[openstreetmap/openstreetmap-website] Add a "tile details" view accessed from the context menu (#1472)

Ilya Zverev notifications at github.com
Tue Mar 7 09:52:49 UTC 2017


Zverik commented on this pull request.



> +  }
+
+  var page = {};
+
+  page.pushstate = page.popstate = function(path) {
+    OSM.loadSidebarContent(path, function () {
+      page.load(path, true);
+    });
+  };
+
+  page.load = function(path, noCentre) {
+    var params = querystring.parse(path.substring(path.indexOf('?') + 1)),
+        lat = parseFloat(params.lat),
+        lon = parseFloat(params.lon),
+        zoom = parseInt(params.zoom),
+        y = lat2y(lat, zoom),

Why not `map.project(latlng, zoom).floor()`? And `unproject` for the reverse transformation. It returns an `L.Point`, which you can use later for `getTileUrl`.

> +          if (matches)
+          {
+            var state = matches[1],
+                rendered = Date.parse(matches[2]),
+                accessed = Date.parse(matches[3]);
+
+            $("#tileinfo-state").text(I18n.t("javascripts.tileinfo.state." + state));
+            $("#tileinfo-rendered").text(I18n.l("time.formats.friendly", rendered));
+            $("#tileinfo-accessed").text(I18n.l("time.formats.friendly", accessed));
+          }
+        }
+      });
+    }
+    else
+    {
+      $("#tileinfo-status").hide();

I don't see this block unhidden anywhere. Do you need to add `$("#tileinfo-status").show()` somewhere above?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1472#pullrequestreview-25469199
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20170307/6d4d021a/attachment.html>


More information about the rails-dev mailing list