@gravitystorm 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 || '');
   }

I'm curious - is this refactoring done by an automatic tool (e.g. your IDE) or 
manually? I mean I like the result, but I'm not sure if it's related to the 
rest of the PR.

> @@ -37,17 +36,17 @@ window.onload = function () {
   map.attributionControl.setPrefix('');
   map.removeControl(map.attributionControl);
 
-  if (args.layer === "cyclosm") {
-    new L.OSM.CyclOSM().addTo(map);
-  } else if (args.layer === "cyclemap" || args.layer === "cycle map") {
-    new L.OSM.CycleMap(thunderforestOptions).addTo(map);
-  } else if (args.layer === "transportmap") {
-    new L.OSM.TransportMap(thunderforestOptions).addTo(map);
-  } else if (args.layer === "hot") {
-    new L.OSM.HOT().addTo(map);
-  } else {
-    new L.OSM.Mapnik(mapnikOptions).addTo(map);
-  }
+  var isDarkTheme = args.theme === "dark" || args.theme !== "light" && 
window.matchMedia("(prefers-color-scheme: dark)").matches;

If eslint is happy, then I'd prefer to see some `()` to clarrify whether this 
is `(a || b) && c` or `a || (b && c)`, just for those of us who can't remember 
the precedence order :smile:

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

Message ID: 
<openstreetmap/openstreetmap-website/pull/5522/review/2567765...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to