Let get the ball rolling edit

{{editprotected}} Please create this pages with the following content:

/* 
 * The file is used by [[tswiki:GeoHack]] and applies effects to [[Template:GeoTemplate]].
 */

/* basic function library */
function appendCSS(text) {
	var s = document.createElement('style');
	s.type = 'text/css';
	s.rel = 'stylesheet';
	if (s.styleSheet) s.styleSheet.cssText = text //IE
	else s.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;}")
}

Dispenser 14:08, 20 July 2009 (UTC)Reply

  Not done First, i'd like to see some links to relevant discussion as to why this should be HERE, and second, we have ways to do this. It's called appendCSS() and addOnloadHook(). —TheDJ (talkcontribs) 09:57, 21 July 2009 (UTC)Reply
I am one of the maintainers of GeoHack. This is part of the separation of general layout. The MediaWiki namespace is best for tools to store executed JavaScript. Finally, a simple script like this is a good introduction to the possible uses before we start adding the clicktracking or WMA. — Dispenser 13:39, 21 July 2009 (UTC)Reply
I have modified the above code to implement appendCSS() since it not available from GeoHack and call it instead. — Dispenser 13:46, 21 July 2009 (UTC)Reply
OK, i see. The toolserver GeoHack includes this page. But then why not create a GeoHack.css and a GeoHack.js and REALLY separate layout and functionality ? It seems a bit pointless to me to include this CSS with Javascript. —TheDJ (talkcontribs) 10:37, 25 July 2009 (UTC)Reply
The code is just suppose to be a sample just to get things started. So the CSS is just a hack to show that it does something. If you want to, I'd be find with just the header comment. In the past, Para has developed and hosted a things on his Toolserver account that should be integrated into GeoHack somehow, like that Google street view finder. — Dispenser 22:40, 25 July 2009 (UTC)Reply

  DoneTheDJ (talkcontribs) 10:14, 26 July 2009 (UTC)Reply

Clicker tracker edit

{{editprotected}}

/* Click tracker to see which services are most used */
var tracker = "http://toolserver.org/~dispenser/ghct";
function addTrackers(){
    var anchors = document.getElementById('mw_content').getElementsByTagName('A');
    for(var i=0; anchors[i]!=null; i++){
        anchors[i].onmousedown = function(){if(document.images){(new Image).src=[tracker,'/',(this.textContent||this.innerText||"NA").replace(/\W/g,'').toLowerCase(),'/',this.href.replace(/[\w+]+:\/*([0-9A-Za-z.\-]*).*/,"$1")].join("");return true;};
        }
    }
}
window.onload = function() {
    addTrackers();

Per Template talk:GeoTemplate#Please please please... we would like to have this code added. — Dispenser 02:39, 27 September 2009 (UTC)Reply

Draggable maps edit

{{editprotected}}

var iframeurl = 'http://stable.toolserver.org/wma/iframe.html';
var wma_class_R = /\bWMA:(\S+)/;
function addWikiMiniAtlas() {
	var arrElements = document.getElementById('mw_content').getElementsByTagName('DIV');
	var mapparams, container;
	for(var i=0; (container=arrElements[i]); i++){
		mapparams = container.className.match(wma_class_R);
		if(mapparams){
			iframe = document.createElement('iframe');
			iframe.frameBorder = 0;
			iframe.scrolling = 'no';
			iframe.src = iframeurl + '?' + mapparams[1];
			iframe.style.width = mapparams[1].split('_')[2]+'px';
			iframe.style.height = mapparams[1].split('_')[3]+'px';
			while(container.firstChild)
				container.removeChild(container.firstChild);
			container.appendChild(iframe); // set attributes before insertion - IE6
			container.style.display = '';
		}
	}
}
Also add addWikiMiniAtlas(); to the onload function.

This code will replace the contents of div tags with special classes with an instance of WikiMiniAtlas. In the future we can change this to OSM at some point, but the OSM folks are worried about load. — Dispenser 01:34, 28 September 2009 (UTC)Reply

Service shuffler edit

So the click tracker works fine (I wouldn't have expected the image url to load when the browser is leaving the page, but it does!). While waiting for some statistics to be published, I had a sneak peek, and it seems people have no trouble finding the Google links that aren't the very first map links. Encouraged by this, I finished the service shuffler script: GeoHack where you choose the service order. The code is at tools:~para/temp/GeoHack-shuffle.js. Should we add this or something like it? --Para (talk) 19:31, 14 October 2009 (UTC)Reply

I've thought about this and to me its too much effort for something that will disappear if you clear your cookies or move to another computer. It might be easier if it were drag and drop. Another possibility is to simply list the last five links a user click on at the top of the page. — Dispenser 16:38, 20 October 2009 (UTC)Reply
True, moving anything one by one on a 30 row list is a pain. So I searched for some drag&drop code, and merged it with mine at tools:~para/temp/GeoHack-dragdrop.html. Seems to work. Moving rows without the user explicitly making the move would confuse people when they're looking for services from the alphabetical list, I think. Copying often used rows and changing the style might be better. This row moving thing could use some styling magic as well, especially if the popularity of services is going to be indicated with background colours. --Para (talk) 22:34, 21 October 2009 (UTC)Reply

HTTPS fix edit

Per [1], I've replaced the hardcoded HTTP toolserver URLs with protocol-relative ones, fixing the mixed-content block in Firefox 23+. --brion (talk) 14:41, 30 August 2013 (UTC)Reply

WikiMiniAtlas moved to Labs edit

please change

var iframeurl = '//toolserver.org/~dschwen/wma/iframe.html';


to

var iframeurl = '//wma.wmflabs.org/iframe.html';


The Wikiminiatlas has moved from the (now dead) Toolserver to WMF Labs. --Dschwen 17:44, 9 June 2014 (UTC)Reply

  Done --Redrose64 (talk) 18:01, 9 June 2014 (UTC)Reply
It would be nice if you setup a redirect (e.g. Redirect 301 /~dschwen/wma/ //wma.wmflabs.org/ in ~/public_html/.htaccess) so all the old links wouldn't break. — Dispenser 18:47, 9 June 2014 (UTC)Reply
@Dispenser: I don't know where to put that. --Redrose64 (talk) 18:54, 9 June 2014 (UTC)Reply
Yeah, it would have been nice if I had done that, like you suggested a few weeks ago :-(. I forgot to add that and now the ts account is closed again. --Dschwen 19:04, 9 June 2014 (UTC)Reply

Translation edit

Is there a way to translate 'Zoom in' and 'Zoom out' hover text? It's in https://maps.wikimedia.org/leaflet/leaflet.js. --Obsuser (talk) 21:04, 12 May 2017 (UTC)Reply

Interface-protected edit request on 23 March 2020 edit

Please change //maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png to //maps.wikimedia.org/osm-intl/{z}/{x}/{y}{r}.png to enable maps with retina resolution. —TheDJ (talkcontribs) 19:20, 23 March 2020 (UTC)Reply

@TheDJ: I trust you know what you are doing here, but would like a sanity check, can you provide examples of the generated url that is currently happening, as this change isn't just adding a new function - but will also change every single existing call with the re-use of {z} in the filename component. — xaosflux Talk 21:46, 26 March 2020 (UTC)Reply
Xaosflux, you are right in being skeptical. Should be {r}. https://maps.wikimedia.org/osm-intl/13/1310/3165@2x.png?lang=en https://leafletjs.com/reference-1.6.0.html#tilelayerTheDJ (talkcontribs) 09:10, 27 March 2020 (UTC)Reply
  Done @TheDJ: I added the parameter. — xaosflux Talk 18:09, 2 April 2020 (UTC)Reply

Map jumps upon first zoom click edit

There are apparently two bugs using GeoHack.js with Google Chrome under Linux. Please see Template talk:GeoTemplate#Map jumps upon first zoom click for details. --Redrose64 🌹 (talk) 08:58, 14 March 2023 (UTC)Reply

Add a "make fullscreen" button to Wikimedia Maps map edit

See Template_talk:GeoTemplate/Archive_14#Add_a_"make_fullscreen"_button_to_Wikimedia_Maps_map. The RedBurn (ϕ) 10:08, 12 May 2023 (UTC)Reply