User:Huffers/wikiminiatlas2.js

// ////////////////////////////////////////////////////////////////////////////////////// // Huffers' modified version of User:Dschwen/wikiminiatlas2.js // I intend to use this to test some little bug fixes, then ask Dschwen to copy the fixes across //////////////////////////////////////////////////////////////////////////////////////

// Script to embed interactive maps into pages that have coordinate templates // also check my commons page commons:User:Dschwen for more tools

// // defaults // var wikiminiatlas_coordinate_region = ''; var wikiminiatlas_width = 500; var wikiminiatlas_height = 300; var wikiminiatlas_iframeurl = 'http://www.geocities.com/huffers2002/iframe.html'; // load my version --Huffers var wikiminiatlas_imgbase = 'http://atlas.schwen.de/tiles/'; var wikiminiatlas_imgbase_test = 'http://www.geocities.com/huffers2002/tiles/'; // my icons --Huffers

// // globals // var wikiminiatlas_iframe = null;

// // Insert the IFrame into the page. // function wikiminiatlasLoader { var wikiminiatlas_marker_lon; var wikiminiatlas_marker_lat; var coordinates = document.getElementById('coordinates');

if (coordinates != null && wikiminiatlas_iframe == null) { var coord_index = (coordinates.innerHTML).indexOf('params='); if(coord_index>-1) {  var coord_params = (coordinates.innerHTML).substr(coord_index+7);

// en.wp coordinates var coord_filter = /([\d+-.]+)_([NS])_([\d+-.]+)_([EW])_/; if(coord_filter.test(coord_params)) {   coord_filter.exec(coord_params); wikiminiatlas_marker_lat=RegExp.$1; if(RegExp.$2=='S') wikiminiatlas_marker_lat*=-1; wikiminiatlas_marker_lon=RegExp.$3; if(RegExp.$4=='W') wikiminiatlas_marker_lon*=-1; }

// de.wp coordinates coord_filter = /([\d+-.]+)_([\d+-.]+)_([\d+-.]*)_([NS])_([\d+-.]+)_([\d+-.]+)_([\d+-.]*)_([EW])_/; if(coord_filter.test(coord_params)) {   coord_filter.exec(coord_params); wikiminiatlas_marker_lat=(1.0*RegExp.$1) + (RegExp.$2/60.0) + (RegExp.$3/3600.0); if(RegExp.$4=='S') wikiminiatlas_marker_lat*=-1; wikiminiatlas_marker_lon=(1.0*RegExp.$5) + (RegExp.$6/60.0) + (RegExp.$6/3600.0); if(RegExp.$8=='W') wikiminiatlas_marker_lon*=-1; }  // de.wp coordinates coord_filter = /([\d+-.]+)_([\d+-.]+)_([NS])_([\d+-.]+)_([\d+-.]+)_([EW])_/; if(coord_filter.test(coord_params)) {   coord_filter.exec(coord_params); wikiminiatlas_marker_lat=(1.0*RegExp.$1) + (RegExp.$2/60.0); if(RegExp.$3=='S') wikiminiatlas_marker_lat*=-1; wikiminiatlas_marker_lon=(1.0*RegExp.$4) + (RegExp.$5/60.0); if(RegExp.$6=='W') wikiminiatlas_marker_lon*=-1; } }  var region_index = (coordinates.innerHTML).indexOf('region:'); if(region_index>-1) {  wikiminiatlas_coordinate_region = (coordinates.innerHTML).substr(region_index+7); wikiminiatlas_coordinate_region = wikiminiatlas_coordinate_region.substr(0,wikiminiatlas_coordinate_region.indexOf('"')); }

WikiMiniAtlasHTML = ' Atlas'; WikiMiniAtlasHTML += ''; WikiMiniAtlasHTML += '' WikiMiniAtlasHTML += ' ';

coordinates.innerHTML = coordinates.innerHTML + WikiMiniAtlasHTML ;

wikiminiatlas_iframe = document.getElementById('wikiminiatlas_iframe'); } }

// // Hook up instalation function // $(wikiminiatlasLoader);

function toggleWikiMiniAtlasIFrame { if(wikiminiatlas_iframe.style.visibility != "visible") {  wikiminiatlas_iframe.style.visibility="visible"; } else {  wikiminiatlas_iframe.style.visibility="hidden"; }

return false; }

//