User:Hlaw/global.js

/*mw.loader.implement( 'code.js',   [        '//community.wikia.com/wiki/User:Hlaw/Leaflet.js?action=raw&ctype=text/javascript'    ], {        css: ''     }, {        // this part is for any messages you might want        // I personally haven't used it so can't give any pointers on how it works    } );*/

importScriptPage('User:Hlaw/Leaflet.js', 'c');

/*mw.loader.using( [ 'code.js' ], function {    // execute whatever callback you need here

} );*/

/* if (wgCanonicalNamespace == 'User' || wgCanonicalNamespace == 'User_talk') { $('Hide ').insertAfter('.UserProfileActionButton'); $('Show ').insertAfter('.UserProfileActionButton'); } function hideBar { $('#UserProfileMasthead').hide; } function showBar { $('#UserProfileMasthead').show; } /* Insert map */ function CreateHideMap { $('.infomap tbody:nth-child(1) tr:nth-child(1) td:nth-child(1) span:nth-child(1) a:nth-last-child(1)').after('     '); //$('.infomap tbody:nth-child(1) tr:nth-child(1)').after('    '); //$('.mapexpandbutton').after(''); var maplat = $('.infomap').attr('data-lat'); var maplon = $('.infomap').attr('data-lon'); var map = L.map('embededmap').setView([maplat, maplon], 16); var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; var osmAttrib='Map data © OSM contributors'; var osm = new L.TileLayer(osmUrl, {minZoom: 9, maxZoom: 18, attribution: osmAttrib, zoomControl: false}); // start the map map.addLayer(osm); L.marker([maplat, maplon]).addTo(map); }

addOnloadHook(CreateHideMap);

/*$(window).load(function { //   $.getScript( 'http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js').done(function // { CreateHideMap; //  }); });*/