]> git.openstreetmap.org Git - rails.git/commitdiff
Propagate iD title to parent
authorMarwin Hochfelsner <50826859+hlfan@users.noreply.github.com>
Sun, 30 Mar 2025 06:09:37 +0000 (08:09 +0200)
committerMarwin Hochfelsner <50826859+hlfan@users.noreply.github.com>
Mon, 31 Mar 2025 06:32:11 +0000 (08:32 +0200)
app/assets/javascripts/id.js
app/views/site/id.html.erb

index d60d4b82d0d0b709335d77aed1d32e7cca19ea10..b5c8a41539559122fdb3454bb1b3d34822c6e363 100644 (file)
@@ -76,5 +76,10 @@ document.addEventListener("DOMContentLoaded", function () {
       const data = parent.OSM.mapParams();
       goToLocation(data);
     });
+
+    const projectTitle = parent.document.title;
+    new MutationObserver(() =>
+      parent.document.title = [document.title, projectTitle].filter(t => t).join(" | ")
+    ).observe(document.querySelector("title"), { childList: true, subtree: true, characterData: true });
   }
 });
index 64cb4fd58e84be24042079846fb0364899454b72..52f2de937cff4e4d0d71f2d843d9b3ef6eaef289 100644 (file)
@@ -6,6 +6,7 @@
   <!--[if !IE || gte IE 9]><!-->
   <%= javascript_include_tag "id" %>
   <!-- <![endif]-->
+  <title></title>
 </head>
 <body>
 <% data = {}