r82988 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82987‎ | r82988 | r82989 >
Date:00:00, 1 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
more cleanup and work on the google maps js
Modified paths:
  • /branches/Maps0.8/includes/features/Maps_BaseMap.php (modified) (history)
  • /branches/Maps0.8/includes/features/Maps_BasePointMap.php (modified) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps/GoogleMaps.php (modified) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMaps.php (modified) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps/ext.maps.googlemaps2.js (modified) (history)
  • /branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayers.php (modified) (history)
  • /branches/Maps0.8/includes/services/OpenLayers/OpenLayers.php (modified) (history)

Diff [purge]

Index: branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayers.php
@@ -23,24 +23,6 @@
2424 $serviceName,
2525 array( 'layers', 'openlayer' )
2626 );
27 -
28 - global $wgResourceModules, $egMapsScriptPath;
29 -
30 - $wgResourceModules['ext.maps.openlayers'] = array(
31 - 'localBasePath' => dirname( __FILE__ ),
32 - 'remoteBasePath' => $egMapsScriptPath . '/includes/services/OpenLayers',
33 - 'group' => 'ext.maps',
34 - 'scripts' => array(
35 - 'OpenLayers/OpenLayers.js',
36 - 'ext.maps.openlayers.js'
37 - ),
38 - 'styles' => array(
39 - 'OpenLayers/theme/default/style.css'
40 - ),
41 - 'messages' => array(
42 - 'maps-markers'
43 - )
44 - );
4527 }
4628
4729 /**
Index: branches/Maps0.8/includes/services/OpenLayers/OpenLayers.php
@@ -19,7 +19,23 @@
2020 if ( !defined( 'MEDIAWIKI' ) ) {
2121 die( 'Not an entry point.' );
2222 }
23 -
 23+
 24+$wgResourceModules['ext.maps.openlayers'] = array(
 25+ 'localBasePath' => dirname( __FILE__ ),
 26+ 'remoteBasePath' => $egMapsScriptPath . '/includes/services/OpenLayers',
 27+ 'group' => 'ext.maps',
 28+ 'scripts' => array(
 29+ 'OpenLayers/OpenLayers.js',
 30+ 'ext.maps.openlayers.js'
 31+ ),
 32+ 'styles' => array(
 33+ 'OpenLayers/theme/default/style.css'
 34+ ),
 35+ 'messages' => array(
 36+ 'maps-markers'
 37+ )
 38+);
 39+
2440 $wgAutoloadClasses['CriterionOLLayer'] = dirname( __FILE__ ) . '/CriterionOLLayer.php';
2541 $wgAutoloadClasses['MapsOpenLayers'] = dirname( __FILE__ ) . '/Maps_OpenLayers.php';
2642 $wgAutoloadClasses['MapsOpenLayersDispMap'] = dirname( __FILE__ ) . '/Maps_OpenLayersDispMap.php';
Index: branches/Maps0.8/includes/services/GoogleMaps/GoogleMaps.php
@@ -20,6 +20,26 @@
2121 die( 'Not an entry point.' );
2222 }
2323
 24+$wgResourceModules['ext.maps.googlemaps2'] = array(
 25+ 'localBasePath' => dirname( __FILE__ ),
 26+ 'remoteBasePath' => $egMapsScriptPath . '/includes/services/GoogleMaps',
 27+ 'group' => 'ext.maps',
 28+ 'scripts' => array(
 29+ 'ext.maps.googlemaps2.js',
 30+ ),
 31+ 'styles' => array(
 32+ 'ext.maps.googlemaps2.css',
 33+ ),
 34+ 'messages' => array(
 35+ 'maps-markers',
 36+ 'maps_overlays',
 37+ 'maps_photos',
 38+ 'maps_videos',
 39+ 'maps_wikipedia',
 40+ 'maps_webcams'
 41+ )
 42+);
 43+
2444 $wgHooks['MappingServiceLoad'][] = 'efMapsInitGoogleMaps';
2545
2646 /**
Index: branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMaps.php
@@ -35,26 +35,6 @@
3636 $serviceName,
3737 array( 'googlemaps', 'google', 'googlemap', 'gmap', 'gmaps' )
3838 );
39 -
40 - global $wgResourceModules, $egMapsScriptPath;
41 -
42 - $wgResourceModules['ext.maps.googlemaps2'] = array(
43 - 'localBasePath' => dirname( __FILE__ ),
44 - 'remoteBasePath' => $egMapsScriptPath . '/includes/services/GoogleMaps',
45 - 'group' => 'ext.maps',
46 - 'scripts' => array(
47 - 'ext.maps.googlemaps2.js',
48 - 'ext.maps.googlemaps2.css',
49 - ),
50 - 'messages' => array(
51 - 'maps-markers',
52 - 'maps_overlays',
53 - 'maps_photos',
54 - 'maps_videos',
55 - 'maps_wikipedia',
56 - 'maps_webcams'
57 - )
58 - );
5939 }
6040
6141 /**
Index: branches/Maps0.8/includes/services/GoogleMaps/ext.maps.googlemaps2.js
@@ -5,282 +5,300 @@
66 * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
77 */
88
9 -(function($) { $( document ).ready( function() {
10 -
11 - // http://maps.google.com/maps?file=api&v=2&key=$egGoogleMapsKey&hl=$langCode
12 -
13 - window.unload = GUnload;
14 -
15 - var GOverlays = [
16 - new GLayer("com.panoramio.all"),
17 - new GLayer("com.youtube.all"),
18 - new GLayer("org.wikipedia.en"),
19 - new GLayer("com.google.webcams")
20 - ];
21 -
22 - for ( mapName in window. ) {
 9+/**
 10+ * The Google Maps API is so nice to take care of loading all it's modules on it's own.
 11+ * This means that when the API is loaded, not all modules will have yet, so we need to
 12+ * wait untill they are available before setting up the maps. Try every 100ms.
 13+ */
 14+function loadGoogleMaps() {
 15+ if ( typeof GLayer == 'undefined' ) {
 16+ setTimeout( function() { loadGoogleMaps(); }, 100 );
 17+ }
 18+ else {
 19+ window.unload = GUnload;
2320
 21+ window.GOverlays = [
 22+ new GLayer("com.panoramio.all"),
 23+ new GLayer("com.youtube.all"),
 24+ new GLayer("org.wikipedia.en"),
 25+ new GLayer("com.google.webcams")
 26+ ];
 27+
 28+ for ( i in window.maps.googlemaps2 ) {
 29+ var map = new googleMap( jQuery );
 30+ map.initializeGoogleMap( 'foo',{},[] );
 31+ }
2432 }
 33+}
 34+
 35+// Load the Google Maps v2 API.
 36+jQuery.getScript(
 37+ 'http://maps.google.com/maps?file=api&v=2&key=' + window.googleMapsKey + '&hl=' + window.googleLangCode,
 38+ function () { loadGoogleMaps(); }
 39+);
 40+
 41+var googleMap = function($) {
2542
26 - /**
27 - * Returns GMarker object on the provided location. It will show a popup baloon
28 - * with title and label when clicked, if either of these is set.
29 - */
 43+ /**
 44+ * Returns GMarker object on the provided location. It will show a popup baloon
 45+ * with title and label when clicked, if either of these is set.
 46+ */
3047 function createGMarker( markerData ) {
31 - var marker;
32 -
33 - if ( markerData.icon != '' ) {
34 - var iconObj = new GIcon( G_DEFAULT_ICON );
35 - iconObj.image = markerData.icon;
36 -
37 - var newimg = new Image();
38 - newimg.src = markerData.icon;
39 -
40 - // Only do these things when there is an actual width, which there won,t the first time the image is loaded.
41 - // FIXME: this means the image won't have it's correct size when it differs from the default on first load!
42 - if ( newimg.width > 0 ) {
43 - /* Determine size of icon and pass it in */
44 - iconObj.iconSize.width = newimg.width;
45 - iconObj.iconSize.height = newimg.height;
46 - iconObj.shadow = null;
47 -
48 - /* Anchor the icon on bottom middle */
49 - var anchor = new GPoint();
50 - anchor.x = Math.floor( newimg.width / 2 );
51 - anchor.y = newimg.height;
52 - iconObj.iconAnchor = anchor;
53 - }
 48+ var marker;
 49+
 50+ if ( markerData.icon != '' ) {
 51+ var iconObj = new GIcon( G_DEFAULT_ICON );
 52+ iconObj.image = markerData.icon;
 53+
 54+ var newimg = new Image();
 55+ newimg.src = markerData.icon;
 56+
 57+ // Only do these things when there is an actual width, which there won,t the first time the image is loaded.
 58+ // FIXME: this means the image won't have it's correct size when it differs from the default on first load!
 59+ if ( newimg.width > 0 ) {
 60+ /* Determine size of icon and pass it in */
 61+ iconObj.iconSize.width = newimg.width;
 62+ iconObj.iconSize.height = newimg.height;
 63+ iconObj.shadow = null;
 64+
 65+ /* Anchor the icon on bottom middle */
 66+ var anchor = new GPoint();
 67+ anchor.x = Math.floor( newimg.width / 2 );
 68+ anchor.y = newimg.height;
 69+ iconObj.iconAnchor = anchor;
 70+ }
5471
55 - marker = new GMarker( markerData.point, { icon: iconObj } );
56 - } else {
57 - marker = new GMarker( markerData.point );
58 - }
59 -
60 - if ( ( markerData.title + markerData.label ).length != '' ) {
61 - var bothTxtAreSet = markerData.title.length != '' && markerData.label.length != '';
62 - var popupText = bothTxtAreSet ? '<b>' + markerData.title + '</b><hr />' + markerData.label : markerData.title + markerData.label;
63 - popupText = '<div style="overflow:auto;max-height:130px;">' + popupText + '</div>';
 72+ marker = new GMarker( markerData.point, { icon: iconObj } );
 73+ } else {
 74+ marker = new GMarker( markerData.point );
 75+ }
 76+
 77+ if ( ( markerData.title + markerData.label ).length != '' ) {
 78+ var bothTxtAreSet = markerData.title.length != '' && markerData.label.length != '';
 79+ var popupText = bothTxtAreSet ? '<b>' + markerData.title + '</b><hr />' + markerData.label : markerData.title + markerData.label;
 80+ popupText = '<div style="overflow:auto;max-height:130px;">' + popupText + '</div>';
6481
65 - GEvent.addListener(marker, 'click',
66 - function() {
67 - marker.openInfoWindowHtml(popupText, {maxWidth:350});
68 - }
69 - );
70 - }
 82+ GEvent.addListener(marker, 'click',
 83+ function() {
 84+ marker.openInfoWindowHtml(popupText, {maxWidth:350});
 85+ }
 86+ );
 87+ }
7188
72 - return marker;
73 - }
 89+ return marker;
 90+ }
7491
75 - /**
76 - * Returns GMap2 object with the provided properties and markers.
77 - * This is done by setting the map centre and size, and passing the arguments to function createGoogleMap.
78 - */
79 - function initializeGoogleMap(mapName, mapOptions, markers) {
80 - if (GBrowserIsCompatible()) {
81 - mapOptions.centre = (mapOptions.lat != null && mapOptions.lon != null) ? new GLatLng(mapOptions.lat, mapOptions.lon) : null;
82 - //mapOptions.size = new GSize(mapOptions.width, mapOptions.height);
83 - return createGoogleMap(mapName, mapOptions, markers);
84 - }
85 - else {
86 - return false;
87 - }
88 - }
 92+ /**
 93+ * Returns GMap2 object with the provided properties and markers.
 94+ * This is done by setting the map centre and size, and passing the arguments to function createGoogleMap.
 95+ */
 96+ var initializeGoogleMap = function(mapName, mapOptions, markers) {
 97+ if (GBrowserIsCompatible()) {
 98+ mapOptions.centre = (mapOptions.lat != null && mapOptions.lon != null) ? new GLatLng(mapOptions.lat, mapOptions.lon) : null;
 99+ //mapOptions.size = new GSize(mapOptions.width, mapOptions.height);
 100+ return createGoogleMap(mapName, mapOptions, markers);
 101+ }
 102+ else {
 103+ return false;
 104+ }
 105+ }
89106
90 - /**
91 - * Returns GMap2 object with the provided properties.
92 - */
93 - function createGoogleMap(mapName, mapOptions, markers) {
94 - var mapElement = document.getElementById(mapName);
95 - var typesContainType = false;
 107+ /**
 108+ * Returns GMap2 object with the provided properties.
 109+ */
 110+ function createGoogleMap(mapName, mapOptions, markers) {
 111+ var mapElement = document.getElementById(mapName);
 112+ var typesContainType = false;
96113
97 - for (var i = 0; i < mapOptions.types.length; i++) {
98 - if (mapOptions.types[i] == mapOptions.type) typesContainType = true;
99 - }
 114+ for (var i = 0; i < mapOptions.types.length; i++) {
 115+ if (mapOptions.types[i] == mapOptions.type) typesContainType = true;
 116+ }
100117
101 - if (! typesContainType) mapOptions.types.push(mapOptions.type);
 118+ if (! typesContainType) mapOptions.types.push(mapOptions.type);
102119
103 - var map = new GMap2(mapElement, {mapTypes: mapOptions.types});
104 - map.name = mapName;
 120+ var map = new GMap2(mapElement, {mapTypes: mapOptions.types});
 121+ map.name = mapName;
105122
106 - map.setMapType(mapOptions.type);
 123+ map.setMapType(mapOptions.type);
107124
108 - var hasSearchBar = false;
109 -
110 - for ( i = mapOptions.controls.length - 1; i >= 0; i-- ) {
111 - if ( mapOptions.controls[i] == 'searchbar' ) {
112 - hasSearchBar = true;
113 - break;
114 - }
115 - }
116 -
117 - // List of GControls: http://code.google.com/apis/maps/documentation/reference.html#GControl
118 - for ( i = 0; i < mapOptions.controls.length; i++ ) {
119 - if ( mapOptions.controls[i].toLowerCase() == 'auto' ) {
120 - if ( mapElement.offsetHeight > 75 ) mapOptions.controls[i] = mapElement.offsetHeight > 320 ? 'large' : 'small';
121 - }
122 -
123 - switch ( mapOptions.controls[i] ) {
124 - case 'large' :
125 - map.addControl( new GLargeMapControl3D() );
126 - break;
127 - case 'small' :
128 - map.addControl( new GSmallZoomControl3D() );
129 - break;
130 - case 'large-original' :
131 - map.addControl( new GLargeMapControl() );
132 - break;
133 - case 'small-original' :
134 - map.addControl( new GSmallMapControl() );
135 - break;
136 - case 'zoom' :
137 - map.addControl( new GSmallZoomControl() );
138 - break;
139 - case 'type' :
140 - map.addControl( new GMapTypeControl() );
141 - break;
142 - case 'type-menu' :
143 - map.addControl( new GMenuMapTypeControl() );
144 - break;
145 - case 'overlays' :
146 - map.addControl( new MoreControl() );
147 - break;
148 - case 'overview' : case 'overview-map' :
149 - map.addControl( new GOverviewMapControl() );
150 - break;
151 - case 'scale' :
152 - if ( hasSearchBar ) {
153 - map.addControl( new GScaleControl(), new GControlPosition( G_ANCHOR_BOTTOM_LEFT, new GSize( 5,37 ) ) );
154 - }
155 - else {
156 - map.addControl( new GScaleControl() );
157 - }
158 - break;
159 - case 'nav-label' : case 'nav' :
160 - map.addControl( new GNavLabelControl() );
161 - break;
162 - case 'searchbar' :
163 - map.enableGoogleBar();
164 - break;
165 - }
166 - }
 125+ var hasSearchBar = false;
 126+
 127+ for ( i = mapOptions.controls.length - 1; i >= 0; i-- ) {
 128+ if ( mapOptions.controls[i] == 'searchbar' ) {
 129+ hasSearchBar = true;
 130+ break;
 131+ }
 132+ }
 133+
 134+ // List of GControls: http://code.google.com/apis/maps/documentation/reference.html#GControl
 135+ for ( i = 0; i < mapOptions.controls.length; i++ ) {
 136+ if ( mapOptions.controls[i].toLowerCase() == 'auto' ) {
 137+ if ( mapElement.offsetHeight > 75 ) mapOptions.controls[i] = mapElement.offsetHeight > 320 ? 'large' : 'small';
 138+ }
 139+
 140+ switch ( mapOptions.controls[i] ) {
 141+ case 'large' :
 142+ map.addControl( new GLargeMapControl3D() );
 143+ break;
 144+ case 'small' :
 145+ map.addControl( new GSmallZoomControl3D() );
 146+ break;
 147+ case 'large-original' :
 148+ map.addControl( new GLargeMapControl() );
 149+ break;
 150+ case 'small-original' :
 151+ map.addControl( new GSmallMapControl() );
 152+ break;
 153+ case 'zoom' :
 154+ map.addControl( new GSmallZoomControl() );
 155+ break;
 156+ case 'type' :
 157+ map.addControl( new GMapTypeControl() );
 158+ break;
 159+ case 'type-menu' :
 160+ map.addControl( new GMenuMapTypeControl() );
 161+ break;
 162+ case 'overlays' :
 163+ map.addControl( new MoreControl() );
 164+ break;
 165+ case 'overview' : case 'overview-map' :
 166+ map.addControl( new GOverviewMapControl() );
 167+ break;
 168+ case 'scale' :
 169+ if ( hasSearchBar ) {
 170+ map.addControl( new GScaleControl(), new GControlPosition( G_ANCHOR_BOTTOM_LEFT, new GSize( 5,37 ) ) );
 171+ }
 172+ else {
 173+ map.addControl( new GScaleControl() );
 174+ }
 175+ break;
 176+ case 'nav-label' : case 'nav' :
 177+ map.addControl( new GNavLabelControl() );
 178+ break;
 179+ case 'searchbar' :
 180+ map.enableGoogleBar();
 181+ break;
 182+ }
 183+ }
167184
168 - var bounds = ((mapOptions.zoom == null || mapOptions.centre == null) && markers.length > 1) ? new GLatLngBounds() : null;
 185+ var bounds = ((mapOptions.zoom == null || mapOptions.centre == null) && markers.length > 1) ? new GLatLngBounds() : null;
169186
170 - for ( i = markers.length - 1; i >= 0; i-- ) {
171 - var marker = markers[i];
172 - marker.point = new GLatLng( marker.lat, marker.lon );
173 - map.addOverlay( createGMarker( marker ) );
174 - if ( bounds != null ) bounds.extend( marker.point );
175 - }
 187+ for ( i = markers.length - 1; i >= 0; i-- ) {
 188+ var marker = markers[i];
 189+ marker.point = new GLatLng( marker.lat, marker.lon );
 190+ map.addOverlay( createGMarker( marker ) );
 191+ if ( bounds != null ) bounds.extend( marker.point );
 192+ }
176193
177 - if (bounds != null) {
178 - map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
179 - }
 194+ if (bounds != null) {
 195+ map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
 196+ }
180197
181 - if (mapOptions.centre != null) map.setCenter(mapOptions.centre);
182 - if (mapOptions.zoom != null) map.setZoom(mapOptions.zoom);
183 -
184 - if (mapOptions.scrollWheelZoom) map.enableScrollWheelZoom();
 198+ if (mapOptions.centre != null) map.setCenter(mapOptions.centre);
 199+ if (mapOptions.zoom != null) map.setZoom(mapOptions.zoom);
 200+
 201+ if (mapOptions.scrollWheelZoom) map.enableScrollWheelZoom();
185202
186 - map.enableContinuousZoom();
187 -
188 - // Code to add KML files.
189 - var kmlOverlays = [];
190 - for ( i = mapOptions.kml.length - 1; i >= 0; i-- ) {
191 - kmlOverlays[i] = new GGeoXml( mapOptions.kml[i] );
192 - map.addOverlay( kmlOverlays[i] );
193 - }
194 -
195 - // Make the map variable available for other functions.
196 - if (!window.GMaps) window.GMaps = new Object;
197 - eval("window.GMaps." + mapName + " = map;");
198 -
199 - return map;
200 - }
 203+ map.enableContinuousZoom();
 204+
 205+ // Code to add KML files.
 206+ var kmlOverlays = [];
 207+ for ( i = mapOptions.kml.length - 1; i >= 0; i-- ) {
 208+ kmlOverlays[i] = new GGeoXml( mapOptions.kml[i] );
 209+ map.addOverlay( kmlOverlays[i] );
 210+ }
 211+
 212+ // Make the map variable available for other functions.
 213+ if (!window.GMaps) window.GMaps = new Object;
 214+ eval("window.GMaps." + mapName + " = map;");
 215+
 216+ return map;
 217+ }
201218
202 - function setupCheckboxShiftClick() { return true; }
 219+ function setupCheckboxShiftClick() { return true; }
203220
204 - function MoreControl() {};
205 - MoreControl.prototype = new GControl();
 221+ function MoreControl() {};
 222+ MoreControl.prototype = new GControl();
206223
207 - MoreControl.prototype.initialize = function(map) {
208 - this.map = map;
209 -
210 - var more = document.getElementById(map.name + "-outer-more");
 224+ MoreControl.prototype.initialize = function(map) {
 225+ this.map = map;
 226+
 227+ var more = document.getElementById(map.name + "-outer-more");
211228
212 - var buttonDiv = document.createElement("div");
213 - buttonDiv.id = map.name + "-more-button";
214 - buttonDiv.title = "Show/Hide Overlays";
215 - buttonDiv.style.border = "1px solid black";
216 - buttonDiv.style.width = "86px";
 229+ var buttonDiv = document.createElement("div");
 230+ buttonDiv.id = map.name + "-more-button";
 231+ buttonDiv.title = "Show/Hide Overlays";
 232+ buttonDiv.style.border = "1px solid black";
 233+ buttonDiv.style.width = "86px";
217234
218 - var textDiv = document.createElement("div");
219 - textDiv.id = map.name + "-inner-more";
220 - textDiv.setAttribute('class', 'inner-more');
221 - textDiv.appendChild(document.createTextNode( msgOverlays ));
 235+ var textDiv = document.createElement("div");
 236+ textDiv.id = map.name + "-inner-more";
 237+ textDiv.setAttribute('class', 'inner-more');
 238+ textDiv.appendChild(document.createTextNode( msgOverlays ));
222239
223 - buttonDiv.appendChild(textDiv);
 240+ buttonDiv.appendChild(textDiv);
224241
225 - // Register Event handlers
226 - more.onmouseover = showGLayerbox;
227 - more.onmouseout = setGLayerboxClose;
 242+ // Register Event handlers
 243+ more.onmouseover = showGLayerbox;
 244+ more.onmouseout = setGLayerboxClose;
228245
229 - // Insert the button just after outer_more div.
230 - more.insertBefore(buttonDiv, document.getElementById(map.name + "-more-box").parentNode);
 246+ // Insert the button just after outer_more div.
 247+ more.insertBefore(buttonDiv, document.getElementById(map.name + "-more-box").parentNode);
231248
232 - // Remove the whole div from its location and reinsert it to the map.
233 - map.getContainer().appendChild(more);
 249+ // Remove the whole div from its location and reinsert it to the map.
 250+ map.getContainer().appendChild(more);
234251
235 - return more;
236 - };
 252+ return more;
 253+ };
237254
238 - MoreControl.prototype.getDefaultPosition = function() {
239 - return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 35));
240 - };
 255+ MoreControl.prototype.getDefaultPosition = function() {
 256+ return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 35));
 257+ };
241258
242 - function checkGChecked(mapName) {
243 - // Returns true if a checkbox is still checked otherwise false.
244 - var boxes = document.getElementsByName(mapName + "-overlay-box");
245 - for(var i = 0; i < boxes.length; i++) {
246 - if(boxes[i].checked) return true;
247 - }
248 - return false;
249 - }
 259+ function checkGChecked(mapName) {
 260+ // Returns true if a checkbox is still checked otherwise false.
 261+ var boxes = document.getElementsByName(mapName + "-overlay-box");
 262+ for(var i = 0; i < boxes.length; i++) {
 263+ if(boxes[i].checked) return true;
 264+ }
 265+ return false;
 266+ }
250267
251 - function showGLayerbox() {
252 - var mapName = this.id.split('-')[0];
253 - eval("if(window.timer_" + mapName + ") clearTimeout(timer_" + mapName + ");");
254 - document.getElementById(mapName + "-more-box").style.display = "block";
255 - var button = document.getElementById(mapName + "-inner-more");
256 - button.style.borderBottomWidth = "4px";
257 - button.style.borderBottomColor = "white";
258 - }
 268+ function showGLayerbox() {
 269+ var mapName = this.id.split('-')[0];
 270+ eval("if(window.timer_" + mapName + ") clearTimeout(timer_" + mapName + ");");
 271+ document.getElementById(mapName + "-more-box").style.display = "block";
 272+ var button = document.getElementById(mapName + "-inner-more");
 273+ button.style.borderBottomWidth = "4px";
 274+ button.style.borderBottomColor = "white";
 275+ }
259276
260277
261 - function setGLayerboxClose() {
262 - var mapName = this.id.split('-')[0];
263 - var layerbox = document.getElementById(mapName + "-more-box");
264 - var button = document.getElementById(mapName + "-inner-more");
265 - var bottomColor = checkGChecked(mapName) ? "#6495ed" : "#c0c0c0";
266 - eval("timer_" + mapName + " = window.setTimeout(function() { layerbox.style.display = 'none'; button.style.borderBottomWidth = '1px'; button.style.borderBottomColor = bottomColor; }, 400);");
267 - }
 278+ function setGLayerboxClose() {
 279+ var mapName = this.id.split('-')[0];
 280+ var layerbox = document.getElementById(mapName + "-more-box");
 281+ var button = document.getElementById(mapName + "-inner-more");
 282+ var bottomColor = checkGChecked(mapName) ? "#6495ed" : "#c0c0c0";
 283+ eval("timer_" + mapName + " = window.setTimeout(function() { layerbox.style.display = 'none'; button.style.borderBottomWidth = '1px'; button.style.borderBottomColor = bottomColor; }, 400);");
 284+ }
268285
269 - function switchGLayer(map, checked, layer) {
270 - var layerbox = document.getElementById(map.name + "-more-box");
271 - var button = document.getElementById(map.name + "-inner-more");
272 -
273 - if(checked) {
274 - map.addOverlay(layer);
275 - }
276 - else {
277 - map.removeOverlay(layer);
278 - }
279 -
280 - }
 286+ function switchGLayer(map, checked, layer) {
 287+ var layerbox = document.getElementById(map.name + "-more-box");
 288+ var button = document.getElementById(map.name + "-inner-more");
 289+
 290+ if(checked) {
 291+ map.addOverlay(layer);
 292+ }
 293+ else {
 294+ map.removeOverlay(layer);
 295+ }
 296+
 297+ }
281298
282 - function initiateGOverlay(elementId, mapName, urlNr) {
283 - document.getElementById(elementId).checked = true;
284 - switchGLayer(GMaps[mapName], true, GOverlays[urlNr]);
285 - }
286 -
287 -} ); })(jQuery);
\ No newline at end of file
 299+ function initiateGOverlay(elementId, mapName, urlNr) {
 300+ document.getElementById(elementId).checked = true;
 301+ switchGLayer(GMaps[mapName], true, GOverlays[urlNr]);
 302+ }
 303+
 304+}
 305+
\ No newline at end of file
Index: branches/Maps0.8/includes/features/Maps_BasePointMap.php
@@ -74,7 +74,7 @@
7575 $output = $this->getMapHTML( $params, $parser ) . $this->getJSON( $params, $parser );
7676
7777 global $wgTitle;
78 - if ( $wgTitle->getNamespace() == NS_SPECIAL ) {
 78+ if ( $wgTitle->isSpecialPage() ) {
7979 global $wgOut;
8080 $this->service->addDependencies( $wgOut );
8181 }
Index: branches/Maps0.8/includes/features/Maps_BaseMap.php
@@ -76,7 +76,7 @@
7777 $output = $this->getMapHTML( $params, $parser ) . $this->getJSON( $params, $parser );
7878
7979 global $wgTitle;
80 - if ( $wgTitle->getNamespace() == NS_SPECIAL ) {
 80+ if ( $wgTitle->isSpecialPage() ) {
8181 global $wgOut;
8282 $this->service->addDependencies( $wgOut );
8383 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r82991follow up to r82988jeroendedauw00:14, 1 March 2011

Status & tagging log