1(function (Drupal, once) { 2 Drupal.behaviors.favoriteFlagEnhancements = { 3 attach(context) { 4 // Inject Star Icon 5 once("favorite-flag-icon", ".flag a", context).forEach((link) => { 6 if (!link.querySelector(".icon")) { 7 const icon = document.createElement("span"); 8 icon.classList.add("icon"); 9 icon.setAttribute("data-icon", "star"); 10 icon.style.setProperty("--icon-size", "24px"); 11 link.insertBefore(icon, link.firstChild); 12 } 13 }); 14 15 // Manage Flag Message Timing and Formatting 16 const observer = new MutationObserver(() => { 17 document 18 .querySelectorAll(".favorite-button-wrapper .js-flag-message") 19 .forEach((message) => { 20 if (message.classList.contains("custom-favorite-message")) return; 21 22 // Mark as processed 23 message.classList.add("custom-favorite-message"); 24 25 // **Reformat the content** 26 const originalText = message.textContent.trim(); 27 if (originalText.includes("Sidan har sparats!")) { 28 const newHtml = originalText.replace( 29 "Sidan har sparats!", 30 "<strong>Sidan har sparats!</strong><br>", 31 ); 32 message.innerHTML = newHtml; 33 } 34 35 // **FORCE RESET** any fading or inline opacity 36 message.style.opacity = "1"; 37 message.style.animation = "none"; 38 message.style.transition = "none"; 39 message.style.display = "block"; 40 41 // Ensure visibility for 5 seconds before removal 42 setTimeout(() => { 43 message.remove(); 44 }, 5000); 45 }); 46 }); 47 48 observer.observe(document.body, { childList: true, subtree: true }); 49 }, 50 }; 51})(Drupal, once);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.