[tarent-useful-scripts SCM] {mirkarte} branch master updated. b3c6738bfb3d9563dde0e2a8e75efd8128ca114f

mirabilos at evolvis.org mirabilos at evolvis.org
Sat Oct 18 17:15:15 CEST 2014 • <20141018151515.2A4B84A2559@evolvis.org>


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MirKarte source code repository".

The branch, master has been updated
       via  b3c6738bfb3d9563dde0e2a8e75efd8128ca114f (commit)
       via  2309007ce125b132558223c0dd06b844d6577a19 (commit)
      from  0827be9c1e67b2c57f4b11d1e10b9c8583a1b207 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b3c6738bfb3d9563dde0e2a8e75efd8128ca114f
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Sat Oct 18 15:15:30 2014 +0000

    add GeoVexilla flags

commit 2309007ce125b132558223c0dd06b844d6577a19
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Sat Oct 18 15:02:33 2014 +0000

    API change: default location now set in index.htm (or CGI)

-----------------------------------------------------------------------

Summary of changes:
 README         |    6 +++
 geohashing.cgi |    1 +
 geovexilla.cgi |  135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ghtomorrow.cgi |    1 +
 index.htm      |    1 +
 marker.htm     |    1 +
 marker.js      |    8 ++--
 mirkarte.js    |    8 ++--
 8 files changed, 151 insertions(+), 10 deletions(-)
 create mode 100755 geovexilla.cgi

diff --git a/README b/README
index 7504beb..da4fe20 100644
--- a/README
+++ b/README
@@ -27,6 +27,7 @@ Variants:
   largely untested, markers cannot be removed, scrap
 – geohashing.cgi (mirkarte.js): displays xkcd Geo Hashing waypoints
 – ghtomorrow.cgi (mirkarte.js): same, but for the next day
+– geovexilla.cgi (mirkarte.js): displays GeoVexilla.gpsgames.org flags
 
 VCS repository:
 https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=useful-scripts/mirkarte.git
@@ -66,3 +67,8 @@ Other notes
 ───────────
 
 GeoHashing is always calculated east of 30°W only.
+The area is limited to a hard-coded value, currently
+in between 42°N 6°W and 56°N 12°E. Run xkcd2js.sh
+and change the CGIs to change this range.
+
+Centre coordinates for GeoVexilla are currently hardcoded.
diff --git a/geohashing.cgi b/geohashing.cgi
index 1b23e1a..649e608 100755
--- a/geohashing.cgi
+++ b/geohashing.cgi
@@ -276,6 +276,7 @@ Content-type: text/html; charset=utf-8
  <script type="text/javascript" src="zip.js/WebContent/zip.js"></script>
  <script type="text/javascript"><!--//--><![CDATA[//><!--
   zip.workerScriptsPath = "zip.js/WebContent/";
+  mirkarte_default_loc = [50.7, 7.11, 8];
   var graticules = [
 	/* BEGIN generated file from xkcd2js.sh */
 	["42", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Ponferrada,_Spain\">Ponferrada, Spain</a>"],
diff --git a/geovexilla.cgi b/geovexilla.cgi
new file mode 100755
index 0000000..9ef8163
--- /dev/null
+++ b/geovexilla.cgi
@@ -0,0 +1,135 @@
+#!/bin/mksh
+#-
+# Copyright © 2014
+#	Thorsten “mirabilos” Glaser <tg at mirbsd.org>
+#
+# Provided that these terms and disclaimer and all copyright notices
+# are retained or reproduced in an accompanying document, permission
+# is granted to deal in this work without restriction, including un‐
+# limited rights to use, publicly perform, distribute, sell, modify,
+# merge, give away, or sublicence.
+#
+# This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
+# the utmost extent permitted by applicable law, neither express nor
+# implied; without malicious intent or gross negligence. In no event
+# may a licensor, author or contributor be held liable for indirect,
+# direct, other damage, loss, or other issues arising in any way out
+# of dealing in the work, even if advised of the possibility of such
+# damage or existence of a defect, except proven that it results out
+# of said person’s immediate fault when using the work as intended.
+
+#XXX make these CGI parameters
+deflat=50.7
+deflon=7.11
+defzoom=9
+
+fetch='ftp -o -'
+whence -p wget >/dev/null 2>&1 && fetch='wget -qO- -T3'
+
+cat <<'EOF'
+Content-type: text/html; charset=utf-8
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <meta name="copyright" content="see mirkarte.js" />
+ <title>MirKarte for GeoVexilla (Beta)</title>
+ <link rel="stylesheet" type="text/css" href="leaflet/leaflet.css" />
+ <style type="text/css"><!--/*--><![CDATA[/*><!--*/
+  #nomap {
+	padding:12px;
+	margin:12px;
+	border:1px solid black;
+	width:24em;
+  }
+  #map {
+	height:100%;
+	width:100%;
+	position:relative;
+  }
+  #map_coors {
+	position:fixed;
+	right:0; bottom:16px;
+	padding:6px;
+	font:12px monospace, sans-serif;
+	text-align:right;
+	z-index:3;
+  }
+  #map_coors span {
+	background:rgba(255, 255, 255, 0.33);
+  }
+  #map_wrapper {
+	position:absolute;
+	top:0; left:0;
+	bottom:0; right:0;
+  }
+  .myzoomcontrol-text {
+	font:bold 14px 'Lucida Console', Monaco, monospace;
+	text-align:center;
+	vertical-align:middle;
+  }
+  .nowrap {
+	white-space:nowrap;
+  }
+ /*]]>*/--></style>
+ <script type="text/javascript" src="leaflet/leaflet-src.js"></script>
+ <script type="text/javascript" src="prototype/prototype.js"></script>
+ <script type="text/javascript" src="togeojson/togeojson.js"></script>
+ <script type="text/javascript" src="zip.js/WebContent/zip.js"></script>
+ <script type="text/javascript"><!--//--><![CDATA[//><!--
+  zip.workerScriptsPath = "zip.js/WebContent/";
+EOF
+print "  mirkarte_default_loc = [$deflat, $deflon, $defzoom];"
+
+$fetch "http://geovexilla.gpsgames.org/cgi-bin/vx.pl?zoom=$defzoom&lat=$deflat&lon=$deflon" | \
+    fgrep google.maps.InfoWindow | sed \
+    -e 's/^.*content: "[	 '\'']*//' \
+    -e 's/[	 '\''
]*".*$//' \
+    -e "s!'/cgi-bin!'http://geovexilla.gpsgames.org/cgi-bin!g" |&
+n=0; print "  var geovexilla_arr = ["
+while IFS= read -pr line; do
+	print -r -- "	[$((++n)), \"$line\"],"
+done
+print '	[0, ""]'
+print '  ];'
+
+cat <<'EOF'
+
+  function mirkarte_hookfn(map) {
+	var i = 0;
+	var xre = /&lat=([0-9.-]*)&lon=([0-9.-]*)'/;
+
+	while (geovexilla_arr[i][0] != 0) {
+		var xs = xre.exec(geovexilla_arr[i][1]);
+		var ghlat = parseFloat(xs[1]);
+		var ghlon = parseFloat(xs[2]);
+		var ghmarker = L.marker([ghlat, ghlon], {
+			"draggable": false
+		    }).addTo(map);
+		var f = llformat(ghlat, ghlon, 1);
+		ghmarker.bindPopup(f[0] + ' ' + f[1] + '<br />' + geovexilla_arr[i][1]);
+		i++;
+	}
+  }
+
+ //--><!]]></script>
+ <script type="text/javascript" src="mirkarte.js"></script>
+</head><body>
+<div id="map_wrapper">
+ <div id="map">
+  <p id="nomap">
+   This is an interactive map application called “MirKarte”.
+   Unfortunately, it is implemented completely client-side
+   in JavaScript – so, you have to enable that, and use a
+   GUI webbrowser supported by Leaflet and Prototype.
+  </p>
+ </div>
+ <div id="map_coors">
+  <span id="map_coors_ns"></span><br />
+  <span id="map_coors_we"></span>
+ </div>
+</div>
+</body></html>
+EOF
+exit 0
diff --git a/ghtomorrow.cgi b/ghtomorrow.cgi
index 5b66bca..52dd62b 100755
--- a/ghtomorrow.cgi
+++ b/ghtomorrow.cgi
@@ -276,6 +276,7 @@ Content-type: text/html; charset=utf-8
  <script type="text/javascript" src="zip.js/WebContent/zip.js"></script>
  <script type="text/javascript"><!--//--><![CDATA[//><!--
   zip.workerScriptsPath = "zip.js/WebContent/";
+  mirkarte_default_loc = [50.7, 7.11, 8];
   var graticules = [
 	/* BEGIN generated file from xkcd2js.sh */
 	["42", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Ponferrada,_Spain\">Ponferrada, Spain</a>"],
diff --git a/index.htm b/index.htm
index f2a9a35..96a34c7 100644
--- a/index.htm
+++ b/index.htm
@@ -48,6 +48,7 @@
  <script type="text/javascript" src="zip.js/WebContent/zip.js"></script>
  <script type="text/javascript"><!--//--><![CDATA[//><!--
   zip.workerScriptsPath = "zip.js/WebContent/";
+  mirkarte_default_loc = [50.7, 7.11, 12];
  //--><!]]></script>
  <script type="text/javascript" src="mirkarte.js"></script>
 </head><body>
diff --git a/marker.htm b/marker.htm
index af01c36..8321a01 100644
--- a/marker.htm
+++ b/marker.htm
@@ -48,6 +48,7 @@
  <script type="text/javascript" src="zip.js/WebContent/zip.js"></script>
  <script type="text/javascript"><!--//--><![CDATA[//><!--
   zip.workerScriptsPath = "zip.js/WebContent/";
+  mirkarte_default_loc = [50.7, 7.11, 12];
  //--><!]]></script>
  <script type="text/javascript" src="marker.js"></script>
 </head><body>
diff --git a/marker.js b/marker.js
index bb8278e..b44de2d 100644
--- a/marker.js
+++ b/marker.js
@@ -361,8 +361,7 @@ var fn_hashchanged = function () {
 		/* convert to int */
 		czoom = czoom | 0;
 	} else {
-		/* default value */
-		czoom = 12;
+		czoom = mirkarte_default_loc[2];
 	}
 	params["zoom"] = czoom;
 
@@ -371,9 +370,8 @@ var fn_hashchanged = function () {
 	if (isNaN(clat) || isNaN(clon) ||
 	    clat < -85 || clat > 85 ||
 	    clon < -180 || clon > 180) {
-		/* default value */
-		clat = 50.7;
-		clon = 7.11;
+		clat = mirkarte_default_loc[0];
+		clon = mirkarte_default_loc[1];
 	}
 	delete params["center_lat"];
 	delete params["center_lon"]
diff --git a/mirkarte.js b/mirkarte.js
index 5482989..2ab4cf8 100644
--- a/mirkarte.js
+++ b/mirkarte.js
@@ -371,8 +371,7 @@ var fn_hashchanged = function () {
 		/* convert to int */
 		czoom = czoom | 0;
 	} else {
-		/* default value */
-		czoom = 12;
+		czoom = mirkarte_default_loc[2];
 	}
 	params["zoom"] = czoom;
 
@@ -435,9 +434,8 @@ var fn_hashchanged = function () {
 	if (isNaN(clat) || isNaN(clon) ||
 	    clat < -85 || clat > 85 ||
 	    clon < -180 || clon > 180) {
-		/* default value */
-		clat = 50.7;
-		clon = 7.11;
+		clat = mirkarte_default_loc[0];
+		clon = mirkarte_default_loc[1];
 		/* jump to marker position */
 		if (wantMarker) {
 			clat = mlat;


hooks/post-receive
-- 
MirKarte source code repository
(Evolvis project useful-scripts repository mirkarte)


More information about the useful-scripts-commits mailing list