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

mirabilos at evolvis.org mirabilos at evolvis.org
Tue Jun 17 19:03:57 CEST 2014


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  edf8767da2b138a699478f60d7c7299defa5c285 (commit)
       via  0c2a2742526f391c0d345f7908c51631b3a4efca (commit)
       via  525d6b444f6d995887ced7319c03a12aa4df5019 (commit)
       via  54164ca23aabf8582e3bf0ea05463ea63e980c5b (commit)
       via  083ccd466a490787f22f0ccf63ec237c750ed108 (commit)
       via  450c13e8a1e6dada9aa5aab21dd458093db6448f (commit)
       via  a78244233bc41d8d4cc6a21d96306b78ab8e7931 (commit)
       via  8c68a0597efa5810fac07392fa75a6204ede2189 (commit)
       via  0660f68afa6006df1f72f1e3c0e17fadd9d79f2e (commit)
       via  de83ec74ca2126fffa45d703136c7440a7f1121f (commit)
       via  bcaa1667ee89a2e98c261cfb554a10ffeb3ceaf3 (commit)
       via  b31df3ba1793cc4df8506ad8308b3cd11a05aa09 (commit)
       via  49d4c161e92cfecfd7edccc9a6aa04dbc98fdf4c (commit)
       via  57e381968f762adb0929ac8bd152027201b77f69 (commit)
      from  d13d5eacefba3d22eb6c2eb689198cad6d10c569 (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 edf8767da2b138a699478f60d7c7299defa5c285
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 19:03:23 2014 +0200

    document consequences

commit 0c2a2742526f391c0d345f7908c51631b3a4efca
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 19:02:51 2014 +0200

    it’s better to not touch window.location.hash too much

commit 525d6b444f6d995887ced7319c03a12aa4df5019
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 18:57:20 2014 +0200

    really fix shift-click

commit 54164ca23aabf8582e3bf0ea05463ea63e980c5b
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 18:47:27 2014 +0200

    more legible

commit 083ccd466a490787f22f0ccf63ec237c750ed108
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 18:25:33 2014 +0200

    $(document).observe("hashchange", fn_hashchange); does not work

commit 450c13e8a1e6dada9aa5aab21dd458093db6448f
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 18:16:58 2014 +0200

    prevent line-wrapping coordinates

commit a78244233bc41d8d4cc6a21d96306b78ab8e7931
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 18:09:15 2014 +0200

    fix observing the hashchange event

commit 8c68a0597efa5810fac07392fa75a6204ede2189
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 18:08:52 2014 +0200

    do not use the three-argument form of "".replace() in Opera 9

commit 0660f68afa6006df1f72f1e3c0e17fadd9d79f2e
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 17:54:43 2014 +0200

    shift-click (w/o dragging) is now the same as right-click
    
    for Opera ;-)

commit de83ec74ca2126fffa45d703136c7440a7f1121f
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 17:05:35 2014 +0200

    fix mouse move events on Opera 9

commit bcaa1667ee89a2e98c261cfb554a10ffeb3ceaf3
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 17:05:15 2014 +0200

    fix CSS bug exposed by Opera 9

commit b31df3ba1793cc4df8506ad8308b3cd11a05aa09
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 17:04:53 2014 +0200

    make coordinates visible on Opera 9 by raising its Z index

commit 49d4c161e92cfecfd7edccc9a6aa04dbc98fdf4c
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 16:45:05 2014 +0200

    some browser notes, and why we don’t need to merge the “exp” branch

commit 57e381968f762adb0929ac8bd152027201b77f69
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Jun 17 15:59:07 2014 +0200

    fix Konqueror JS error popup for missing Blob

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

Summary of changes:
 README                   |   25 ++++
 index.htm                |    8 +-
 leaflet/leaflet-src.js   |   31 ++++-
 mirkarte.js              |  291 ++++++++++++++++++++++++----------------------
 zip.js/WebContent/zip.js |    4 +-
 5 files changed, 216 insertions(+), 143 deletions(-)

diff --git a/README b/README
index 2436a38..fd24978 100644
--- a/README
+++ b/README
@@ -28,3 +28,28 @@ MirKarte is developed “on the side” by a developer from
 The MirOS Project. Please feel invited to discuss it, send
 patches, etc. to: <miros-discuss at mirbsd.org>
 Web: http://news.gmane.org/gmane.os.miros.general
+
+
+Browser notes
+─────────────
+
+Opera 9 mostly works, except right-clicks; subsequent
+double-clicks need mouse movement in between. No File API.
+
+Konqueror (KDE 4) with KHTML is pretty bad: right click is
+mildly broken, panning is very annoying. No File API.
+
+Konqueror (KDE 4) with Webkit works better. ZIP decoding
+misses getting the progress and end events, but regular
+GPX import works.
+
+This was mostly tested with Firefox 24 ESR on Debian.
+
+
+Documentation
+─────────────
+
+TODO: create user docs, based on Leaflet docs.
+
+Shift-Click (w/o dragging) is now the same as right-click.
+But Shift-Doubleclick is broken now. Meh.
diff --git a/index.htm b/index.htm
index 5ef0eb4..f2a9a35 100644
--- a/index.htm
+++ b/index.htm
@@ -21,8 +21,9 @@
 	position:fixed;
 	right:0; bottom:16px;
 	padding:6px;
-	font:11px monospace, sans-serif;
+	font:12px monospace, sans-serif;
 	text-align:right;
+	z-index:3;
   }
   #map_coors span {
 	background:rgba(255, 255, 255, 0.33);
@@ -35,7 +36,10 @@
   .myzoomcontrol-text {
 	font:bold 14px 'Lucida Console', Monaco, monospace;
 	text-align:center;
-	vertical-align:center;
+	vertical-align:middle;
+  }
+  .nowrap {
+	white-space:nowrap;
   }
  /*]]>*/--></style>
  <script type="text/javascript" src="leaflet/leaflet-src.js"></script>
diff --git a/leaflet/leaflet-src.js b/leaflet/leaflet-src.js
index c04a7c1..af16eea 100644
--- a/leaflet/leaflet-src.js
+++ b/leaflet/leaflet-src.js
@@ -6533,7 +6533,20 @@ L.DomEvent = {
 			return new L.Point(e.clientX, e.clientY);
 		}
 
-		var rect = container.getBoundingClientRect();
+		if (container.getBoundingClientRect) {
+			var rect = container.getBoundingClientRect();
+		} else {
+			/* clumsy fallback for Opera 9 */
+			var rect = {}, top = 0, left = 0, elem = container;
+
+			while (elem) {
+				top = top + parseInt(elem.offsetTop);
+				left = left + parseInt(elem.offsetLeft);
+				elem = elem.offsetParent;
+			}
+			rect["top"] = top;
+			rect["left"] = left;
+		}
 
 		return new L.Point(
 			e.clientX - rect.left - container.clientLeft,
@@ -7638,8 +7651,20 @@ L.Map.BoxZoom = L.Handler.extend({
 
 		var map = this._map,
 		    layerPoint = map.mouseEventToLayerPoint(e);
-
-		if (this._startLayerPoint.equals(layerPoint)) { return; }
+
+		if (this._startLayerPoint.equals(layerPoint)) {
+			e._map = map;
+			e._lp = layerPoint;
+			e._fn = function () {
+				this._map.fire('contextmenu', {
+					latlng: this._map.mouseEventToLatLng(e),
+					layerPoint: this._lp,
+					originalEvent: this
+				    });
+			    }.bind(e);
+			window.setTimeout(e._fn, 1);
+			return;
+		}
 
 		var bounds = new L.LatLngBounds(
 		        map.layerPointToLatLng(this._startLayerPoint),
diff --git a/mirkarte.js b/mirkarte.js
index 27d95bb..45a2788 100644
--- a/mirkarte.js
+++ b/mirkarte.js
@@ -48,7 +48,7 @@ function zeropad(n, len) {
 	return (n);
 }
 
-function llformat(lat, lon) {
+function llformat(lat, lon, ashtml) {
 	var ns, we, sns, swe, t;
 
 	ns = lat;
@@ -70,6 +70,15 @@ function llformat(lat, lon) {
 	we = (we - t) * 60;
 	swe = swe + zeropad(t, 3) + "° " + zeropad(we.toFixed(3), 6);
 
+	if (ashtml) {
+		var snw = '<span class="nowrap">';
+
+		if (ashtml == 2)
+			return (snw + sns + " " + swe + "</span>");
+		sns = snw + sns + "</span>";
+		swe = snw + swe + "</span>";
+	}
+
 	return ([sns, swe]);
 }
 
@@ -78,8 +87,8 @@ function marker_popup(marker, text) {
 	marker.on("popupopen", function () {
 		var xtext, f, pos = marker.getLatLng();
 
-		f = llformat(pos.lat, pos.lng);
-		xtext = text.replace("°N", f[0], "g").replace("°E", f[1], "g");
+		f = llformat(pos.lat, pos.lng, 1);
+		xtext = text.replace(/°N/g, f[0]).replace(/°E/g, f[1]);
 		marker.setPopupContent(xtext);
 	    });
 }
@@ -143,9 +152,9 @@ var show_menu_marker = (function () {
 					return;
 				var s, f, x, pos = feature["_isWP"];
 
-				f = llformat(pos.lat, pos.lng);
+				f = llformat(pos.lat, pos.lng, 2);
 				x = feature.properties["name"];
-				s = (x ? (x + " ") : "") + f[0] + " " + f[1];
+				s = (x ? (x + " ") : "") + f;
 
 				x = feature.properties["desc"];
 				if (/TC/.test(feature.properties["name"]) &&
@@ -238,10 +247,11 @@ var show_menu_marker = (function () {
 	};
 
 	var res = function () {
-		var s, pos = map.getCenter(), f = llformat(pos.lat, pos.lng);
+		var s, pos = map.getCenter();
+		var f = llformat(pos.lat, pos.lng, 0);
 
-		s = "Current centre: " + f[0] + " " + f[1] + "<hr />" +
-		    filestr;
+		s = '<span class="nowrap">Current centre: ' + f[0] + " " +
+		    f[1] + "</span><hr />" + filestr;
 		L.popup().setLatLng(pos).setContent(s).openOn(map);
 		if (hasfile) {
 			document.getElementById("files").addEventListener("change",
@@ -254,24 +264,27 @@ var show_menu_marker = (function () {
 	return (res);
     })();
 
-if (typeof(window.onhashchange) !== "undefined" &&
-    (document.documentMode === undefined || document.documentMode > 7)) {
-	(function () {
-		var prevhash = "" + location.href.split("#")[1];
-		this.checkHash = function () {
-			var newhash = "" + location.href.split("#")[1];
-			if (prevhash !== newhash) {
-				prevhash = newhash;
-				/*
-				 * Event.fire(document, "hashchange");
-				 * doesn’t work here
-				 */
-				fn_hashchange(this);
-			}
-		    }.bind(this);
+/* $(document).observe("hashchange", fn_hashchange); does not work */
+(function () {
+	var prevhash = "" + location.href.split("#")[1];
+	this.checkHash = function () {
+		var newhash = "" + location.href.split("#")[1];
+		if (prevhash !== newhash) {
+			prevhash = newhash;
+			/*
+			 * Event.fire(document, "hashchange");
+			 * doesn’t work here
+			 */
+			fn_hashchange("callout");
+		}
+	    }.bind(this);
+	if (typeof(window.onhashchange) !== "undefined" &&
+	    (document.documentMode === undefined || document.documentMode > 7))
 		window.onhashchange = this.checkHash;
-	    })();
-}
+	else
+		window.setInterval(this.checkHash, 100);
+    })();
+
 var marker_icon = L.icon({
 	"iconUrl": "img/marker-icon.png",
 	"iconRetinaUrl": "img/marker-icon-2x.png",
@@ -293,7 +306,7 @@ var tc_icon = L.icon({
 	"shadowSize": [37, 34]
 });
 var fn_mousemove = function (e) {
-	var f = llformat(e.latlng.lat, e.latlng.lng);
+	var f = llformat(e.latlng.lat, e.latlng.lng, 1);
 
 	$("map_coors_ns").update(f[0]);
 	$("map_coors_we").update(f[1]);
@@ -302,7 +315,7 @@ var ign_hashchange = false;
 var update_hash = function () {
 	ign_hashchange = true;
 	window.location.hash =
-	    $H(params).toQueryString().replace("%2C", ",", "gi");
+	    $H(params).toQueryString().replace(/%2C/gi, ",");
 };
 var fn_hashchange = function (event) {
 	var newhash = "" + location.href.split("#")[1];
@@ -328,114 +341,116 @@ var fn_hashchange = function (event) {
 		return;
 	}
 	if (map_initialised) {
-		var clat = NaN, clon = NaN;
-		if (isTwoNum.test(params["ll"])) {
-			clat = parseFloat(params["ll"].split(",")[0]);
-			clon = parseFloat(params["ll"].split(",")[1]);
-			if (isNaN(clat) || isNaN(clon) ||
-			    clat < -85 || clat > 85 ||
-			    clon < -180 || clon > 180) {
-				clat = NaN;
-				clon = NaN;
-			}
-		}
-		if ((isNaN(clat) || isNaN(clon)) &&
-		    isNum.test(params["center_lat"]) &&
-		    isNum.test(params["center_lon"])) {
-			clat = parseFloat(params["center_lat"]);
-			clon = parseFloat(params["center_lon"]);
-		}
-		/* defer until we know marker pos */
-
-		var czoom;
-		if (/^\d+$/.test(params["zoom"]) &&
-		    !isNaN((czoom = parseFloat(params["zoom"]))) &&
-		    czoom >= 0 && czoom < 32) {
-			/* convert to int */
-			czoom = czoom | 0;
-		} else {
-			/* default value */
-			czoom = 12;
-		}
-		params["zoom"] = czoom;
-
-		var wantMarker = false, mlat, mlon;
-		if (isTwoNum.test(params["m"])) {
-			wantMarker = true;
-			mlat = parseFloat(params["m"].split(",")[0]);
-			mlon = parseFloat(params["m"].split(",")[1]);
-			if (isNaN(mlat) || isNaN(mlon) ||
-			    mlat < -85 || mlat > 85 ||
-			    mlon < -180 || mlon > 180)
-				wantMarker = false;
-		}
-		if (!wantMarker &&
-		    isNum.test(params["mlat"]) &&
-		    isNum.test(params["mlon"])) {
-			wantMarker = true;
-			mlat = parseFloat(params["mlat"]);
-			mlon = parseFloat(params["mlon"]);
-			if (isNaN(mlat) || isNaN(mlon) ||
-			    mlat < -85 || mlat > 85 ||
-			    mlon < -180 || mlon > 180)
-				wantMarker = false;
-		}
-		if (!wantMarker && /1/.test(params["m"])) {
-			wantMarker = true;
-			mlat = clat;
-			mlon = clon;
-			if (isNaN(mlat) || isNaN(mlon) ||
-			    mlat < -85 || mlat > 85 ||
-			    mlon < -180 || mlon > 180)
-				wantMarker = false;
-		}
-		delete params["mlat"];
-		delete params["mlon"];
-		if (!wantMarker) {
-			delete params["m"];
-			if (marker !== false) {
-				map.removeLayer(marker);
-				marker = false;
-			}
-		} else {
-			params["m"] = mlat + "," + mlon;
-			if (marker === false) {
-				marker = L.marker([mlat, mlon], {
-					"icon": marker_icon,
-					"draggable": true
-				    }).addTo(map).on("dragend", function(e) {
-					var newloc = marker.getLatLng();
-
-					params["m"] = newloc.lat + "," + newloc.lng;
-					update_hash();
-				    });
-				marker_popup(marker,
-				    'Marker | <a href="javascript:nuke_marker();">Hide</a><br />°N<br />°E');
-			} else
-				marker.setLatLng([mlat, mlon]);
-		}
-
+		fn_hashchanged();
+	}
+};
+var fn_hashchanged = function () {
+	var clat = NaN, clon = NaN;
+	if (isTwoNum.test(params["ll"])) {
+		clat = parseFloat(params["ll"].split(",")[0]);
+		clon = parseFloat(params["ll"].split(",")[1]);
 		if (isNaN(clat) || isNaN(clon) ||
 		    clat < -85 || clat > 85 ||
 		    clon < -180 || clon > 180) {
-			/* default value */
-			clat = 50.7;
-			clon = 7.11;
-			/* jump to marker position */
-			if (wantMarker) {
-				clat = mlat;
-				clon = mlon;
-			}
+			clat = NaN;
+			clon = NaN;
 		}
-		delete params["center_lat"];
-		delete params["center_lon"]
-		params["ll"] = clat + "," + clon;
+	}
+	if ((isNaN(clat) || isNaN(clon)) &&
+	    isNum.test(params["center_lat"]) &&
+	    isNum.test(params["center_lon"])) {
+		clat = parseFloat(params["center_lat"]);
+		clon = parseFloat(params["center_lon"]);
+	}
+	/* defer until we know marker pos */
+
+	var czoom;
+	if (/^\d+$/.test(params["zoom"]) &&
+	    !isNaN((czoom = parseFloat(params["zoom"]))) &&
+	    czoom >= 0 && czoom < 32) {
+		/* convert to int */
+		czoom = czoom | 0;
+	} else {
+		/* default value */
+		czoom = 12;
+	}
+	params["zoom"] = czoom;
+
+	var wantMarker = false, mlat, mlon;
+	if (isTwoNum.test(params["m"])) {
+		wantMarker = true;
+		mlat = parseFloat(params["m"].split(",")[0]);
+		mlon = parseFloat(params["m"].split(",")[1]);
+		if (isNaN(mlat) || isNaN(mlon) ||
+		    mlat < -85 || mlat > 85 ||
+		    mlon < -180 || mlon > 180)
+			wantMarker = false;
+	}
+	if (!wantMarker &&
+	    isNum.test(params["mlat"]) &&
+	    isNum.test(params["mlon"])) {
+		wantMarker = true;
+		mlat = parseFloat(params["mlat"]);
+		mlon = parseFloat(params["mlon"]);
+		if (isNaN(mlat) || isNaN(mlon) ||
+		    mlat < -85 || mlat > 85 ||
+		    mlon < -180 || mlon > 180)
+			wantMarker = false;
+	}
+	if (!wantMarker && /1/.test(params["m"])) {
+		wantMarker = true;
+		mlat = clat;
+		mlon = clon;
+		if (isNaN(mlat) || isNaN(mlon) ||
+		    mlat < -85 || mlat > 85 ||
+		    mlon < -180 || mlon > 180)
+			wantMarker = false;
+	}
+	delete params["mlat"];
+	delete params["mlon"];
+	if (!wantMarker) {
+		delete params["m"];
+		if (marker !== false) {
+			map.removeLayer(marker);
+			marker = false;
+		}
+	} else {
+		params["m"] = mlat + "," + mlon;
+		if (marker === false) {
+			marker = L.marker([mlat, mlon], {
+				"icon": marker_icon,
+				"draggable": true
+			    }).addTo(map).on("dragend", function(e) {
+				var newloc = marker.getLatLng();
+
+				params["m"] = newloc.lat + "," + newloc.lng;
+				update_hash();
+			    });
+			marker_popup(marker,
+			    'Marker | <a href="javascript:nuke_marker();">Hide</a><br />°N<br />°E');
+		} else
+			marker.setLatLng([mlat, mlon]);
+	}
 
-		map.setView([clat, clon], czoom);
-		update_hash();
+	if (isNaN(clat) || isNaN(clon) ||
+	    clat < -85 || clat > 85 ||
+	    clon < -180 || clon > 180) {
+		/* default value */
+		clat = 50.7;
+		clon = 7.11;
+		/* jump to marker position */
+		if (wantMarker) {
+			clat = mlat;
+			clon = mlon;
+		}
 	}
+	delete params["center_lat"];
+	delete params["center_lon"]
+	params["ll"] = clat + "," + clon;
+
+	map.setView([clat, clon], czoom);
+	update_hash();
 };
-$(document).observe("hashchange", fn_hashchange);
 $(document).observe("dom:loaded", function () {
 	map_initialised = false;
 	fn_hashchange(false);
@@ -687,14 +702,18 @@ too much */
 		update_hash();
 	    });
 	map.on("contextmenu", function (e) {
-		var f = llformat(e.latlng.lat, e.latlng.lng);
-
-		if (marker === false)
-			window.location.hash = window.location.hash +
-			    "&m=" + e.latlng.lat + "," + e.latlng.lng;
-		L.popup().setLatLng(e.latlng).setContent("d: " +
-		    e.latlng.lat + "," + e.latlng.lng + "<br />dm: " +
-		    f[0] + " " + f[1]).openOn(map);
+		var l = e.latlng, llat = l.lat, llon = l.lng;
+		var f = llformat(llat, llon, 0);
+		var s = '<span class="nowrap">d: ' + llat + "," + llon +
+		    '</span><br /><span class="nowrap">dm: ' + f[0] +
+		    " " + f[1] + "</span>";
+
+		L.popup().setLatLng(l).setContent(s).openOn(map);
+		if (marker === false) {
+			params["mlat"] = llat;
+			params["mlon"] = llon;
+			fn_hashchanged();
+		}
 	    });
 	map.on("mousemove", fn_mousemove);
 	map.on("dragstart", function () { map.off("mousemove", fn_mousemove); });
diff --git a/zip.js/WebContent/zip.js b/zip.js/WebContent/zip.js
index 655b0b9..c4a3c14 100644
--- a/zip.js/WebContent/zip.js
+++ b/zip.js/WebContent/zip.js
@@ -45,8 +45,8 @@
 	
 	var MESSAGE_EVENT = "message";
 
-	var appendABViewSupported;
-	try {
+	var appendABViewSupported = false;
+	if (window.Blob) try {
 		appendABViewSupported = new Blob([ new DataView(new ArrayBuffer(0)) ]).size === 0;
 	} catch (e) {
 	}


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


More information about the useful-scripts-commits mailing list