Changeset 26160


Ignore:
Timestamp:
2012-09-11T10:14:44+12:00 (12 years ago)
Author:
sjm84
Message:

Added a button that turns the scrolling through places on and off, also flipped the markers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js

    r26141 r26160  
    1717{
    1818    modifyFunctions();
    19    
    2019    setUpMap();
    2120   
     
    4544    if(_docList.ids.length > 1)
    4645    {
     46        var startStopCheckbox = document.createElement("input");
     47        startStopCheckbox.setAttribute("type", "checkbox");
     48        startStopCheckbox.setAttribute("checked", "true");
     49        startStopCheckbox.onclick = function()
     50        {
     51            if(startStopCheckbox.checked)
     52            {
     53                if(_intervalHandle == null)
     54                {
     55                    _intervalHandle = setInterval(loopThroughMarkers, 2000);
     56                }
     57            }
     58            else
     59            {
     60                clearInterval(_intervalHandle);
     61                _intervalHandle = null;
     62            }
     63        };
     64       
     65        var label = document.createElement("span");
     66        label.innerHTML = "Scroll through places";
     67       
     68        var container = document.createElement("DIV");
     69        container.appendChild(startStopCheckbox);
     70        container.appendChild(label);
     71        container.setAttribute("class", "ui-widget-header ui-corner-all");
     72        container.setAttribute("style", "clear:right; float:right; padding:0px 5px 3px 0px;");
     73
     74        $(container).insertAfter("#map_canvas");
     75       
    4776        _intervalHandle = setInterval(loopThroughMarkers, 2000);
    4877    }
     
    337366    {
    338367        clearInterval(_intervalHandle);
     368        _intervalHandle = null;
    339369        _map.panTo(new google.maps.LatLng(doc.lat, doc.lng));
    340370        clearAllInfoBoxes();
     
    357387    var marker
    358388    if(mainMarker)
     389    {
     390        marker = new google.maps.Marker
     391        ({
     392            position: pos,
     393            title:doc.title,
     394            map:_map
     395        });
     396    }
     397    else
    359398    {
    360399        marker = new google.maps.Marker
     
    364403            map:_map,
    365404            icon:"interfaces/" + gs.xsltParams.interface_name + "/images/bluemarker.png"
    366         });
    367     }
    368     else
    369     {
    370         marker = new google.maps.Marker
    371         ({
    372             position: pos,
    373             title:doc.title,
    374             map:_map
    375405        });
    376406    }
Note: See TracChangeset for help on using the changeset viewer.