[openstreetmap/openstreetmap-website] Use dark mode map tiles in embed (PR #5522)

Marwin Hochfelsner notifications at github.com
Wed Jan 22 18:32:41 UTC 2025


@hlfan commented on this pull request.



> @@ -15,10 +15,9 @@ window.onload = function () {
   var query = (window.location.search || '?').slice(1),
       args  = {};
 
-  var pairs = query.split('&');
-  for (var i = 0; i < pairs.length; i++) {
-    var parts = pairs[i].split('=');
-    args[parts[0]] = decodeURIComponent(parts[1] || '');
+  for (var pair of query.split('&')) {
+    var [key, val] = pair.split('=');
+    args[key] = decodeURIComponent(val || '');
   }

Like all of this PR mainly manually, with #5421 in the back of my mind and the logic not having changed since 2015 I thought I'd see what I can do.
To be fair, this is a refactor PR apart from the last two-line commit. But also the dark mode toggling caused rewriting the else-if-chain.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5522#discussion_r1925789038
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5522/review/2567987583 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250122/8e0d8935/attachment.htm>


More information about the rails-dev mailing list