diff --git a/www/misc.js b/www/misc.js index 702a3d1..54d7f60 100644 --- a/www/misc.js +++ b/www/misc.js @@ -71,6 +71,17 @@ $( window ).resize(function() { setInfoHeight(); }); +/* parseQueryString */ +function parseQueryString() { + var query = (window.location.search || '?').substr(1), + map = {}; + query.replace(/([^&=]+)=?([^&]*)(?:&+|$)/g, function(match, key, value) { + key.toLowerCase(); + (map[key] = map[key] || []).push(value); + }); + return map; +} + /* create global vars */ var map; var openMarkerID; @@ -111,6 +122,21 @@ var config = { * document ready * **********************************************************************/ $(document).ready(function() { + // parse query string + var parameters = parseQueryString(); + if ( Number(parameters['minmag']) ) { + config['event']['minMag'] = Number(parameters['minmag']); + }; + if ( parameters['markercolor'] ) { + config['event']['markerColor'] = parameters['markercolor']; + }; + if ( parameters['markercolorh'] ) { + config['event']['markerColorH'] = parameters['markercolorh']; + }; + if ( Number(parameters['timespan']) ) { + config['map']['timespan'] = Number(parameters['timespan']); + }; + // AJAX setup $.ajaxSetup({timeout: config['ajax']['timeout']});