r68996 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68995‎ | r68996 | r68997 >
Date:13:52, 4 July 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Removed obsolete minified js files
Modified paths:
  • /trunk/extensions/Maps/Services/GoogleMaps/GoogleMapFunctions.min.js (deleted) (history)
  • /trunk/extensions/Maps/Services/GoogleMaps3/GoogleMap3Functions.min.js (deleted) (history)
  • /trunk/extensions/Maps/Services/OpenLayers/OpenLayerFunctions.min.js (deleted) (history)
  • /trunk/extensions/Maps/Services/YahooMaps/YahooMapFunctions.min.js (deleted) (history)

Diff [purge]

Index: trunk/extensions/Maps/Services/YahooMaps/YahooMapFunctions.min.js
@@ -1,3 +0,0 @@
2 -function createYMarker(a,d,e,c){var b;b=c!=""?new YMarker(a,new YImage(c)):new YMarker(a);if((d+e).length>0){var g=(a=d.length>0&&e.length>0)?"<b>"+d+"</b><hr />"+e:d+e;YEvent.Capture(b,EventsList.MouseClick,function(){b.openSmartWindow(g)})}return b}function initializeYahooMap(a,d,e,c,b,g,k,h,i,j){d=e!=null&&d!=null?new YGeoPoint(d,e):null;return createYahooMap(document.getElementById(a),d,c,b,g,k,h,i,j)}
3 -function createYahooMap(a,d,e,c,b,g,k,h,i){for(var j=false,f=0;f<b.length;f++)if(b[f]==c)j=true;j||b.push(c);a=new YMap(a,c);a.removeZoomScale();for(f in g){if(g[f].toLowerCase()=="auto-zoom")if(i>42)g[f]=i>100?"zoom":"zoom-short";switch(g[f]){case "scale":a.addZoomScale();case "type":a.addTypeControl(b);break;case "pan":a.addPanControl();break;case "zoom":a.addZoomLong();break;case "zoom-short":a.addZoomShort();break}}a.setMapType(c);k||a.disableKeyControls();c=(e==null||d==null)&&h.length>1?Array():
4 -null;for(f in h){b=h[f];a.addOverlay(createYMarker(b.point,b.title,b.label,b.icon));c!=null&&c.push(b.point)}if(c!=null){h=a.getBestZoomAndCenter(c);a.drawZoomAndCenter(h.YGeoPoint,h.zoomLevel)}e!=null&&a.setZoomLevel(e);d!=null&&a.drawZoomAndCenter(d);return a}function getYMarkerData(a,d,e,c,b){return{point:new YGeoPoint(a,d),title:e,label:c,icon:b}};
\ No newline at end of file
Index: trunk/extensions/Maps/Services/OpenLayers/OpenLayerFunctions.min.js
@@ -1,18 +0,0 @@
2 -function initOpenLayer(mapName,lon,lat,zoom,mapTypes,controls,marker_data,height){var mapOptions={projection:new OpenLayers.Projection("EPSG:900913"),displayProjection:new OpenLayers.Projection("EPSG:4326"),units:"m",numZoomLevels:18,maxResolution:156543.0339,maxExtent:new OpenLayers.Bounds(-20037508,-20037508,20037508,2.003750834E7),controls:[]};var map=new OpenLayers.Map(mapName,mapOptions);for(i in controls)if(typeof controls[i]=="string"){if(controls[i].toLowerCase()=="autopanzoom")if(height>
3 -140)controls[i]=height>320?"panzoombar":"panzoom";control=getValidControlName(controls[i]);if(control)eval(" map.addControl( new OpenLayers.Control."+control+"() ); ")}else{map.addControl(controls[i]);controls[i].activate()}addMapBaseLayers(map,mapTypes);var markerLayer=new OpenLayers.Layer.Markers("Markers");markerLayer.id="markerLayer";map.addLayer(markerLayer);var centerIsSet=lon!=null&&lat!=null;var bounds=null;if(marker_data.length>1&&(!centerIsSet||zoom==null))bounds=new OpenLayers.Bounds;for(i in marker_data){marker_data[i].lonlat.transform(new OpenLayers.Projection("EPSG:4326"),
4 -new OpenLayers.Projection("EPSG:900913"));if(bounds!=null)bounds.extend(marker_data[i].lonlat);markerLayer.addMarker(getOLMarker(markerLayer,marker_data[i],map.getProjectionObject()))}if(bounds!=null)map.zoomToExtent(bounds);if(centerIsSet){var centre=new OpenLayers.LonLat(lon,lat);centre.transform(new OpenLayers.Projection("EPSG:4326"),new OpenLayers.Projection("EPSG:900913"));map.setCenter(centre)}if(zoom!=null)map.zoomTo(zoom);return map}
5 -function getValidControlName(control){var OLControls=["ArgParser","Attribution","Button","DragFeature","DragPan","DrawFeature","EditingToolbar","GetFeature","KeyboardDefaults","LayerSwitcher","Measure","ModifyFeature","MouseDefaults","MousePosition","MouseToolbar","Navigation","NavigationHistory","NavToolbar","OverviewMap","Pan","Panel","PanPanel","PanZoom","PanZoomBar","Permalink","Scale","ScaleLine","SelectFeature","Snapping","Split","WMSGetFeatureInfo","ZoomBox","ZoomIn","ZoomOut","ZoomPanel",
6 -"ZoomToMaxExtent"];for(i in OLControls)if(control==OLControls[i].toLowerCase())return OLControls[i];return false}
7 -function addMapBaseLayers(map,mapTypes){var googleAPILoaded=typeof G_NORMAL_MAP!="undefined";var shownApiError=false;var usedNor=false;var usedSat=false;var usedHyb=false;var usedPhy=false;var usedBingNor=false;var usedBingHyb=false;var usedBingSat=false;var usedYahooNor=false;var usedYahooHyb=false;var usedYahooSat=false;var usedOLWMS=false;var usedOSMnik=false;var usedOSMcycle=false;var usedOSMarender=false;var usedNasa=false;var isDefaultBaseLayer=false;for(i in mapTypes){var newLayer=null;switch(mapTypes[i]){case "google":case "google-normal":case "google-satellite":case "google-hybrid":case "google-physical":if(googleAPILoaded)switch(mapTypes[i]){case "google-normal":if(!usedNor){newLayer=
8 -new OpenLayers.Layer.Google("Google Streets",{sphericalMercator:true});usedNor=true}break;case "google-satellite":if(!usedSat){newLayer=new OpenLayers.Layer.Google("Google Satellite",{type:G_SATELLITE_MAP,sphericalMercator:true});usedSat=true}break;case "google-hybrid":if(!usedHyb){newLayer=new OpenLayers.Layer.Google("Google Hybrid",{type:G_HYBRID_MAP,sphericalMercator:true});usedHyb=true}break;case "google-physical":if(!usedPhy){newLayer=new OpenLayers.Layer.Google("Google Physical",{type:G_PHYSICAL_MAP,
9 -sphericalMercator:true});usedPhy=true}break;case "google":if(!usedNor){map.addLayer(new OpenLayers.Layer.Google("Google Streets",{sphericalMercator:true}));usedNor=true}if(!usedSat){map.addLayer(new OpenLayers.Layer.Google("Google Satellite",{type:G_SATELLITE_MAP,sphericalMercator:true}));usedSat=true}if(!usedHyb){map.addLayer(new OpenLayers.Layer.Google("Google Hybrid",{type:G_HYBRID_MAP,sphericalMercator:true}));usedHyb=true}if(!usedPhy){map.addLayer(new OpenLayers.Layer.Google("Google Physical",
10 -{type:G_PHYSICAL_MAP,sphericalMercator:true}));usedPhy=true}break}else if(!shownApiError){window.alert("Please enter your Google Maps API key to use the Google Maps layers");shownApiError=true}break;case "bing":case "virtual-earth":if(!usedBingNor){map.addLayer(new OpenLayers.Layer.VirtualEarth("Bing Streets",{type:VEMapStyle.Shaded,sphericalMercator:true}));usedBingNor=true}if(!usedBingSat){map.addLayer(new OpenLayers.Layer.VirtualEarth("Bing Satellite",{type:VEMapStyle.Aerial,sphericalMercator:true}));
11 -usedBingSat=true}if(!usedBingHyb){map.addLayer(new OpenLayers.Layer.VirtualEarth("Bing Hybrid",{type:VEMapStyle.Hybrid,sphericalMercator:true}));usedBingHyb=true}break;case "bing-normal":if(!usedBingNor){newLayer=new OpenLayers.Layer.VirtualEarth("Bing Streets",{type:VEMapStyle.Shaded,sphericalMercator:true});usedBingNor=true}case "bing-satellite":if(!usedBingSat){newLayer=new OpenLayers.Layer.VirtualEarth("Bing Satellite",{type:VEMapStyle.Aerial,sphericalMercator:true});usedBingSat=true}case "bing-hybrid":if(!usedBingHyb){newLayer=
12 -new OpenLayers.Layer.VirtualEarth("Bing Hybrid",{type:VEMapStyle.Hybrid,sphericalMercator:true});usedBingHyb=true}case "yahoo":if(!usedYahooNor){map.addLayer(new OpenLayers.Layer.Yahoo("Yahoo! Streets"),{sphericalMercator:true});usedYahooNor=true}if(!usedYahooSat){map.addLayer(new OpenLayers.Layer.Yahoo("Yahoo! Satellite",{type:YAHOO_MAP_SAT,sphericalMercator:true}));usedYahooSat=true}if(!usedYahooHyb){map.addLayer(new OpenLayers.Layer.Yahoo("Yahoo! Hybrid",{type:YAHOO_MAP_HYB,sphericalMercator:true}));
13 -usedYahooHyb=true}break;case "yahoo-normal":if(!usedYahooNor){newLayer=new OpenLayers.Layer.Yahoo("Yahoo! Streets",{sphericalMercator:true});usedYahooNor=true}break;case "yahoo-satellite":if(!usedYahooSat){newLayer=new OpenLayers.Layer.Yahoo("Yahoo! Satellite",{type:YAHOO_MAP_SAT,sphericalMercator:true});usedYahooSat=true}break;case "yahoo-hybrid":if(!usedYahooHyb){newLayer=new OpenLayers.Layer.Yahoo("Yahoo! Hybrid",{type:YAHOO_MAP_HYB,sphericalMercator:true});usedYahooHyb=true}break;case "openlayers":case "open-layers":if(!usedOLWMS){newLayer=
14 -new OpenLayers.Layer.WMS("OpenLayers WMS","http://labs.metacarta.com/wms/vmap0",{layers:"basic",sphericalMercator:true});usedOLWMS=true}break;case "nasa":if(!usedNasa){newLayer=new OpenLayers.Layer.WMS("NASA Global Mosaic","http://t1.hypercube.telascience.org/cgi-bin/landsat7",{layers:"landsat7",sphericalMercator:true});usedNasa=true}break;case "osm":case "openstreetmap":if(!usedOSMarender){map.addLayer(new OpenLayers.Layer.OSM.Osmarender("OSM arender"));usedOSMarender=true}if(!usedOSMnik){map.addLayer(new OpenLayers.Layer.OSM.Mapnik("OSM Mapnik"),
15 -{sphericalMercator:true});usedOSMnik=true}if(!usedOSMcycle){map.addLayer(new OpenLayers.Layer.OSM.CycleMap("OSM Cycle Map"),{sphericalMercator:true});usedOSMcycle=true}break;case "osmarender":if(!usedOSMarender){newLayer=new OpenLayers.Layer.OSM.Osmarender("OSM arender");usedOSMarender=true}break;case "osm-nik":case "osm-mapnik":if(!usedOSMnik){newLayer=new OpenLayers.Layer.OSM.Mapnik("OSM Mapnik");usedOSMnik=true}break;case "osm-cycle":case "osm-cyclemap":if(!usedOSMcycle){newLayer=new OpenLayers.Layer.OSM.CycleMap("OSM Cycle Map");
16 -usedOSMcycle=true}break}if(newLayer!=null)map.addLayer(newLayer)}return map}
17 -function getOLMarker(markerLayer,markerData,projectionObject){var marker;if(markerData.icon!="")marker=new OpenLayers.Marker(markerData.lonlat,new OpenLayers.Icon(markerData.icon));else marker=new OpenLayers.Marker(markerData.lonlat);if(markerData.title.length+markerData.label.length>0)marker.events.register("mousedown",marker,function(evt){var popup=(new OpenLayers.Feature(markerLayer,markerData.lonlat)).createPopup(true);if(markerData.title.length>0&&markerData.label.length>0)popup.setContentHTML("<b>"+
18 -markerData.title+"</b><hr />"+markerData.label);else popup.setContentHTML(markerData.title+markerData.label);popup.setOpacity(0.85);markerLayer.map.addPopup(popup);OpenLayers.Event.stop(evt)});return marker}function getOLMarkerData(lon,lat,title,label,icon){lonLat=new OpenLayers.LonLat(lon,lat);return{lonlat:lonLat,title:title,label:label,icon:icon}}
19 -function initOLSettings(minWidth,minHeight){OpenLayers.IMAGE_RELOAD_ATTEMPTS=3;OpenLayers.Util.onImageLoadErrorColor="transparent";OpenLayers.Feature.prototype.popupClass=OpenLayers.Class(OpenLayers.Popup.FramedCloud,{autoSize:true,minSize:new OpenLayers.Size(minWidth,minHeight)})};
\ No newline at end of file
Index: trunk/extensions/Maps/Services/GoogleMaps/GoogleMapFunctions.min.js
@@ -1,20 +0,0 @@
2 -var GOverlays=[new GLayer("com.panoramio.all"),new GLayer("com.youtube.all"),new GLayer("org.wikipedia.en"),new GLayer("com.google.webcams")];function createGMarker(point,title,label,icon){var marker;if(icon!=''){var iconObj=new GIcon(G_DEFAULT_ICON);iconObj.image=icon;marker=new GMarker(point,{icon:iconObj});}else{marker=new GMarker(point);}
3 -if((title+label).length>0){var bothTxtAreSet=title.length>0&&label.length>0;var popupText=bothTxtAreSet?'<b>'+title+'</b><hr />'+label:title+label;popupText='<div style="overflow:auto;max-height:150px;">'+popupText+'</div>';GEvent.addListener(marker,'click',function(){marker.openInfoWindowHtml(popupText,{maxWidth:350});});}
4 -return marker;}
5 -function initializeGoogleMap(mapName,mapOptions,markers){if(GBrowserIsCompatible()){mapOptions.centre=(mapOptions.lat!=null&&mapOptions.lon!=null)?new GLatLng(mapOptions.lat,mapOptions.lon):null;mapOptions.size=new GSize(mapOptions.width,mapOptions.height);return createGoogleMap(mapName,mapOptions,markers);}
6 -else{return false;}}
7 -function createGoogleMap(mapName,mapOptions,markers){var mapElement=document.getElementById(mapName);var typesContainType=false;for(var i=0;i<mapOptions.types.length;i++){if(mapOptions.types[i]==mapOptions.type)typesContainType=true;}
8 -if(!typesContainType)mapOptions.types.push(mapOptions.type);var map=new GMap2(mapElement,{size:mapOptions.size,mapTypes:mapOptions.types});map.name=mapName;map.setMapType(mapOptions.type);for(i in mapOptions.controls){if(mapOptions.controls[i].toLowerCase()=='auto'){if(mapOptions.height>75)mapOptions.controls[i]=mapOptions.height>320?'large':'small';}
9 -switch(mapOptions.controls[i]){case'large':map.addControl(new GLargeMapControl3D());break;case'small':map.addControl(new GSmallZoomControl3D());break;case'large-original':map.addControl(new GLargeMapControl());break;case'small-original':map.addControl(new GSmallMapControl());break;case'zoom':map.addControl(new GSmallZoomControl());break;case'type':map.addControl(new GMapTypeControl());break;case'type-menu':map.addControl(new GMenuMapTypeControl());break;case'overlays':map.addControl(new MoreControl());break;case'overview':case'overview-map':map.addControl(new GOverviewMapControl());break;case'scale':map.addControl(new GScaleControl());break;case'nav-label':case'nav':map.addControl(new GNavLabelControl());break;}}
10 -var bounds=((mapOptions.zoom==null||mapOptions.centre==null)&&markers.length>1)?new GLatLngBounds():null;for(i in markers){var marker=markers[i];map.addOverlay(createGMarker(marker.point,marker.title,marker.label,marker.icon));if(bounds!=null)bounds.extend(marker.point);}
11 -if(bounds!=null){map.setCenter(bounds.getCenter(),map.getBoundsZoomLevel(bounds));}
12 -if(mapOptions.centre!=null)map.setCenter(mapOptions.centre);if(mapOptions.zoom!=null)map.setZoom(mapOptions.zoom);if(mapOptions.scrollWheelZoom)map.enableScrollWheelZoom();map.enableContinuousZoom();if(!window.GMaps)window.GMaps=new Object;eval("window.GMaps."+mapName+" = map;");return map;}
13 -function getGMarkerData(lat,lon,title,label,icon){return{point:new GLatLng(lat,lon),title:title,label:label,icon:icon};}
14 -function setupCheckboxShiftClick(){return true;}
15 -function MoreControl(){};MoreControl.prototype=new GControl();MoreControl.prototype.initialize=function(map){this.map=map;var more=document.getElementById(map.name+"-outer-more");var buttonDiv=document.createElement("div");buttonDiv.id=map.name+"-more-button";buttonDiv.title="Show/Hide Overlays";buttonDiv.style.border="1px solid black";buttonDiv.style.width="86px";var textDiv=document.createElement("div");textDiv.id=map.name+"-inner-more";textDiv.setAttribute('class','inner-more');textDiv.appendChild(document.createTextNode("Overlays"));buttonDiv.appendChild(textDiv);more.onmouseover=showGLayerbox;more.onmouseout=setGLayerboxClose;more.insertBefore(buttonDiv,document.getElementById(map.name+"-more-box").parentNode);map.getContainer().appendChild(more);return more;};MoreControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(7,35));};function checkGChecked(mapName){var boxes=document.getElementsByName(mapName+"-overlay-box");for(var i=0;i<boxes.length;i++){if(boxes[i].checked)return true;}
16 -return false;}
17 -function showGLayerbox(){var mapName=this.id.split('-')[0];eval("if(window.timer_"+mapName+") clearTimeout(timer_"+mapName+");");document.getElementById(mapName+"-more-box").style.display="block";var button=document.getElementById(mapName+"-inner-more");button.style.borderBottomWidth="4px";button.style.borderBottomColor="white";}
18 -function setGLayerboxClose(){var mapName=this.id.split('-')[0];var layerbox=document.getElementById(mapName+"-more-box");var button=document.getElementById(mapName+"-inner-more");var bottomColor=checkGChecked(mapName)?"#6495ed":"#c0c0c0";eval("timer_"+mapName+" = window.setTimeout(function() { layerbox.style.display = 'none'; button.style.borderBottomWidth = '1px'; button.style.borderBottomColor = bottomColor; }, 400);");}
19 -function switchGLayer(map,checked,layer){var layerbox=document.getElementById(map.name+"-more-box");var button=document.getElementById(map.name+"-inner-more");if(checked){map.addOverlay(layer);}
20 -else{map.removeOverlay(layer);}}
21 -function initiateGOverlay(elementId,mapName,urlNr){document.getElementById(elementId).checked=true;switchGLayer(GMaps[mapName],true,GOverlays[urlNr]);}
\ No newline at end of file

Status & tagging log