Changeset 254


Ignore:
Timestamp:
Oct 31, 2006, 2:23:13 PM (13 years ago)
Author:
David Sheldon
Message:

Show/hide markers. This fixes ticket:51.

Location:
trunk/npemap.org.uk/static/tiles
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/static/tiles/grid.css

    r249 r254  
    160160}
    161161
    162 
     162div#showHideMarkers{
     163        font-size: 60%;
     164}
  • trunk/npemap.org.uk/static/tiles/map.html

    r253 r254  
    7070    <div id="geonames_results"></div>
    7171  </div>
     72        <div id="showHideMarkers">
     73    <p><img src="../images/green-marker.gif" > <a href="javascript:setMarkersHidden()" id="setMarkers">hide markers</a><a href="javascript:unsetMarkersHidden()" id="unsetMarkers" style="display:none">show markers</a></p>
     74        </div>
    7275</div>
    7376  <div id="postcode_detail_window">
     
    101104    <div>
    102105      <input type="text" name="postcode1" id="postcode1" size="4" />
    103       <input type="text" name="postcode2" id="postcode2" size="3" />
    104     </div>
    105     <div><input type="submit" value="submit" /></div>
     106      <input type="text" name="postcode2" id="postcode2" size="3" /> 
     107          </div>
     108                <div> <input type="submit" value="submit" /></div>
    106109  </form>
    107110         <span class="terms">Partial codes are fine e.g. "OX1" or "OX1 3". <!--<a href="" target='_new'>Details</a>.--></span><br/><br/>
  • trunk/npemap.org.uk/static/tiles/mapTiles.js

    r243 r254  
    234234    spinnerElement = $('spinner');
    235235
     236    updateShowMarkers();
    236237    parseQueryString();
    237238    fixZoomButton();
     
    319320
    320321function drawExisting() {
    321   var url = "../../cgi/get-postcodes.fcgi";
    322   url += "?mineasting=" + minEasting + "000&maxeasting="  + maxEasting + "000&minnorthing=" + minNorthing + "000&maxnorthing=" + maxNorthing+"000";
    323   var callback = {
    324     success: successHandler ,
    325     failure: failHander
    326     }
    327  
    328   removeMarkers();
    329   spinnerElement.className = 'loading';
    330   spinnerElement.innerHTML = 'Loading...';
    331   findMarkerOffsets();
    332  
    333   YAHOO.util.Connect.asyncRequest('GET', url, callback); 
    334 
     322        if (shouldWeShowMarkers()) {
     323                var url = "../../cgi/get-postcodes.fcgi";
     324                url += "?mineasting=" + minEasting + "000&maxeasting="  + maxEasting + "000&minnorthing=" + minNorthing + "000&maxnorthing=" + maxNorthing+"000";
     325                var callback = {
     326                        success: successHandler ,
     327                        failure: failHander
     328                        }
     329               
     330                removeMarkers();
     331                spinnerElement.className = 'loading';
     332                spinnerElement.innerHTML = 'Loading...';
     333                findMarkerOffsets();
     334               
     335                YAHOO.util.Connect.asyncRequest('GET', url, callback); 
     336  }
    335337}
    336338
     
    592594}
    593595
     596
     597function shouldWeShowMarkers() {
     598        if (readCookie('hideMarkers')) {
     599                return false;
     600        }
     601        return true;
     602}
     603
     604function setMarkersHidden() {
     605  createCookie("hideMarkers", 'true', 30);
     606        removeMarkers();
     607        updateShowMarkers();
     608}
     609
     610function unsetMarkersHidden() {
     611  eraseCookie("hideMarkers");
     612        drawExisting();
     613        updateShowMarkers();
     614}
     615
     616function updateShowMarkers() {
     617  if (shouldWeShowMarkers()) {
     618    $('setMarkers').style.display = '';
     619    $('unsetMarkers').style.display = 'none';
     620        } else {
     621    $('setMarkers').style.display = 'none';
     622    $('unsetMarkers').style.display = '';
     623        }
     624}
     625
     626
     627function createCookie(name,value,days) {
     628        if (days) {
     629                var date = new Date();
     630                date.setTime(date.getTime()+(days*24*60*60*1000));
     631                var expires = "; expires="+date.toGMTString();
     632        }
     633        else var expires = "";
     634        document.cookie = name+"="+value+expires+"; path=/";
     635}
     636
     637function readCookie(name) {
     638        var nameEQ = name + "=";
     639        var ca = document.cookie.split(';');
     640        for(var i=0;i < ca.length;i++) {
     641                var c = ca[i];
     642                while (c.charAt(0)==' ') c = c.substring(1,c.length);
     643                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
     644        }
     645        return null;
     646}
     647
     648function eraseCookie(name) {
     649        createCookie(name,"",-1);
     650}
Note: See TracChangeset for help on using the changeset viewer.