// Uses zoomlevel and mouseposition to call the nodelist.py view. View returns nodes in json format which is read and printed in document element. function getNodeList(zoomlevel, mousepos){ $.getJSON("/website/nodelist/" + zoomlevel + "," + mousepos.lat + "," + mousepos.lon, function(json){ content = 'Wireless Leiden nodes on mouseposition:
'; $.each(json, function(i,json){ content += json.fields.ssid + '
'; }); content += '
'; $("#node_list").html(content); } ); } // Right way to get url parameters?: http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery/1404100#1404100 function getURLParameter(name) { return decodeURI( (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1] ); } $(document).ready(function() { var signallayer = ''; var userlist = new Array(); var nodelist = new Array(); // add colour picker $("#colour").colorPicker(); // add date picker for start date $("#start_date").datepicker({ dateFormat: "dd/mm/yy", onSelect: function(dateValue, inst){ $("#end_date").datepicker("option", "minDate", dateValue); } }); // add date picker for end date $("#end_date").datepicker({ dateFormat: "dd/mm/yy", }); // add slider for signal strength filter $("#slider").slider({ range: true, min: 0, max: 100, values: [0, 100], // while sliding, it changes the text above the slider to show the values realtime slide: function(event, sig){ $("#sig_value").text("Signal strength: " + sig.values[0] + " - " + sig.values[1]); }, // on slider stop, it tries to delete the old layer and creates a new layer with the slider values stop: function(event, sig){ if(signallayer){ map.removeLayer(signallayer); } OpenLayers.Layer.OSM.Overlay = OpenLayers.Class(OpenLayers.Layer.OSM, { initialize: function(name, options) { var url = [ "/website/tile/${z}/${x},${y}.png?colour=0,255,0&signaal__gte=" + sig.values[0] + "&signaal__lte=" + sig.values[1] ]; options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); var newArguments = [name, url, options]; OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); }, CLASS_NAME: "OpenLayers.Layer.Overlay" }); signallayer = new OpenLayers.Layer.OSM.Overlay("Signal strength: " + sig.values[0] + " - " + sig.values[1], {isBaseLayer: false, visibility: true}); map.addLayer(signallayer); }, }); // menu toggle $("#menu_filter").click(function(){ $("#filter").slideToggle("fast"); $("#info").slideUp("fast"); }); $("#menu_info").click(function(){ $("#filter").slideUp("fast"); $("#info").slideToggle("fast"); }); // Fastest?: http://stackoverflow.com/questions/170986/what-is-the-best-way-to-add-options-to-a-select-from-an-array-with-jquery $.getJSON("/website/filters/", function(json) { $.each(json, function(i,json){ $("#select_user").append($("