Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
(function(mw,$){// stuff should only happen in the File namespaceif(mw.config.values.wgCanonicalNamespace==='File'){// use the Mediawiki API to check for the use of Template:Map on this page$.ajax({url:'https://commons.wikimedia.org/w/api.php?action=query&format=json&prop=templates&redirects=1&tllimit=100&pageids='+mw.config.values.wgArticleId,success:function(result){vartemplates=result.query.pages[mw.config.values.wgArticleId].templates;for(varkeyintemplates){if(templates[key].title==='Template:Map'){varmap='https://tools.wmflabs.org/warped-to-iframe/map.php?opacity=true&lang='+mw.config.values.wgUserLanguage+'&pageid='+mw.config.values.wgArticleId;$('#mw-content-text').append('<h2>Georeferenced Map</h2>').append('<iframe src="'+map+'" width="640" height="480" style="border:0;"></iframe>');break;}}}});}})(mediaWiki,jQuery);