' + nav;
72 | }
73 |
74 | function zoomOnLayerGroup( map, layer ) {
75 | var clat = 0.0, clon = 0.0, ccount = 0;
76 | layer.eachLayer(function(m) {
77 | clat += m.getLatLng().lat;
78 | clon += m.getLatLng().lng;
79 | ccount++;
80 | });
81 | if( ccount > 0 )
82 | map.panTo([clat/ccount, clon/ccount]);
83 | }
84 |
85 | for( var d, count = 0; d = body.firstChild; ) {
86 | if( d.nodeType == 1 && d.localName != 'script' ) pages[++count] = d;
87 | body.removeChild(d);
88 | }
89 | for( var p in pages ) process(pages[p], p);
90 | body.innerHTML = '
';
91 | content = document.getElementById('content');
92 | content.appendChild(document.createComment(''));
93 |
94 | var overviewMap = L.map('overviewmap', {keyboard: false}).setView([60, 30], overviewZoom);
95 | L.tileLayer('http://tile.openstreetmap.org/{z}/{x}/{y}.png', {
96 | attribution: 'Map data ©
OpenStreetMap contributors',
97 | maxZoom: 13, minZoom: 8
98 | }).addTo(overviewMap);
99 | if( typeof overviewLayer != 'undefined' )
100 | overviewMap.addLayer(overviewLayer);
101 | overviewMap.addLayer(pageMarkersLayer);
102 | zoomOnLayerGroup(overviewMap, pageMarkersLayer);
103 |
104 | var detailMap = L.map('detailmap', {keyboard: false}).setView([60, 30], detailZoom);
105 | L.tileLayer('http://tile.openstreetmap.org/{z}/{x}/{y}.png', {
106 | attribution: 'Map data ©
OpenStreetMap contributors',
107 | maxZoom: 18, minZoom: 13
108 | }).addTo(detailMap);
109 | if( typeof detailLayer != 'undefined' )
110 | detailMap.addLayer(detailLayer);
111 |
112 | !function sync() {
113 | setTimeout(sync, 50);
114 | var next = 0 | location.hash.match(/\d+/);
115 | next = Math.max(Math.min(count, next), 1);
116 | if( page == next ) return;
117 | location.hash = page = next;
118 | content.replaceChild(pages[page], content.firstChild);
119 | window.scrollTo(0,0);
120 | if( overviewMap && detailMap ) {
121 | pageMarkersLayer.eachLayer(function(m) {
122 | m.setColor(m.options.letter == page ? 'blue' : 'black');
123 | if( m.options.letter == page )
124 | overviewMap.panTo(m.getLatLng());
125 | });
126 | if( currentDetailLayer )
127 | detailMap.removeLayer(currentDetailLayer);
128 | if( page in photoMarkers ) {
129 | currentDetailLayer = photoMarkers[page];
130 | detailMap.addLayer(currentDetailLayer);
131 | zoomOnLayerGroup(detailMap, currentDetailLayer);
132 | detailMap.setZoom(detailZoom);
133 | document.getElementById('detailmap').style.visibility = 'inherit';
134 | } else
135 | document.getElementById('detailmap').style.visibility = 'hidden';
136 | }
137 | }();
138 |
139 | document.onkeydown = function(e) {
140 | var next = e.which == 39 ? page + 1 : e.which == 37 ? page - 1 : page;
141 | if( next in pages )
142 | location.hash = next;
143 | }
144 | }
145 |
146 | L.LetterMarker = L.Marker.extend({
147 | options: {
148 | letter: 'A',
149 | color: 'black',
150 | riseOnHover: true,
151 | icon: new L.DivIcon({popupAnchor: [2, -2]})
152 | },
153 |
154 | initialize: function( latlng, letter, options ) {
155 | L.Marker.prototype.initialize.call(this, latlng, options);
156 | this.options.letter = letter;
157 | },
158 |
159 | _initIcon: function() {
160 | var options = this.options,
161 | map = this._map,
162 | animation = (map.options.zoomAnimation && map.options.markerZoomAnimation),
163 | classToAdd = animation ? 'leaflet-zoom-animated' : 'leaflet-zoom-hide';
164 |
165 | if (!this._icon) {
166 | var div = document.createElement('div');
167 | div.innerHTML = '' + options.letter + '';
168 | div.className = 'leaflet-marker-icon';
169 | div.style.marginLeft = '-7px';
170 | div.style.marginTop = '-7px';
171 | div.style.width = '15px';
172 | div.style.height = '15px';
173 | div.style.borderRadius = '7px';
174 | div.style.fontSize = '10px';
175 | div.style.fontFamily = 'sans-serif';
176 | div.style.fontWeight = 'bold';
177 | div.style.textAlign = 'center';
178 | div.style.lineHeight = '15px';
179 | div.style.cursor = options.clickable ? 'hand' : 'default';
180 | div.style.color = 'white';
181 | div.style.backgroundColor = options.color;
182 | this._icon = div;
183 |
184 | if (options.title) {
185 | this._icon.title = options.title;
186 | }
187 |
188 | this._initInteraction();
189 |
190 | L.DomUtil.addClass(this._icon, classToAdd);
191 |
192 | if (options.riseOnHover) {
193 | L.DomEvent
194 | .on(this._icon, 'mouseover', this._bringToFront, this)
195 | .on(this._icon, 'mouseout', this._resetZIndex, this);
196 | }
197 | }
198 |
199 | var panes = this._map._panes;
200 | panes.markerPane.appendChild(this._icon);
201 | },
202 |
203 | setColor: function( color ) {
204 | if( !this._icon )
205 | this.options.color = color;
206 | else
207 | this._icon.style.backgroundColor = color;
208 | }
209 | });
210 |
211 | L.letterMarker = function(latlng, letter, options) {
212 | return new L.LetterMarker(latlng, letter, options);
213 | };
214 |
--------------------------------------------------------------------------------