User:Gopavasanth/UserScripts/WikiShootMe.js

/* This function receives latitude and longitude coordinates as input and redirects the user to the Wikishoot tool page, which shows nearby Wikimedia Commons images of the location. */

$(document).ready(function {	var latText = $('.latitude').text;	var lonText = $('.longitude').text;	var parseCoordinate = function(coordText) {		var degrees = parseInt(coordText.match(/\d+/g)[0]);		var minutes = parseInt(coordText.match(/\d+/g)[1]);		var seconds = parseInt(coordText.match(/\d+/g)[2]);		var sign = /[WS]/.test(coordText) ? -1 : 1;		return sign * (degrees + (minutes / 60) + (seconds / 3600));	};	var latitude = parseCoordinate(latText);	var longitude = parseCoordinate(lonText);	var wikishootbtn = $(" ").text("Wikishoot");	$('.mw-indicators').append(wikishootbtn);	wikishootbtn.on('click', function { window.location.href = "https://wikishootme.toolforge.org/#lat=" + latitude + "&lng=" + longitude + "&zoom=18"; }); });