Benutzer:Habitator terrae/WikiMap URL-Generator/en

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen
<!DOCTYPE html>
<html lang="en">
<head>
<title>
	WikiMap URL-Generator
</title>
<meta charset="UTF-8"/>
<style>
	body, a:target {color:#000}
	form a:target, form label input:checked+label, form label input:checked {font-weight:bold}
	form a:not(:target)+*+*+*+a, form a:not(:target)+*+*+*+*+*+*+*+*+ul {display:none}
	.ext {float:right;font-size:2em}
	#Attribution {position:fixed;right:0;bottom:0;background:#FFF}
</style>
<script>
	//Start
	window.onload = function () {
		sprache();projekt();cluster();karte();locator(),sidebar(),bearing();region();year();
		lat();lon();wp();commons();zoom();allco();
		kat();subcats();subcatdepth();
		page();linksto();linkshere();shape();
		kml();
	};
	
	//Allgemeine Rechenmethoden
	function eingabe(fu) {return document.querySelector('[onchange^='+fu+']')}
	function ausgabe(fu, e, n) {if (n) {rechnen(fu, e, n+4)} else {while (n<4) {n++; rechnen(fu, e, n+4)}}}
	function rechnen(fu, e, n) {
		e = e + "";
		array = document.querySelector(".ext:nth-child("+n+")").href;
		if (array.indexOf("?") == -1) {
			array = array + "?";
		} else {
		array = array + "&";
		}
		array = array.split(fu+"=");
		array = array[0] + fu + "=" + ("a"+array[1]).replace(/[^&]+/, e.replace(/&/g, "%26").replace(/\?/g, "%3F").replace(/ /g, "_").replace(/\=/g, "%3D"))+"  ";
		document.querySelector(".ext:nth-child("+n+")").href = array.replace(fu+"=&","").replace(fu+"= ","").replace("& ","").replace("? ","").replace(/ /g,"");
	}
	
	//Spezialfunktion für das wählen zwischen Wikipedia und Commons bei den Kategorien
	function wiki() {
		var r = document.querySelector("a:nth-child(6)").href;
		if (document.getElementById("cat").checked) {
			document.querySelector("a:nth-child(6)").href = r.replace("wpcat","cat");
			ausgabe("lang", "", 2);
		} else {
			document.querySelector("a:nth-child(6)").href = r.replace("cat","wpcat").replace("wpwp", "wp");
			ausgabe("lang", eingabe("sprache").value, 2);
		}
	}
	
	//Einzelne Funktionen
	function sprache() {ausgabe("lang", eingabe("sprache").value, 0);wiki();}
	function projekt() {if (eingabe("projekt").checked){ausgabe("project", "", 0)} else {ausgabe("project", "wikivoyage", 0)}}
	function cluster() {
		var array = ["false",""];
		if (eingabe("subcats").checked) {array = ["","true"];}
		if (eingabe("cluster").checked) {ausgabe("cluster", array[1], 0)}
		else {ausgabe("cluster", array[0], 0)}
	}
	function karte() {if (eingabe("karte").checked){ausgabe("basemap", "", 0)} else {ausgabe("basemap", "2", 0)}}
	function locator() {if (eingabe("locator").checked) {ausgabe("locator", "true", 0)} else {ausgabe("locator", "", 0)}}
	function sidebar() {if (eingabe("sidebar").checked) {ausgabe("sidebar", "", 0)} else {ausgabe("sidebar", "false", 0)}}
	function bearing() {if (eingabe("bearing").checked) {ausgabe("bearing", "", 0)} else {ausgabe("bearing", "false", 0)}}
	function image() {if (eingabe("image").checked) {ausgabe("image", "", 0)} else {ausgabe("image", "false", 0)}}
	function region() {if (eingabe("region").value == "90|-180|-90|180"){ausgabe("region", "", 0)} else {ausgabe("region", eingabe("region").value.replace(",","."), 0)}}
	function year() {
		var von = Math.round(document.getElementById("von").value);
		var bis = Math.round(document.getElementById("bis").value);
		var text = von + "-" + bis;
		if (von === bis) {text = bis + "";}
		if (!von||von < 2000) {text = text.replace(/[0-9]+\-/, "0000-");}
		if (bis < 2000||bis < von) {text = "0000";}
		if (bis == "") {text = text.replace("-", "") + "-";}
		if (bis == "" && von == "") {text = "";}
		ausgabe("year", text, 0);
	}
	
	function lat() {if (eingabe("lat").value == "auto"){ausgabe("lat", "", 1)} else {ausgabe("lat", eingabe("lat").value.replace(",","."), 1)}}
	function lon() {if (eingabe("lon").value == "auto"){ausgabe("lon", "", 1)} else {ausgabe("lon", eingabe("lon").value.replace(",","."), 1)}}
	function wp() {if (eingabe("wp").checked) {ausgabe("wp", "", 1)} else {ausgabe("wp", "false", 1)}}
	function commons() {if (eingabe("commons").checked) {ausgabe("commons", "", 1)} else {ausgabe("commons", "false", 1)}}
	function zoom() {if (eingabe("zoom").value == 13){ausgabe("zoom", "", 1)} else {ausgabe("zoom", eingabe("zoom").value, 1)}}
	function allco() {if (eingabe("allco").checked) {ausgabe("allco", "true", 1)} else {ausgabe("allco", "", 1)}}
	
	function kat() {ausgabe("cat", eingabe("kat").value, 2);wiki();}
	function subcats() {if (eingabe("subcats").checked) {ausgabe("subcats", "true", 2)} else {ausgabe("subcats", "", 2)} cluster();}
	function subcatdepth() {if (eingabe("subcatdepth").value == 5){ausgabe("subcatdepth", "", 2)} else {ausgabe("subcatdepth", eingabe("subcatdepth").value, 2)}}

	function page() {ausgabe("page", eingabe("page").value, 3)}
	function linksto() {if (eingabe("linksto").checked) {ausgabe("links", "true", 3)} else {ausgabe("links", "", 3)}}
	function linkshere() {if (eingabe("linkshere").checked) {ausgabe("linkshere", "true", 3)} else {ausgabe("linkshere", "", 3)}}
	function shape() {if (eingabe("shape").checked) {ausgabe("shape", "", 3)} else {ausgabe("shape", "false", 3)}}

	function kml() {ausgabe("kml", eingabe("kml").value, 4)}
</script>
</head>
<body>
<form>
	<a href="#Ort" id="Ort">Location mode</a> ·
	<a href="#Kat" id="Kat">Category mode</a> ·
	<a href="#Art" id="Art">Article mode</a> ·
	<a href="#Kml" id="Kml">KML mode</a>
	<a href="https://wikimap.toolforge.org/?lang=en" class="ext">Generate map</a>
	<a href="https://wikimap.toolforge.org/?cat=Media_with_geo-coordinates_needing_categories" class="ext">Generate map</a>
	<a href="https://wikimap.toolforge.org/?page=List_of_highest_mountains_on_Earth&lang=en" class="ext">Generate map</a>
	<a href="https://wikimap.toolforge.org/?lang=en" class="ext">Generate map</a>
	<ul>
		<li><label><input type="text" onchange="sprache()" value="en"/> Article language</label></li>
		<li>Wikimedia article project <input type="radio" name="project" id="project" checked="checked" onchange="projekt()"/><label for="project">Wikipedia</label><input type="radio" name="project" id="project2" onchange="projekt()"/><label for="project2">Wikivoyage</label></li>
		<li><label><input type="checkbox" onchange="cluster()" checked="checked"/> Cluster points on map (with sidebar enable and less than 500 markers or with subcategories off; switching in GUI possible)</label></li>
		<li>Choose basemap <input type="radio" name="basemap" id="basemap" checked="checked" onchange="karte()"/><label for="basemap">Wikimedia maps</label><input type="radio" name="basemap" id="basemap2" onchange="karte()"/><label for="basemap2">WMFlabs map</label></li>
		<li><label><input type="checkbox" onchange="locator()"/> Include Locator tool link on images</label></li>
		<li><label><input type="checkbox" onchange="sidebar()" checked="checked"/> Show markers list for articles & categories (turning clustering off is needed to enable it for more than 500 markers)</label></li>
		<li><label><input type="checkbox" onchange="bearing()" checked="checked"/> Turn markers for photographers direction (needs camera & object coordinates of the image)</label></li>
		<li><label><input type="checkbox" onchange="image()" checked="checked"/> Generate thumbnails (Disabling speed up things enormously)</label></li>
		<li><label><input type="text" onchange="region()" value="90|-180|-90|180"/> Limit results to a specific area per N|W|S|E coordinates</label></li>
		<li><label>From <input type="number" onchange="year()" id="von" placeholder="the big bang"/> till </label><label><input type="number" onchange="year()" id="bis" placeholder="hell freezes over"/>. Limit results to year(s) (of creation or rather category inclusion)</label></li>
	</ul>
	<ul>
		<li><label><input type="text" onchange="lat()" value="auto"/>/</label><label><input type="text" onchange="lon()" value="auto"/> Coordinates (Default: Browser geolocation; Location search in GUI possible)</label></li>
		<li><label><input type="checkbox" onchange="wp()" checked="checked"/> Show Wikipedia articles</label></li>
		<li><label><input type="checkbox" onchange="commons()" checked="checked"/> Show Commons images</label></li>
		<li><label><input type="range" onchange="zoom()" max="20" value="13"/> Zoom</label></li>
		<li><label><input type="checkbox" onchange="allco()"/> Show secondary coordinates too</label></li>
	</ul>
	<ul>
		<li><label><input type="text" onchange="kat()" value="Media with geo-coordinates needing categories"/> Show all </label><input type="radio" name="c" id="cat" checked="checked" onchange="wiki()"/><label for="cat">images of a commons</label><input type="radio" name="c" id="wpcat" onchange="wiki()"/><label for="wpcat">articles of a Wikipedia</label> category</li>
		<li><label><input type="checkbox" onchange="subcats()"/> Show subcategories</label></li>
		<li><label><input type="number" onchange="subcatdepth()" value="5"/> Depth of subcategories</label></li>
	</ul>
	<ul>
		<li><label><input type="text" onchange="page()" value="List of highest mountains on Earth"/> Show Wikipedia article with all including coordinates (universal for articles & categories; with "Category:" prefix just as "wpcat")</label></li>
		<li><label><input type="checkbox" onchange="linksto()"/> Show linked articles</label></li>
		<li><label><input type="checkbox" onchange="linkshere()"/> Show articles linking to this article</label></li>
		<li><label><input type="checkbox" onchange="shape()" checked="checked" /> Show shape</label></li>
	</ul>
	<ul>
		<li><label><input type="text" onchange="kml()" value=""/> Visualize KML page</label></li>
	</ul>
</form><br/>
<div id="Attribution">Based on <a href="https://de.wikipedia.org/wiki/Benutzer:DB111">DB111</a>, created by <a href="https://de.wikipedia.org/wiki/Benutzer:Habitator_terrae">Habitator terrae</a>. <a href="http://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA 3.0</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/legalcode">legal</a>).</div>
</body>
</html>