Changeset 9302 for src/django_gheat/website/static/heatmap_extensions.js
- Timestamp:
- Jun 27, 2011, 4:00:01 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/website/static/heatmap_extensions.js
r9297 r9302 1 // Uses zoomlevel and mouseposition to call the nodelist.py view. View returns nodes in json format which is read and printed in document element. 1 /** 2 * Uses zoomleven and mouseposition to call nodelist.py view. 3 * View returns nodes in json format, values are printed in doc element. 4 */ 2 5 function getNodeList(zoomlevel, mousepos){ 3 6 $.getJSON("/website/nodelist/" + zoomlevel + "," + mousepos.lat + "," + mousepos.lon, … … 13 16 } 14 17 15 // Right way to get url parameters?: http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery/1404100#1404100 18 /** 19 * Right way to get url parameters? 20 * http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery/1404100#1404100 21 */ 16 22 function getURLParameter(name) { 17 23 return decodeURI( … … 25 31 var nodelist = new Array(); 26 32 27 // add colour picker 33 /** 34 * Adds colourpicker for layer colour. 35 * Function set in: 'colourpicker.js' 36 */ 28 37 $("#colour").colorPicker(); 29 38 30 // add date picker for start date 39 /** 40 * Adds datepicker for start & end date 41 * Function set in: 'jquery-ui-1.8.13.custom.min.js' 42 */ 31 43 $("#start_date").datepicker({ 32 44 dateFormat: "dd/mm/yy", … … 35 47 } 36 48 }); 37 38 // add date picker for end date39 49 $("#end_date").datepicker({ 40 50 dateFormat: "dd/mm/yy", 41 51 }); 42 52 43 // add slider for signal strength filter 53 /** 54 * Adds slider for signal strength layer. 55 * Function set in: 'jquery-ui-1.8.13.custom.min.js' 56 */ 44 57 $("#slider").slider({ 45 58 range: true, … … 61 74 }); 62 75 63 // toggle layer visibility 76 /** 77 * Toggles layer visibility on checkbox use from layerswitcher. 78 */ 64 79 $("#togglelayer").live('click', function(){ 65 80 status = $(this).attr("checked"); … … 69 84 }); 70 85 71 // toggle layer visibility per category 86 /** 87 * Toggles layer visibility per category on checkbox use from layerswitcher. 88 */ 72 89 $("#togglecat").live("click", function(){ 73 90 if($(this).attr("checked")){ … … 87 104 }); 88 105 89 // remove layer 106 /** 107 * Removes layer from map and layerswitcher. 108 */ 90 109 $("#rmvlayer").live("click", function(){ 91 110 layername = $(this).closest('span').attr('id'); … … 95 114 }); 96 115 97 // menu toggle 116 /** 117 * Toggles text shown on website. 118 * 'info' shows info text. 119 * 'filter' page shows text on filters & filter options. 120 */ 98 121 $("#menu_filter").click(function(){ 99 122 $("#filter").slideToggle("fast"); … … 105 128 }); 106 129 107 // switcher toggle 130 /** 131 * Toggles layerswitcher visibility. 132 * On 'off', toggler shows a '+'. 133 * On 'on', toggler shows a '-'. 134 */ 108 135 $("#layer_switcher_toggle").click(function(){ 109 136 $("#layer_switcher").toggle(); … … 116 143 }); 117 144 118 // Fastest?: http://stackoverflow.com/questions/170986/what-is-the-best-way-to-add-options-to-a-select-from-an-array-with-jquery 145 /** 146 * Fastest? 147 * http://stackoverflow.com/questions/170986/what-is-the-best-way-to-add-options-to-a-select-from-an-array-with-jquery 148 */ 119 149 $.getJSON("/website/filters/", 120 150 function(json) { … … 123 153 userlist.push(json.gebruiker); 124 154 $.each(json.meetrondje, function(m, meetrondje){ 155 console.log(meetrondje.datum); 125 156 $("#select_dataset").append($("<option/>").attr({"class":json.gebruiker, "value":meetrondje.naam}).text(meetrondje.naam)); 126 157 $.each(meetrondje.nodes, function(n, nodes){ … … 138 169 ); 139 170 140 // add filter per user 171 /** 172 * Earlier process got all users in JSON and put them in array. 173 * For each user in array, new layer is added with username as parameter. 174 * Layercolour is randomized. 175 * If button is pressed again, layers will be deleted. 176 */ 141 177 $('#user_filter').click(function(){ 142 178 if(this.text=='(Add all users)'){ … … 169 205 }); 170 206 171 // add filter per node 207 /** 208 * Earlier process got all nodes in JSON and put them in array. 209 * For each node in array, new layer is added with node as parameter. 210 * Layercolour is randomized. 211 * If button is pressed again, layers will be deleted. 212 */ 172 213 $('#node_filter').click(function(){ 173 214 if(this.text=='(Add all nodes)'){ … … 201 242 }); 202 243 203 // add custom filter 244 /** 245 * Adds a new layer when clicked. 246 * Filters set by user are used as layer parameters. 247 * Colour is either chosen or randomized. 248 * Blank parameters are ignored. 249 */ 204 250 $('#add_filter').click(function(){ 205 // get values from elements251 // get values from elements 206 252 user = $('#select_user option:selected').text(); 207 253 dataset = $('#select_dataset option:selected').text(); … … 212 258 lname = encodeURIComponent(document.getElementById("lname").value); 213 259 214 // HEX to RGB: http://stackoverflow.com/questions/5798868/need-some-tips-with-how-to-convert-a-hexadecimal-color-value-to-a-rgb-one/5798900#5798900 215 // '#' comes out as '%23', so substr() starts at char 3 260 /** 261 * On HEX to RGB: 262 * http://stackoverflow.com/questions/5798868/need-some-tips-with-how-to-convert-a-hexadecimal-color-value-to-a-rgb-one/5798900#5798900 263 * Note that '#' comes out as '%23', so substr() starts at char 3 264 */ 216 265 colour = parseInt((colour.substr(3, 2)),16) + ',' + parseInt((colour.substr(5, 2)),16) + ',' + parseInt((colour.substr(7, 2)),16); 217 266
Note:
See TracChangeset
for help on using the changeset viewer.