Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bf952934a |
No files matched your search
+16
-3
@@ -1,4 +1,17 @@
|
||||
* text=auto !eol
|
||||
/mapkey.js -text
|
||||
/mapkey_yearly.js -text
|
||||
/quakes2kml.py -text
|
||||
www/TileLayer.Grayscale.js -text
|
||||
www/first.png -text
|
||||
www/jquery.localtime-0.9.1.min.js -text
|
||||
www/jquery.tablesorter.min.js -text
|
||||
www/jquery.tablesorter.pager.css -text
|
||||
www/jquery.tablesorter.pager.min.js -text
|
||||
www/jquery.tablesorter.widgets.min.js -text
|
||||
www/last.png -text
|
||||
www/leaflet.css -text
|
||||
www/leaflet.js -text
|
||||
www/logo_RUB_155x30.png -text
|
||||
www/next.png -text
|
||||
www/prev.png -text
|
||||
www/sprintf.min.js -text
|
||||
www/theme.blue.css -text
|
||||
www/widget-pager.js -text
|
||||
+2
-1
@@ -1 +1,2 @@
|
||||
/*.kml
|
||||
www/event.xml
|
||||
www/stations.xml
|
||||
-92
@@ -1,92 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
|
||||
<!-- $Id$ -->
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
||||
<title>RUB SeisObs - Station and Seismicity Map</title>
|
||||
<style type="text/css">
|
||||
html, body, #map {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
#maptext {
|
||||
position: absolute;
|
||||
bottom: 1em;
|
||||
left: 1em;
|
||||
width: 20%;
|
||||
z-index: 15000;
|
||||
background-color: white;
|
||||
padding: 0 0.5em 0.5em 0.5em;
|
||||
}
|
||||
|
||||
#mapkey {
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
left: 80px;
|
||||
width: 420px;
|
||||
height: 80px;
|
||||
z-index: 20000;
|
||||
background: rgb(255, 255, 255);
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
padding: 0px 0px 0px 0px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<style type="text/css">
|
||||
.olControlAttribution {
|
||||
position: absolute;
|
||||
font-size: 10px;
|
||||
text-align: left;
|
||||
color: #eeeeee;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right:auto !important;
|
||||
background: #130085; /* fallback for IE - IE6 requires background shorthand*/
|
||||
background: rgba(0, 60, 136, 0.3);
|
||||
filter: alpha(opacity=30);
|
||||
font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
|
||||
border-radius: 5px 0 0 0;
|
||||
}
|
||||
.olControlAttribution a {
|
||||
color: #eeeeee;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript' src='OpenLayers.js'></script>
|
||||
<script type='text/javascript' src='https://maps.google.com/maps/api/js?sensor=false&v=3'></script>
|
||||
<script type='text/javascript' src='station_map_www.js'></script>
|
||||
<script type='text/javascript' src='mapkey.js'></script>
|
||||
<script type='text/javascript' src='lang/de.js'></script>
|
||||
<script type='text/javascript'>
|
||||
OpenLayers.Util.extend(OpenLayers.Lang.de, {
|
||||
'Overlays' : 'Ebenen',
|
||||
'Stations' : 'Stationen',
|
||||
'Events': 'Ereignisse',
|
||||
'Grid': 'Gitter',
|
||||
'Google Maps (Terrain)': 'Google Maps (Gelände)',
|
||||
'Google Maps (Satellite)': 'Google Maps (Satellit)',
|
||||
'Google Maps (Streets)': 'Google Maps (Straßen)',
|
||||
'Year': 'Jahr',
|
||||
'Magnitudes': 'Magnituden',
|
||||
'Magnitude': 'Magnitude',
|
||||
'stations': 'Stationen',
|
||||
'Zoom in to resolve individual stations.': 'Zum Anzeigen der einzelnen Stationen vergrößern.'
|
||||
});
|
||||
OpenLayers.Lang.setCode(document.documentElement.lang);
|
||||
</script>
|
||||
<div id="map">
|
||||
<script type='text/javascript'>init(true, true, true, false);</script>
|
||||
</div>
|
||||
<div id="mapkey">
|
||||
<script type='text/javascript'>initKey(true, false, false);</script>
|
||||
</div>
|
||||
<!-- <div id="maptext">
|
||||
<h3 id="title">Stations</h3>
|
||||
</div> -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* JavaScript code to generate maps used by the
|
||||
* Seismological Observatory of the Ruhr-University Bochum
|
||||
*
|
||||
* Copyright 2012 Kasper D. Fischer <kasper.fischer@rub.de>
|
||||
*
|
||||
* License
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* $Id: station_map.js 321 2012-02-13 14:52:11Z kasper $
|
||||
|
||||
*/
|
||||
|
||||
/* Global variables */
|
||||
var mapkey;
|
||||
|
||||
/* Main function to create the map */
|
||||
function initKey(showMag, showAge, showStation) {
|
||||
|
||||
/* Creating map */
|
||||
wgs84 = new OpenLayers.Projection("EPSG:4326");
|
||||
mapkey = new OpenLayers.Map(
|
||||
'mapkey',
|
||||
{
|
||||
projection: wgs84,
|
||||
displayProjection: wgs84,
|
||||
controls: []
|
||||
}
|
||||
);
|
||||
|
||||
// Show Magnitudes
|
||||
mag_layer = new OpenLayers.Layer.Vector(
|
||||
'Magnitude Scale',
|
||||
{
|
||||
projection: wgs84,
|
||||
isBaseLayer: true
|
||||
}
|
||||
);
|
||||
|
||||
// Adding custom style for Magnitudes
|
||||
var mag_style_default = new OpenLayers.Style({
|
||||
fillColor: '#ff0000', fillOpacity: 0.2,
|
||||
strokeColor: '#ff0000', strokeWidth: 2,
|
||||
pointRadius: "${pntsize}",
|
||||
label: "${text}", labelXOffset: "${offset}",
|
||||
graphicName: 'circle'
|
||||
});
|
||||
var mag_style_map = new OpenLayers.StyleMap({
|
||||
'default': mag_style_default
|
||||
});
|
||||
mag_layer.styleMap = mag_style_map;
|
||||
|
||||
// Adding points as map key, size: mag*3.5+2.0
|
||||
var pointt = new OpenLayers.Geometry.Point(-10, 0);
|
||||
var mag_pointt = new OpenLayers.Feature.Vector(pointt, {pntsize: 0, text: 'Magnitude', offset: 2});
|
||||
var point0 = new OpenLayers.Geometry.Point(0, 0);
|
||||
var mag_point0 = new OpenLayers.Feature.Vector(point0, {pntsize: 0.5*3.5+2.0, text: '0.5', offset: 17});
|
||||
var point1 = new OpenLayers.Geometry.Point(10, 0);
|
||||
var mag_point1 = new OpenLayers.Feature.Vector(point1, {pntsize: 1.5*3.5+2.0, text: '1.5', offset: 20.5});
|
||||
var point2 = new OpenLayers.Geometry.Point(20, 0);
|
||||
var mag_point2 = new OpenLayers.Feature.Vector(point2, {pntsize: 2.5*3.5+2.0, text: '2.5', offset: 24.0});
|
||||
var point3 = new OpenLayers.Geometry.Point(30, 0);
|
||||
var mag_point3 = new OpenLayers.Feature.Vector(point3, {pntsize: 3.5*3.5+2.0, text: '3.5', offset: 27.5});
|
||||
mag_layer.addFeatures([mag_pointt, mag_point0, mag_point1, mag_point2, mag_point3]);
|
||||
|
||||
|
||||
mapkey.addLayer(mag_layer);
|
||||
mag_layer.setVisibility(true);
|
||||
|
||||
// Set initial view
|
||||
if (!mapkey.getCenter()) {
|
||||
mapkey.setCenter(0,0);
|
||||
mapkey.zoomToExtent(mag_layer.getDataExtent());
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
mapkey.js
|
||||
-90
@@ -1,90 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
|
||||
<!-- $Id$ -->
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
||||
<title>RUB SeisObs - Station and Seismicity Map</title>
|
||||
<style type="text/css">
|
||||
html, body, #map {
|
||||
margin: 0;
|
||||
width: 1440px;
|
||||
height: 900px;
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
#maptext {
|
||||
position: absolute;
|
||||
bottom: 1em;
|
||||
left: 1em;
|
||||
width: 20%;
|
||||
z-index: 15000;
|
||||
background-color: white;
|
||||
padding: 0 0.5em 0.5em 0.5em;
|
||||
}
|
||||
|
||||
#mapkey {
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
left: 80px;
|
||||
width: 320px;
|
||||
height: 34px;
|
||||
z-index: 20000;
|
||||
background: rgb(255, 255, 255);
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
padding: 0px 0px 0px 0px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<style type="text/css">
|
||||
.olControlAttribution {
|
||||
position: absolute;
|
||||
font-size: 10px;
|
||||
text-align: left;
|
||||
color: #eeeeee;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right:auto !important;
|
||||
background: #130085; /* fallback for IE - IE6 requires background shorthand*/
|
||||
background: rgba(0, 60, 136, 0.3);
|
||||
filter: alpha(opacity=30);
|
||||
font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
|
||||
border-radius: 5px 0 0 0;
|
||||
}
|
||||
.olControlAttribution a {
|
||||
color: #eeeeee;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript' src='OpenLayers.js'></script>
|
||||
<script type='text/javascript' src='https://maps.google.com/maps/api/js?sensor=false&v=3'></script>
|
||||
<script type='text/javascript' src='station_map_www.js'></script>
|
||||
<script type='text/javascript' src='mapkey.js'></script>
|
||||
<script type='text/javascript' src='lang/de.js'></script>
|
||||
<script type='text/javascript'>
|
||||
OpenLayers.Util.extend(OpenLayers.Lang.de, {
|
||||
'Overlays' : 'Ebenen',
|
||||
'Stations' : 'Stationen',
|
||||
'Events': 'Ereignisse',
|
||||
'Grid': 'Gitter',
|
||||
'Google Maps (Terrain)': 'Google Maps (Gelände)',
|
||||
'Google Maps (Satellite)': 'Google Maps (Satellit)',
|
||||
'Google Maps (Streets)': 'Google Maps (Straßen)',
|
||||
'Magnitudes': 'Magnituden',
|
||||
'stations': 'Stationen',
|
||||
'Zoom in to resolve individual stations.': 'Zum Anzeigen der einzelnen Stationen vergrößern.'
|
||||
});
|
||||
OpenLayers.Lang.setCode(document.documentElement.lang);
|
||||
</script>
|
||||
<div id="map">
|
||||
<script type='text/javascript'>init(true, true, true, true);</script>
|
||||
</div>
|
||||
<div id="mapkey">
|
||||
<script type='text/javascript'>initKey(true, false, false);</script>
|
||||
</div>
|
||||
<!-- <div id="maptext">
|
||||
<h3 id="title">Stations</h3>
|
||||
</div> -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,95 +0,0 @@
|
||||
#! /usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Creates KML file with station info.
|
||||
|
||||
License
|
||||
Copyright 2012 Kasper D. Fischer <kasper.fischer@rub.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
$Id: stations.py 311 2012-01-31 14:34:31Z kasper $
|
||||
"""
|
||||
|
||||
import csv, os, shutil, sys
|
||||
import simplekml
|
||||
from obspy.core import UTCDateTime
|
||||
|
||||
# create new empty KML file
|
||||
kml = simplekml.Kml()
|
||||
|
||||
# create empyt folder to contain styles and stations
|
||||
quakes_folder = kml.newfolder(name="Earthquakes")
|
||||
|
||||
# style of broad-band stations
|
||||
quake1m_style = simplekml.Style()
|
||||
quake1m_style.iconstyle.color = 'ff0000ff'
|
||||
quake1m_style.iconstyle.icon.href = 'circle'
|
||||
|
||||
# style of short periode stations
|
||||
quake1y_style = simplekml.Style()
|
||||
quake1y_style.iconstyle.color = 'ffff00ff'
|
||||
|
||||
# style of short periode stations
|
||||
quakeAll_style = simplekml.Style()
|
||||
quakeAll_style.iconstyle.color = 'ff00ffff'
|
||||
|
||||
# reading earthquake list
|
||||
events = []
|
||||
num_header = 0
|
||||
with open('quakes.txt', 'rb') as f:
|
||||
reader = csv.reader(f, delimiter='\t')
|
||||
try:
|
||||
for row in reader:
|
||||
if ( reader.line_num <= num_header ):
|
||||
header = row
|
||||
else:
|
||||
events.append(row)
|
||||
except csv.Error, e:
|
||||
sys.exit('file {0}, line {1}: {2}'.format('quakes.txt', reader.line_num, e))
|
||||
|
||||
# adding station markers
|
||||
for event in events:
|
||||
eventTime = UTCDateTime(event[0]+' '+event[1])
|
||||
nowTime = UTCDateTime()
|
||||
lat = event[2]
|
||||
lon = event[3]
|
||||
mag = event[4]
|
||||
region = event[5]
|
||||
|
||||
pnt = quakes_folder.newpoint(
|
||||
name = region,
|
||||
coords = [(lon, lat)],
|
||||
description = "<p>Magnitude {0}<br>Time {1}<br>Location {2}N {3}E</p>".format(
|
||||
mag, eventTime.strftime('%Y-%m-%d %H:%M:%S'), lat, lon)
|
||||
)
|
||||
pnt.extendeddata.newdata('mag', mag)
|
||||
pnt.extendeddata.newdata('lat', lat)
|
||||
pnt.extendeddata.newdata('lon', lon)
|
||||
pnt.extendeddata.newdata('time', eventTime.strftime('%Y-%m-%d %H:%M:%S'))
|
||||
pnt.extendeddata.newdata('age', nowTime-eventTime)
|
||||
pnt.extendeddata.newdata('pntsize', float(mag)*3.5+2)
|
||||
if (( nowTime - eventTime ) > 60*60*24*30 ):
|
||||
pnt.extendeddata.newdata('pntcolor', '#ffa500')
|
||||
pnt.style = quake1y_style
|
||||
elif (( nowTime - eventTime ) > 60*60*24*365 ):
|
||||
pnt.extendeddata.newdata('pntcolor', '#ffff00')
|
||||
pnt.style = quakeAll_style
|
||||
else:
|
||||
pnt.extendeddata.newdata('pntcolor', '#ff0000')
|
||||
pnt.style = quake1m_style
|
||||
|
||||
|
||||
# saving the KML file
|
||||
kml.save('quakes.kml')
|
||||
@@ -1,455 +0,0 @@
|
||||
/*
|
||||
* JavaScript code to generate maps used by the
|
||||
* Seismological Observatory of the Ruhr-University Bochum
|
||||
*
|
||||
* Copyright 2013 Kasper D. Fischer <kasper.fischer@rub.de>
|
||||
*
|
||||
* License
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* $Id$
|
||||
|
||||
*/
|
||||
|
||||
/* Global variables */
|
||||
var map, mapargs;
|
||||
|
||||
/* Main function to create the map */
|
||||
function init(showGoogle, showStations, showQuakes, noFrils) {
|
||||
|
||||
/* get parameters from url */
|
||||
mapargs = OpenLayers.Util.getParameters();
|
||||
if (mapargs['print']) {
|
||||
if (mapargs['print'] == 'true') {
|
||||
noFrils = true;
|
||||
} else {
|
||||
noFrils = false;
|
||||
}
|
||||
}
|
||||
if (mapargs['quakes']) {
|
||||
if (mapargs['quakes'] == 'true') {
|
||||
showQuakes = true;
|
||||
} else {
|
||||
showQuakes = false;
|
||||
}
|
||||
}
|
||||
if (mapargs['stations']) {
|
||||
if (mapargs['stations'] == 'true') {
|
||||
showStations = true;
|
||||
} else {
|
||||
showStations = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Creating map */
|
||||
if ( !noFrils ) {
|
||||
map = new OpenLayers.Map(
|
||||
'map',
|
||||
{
|
||||
projection: new OpenLayers.Projection('EPSG:900913'),
|
||||
displayProjection: new OpenLayers.Projection('EPSG:4326'),
|
||||
controls: [
|
||||
new OpenLayers.Control.Attribution(),
|
||||
new OpenLayers.Control.KeyboardDefaults(),
|
||||
new OpenLayers.Control.LayerSwitcher({}),
|
||||
new OpenLayers.Control.MousePosition(),
|
||||
new OpenLayers.Control.Navigation(),
|
||||
new OpenLayers.Control.OverviewMap(),
|
||||
new OpenLayers.Control.PanZoomBar({zoomWorldIcon: true}),
|
||||
new OpenLayers.Control.Permalink({anchor: noFrils}),
|
||||
new OpenLayers.Control.ScaleLine({geodesic: true})
|
||||
]
|
||||
}
|
||||
);
|
||||
} else {
|
||||
map = new OpenLayers.Map(
|
||||
'map',
|
||||
{
|
||||
projection: new OpenLayers.Projection('EPSG:900913'),
|
||||
displayProjection: new OpenLayers.Projection('EPSG:4326'),
|
||||
controls: [
|
||||
new OpenLayers.Control.Attribution(),
|
||||
new OpenLayers.Control.KeyboardDefaults(),
|
||||
new OpenLayers.Control.Navigation(),
|
||||
new OpenLayers.Control.Permalink({anchor: noFrils}),
|
||||
new OpenLayers.Control.ScaleLine({geodesic: true})
|
||||
]
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/* Base Layers */
|
||||
// OpenStreetMap
|
||||
var osmde_map_layer = new OpenLayers.Layer.OSM(
|
||||
'OpenStreetMap (DE)',
|
||||
[
|
||||
"http://a.tile.openstreetmap.de/tiles/osmde/${z}/${x}/${y}.png",
|
||||
"http://b.tile.openstreetmap.de/tiles/osmde/${z}/${x}/${y}.png",
|
||||
"http://c.tile.openstreetmap.de/tiles/osmde/${z}/${x}/${y}.png"
|
||||
],
|
||||
{
|
||||
attribution: 'Kartenbasis: Daten von <a href="http://www.openstreetmap.org/">OpenStreetMap</a> - Veröffentlicht unter <a href="http://opendatacommons.org/licenses/odbl/">ODbL</a><br />' +
|
||||
'Seismische Daten von <a href="http://www.gmg.ruhr-uni-bochum.de/geophysik/seisobs">Ruhr-Universität Bochum</a> - Veröffentlicht unter <a href="http://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>'
|
||||
}
|
||||
);
|
||||
var osm_map_layer = new OpenLayers.Layer.OSM('OpenStreetMap (Standard)');
|
||||
map.addLayers([
|
||||
osm_map_layer,
|
||||
osmde_map_layer
|
||||
]);
|
||||
|
||||
// Google Maps
|
||||
if (showGoogle) {
|
||||
var googleT_map_layer = new OpenLayers.Layer.Google(
|
||||
OpenLayers.i18n('Google Maps (Terrain)'),
|
||||
{type: google.maps.MapTypeId.TERRAIN,transitionEffect: "resize"}
|
||||
);
|
||||
var googleS_map_layer = new OpenLayers.Layer.Google(
|
||||
OpenLayers.i18n("Google Maps (Satellite)"),
|
||||
{type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22,transitionEffect: "resize"}
|
||||
);
|
||||
var googleH_map_layer = new OpenLayers.Layer.Google(
|
||||
'Google Maps (Hybrid)',
|
||||
{type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20,transitionEffect: "resize"}
|
||||
);
|
||||
var googleM_map_layer = new OpenLayers.Layer.Google(
|
||||
OpenLayers.i18n("Google Maps (Streets)"),
|
||||
{numZoomLevels: 20,transitionEffect: "resize"}
|
||||
);
|
||||
map.addLayers([
|
||||
googleT_map_layer,
|
||||
googleS_map_layer,
|
||||
googleH_map_layer,
|
||||
googleM_map_layer
|
||||
]);
|
||||
};
|
||||
|
||||
// OpenMapQuest
|
||||
var omq_map_layer = new OpenLayers.Layer.OSM(
|
||||
'OpenMapQuest',
|
||||
[
|
||||
"http://otile1.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg",
|
||||
"http://otile2.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg",
|
||||
"http://otile3.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg",
|
||||
"http://otile4.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg"
|
||||
],
|
||||
{
|
||||
attribution: 'Kartenbasis: Daten von <a href="http://www.openstreetmap.org/">OpenStreetMap</a> - Veröffentlicht unter <a href="http://opendatacommons.org/licenses/odbl/">ODbL</a><br />' +
|
||||
'Seismische Daten von <a href="http://www.gmg.ruhr-uni-bochum.de/geophysik/seisobs">Ruhr-Universität Bochum</a> - Veröffentlicht unter <a href="http://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>'
|
||||
}
|
||||
);
|
||||
map.addLayers([omq_map_layer]);
|
||||
|
||||
// ESRI
|
||||
/* var esri_map_layer = new OpenLayers.Layer.XYZ(
|
||||
'ESRI',
|
||||
"https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/${z}/${y}/${x}",
|
||||
{
|
||||
sphericalMercator: true,
|
||||
attribution: 'Copyright © 2013 by ESRI. ' +
|
||||
'This work is licensed under the Web Services and API <a href="http://links.esri.com/agol_tou" target="_blank">Terms of Use</a>.'
|
||||
}
|
||||
);
|
||||
map.addLayers([esri_map_layer]); */
|
||||
|
||||
// Show quakes
|
||||
quakes_layer = loadKML(OpenLayers.i18n("Events"), 'quakes.kml', false, true);
|
||||
quakes_layer.events.on({'loadend': setQuakesMapkeyVisibility});
|
||||
quakes_layer.events.on({'visibilitychanged': setQuakesMapkeyVisibility});
|
||||
map.addLayer(quakes_layer);
|
||||
quakes_layer.setVisibility(showQuakes);
|
||||
|
||||
// color coding of events
|
||||
var day2sec = 86400.;
|
||||
var timeNow = new Date().getTime()/1000.;
|
||||
var timeCoding;
|
||||
if (mapargs['timeCoding']) {
|
||||
switch ( mapargs['timeCoding'] ){
|
||||
case 'decade':
|
||||
timeCoding = {
|
||||
'colors': [ '#0000ff', '#ff0000', '#ffa500', '#ffff00'],
|
||||
'times': [1262300400, 946681200, 631148400, 315529200]
|
||||
// 1.1.2010, 1.1.2000, 1.1.1990, 1.1.1980
|
||||
};
|
||||
};
|
||||
};
|
||||
if (!mapargs['timeCoding'] || !timeCoding ) {
|
||||
timeCoding = {
|
||||
'colors': ['#0000ff', '#ff0000', '#ffa500', '#ffff00'],
|
||||
'ages': [7*day2sec, 30.4375*day2sec, 182.625*day2sec, 365.25*day2sec]
|
||||
};
|
||||
};
|
||||
|
||||
// Adding custom style to quakes
|
||||
var quake_style_default = new OpenLayers.Style({
|
||||
fillColor: '${pntcolor}', fillOpacity: 0.2,
|
||||
strokeColor: '${pntcolor}', strokeWidth: 2,
|
||||
pointRadius: '${pntsize}'
|
||||
},
|
||||
{
|
||||
context: {
|
||||
pntcolor: function(feature){
|
||||
try {
|
||||
return feature.data.pntcolor.value;
|
||||
} catch (e) {
|
||||
return "#E020F0"
|
||||
}
|
||||
},
|
||||
/* if (timeCoding['ages']) {
|
||||
quakeAge = feature.data.age.value;
|
||||
// quakeAge = timeNow - feature.data.stime.value;
|
||||
for ( level = 0; level < timeCoding['ages'].length; level += 1 ) {
|
||||
if ( quakeAge <= timeCoding['ages'][level] ) {
|
||||
return timeCoding['colors'][level];
|
||||
};
|
||||
};
|
||||
} else if (timeCoding['decade']) {
|
||||
return feature.data.pntcolor.value;
|
||||
} else {
|
||||
quakeTime = timeNow + feature.data.age.value;
|
||||
// quakeTime = feature.data.stime.value;
|
||||
for ( level = 0; level < timeCoding['times'].length; level += 1 ) {
|
||||
if ( quakeTime >= timeCoding['times'][level] ) {
|
||||
return timeCoding['colors'][level];
|
||||
};
|
||||
};
|
||||
};
|
||||
//return '#ffffff00';
|
||||
}, */
|
||||
pntsize: function(feature){
|
||||
try {
|
||||
// quakeAge = feature.data.age.value;
|
||||
// quakeAge = timeNow - feature.data.time.value;
|
||||
// if ( timeCoding['ages'] && quakeAge > timeCoding['ages'][timeCoding['ages'].length-1] ) {
|
||||
// return 0;
|
||||
// } else {
|
||||
return feature.data.pntsize.value;
|
||||
//}
|
||||
} catch (e) {
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
var quake_style_select = quake_style_default.clone();
|
||||
quake_style_select.defaultStyle.fillOpacity = 0.8;
|
||||
|
||||
var quake_style_map = new OpenLayers.StyleMap({
|
||||
'default': quake_style_default,
|
||||
'select': quake_style_select
|
||||
});
|
||||
quakes_layer.styleMap = quake_style_map;
|
||||
|
||||
// Show stations
|
||||
stations_layer = loadKML(OpenLayers.i18n("Stations"), 'stations.kml', false, noFrils);
|
||||
map.addLayer(stations_layer);
|
||||
stations_layer.setVisibility(showStations);
|
||||
|
||||
// Adding custom style to stations
|
||||
var station_style_default = new OpenLayers.Style({
|
||||
fillColor: '${pointColor}', fillOpacity: 0.8, // #8dae10
|
||||
strokeColor: 'black', strokeWidth: 2,
|
||||
label: "${text}", labelXOffset: 15, labelAlign: 'l',
|
||||
fontColor: "${tcolor}", fontFamily: 'sans-serif', fontWeight: 'bold',
|
||||
pointRadius: '${pntsize}',
|
||||
graphicName: '${pntsymbol}'
|
||||
},
|
||||
{
|
||||
context: {
|
||||
pointColor: function(feature){
|
||||
if (feature.attributes.count) {
|
||||
return '#8dae10';
|
||||
} else {
|
||||
return '#8dae10'; //return feature.data.pntcolor.value;
|
||||
}
|
||||
},
|
||||
text: function(feature){
|
||||
if (feature.attributes.count) {
|
||||
var c = feature.attributes.count;
|
||||
for (var i=0; i<feature.cluster.length; i++){
|
||||
c = c + feature.cluster[i].data.extrastation.value * 1.0;
|
||||
}
|
||||
return c + ' ' + OpenLayers.i18n('stations');
|
||||
} else {
|
||||
return feature.data.name;
|
||||
}
|
||||
},
|
||||
tcolor: function(feature){
|
||||
if (feature.attributes.count) {
|
||||
return 'black';
|
||||
} else {
|
||||
return feature.data.tcolor.value;
|
||||
}
|
||||
},
|
||||
pntsize: function(feature){
|
||||
if (feature.attributes.count) {
|
||||
return Math.min(feature.attributes.count * 2.0 + 6.0, 12);
|
||||
} else {
|
||||
return feature.data.pntsize.value;
|
||||
}
|
||||
},
|
||||
pntsymbol: function(feature){
|
||||
if (feature.attributes.count) {
|
||||
return 'circle';
|
||||
} else {
|
||||
return 'triangle';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
var station_style_select = station_style_default.clone();
|
||||
station_style_select.defaultStyle.strokeWidth = 4;
|
||||
var station_style_map = new OpenLayers.StyleMap({
|
||||
'default': station_style_default,
|
||||
'select': station_style_select
|
||||
});
|
||||
stations_layer.styleMap = station_style_map;
|
||||
|
||||
// Set initial view
|
||||
if (!map.getCenter()) {
|
||||
map.setCenter(new OpenLayers.LonLat(7.5, 51.8).transform('EPSG:4326','EPSG:900913'), 9);
|
||||
}
|
||||
|
||||
// Enable animated zoom
|
||||
for (var i=map.layers.length-1; i>=0; --i) {
|
||||
map.layers[i].animationEnabled = true;
|
||||
}
|
||||
|
||||
// Show description
|
||||
select = new OpenLayers.Control.SelectFeature([quakes_layer, stations_layer]);
|
||||
map.addControl(select);
|
||||
select.activate();
|
||||
|
||||
// Add graticule
|
||||
map.addControl(new OpenLayers.Control.Graticule({layerName: OpenLayers.i18n("Grid"), visible: false}));
|
||||
|
||||
}
|
||||
|
||||
/* Function to load KML file */
|
||||
function loadKML(name, file, useStyle, noFrils) {
|
||||
// define layer strategy
|
||||
var layer_strategy
|
||||
if (noFrils){
|
||||
layer_strategy = [
|
||||
new OpenLayers.Strategy.Fixed(),
|
||||
];
|
||||
} else {
|
||||
// define cluster parameters
|
||||
var thresholdValue = 4;
|
||||
if (map.getZoom() <= 8){ thresholdValue = 2}
|
||||
if (map.getZoom() >= 10){ thresholdValue = 6}
|
||||
if (noFrils) {
|
||||
thresholdValue = 99;
|
||||
distanceValue = 0
|
||||
};
|
||||
|
||||
var distanceValue = 10;
|
||||
if (map.getZoom() <= 9){ distanceValue = 20}
|
||||
|
||||
layer_strategy = [
|
||||
new OpenLayers.Strategy.Fixed(),
|
||||
new OpenLayers.Strategy.Cluster({distance: distanceValue, threshold: thresholdValue})
|
||||
];
|
||||
}
|
||||
|
||||
// create kml layer
|
||||
var kml_layer = new OpenLayers.Layer.Vector(
|
||||
name,
|
||||
{
|
||||
strategies: layer_strategy,
|
||||
protocol: new OpenLayers.Protocol.HTTP(
|
||||
{
|
||||
url: file,
|
||||
format: new OpenLayers.Format.KML({
|
||||
extractStyles: useStyle,
|
||||
extractAttributes: true,
|
||||
maxDepth: 1
|
||||
})
|
||||
}),
|
||||
transitionEffect: "resize",
|
||||
projection: new OpenLayers.Projection("EPSG:4326")
|
||||
});
|
||||
kml_layer.events.on(
|
||||
{
|
||||
"featureselected": onFeatureSelect,
|
||||
"featureunselected": onFeatureUnselect
|
||||
});
|
||||
|
||||
// return layer object
|
||||
return kml_layer;
|
||||
}
|
||||
|
||||
/* Function called at closing of a popup */
|
||||
function onPopupClose(evt) {
|
||||
select.unselectAll();
|
||||
}
|
||||
|
||||
/* Function called when clicking on a marker */
|
||||
function onFeatureSelect(event) {
|
||||
var feature = event.feature;
|
||||
// Since KML is user-generated, do naive protection against
|
||||
// Javascript.
|
||||
if (feature.attributes.name){
|
||||
var content = "<h3>"+feature.attributes.name + "</h3><p>" + feature.attributes.description + '</p>';
|
||||
if (content.search("<script") != -1) {
|
||||
content = "Content contained Javascript! Escaped content below.<br>" + content.replace(/</g, "<");
|
||||
}
|
||||
} else {
|
||||
var content = '<h3>';
|
||||
for (var i=0; i<feature.cluster.length; i++){
|
||||
content = content + feature.cluster[i].attributes.name;
|
||||
if (i < feature.cluster.length-1) {
|
||||
content = content + ', ';
|
||||
}
|
||||
}
|
||||
content += '</h3>'+
|
||||
OpenLayers.i18n('Zoom in to resolve individual stations.');
|
||||
}
|
||||
var popup = new OpenLayers.Popup.FramedCloud(
|
||||
"popups",
|
||||
feature.geometry.getBounds().getCenterLonLat(),
|
||||
new OpenLayers.Size(100,100),
|
||||
content,
|
||||
null, true,
|
||||
onPopupClose
|
||||
);
|
||||
feature.popup = popup;
|
||||
map.addPopup(popup);
|
||||
}
|
||||
|
||||
/* Function to close popups */
|
||||
function onFeatureUnselect(event) {
|
||||
var feature = event.feature;
|
||||
if(feature.popup) {
|
||||
map.removePopup(feature.popup);
|
||||
feature.popup.destroy();
|
||||
delete feature.popup;
|
||||
}
|
||||
}
|
||||
|
||||
/* Function to activate map legend */
|
||||
function setQuakesMapkeyVisibility() {
|
||||
var mapkey_div = document.getElementById('mapkey');
|
||||
var quakes_visibility = quakes_layer.getVisibility();
|
||||
if (quakes_visibility) {
|
||||
mapkey_div.style.display = "block";
|
||||
mapkey_div.style.visibility = "visible";
|
||||
} else {
|
||||
if (mapkey_div) {
|
||||
mapkey_div.style.visibility = "hidden";
|
||||
mapkey_div.style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
#! /usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Creates KML file with station info.
|
||||
|
||||
License
|
||||
Copyright 2012 Kasper D. Fischer <kasper.fischer@rub.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
$Id$
|
||||
"""
|
||||
|
||||
import simplekml
|
||||
|
||||
# create new empty KML file
|
||||
kml = simplekml.Kml()
|
||||
|
||||
# create empyt folder to contain styles and stations
|
||||
stationsFolder = kml.newfolder(name="Stations")
|
||||
|
||||
# station types
|
||||
stationTypes = {
|
||||
'broadband': {'textColor': '#003560', 'pointSize': 10, 'pointColor': '#ff0000'},
|
||||
'shortperiod': {'textColor': '#003560', 'pointSize': 10, 'pointColor': '#ffa500'},
|
||||
'auxiliary': {'textColor': '#003560', 'pointSize': 8, 'pointColor': '#ffff00'},
|
||||
'geothermie': {'textColor': '#003560', 'pointSize': 10, 'pointColor': '#ffff00'}
|
||||
}
|
||||
# setting station info
|
||||
stations = {
|
||||
'BUG, BKLB': [( 7.2693, 51.4406), 'broadband', 1, "GRSN station BUG, STS-2 seismometer<br />RuhrNet station BKLB, GS-13 seismometer"],
|
||||
'BULI': [( 7.2602, 51.4544), 'auxiliary', 0, 'RuhrNet station BULI, Mark L4c-3D seismometer'],
|
||||
'BTEZ': [( 7.2790, 51.4490), 'auxiliary', 0, 'RuhrNet station BTEZ, GS-13 seismometer'],
|
||||
'BPFI': [( 7.2276, 51.4185), 'auxiliary', 0, 'RuhrNet station BBFI, Mark L4c-3D seismometer'],
|
||||
'HMES': [( 7.7263, 51.6578), 'broadband', 0, 'RuhrNet station HMES, Trillium 40 seismometer'],
|
||||
'BRHE': [( 6.5710, 51.5155), 'shortperiod', 0, 'RuhrNet station BRHE, Mark L4c-3D seismometer'],
|
||||
'ZERL': [( 6.8695, 51.6207), 'shortperiod', 0, 'RuhrNet station ZERL, Mark L4c-3D seismometer'],
|
||||
'ZER1': [( 6.8252, 51.5947), 'auxiliary', 0, 'RuhrNet station ZER1, Mark L4c-3D seismometer'],
|
||||
'ZER2': [( 6.9060, 51.5871), 'auxiliary', 0, 'RuhrNet station ZER2, Mark L4c-3D seismometer'],
|
||||
'ZER3': [( 6.8384, 51.6128), 'auxiliary', 0, 'RuhrNet station ZER3, Mark L4c-3D seismometer'],
|
||||
'BAVN': [( 7.1220, 51.7380), 'broadband', 0, 'RuhrNet station BAVN, STS-2 seismometer'],
|
||||
'BAVS': [( 7.1331, 51.7000), 'auxiliary', 0, 'RuhrNet station BAVS, Mark L4c-3D seismometer'],
|
||||
'IBBN': [( 7.7566, 52.3072), 'broadband', 0, 'GEOFON station IBBN, STS-2 seismometer'],
|
||||
'IBBE': [( 7.7943, 52.2998), 'auxiliary', 0, 'RuhrNet station IBBE, Mark L4c-3D seismometer'],
|
||||
'IBBS': [( 7.7486, 52.2843), 'auxiliary', 0, 'RuhrNet station IBBS, Mark L4c-3D seismometer'],
|
||||
'KERA': [(23.5577, 35.3692), 'broadband', 0, 'GEOFON station KERA, STS-2 seismometer'],
|
||||
'KARP': [(27.1612, 35.5472), 'broadband', 0, 'GEOFON station KARP, STS-2 seismometer']
|
||||
}
|
||||
|
||||
# adding station markers
|
||||
for key, value in stations.iteritems():
|
||||
pnt = stationsFolder.newpoint(
|
||||
name = key,
|
||||
coords = [(value[0][0], value[0][1])],
|
||||
description = value[3]
|
||||
)
|
||||
pnt.extendeddata.newdata('pntsize', stationTypes[value[1]]['pointSize'])
|
||||
pnt.extendeddata.newdata('pntcolor', stationTypes[value[1]]['pointColor'])
|
||||
pnt.extendeddata.newdata('tcolor', stationTypes[value[1]]['textColor'])
|
||||
pnt.extendeddata.newdata('extrastation', value[2])
|
||||
|
||||
# saving the KML file
|
||||
kml.save('stations.kml')
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* L.TileLayer.Grayscale is a regular tilelayer with grayscale makeover.
|
||||
*/
|
||||
|
||||
L.TileLayer.Grayscale = L.TileLayer.extend({
|
||||
options: {
|
||||
enableCanvas: true
|
||||
},
|
||||
|
||||
initialize: function (url, options) {
|
||||
var canvasEl = document.createElement('canvas');
|
||||
if( !(canvasEl.getContext && canvasEl.getContext('2d')) ) {
|
||||
options.enableCanvas = false;
|
||||
}
|
||||
|
||||
L.TileLayer.prototype.initialize.call(this, url, options);
|
||||
},
|
||||
|
||||
_loadTile: function (tile, tilePoint) {
|
||||
tile.setAttribute('crossorigin', 'anonymous');
|
||||
L.TileLayer.prototype._loadTile.call(this, tile, tilePoint);
|
||||
},
|
||||
|
||||
_tileOnLoad: function () {
|
||||
if (this._layer.options.enableCanvas && !this.canvasContext) {
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = canvas.height = this._layer.options.tileSize;
|
||||
this.canvasContext = canvas.getContext("2d");
|
||||
}
|
||||
var ctx = this.canvasContext;
|
||||
|
||||
if (ctx) {
|
||||
this.onload = null; // to prevent an infinite loop
|
||||
ctx.drawImage(this, 0, 0);
|
||||
var imgd = ctx.getImageData(0, 0, this._layer.options.tileSize, this._layer.options.tileSize);
|
||||
var pix = imgd.data;
|
||||
for (var i = 0, n = pix.length; i < n; i += 4) {
|
||||
pix[i] = pix[i + 1] = pix[i + 2] = (3 * pix[i] + 4 * pix[i + 1] + pix[i + 2]) / 8;
|
||||
}
|
||||
ctx.putImageData(imgd, 0, 0);
|
||||
this.removeAttribute("crossorigin");
|
||||
this.src = ctx.canvas.toDataURL();
|
||||
}
|
||||
|
||||
L.TileLayer.prototype._tileOnLoad.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
L.tileLayer.grayscale = function (url, options) {
|
||||
return new L.TileLayer.Grayscale(url, options);
|
||||
};
|
||||
+239
@@ -0,0 +1,239 @@
|
||||
/* do reverse geolocation lookup */
|
||||
function getGeolocation(id, lat, lng) {
|
||||
if ( !geolocationTable[id] ) {
|
||||
// $.getJSON( "//nominatim.openstreetmap.org/reverse", { lat: lat, lon: lng, zoom: 10, format: "json" } )
|
||||
$.getJSON( "//open.mapquestapi.com/nominatim/v1/reverse.php", { lat: lat, lon: lng, zoom: 10, format: "json" } )
|
||||
.done(function( json ) {
|
||||
var city = json.address["city"];
|
||||
var country = json.address["country"];
|
||||
var countryCode = json.address["country_code"].toUpperCase();
|
||||
geolocationTable[id] = city;
|
||||
( country != "Deutschland" ) ? geolocationTable[id] = geolocationTable[id] + " ("+countryCode+")" : null;
|
||||
if ( city ) {
|
||||
$("#eventstable a.toggle[eventid="+id+"]").text(geolocationTable[id]);
|
||||
var sort = [[0,1],[1,1],[2,1]];
|
||||
$("#eventstable").trigger("update", [true]);
|
||||
$("#eventstable").trigger("updateCache");
|
||||
$("#eventstable").trigger("sorton", [sort]);
|
||||
} else {
|
||||
console.log("Nominatim did not provide a city tag for "+lat+" / "+lng);
|
||||
};
|
||||
})
|
||||
.fail(function( jqxhr, textStatus, error ) {
|
||||
var err = textStatus + ", " + error;
|
||||
console.log( "Request Failed: " + err );
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/* Load events using ajax */
|
||||
function ajaxLoadEvents(stime, etime) {
|
||||
var mapBounds = map.getBounds();
|
||||
var N = mapBounds.getNorth();
|
||||
var E = mapBounds.getEast();
|
||||
var S = mapBounds.getSouth();
|
||||
var W = mapBounds.getWest();
|
||||
var d = 0.1;
|
||||
if ( !stime ) {
|
||||
var stime = new Date();
|
||||
stime.setDate(stime.getDate()-180);
|
||||
};
|
||||
if ( !etime ) {
|
||||
var etime = new Date();
|
||||
etime.setDate(etime.getDate()+1);
|
||||
};
|
||||
var url = "https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/event/1/query"
|
||||
var request_data = {
|
||||
starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()),
|
||||
endtime: sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate()),
|
||||
minlat: S-d,
|
||||
maxlat: N+d,
|
||||
minlon: W-d,
|
||||
maxlon: E+d,
|
||||
minmag: minMag-0.1,
|
||||
};
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: request_data,
|
||||
dataType: "xml",
|
||||
success: function (xml) {
|
||||
$(xml).find('event').each(function () {
|
||||
var id = $(this).attr('publicID').split('/')[2];
|
||||
var mag = $(this).find('magnitude > mag > value').text();
|
||||
var otime = $(this).find('origin > time > value').text();
|
||||
var lng = $(this).find('origin > longitude > value').text();
|
||||
var lat = $(this).find('origin > latitude > value').text();
|
||||
var mag = $(this).find('magnitude > mag > value').text();
|
||||
var evaluationMode = $(this).find('evaluationMode').text();
|
||||
var evaluationStatus = $(this).find('evaluationStatus').text();
|
||||
var type = $(this).find('type').last().text();
|
||||
var location = getLocation(Number(lat), Number(lng))[0];
|
||||
( location ) ? null : location = $(this).find('description > text').text();
|
||||
// create table row: Date, Time, Mag, Location
|
||||
if ( !eventTable[id] && ( type == 'earthquake' || type == 'induced or triggered event' || type == 'outside of network interest') && evaluationMode != 'automatic' && evaluationStatus != 'preliminary' && Number(mag)+0.05 >= minMag ) {
|
||||
var row = '<tr class="tablesorter-hasChildRow">'
|
||||
+ '<td class="utctime-date">'+otime.split('.')[0]+'Z</td>'
|
||||
+ '<td class="utctime-time">'+otime.split('.')[0]+'Z</td>'
|
||||
+ sprintf('<td class="ar">%.1f</td>', Number(mag))
|
||||
+ '<td><a href="#" class="toggle" eventid="'+id+'">'+location+'</a><a class="map-link" href="#" eventid="'+id+'">Karte</a></td>'
|
||||
+ '</tr>';
|
||||
row += '<tr class="tablesorter-childRow">'
|
||||
+ '<td colspan="4" eventid="'+id+'">not implemented</td></tr>';
|
||||
var added = $('#eventstable tbody').append(row);
|
||||
added.find('.tablesorter-childRow td').hide();
|
||||
$('#eventstable').find('td.utctime-date').each(function() {
|
||||
$.localtime.formatObject($(this), "dd.MM.yyyy");
|
||||
$(this).removeClass('utctime-date');
|
||||
$(this).addClass('localtime-date');
|
||||
});
|
||||
$('#eventstable').find('td.utctime-time').each(function() {
|
||||
$.localtime.formatObject($(this), "HH:mm");
|
||||
$(this).removeClass('utctime-time');
|
||||
$(this).addClass('localtime-time');
|
||||
});
|
||||
// create marker
|
||||
var marker = addEventMarker(id, Number(lat), Number(lng), Number(mag));
|
||||
var text = sprintf('<h3 eventid="%s">%s</h3>', id, location)
|
||||
+ sprintf('<p>Ereignis: %s</br>', id)
|
||||
+ sprintf('Ort: %.4f °N, %.4f °O </br>', Number(lat), Number(lng))
|
||||
+ sprintf('Zeit: <span class="utctime">%sZ</span></p>', otime.split('.')[0], otime.split('.')[0]);
|
||||
marker.bindPopup(text);
|
||||
// try to get better location with reverse geolocation lookup (nominatim)
|
||||
getGeolocation(id, lat, lng);
|
||||
};
|
||||
});
|
||||
},
|
||||
complete: function () {
|
||||
initStationTable();
|
||||
var sort = [[0,1],[1,1],[2,1]];
|
||||
$("#eventstable").trigger("update", [true]);
|
||||
$("#eventstable").trigger("updateCache");
|
||||
$("#eventstable").trigger("sorton", [sort]);
|
||||
initMapLink();
|
||||
},
|
||||
error: function( jqxhr, textStatus, error ) {
|
||||
var err = textStatus + ", " + error;
|
||||
console.log( "Request Failed: " + err );
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// add row to table
|
||||
function addEventRow(id, props) {
|
||||
$('#eventstable').tablesorter({
|
||||
sortList: "[[0,0], [1,1]], [2,1]",
|
||||
resort: true,
|
||||
showProcessing: true,
|
||||
pager_size: 35
|
||||
});
|
||||
var html = '<tr class="tablesorter-hasChildRow">'
|
||||
+ '<td class="utctime-date">'+props.date+'T'+props.time.split('.')[0]+'Z</td>'
|
||||
+ '<td class="utctime-time">'+props.date+'T'+props.time.split('.')[0]+'Z</td>'
|
||||
+ '<td class="ar">'+props.mag+'</td>'
|
||||
+ '<td><a href="#" class="toggle">'+props.location+'</a><a class="map-link" href="#" eventid="'+id+'">Karte</a></td>'
|
||||
+ '</tr>'
|
||||
+ '<tr class="tablesorter-childRow">'
|
||||
+ '<td colspan="4" eventid="'+id+'">'
|
||||
+ "<pre>ID "+id+"\n\n"
|
||||
+ "Origin\n"
|
||||
+ "Date "+props.date+"\n"
|
||||
+ "Time "+props.time+"\n"
|
||||
+ "Latitude "+props.lat+" deg +/- "+props.lat_err+" km\n"
|
||||
+ "Longitude "+props.lon+" deg +/- "+props.lon_err+" km\n"
|
||||
+ "Depth "+props.depth+" km +/- "+props.depth_err+" km\n"
|
||||
+ "Residual RMS "+props.rms+" s\n"
|
||||
+ "Azimuthal gap "+props.gap+" deg\n\n"
|
||||
+ props.no_phases + " Phase arrivals:\n"
|
||||
+ "sta net dist azi phase time res wt sta\n";
|
||||
for ( i = 0 ; i < props.no_phases ; i++ ) {
|
||||
html += props.phases[i];
|
||||
( i < props.no_phases -1 ) ? html += "\n" : null ;
|
||||
};
|
||||
html += "</pre></td></tr>\n";
|
||||
var added = $('#eventstable tbody').append(html);
|
||||
added.find('.tablesorter-childRow td').hide();
|
||||
$('#eventstable').find('td.utctime-date').each(function() {
|
||||
$.localtime.formatObject($(this), "dd. MM. yyyy");
|
||||
$(this).removeClass('utctime-date');
|
||||
$(this).addClass('localtime-date');
|
||||
});
|
||||
$('#eventstable').find('td.utctime-time').each(function() {
|
||||
$.localtime.formatObject($(this), "HH:mm");
|
||||
$(this).removeClass('utctime-time');
|
||||
$(this).addClass('localtime-time');
|
||||
});
|
||||
// force resorting
|
||||
$("#eventstable").trigger("update", [true]);
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
// tablesorter for event list
|
||||
$("#eventstable").tablesorter(
|
||||
{
|
||||
theme : 'blue',
|
||||
dateFormat : "ddmmyyyy",
|
||||
headers: {
|
||||
0: { sorter: "shortDate" }
|
||||
},
|
||||
cssChildRow: "tablesorter-childRow", // this is the default setting
|
||||
widgets: ["uitheme", "zebra", "filter", "pager"], // initialize zebra and filter widgets, "scroller"
|
||||
widgetOptions: {
|
||||
// possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
|
||||
pager_output: '# {startRow} - {endRow} ({totalRows}) | Seite {page} ({totalPages})',
|
||||
pager_removeRows: false,
|
||||
pager_size: 35,
|
||||
filter_childRows : true,
|
||||
filter_cssFilter : 'tablesorter-filter',
|
||||
filter_startsWith : false,
|
||||
filter_ignoreCase : true,
|
||||
scroller_height: $('div.map').height() - 250,
|
||||
scroller_barWidth: 10,
|
||||
scroller_jumpToHeader: false,
|
||||
sortList: "[[0,1], [1,1], [2,1]]",
|
||||
resort: true,
|
||||
showProcessing: true,
|
||||
}
|
||||
});
|
||||
|
||||
// hide child rows
|
||||
$('#eventstable > tbody > tr.tablesorter-childRow td').hide();
|
||||
|
||||
// update map after filtering
|
||||
$('#eventstable').bind('filterEnd', function(){
|
||||
toggleFilteredMarkers();
|
||||
});
|
||||
|
||||
// highlight first event
|
||||
$('#eventstable').bind('sortEnd', function(){
|
||||
highlightFirstEvent();
|
||||
});
|
||||
|
||||
// show / hide event info
|
||||
$('#eventstable').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('slow');
|
||||
$(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');
|
||||
} else {
|
||||
$(this).addClass('selected');
|
||||
};
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 720 B |
@@ -0,0 +1,139 @@
|
||||
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
|
||||
<!-- $Id$ -->
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='de' lang='de'>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
||||
<title>RUB SeisObs - Ereignis- und Stationskarte</title>
|
||||
|
||||
|
||||
<!-- Style definitions -->
|
||||
<link rel="stylesheet" href="main.css">
|
||||
|
||||
<!-- jQuery & jQueryUI -->
|
||||
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
|
||||
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/cupertino/jquery-ui.css">
|
||||
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
|
||||
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
|
||||
|
||||
<!-- Localtime -->
|
||||
<script type="text/javascript" src="jquery.localtime-0.9.1.min.js"></script>
|
||||
|
||||
<!-- Tablesorter: required -->
|
||||
<link rel="stylesheet" href="theme.blue.css">
|
||||
<script src="jquery.tablesorter.min.js"></script>
|
||||
<!-- script src="widget-scroller.js"></script -->
|
||||
<script src="jquery.tablesorter.widgets.min.js"></script>
|
||||
<script src="jquery.tablesorter.pager.min.js"></script>
|
||||
|
||||
<!-- misc functions -->
|
||||
<script src="misc.js"></script>
|
||||
<script src="sprintf.min.js"></script>
|
||||
|
||||
<!-- Tablesorter: pager -->
|
||||
<link rel="stylesheet" href="jquery.tablesorter.pager.css">
|
||||
<script src="widget-pager.js"></script>
|
||||
<script src="events.js"></script>
|
||||
|
||||
<!-- Leaflet -->
|
||||
<link rel="stylesheet" href="leaflet.css" />
|
||||
<script src="leaflet.js"></script>
|
||||
<!-- script src="TileLayer.Grayscale.js"></script -->
|
||||
<script src="map.js"></script>
|
||||
|
||||
<!-- Stations -->
|
||||
<script src="stations.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="info" id="tabs">
|
||||
<ul>
|
||||
<li><a href="#eventstab"><span>Ereignisse</span></a></li>
|
||||
<li><a href="#stationstab"><span>Stationen</span></a></li>
|
||||
<li><a href="#moretab"><span>Mehr</span></a></li>
|
||||
<li class="infotab"><a href="#infotab"><span>Info</span></a></li>
|
||||
</ul>
|
||||
<!-- Ereignisse -->
|
||||
<div class="tab" id="eventstab">
|
||||
<div class="pager events" id="eventspager">
|
||||
<img src="first.png" class="first" alt="First" />
|
||||
<img src="prev.png" class="prev" alt="Prev" />
|
||||
<span class="pagedisplay"></span>
|
||||
<img src="next.png" class="next" alt="Next" />
|
||||
<img src="last.png" class="last" alt="Last" />
|
||||
<select class="pagesize" title="Select page size">
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="15">15</option>
|
||||
<option value="20">20</option>
|
||||
<option value="25">25</option>
|
||||
<option value="30">30</option>
|
||||
<option value="35">35</option>
|
||||
</select>
|
||||
<select class="gotoPage" title="Select page number"></select>
|
||||
</div>
|
||||
<table class="tablesorter" id="eventstable" data-sortlist="[[0,0],[1,1],[2,1]]">
|
||||
<colgroup>
|
||||
<col width="85" />
|
||||
<col width="50" />
|
||||
<col width="50" />
|
||||
<col />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Datum</th>
|
||||
<th>Zeit</th>
|
||||
<th>Mag.</th>
|
||||
<th>Ort</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Nominatim Search Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png"></p>
|
||||
</div>
|
||||
<!-- Stations -->
|
||||
<div class="tab" id="stationstab">
|
||||
<div class="pager stationspager" id="stationspager">
|
||||
<img src="first.png" class="stationsfirst" alt="First" />
|
||||
<img src="prev.png" class="stationsprev" alt="Prev" />
|
||||
<span class="stationspagedisplay"></span>
|
||||
<img src="next.png" class="stationsnext" alt="Next" />
|
||||
<img src="last.png" class="stationslast" alt="Last" />
|
||||
<select class="stationspagesize" title="Select page size">
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="15">15</option>
|
||||
<option value="20">20</option>
|
||||
<option value="25">25</option>
|
||||
<option value="30">30</option>
|
||||
<option value="35">35</option>
|
||||
</select>
|
||||
<select class="stationsgotoPage" title="Select page number"></select>
|
||||
</div>
|
||||
<table class="tablesorter" id="stationstable">
|
||||
<colgroup>
|
||||
<col width="77" />
|
||||
<col/>
|
||||
<col width="77" />
|
||||
<col width="77" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Network</th>
|
||||
<th>Station</th>
|
||||
<th>Breite [°]</th>
|
||||
<th>Länge [°]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- More -->
|
||||
<div class="tab" id="moretab"></div>
|
||||
<!-- Info -->
|
||||
<div class="tab" id="infotab"></div>
|
||||
</div>
|
||||
<div class="rublogo"><img class="rublogo" src="logo_RUB_155x30.png" alt="Ruhr-Universität Bochum" title="Ruhr-Universität Bochum"/></div>
|
||||
<div id="map" class="map"></div>
|
||||
</body>
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
/*! jQuery localtime - v0.9.1 - 2014-01-11
|
||||
* https://github.com/GregDThomas/jquery-localtime
|
||||
* Copyright (c) 2014 Greg Thomas; Licensed Apache-2.0 */
|
||||
(function(e){"use strict";e.localtime=function(){var a={localtime:"yyyy-MM-dd HH:mm:ss"},t=["January","February","March","April","May","June","July","August","September","October","November","December"],r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["th","st","nd","rd"],s=function(e){return e>=13?e-12:"0"===e?12:e},i=function(e,i){var o=""+e.getFullYear(),n=""+(e.getMonth()+1),l=""+e.getDate(),m=e.getDay(),d=""+e.getHours(),u=""+e.getMinutes(),b=""+e.getSeconds(),f=""+e.getMilliseconds(),k=e.getTimezoneOffset(),h=k>0?"-":"+";if(k=Math.abs(k),void 0===i){var y;for(y in a)if(a.hasOwnProperty(y)){i=a[y];break}if(void 0===i)return""+e}for(var g="",p="",M=0;i.length>M;M++)if(p+=i.charAt(M),"'"===p)for(M++;i.length>M;M++){var T=i.charAt(M);if("'"===T){p="";break}g+=T}else if("\\"===p&&i.length-1>M&&"'"===i.charAt(M+1))M++,g+="'",p="";else if(M===i.length-1||i.charAt(M)!==i.charAt(M+1)){switch(p){case"d":g+=l;break;case"dd":g+=("0"+l).slice(-2);break;case"ddd":g+=r[m].substr(0,3);break;case"ddddd":g+=r[m];break;case"M":g+=n;break;case"MM":g+=("0"+n).slice(-2);break;case"MMM":g+=t[n-1].substr(0,3);break;case"MMMMM":g+=t[n-1];break;case"yy":g+=o.slice(-2);break;case"yyyy":g+=o;break;case"H":g+=d;break;case"HH":g+=("0"+d).slice(-2);break;case"h":g+=s(d);break;case"hh":g+=("0"+s(d)).slice(-2);break;case"m":g+=u;break;case"mm":g+=("0"+u).slice(-2);break;case"s":g+=b;break;case"ss":g+=("0"+b).slice(-2);break;case"S":g+=f;break;case"SS":g+=("0"+f).slice(-2);break;case"SSS":g+=("00"+f).slice(-3);break;case"o":switch(l){case"11":case"12":case"13":g+=c[0];break;default:var v=l%10;v>3&&(v=0),g+=c[v]}break;case"a":case"TT":g+=d>=12?"PM":"AM";break;case"tt":g+=d>=12?"pm":"am";break;case"T":g+=d>=12?"P":"A";break;case"t":g+=d>=12?"p":"a";break;case"z":g+=h+parseInt(k/60,10);break;case"zz":g+=h+("0"+parseInt(k/60,10)).slice(-2);break;case"zzz":g+=h+("0"+parseInt(k/60,10)).slice(-2)+":"+("0"+k%60).slice(-2);break;default:g+=p}p=""}return g};return{setFormat:function(e){a="object"==typeof e?e:{localtime:e}},getFormat:function(){return a},parseISOTimeString:function(a){a=e.trim(""+a);var t=/^(\d{4})-([01]\d)-([0-3]\d)[T| ]([0-2]\d):([0-5]\d)(?::([0-5]\d)(?:\.(\d{3}))?)?Z$/.exec(a);if(t){var r=parseInt(t[1],10),c=parseInt(t[2],10)-1,s=parseInt(t[3],10),i=parseInt(t[4],10),o=parseInt(t[5],10),n=t[6]?parseInt(t[6],10):0,l=t[7]?parseInt(t[7],10):0,m=new Date(Date.UTC(r,c,s,i,o,n,l));if(m.getUTCFullYear()!==r||m.getUTCMonth()!==c||m.getUTCDate()!==s)throw Error(t[1]+"-"+t[2]+"-"+t[3]+" is not a valid date");if(m.getUTCHours()!==i)throw Error(t[4]+":"+t[5]+" is not a valid time");return m}throw Error(a+" is not a supported date/time string")},toLocalTime:function(a,t){return"[object Date]"!==Object.prototype.toString.call(a)&&(a=e.localtime.parseISOTimeString(a)),""===t&&(t=void 0),i(a,t)},formatObject:function(a,t){a.is(":input")?a.val(e.localtime.toLocalTime(a.val(),t)):a.is("time")?a.text(e.localtime.toLocalTime(a.attr("datetime"),t)):a.text(e.localtime.toLocalTime(a.text(),t))},formatPage:function(){e.localtime.format()},format:function(a){var t,r,c=function(){e.localtime.formatObject(e(this),t)},s=e.localtime.getFormat();for(r in s)s.hasOwnProperty(r)&&(t=s[r],e("."+r,a).each(c));e("[data-localtime-format]",a).each(function(){e.localtime.formatObject(e(this),e(this).attr("data-localtime-format"))})}}}()})(jQuery),jQuery(document).ready(function(e){"use strict";e.localtime.format()});
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/*!
|
||||
* TableSorter 2.16.2 min - Client-side table sorting with ease!
|
||||
* Copyright (c) 2007 Christian Bach
|
||||
*/
|
||||
!function(g){g.extend({tablesorter:new function(){function d(){var a=arguments[0],b=1<arguments.length?Array.prototype.slice.call(arguments):a;if("undefined"!==typeof console&&"undefined"!==typeof console.log)console[/error/i.test(a)?"error":/warn/i.test(a)?"warn":"log"](b);else alert(b)}function u(a,b){d(a+" ("+((new Date).getTime()-b.getTime())+"ms)")}function n(a){for(var b in a)return!1;return!0}function p(a,b,c){if(!b)return"";var h=a.config,e=h.textExtraction||"",f="",f="basic"===e?g(b).attr(h.textAttribute)|| b.textContent||b.innerText||g(b).text()||"":"function"===typeof e?e(b,a,c):"object"===typeof e&&e.hasOwnProperty(c)?e[c](b,a,c):b.textContent||b.innerText||g(b).text()||"";return g.trim(f)}function s(a){var b=a.config,c=b.$tbodies=b.$table.children("tbody:not(."+b.cssInfoBlock+")"),h,e,t,k,l,m,g,n,w=0,q="",r=c.length;if(0===r)return b.debug?d("Warning: *Empty table!* Not building a parser cache"):"";b.debug&&(n=new Date,d("Detecting parsers for each column"));for(e=[];w<r;){h=c[w].rows;if(h[w])for(t= h[w].cells.length,k=0;k<t;k++){l=b.$headers.filter(":not([colspan])");l=l.add(b.$headers.filter('[colspan="1"]')).filter('[data-column="'+k+'"]:last');m=b.headers[k];g=f.getParserById(f.getData(l,m,"sorter"));b.empties[k]=f.getData(l,m,"empty")||b.emptyTo||(b.emptyToBottom?"bottom":"top");b.strings[k]=f.getData(l,m,"string")||b.stringTo||"max";if(!g)a:{l=a;m=h;g=-1;for(var s=k,A=void 0,x=f.parsers.length,y=!1,F="",A=!0;""===F&&A;)g++,m[g]?(y=m[g].cells[s],F=p(l,y,s),l.config.debug&&d("Checking if value was empty on row "+ g+", column: "+s+': "'+F+'"')):A=!1;for(;0<=--x;)if((A=f.parsers[x])&&"text"!==A.id&&A.is&&A.is(F,l,y)){g=A;break a}g=f.getParserById("text")}b.debug&&(q+="column:"+k+"; parser:"+g.id+"; string:"+b.strings[k]+"; empty: "+b.empties[k]+"\n");e.push(g)}w+=e.length?r:1}b.debug&&(d(q?q:"No parsers detected"),u("Completed detecting parsers",n));b.parsers=e}function x(a){var b,c,h,e,t,k,l,m,z,n,w,q=a.config,r=q.$table.children("tbody"),s=q.parsers;q.cache={};if(!s)return q.debug?d("Warning: *Empty table!* Not building a cache"): "";q.debug&&(m=new Date);q.showProcessing&&f.isProcessing(a,!0);for(t=0;t<r.length;t++)if(w=[],b=q.cache[t]={normalized:[]},!r.eq(t).hasClass(q.cssInfoBlock)){z=r[t]&&r[t].rows.length||0;for(h=0;h<z;++h)if(n={child:[]},k=g(r[t].rows[h]),l=[],k.hasClass(q.cssChildRow)&&0!==h)c=b.normalized.length-1,b.normalized[c][q.columns].$row=b.normalized[c][q.columns].$row.add(k),k.prev().hasClass(q.cssChildRow)||k.prev().addClass(f.css.cssHasChild),n.child[c]=g.trim(k[0].textContent||k[0].innerText||k.text()|| "");else{n.$row=k;n.order=h;for(e=0;e<q.columns;++e)"undefined"===typeof s[e]?q.debug&&d("No parser found for cell:",k[0].cells[e],"does it have a header?"):(c=p(a,k[0].cells[e],e),c=s[e].format(c,a,k[0].cells[e],e),l.push(c),"numeric"===(s[e].type||"").toLowerCase()&&(w[e]=Math.max(Math.abs(c)||0,w[e]||0)));l[q.columns]=n;b.normalized.push(l)}b.colMax=w}q.showProcessing&&f.isProcessing(a);q.debug&&u("Building cache for "+z+" rows",m)}function y(a,b){var c=a.config,h=c.widgetOptions,e=a.tBodies,t= [],k=c.cache,d,m,z,p,w,q;if(n(k))return c.appender?c.appender(a,t):a.isUpdating?c.$table.trigger("updateComplete",a):"";c.debug&&(q=new Date);for(w=0;w<e.length;w++)if(d=g(e[w]),d.length&&!d.hasClass(c.cssInfoBlock)){z=f.processTbody(a,d,!0);d=k[w].normalized;m=d.length;for(p=0;p<m;p++)t.push(d[p][c.columns].$row),c.appender&&(!c.pager||c.pager.removeRows&&h.pager_removeRows||c.pager.ajax)||z.append(d[p][c.columns].$row);f.processTbody(a,z,!1)}c.appender&&c.appender(a,t);c.debug&&u("Rebuilt table", q);b||c.appender||f.applyWidget(a);a.isUpdating&&c.$table.trigger("updateComplete",a)}function C(a){return/^d/i.test(a)||1===a}function D(a){var b,c,h,e,t,k,l,m=a.config;m.headerList=[];m.headerContent=[];m.debug&&(l=new Date);m.columns=f.computeColumnIndex(m.$table.children("thead, tfoot").children("tr"));e=m.cssIcon?'<i class="'+(m.cssIcon===f.css.icon?f.css.icon:m.cssIcon+" "+f.css.icon)+'"></i>':"";m.$headers=g(a).find(m.selectorHeaders).each(function(a){c=g(this);b=m.headers[a];m.headerContent[a]= g(this).html();t=m.headerTemplate.replace(/\{content\}/g,g(this).html()).replace(/\{icon\}/g,e);m.onRenderTemplate&&(h=m.onRenderTemplate.apply(c,[a,t]))&&"string"===typeof h&&(t=h);g(this).html('<div class="'+f.css.headerIn+'">'+t+"</div>");m.onRenderHeader&&m.onRenderHeader.apply(c,[a]);this.column=parseInt(g(this).attr("data-column"),10);this.order=C(f.getData(c,b,"sortInitialOrder")||m.sortInitialOrder)?[1,0,2]:[0,1,2];this.count=-1;this.lockedOrder=!1;k=f.getData(c,b,"lockedOrder")||!1;"undefined"!== typeof k&&!1!==k&&(this.order=this.lockedOrder=C(k)?[1,1,1]:[0,0,0]);c.addClass(f.css.header+" "+m.cssHeader);m.headerList[a]=this;c.parent().addClass(f.css.headerRow+" "+m.cssHeaderRow).attr("role","row");m.tabIndex&&c.attr("tabindex",0)}).attr({scope:"col",role:"columnheader"});B(a);m.debug&&(u("Built headers:",l),d(m.$headers))}function E(a,b,c){var h=a.config;h.$table.find(h.selLine truncated
|
||||
@@ -0,0 +1,42 @@
|
||||
/* pager wrapper, div */
|
||||
.tablesorter-pager {
|
||||
padding: 5px;
|
||||
}
|
||||
/* pager wrapper, in thead/tfoot */
|
||||
td.tablesorter-pager {
|
||||
background-color: #e6eeee;
|
||||
margin: 0; /* needed for bootstrap .pager gets a 18px bottom margin */
|
||||
}
|
||||
/* pager navigation arrows */
|
||||
.tablesorter-pager img {
|
||||
vertical-align: middle;
|
||||
margin-right: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* pager output text */
|
||||
.tablesorter-pager .pagedisplay {
|
||||
padding: 0 5px 0 5px;
|
||||
width: auto;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* pager element reset (needed for bootstrap) */
|
||||
.tablesorter-pager select {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/*** css used when "updateArrows" option is true ***/
|
||||
/* the pager itself gets a disabled class when the number of rows is less than the size */
|
||||
.tablesorter-pager.disabled {
|
||||
display: none;
|
||||
}
|
||||
/* hide or fade out pager arrows when the first or last row is visible */
|
||||
.tablesorter-pager .disabled {
|
||||
/* visibility: hidden */
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
cursor: default;
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/* tablesorter pager plugin updated 4/23/2014 (v2.16.0) */
|
||||
;(function(h){var k=h.tablesorter;h.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(c,a){return a},ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(c){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,pageReset:0,size:10,savePages:!0,storageKey:"tablesorter-pager",fixedHeight:!1,countChildRows:!1,removeRows:!1,cssFirst:".first",cssPrev:".prev",cssNext:".next",cssLast:".last", cssGoto:".gotoPage",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssErrorRow:"tablesorter-errorRow",cssDisabled:"disabled",totalRows:0,totalPages:0,filteredRows:0,filteredPages:0,ajaxCounter:0,currentFilters:[],startRow:0,endRow:0,$size:null,last:{}};var w=this,p=function(c,a){var b=c.cssDisabled,d=!!a,f=d||0===c.page,g=Math.min(c.totalPages,c.filteredPages),d=d||c.page===g-1||0===c.totalPages;c.updateArrows&&(c.$container.find(c.cssFirst+","+c.cssPrev)[f?"addClass":"removeClass"](b).attr("aria-disabled", f),c.$container.find(c.cssNext+","+c.cssLast)[d?"addClass":"removeClass"](b).attr("aria-disabled",d))},t=function(c,a,b){var d,f,g,l=c.config;d=l.$table.hasClass("hasFilters")&&!a.ajaxUrl;g=[];f=a.size||10;g=[l.widgetOptions&&l.widgetOptions.filter_filteredRow||"filtered",l.selectorRemove];a.countChildRows&&g.push(l.cssChildRow);g.join("|");a.totalPages=Math.ceil(a.totalRows/f);a.filteredRows=d?0:a.totalRows;a.filteredPages=a.totalPages;d&&(h.each(l.cache[0].normalized,function(e,c){a.filteredRows+= a.regexRows.test(c[l.columns].$row[0].className)?0:1}),a.filteredPages=Math.ceil(a.filteredRows/f)||0);if(0<=Math.min(a.totalPages,a.filteredPages)&&(g=a.size*a.page>a.filteredRows,a.startRow=g?1:0===a.filteredRows?0:a.size*a.page+1,a.page=g?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),d=a.$container.find(a.cssPageDisplay),g=(a.ajaxData&&a.ajaxData.output?a.ajaxData.output||a.output:a.output).replace(/\{page([\-+]\d+)?\}/gi,function(c,b){return a.totalPages?a.page+(b?parseInt(b, 10):1):0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(c){c=c.replace(/[{}\s]/g,"");var b=c.split(":"),d=a.ajaxData,f=/(rows?|pages?)$/i.test(c)?0:"";return 1<b.length&&d&&d[b[0]]?d[b[0]][b[1]]:a[c]||(d?d[c]:f)||f}),d.length&&(d["INPUT"===d[0].tagName?"val":"html"](g),a.$goto.length))){g="";f=Math.min(a.totalPages,a.filteredPages);for(d=1;d<=f;d++)g+="<option>"+d+"</option>";a.$goto.html(g).val(a.page+1)}p(a);a.initialized&&!1!==b&&(l.$table.trigger("pagerComplete",a),a.savePages&&k.storage&&k.storage(c, a.storageKey,{page:a.page,size:a.size}))},u=function(c,a){var b,d=c.config,f=d.$tbodies.eq(0);a.fixedHeight&&(f.find("tr.pagerSavedHeightSpacer").remove(),b=h.data(c,"pagerSavedHeight"))&&(b-=f.height(),5<b&&h.data(c,"pagerLastSize")===a.size&&f.children("tr:visible").length<a.size&&f.append('<tr class="pagerSavedHeightSpacer '+d.selectorRemove.replace(/(tr)?\./g,"")+'" style="height:'+b+'px;"></tr>'))},z=function(c,a){var b=c.config.$tbodies.eq(0);b.find("tr.pagerSavedHeightSpacer").remove();h.data(c, "pagerSavedHeight",b.height());u(c,a);h.data(c,"pagerLastSize",a.size)},v=function(c,a){if(!a.ajaxUrl){var b,d=0,f=c.config,g=f.$tbodies.eq(0).children(),h=g.length,e=a.page*a.size,m=e+a.size,n=f.widgetOptions&&f.widgetOptions.filter_filteredRow||"filtered",r=0;for(b=0;b<h;b++)g[b].className.match(n)||(r===e&&g[b].className.match(f.cssChildRow)?g[b].style.display="none":(g[b].style.display=r>=e&&r<m?"":"none",r+=g[b].className.match(f.cssChildRow+"|"+f.selectorRemove.slice(1))&&!a.countChildRows? 0:1,r===m&&"none"!==g[b].style.display&&g[b].className.match(k.css.cssHasChild)&&(d=b)));if(0<d&&g[d].className.match(k.css.cssHasChild))for(;++d<h&&g[d].className.match(f.cssChildRow);)g[d].style.display=""}},A=function(c,a){a.size=parseInt(a.$size.val(),10)||a.size;h.data(c,"pagerLastSize",a.size);p(a);a.removeRows||(v(c,a),h(c).bind("sortEnd.pager filterEnd.pager",function(){v(c,a)}))},B=function(c,a,b,d,f){if("function"===typeof b.ajaxProcessing){var g,l,e,m,n,r,s=a.config,q=s.$table,p="";g=b.ajaxProcessing(c, a)||[0,[]];c=q.find("thead th").length;k.showError(a);if(f)s.debug&&k.log("Ajax Error",d,f),k.showError(a,0===d.status?"Not connected, verify Network":404===d.status?"Requested page not found [404]":500===d.status?"Internal Server Error [500]":"parsererror"===f?"Requested JSON parse failed":"timeout"===f?"Time out error":"abort"===f?"Ajax Request aborted":"Uncaught error: "+d.statusText+" ["+d.status+"]"),s.$tbodies.eq(0).empty(),b.totalRows=0;else{h.isArray(g)?(d=isNaN(g[0])&&!isNaN(g[1]),f=g[d? 1:0],b.totalRows=isNaN(f)?b.totalRows||0:f,d=0===b.totalRows?[""]:g[d?0:1]||[],n=g[2]):(b.ajaxData=g,b.totalRows=g.total,n=g.headers,d=g.rows);r=d.length;if(d instanceof jQuery)b.processAjaxOnInit&&s.$tbodies.eq(0).empty().append(d);else if(r){for(g=0;g<r;g++){p+="<tr>";for(f=0;f<d[g].length;f++)p+=/^\s*<td/.test(d[g][f])?h.trim(d[g][f]):"<td>"+d[g][f]+"</td>";p+="</tr>"}b.processAjaxOnInit&&s.$tbodies.eq(0).htmlLine truncated
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
/*! tableSorter 2.16+ widgets - updated 4/27/2014 (v2.16.2) */
|
||||
;(function(k){
|
||||
var d=k.tablesorter=k.tablesorter||{};
|
||||
d.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption",header:"bootstrap-header",footerRow:"",footerCells:"",icons:"",sortNone:"bootstrap-icon-unsorted",sortAsc:"icon-chevron-up glyphicon glyphicon-chevron-up",sortDesc:"icon-chevron-down glyphicon glyphicon-chevron-down",active:"",hover:"",filterRow:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",caption:"ui-widget-content ui-corner-all",header:"ui-widget-header ui-corner-all ui-state-default", footerRow:"",footerCells:"",icons:"ui-icon",sortNone:"ui-icon-carat-2-n-s",sortAsc:"ui-icon-carat-1-n",sortDesc:"ui-icon-carat-1-s",active:"ui-state-active",hover:"ui-state-hover",filterRow:"",even:"ui-widget-content",odd:"ui-state-default"}};k.extend(d.css,{filterRow:"tablesorter-filter-row",filter:"tablesorter-filter",wrapper:"tablesorter-wrapper",resizer:"tablesorter-resizer",grip:"tablesorter-resizer-grip",sticky:"tablesorter-stickyHeader",stickyVis:"tablesorter-sticky-visible"});
|
||||
d.storage=function(b, a,e,c){b=k(b)[0];var f,d,h=!1;f={};d=b.config;var l=k(b);b=c&&c.id||l.attr(c&&c.group||"data-table-group")||b.id||k(".tablesorter").index(l);c=c&&c.url||l.attr(c&&c.page||"data-table-page")||d&&d.fixedUrl||window.location.pathname;if("localStorage"in window)try{window.localStorage.setItem("_tmptest","temp"),h=!0,window.localStorage.removeItem("_tmptest")}catch(m){}k.parseJSON&&(h?f=k.parseJSON(localStorage[a]||"{}"):(d=document.cookie.split(/[;\s|=]/),f=k.inArray(a,d)+1,f=0!==f?k.parseJSON(d[f]|| "{}"):{}));if((e||""===e)&&window.JSON&&JSON.hasOwnProperty("stringify"))f[c]||(f[c]={}),f[c][b]=e,h?localStorage[a]=JSON.stringify(f):(e=new Date,e.setTime(e.getTime()+31536E6),document.cookie=a+"="+JSON.stringify(f).replace(/\"/g,'"')+"; expires="+e.toGMTString()+"; path=/");else return f&&f[c]?f[c][b]:""};
|
||||
d.addHeaderResizeEvent=function(b,a,e){var c;e=k.extend({},{timer:250},e);var d=b.config,g=d.widgetOptions,h=function(a){g.resize_flag=!0;c=[];d.$headers.each(function(){var a=k(this),b=a.data("savedSizes")|| [0,0],e=this.offsetWidth,d=this.offsetHeight;if(e!==b[0]||d!==b[1])a.data("savedSizes",[e,d]),c.push(this)});c.length&&!1!==a&&d.$table.trigger("resize",[c]);g.resize_flag=!1};h(!1);clearInterval(g.resize_timer);if(a)return g.resize_flag=!1;g.resize_timer=setInterval(function(){g.resize_flag||h()},e.timer)};
|
||||
d.addWidget({id:"uitheme",priority:10,format:function(b,a,e){var c,f,g,h=d.themes;c=a.$table;g=a.$headers;var l=a.theme||"jui",m=h[l]||h.jui,h=m.sortNone+" "+m.sortDesc+" "+m.sortAsc;a.debug&& (f=new Date);c.hasClass("tablesorter-"+l)&&a.theme!==l&&b.hasInitialized||(""!==m.even&&(e.zebra[0]+=" "+m.even),""!==m.odd&&(e.zebra[1]+=" "+m.odd),c.find("caption").addClass(m.caption),b=c.removeClass(""===a.theme?"":"tablesorter-"+a.theme).addClass("tablesorter-"+l+" "+m.table).find("tfoot"),b.length&&b.find("tr").addClass(m.footerRow).children("th, td").addClass(m.footerCells),g.addClass(m.header).not(".sorter-false").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(a){k(this)["mouseenter"=== a.type?"addClass":"removeClass"](m.hover)}),g.find("."+d.css.wrapper).length||g.wrapInner('<div class="'+d.css.wrapper+'" style="position:relative;height:100%;width:100%"></div>'),a.cssIcon&&g.find("."+d.css.icon).addClass(m.icons),c.hasClass("hasFilters")&&g.find("."+d.css.filterRow).addClass(m.filterRow));for(c=0;c<a.columns;c++)b=a.$headers.add(a.$extraHeaders).filter('[data-column="'+c+'"]'),e=d.css.icon?b.find("."+d.css.icon):b,a.$headers.filter('[data-column="'+c+'"]:last')[0].sortDisabled? (b.removeClass(h),e.removeClass(h+" "+m.icons)):(g=b.hasClass(d.css.sortAsc)?m.sortAsc:b.hasClass(d.css.sortDesc)?m.sortDesc:b.hasClass(d.css.header)?m.sortNone:"",b[g===m.sortNone?"removeClass":"addClass"](m.active),e.removeClass(h).addClass(g));a.debug&&d.benchmark("Applying "+l+" theme",f)},remove:function(b,a,e){b=a.$table;a=a.theme||"jui";e=d.themes[a]||d.themes.jui;var c=b.children("thead").children(),f=e.sortNone+" "+e.sortDesc+" "+e.sortAsc;b.removeClass("tablesorter-"+a+" "+e.table).find(d.css.header).removeClass(e.header); c.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(e.hover+" "+f+" "+e.active).find("."+d.css.filterRow).removeClass(e.filterRow);c.find("."+d.css.icon).removeClass(e.icons)}});
|
||||
d.addWidget({id:"columns",priority:30,options:{columns:["primary","secondary","tertiary"]},format:function(b,a,e){var c,f,g,h,l,m,q,n,p=a.$table,t=a.$tbodies,v=a.sortList,u=v.length,w=e&&e.columns||["primary","secondary","tertiary"],x=w.length-1;q=w.join(" ");a.debug&&(c=new Date);for(g=0;g<t.length;g++)f=d.processTbody(b, t.eq(g),!0),h=f.children("tr"),h.each(function(){l=k(this);if("none"!==this.style.display&&(m=l.children().removeClass(q),v&&v[0]&&(m.eq(v[0][0]).addClass(w[0]),1<u)))for(n=1;n<u;n++)m.eq(v[n][0]).addClass(w[n]||w[x])}),d.processTbody(b,f,!1);b=!1!==e.columns_thead?["thead tr"]:[];!1!==e.columns_tfoot&&b.push("tfoot tr");if(b.length&&(h=p.find(b.join(",")).children().removeClass(q),u))for(n=0;n<u;n++)h.filter('[data-column="'+v[n][0]+'"]').addClass(w[n]||w[x]);a.debug&&d.benchmark("Applying Columns widget", c)},remove:function(b,a,e){var c=a.$tbodies,f=(e.columns||["primary","secondary","tertiary"]).join(" ");a.$headers.removeClass(f);a.$table.children("tfoot").children("tr").children("th, td").removeClass(f);for(a=0;a<c.length;a++)e=d.processTbody(b,c.eq(a),!0),e.children("tr").each(function(){k(this).children().removeClass(f)}),d.processTbody(b,e,!1)}});
|
||||
d.addWidget({id:"filter",priority:50,options:{filter_childRows:!1,filter_columnFilters:!0,filter_cssFilter:"",filter_external:"",filter_filteredRow:"filtered", filter_formatter:null,filter_functions:null,filter_hideEmpty:!0,filter_hideFilters:!1,filter_ignoreCase:!0,filter_liveSearch:!0,filter_onlyAvail:"filter-onlyAvail",filter_placeholder:{search:"",select:""},filter_reset:null,filter_saveFilters:!1,filter_searchDelay:300,filter_selectSource:null,filter_startsWith:!1,filter_useParsedData:!1,filter_serversideFiltering:!1,filter_defaultAttrib:"data-value"},format:function(b,a,e){a.$table.hasClass("hasFilters")||d.filter.init(b,a,e)},remove:function(b,a, e){var c,f=a.$tbodies;a.$table.removeClass("hasFilters").unbind("addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search ".split(" ").join(a.namespace+"filter ")).find("."+d.css.filterRow).remove();for(a=0;a<f.length;a++)c=d.processTbody(b,f.eq(a),!0),c.children().removeClass(e.filter_filteredRow).show(),d.processTbody(b,c,!1);e.filter_reset&&k(document).undelegate(e.filter_reset,"click.tsfilter")}});
|
||||
d.filter={regex:{regex:/^\/((?:\\\/|[^\/])+)\/([mig]{0,3})?$/, child:/tablesorter-childRow/,filtered:/filtered/,type:/undefined|number/,exact:/(^[\"|\'|=]+)|([\"|\'|=]+$)/g,nondigit:/[^\w,. \-()]/g,operators:/[<>=]/g},types:{regex:function(b,a,e,c){if(d.filter.regex.regex.test(a)){var f;b=d.filter.regex.regex.exec(a);try{f=RegExp(b[1],b[2]).test(c)}catch(g){f=!1}return f}return null},operators:function(b,a,e,c,f,g,h,l,k){if(/^[<>]=?/.test(a)){var q,n;q=h.config;b=d.formatFloat(a.replace(d.filter.regex.operators,""),h);e=q.parsers[g];l=b;if(k[g]||"numeric"=== e.type)q=e.format(""+a.replace(d.filter.regex.operators,""),h,q.$headers.eq(g),g),b="number"!==typeof b||""===q||isNaN(q)?b:q;q=!k[g]&&"numeric"!==e.type||isNaN(b)||!f?isNaN(c)?d.formatFloat(c.replace(d.filter.regex.nondigit,""),h):d.formatFloat(c,h):f;/>/.test(a)&&(n=/>=/.test(a)?q>=b:q>b);/</.test(a)&&(n=/<=/.test(a)?q<=b:q<b);n||""!==l||(n=!0);return n}return null},exact:function(b,a,e,c,f,g,h,l,m,q){return d.filter.regex.exact.test(a)?(b=a.replace(d.filter.regex.exact,""),q?0<=k.inArray(b,q): b==c):null},notMatch:function(b,a,e,c,d,g,h,l){return/^\!/.test(a)?(a=a.replace("!",""),b=c.search(k.trim(a)),""===a?!0:!(l.filter_startsWith?0===b:0<=b)):null},and:function(b,a,e,c){if(/\s+(AND|&&)\s+/g.test(b)){b=a.split(/(?:\s+(?:and|&&)\s+)/g);a=0<=c.search(k.trim(b[0]));for(e=b.length-1;a&&e;)a=a&&0<=c.search(k.trim(b[e])),e--;return a}return null},range:function(b,a,e,c,f,g,h,l,k){if(/\s+(-|to)\s+/.test(a)){b=h.config;var q=a.split(/(?: - | to )/);e=d.formatFloat(q[0].replace(d.filter.regex.nondigit, ""),h);l=d.formatFloat(q[1].replace(d.filter.regex.nondigit,""),h);if(k[g]||"numeric"===b.parsers[g].type)a=b.parsers[g].format(""+q[0],h,b.$headers.eq(g),g),e=""===a||isNaN(a)?e:a,a=b.parsers[g].format(""+q[1],h,b.$headers.eq(g),g),l=""===a||isNaN(a)?l:a;a=!k[g]&&"numeric"!==b.parsers[g].type||isNaN(e)||isNaN(l)?isNaN(c)?d.formatFloat(c.replace(d.filter.regex.nondigit,""),h):d.formatFloat(c,h):f;e>l&&(c=e,e=l,l=c);return a>=e&&a<=l||""===e||""===l}return null},wild:function(b,a,e,c,d,g,h,l,m,q){return/[\?|\*]/.test(a)|| /\s+OR\s+/i.test(b)?(b=h.config,a=a.replace(/\s+OR\s+/gi,"|"),!b.$headers.filter('[data-column="'+g+'"]:last').hasClass("filter-match")&&/\|/.test(a)&&(a=k.isArray(q)?"("+a+")":"^("+a+")$"),RegExp(a.replace(/\?/g,"\\S{1}").replace(/\*/g,"\\S*")).test(c)):null},fuzzy:function(b,a,e,c){if(/^~/.test(a)){b=0;e=c.length;var d=a.slice(1);for(a=0;a<e;a++)c[a]===d[b]&&(b+=1);return b===d.length?!0:!1}return null}},init:function(b,a,e){var c,f,g,h,l,m;a.debug&&(m=new Date);a.$table.addClass("hasFilters"); d.filter.regex.child=RegExp(a.cssChildRow);d.filter.regex.filtered=RegExp(e.filter_filteredRow);!1!==e.filter_columnFilters&&a.$headers.filter(".filter-false").length!==a.$headers.length&&d.filter.buildRow(b,a,e);a.$table.bind("addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search ".split(" ").join(a.namespace+"filter "),function(c,f){a.$table.find("."+d.css.filterRow).toggle(!(e.filter_hideEmpty&&k.isEmptyObject(a.cache)));/(search|filter)/.test(c.type)||(c.stopPropagation(), d.filter.buildDefault(b,!0));"filterReset"===c.type?d.filter.searching(b,[]):"filterEnd"===c.type?d.filter.buildDefault(b,!0):(f="search"===c.type?f:"updateComplete"===c.type?a.$table.data("lastSearch"):"",/(update|add)/.test(c.type)&&"updateComplete"!==c.type&&(a.lastCombinedFilter=null),d.filter.searching(b,f,!0));return!1});e.filter_reset&&(e.filter_reset instanceof k?e.filter_reset.click(function(){a.$table.trigger("filterReset")}):k(e.filter_reset).length&&k(document).undelegate(e.filter_reset, "click.tsfilter").delegate(e.filter_reset,"click.tsfilter",function(){a.$table.trigger("filterReset")}));if(e.filter_functions)for(h in e.filter_functions)if(e.filter_functions.hasOwnProperty(h)&&"string"===typeof h)if(g=a.$headers.filter('[data-column="'+h+'"]:last'),c="",!0===e.filter_functions[h]&&!g.hasClass("filter-false"))d.filter.buildSelect(b,h);else if("string"===typeof h&&!g.hasClass("filter-false")){for(f in e.filter_functions[h])"string"===typeof f&&(c+=""===c?'<option value="">'+(g.data("placeholder")|| g.attr("data-placeholder")||e.filter_placeholder.select||"")+"</option>":"",c+='<option value="'+f+'">'+f+"</option>");a.$table.find("thead").find("select."+d.css.filter+'[data-column="'+h+'"]').append(c)}d.filter.buildDefault(b,!0);d.filter.bindSearch(b,a.$table.find("."+d.css.filter),!0);e.filter_external&&d.filter.bindSearch(b,e.filter_external);e.filter_hideFilters&&d.filter.hideFilters(b,a);a.showProcessing&&a.$table.bind("filterStart"+a.namespace+"filter filterEnd"+a.namespace+"filter",function(e, c){g=c?a.$table.find("."+d.css.header).filter("[data-column]").filter(function(){return""!==c[k(this).data("column")]}):"";d.isProcessing(b,"filterStart"===e.type,c?g:"")});a.debug&&d.benchmark("Applying Filter widget",m);a.$table.bind("tablesorter-initialized pagerInitialized",function(){l=d.filter.setDefaults(b,a,e)||[];l.length&&Line truncated
|
||||
d.getFilters=function(b,a,e,c){var f,g=!1,h=b?k(b)[0].config:"",l=h?h.widgetOptions:"";if(!0!==a&&l&&!l.filter_columnFilters)return k(b).data("lastSearch");if(h&&(h.$filters&&(f=h.$filters.find("."+d.css.filter)),l.filter_$externalFilters&&(f=f&&f.length?f.add(l.filter_$externalFilters):l.filter_$externalFilters),f&&f.length))for(g=e||[],b=0;b<h.columns+1;b++)a=f.filter('[data-column="'+(b===h.columns?"all":b)+'"]'),a.length&&(a=a.sort(function(a, b){return k(b).attr("data-lastSearchTime")-k(a).attr("data-lastSearchTime")}),k.isArray(e)?(c?a.slice(1):a).val(e[b]).trigger("change.tsfilter"):(g[b]=a.val()||"",a.slice(1).val(g[b])),b===h.columns&&a.length&&(l.filter_$anyMatch=a));0===g.length&&(g=!1);return g};
|
||||
d.setFilters=function(b,a,e,c){var f=b?k(b)[0].config:"";b=d.getFilters(b,!0,a,c);f&&e&&(f.lastCombinedFilter=null,d.filter.searching(f.$table[0],a,c),f.$table.trigger("filterFomatterUpdate"));return!!b};
|
||||
d.addWidget({id:"stickyHeaders", priority:60,options:{stickyHeaders:"",stickyHeaders_attachTo:null,stickyHeaders_offset:0,stickyHeaders_filteredToTop:!0,stickyHeaders_cloneId:"-sticky",stickyHeaders_addResizeEvent:!0,stickyHeaders_includeCaption:!0,stickyHeaders_zIndex:2},format:function(b,a,e){if(!(a.$table.hasClass("hasStickyHeaders")||0<=k.inArray("filter",a.widgets)&&!a.$table.hasClass("hasFilters"))){var c=a.$table,f=k(e.stickyHeaders_attachTo),g=c.children("thead:first"),h=f.length?f:k(window),l=g.children("tr").not(".sticky-false").children(), m="."+d.css.headerIn,q=c.find("tfoot"),n=isNaN(e.stickyHeaders_offset)?k(e.stickyHeaders_offset):"",p=f.length?0:n.length?n.height()||0:parseInt(e.stickyHeaders_offset,10)||0,t=e.$sticky=c.clone().addClass("containsStickyHeaders").css({position:f.length?"absolute":"fixed",margin:0,top:p,left:0,visibility:"hidden",zIndex:e.stickyHeaders_zIndex?e.stickyHeaders_zIndex:2}),v=t.children("thead:first").addClass(d.css.sticky+" "+e.stickyHeaders),u,w="",x=0,D="collapse"!==c.css("border-collapse")&&!/(webkit|msie)/i.test(navigator.userAgent), y=function(){p=n.length?n.height()||0:parseInt(e.stickyHeaders_offset,10)||0;x=0;D&&(x=2*parseInt(l.eq(0).css("border-left-width"),10));t.css({left:f.length?(parseInt(f.css("padding-left"),10)||0)+parseInt(a.$table.css("padding-left"),10)+parseInt(a.$table.css("margin-left"),10)+parseInt(c.css("border-left-width"),10):g.offset().left-h.scrollLeft()-x,width:c.width()});u.filter(":visible").each(function(b){b=l.filter(":visible").eq(b);var c=D&&k(this).attr("data-column")===""+parseInt(a.columns/2, 10)?1:0;k(this).css({width:b.width()-x,height:b.height()}).find(m).width(b.find(m).width()-c)})};t.attr("id")&&(t[0].id+=e.stickyHeaders_cloneId);t.find("thead:gt(0), tr.sticky-false").hide();t.find("tbody, tfoot").remove();e.stickyHeaders_includeCaption?t.find("caption").css("margin-left","-1px"):t.find("caption").remove();u=v.children().children();t.css({height:0,width:0,padding:0,margin:0,border:0});u.find("."+d.css.resizer).remove();c.addClass("hasStickyHeaders").bind("pagerComplete.tsSticky", function(){y()});d.bindEvents(b,v.children().children(".tablesorter-header"));c.after(t);h.bind("scroll.tsSticky resize.tsSticky",function(a){if(c.is(":visible")){var b=c.offset(),d=e.stickyHeaders_includeCaption?0:c.find("caption").outerHeight(!0),d=(f.length?f.offset().top:h.scrollTop())+p-d,k=c.height()-(t.height()+(q.height()||0)),b=d>b.top&&d<b.top+k?"visible":"hidden",d={visibility:b};f.length?d.top=f.scrollTop():d.left=g.offset().left-h.scrollLeft()-x;t.removeClass("tablesorter-sticky-visible tablesorter-sticky-hidden").addClass("tablesorter-sticky-"+ b).css(d);if(b!==w||"resize"===a.type)y(),w=b}});e.stickyHeaders_addResizeEvent&&d.addHeaderResizeEvent(b);c.hasClass("hasFilters")&&(c.bind("filterEnd",function(){var b=k(document.activeElement).closest("td"),b=b.parent().children().index(b);t.hasClass(d.css.stickyVis)&&e.stickyHeaders_filteredToTop&&(window.scrollTo(0,c.position().top),0<=b&&a.$filters&&a.$filters.eq(b).find("a, select, input").filter(":visible").focus())}),d.filter.bindSearch(c,u.find("."+d.css.filter)));c.trigger("stickyHeadersInit")}}, remove:function(b,a,e){a.$table.removeClass("hasStickyHeaders").unbind("pagerComplete.tsSticky").find("."+d.css.sticky).remove();e.$sticky&&e.$sticky.length&&e.$sticky.remove();k(".hasStickyHeaders").length||k(window).unbind("scroll.tsSticky resize.tsSticky");d.addHeaderResizeEvent(b,!1)}});
|
||||
d.addWidget({id:"resizable",priority:40,options:{resizable:!0,resizable_addLastColumn:!1,resizable_widths:[]},format:function(b,a,e){if(!a.$table.hasClass("hasResizable")){a.$table.addClass("hasResizable");d.resizableReset(b, !0);var c,f,g,h,l={},m=a.$table,q=0,n=null,p=null,t=20>Math.abs(m.parent().width()-m.width()),v=function(){d.storage&&n&&p&&(l={},l[n.index()]=n.width(),l[p.index()]=p.width(),n.width(l[n.index()]),p.width(l[p.index()]),!1!==e.resizable&&d.storage(b,"tablesorter-resizable",a.$headers.map(function(){return k(this).width()}).get()));q=0;n=p=null;k(window).trigger("resize")};if(l=d.storage&&!1!==e.resizable?d.storage(b,"tablesorter-resizable"):{})for(h in l)!isNaN(h)&&h<a.$headers.length&&a.$headers.eq(h).width(l[h]); c=m.children("thead:first").children("tr");c.children().each(function(){var b;b=k(this);h=b.attr("data-column");b="false"===d.getData(b,a.headers[h],"resizable");c.children().filter('[data-column="'+h+'"]')[b?"addClass":"removeClass"]("resizable-false")});c.each(function(){g=k(this).children().not(".resizable-false");k(this).find("."+d.css.wrapper).length||g.wrapInner('<div class="'+d.css.wrapper+'" style="position:relative;height:100%;width:100%"></div>');e.resizable_addLastColumn||(g=g.slice(0, -1));f=f?f.add(g):g});f.each(function(){var a=k(this),b=parseInt(a.css("padding-right"),10)+10;a.find("."+d.css.wrapper).append('<div class="'+d.css.resizer+'" style="cursor:w-resize;position:absolute;z-index:1;right:-'+b+'px;top:0;height:100%;width:20px;"></div>')}).bind("mousemove.tsresize",function(a){if(0!==q&&n){var b=a.pageX-q,c=n.width();n.width(c+b);n.width()!==c&&t&&p.width(p.width()-b);q=a.pageX}}).bind("mouseup.tsresize",function(){v()}).find("."+d.css.resizer+",."+d.css.grip).bind("mousedown", function(b){n=k(b.target).closest("th");var c=a.$headers.filter('[data-column="'+n.attr("data-column")+'"]');1<c.length&&(n=n.add(c));p=b.shiftKey?n.parent().find("th").not(".resizable-false").filter(":last"):n.nextAll(":not(.resizable-false)").eq(0);q=b.pageX});m.find("thead:first").bind("mouseup.tsresize mouseleave.tsresize",function(){v()}).bind("contextmenu.tsresize",function(){d.resizableReset(b);var a=k.isEmptyObject?k.isEmptyObject(l):!0;l={};return a})}},remove:function(b,a){a.$table.removeClass("hasResizable").children("thead").unbind("mouseup.tsresize mouseleave.tsresize contextmenu.tsresize").children("tr").children().unbind("mousemove.tsresize mouseup.tsresize").find("."+ d.css.resizer+",."+d.css.grip).remove();d.resizableReset(b)}});
|
||||
d.resizableReset=function(b,a){k(b).each(function(){var e,c=this.config,f=c&&c.widgetOptions;b&&c&&(c.$headers.each(function(a){e=k(this);f.resizable_widths[a]?e.css("width",f.resizable_widths[a]):e.hasClass("resizable-false")||e.css("width","")}),d.storage&&!a&&d.storage(this,"tablesorter-resizable",{}))})};
|
||||
d.addWidget({id:"saveSort",priority:20,options:{saveSort:!0},init:function(b,a,d,c){a.format(b,d,c,!0)},format:function(b,a,e,c){var f, g=a.$table;e=!1!==e.saveSort;var h={sortList:a.sortList};a.debug&&(f=new Date);g.hasClass("hasSaveSort")?e&&b.hasInitialized&&d.storage&&(d.storage(b,"tablesorter-savesort",h),a.debug&&d.benchmark("saveSort widget: Saving last sort: "+a.sortList,f)):(g.addClass("hasSaveSort"),h="",d.storage&&(h=(e=d.storage(b,"tablesorter-savesort"))&&e.hasOwnProperty("sortList")&&k.isArray(e.sortList)?e.sortList:"",a.debug&&d.benchmark('saveSort: Last sort loaded: "'+h+'"',f),g.bind("saveSortReset",function(a){a.stopPropagation(); d.storage(b,"tablesorter-savesort","")})),c&&h&&0<h.length?a.sortList=h:b.hasInitialized&&h&&0<h.length&&g.trigger("sorton",[h]))},remove:function(b){d.storage&&d.storage(b,"tablesorter-savesort","")}})
|
||||
})(jQuery);
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 737 B |
+478
@@ -0,0 +1,478 @@
|
||||
/* required styles */
|
||||
|
||||
.leaflet-map-pane,
|
||||
.leaflet-tile,
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow,
|
||||
.leaflet-tile-pane,
|
||||
.leaflet-tile-container,
|
||||
.leaflet-overlay-pane,
|
||||
.leaflet-shadow-pane,
|
||||
.leaflet-marker-pane,
|
||||
.leaflet-popup-pane,
|
||||
.leaflet-overlay-pane svg,
|
||||
.leaflet-zoom-box,
|
||||
.leaflet-image-layer,
|
||||
.leaflet-layer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
.leaflet-container {
|
||||
overflow: hidden;
|
||||
-ms-touch-action: none;
|
||||
}
|
||||
.leaflet-tile,
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
-webkit-user-drag: none;
|
||||
}
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow {
|
||||
display: block;
|
||||
}
|
||||
/* map is broken in FF if you have max-width: 100% on tiles */
|
||||
.leaflet-container img {
|
||||
max-width: none !important;
|
||||
}
|
||||
/* stupid Android 2 doesn't understand "max-width: none" properly */
|
||||
.leaflet-container img.leaflet-image-layer {
|
||||
max-width: 15000px !important;
|
||||
}
|
||||
.leaflet-tile {
|
||||
filter: inherit;
|
||||
visibility: hidden;
|
||||
}
|
||||
.leaflet-tile-loaded {
|
||||
visibility: inherit;
|
||||
}
|
||||
.leaflet-zoom-box {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
|
||||
.leaflet-overlay-pane svg {
|
||||
-moz-user-select: none;
|
||||
}
|
||||
|
||||
.leaflet-tile-pane { z-index: 2; }
|
||||
.leaflet-objects-pane { z-index: 3; }
|
||||
.leaflet-overlay-pane { z-index: 4; }
|
||||
.leaflet-shadow-pane { z-index: 5; }
|
||||
.leaflet-marker-pane { z-index: 6; }
|
||||
.leaflet-popup-pane { z-index: 7; }
|
||||
|
||||
.leaflet-vml-shape {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
}
|
||||
.lvml {
|
||||
behavior: url(#default#VML);
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
|
||||
/* control positioning */
|
||||
|
||||
.leaflet-control {
|
||||
position: relative;
|
||||
z-index: 7;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.leaflet-top,
|
||||
.leaflet-bottom {
|
||||
position: absolute;
|
||||
z-index: 1000;
|
||||
pointer-events: none;
|
||||
}
|
||||
.leaflet-top {
|
||||
top: 0;
|
||||
}
|
||||
.leaflet-right {
|
||||
right: 0;
|
||||
}
|
||||
.leaflet-bottom {
|
||||
bottom: 0;
|
||||
}
|
||||
.leaflet-left {
|
||||
left: 0;
|
||||
}
|
||||
.leaflet-control {
|
||||
float: left;
|
||||
clear: both;
|
||||
}
|
||||
.leaflet-right .leaflet-control {
|
||||
float: right;
|
||||
}
|
||||
.leaflet-top .leaflet-control {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.leaflet-bottom .leaflet-control {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.leaflet-left .leaflet-control {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.leaflet-right .leaflet-control {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
||||
/* zoom and fade animations */
|
||||
|
||||
.leaflet-fade-anim .leaflet-tile,
|
||||
.leaflet-fade-anim .leaflet-popup {
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.2s linear;
|
||||
-moz-transition: opacity 0.2s linear;
|
||||
-o-transition: opacity 0.2s linear;
|
||||
transition: opacity 0.2s linear;
|
||||
}
|
||||
.leaflet-fade-anim .leaflet-tile-loaded,
|
||||
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.leaflet-zoom-anim .leaflet-zoom-animated {
|
||||
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
-o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
}
|
||||
.leaflet-zoom-anim .leaflet-tile,
|
||||
.leaflet-pan-anim .leaflet-tile,
|
||||
.leaflet-touching .leaflet-zoom-animated {
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
-o-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.leaflet-zoom-anim .leaflet-zoom-hide {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
|
||||
/* cursors */
|
||||
|
||||
.leaflet-clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
.leaflet-container {
|
||||
cursor: -webkit-grab;
|
||||
cursor: -moz-grab;
|
||||
}
|
||||
.leaflet-popup-pane,
|
||||
.leaflet-control {
|
||||
cursor: auto;
|
||||
}
|
||||
.leaflet-dragging .leaflet-container,
|
||||
.leaflet-dragging .leaflet-clickable {
|
||||
cursor: move;
|
||||
cursor: -webkit-grabbing;
|
||||
cursor: -moz-grabbing;
|
||||
}
|
||||
|
||||
|
||||
/* visual tweaks */
|
||||
|
||||
.leaflet-container {
|
||||
background: #ddd;
|
||||
outline: 0;
|
||||
}
|
||||
.leaflet-container a {
|
||||
color: #0078A8;
|
||||
}
|
||||
.leaflet-container a.leaflet-active {
|
||||
outline: 2px solid orange;
|
||||
}
|
||||
.leaflet-zoom-box {
|
||||
border: 2px dotted #38f;
|
||||
background: rgba(255,255,255,0.5);
|
||||
}
|
||||
|
||||
|
||||
/* general typography */
|
||||
.leaflet-container {
|
||||
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
|
||||
/* general toolbar styles */
|
||||
|
||||
.leaflet-bar {
|
||||
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
|
||||
border-radius: 4px;
|
||||
}
|
||||
.leaflet-bar a,
|
||||
.leaflet-bar a:hover {
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #ccc;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
.leaflet-bar a,
|
||||
.leaflet-control-layers-toggle {
|
||||
background-position: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
display: block;
|
||||
}
|
||||
.leaflet-bar a:hover {
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
.leaflet-bar a:first-child {
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
}
|
||||
.leaflet-bar a:last-child {
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom: none;
|
||||
}
|
||||
.leaflet-bar a.leaflet-disabled {
|
||||
cursor: default;
|
||||
background-color: #f4f4f4;
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-bar a {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
|
||||
/* zoom control */
|
||||
|
||||
.leaflet-control-zoom-in,
|
||||
.leaflet-control-zoom-out {
|
||||
font: bold 18px 'Lucida Console', Monaco, monospace;
|
||||
text-indent: 1px;
|
||||
}
|
||||
.leaflet-control-zoom-out {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-control-zoom-in {
|
||||
font-size: 22px;
|
||||
}
|
||||
.leaflet-touch .leaflet-control-zoom-out {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
|
||||
/* layers control */
|
||||
|
||||
.leaflet-control-layers {
|
||||
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
|
||||
background: #fff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.leaflet-control-layers-toggle {
|
||||
background-image: url(images/layers.png);
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
.leaflet-retina .leaflet-control-layers-toggle {
|
||||
background-image: url(images/layers-2x.png);
|
||||
background-size: 26px 26px;
|
||||
}
|
||||
.leaflet-touch .leaflet-control-layers-toggle {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
.leaflet-control-layers .leaflet-control-layers-list,
|
||||
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
|
||||
display: none;
|
||||
}
|
||||
.leaflet-control-layers-expanded .leaflet-control-layers-list {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
.leaflet-control-layers-expanded {
|
||||
padding: 6px 10px 6px 6px;
|
||||
color: #333;
|
||||
background: #fff;
|
||||
}
|
||||
.leaflet-control-layers-selector {
|
||||
margin-top: 2px;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
.leaflet-control-layers label {
|
||||
display: block;
|
||||
}
|
||||
.leaflet-control-layers-separator {
|
||||
height: 0;
|
||||
border-top: 1px solid #ddd;
|
||||
margin: 5px -10px 5px -6px;
|
||||
}
|
||||
|
||||
|
||||
/* attribution and scale controls */
|
||||
|
||||
.leaflet-container .leaflet-control-attribution {
|
||||
background: #fff;
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
margin: 0;
|
||||
}
|
||||
.leaflet-control-attribution,
|
||||
.leaflet-control-scale-line {
|
||||
padding: 0 5px;
|
||||
color: #333;
|
||||
}
|
||||
.leaflet-control-attribution a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.leaflet-control-attribution a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.leaflet-container .leaflet-control-attribution,
|
||||
.leaflet-container .leaflet-control-scale {
|
||||
font-size: 11px;
|
||||
}
|
||||
.leaflet-left .leaflet-control-scale {
|
||||
margin-left: 5px;
|
||||
}
|
||||
.leaflet-bottom .leaflet-control-scale {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.leaflet-control-scale-line {
|
||||
border: 2px solid #777;
|
||||
border-top: none;
|
||||
line-height: 1.1;
|
||||
padding: 2px 5px 1px;
|
||||
font-size: 11px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
|
||||
background: #fff;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
.leaflet-control-scale-line:not(:first-child) {
|
||||
border-top: 2px solid #777;
|
||||
border-bottom: none;
|
||||
margin-top: -2px;
|
||||
}
|
||||
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
|
||||
border-bottom: 2px solid #777;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-control-attribution,
|
||||
.leaflet-touch .leaflet-control-layers,
|
||||
.leaflet-touch .leaflet-bar {
|
||||
box-shadow: none;
|
||||
}
|
||||
.leaflet-touch .leaflet-control-layers,
|
||||
.leaflet-touch .leaflet-bar {
|
||||
border: 2px solid rgba(0,0,0,0.2);
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
|
||||
/* popup */
|
||||
|
||||
.leaflet-popup {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
}
|
||||
.leaflet-popup-content-wrapper {
|
||||
padding: 1px;
|
||||
text-align: left;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.leaflet-popup-content {
|
||||
margin: 13px 19px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.leaflet-popup-content p {
|
||||
margin: 18px 0;
|
||||
}
|
||||
.leaflet-popup-tip-container {
|
||||
margin: 0 auto;
|
||||
width: 40px;
|
||||
height: 20px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.leaflet-popup-tip {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
padding: 1px;
|
||||
|
||||
margin: -10px auto 0;
|
||||
|
||||
-webkit-transform: rotate(45deg);
|
||||
-moz-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
-o-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.leaflet-popup-content-wrapper,
|
||||
.leaflet-popup-tip {
|
||||
background: white;
|
||||
|
||||
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
|
||||
}
|
||||
.leaflet-container a.leaflet-popup-close-button {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 4px 4px 0 0;
|
||||
text-align: center;
|
||||
width: 18px;
|
||||
height: 14px;
|
||||
font: 16px/14px Tahoma, Verdana, sans-serif;
|
||||
color: #c3c3c3;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
background: transparent;
|
||||
}
|
||||
.leaflet-container a.leaflet-popup-close-button:hover {
|
||||
color: #999;
|
||||
}
|
||||
.leaflet-popup-scrolled {
|
||||
overflow: auto;
|
||||
border-bottom: 1px solid #ddd;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.leaflet-oldie .leaflet-popup-content-wrapper {
|
||||
zoom: 1;
|
||||
}
|
||||
.leaflet-oldie .leaflet-popup-tip {
|
||||
width: 24px;
|
||||
margin: 0 auto;
|
||||
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
|
||||
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
|
||||
}
|
||||
.leaflet-oldie .leaflet-popup-tip-container {
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.leaflet-oldie .leaflet-control-zoom,
|
||||
.leaflet-oldie .leaflet-control-layers,
|
||||
.leaflet-oldie .leaflet-popup-content-wrapper,
|
||||
.leaflet-oldie .leaflet-popup-tip {
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
|
||||
/* div icon */
|
||||
|
||||
.leaflet-div-icon {
|
||||
background: #fff;
|
||||
border: 1px solid #666;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
Leaflet, a JavaScript library for mobile-friendly interactive maps. http://leafletjs.com
|
||||
(c) 2010-2013, Vladimir Agafonkin
|
||||
(c) 2010-2011, CloudMade
|
||||
*/
|
||||
!function(t,e,i){var n=t.L,o={};o.version="0.7.2","object"==typeof module&&"object"==typeof module.exports?module.exports=o:"function"==typeof define&&define.amd&&define(o),o.noConflict=function(){return t.L=n,this},t.L=o,o.Util={extend:function(t){var e,i,n,o,s=Array.prototype.slice.call(arguments,1);for(i=0,n=s.length;n>i;i++){o=s[i]||{};for(e in o)o.hasOwnProperty(e)&&(t[e]=o[e])}return t},bind:function(t,e){var i=arguments.length>2?Array.prototype.slice.call(arguments,2):null;return function(){return t.apply(e,i||arguments)}},stamp:function(){var t=0,e="_leaflet_id";return function(i){return i[e]=i[e]||++t,i[e]}}(),invokeEach:function(t,e,i){var n,o;if("object"==typeof t){o=Array.prototype.slice.call(arguments,3);for(n in t)e.apply(i,[n,t[n]].concat(o));return!0}return!1},limitExecByInterval:function(t,e,i){var n,o;return function s(){var a=arguments;return n?(o=!0,void 0):(n=!0,setTimeout(function(){n=!1,o&&(s.apply(i,a),o=!1)},e),t.apply(i,a),void 0)}},falseFn:function(){return!1},formatNum:function(t,e){var i=Math.pow(10,e||5);return Math.round(t*i)/i},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},splitWords:function(t){return o.Util.trim(t).split(/\s+/)},setOptions:function(t,e){return t.options=o.extend({},t.options,e),t.options},getParamString:function(t,e,i){var n=[];for(var o in t)n.push(encodeURIComponent(i?o.toUpperCase():o)+"="+encodeURIComponent(t[o]));return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")},template:function(t,e){return t.replace(/\{ *([\w_]+) *\}/g,function(t,n){var o=e[n];if(o===i)throw new Error("No value provided for variable "+t);return"function"==typeof o&&(o=o(e)),o})},isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="},function(){function e(e){var i,n,o=["webkit","moz","o","ms"];for(i=0;i<o.length&&!n;i++)n=t[o[i]+e];return n}function i(e){var i=+new Date,o=Math.max(0,16-(i-n));return n=i+o,t.setTimeout(e,o)}var n=0,s=t.requestAnimationFrame||e("RequestAnimationFrame")||i,a=t.cancelAnimationFrame||e("CancelAnimationFrame")||e("CancelRequestAnimationFrame")||function(e){t.clearTimeout(e)};o.Util.requestAnimFrame=function(e,n,a,r){return e=o.bind(e,n),a&&s===i?(e(),void 0):s.call(t,e,r)},o.Util.cancelAnimFrame=function(e){e&&a.call(t,e)}}(),o.extend=o.Util.extend,o.bind=o.Util.bind,o.stamp=o.Util.stamp,o.setOptions=o.Util.setOptions,o.Class=function(){},o.Class.extend=function(t){var e=function(){this.initialize&&this.initialize.apply(this,arguments),this._initHooks&&this.callInitHooks()},i=function(){};i.prototype=this.prototype;var n=new i;n.constructor=e,e.prototype=n;for(var s in this)this.hasOwnProperty(s)&&"prototype"!==s&&(e[s]=this[s]);t.statics&&(o.extend(e,t.statics),delete t.statics),t.includes&&(o.Util.extend.apply(null,[n].concat(t.includes)),delete t.includes),t.options&&n.options&&(t.options=o.extend({},n.options,t.options)),o.extend(n,t),n._initHooks=[];var a=this;return e.__super__=a.prototype,n.callInitHooks=function(){if(!this._initHooksCalled){a.prototype.callInitHooks&&a.prototype.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=n._initHooks.length;e>t;t++)n._initHooks[t].call(this)}},e},o.Class.include=function(t){o.extend(this.prototype,t)},o.Class.mergeOptions=function(t){o.extend(this.prototype.options,t)},o.Class.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof t?t:function(){this[t].apply(this,e)};this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i)};var s="_leaflet_events";o.Mixin={},o.Mixin.Events={addEventListener:function(t,e,i){if(o.Util.invokeEach(t,this.addEventListener,this,e,i))return this;var n,a,r,h,l,u,c,d=this[s]=this[s]||{},p=i&&i!==this&&o.stamp(i);for(t=o.Util.splitWords(t),n=0,a=t.length;a>n;n++)r={action:e,context:i||this},h=t[n],p?(l=h+"_idx",u=l+"_len",c=d[l]=d[l]||{},c[p]||(c[p]=[],d[u]=(d[u]||0)+1),c[p].push(r)):(d[h]=d[h]||[],d[h].push(r));return this},hasEventListeners:function(t){var e=this[s];return!!e&&(t in e&&e[t].length>0||t+"_idx"in e&&e[t+"_idx_len"]>0)},removeEventListener:function(t,e,i){if(!this[s])return this;if(!t)return this.clearAllEventListeners();if(o.Util.invokeEach(t,this.removeEventListener,this,e,i))return this;var n,a,r,h,l,u,c,d,p,_=this[s],m=i&&i!==this&&o.stamp(i);for(t=o.Util.splitWords(t),n=0,a=t.length;a>n;n++)if(r=t[n],u=r+"_idx",c=u+"_len",d=_[u],e){if(h=m&&d?d[m]:_[r]){for(l=h.length-1;l>=0;l--)h[l].action!==e||i&&h[l].context!==i||(p=h.splice(l,1),p[0].action=o.Util.falseFn);i&&d&&0===h.length&&(delete d[m],_[c]--)}}else delete _[r],delete _[u],delete _[c];return this},clearAllEventListeners:function(){return delete this[s],this},fireEvent:function(t,e){if(!this.hasEventListeners(t))return this;var i,n,a,r,h,l=o.Util.extend({},e,{type:t,target:this}),u=this[s];if(u[t])for(i=u[t].slice(),n=0,a=i.length;a>n;n++)i[n].action.call(i[n].context,l);r=u[t+"_idx"];for(Line truncated
|
||||
return new o.LatLng(u*i,a)}},o.CRS.EPSG3395=o.extend({},o.CRS,{code:"EPSG:3395",projection:o.Projection.Mercator,transformation:function(){var t=o.Projection.Mercator,e=t.R_MAJOR,i=.5/(Math.PI*e);return new o.Transformation(i,.5,-i,.5)}()}),o.TileLayer=o.Class.extend({includes:o.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",zoomOffset:0,opacity:1,unloadInvisibleTiles:o.Browser.mobile,updateWhenIdle:o.Browser.mobile},initialize:function(t,e){e=o.setOptions(this,e),e.detectRetina&&o.Browser.retina&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomOffset++,e.minZoom>0&&e.minZoom--,this.options.maxZoom--),e.bounds&&(e.bounds=o.latLngBounds(e.bounds)),this._url=t;var i=this.options.subdomains;"string"==typeof i&&(this.options.subdomains=i.split(""))},onAdd:function(t){this._map=t,this._animated=t._zoomAnimated,this._initContainer(),t.on({viewreset:this._reset,moveend:this._update},this),this._animated&&t.on({zoomanim:this._animateZoom,zoomend:this._endZoomAnim},this),this.options.updateWhenIdle||(this._limitedUpdate=o.Util.limitExecByInterval(this._update,150,this),t.on("move",this._limitedUpdate,this)),this._reset(),this._update()},addTo:function(t){return t.addLayer(this),this},onRemove:function(t){this._container.parentNode.removeChild(this._container),t.off({viewreset:this._reset,moveend:this._update},this),this._animated&&t.off({zoomanim:this._animateZoom,zoomend:this._endZoomAnim},this),this.options.updateWhenIdle||t.off("move",this._limitedUpdate,this),this._container=null,this._map=null},bringToFront:function(){var t=this._map._panes.tilePane;return this._container&&(t.appendChild(this._container),this._setAutoZIndex(t,Math.max)),this},bringToBack:function(){var t=this._map._panes.tilePane;return this._container&&(t.insertBefore(this._container,t.firstChild),this._setAutoZIndex(t,Math.min)),this},getAttribution:function(){return this.options.attribution},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},setUrl:function(t,e){return this._url=t,e||this.redraw(),this},redraw:function(){return this._map&&(this._reset({hard:!0}),this._update()),this},_updateZIndex:function(){this._container&&this.options.zIndex!==i&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t,e){var i,n,o,s=t.children,a=-e(1/0,-1/0);for(n=0,o=s.length;o>n;n++)s[n]!==this._container&&(i=parseInt(s[n].style.zIndex,10),isNaN(i)||(a=e(a,i)));this.options.zIndex=this._container.style.zIndex=(isFinite(a)?a:0)+e(1,-1)},_updateOpacity:function(){var t,e=this._tiles;if(o.Browser.ielt9)for(t in e)o.DomUtil.setOpacity(e[t],this.options.opacity);else o.DomUtil.setOpacity(this._container,this.options.opacity)},_initContainer:function(){var t=this._map._panes.tilePane;if(!this._container){if(this._container=o.DomUtil.create("div","leaflet-layer"),this._updateZIndex(),this._animated){var e="leaflet-tile-container";this._bgBuffer=o.DomUtil.create("div",e,this._container),this._tileContainer=o.DomUtil.create("div",e,this._container)}else this._tileContainer=this._container;t.appendChild(this._container),this.options.opacity<1&&this._updateOpacity()}},_reset:function(t){for(var e in this._tiles)this.fire("tileunload",{tile:this._tiles[e]});this._tiles={},this._tilesToLoad=0,this.options.reuseTiles&&(this._unusedTiles=[]),this._tileContainer.innerHTML="",this._animated&&t&&t.hard&&this._clearBgBuffer(),this._initContainer()},_getTileSize:function(){var t=this._map,e=t.getZoom()+this.options.zoomOffset,i=this.options.maxNativeZoom,n=this.options.tileSize;return i&&e>i&&(n=Math.round(t.getZoomScale(e)/t.getZoomScale(i)*n)),n},_update:function(){if(this._map){var t=this._map,e=t.getPixelBounds(),i=t.getZoom(),n=this._getTileSize();if(!(i>this.options.maxZoom||i<this.options.minZoom)){var s=o.bounds(e.min.divideBy(n)._floor(),e.max.divideBy(n)._floor());this._addTilesFromCenterOut(s),(this.options.unloadInvisibleTiles||this.options.reuseTiles)&&this._removeOtherTiles(s)}}},_addTilesFromCenterOut:function(t){var i,n,s,a=[],r=t.getCenter();for(i=t.min.y;i<=t.max.y;i++)for(n=t.min.x;n<=t.max.x;n++)s=new o.Point(n,i),this._tileShouldBeLoaded(s)&&a.push(s);var h=a.length;if(0!==h){a.sort(function(t,e){return t.distanceTo(r)-e.distanceTo(r)});var l=e.createDocumentFragment();for(this._tilesToLoad||this.fire("loading"),this._tilesToLoad+=h,n=0;h>n;n++)this._addTile(a[n],l);this._tileContainer.appendChild(l)}},_tileShouldBeLoaded:function(t){if(t.x+":"+t.y in this._tiles)return!1;var e=this.options;if(!e.continuousWorld){var i=this._getWrapTileNum();if(e.noWrap&&(t.x<0||t.x>=i.x)||t.y<0||t.y>=i.y)return!1}if(e.bounds){var n=e.tileSize,o=t.multiplyBy(n),s=o.add([n,n]),a=this._map.unproject(o),r=this._map.unproject(s);if(e.continuousWorld||e.noWrap||(a=a.wrap(),r=r.wrap()),!e.bounds.intersects([a,r]))return!1}reLine truncated
|
||||
},_animatePathZoom:function(t){var e=this.getZoomScale(t.zoom),i=this._getCenterOffset(t.center)._multiplyBy(-e)._add(this._pathViewport.min);this._pathRoot.style[o.DomUtil.TRANSFORM]=o.DomUtil.getTranslateString(i)+" scale("+e+") ",this._pathZooming=!0},_endPathZoom:function(){this._pathZooming=!1},_updateSvgViewport:function(){if(!this._pathZooming){this._updatePathViewport();var t=this._pathViewport,e=t.min,i=t.max,n=i.x-e.x,s=i.y-e.y,a=this._pathRoot,r=this._panes.overlayPane;o.Browser.mobileWebkit&&r.removeChild(a),o.DomUtil.setPosition(a,e),a.setAttribute("width",n),a.setAttribute("height",s),a.setAttribute("viewBox",[e.x,e.y,n,s].join(" ")),o.Browser.mobileWebkit&&r.appendChild(a)}}}),o.Path.include({bindPopup:function(t,e){return t instanceof o.Popup?this._popup=t:((!this._popup||e)&&(this._popup=new o.Popup(e,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on("click",this._openPopup,this).on("remove",this.closePopup,this),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this._popup=null,this.off("click",this._openPopup).off("remove",this.closePopup),this._popupHandlersAdded=!1),this},openPopup:function(t){return this._popup&&(t=t||this._latlng||this._latlngs[Math.floor(this._latlngs.length/2)],this._openPopup({latlng:t})),this},closePopup:function(){return this._popup&&this._popup._close(),this},_openPopup:function(t){this._popup.setLatLng(t.latlng),this._map.openPopup(this._popup)}}),o.Browser.vml=!o.Browser.svg&&function(){try{var t=e.createElement("div");t.innerHTML='<v:shape adj="1"/>';var i=t.firstChild;return i.style.behavior="url(#default#VML)",i&&"object"==typeof i.adj}catch(n){return!1}}(),o.Path=o.Browser.svg||!o.Browser.vml?o.Path:o.Path.extend({statics:{VML:!0,CLIP_PADDING:.02},_createElement:function(){try{return e.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return e.createElement("<lvml:"+t+' class="lvml">')}}catch(t){return function(t){return e.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),_initPath:function(){var t=this._container=this._createElement("shape");o.DomUtil.addClass(t,"leaflet-vml-shape"+(this.options.className?" "+this.options.className:"")),this.options.clickable&&o.DomUtil.addClass(t,"leaflet-clickable"),t.coordsize="1 1",this._path=this._createElement("path"),t.appendChild(this._path),this._map._pathRoot.appendChild(t)},_initStyle:function(){this._updateStyle()},_updateStyle:function(){var t=this._stroke,e=this._fill,i=this.options,n=this._container;n.stroked=i.stroke,n.filled=i.fill,i.stroke?(t||(t=this._stroke=this._createElement("stroke"),t.endcap="round",n.appendChild(t)),t.weight=i.weight+"px",t.color=i.color,t.opacity=i.opacity,t.dashStyle=i.dashArray?o.Util.isArray(i.dashArray)?i.dashArray.join(" "):i.dashArray.replace(/( *, *)/g," "):"",i.lineCap&&(t.endcap=i.lineCap.replace("butt","flat")),i.lineJoin&&(t.joinstyle=i.lineJoin)):t&&(n.removeChild(t),this._stroke=null),i.fill?(e||(e=this._fill=this._createElement("fill"),n.appendChild(e)),e.color=i.fillColor||i.color,e.opacity=i.fillOpacity):e&&(n.removeChild(e),this._fill=null)},_updatePath:function(){var t=this._container.style;t.display="none",this._path.v=this.getPathString()+" ",t.display=""}}),o.Map.include(o.Browser.svg||!o.Browser.vml?{}:{_initPathRoot:function(){if(!this._pathRoot){var t=this._pathRoot=e.createElement("div");t.className="leaflet-vml-container",this._panes.overlayPane.appendChild(t),this.on("moveend",this._updatePathViewport),this._updatePathViewport()}}}),o.Browser.canvas=function(){return!!e.createElement("canvas").getContext}(),o.Path=o.Path.SVG&&!t.L_PREFER_CANVAS||!o.Browser.canvas?o.Path:o.Path.extend({statics:{CANVAS:!0,SVG:!1},redraw:function(){return this._map&&(this.projectLatlngs(),this._requestUpdate()),this},setStyle:function(t){return o.setOptions(this,t),this._map&&(this._updateStyle(),this._requestUpdate()),this},onRemove:function(t){t.off("viewreset",this.projectLatlngs,this).off("moveend",this._updatePath,this),this.options.clickable&&(this._map.off("click",this._onClick,this),this._map.off("mousemove",this._onMouseMove,this)),this._requestUpdate(),this._map=null},_requestUpdate:function(){this._map&&!o.Path._updateRequest&&(o.Path._updateRequest=o.Util.requestAnimFrame(this._fireMapMoveEnd,this._map))},_fireMapMoveEnd:function(){o.Path._updateRequest=null,this.fire("moveend")},_initElements:function(){this._map._initPathRoot(),this._ctx=this._map._canvasCtx},_updateStyle:function(){var t=this.options;t.stroke&&(this._ctx.lineWidth=t.weight,this._ctx.strokeStyle=t.color),t.fill&&(this._ctx.fillStyle=t.fillColor||t.color)},_drawPath:function(){var t,e,i,n,s,a;for(this._ctx.beginPath(),t=0,i=this._parts.length;i>t;t++){for(e=0,n=this._parts[t].length;n>e;e++)s=this._parts[t][e],a=(0===e?"move":"line")+"To",this._ctx[a](s.x,s.y);this instanceof o.Polygon&&this._ctx.closePath()}},_checkIfEmpty:function(){return!this._parts.length},_updatePath:function(){if(!this._checLine truncated
|
||||
break}};e.documentElement.addEventListener(this.POINTER_UP,l,!1),e.documentElement.addEventListener(this.POINTER_CANCEL,l,!1),this._pointerDocumentListener=!0}return this},addPointerListenerMove:function(t,e,i,n){function o(t){if(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons){for(var e=0;e<a.length;e++)if(a[e].pointerId===t.pointerId){a[e]=t;break}t.touches=a.slice(),t.changedTouches=[t],i(t)}}var s="_leaflet_",a=this._pointers;return t[s+"touchmove"+n]=o,t.addEventListener(this.POINTER_MOVE,o,!1),this},addPointerListenerEnd:function(t,e,i,n){var o="_leaflet_",s=this._pointers,a=function(t){for(var e=0;e<s.length;e++)if(s[e].pointerId===t.pointerId){s.splice(e,1);break}t.touches=s.slice(),t.changedTouches=[t],i(t)};return t[o+"touchend"+n]=a,t.addEventListener(this.POINTER_UP,a,!1),t.addEventListener(this.POINTER_CANCEL,a,!1),this},removePointerListener:function(t,e,i){var n="_leaflet_",o=t[n+e+i];switch(e){case"touchstart":t.removeEventListener(this.POINTER_DOWN,o,!1);break;case"touchmove":t.removeEventListener(this.POINTER_MOVE,o,!1);break;case"touchend":t.removeEventListener(this.POINTER_UP,o,!1),t.removeEventListener(this.POINTER_CANCEL,o,!1)}return this}}),o.Map.mergeOptions({touchZoom:o.Browser.touch&&!o.Browser.android23,bounceAtZoomLimits:!0}),o.Map.TouchZoom=o.Handler.extend({addHooks:function(){o.DomEvent.on(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){o.DomEvent.off(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var i=this._map;if(t.touches&&2===t.touches.length&&!i._animatingZoom&&!this._zooming){var n=i.mouseEventToLayerPoint(t.touches[0]),s=i.mouseEventToLayerPoint(t.touches[1]),a=i._getCenterLayerPoint();this._startCenter=n.add(s)._divideBy(2),this._startDist=n.distanceTo(s),this._moved=!1,this._zooming=!0,this._centerOffset=a.subtract(this._startCenter),i._panAnim&&i._panAnim.stop(),o.DomEvent.on(e,"touchmove",this._onTouchMove,this).on(e,"touchend",this._onTouchEnd,this),o.DomEvent.preventDefault(t)}},_onTouchMove:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&this._zooming){var i=e.mouseEventToLayerPoint(t.touches[0]),n=e.mouseEventToLayerPoint(t.touches[1]);this._scale=i.distanceTo(n)/this._startDist,this._delta=i._add(n)._divideBy(2)._subtract(this._startCenter),1!==this._scale&&(e.options.bounceAtZoomLimits||!(e.getZoom()===e.getMinZoom()&&this._scale<1||e.getZoom()===e.getMaxZoom()&&this._scale>1))&&(this._moved||(o.DomUtil.addClass(e._mapPane,"leaflet-touching"),e.fire("movestart").fire("zoomstart"),this._moved=!0),o.Util.cancelAnimFrame(this._animRequest),this._animRequest=o.Util.requestAnimFrame(this._updateOnMove,this,!0,this._map._container),o.DomEvent.preventDefault(t))}},_updateOnMove:function(){var t=this._map,e=this._getScaleOrigin(),i=t.layerPointToLatLng(e),n=t.getScaleZoom(this._scale);t._animateZoom(i,n,this._startCenter,this._scale,this._delta)},_onTouchEnd:function(){if(!this._moved||!this._zooming)return this._zooming=!1,void 0;var t=this._map;this._zooming=!1,o.DomUtil.removeClass(t._mapPane,"leaflet-touching"),o.Util.cancelAnimFrame(this._animRequest),o.DomEvent.off(e,"touchmove",this._onTouchMove).off(e,"touchend",this._onTouchEnd);var i=this._getScaleOrigin(),n=t.layerPointToLatLng(i),s=t.getZoom(),a=t.getScaleZoom(this._scale)-s,r=a>0?Math.ceil(a):Math.floor(a),h=t._limitZoom(s+r),l=t.getZoomScale(h)/this._scale;t._animateZoom(n,h,i,l)},_getScaleOrigin:function(){var t=this._centerOffset.subtract(this._delta).divideBy(this._scale);return this._startCenter.add(t)}}),o.Map.addInitHook("addHandler","touchZoom",o.Map.TouchZoom),o.Map.mergeOptions({tap:!0,tapTolerance:15}),o.Map.Tap=o.Handler.extend({addHooks:function(){o.DomEvent.on(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){o.DomEvent.off(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(o.DomEvent.preventDefault(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,clearTimeout(this._holdTimeout),void 0;var i=t.touches[0],n=i.target;this._startPos=this._newPos=new o.Point(i.clientX,i.clientY),n.tagName&&"a"===n.tagName.toLowerCase()&&o.DomUtil.addClass(n,"leaflet-active"),this._holdTimeout=setTimeout(o.bind(function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",i))},this),1e3),o.DomEvent.on(e,"touchmove",this._onMove,this).on(e,"touchend",this._onUp,this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),o.DomEvent.off(e,"touchmove",this._onMove,this).off(e,"touchend",this._onUp,this),this._fireClick&&t&&t.changedTouches){var i=t.changedTouches[0],n=i.target;n&&n.tagName&&"a"===n.tagName.toLowerCase()&&o.DomUtil.removeClass(n,"leaflet-active"),this._isTapValid()&&this._simulateEvent("click",i)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new o.PoinLine truncated
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
@@ -0,0 +1,67 @@
|
||||
<style>
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
html, body, #map {
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
div.info {
|
||||
z-index: 10000;
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 14px;
|
||||
padding: 4px;
|
||||
width: 435px;
|
||||
font-size: small;
|
||||
font: sans-serif;
|
||||
background: rgb(255, 255, 255);
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
|
||||
overflow: auto;
|
||||
}
|
||||
div.tab {
|
||||
z-index: 10010;
|
||||
width: 400px;
|
||||
padding: 0px;
|
||||
float: left;
|
||||
font-size: small;
|
||||
font: sans-serif;
|
||||
background: rgb(255, 255, 255);
|
||||
background: rgba(25, 255, 255, 0.95);
|
||||
}
|
||||
div.rublogo {
|
||||
z-index: 10000;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 46px;
|
||||
height: 33px;
|
||||
padding: 10px;
|
||||
width: 155px;
|
||||
font-size: x-small;
|
||||
font: sans-serif;
|
||||
color: #003560;
|
||||
background: rgb(255, 255, 255);
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
|
||||
|
||||
}
|
||||
a.map-link {
|
||||
float: right;
|
||||
}
|
||||
li.infotab {
|
||||
float: right!important;
|
||||
}
|
||||
td.ar {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
+192
@@ -0,0 +1,192 @@
|
||||
/* toggles visibility of filtered markers
|
||||
* only events in the event list are shown */
|
||||
function toggleFilteredMarkers() {
|
||||
// show all shown events in map
|
||||
$("#eventstable > tbody > tr:not(.filtered) > td > a.map-link").each( function() {
|
||||
if ( $(this).attr("eventid") ) {
|
||||
eventTable[$(this).attr("eventid")].setStyle({opacity: 1, strokeOpacity: 1, fillOpacity: eventMarkerOpacity});
|
||||
};
|
||||
});
|
||||
|
||||
// hide filtered events in map
|
||||
$("#eventstable > tbody > tr.filtered > td > a.map-link").each( function() {
|
||||
if ( $(this).attr("eventid") ) {
|
||||
eventTable[$(this).attr("eventid")].setStyle({opacity: 0, strokeOpacity: 0, fillOpacity: 0});
|
||||
};
|
||||
});
|
||||
highlightFirstEvent();
|
||||
};
|
||||
|
||||
/* Highlight the first event of the event list on the map if no
|
||||
* other event is selected */
|
||||
function highlightFirstEvent() {
|
||||
var highlightStyle = {
|
||||
color: 'red',
|
||||
fillColor: '#f03',
|
||||
};
|
||||
var normalStyle = {
|
||||
fillColor: "#FFF500",
|
||||
color: "#FFF500"
|
||||
};
|
||||
$("#eventstable a.map-link").each( function() {
|
||||
if ( $(this).attr("eventid") ) {
|
||||
eventTable[$(this).attr("eventid")].setStyle(normalStyle);
|
||||
$(this).removeClass('first');
|
||||
$(this).text('Karte');
|
||||
};
|
||||
});
|
||||
$("#eventstable > tbody > tr:not(.filtered)").first().find("a.map-link").each(function() {
|
||||
if ( $(this).attr("eventid") ) {
|
||||
eventTable[$(this).attr("eventid")].setStyle(highlightStyle);
|
||||
$(this).addClass('first');
|
||||
$(this).text('Karte (rot)');
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
function highlightEvent( id ) {
|
||||
var highlightStyle = {
|
||||
color: 'red',
|
||||
fillColor: '#f03',
|
||||
};
|
||||
var normalStyle = {
|
||||
fillColor: "#FFF500",
|
||||
color: "#FFF500"
|
||||
};
|
||||
$("#eventstable > tbody > tr:not(.filtered)").find("a.map-link").each( function() {
|
||||
if ( $(this).attr("eventid") ) {
|
||||
if ( $(this).attr("eventid") == id ) {
|
||||
eventTable[$(this).attr("eventid")].setStyle(highlightStyle);
|
||||
$(this).addClass('first');
|
||||
$(this).text('Karte (rot)');
|
||||
} else {
|
||||
eventTable[$(this).attr("eventid")].setStyle(normalStyle);
|
||||
$(this).removeClass('first');
|
||||
$(this).text('Karte');
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
/* add station marker */
|
||||
function addStationMarker(id, lat, lng) {
|
||||
var a = 0.0025,
|
||||
b = Math.sqrt(3)*a,
|
||||
a = a * Math.cos(lat*Math.PI/180);
|
||||
var corners = [L.latLng(lat+2*a, lng), L.latLng(lat-a, lng+b), L.latLng(lat-a, lng-b)];
|
||||
var marker = L.polygon(corners,
|
||||
{
|
||||
fillColor: "#1C771C",
|
||||
color: "#1C771C",
|
||||
weight: 1,
|
||||
opacity: 1,
|
||||
fillOpacity: stationMarkerOpacity,
|
||||
className: id+' stationMarker',
|
||||
}).addTo(stationLayer);
|
||||
stationTable[id] = marker;
|
||||
};
|
||||
|
||||
/* add event marker */
|
||||
function addEventMarker(id, lat, lng, mag) {
|
||||
var markerOptions = {
|
||||
fillColor: "#FFF500",
|
||||
color: "#FFF500",
|
||||
weight: 1,
|
||||
opacity: 1,
|
||||
fillOpacity: eventMarkerOpacity,
|
||||
className: id+' eventMarker',
|
||||
};
|
||||
var marker = L.circle(L.latLng(lat, lng), mag2radius(mag), markerOptions).addTo(eventLayer);
|
||||
eventTable[id] = marker;
|
||||
return marker;
|
||||
};
|
||||
|
||||
/* handle to show events on map */
|
||||
function initMapLink() {
|
||||
$("#eventstable > tbody > tr > td > a.map-link").on('click' , function(){
|
||||
var highlightStyle = {
|
||||
color: 'red',
|
||||
fillColor: '#f03',
|
||||
className: $(this).attr('eventid')
|
||||
}
|
||||
var normalStyle = {
|
||||
fillColor: "#FFF500",
|
||||
color: "#FFF500"
|
||||
};
|
||||
// mark currently selected link and remove class selected from all other links
|
||||
// set everything to normal state
|
||||
$(this).addClass('selected-now');
|
||||
$("#eventstable > tbody > tr:not(.filtered) > td > a.map-link:not(.selected-now)").each(function(){
|
||||
$(this).removeClass('selected');
|
||||
$(this).text('Karte');
|
||||
eventTable[$(this).attr('eventid')].setStyle(normalStyle);
|
||||
});
|
||||
// switch event of first row to normalStyle if it is not the selected one
|
||||
( $(this).hasClass('first') ) ? null : eventTable[$("#eventstable > tbody > tr:not(.filtered)").first().find("a.map-link").attr("eventid")].setStyle(normalStyle);
|
||||
$(this).each(function(){
|
||||
$(this).removeClass('selected-now');
|
||||
// selected -> unselected
|
||||
if ( $(this).hasClass('selected') ) {
|
||||
$(this).removeClass('selected');
|
||||
$(this).text('Karte');
|
||||
eventTable[$(this).attr('eventid')].setStyle(normalStyle);
|
||||
map.setView(mapCentreDefault, zoomDefault);
|
||||
highlightFirstEvent();
|
||||
// unselected -> selected
|
||||
} else {
|
||||
$(this).addClass('selected');
|
||||
$(this).text('im Fokus (rot)');
|
||||
eventTable[$(this).attr('eventid')].setStyle(highlightStyle);
|
||||
map.setView(eventTable[$(this).attr('eventid')].getLatLng(), zoomFocus);
|
||||
};
|
||||
});
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
/******************
|
||||
* document ready *
|
||||
******************/
|
||||
$(document).ready(function() {
|
||||
|
||||
// create a map in the "map" div, set the view to a given place and zoom
|
||||
map = L.map('map', { zoomControl: false }).setView(mapCentreDefault, zoomDefault);
|
||||
new L.Control.Zoom({ position: 'topright' }).addTo(map);
|
||||
|
||||
// add MapQuestOSM tile layer
|
||||
// L.tileLayer.grayscale('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg',
|
||||
L.tileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg',
|
||||
{
|
||||
subdomains: '1234',
|
||||
detectRetina: true,
|
||||
attribution: 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a> | Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> <img src="https://developer.mapquest.com/content/osm/mq_logo.png">',
|
||||
}).addTo(map);
|
||||
|
||||
// add ESRI Grayscale World Map (neither city nor road names)
|
||||
/* L.tileLayer('//server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}',
|
||||
{
|
||||
attribution: 'Tiles © Esri — Esri, DeLorme, NAVTEQ',
|
||||
maxZoom: 16
|
||||
}).addTo(map); */
|
||||
|
||||
// read in stations
|
||||
stationLayer = L.geoJson().addTo(map);
|
||||
|
||||
// read in events, process filter
|
||||
eventLayer = L.geoJson().addTo(map);
|
||||
ajaxLoadEvents();
|
||||
toggleFilteredMarkers();
|
||||
|
||||
// bind popupopen event
|
||||
map.on('popupopen', function() {
|
||||
// convert date/time to localtime
|
||||
$("div.leaflet-popup span.utctime").each(function(){$(this).addClass("localtime").removeClass("utctime");$.localtime.formatObject($(this), "dd.MM.yyyy - HH:mm")});
|
||||
var eventid = $("div.leaflet-popup h3").attr("eventid");
|
||||
if ( eventid ) {
|
||||
// highlight event in table
|
||||
highlightEvent(eventid);
|
||||
// update city in popup
|
||||
$("div.leaflet-popup h3").text(geolocationTable[eventid]);
|
||||
};
|
||||
});
|
||||
});
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
// calculate marker radius from magnitude, both formulas have equal radii at mag=1.2
|
||||
function mag2radius(mag) {
|
||||
return 400*mag; // radius proportional to magagnitude
|
||||
// return 8.104*Math.pow(30,mag) // radius proportional to energy
|
||||
};
|
||||
|
||||
// set height of eventlist div
|
||||
function sleep(milliseconds) {
|
||||
var start = new Date().getTime();
|
||||
for (var i = 0; i < 1e7; i++) {
|
||||
if ((new Date().getTime() - start) > milliseconds){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function setInfoHeight() {
|
||||
var height = $('div.map').height() - 36;
|
||||
$('div.info').height(height);
|
||||
//$('.tab').height(height-80);
|
||||
//$('#eventtable').height(height-100);
|
||||
};
|
||||
|
||||
/* get region and regionID of a location */
|
||||
function getLocation(lat, lng) {
|
||||
var region = false;
|
||||
var regionID;
|
||||
var regions = [
|
||||
['Monschau', 'Schleiden', 'Bad Münstereifel', 'Rheinland-Pfalz', 'Rheinland-Pfalz', 'Rheinland-Pfalz', 'Hessen', 'Hessen', 'Hessen', 'Hessen'],
|
||||
['Aachen', 'Zülpich', 'Euskirchen', 'Bonn', 'Rheinland-Pfalz', 'Rheinland-Pfalz', 'Hessen', 'Hessen', 'Hessen', 'Hessen'],
|
||||
['Geilenkirchen', 'Düren', 'Köln', 'Köln-Mülheim', 'Waldbröl', 'Freudenberg', 'Siegen', 'Hessen', 'Hessen', 'Hessen'],
|
||||
['Heinsberg', 'Mönchengladbach', 'Neuss', 'Solingen', 'Gummersbach', 'Olpe', 'Schmallenberg', 'Bad Berleburg', 'Hessen', 'Hessen'],
|
||||
['Nettetal', 'Krefeld', 'Düsseldorf', 'Wuppertal', 'Hagen', 'Iserlohn', 'Arnsberg', 'Brilon', 'Hessen', 'Hessen'],
|
||||
['Geldern', 'Moers', 'Duisburg', 'Essen', 'Dortmund', 'Unna', 'Soest', 'Büren', 'Marsberg', 'Warburg'],
|
||||
['Kleve', 'Wesel', 'Dorsten', 'Recklinghausen', 'Lünen', 'Hamm/Westfalen', 'Beckum', 'Lippstadt', 'Paderborn', 'Bad Driburg'],
|
||||
['Emmerich am Rhein', 'Bocholt', 'Borken', 'Coesfeld', 'Münster', 'Warendorf', 'Rheda-Wiedenbrück', 'Gütersloh', 'Detmold', 'Bad Pyrmont'],
|
||||
['The Netherlands', 'The Netherlands', 'Vreden', 'Ahaus', 'Steinfurt', 'Lengerich', 'Bad Ilburg', 'Bielefeld', 'Herford', 'Niedersachsen'],
|
||||
['The Netherlands', 'The Netherlands', 'The Netherlands', 'Niedersachsen', 'Rheine', 'Ibbenbüren', 'Niedersachsen', 'Lübbecke', 'Minden', 'Niedersachsen']
|
||||
];
|
||||
if ( lat >= 50.4 && lat < 52.4 && lng >= 6.0 && lng < 9.333333 ) {
|
||||
var latIndex = Math.floor((lat-50.4)*5); // 5 tiles per degree
|
||||
var lngIndex = Math.floor((lng-6.0)*3); // 3 tiles per degree
|
||||
region = regions[latIndex][lngIndex];
|
||||
};
|
||||
if ( region != 'The Netherlands' ) {
|
||||
regionID = 5500-latIndex*200+lngIndex*2+2;
|
||||
};
|
||||
if ( lat >= 50.9 && lat < 51.1 && lng >= 5.666666 && lng < 6.0 ) {
|
||||
region = 'Selfkant';
|
||||
regionID = 5000;
|
||||
};
|
||||
return [ region, regionID ];
|
||||
};
|
||||
|
||||
// window resize
|
||||
$( window ).resize(function() {
|
||||
setInfoHeight();
|
||||
});
|
||||
|
||||
// create global vars
|
||||
var map
|
||||
var eventTable = {};
|
||||
var geolocationTable = {};
|
||||
var eventDetails = {};
|
||||
var stationTable = {};
|
||||
var eventMarkerOpacity = 0.3;
|
||||
var stationMarkerOpacity = 0.5;
|
||||
var zoomFocus = 12;
|
||||
var zoomDefault = 9;
|
||||
var mapCentreDefault = [51.85, 7.0];
|
||||
var minMag = 1.2;
|
||||
|
||||
// run when ready
|
||||
$(document).ready(function() {
|
||||
// AJAX setup
|
||||
$.ajaxSetup({timeout: 15000}); // 15 seconds
|
||||
// adjust height of infocontainer
|
||||
setInfoHeight();
|
||||
// create tabs
|
||||
var tabOptions = {
|
||||
active: 0,
|
||||
disabled: [2, 3],
|
||||
};
|
||||
$('#tabs').tabs(tabOptions);
|
||||
// $('.ui-tabs-nav').sortable();
|
||||
});
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 736 B |
Binary file not shown.
|
After Width: | Height: | Size: 745 B |
Vendored
+1
@@ -0,0 +1 @@
|
||||
/*! sprintf.js | Copyright (c) 2007-2013 Alexandru Marasteanu <hello at alexei dot ro> | 3 clause BSD license */(function(e){function r(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function i(e,t){for(var n=[];t>0;n[--t]=e);return n.join("")}var t=function(){return t.cache.hasOwnProperty(arguments[0])||(t.cache[arguments[0]]=t.parse(arguments[0])),t.format.call(null,t.cache[arguments[0]],arguments)};t.format=function(e,n){var s=1,o=e.length,u="",a,f=[],l,c,h,p,d,v;for(l=0;l<o;l++){u=r(e[l]);if(u==="string")f.push(e[l]);else if(u==="array"){h=e[l];if(h[2]){a=n[s];for(c=0;c<h[2].length;c++){if(!a.hasOwnProperty(h[2][c]))throw t('[sprintf] property "%s" does not exist',h[2][c]);a=a[h[2][c]]}}else h[1]?a=n[h[1]]:a=n[s++];if(/[^s]/.test(h[8])&&r(a)!="number")throw t("[sprintf] expecting number but found %s",r(a));switch(h[8]){case"b":a=a.toString(2);break;case"c":a=String.fromCharCode(a);break;case"d":a=parseInt(a,10);break;case"e":a=h[7]?a.toExponential(h[7]):a.toExponential();break;case"f":a=h[7]?parseFloat(a).toFixed(h[7]):parseFloat(a);break;case"o":a=a.toString(8);break;case"s":a=(a=String(a))&&h[7]?a.substring(0,h[7]):a;break;case"u":a>>>=0;break;case"x":a=a.toString(16);break;case"X":a=a.toString(16).toUpperCase()}a=/[def]/.test(h[8])&&h[3]&&a>=0?"+"+a:a,d=h[4]?h[4]=="0"?"0":h[4].charAt(1):" ",v=h[6]-String(a).length,p=h[6]?i(d,v):"",f.push(h[5]?a+p:p+a)}}return f.join("")},t.cache={},t.parse=function(e){var t=e,n=[],r=[],i=0;while(t){if((n=/^[^\x25]+/.exec(t))!==null)r.push(n[0]);else if((n=/^\x25{2}/.exec(t))!==null)r.push("%");else{if((n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t))===null)throw"[sprintf] huh?";if(n[2]){i|=1;var s=[],o=n[2],u=[];if((u=/^([a-z_][a-z_\d]*)/i.exec(o))===null)throw"[sprintf] huh?";s.push(u[1]);while((o=o.substring(u[0].length))!=="")if((u=/^\.([a-z_][a-z_\d]*)/i.exec(o))!==null)s.push(u[1]);else{if((u=/^\[(\d+)\]/.exec(o))===null)throw"[sprintf] huh?";s.push(u[1])}n[2]=s}else i|=2;if(i===3)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";r.push(n)}t=t.substring(n[0].length)}return r};var n=function(e,n,r){return r=n.slice(0),r.splice(0,0,e),t.apply(null,r)};e.sprintf=t,e.vsprintf=n})(typeof exports!="undefined"?exports:window);
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
// Load the stations using ajax
|
||||
function loadStations(stime, etime) {
|
||||
var mapBounds = map.getBounds();
|
||||
var N = mapBounds.getNorth();
|
||||
var E = mapBounds.getEast();
|
||||
var S = mapBounds.getSouth();
|
||||
var W = mapBounds.getWest();
|
||||
var d = 0.1;
|
||||
var url = "https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/station/1/query";
|
||||
if ( !stime ) {
|
||||
var stime = new Date();
|
||||
stime.setDate(stime.getDate()-180);
|
||||
};
|
||||
if ( !etime ) {
|
||||
var etime = new Date();
|
||||
etime.setDate(etime.getDate()+1);
|
||||
};
|
||||
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()),
|
||||
minlat: S-d,
|
||||
maxlat: N+d,
|
||||
minlon: W-d,
|
||||
maxlon: E+d,
|
||||
};
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
dataType: "xml",
|
||||
data: request_data,
|
||||
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;
|
||||
if ( !stationTable[stationID] ) { // && N >= lat && S <= lat && W<= lng && E >= lng
|
||||
var row = sprintf('<tr><td>%s</td><td>%s</td><td class="ar">%7.4f</td><td class="ar">%7.4f</td></tr>' , network, station, Number(lat), Number(lng));
|
||||
var r = $(row);
|
||||
$('#stationstable tbody').append(r);
|
||||
addStationMarker(stationID, Number(lat), Number(lng));
|
||||
};
|
||||
});
|
||||
});
|
||||
},
|
||||
complete: function () {
|
||||
initStationTable();
|
||||
var sort = [[0,0],[1,0]];
|
||||
$("#stationstable").trigger("update", [true]);
|
||||
$("#stationstable").trigger("updateCache");
|
||||
$("#stationstable").trigger("sorton", [sort]);
|
||||
$("#stationstable > tbody > tr:even").addClass("odd");
|
||||
$("#stationstable > tbody > tr:odd").addClass("even");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function initStationTable() {
|
||||
// tablesorter for station list
|
||||
$("#stationstable").tablesorter(
|
||||
{
|
||||
theme : 'blue',
|
||||
cssChildRow: "tablesorter-childRow", // this is the default setting
|
||||
widgets: ["uitheme", "zebra", "filter", "pager"], // initialize zebra and filter widgets, "scroller"
|
||||
widgetOptions: {
|
||||
// output default: '{page}/{totalPages}'
|
||||
// possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
|
||||
pager_output: '# {startRow} - {endRow} ({totalRows}) | Seite {page} ({totalPages})',
|
||||
// apply disabled classname to the pager arrows when the rows at either extreme is visible
|
||||
pager_updateArrows: true,
|
||||
// starting page of the pager (zero based index)
|
||||
pager_startPage: 0,
|
||||
// Number of visible rows
|
||||
pager_size: 35,
|
||||
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js)
|
||||
pager_savePages: true,
|
||||
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
|
||||
// table row set to a height to compensate; default is false
|
||||
pager_fixedHeight: false,
|
||||
// remove rows from the table to speed up the sort of large tables.
|
||||
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
|
||||
pager_removeRows: false,
|
||||
// css class names of pager arrows
|
||||
pager_css: {
|
||||
container : 'stations-tablesorter-pager',
|
||||
errorRow : '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
|
||||
pager_selectors: {
|
||||
container : '.stationspager', // target the pager markup (wrapper)
|
||||
first : '.stationsfirst', // go to first page arrow
|
||||
prev : '.stationsprev', // previous page arrow
|
||||
next : '.stationsnext', // next page arrow
|
||||
last : '.stationslast', // go to last page arrow
|
||||
goto : '.stationsgotoPage', // go to page selector - select dropdown that sets the current page
|
||||
pageDisplay : '.stationspagedisplay', // location of where the "output" is displayed
|
||||
pageSize : '.stationspagesize' // page size selector - select dropdown that sets the "size" option
|
||||
},
|
||||
|
||||
filter_childRows : true,
|
||||
filter_cssFilter : 'tablesorter-filter',
|
||||
filter_startsWith : false,
|
||||
filter_ignoreCase : true,
|
||||
scroller_height: $('div.map').height() - 250,
|
||||
scroller_barWidth: 10,
|
||||
scroller_jumpToHeader: false,
|
||||
sortList: "[[0,0], [1,0]]",
|
||||
resort: true,
|
||||
showProcessing: true,
|
||||
}
|
||||
});
|
||||
};
|
||||
$(document).ready(function() {
|
||||
loadStations();
|
||||
});
|
||||
@@ -0,0 +1,221 @@
|
||||
/*************
|
||||
Blue Theme
|
||||
*************/
|
||||
/* overall */
|
||||
.tablesorter-blue {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
margin: 10px 0 15px;
|
||||
text-align: left;
|
||||
border-spacing: 0;
|
||||
border: #cdcdcd 1px solid;
|
||||
border-width: 1px 0 0 1px;
|
||||
}
|
||||
.tablesorter-blue th,
|
||||
.tablesorter-blue td {
|
||||
border: #cdcdcd 1px solid;
|
||||
border-width: 0 1px 1px 0;
|
||||
}
|
||||
|
||||
/* header */
|
||||
.tablesorter-blue th,
|
||||
.tablesorter-blue thead td {
|
||||
font: bold 12px/18px Arial, Sans-serif;
|
||||
color: #000;
|
||||
background-color: #99bfe6;
|
||||
border-collapse: collapse;
|
||||
padding: 4px;
|
||||
text-shadow: 0 1px 0 rgba(204, 204, 204, 0.7);
|
||||
}
|
||||
.tablesorter-blue tbody td,
|
||||
.tablesorter-blue tfoot th,
|
||||
.tablesorter-blue tfoot td {
|
||||
padding: 4px;
|
||||
vertical-align: top;
|
||||
}
|
||||
.tablesorter-blue .header,
|
||||
.tablesorter-blue .tablesorter-header {
|
||||
/* black (unsorted) double arrow */
|
||||
background-image: url(data:image/gif;base64,R0lGODlhFQAJAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==);
|
||||
/* white (unsorted) double arrow */
|
||||
/* background-image: url(data:image/gif;base64,R0lGODlhFQAJAIAAAP///////yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==); */
|
||||
/* image */
|
||||
/* background-image: url(images/black-unsorted.gif); */
|
||||
background-repeat: no-repeat;
|
||||
background-position: center right;
|
||||
padding: 4px 18px 4px 4px;
|
||||
white-space: normal;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tablesorter-blue .headerSortUp,
|
||||
.tablesorter-blue .tablesorter-headerSortUp,
|
||||
.tablesorter-blue .tablesorter-headerAsc {
|
||||
background-color: #9fbfdf;
|
||||
/* black asc arrow */
|
||||
background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7);
|
||||
/* white asc arrow */
|
||||
/* background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAAP///////yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7); */
|
||||
/* image */
|
||||
/* background-image: url(images/black-asc.gif); */
|
||||
}
|
||||
.tablesorter-blue .headerSortDown,
|
||||
.tablesorter-blue .tablesorter-headerSortDown,
|
||||
.tablesorter-blue .tablesorter-headerDesc {
|
||||
background-color: #8cb3d9;
|
||||
/* black desc arrow */
|
||||
background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7);
|
||||
/* white desc arrow */
|
||||
/* background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAAP///////yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7); */
|
||||
/* image */
|
||||
/* background-image: url(images/black-desc.gif); */
|
||||
}
|
||||
.tablesorter-blue thead .sorter-false {
|
||||
background-image: none;
|
||||
cursor: default;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
/* tfoot */
|
||||
.tablesorter-blue tfoot .tablesorter-headerSortUp,
|
||||
.tablesorter-blue tfoot .tablesorter-headerSortDown,
|
||||
.tablesorter-blue tfoot .tablesorter-headerAsc,
|
||||
.tablesorter-blue tfoot .tablesorter-headerDesc {
|
||||
/* remove sort arrows from footer */
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
/* tbody */
|
||||
.tablesorter-blue td {
|
||||
color: #3d3d3d;
|
||||
background-color: #fff;
|
||||
padding: 4px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* hovered row colors
|
||||
you'll need to add additional lines for
|
||||
rows with more than 2 child rows
|
||||
*/
|
||||
.tablesorter-blue tbody > tr:hover > td,
|
||||
.tablesorter-blue tbody > tr:hover + tr.tablesorter-childRow > td,
|
||||
.tablesorter-blue tbody > tr:hover + tr.tablesorter-childRow + tr.tablesorter-childRow > td,
|
||||
.tablesorter-blue tbody > tr.even:hover > td,
|
||||
.tablesorter-blue tbody > tr.even:hover + tr.tablesorter-childRow > td,
|
||||
.tablesorter-blue tbody > tr.even:hover + tr.tablesorter-childRow + tr.tablesorter-childRow > td {
|
||||
background: #d9d9d9;
|
||||
}
|
||||
.tablesorter-blue tbody > tr.odd:hover > td,
|
||||
.tablesorter-blue tbody > tr.odd:hover + tr.tablesorter-childRow > td,
|
||||
.tablesorter-blue tbody > tr.odd:hover + tr.tablesorter-childRow + tr.tablesorter-childRow > td {
|
||||
background: #bfbfbf;
|
||||
}
|
||||
|
||||
/* table processing indicator */
|
||||
.tablesorter-blue .tablesorter-processing {
|
||||
background-position: center center !important;
|
||||
background-repeat: no-repeat !important;
|
||||
/* background-image: url(../addons/pager/icons/loading.gif) !important; */
|
||||
background-image: url('data:image/gif;base64,R0lGODlhFAAUAKEAAO7u7lpaWgAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQBCgACACwAAAAAFAAUAAACQZRvoIDtu1wLQUAlqKTVxqwhXIiBnDg6Y4eyx4lKW5XK7wrLeK3vbq8J2W4T4e1nMhpWrZCTt3xKZ8kgsggdJmUFACH5BAEKAAIALAcAAAALAAcAAAIUVB6ii7jajgCAuUmtovxtXnmdUAAAIfkEAQoAAgAsDQACAAcACwAAAhRUIpmHy/3gUVQAQO9NetuugCFWAAAh+QQBCgACACwNAAcABwALAAACE5QVcZjKbVo6ck2AF95m5/6BSwEAIfkEAQoAAgAsBwANAAsABwAAAhOUH3kr6QaAcSrGWe1VQl+mMUIBACH5BAEKAAIALAIADQALAAcAAAIUlICmh7ncTAgqijkruDiv7n2YUAAAIfkEAQoAAgAsAAAHAAcACwAAAhQUIGmHyedehIoqFXLKfPOAaZdWAAAh+QQFCgACACwAAAIABwALAAACFJQFcJiXb15zLYRl7cla8OtlGGgUADs=') !important;
|
||||
}
|
||||
|
||||
/* Zebra Widget - row alternating colors */
|
||||
.tablesorter-blue tbody tr.odd td {
|
||||
background-color: #ebf2fa;
|
||||
}
|
||||
.tablesorter-blue tbody tr.even td {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
/* Column Widget - column sort colors */
|
||||
.tablesorter-blue td.primary,
|
||||
.tablesorter-blue tr.odd td.primary {
|
||||
background-color: #99b3e6;
|
||||
}
|
||||
.tablesorter-blue tr.even td.primary {
|
||||
background-color: #c2d1f0;
|
||||
}
|
||||
.tablesorter-blue td.secondary,
|
||||
.tablesorter-blue tr.odd td.secondary {
|
||||
background-color: #c2d1f0;
|
||||
}
|
||||
.tablesorter-blue tr.even td.secondary {
|
||||
background-color: #d6e0f5;
|
||||
}
|
||||
.tablesorter-blue td.tertiary,
|
||||
.tablesorter-blue tr.odd td.tertiary {
|
||||
background-color: #d6e0f5;
|
||||
}
|
||||
.tablesorter-blue tr.even td.tertiary {
|
||||
background-color: #ebf0fa;
|
||||
}
|
||||
|
||||
/* caption */
|
||||
caption {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* filter widget */
|
||||
.tablesorter-blue .tablesorter-filter-row td {
|
||||
background: #eee;
|
||||
line-height: normal;
|
||||
text-align: center; /* center the input */
|
||||
-webkit-transition: line-height 0.1s ease;
|
||||
-moz-transition: line-height 0.1s ease;
|
||||
-o-transition: line-height 0.1s ease;
|
||||
transition: line-height 0.1s ease;
|
||||
}
|
||||
/* optional disabled input styling */
|
||||
.tablesorter-blue .tablesorter-filter-row .disabled {
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
/* hidden filter row */
|
||||
.tablesorter-blue .tablesorter-filter-row.hideme td {
|
||||
/*** *********************************************** ***/
|
||||
/*** change this padding to modify the thickness ***/
|
||||
/*** of the closed filter row (height = padding x 2) ***/
|
||||
padding: 2px;
|
||||
/*** *********************************************** ***/
|
||||
margin: 0;
|
||||
line-height: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tablesorter-blue .tablesorter-filter-row.hideme .tablesorter-filter {
|
||||
height: 1px;
|
||||
min-height: 0;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
/* don't use visibility: hidden because it disables tabbing */
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
}
|
||||
/* filters */
|
||||
.tablesorter-blue .tablesorter-filter {
|
||||
width: 98%;
|
||||
height: auto;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
background-color: #fff;
|
||||
border: 1px solid #bbb;
|
||||
color: #333;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
-webkit-transition: height 0.1s ease;
|
||||
-moz-transition: height 0.1s ease;
|
||||
-o-transition: height 0.1s ease;
|
||||
transition: height 0.1s ease;
|
||||
}
|
||||
/* rows hidden by filtering (needed for child rows) */
|
||||
.tablesorter .filtered {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ajax error row */
|
||||
.tablesorter .tablesorter-errorRow td {
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background-color: #e6bf99;
|
||||
}
|
||||
@@ -0,0 +1,863 @@
|
||||
/* Pager widget (beta) for TableSorter 3/31/2014 (v2.15.12) */
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var tsp,
|
||||
ts = $.tablesorter;
|
||||
|
||||
ts.addWidget({
|
||||
id: "pager",
|
||||
priority: 55, // load pager after filter widget
|
||||
options : {
|
||||
// output default: '{page}/{totalPages}'
|
||||
// possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
|
||||
pager_output: '{startRow} to {endRow} of {totalRows} rows', // '{page}/{totalPages}'
|
||||
|
||||
// apply disabled classname to the pager arrows when the rows at either extreme is visible
|
||||
pager_updateArrows: true,
|
||||
|
||||
// starting page of the pager (zero based index)
|
||||
pager_startPage: 0,
|
||||
|
||||
// Number of visible rows
|
||||
pager_size: 10,
|
||||
|
||||
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js)
|
||||
pager_savePages: true,
|
||||
|
||||
//defines custom storage key
|
||||
pager_storageKey: 'tablesorter-pager',
|
||||
|
||||
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
|
||||
// table row set to a height to compensate; default is false
|
||||
pager_fixedHeight: false,
|
||||
|
||||
// count child rows towards the set page size? (set true if it is a visible table row within the pager)
|
||||
// if true, child row(s) may not appear to be attached to its parent row, may be split across pages or
|
||||
// may distort the table if rowspan or cellspans are included.
|
||||
pager_countChildRows: false,
|
||||
|
||||
// remove rows from the table to speed up the sort of large tables.
|
||||
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
|
||||
pager_removeRows: false, // removing rows in larger tables speeds up the sort
|
||||
|
||||
// use this format: "http://mydatabase.com?page={page}&size={size}&{sortList:col}&{filterList:fcol}"
|
||||
// where {page} is replaced by the page number, {size} is replaced by the number of records to show,
|
||||
// {sortList:col} adds the sortList to the url into a "col" array, and {filterList:fcol} adds
|
||||
// the filterList to the url into an "fcol" array.
|
||||
// So a sortList = [[2,0],[3,0]] becomes "&col[2]=0&col[3]=0" in the url
|
||||
// and a filterList = [[2,Blue],[3,13]] becomes "&fcol[2]=Blue&fcol[3]=13" in the url
|
||||
pager_ajaxUrl: null,
|
||||
|
||||
// modify the url after all processing has been applied
|
||||
pager_customAjaxUrl: function(table, url) { return url; },
|
||||
|
||||
// modify the $.ajax object to allow complete control over your ajax requests
|
||||
pager_ajaxObject: {
|
||||
dataType: 'json'
|
||||
},
|
||||
|
||||
// set this to false if you want to block ajax loading on init
|
||||
pager_processAjaxOnInit: true,
|
||||
|
||||
// process ajax so that the following information is returned:
|
||||
// [ total_rows (number), rows (array of arrays), headers (array; optional) ]
|
||||
// example:
|
||||
// [
|
||||
// 100, // total rows
|
||||
// [
|
||||
// [ "row1cell1", "row1cell2", ... "row1cellN" ],
|
||||
// [ "row2cell1", "row2cell2", ... "row2cellN" ],
|
||||
// ...
|
||||
// [ "rowNcell1", "rowNcell2", ... "rowNcellN" ]
|
||||
// ],
|
||||
// [ "header1", "header2", ... "headerN" ] // optional
|
||||
// ]
|
||||
pager_ajaxProcessing: function(ajax){ return [ 0, [], null ]; },
|
||||
|
||||
// css class names of pager arrows
|
||||
pager_css: {
|
||||
container : 'tablesorter-pager',
|
||||
errorRow : '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 selectors
|
||||
pager_selectors: {
|
||||
container : '.pager', // target the pager markup
|
||||
first : '.first', // go to first page arrow
|
||||
prev : '.prev', // previous page arrow
|
||||
next : '.next', // next page arrow
|
||||
last : '.last', // go to last page arrow
|
||||
goto : '.gotoPage', // go to page selector - select dropdown that sets the current page
|
||||
pageDisplay : '.pagedisplay', // location of where the "output" is displayed
|
||||
pageSize : '.pagesize' // page size selector - select dropdown that sets the "size" option
|
||||
}
|
||||
},
|
||||
init: function(table){
|
||||
tsp.init(table);
|
||||
},
|
||||
// only update to complete sorter initialization
|
||||
format: function(table, c){
|
||||
if (!(c.pager && c.pager.initialized)){
|
||||
return tsp.initComplete(table, c);
|
||||
}
|
||||
tsp.moveToPage(table, c.pager, false);
|
||||
},
|
||||
remove: function(table, c){
|
||||
tsp.destroyPager(table, c);
|
||||
}
|
||||
});
|
||||
|
||||
/* pager widget functions */
|
||||
tsp = ts.pager = {
|
||||
|
||||
init: function(table) {
|
||||
// check if tablesorter has initialized
|
||||
if (table.hasInitialized && table.config.pager.initialized) { return; }
|
||||
var t,
|
||||
c = table.config,
|
||||
wo = c.widgetOptions,
|
||||
s = wo.pager_selectors,
|
||||
|
||||
// save pager variables
|
||||
p = c.pager = $.extend({
|
||||
totalPages: 0,
|
||||
filteredRows: 0,
|
||||
filteredPages: 0,
|
||||
currentFilters: [],
|
||||
page: wo.pager_startPage,
|
||||
size: wo.pager_size,
|
||||
startRow: 0,
|
||||
endRow: 0,
|
||||
ajaxCounter: 0,
|
||||
$size: null,
|
||||
last: {}
|
||||
}, c.pager);
|
||||
|
||||
// pager initializes multiple times before table has completed initialization
|
||||
if (p.isInitializing) { return; }
|
||||
|
||||
p.isInitializing = true;
|
||||
if (c.debug) {
|
||||
ts.log('Pager initializing');
|
||||
}
|
||||
|
||||
// added in case the pager is reinitialized after being destroyed.
|
||||
p.$container = $(s.container).addClass(wo.pager_css.container).show();
|
||||
// goto selector
|
||||
p.$goto = p.$container.find(s.goto);
|
||||
// page size selector
|
||||
p.$size = p.$container.find(s.pageSize);
|
||||
p.totalRows = c.$tbodies.eq(0).children().length;
|
||||
p.oldAjaxSuccess = p.oldAjaxSuccess || wo.pager_ajaxObject.success;
|
||||
c.appender = tsp.appender;
|
||||
if (ts.filter && $.inArray('filter', c.widgets) >= 0) {
|
||||
// get any default filter settings (data-value attribute) fixes #388
|
||||
p.currentFilters = c.$table.data('lastSearch') || ts.filter.setDefaults(table, c, wo) || [];
|
||||
// set, but don't apply current filters
|
||||
ts.setFilters(table, p.currentFilters, false);
|
||||
}
|
||||
if (wo.pager_savePages && ts.storage) {
|
||||
t = ts.storage(table, wo.pager_storageKey) || {}; // fixes #387
|
||||
p.page = isNaN(t.page) ? p.page : t.page;
|
||||
p.size = ( isNaN(t.size) ? p.size : t.size ) || 10;
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
}
|
||||
// clear initialized flag
|
||||
p.initialized = false;
|
||||
// before initialization event
|
||||
c.$table.trigger('pagerBeforeInitialized', c);
|
||||
|
||||
tsp.enablePager(table, c, false);
|
||||
|
||||
if ( typeof(wo.pager_ajaxUrl) === 'string' ) {
|
||||
// ajax pager; interact with database
|
||||
p.ajax = true;
|
||||
// When filtering with ajax, allow only custom filtering function, disable default filtering since it will be done server side.
|
||||
wo.filter_serversideFiltering = true;
|
||||
c.serverSideSorting = true;
|
||||
tsp.moveToPage(table, p);
|
||||
} else {
|
||||
p.ajax = false;
|
||||
// Regular pager; all rows stored in memory
|
||||
c.$table.trigger("appendCache", [{}, true]);
|
||||
tsp.hideRowsSetup(table, c);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
initComplete: function(table, c){
|
||||
var p = c.pager;
|
||||
tsp.changeHeight(table, c);
|
||||
tsp.bindEvents(table, c);
|
||||
|
||||
// pager initialized
|
||||
p.initialized = true;
|
||||
p.isInitializing = false;
|
||||
tsp.setPageSize(table, 0, c); // page size 0 is ignored
|
||||
c.$table.trigger('pagerInitialized', c);
|
||||
|
||||
},
|
||||
|
||||
bindEvents: function(table, c){
|
||||
var ctrls, fxn,
|
||||
p = c.pager,
|
||||
wo = c.widgetOptions,
|
||||
s = wo.pager_selectors;
|
||||
|
||||
c.$table
|
||||
.unbind('filterStart filterEnd sortEnd disable enable destroy update updateRows updateAll addRows pageSize '.split(' ').join('.pager '))
|
||||
.bind('filterStart.pager', function(e, filters) {
|
||||
p.currentFilters = filters;
|
||||
p.page = 0; // fixes #456
|
||||
})
|
||||
// update pager after filter widget completes
|
||||
.bind('filterEnd.pager sortEnd.pager', function() {
|
||||
if (p.initialized) {
|
||||
tsp.moveToPage(table, p, false);
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
tsp.fixHeight(table, c);
|
||||
}
|
||||
})
|
||||
.bind('disable.pager', function(e){
|
||||
e.stopPropagation();
|
||||
tsp.showAllRows(table, c);
|
||||
})
|
||||
.on('enable.pager', function(e){
|
||||
e.stopPropagation();
|
||||
tsp.enablePager(table, c, true);
|
||||
})
|
||||
.on('destroy.pager', function(e){
|
||||
e.stopPropagation();
|
||||
tsp.destroyPager(table, c);
|
||||
})
|
||||
.on('update updateRows updateAll addRows '.split(' ').join('.pager '), function(e){
|
||||
e.stopPropagation();
|
||||
tsp.hideRows(table, c);
|
||||
// make sure widgets are applied - fixes #450
|
||||
c.$table.trigger('applyWidgets');
|
||||
})
|
||||
.on('pageSize.pager', function(e,v){
|
||||
e.stopPropagation();
|
||||
tsp.setPageSize(table, parseInt(v, 10) || 10, c);
|
||||
tsp.hideRows(table, c);
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
if (p.$size.length) { p.$size.val(p.size); } // twice?
|
||||
})
|
||||
.on('pageSet.pager', function(e,v){
|
||||
e.stopPropagation();
|
||||
p.page = (parseInt(v, 10) || 1) - 1;
|
||||
if (p.$goto.length) { p.$goto.val(c.size); } // twice?
|
||||
tsp.moveToPage(table, p);
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
});
|
||||
|
||||
// clicked controls
|
||||
ctrls = [ s.first, s.prev, s.next, s.last ];
|
||||
fxn = [ 'moveToFirstPage', 'moveToPrevPage', 'moveToNextPage', 'moveToLastPage' ];
|
||||
p.$container.find(ctrls.join(','))
|
||||
.attr("tabindex", 0)
|
||||
.unbind('click.pager')
|
||||
.bind('click.pager', function(e){
|
||||
e.stopPropagation();
|
||||
var i,
|
||||
$c = $(this),
|
||||
l = ctrls.length;
|
||||
if ( !$c.hasClass(wo.pager_css.disabled) ) {
|
||||
for (i = 0; i < l; i++) {
|
||||
if ($c.is(ctrls[i])) {
|
||||
tsp[fxn[i]](table, p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if ( p.$goto.length ) {
|
||||
p.$goto
|
||||
.unbind('change')
|
||||
.bind('change', function(){
|
||||
p.page = $(this).val() - 1;
|
||||
tsp.moveToPage(table, p);
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
});
|
||||
}
|
||||
|
||||
if ( p.$size.length ) {
|
||||
p.$size
|
||||
.unbind('change.pager')
|
||||
.bind('change.pager', function() {
|
||||
p.$size.val( $(this).val() ); // in case there are more than one pagers
|
||||
if ( !$(this).hasClass(wo.pager_css.disabled) ) {
|
||||
tsp.setPageSize(table, parseInt( $(this).val(), 10 ), c);
|
||||
tsp.changeHeight(table, c);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// hide arrows at extremes
|
||||
pagerArrows: function(c, disable) {
|
||||
var p = c.pager,
|
||||
dis = !!disable,
|
||||
first = dis || p.page === 0,
|
||||
tp = Math.min( p.totalPages, p.filteredPages ),
|
||||
last = dis || p.page === tp - 1 || p.totalPages === 0,
|
||||
wo = c.widgetOptions,
|
||||
s = wo.pager_selectors;
|
||||
if ( wo.pager_updateArrows ) {
|
||||
p.$container.find(s.first + ',' + s.prev).toggleClass(wo.pager_css.disabled, first).attr('aria-disabled', first);
|
||||
p.$container.find(s.next + ',' + s.last).toggleClass(wo.pager_css.disabled, last).attr('aria-disabled', last);
|
||||
}
|
||||
},
|
||||
|
||||
updatePageDisplay: function(table, c, completed) {
|
||||
var i, pg, s, out,
|
||||
wo = c.widgetOptions,
|
||||
p = c.pager,
|
||||
f = c.$table.hasClass('hasFilters') && !wo.pager_ajaxUrl,
|
||||
t = (c.widgetOptions && c.widgetOptions.filter_filteredRow || 'filtered') + ',' + c.selectorRemove +
|
||||
(wo.pager_countChildRows ? '' : ',.' + c.cssChildRow),
|
||||
sz = p.size || 10; // don't allow dividing by zero
|
||||
p.$size.add(p.$goto).removeClass(wo.pager_css.disabled).removeAttr('disabled').attr('aria-disabled', 'false');
|
||||
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for "pageSize" method
|
||||
p.filteredRows = (f) ? c.$tbodies.eq(0).children('tr').not('.' + t).length : p.totalRows;
|
||||
p.filteredPages = (f) ? Math.ceil( p.filteredRows / sz ) || 1 : p.totalPages;
|
||||
if ( Math.min( p.totalPages, p.filteredPages ) >= 0 ) {
|
||||
t = (p.size * p.page > p.filteredRows);
|
||||
p.startRow = (t) ? 1 : (p.filteredRows === 0 ? 0 : p.size * p.page + 1);
|
||||
p.page = (t) ? 0 : p.page;
|
||||
p.endRow = Math.min( p.filteredRows, p.totalRows, p.size * ( p.page + 1 ) );
|
||||
out = p.$container.find(wo.pager_selectors.pageDisplay);
|
||||
// form the output string (can now get a new output string from the server)
|
||||
s = ( p.ajaxData && p.ajaxData.output ? p.ajaxData.output || wo.pager_output : wo.pager_output )
|
||||
// {page} = one-based index; {page+#} = zero based index +/- value
|
||||
.replace(/\{page([\-+]\d+)?\}/gi, function(m,n){
|
||||
return p.totalPages ? p.page + (n ? parseInt(n, 10) : 1) : 0;
|
||||
})
|
||||
// {totalPages}, {extra}, {extra:0} (array) or {extra : key} (object)
|
||||
.replace(/\{\w+(\s*:\s*\w+)?\}/gi, function(m){
|
||||
var str = m.replace(/[{}\s]/g,''),
|
||||
extra = str.split(':'),
|
||||
data = p.ajaxData,
|
||||
// return zero for default page/row numbers
|
||||
deflt = /(rows?|pages?)$/i.test(str) ? 0 : '';
|
||||
return extra.length > 1 && data && data[extra[0]] ? data[extra[0]][extra[1]] : p[str] || (data ? data[str] : deflt) || deflt;
|
||||
});
|
||||
if (out.length) {
|
||||
out[ (out[0].tagName === 'INPUT') ? 'val' : 'html' ](s);
|
||||
if ( p.$goto.length ) {
|
||||
t = '';
|
||||
pg = Math.min( p.totalPages, p.filteredPages );
|
||||
for ( i = 1; i <= pg; i++ ) {
|
||||
t += '<option>' + i + '</option>';
|
||||
}
|
||||
p.$goto.html(t).val( p.page + 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
tsp.pagerArrows(c);
|
||||
if (p.initialized && completed !== false) {
|
||||
c.$table.trigger('pagerComplete', c);
|
||||
// save pager info to storage
|
||||
if (wo.pager_savePages && ts.storage) {
|
||||
ts.storage(table, wo.pager_storageKey, {
|
||||
page : p.page,
|
||||
size : p.size
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
fixHeight: function(table, c) {
|
||||
var d, h,
|
||||
p = c.pager,
|
||||
wo = c.widgetOptions,
|
||||
$b = c.$tbodies.eq(0);
|
||||
if (wo.pager_fixedHeight) {
|
||||
$b.find('tr.pagerSavedHeightSpacer').remove();
|
||||
h = $.data(table, 'pagerSavedHeight');
|
||||
if (h) {
|
||||
d = h - $b.height();
|
||||
if ( d > 5 && $.data(table, 'pagerLastSize') === p.size && $b.children('tr:visible').length < p.size ) {
|
||||
$b.append('<tr class="pagerSavedHeightSpacer ' + wo.pager_selectors.remove.replace(/(tr)?\./g,'') + '" style="height:' + d + 'px;"></tr>');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
changeHeight: function(table, c) {
|
||||
var $b = c.$tbodies.eq(0);
|
||||
$b.find('tr.pagerSavedHeightSpacer').remove();
|
||||
$.data(table, 'pagerSavedHeight', $b.height());
|
||||
tsp.fixHeight(table, c);
|
||||
$.data(table, 'pagerLastSize', c.pager.size);
|
||||
},
|
||||
|
||||
hideRows: function(table, c){
|
||||
if (!c.widgetOptions.pager_ajaxUrl) {
|
||||
var i,
|
||||
lastIndex = 0,
|
||||
p = c.pager,
|
||||
wo = c.widgetOptions,
|
||||
rows = c.$tbodies.eq(0).children(),
|
||||
l = rows.length,
|
||||
s = ( p.page * p.size ),
|
||||
e = s + p.size,
|
||||
f = wo && wo.filter_filteredRow || 'filtered',
|
||||
j = 0; // size counter
|
||||
for ( i = 0; i < l; i++ ){
|
||||
if ( !rows[i].className.match(f) ) {
|
||||
if (j === s && rows[i].className.match(c.cssChildRow)) {
|
||||
// hide child rows @ start of pager (if already visible)
|
||||
rows[i].style.display = 'none';
|
||||
} else {
|
||||
rows[i].style.display = ( j >= s && j < e ) ? '' : 'none';
|
||||
// don't count child rows
|
||||
j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.slice(1)) && !wo.pager_countChildRows ? 0 : 1;
|
||||
if ( j === e && rows[i].style.display !== 'none' && rows[i].className.match(ts.css.cssHasChild) ) {
|
||||
lastIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// add any attached child rows to last row of pager. Fixes part of issue #396
|
||||
if ( lastIndex > 0 && rows[lastIndex].className.match(ts.css.cssHasChild) ) {
|
||||
while ( ++lastIndex < l && rows[lastIndex].className.match(c.cssChildRow) ) {
|
||||
rows[lastIndex].style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hideRowsSetup: function(table, c){
|
||||
var p = c.pager;
|
||||
p.size = parseInt( p.$size.val(), 10 ) || p.size;
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
tsp.pagerArrows(c);
|
||||
if ( !c.widgetOptions.pager_removeRows ) {
|
||||
tsp.hideRows(table, c);
|
||||
c.$table.on('sortEnd.pager filterEnd.pager', function(){
|
||||
tsp.hideRows(table, c);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
renderAjax: function(data, table, c, xhr, exception){
|
||||
var p = c.pager,
|
||||
wo = c.widgetOptions;
|
||||
// process data
|
||||
if ( $.isFunction(wo.pager_ajaxProcessing) ) {
|
||||
// ajaxProcessing result: [ total, rows, headers ]
|
||||
var i, j, t, hsh, $f, $sh, th, d, l, rr_count,
|
||||
$t = c.$table,
|
||||
tds = '',
|
||||
result = wo.pager_ajaxProcessing(data, table) || [ 0, [] ],
|
||||
hl = $t.find('thead th').length;
|
||||
|
||||
// Clean up any previous error.
|
||||
ts.showError(table);
|
||||
|
||||
if ( exception ) {
|
||||
if (c.debug) {
|
||||
ts.log('Ajax Error', xhr, exception);
|
||||
}
|
||||
ts.showError(table, exception.message + ' (' + xhr.status + ')');
|
||||
c.$tbodies.eq(0).empty();
|
||||
p.totalRows = 0;
|
||||
} else {
|
||||
// process ajax object
|
||||
if (!$.isArray(result)) {
|
||||
p.ajaxData = result;
|
||||
p.totalRows = result.total;
|
||||
th = result.headers;
|
||||
d = result.rows;
|
||||
} else {
|
||||
// allow [ total, rows, headers ] or [ rows, total, headers ]
|
||||
t = isNaN(result[0]) && !isNaN(result[1]);
|
||||
// ensure a zero returned row count doesn't fail the logical ||
|
||||
rr_count = result[t ? 1 : 0];
|
||||
p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count;
|
||||
d = p.totalRows === 0 ? [""] : result[t ? 0 : 1] || []; // row data
|
||||
th = result[2]; // headers
|
||||
}
|
||||
l = d.length;
|
||||
if (d instanceof jQuery) {
|
||||
// append jQuery object
|
||||
c.$tbodies.eq(0).empty().append(d);
|
||||
} else if (l) {
|
||||
// build table from array
|
||||
for ( i = 0; i < l; i++ ) {
|
||||
tds += '<tr>';
|
||||
for ( j = 0; j < d[i].length; j++ ) {
|
||||
// build tbody cells; watch for data containing HTML markup - see #434
|
||||
tds += /^\s*<td/.test(d[i][j]) ? $.trim(d[i][j]) : '<td>' + d[i][j] + '</td>';
|
||||
}
|
||||
tds += '</tr>';
|
||||
}
|
||||
// add rows to first tbody
|
||||
if (wo.pager_processAjaxOnInit) {
|
||||
c.$tbodies.eq(0).html( tds );
|
||||
} else {
|
||||
wo.pager_processAjaxOnInit = true;
|
||||
}
|
||||
}
|
||||
// only add new header text if the length matches
|
||||
if ( th && th.length === hl ) {
|
||||
hsh = $t.hasClass('hasStickyHeaders');
|
||||
$sh = hsh ? wo.$sticky.children('thead:first').children().children() : '';
|
||||
$f = $t.find('tfoot tr:first').children();
|
||||
// don't change td headers (may contain pager)
|
||||
c.$headers.filter('th').each(function(j){
|
||||
var $t = $(this), icn;
|
||||
// add new test within the first span it finds, or just in the header
|
||||
if ( $t.find('.' + ts.css.icon).length ) {
|
||||
icn = $t.find('.' + ts.css.icon).clone(true);
|
||||
$t.find('.tablesorter-header-inner').html( th[j] ).append(icn);
|
||||
if ( hsh && $sh.length ) {
|
||||
icn = $sh.eq(j).find('.' + ts.css.icon).clone(true);
|
||||
$sh.eq(j).find('.tablesorter-header-inner').html( th[j] ).append(icn);
|
||||
}
|
||||
} else {
|
||||
$t.find('.tablesorter-header-inner').html( th[j] );
|
||||
if (hsh && $sh.length) {
|
||||
$sh.eq(j).find('.tablesorter-header-inner').html( th[j] );
|
||||
}
|
||||
}
|
||||
$f.eq(j).html( th[j] );
|
||||
});
|
||||
}
|
||||
}
|
||||
if (c.showProcessing) {
|
||||
ts.isProcessing(table); // remove loading icon
|
||||
}
|
||||
// make sure last pager settings are saved, prevents multiple server side calls with
|
||||
// the same parameters
|
||||
p.totalPages = Math.ceil( p.totalRows / ( p.size || 10 ) );
|
||||
p.last.totalRows = p.totalRows;
|
||||
p.last.currentFilters = p.currentFilters;
|
||||
p.last.sortList = (c.sortList || []).join(',');
|
||||
tsp.updatePageDisplay(table, c);
|
||||
tsp.fixHeight(table, c);
|
||||
$t.trigger('updateCache', [function(){
|
||||
if (p.initialized) {
|
||||
// apply widgets after table has rendered
|
||||
$t.trigger('applyWidgets');
|
||||
$t.trigger('pagerChange', p);
|
||||
}
|
||||
}]);
|
||||
}
|
||||
if (!p.initialized) {
|
||||
c.$table.trigger('applyWidgets');
|
||||
}
|
||||
},
|
||||
|
||||
getAjax: function(table, c){
|
||||
var counter,
|
||||
url = tsp.getAjaxUrl(table, c),
|
||||
$doc = $(document),
|
||||
wo = c.widgetOptions,
|
||||
p = c.pager;
|
||||
if ( url !== '' ) {
|
||||
if (c.showProcessing) {
|
||||
ts.isProcessing(table, true); // show loading icon
|
||||
}
|
||||
$doc.on('ajaxError.pager', function(e, xhr, settings, exception) {
|
||||
tsp.renderAjax(null, table, c, xhr, exception);
|
||||
$doc.unbind('ajaxError.pager');
|
||||
});
|
||||
counter = ++p.ajaxCounter;
|
||||
wo.pager_ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
|
||||
wo.pager_ajaxObject.success = function(data) {
|
||||
// Refuse to process old ajax commands that were overwritten by new ones - see #443
|
||||
if (counter < p.ajaxCounter){
|
||||
return;
|
||||
}
|
||||
tsp.renderAjax(data, table, c);
|
||||
$doc.unbind('ajaxError.pager');
|
||||
if (typeof p.oldAjaxSuccess === 'function') {
|
||||
p.oldAjaxSuccess(data);
|
||||
}
|
||||
};
|
||||
if (c.debug) {
|
||||
ts.log('ajax initialized', wo.pager_ajaxObject);
|
||||
}
|
||||
$.ajax(wo.pager_ajaxObject);
|
||||
}
|
||||
},
|
||||
|
||||
getAjaxUrl: function(table, c) {
|
||||
var p = c.pager,
|
||||
wo = c.widgetOptions,
|
||||
url = (wo.pager_ajaxUrl) ? wo.pager_ajaxUrl
|
||||
// allow using "{page+1}" in the url string to switch to a non-zero based index
|
||||
.replace(/\{page([\-+]\d+)?\}/, function(s,n){ return p.page + (n ? parseInt(n, 10) : 0); })
|
||||
.replace(/\{size\}/g, p.size) : '',
|
||||
sl = c.sortList,
|
||||
fl = p.currentFilters || $(table).data('lastSearch') || [],
|
||||
sortCol = url.match(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/),
|
||||
filterCol = url.match(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/),
|
||||
arry = [];
|
||||
if (sortCol) {
|
||||
sortCol = sortCol[1];
|
||||
$.each(sl, function(i,v){
|
||||
arry.push(sortCol + '[' + v[0] + ']=' + v[1]);
|
||||
});
|
||||
// if the arry is empty, just add the col parameter... "&{sortList:col}" becomes "&col"
|
||||
url = url.replace(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/g, arry.length ? arry.join('&') : sortCol );
|
||||
arry = [];
|
||||
}
|
||||
if (filterCol) {
|
||||
filterCol = filterCol[1];
|
||||
$.each(fl, function(i,v){
|
||||
if (v) {
|
||||
arry.push(filterCol + '[' + i + ']=' + encodeURIComponent(v));
|
||||
}
|
||||
});
|
||||
// if the arry is empty, just add the fcol parameter... "&{filterList:fcol}" becomes "&fcol"
|
||||
url = url.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g, arry.length ? arry.join('&') : filterCol );
|
||||
p.currentFilters = fl;
|
||||
}
|
||||
if ( $.isFunction(wo.pager_customAjaxUrl) ) {
|
||||
url = wo.pager_customAjaxUrl(table, url);
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.log('Pager ajax url: ' + url);
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
||||
renderTable: function(table, rows) {
|
||||
var i, $tb,
|
||||
c = table.config,
|
||||
p = c.pager,
|
||||
wo = c.widgetOptions,
|
||||
l = rows && rows.length || 0, // rows may be undefined
|
||||
s = ( p.page * p.size ),
|
||||
e = ( s + p.size );
|
||||
if ( l < 1 ) { return; } // empty table, abort!
|
||||
if ( p.page >= p.totalPages ) {
|
||||
// lets not render the table more than once
|
||||
return tsp.moveToLastPage(table, p);
|
||||
}
|
||||
p.isDisabled = false; // needed because sorting will change the page and re-enable the pager
|
||||
if (p.initialized) { c.$table.trigger('pagerChange', c); }
|
||||
|
||||
if ( !wo.pager_removeRows ) {
|
||||
tsp.hideRows(table, c);
|
||||
} else {
|
||||
if ( e > rows.length ) {
|
||||
e = rows.length;
|
||||
}
|
||||
ts.clearTableBody(table);
|
||||
$tb = ts.processTbody(table, c.$tbodies.eq(0), true);
|
||||
for ( i = s; i < e; i++ ) {
|
||||
$tb.append(rows[i]);
|
||||
}
|
||||
ts.processTbody(table, $tb, false);
|
||||
}
|
||||
|
||||
tsp.updatePageDisplay(table, c);
|
||||
if ( !p.isDisabled ) { tsp.fixHeight(table, c); }
|
||||
|
||||
wo.pager_startPage = p.page;
|
||||
wo.pager_size = p.size;
|
||||
c.$table.trigger('applyWidgets');
|
||||
if (table.isUpdating) {
|
||||
c.$table.trigger('updateComplete');
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
showAllRows: function(table, c){
|
||||
var p = c.pager,
|
||||
wo = c.widgetOptions;
|
||||
if ( p.ajax ) {
|
||||
tsp.pagerArrows(c, true);
|
||||
} else {
|
||||
p.isDisabled = true;
|
||||
$.data(table, 'pagerLastPage', p.page);
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
p.page = 0;
|
||||
p.size = p.totalRows;
|
||||
p.totalPages = 1;
|
||||
c.$table
|
||||
.addClass('pagerDisabled')
|
||||
.removeAttr('aria-describedby')
|
||||
.find('tr.pagerSavedHeightSpacer').remove();
|
||||
tsp.renderTable(table, c.rowsCopy);
|
||||
if (c.debug) {
|
||||
ts.log('pager disabled');
|
||||
}
|
||||
}
|
||||
// disable size selector
|
||||
p.$size.add(p.$goto).each(function(){
|
||||
$(this).attr('aria-disabled', 'true').addClass(wo.pager_css.disabled)[0].disabled = true;
|
||||
});
|
||||
},
|
||||
|
||||
moveToPage: function(table, p, pageMoved) {
|
||||
if ( p.isDisabled ) { return; }
|
||||
var c = table.config,
|
||||
l = p.last,
|
||||
pg = Math.min( p.totalPages, p.filteredPages );
|
||||
if ( p.page < 0 ) { p.page = 0; }
|
||||
if ( p.page > ( pg - 1 ) && pg !== 0 ) { p.page = pg - 1; }
|
||||
// fixes issue where one current filter is [] and the other is ['','',''],
|
||||
// making the next if comparison think the filters as different. Fixes #202.
|
||||
l.currentFilters = (l.currentFilters || []).join('') === '' ? [] : l.currentFilters;
|
||||
p.currentFilters = (p.currentFilters || []).join('') === '' ? [] : p.currentFilters;
|
||||
// don't allow rendering multiple times on the same page/size/totalRows/filters/sorts
|
||||
if ( l.page === p.page && l.size === p.size && l.totalRows === p.totalRows &&
|
||||
(l.currentFilters || []).join(',') === (p.currentFilters || []).join(',') &&
|
||||
l.sortList === (c.sortList || []).join(',') ) {
|
||||
return;
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.log('Pager changing to page ' + p.page);
|
||||
}
|
||||
p.last = {
|
||||
page : p.page,
|
||||
size : p.size,
|
||||
// fixes #408; modify sortList otherwise it auto-updates
|
||||
sortList : (c.sortList || []).join(','),
|
||||
totalRows : p.totalRows,
|
||||
currentFilters : p.currentFilters || []
|
||||
};
|
||||
if (p.ajax) {
|
||||
tsp.getAjax(table, c);
|
||||
} else if (!p.ajax) {
|
||||
tsp.renderTable(table, c.rowsCopy);
|
||||
}
|
||||
$.data(table, 'pagerLastPage', p.page);
|
||||
if (p.initialized && pageMoved !== false) {
|
||||
c.$table.trigger('pageMoved', c);
|
||||
if (!p.ajax && table.isUpdating) {
|
||||
c.$table.trigger('updateComplete');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setPageSize: function(table, size, c) {
|
||||
var p = c.pager;
|
||||
p.size = size || p.size || 10;
|
||||
p.$size.val(p.size);
|
||||
$.data(table, 'pagerLastPage', p.page);
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
p.totalPages = Math.ceil( p.totalRows / p.size );
|
||||
p.filteredPages = Math.ceil( p.filteredRows / p.size );
|
||||
tsp.moveToPage(table, p);
|
||||
},
|
||||
|
||||
moveToFirstPage: function(table, p) {
|
||||
p.page = 0;
|
||||
tsp.moveToPage(table, p);
|
||||
},
|
||||
|
||||
moveToLastPage: function(table, p) {
|
||||
p.page = ( Math.min( p.totalPages, p.filteredPages ) - 1 );
|
||||
tsp.moveToPage(table, p);
|
||||
},
|
||||
|
||||
moveToNextPage: function(table, p) {
|
||||
p.page++;
|
||||
if ( p.page >= ( Math.min( p.totalPages, p.filteredPages ) - 1 ) ) {
|
||||
p.page = ( Math.min( p.totalPages, p.filteredPages ) - 1 );
|
||||
}
|
||||
tsp.moveToPage(table, p);
|
||||
},
|
||||
|
||||
moveToPrevPage: function(table, p) {
|
||||
p.page--;
|
||||
if ( p.page <= 0 ) {
|
||||
p.page = 0;
|
||||
}
|
||||
tsp.moveToPage(table, p);
|
||||
},
|
||||
|
||||
destroyPager: function(table, c){
|
||||
var p = c.pager;
|
||||
tsp.showAllRows(table, c);
|
||||
p.$container.hide(); // hide pager
|
||||
c.appender = null; // remove pager appender function
|
||||
p.initialized = false;
|
||||
c.$table.unbind('destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager');
|
||||
if (ts.storage) {
|
||||
ts.storage(table, c.widgetOptions.pager_storageKey, '');
|
||||
}
|
||||
},
|
||||
|
||||
enablePager: function(table, c, triggered){
|
||||
var info, p = c.pager;
|
||||
p.isDisabled = false;
|
||||
p.page = $.data(table, 'pagerLastPage') || p.page || 0;
|
||||
p.size = $.data(table, 'pagerLastSize') || parseInt(p.$size.find('option[selected]').val(), 10) || p.size || 10;
|
||||
p.$size.val(p.size); // set page size
|
||||
p.totalPages = Math.ceil( Math.min( p.totalRows, p.filteredRows ) / p.size );
|
||||
c.$table.removeClass('pagerDisabled');
|
||||
// if table id exists, include page display with aria info
|
||||
if ( table.id ) {
|
||||
info = table.id + '_pager_info';
|
||||
p.$container.find(c.widgetOptions.pager_selectors.pageDisplay).attr('id', info);
|
||||
c.$table.attr('aria-describedby', info);
|
||||
}
|
||||
if ( triggered ) {
|
||||
c.$table.trigger('updateRows');
|
||||
tsp.setPageSize(table, p.size, c);
|
||||
tsp.hideRowsSetup(table, c);
|
||||
tsp.fixHeight(table, c);
|
||||
if (c.debug) {
|
||||
ts.log('pager enabled');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
appender: function(table, rows) {
|
||||
var c = table.config,
|
||||
wo = c.widgetOptions,
|
||||
p = c.pager;
|
||||
if ( !p.ajax ) {
|
||||
c.rowsCopy = rows;
|
||||
p.totalRows = c.widgetOptions.pager_countChildRows ? c.$tbodies.eq(0).children().length : rows.length;
|
||||
p.size = $.data(table, 'pagerLastSize') || p.size || wo.pager_size || 10;
|
||||
p.totalPages = Math.ceil( p.totalRows / p.size );
|
||||
tsp.moveToPage(table, p, true);
|
||||
// update display here in case all rows are removed
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
} else {
|
||||
tsp.moveToPage(table, p, true);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// see #486
|
||||
ts.showError = function(table, message){
|
||||
$(table).each(function(){
|
||||
var $row,
|
||||
c = this.config,
|
||||
errorRow = c.pager && c.pager.cssErrorRow || c.widgetOptions.pager_css && c.widgetOptions.pager_css.errorRow || 'tablesorter-errorRow';
|
||||
if (c) {
|
||||
if (typeof message === 'undefined') {
|
||||
c.$table.find('thead').find(c.selectorRemove).remove();
|
||||
} else {
|
||||
$row = ( /tr\>/.test(message) ? $(message) : $('<tr><td colspan="' + c.columns + '">' + message + '</td></tr>') )
|
||||
.click(function(){
|
||||
$(this).remove();
|
||||
})
|
||||
// add error row to thead instead of tbody, or clicking on the header will result in a parser error
|
||||
.appendTo( c.$table.find('thead:first') )
|
||||
.addClass( errorRow + ' ' + c.selectorRemove.replace(/^[.#]/, '') )
|
||||
.attr({
|
||||
role : 'alert',
|
||||
'aria-live' : 'assertive'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
Reference in new issue
Block a user