/** * The file is used by GeoHack on Tool Labs (linked from [[Template:GeoTemplate]]). * * This file is not loaded within a wiki context. Standard libraries (jQuery, mediawiki.js etc) are not available. */ /** * Copy of standard library function */ functionappendCSS(text){ vars=document.createElement('style'); s.type='text/css'; s.rel='stylesheet'; if(s.styleSheet)s.styleSheet.cssText=text//IE elses.appendChild(document.createTextNode(text+''))//Safari sometimes borks on null document.getElementsByTagName('head')[0].appendChild(s); } window.onload=function(){ /* Add row hover effect */ appendCSS(".directory tr:hover {background:#fdc !important;}"); } varhead=document.getElementsByTagName('head')[0]; varstyle=document.createElement('link'); style.rel='stylesheet'; style.type='text/css'; style.href='//maps.wikimedia.org/leaflet/leaflet.css'; head.appendChild(style); varscript=document.createElement('script'); script.type='text/javascript'; script.src='//maps.wikimedia.org/leaflet/leaflet.js'; head.appendChild(script); varOSM_class_R=/\bOSM:([\d.+-]+)_([\d.+-]+)_([\d.+-]+)_(\w+)/; functionembedOpenStreetMap(){ clearInterval(osmtimer); varosmTarget=document.getElementById('osmEmbed'); if(osmTarget&&OSM_class_R.exec(osmTarget.className)){ varlat=1.0*RegExp.$1, lon=1.0*RegExp.$2, zoom=RegExp.$3; varmap=L.map('osmEmbed').setView([lat,lon],zoom); map.attributionControl.setPrefix(''); L.tileLayer('//maps.wikimedia.org/osm-intl/{z}/{x}/{y}{r}.png',{ attribution:'Wikimedia maps beta | Map data © <a href="http://osm.org/copyright">OpenStreetMap contributors</a>' }).addTo(map); L.marker([lat,lon]).addTo(map); } } osmtimer=setInterval("if (document.getElementById('osmEmbed') && L) { embedOpenStreetMap(); }",200); setTimeout('clearInterval(osmtimer)',5000);
MediaWiki:GeoHack.js
Konten disalin dari Wikipedia Bahasa Indonesia (lisensi CC BY-SA)
Lihat versi asli di Wikipedia