1(function ($) { 2 /** 3 * Initialize the iframe listener 4 * @returns {void} 5 */ 6 function initializeIframeListener() { 7 const messageHandler = function (event) { 8 const { type, payload, registrationUrl } = event.data || {}; 9 10 if (type === "HEIJMANS_REGISTRATION_CLICK") { 11 return (window.location.href = registrationUrl); 12 } 13 14 if (type !== "FAVORITE_PLOT" || (payload && !payload.id)) return; 15 16 const favorites = JSON.parse(localStorage.getItem("favorites") || "{}"); 17 const clickedFavorite = payload; 18 19 if (favorites[clickedFavorite.id]) { 20 showNotification( 21 `Bouwnummer ${clickedFavorite.number} staat al in je favorieten lijst.`, 22 "heart", 23 "#ED0500" 24 ); 25 } else { 26 favorites[clickedFavorite.id] = clickedFavorite; 27 showNotification( 28 `Bouwnummer ${clickedFavorite.number} toegevoegd aan favorieten`, 29 "heart", 30 "#ED0500" 31 ); 32 } 33 34 localStorage.setItem("favorites", JSON.stringify(favorites)); 35 }; 36 37 window.addEventListener("message", messageHandler); 38 return () => window.removeEventListener("message", messageHandler); 39 } 40 41 /** 42 * 43 * @param message 44 * @param icon 45 */ 46 function showNotification(message, icon) { 47 const $notification = $( 48 '<div class="notification" style="cursor: pointer;"></div>' 49 ); 50 51 if (icon) { 52 $notification.append( 53 '<i class="fas fa-' + 54 icon + 55 ' notification-icon" style="color: #ED0500;"></i>' 56 ); 57 } 58 59 $notification.append( 60 '<span class="notification-message">' + message + "</span>" 61 ); 62 63 $notification.on("click", function () { 64 window.location.href = "/favorieten"; 65 }); 66 67 $("body").append($notification); 68 69 setTimeout(function () { 70 $notification.addClass("show"); 71 }, 100); 72 73 setTimeout(function () { 74 $notification.removeClass("show"); 75 setTimeout(function () { 76 $notification.remove(); 77 }, 300); 78 }, 3000); 79 } 80 81 initializeIframeListener(); 82})(jQuery);
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.