diff --git a/www/misc.js b/www/misc.js index 713b5cf..5123e25 100644 --- a/www/misc.js +++ b/www/misc.js @@ -127,8 +127,15 @@ var config = { NL_WIT: 3, NL_WTSB: 3, }, + networkBlacklist: ['NL', 'X5'], }, }; +var networkText = { + GE: 'GEOFON Program, GFZ Potsdam, Germany', + GR: 'German Regional Seismic Network, BGR Hannover, Germany', + NL: 'Netherlands Seismic Network, The Netherlands', + RN: 'RuhrNet - Ruhr-University Bochum, Germany', +}; /********************************************************************** * document ready * @@ -168,6 +175,7 @@ $(document).ready(function() { var tabOptions = { active: 0, disabled: [2, 3], + activate: function( event, ui ) { ui['newPanel'].find('table').trigger("update", [true]); }, }; $('#tabs').tabs(tabOptions); }); diff --git a/www/stations.js b/www/stations.js index 33c7f2b..eb826ca 100644 --- a/www/stations.js +++ b/www/stations.js @@ -40,6 +40,7 @@ function loadStations(stime, etime) { var request_data = { endafter: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()), startbefore: sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate()), + level: 'station', minlat: S-config['map']['latlngDelta'], maxlat: N+config['map']['latlngDelta'], minlon: W-config['map']['latlngDelta'], @@ -53,19 +54,27 @@ function loadStations(stime, etime) { success: function (xml) { $(xml).find('Network').each(function () { var network = $(this).attr('code'); - $(this).find('Station').each(function () { - var station = $(this).attr('code'), - lat = $(this).find('Latitude').text(), - lng = $(this).find('Longitude').text(), - stationID = network+'_'+station, - stationText = network+'.'+station; - if ( !stationTable[stationID] ) { // && N >= lat && S <= lat && W<= lng && E >= lng - var row = sprintf('%s%s%7.4f%7.4f' , network, station, Number(lat), Number(lng)); - var r = $(row); - $('#stationstable tbody').append(r); - addStationMarker(stationID, Number(lat), Number(lng), stationText.toUpperCase()); - }; - }); + if ( $.inArray(network, config['station']['networkBlacklist'])<0 ) { + $(this).find('Station').each(function () { + var station = $(this).attr('code'), + lat = $(this).find('Latitude').text(), + lng = $(this).find('Longitude').text(), + stationID = network+'_'+station, + stationText = network+'.'+station; + if ( !stationTable[stationID] ) { + // general station info (1st line) + var row = sprintf('%s%s%7.4f%7.4f' , network, station, Number(lat), Number(lng)); + // setting up network details (2nd line) + row += sprintf('%s', networkText[network] || ''); + // setting up station details (3rd line) + row += 'not implemented'; + // setting up download links (4th line) + row += 'not implemented'; + $('#stationstable tbody').append(row); + addStationMarker(stationID, Number(lat), Number(lng), stationText.toUpperCase()); + }; + }); + }; }); }, complete: function () { @@ -110,7 +119,7 @@ function initStationTable() { // css class names of pager arrows pager_css: { container : 'stations-tablesorter-pager', - errorRow : 'tablesorter-errorRow', // error information row (don't include period at beginning) + errorRow : 'stations-tablesorter-errorRow', // error information row (don't include period at beginning) disabled : 'disabled' // class added to arrows @ extremes (i.e. prev/first arrows "disabled" on first page) }, // jQuery pager selectors @@ -126,7 +135,7 @@ function initStationTable() { }, filter_childRows : true, - filter_cssFilter : 'tablesorter-filter', + filter_cssFilter : 'stations-tablesorter-filter', filter_startsWith : false, filter_ignoreCase : true, scroller_height: $('div.map').height() - 250, @@ -137,6 +146,12 @@ function initStationTable() { showProcessing: true, } }); + // hide child rows + $('#stationstable > tbody > tr.tablesorter-childRow > td').hide(); + // update map after filtering + // $('#stationsstable').bind('filterEnd', function(){ + // toggleFilteredMarkers(); + // }); }; /********************************************************************** @@ -144,4 +159,30 @@ function initStationTable() { **********************************************************************/ $(document).ready(function() { loadStations(); + // show / hide station info + $('#stationstable').delegate('.toggle', 'click' , function(){ + // toggle visibility of selected row + $(this).closest('tr').nextUntil('tr.tablesorter-hasChildRow').find('td').toggle('slow'); + // mark currently selected row and remove class selected from all other rows + // hide other rows + $(this).closest('tr').nextUntil('tr.tablesorter-hasChildRow').find('td').addClass('selected-now'); + $(this).closest('tbody').find('td.selected').each(function(){ + if ( ! $(this).hasClass('selected-now') ) { + $(this).hide(); + $(this).removeClass('selected'); + }; + }); + $(this).closest('tr').nextUntil('tr.tablesorter-hasChildRow').find('td').each(function(){ + $(this).removeClass('selected-now'); + var selected = $(this).hasClass('selected'); + if ( selected ) { + $(this).removeClass('selected'); + //highlightFirstEvent(); + } else { + $(this).addClass('selected'); + //toggleHighlightStation($(this).attr('stationid')); + }; + }); + return false; + }); });