Ignore:
Timestamp:
Jun 17, 2011, 1:13:58 PM (13 years ago)
Author:
dennisw
Message:

Moved scripts from home.html to heatmap_extensions.js for better overview.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/website/static/heatmap_extensions.js

    r9265 r9267  
    1414
    1515$(document).ready(function() {
     16  var signallayer = '';
    1617  var userlist = new Array();
    1718  var nodelist = new Array();
     19
     20  // add colour picker
     21  $("#colour").colorPicker();
     22
     23  // add date picker for start date
     24  $("#start_date").datepicker({
     25    dateFormat: "dd/mm/yy",
     26    onSelect: function(dateValue, inst){
     27      $("#end_date").datepicker("option", "minDate", dateValue);
     28    }
     29  });
     30
     31  // add date picker for end date
     32  $("#end_date").datepicker({
     33    dateFormat: "dd/mm/yy",
     34  });
     35
     36  // add slider for signal strength filter
     37  $("#slider").slider({
     38    range: true,
     39    min: 0,
     40    max: 100,
     41    values: [0, 100],
     42    // while sliding, it changes the text above the slider to show the values realtime
     43    slide: function(event, sig){
     44      $("#sig_value").text("Signal strength: " + sig.values[0] + " - " + sig.values[1]);
     45    },
     46    // on slider stop, it tries to delete the old layer and creates a new layer with the slider values
     47    stop: function(event, sig){
     48      if(signallayer){
     49        map.removeLayer(signallayer);
     50      }
     51      OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, {
     52        initialize: function(name, options) {
     53          var url = [
     54            "/website/tile/${z}/${x},${y}.png?colour=0,255,0&signaal__gte=" + sig.values[0] + "&signaal__lte=" + sig.values[1]
     55          ];
     56          options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
     57          var newArguments = [name, url, options];
     58          OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
     59        },
     60      CLASS_NAME: "OpenLayers.Layer.Overlay"
     61      });
     62      signallayer = new OpenLayers.Layer.OSM.Overlay("Signal strength: " + sig.values[0] + " - " + sig.values[1], {isBaseLayer: false, visibility: true});
     63      map.addLayer(signallayer);
     64    },
     65  });
     66
     67  // menu toggle
     68  $("#menu_filter").click(function(){
     69    $("#filter").slideToggle("fast");
     70    $("#info").slideUp("fast");
     71  });
     72  $("#menu_info").click(function(){
     73    $("#filter").slideUp("fast");
     74    $("#info").slideToggle("fast");
     75  });
    1876
    1977  // Fastest?: http://stackoverflow.com/questions/170986/what-is-the-best-way-to-add-options-to-a-select-from-an-array-with-jquery
Note: See TracChangeset for help on using the changeset viewer.