Jump to content

User:Baba taré/common.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
var wma_settings = { activé : faux } var wma_settings = { activé : faux }  importScript('User:Baba taré/common.js'); // Backlink: [[User:Baba taré/common.js]]
/* Use your own custom page instead of the regular GeoHack.
 *
 * It support the following replacement variables found in GeoHack:
 * {latdegdec} {londegdec} {scale} {span} {osmzoom}
 *
 * Based on a script by [[User:Dispenser]]: [[mw:GeoHack/Replacement_script]]
 *
 * Instructions:
 * 1) Add the following line to your common.js (or skin-specific js):
 *      importScript('User:Baba taré
 * 2) Create your custom GeoHack user subpage at [[User:YOURUSERNAME/GeoHack]]
 *    - use whatever content and formatting you like
 *    - use the replacement variables above in external links, e.g. for Google Maps use
 *        http://maps.google.com/maps?ll={latdegdec},{londegdec}&spn={span},{span}&q={latdegdec},{londegdec}
 *    - more urls can be found at [[Template:GeoTemplate]]
 *    - see [[User:Evad37/GeoHack]] for an example page
 *
 * 3) Now coordinates will link to this page instead of GeoHack (specifying real values to take the place of
 *    the replacement variables in external links)
 *
 */ 
jQuery( function( $ ) {

	if ( mw.config.get("wgPageName") !== "User:" + mw.config.get("wgUserName") + "/GeoHack" ) {

 		var geohack_base = "//geohack.toolforge.org/geohack.php";
		var coord_filter = /&params=([\d.+-]+)_([\d.+-]*)_?([\d.+-]*)_?([NSZ])_([\d.+-]+)_([\d.+-]*)_?([\d.+-]*)_?([EOW])([^&=]*)/;
		var link, lat, lon, scale;
		$("a[href*='" + geohack_base + "']").each(function() {
			if(coord_filter.exec($(this).attr("href"))) {
				// latitude and longitude
				lat=(1.0*RegExp.$1) + ((RegExp.$2||0)/60.0) + ((RegExp.$3||0)/3600.0);
				if(RegExp.$4!='N') lat*=-1;
				lon=(1.0*RegExp.$5) + ((RegExp.$6||0)/60.0) + ((RegExp.$7||0)/3600.0);
				if(RegExp.$8=='W') lon*=-1;
				
				// Determine scale/zoom
				var params = RegExp.$9;
				if(/_globe:(?!earth|_|$)/i.test(params)) return;
				if(/_type:(adm3rd|city|mountain|isle|river|waterbody)/.test(params))scale = 100000;
				else if(/_type:(event|forest|glacier)/.test(params))scale = 50000;
				else if(/_type:(airport|edu|pass|landmark|railwaystation)/.test(params))scale = 10000;
				else scale = 300000;
				if(/_dim:([\d.+-]+)(km)?m?/.exec(params))scale = RegExp.$1 * (RegExp.$2?10000:10);
				if(/_scale:(\d+)(_|$)/.exec(params))scale = RegExp.$1;
				var osmzoom = 18 - Math.round(Math.log(scale/1693) / Math.log(2));
				var zoom =  Math.log( 1.5e8/scale) / Math.log(2);
				
				$(this).attr("href", "").attr("onclick","window.open(\"https://en.wikipedia.org/wiki/User:Baba taré/GeoHack?lat=" + lat +"&lon=" + lon + "&scale=" + scale + "&span=" + span + "&osmzoom=" + osmzoom + "&zoom=" + zoom +"\")");
			}
		});

	} else if ( mw.util.getParamValue( 'lat' ) ) {

		var lat = mw.util.getParamValue( 'lat' );
		var lon = mw.util.getParamValue( 'lon' );
		var scale = mw.util.getParamValue( 'scale' );
		var span = mw.util.getParamValue( 'span' );
		var osmzoom = mw.util.getParamValue( 'osmzoom' );
		var zoom = mw.util.getParamValue( 'zoom' );

		$("a.external").each(function() {
			var old_url = $(this).attr("href");
			var replacement_url = old_url.replace(/\{latdegdec\}/g, lat).replace(/\{londegdec\}/g, lon).replace(/\{scale\}/g, scale).replace(/\{span\}/g, scale/1e6).replace(/\{osmzoom\}/g, osmzoom).replace(/\{zoom\}/g, zoom);
			$(this).attr("href", replacement_url);
		});

		$("#siteSub").append("<hr><img src='https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Symbol_confirmed.svg/16px-Symbol_confirmed.svg.png'/> Coordinates loaded<hr>");

	} else {

		$("#siteSub").append("<hr><img src='https://upload.wikimedia.org/wikipedia/commons/thumb/1/1d/Information_icon4.svg/20px-Information_icon4.svg.png'/> <span style='font-weight:bold;'>Note:</span> No coordinates loaded (mapping service links will not work)<hr>");

	}

});
importScript('User:Baba taré/common.js'); // Backlink: [[User:Baba taré/common.js]]
importScript('User:195.114.29.189/common.js'); // Backlink: [[User:195.114.29.189/common.js]]
importScript('User:Terasail/HeaderIcons.js'); // Backlink: [[User:Terasail/HeaderIcons.js]]
importScript('User:Eizen/SkinSwitcher.js'); // Backlink: [[User:Eizen/SkinSwitcher.js]]
importScript('User:ClaudineChionh/Scripts/SkinSwitcher.js'); // Backlink: [[User:ClaudineChionh/Scripts/SkinSwitcher.js]]
importScript('User:Fred_Gandt/userResourceManager.js'); // Backlink: [[User:Fred_Gandt/userResourceManager.js]]
importScript('User:Novem_Linguae/Scripts/VisualEditorEverywhere.js'); // Backlink: [[User:Novem_Linguae/Scripts/VisualEditorEverywhere.js]]
importScript('User:Phlsph7/WikiChatbot.js'); // Backlink: [[User:Phlsph7/WikiChatbot.js]]
importScript('User:SoledadKabocha/copySectionLink.js'); // Backlink: [[User:SoledadKabocha/copySectionLink.js]]
importScript('User:Nitobus/div.GoogleMap.js'); // Backlink: [[User:Nitobus/div.GoogleMap.js]]
importScript('User:Evad37/GeoHack_replacement_script.js'); // Backlink: [[User:Evad37/GeoHack_replacement_script.js]]
importScript('User:Enterprisey/parent-cats.js'); // Backlink: [[User:Enterprisey/parent-cats.js]]
importScript('m:User:NguoiDungKhongDinhDanh/AceForLuaDebugConsole.js'); // Backlink: [[m:User:NguoiDungKhongDinhDanh/AceForLuaDebugConsole.js]]
importScript('User:Danski454/code-link.js'); // Backlink: [[User:Danski454/code-link.js]]
importScript('wikt:MediaWiki:Gadget-CodeLinks.js'); // Backlink: [[wikt:MediaWiki:Gadget-CodeLinks.js]]
importScript('User:Dixtosa/userscriptInterwikiLink.js'); // Backlink: [[User:Dixtosa/userscriptInterwikiLink.js]]
importScript('User:Erutuon/scripts/gadgets-definition.js'); // Backlink: [[User:Erutuon/scripts/gadgets-definition.js]]
importScript('User:Qwerfjkl/scripts/hideUnwantedCategories.js'); // Backlink: [[User:Qwerfjkl/scripts/hideUnwantedCategories.js]]
importScript('User:Rummskartoffel/share_ExpandTemplates_url.js'); // Backlink: [[User:Rummskartoffel/share_ExpandTemplates_url.js]]
importScript('User:Shubinator/DYKcheck.js'); // Backlink: [[User:Shubinator/DYKcheck.js]]
importScript('User:Eizen/LastEditor.js'); // Backlink: [[User:Eizen/LastEditor.js]]
importScript('User:Novem_Linguae/Scripts/ReviewStatus.js'); // Backlink: [[User:Novem_Linguae/Scripts/ReviewStatus.js]]
importScript('User:SD0001/watchlist-update-title.js'); // Backlink: [[User:SD0001/watchlist-update-title.js]]
importScript('User:SD0001/shortdescs-in-category.js'); // Backlink: [[User:SD0001/shortdescs-in-category.js]]
importScript('User:PAC2/chouette.js'); // Backlink: [[User:PAC2/chouette.js]]
importScript('User:Ainz_Ooal_Gown/mobilemorelinks.js'); // Backlink: [[User:Ainz_Ooal_Gown/mobilemorelinks.js]]
importScript('User:1234qwer1234qwer4/editthispage.js'); // Backlink: [[User:1234qwer1234qwer4/editthispage.js]]
importScript('User:DannyS712/Undo.js'); // Backlink: [[User:DannyS712/Undo.js]]
importScript('User:TheJosh/Scripts/RecentChangesPatrol.js'); // Backlink: [[User:TheJosh/Scripts/RecentChangesPatrol.js]]
importScript('User:RealFakeKim/Scripts/commonLinks.js'); // Backlink: [[User:RealFakeKim/Scripts/commonLinks.js]]
importScript('User:Awesome_Aasim/addmylinks.js'); // Backlink: [[User:Awesome_Aasim/addmylinks.js]]
importScript('User:Mdaniels5757/PersonalDashboardLink.js'); // Backlink: [[User:Mdaniels5757/PersonalDashboardLink.js]]
importScript('User:PrimeHunter/My_subpages.js'); // Backlink: [[User:PrimeHunter/My_subpages.js]]
importScript('User:J947/Quick_links.js'); // Backlink: [[User:J947/Quick_links.js]]
importScript('User:J947/Task_link.js'); // Backlink: [[User:J947/Task_link.js]]
importScript('User:Equazcion/BetterTwinklePrefs.js'); // Backlink: [[User:Equazcion/BetterTwinklePrefs.js]]
importScript('User:BrandonXLF/GlobalPrefs.js'); // Backlink: [[User:BrandonXLF/GlobalPrefs.js]]
importScript('User:Nigos/scripts/RandomRootpage.js'); // Backlink: [[User:Nigos/scripts/RandomRootpage.js]]
importScript('User:Music1201/QuickLinks.js'); // Backlink: [[User:Music1201/QuickLinks.js]]
importScript('User:SD0001/private-sandbox.js'); // Backlink: [[User:SD0001/private-sandbox.js]]
importScript('User:BrandonXLF/TestWikitext.js'); // Backlink: [[User:BrandonXLF/TestWikitext.js]]
importScript('User:Writ_Keeper/Scripts/previewAndDiff.js'); // Backlink: [[User:Writ_Keeper/Scripts/previewAndDiff.js]]
importScript('User:Joeytje50/JWB.js/load.js'); // Backlink: [[User:Joeytje50/JWB.js/load.js]]
importScript('m:User:NguoiDungKhongDinhDanh/CodeAjaxEditor.js'); // Backlink: [[m:User:NguoiDungKhongDinhDanh/CodeAjaxEditor.js]]
importScript('m:User:Jon_Harald_Søby/diffedit.js'); // Backlink: [[m:User:Jon_Harald_Søby/diffedit.js]]
importScript('User:Qwertyytrewqqwerty/DisamAssist.js'); // Backlink: [[User:Qwertyytrewqqwerty/DisamAssist.js]]
importScript('User:The_Evil_IP_address/hdedit.js'); // Backlink: [[User:The_Evil_IP_address/hdedit.js]]
importScript('User:Awesome_Aasim/quickcreate.js'); // Backlink: [[User:Awesome_Aasim/quickcreate.js]]
importScript('User:EpochFail/wikignome.js'); // Backlink: [[User:EpochFail/wikignome.js]]
importScript('Wikipedia:AutoEd/basic.js'); // Backlink: [[Wikipedia:AutoEd/basic.js]]
importScript('User:Ohconfucius/script/formatgeneral.js'); // Backlink: [[User:Ohconfucius/script/formatgeneral.js]]
importScript('User:Novem_Linguae/Scripts/DraftCleaner.js'); // Backlink: [[User:Novem_Linguae/Scripts/DraftCleaner.js]]
importScript('User:Ohconfucius/script/Common_Terms.js'); // Backlink: [[User:Ohconfucius/script/Common_Terms.js]]
importScript('User:Ohconfucius/script/MOSNUM_dates.js'); // Backlink: [[User:Ohconfucius/script/MOSNUM_dates.js]]
importScript('User:Salix_alba/Citoid.js'); // Backlink: [[User:Salix_alba/Citoid.js]]
importScript('User:Taavi/Aligner.js'); // Backlink: [[User:Taavi/Aligner.js]]
importScript('User:Evad37/kmlToJson.js'); // Backlink: [[User:Evad37/kmlToJson.js]]
importScript('User:קיפודנחש/TemplateParamWizard.js'); // Backlink: [[User:קיפודנחש/TemplateParamWizard.js]]
importScript('User:Chlod/Scripts/Coordinator.js'); // Backlink: [[User:Chlod/Scripts/Coordinator.js]]
importScript('User:Vghfr/EasyTemplates/Easytemplates.js'); // Backlink: [[User:Vghfr/EasyTemplates/Easytemplates.js]]
importScript('User:Daduxing/familytree.js'); // Backlink: [[User:Daduxing/familytree.js]]
importScript('User:BrandonXLF/CSSImageCrop.js'); // Backlink: [[User:BrandonXLF/CSSImageCrop.js]]
importScript('User:Frietjes/findargdups.js'); // Backlink: [[User:Frietjes/findargdups.js]]
importScript('User:Novem_Linguae/Scripts/SpeciesHelper.js'); // Backlink: [[User:Novem_Linguae/Scripts/SpeciesHelper.js]]
importScript('User:Tol/VECN.js'); // Backlink: [[User:Tol/VECN.js]]
importScript('User:Cobaltcigs/IllWill.js'); // Backlink: [[User:Cobaltcigs/IllWill.js]]
importScript('User:Enterprisey/sync-template-sandbox.js'); // Backlink: [[User:Enterprisey/sync-template-sandbox.js]]
importScript('User:Equazcion/SafetyEdit.js'); // Backlink: [[User:Equazcion/SafetyEdit.js]]
importScript('User:Jackmcbarn/advancedtemplatesandbox.js'); // Backlink: [[User:Jackmcbarn/advancedtemplatesandbox.js]]
importScript('User:Frietjes/infoboxgap.js'); // Backlink: [[User:Frietjes/infoboxgap.js]]
importScript('User:Ais523/bracketmatch.js'); // Backlink: [[User:Ais523/bracketmatch.js]]
importScript('User:קיפודנחש/cat-a-lot.js'); // Backlink: [[User:קיפודנחש/cat-a-lot.js]]
importScript('User:Σ/Testing_facility/Archiver.js'); // Backlink: [[User:Σ/Testing_facility/Archiver.js]]
importScript('User:Enterprisey/req-helper.js'); // Backlink: [[User:Enterprisey/req-helper.js]]
importScript('User:Xenocidic/statusChanger2.js'); // Backlink: [[User:Xenocidic/statusChanger2.js]]
importScript('User:Ale_jrb/Scripts/csdhelper.js'); // Backlink: [[User:Ale_jrb/Scripts/csdhelper.js]]
importScript('User:GeneralNotability/spihelper.js'); // Backlink: [[User:GeneralNotability/spihelper.js]]
importScript('User:Guarapiranga/accessKeysCheatSheet.js'); // Backlink: [[User:Guarapiranga/accessKeysCheatSheet.js]]
importScript('User:Zhaofeng_Li/accesskey.css'); // Backlink: [[User:Zhaofeng_Li/accesskey.css]]