PageSourceSearch

https://www.hotelamericabarcelona.com/js/modals.js?v=1.0.3

js hotelamericabarcelona.com collected 2026-10-03 23:21:58 UTC 3,026 bytes, 1 lines download raw bytes

1class Modals{constructor(o){this.active=null,this.modals=[],this.names=[];for(let l=0;l<o.length;l++)this.modals[o[l].name]=o[l].modal,this.names.push(o[l].name)}open(o,l){if(this.names.indexOf(o)!==-1){this.active!==o&&this.close(this.active),this.modals[o].classList.add("is-visible");let n=new Event("modal-opens",{bubbles:!0,name:o,from:l});this.modals[o].dispatchEvent(n),this.active=o}}close(o,l){if(this.names.indexOf(o)!==-1){this.modals[o].classList.remove("is-visible");let n=new Event("modal-closes",{bubbles:!0,name:o,from:l});this.modals[o].dispatchEvent(n),this.active=null}}}document.addEventListener("DOMContentLoaded",function(){document.querySelector("body").classList.remove("preload");let i=[];document.querySelectorAll(".js-modal[data-modal-name]").forEach(function(t){i.push({name:t.getAttribute("data-modal-name"),modal:t})}),window.modals=new Modals(i),document.querySelectorAll("a[data-modal-class], #block-head__button--booking[data-modal-class]").forEach(t=>{const e=t.getAttribute("data-modal-class")?.split(" ").filter(a=>a.trim());e?.length&&t.classList.add(...e)}),document.querySelectorAll("a:not([data-modal-class]), #block-head__button--booking:not([data-modal-class])").forEach(t=>{t.classList.forEach(e=>{(e==="js-modal-action"||e.startsWith("js-modal-action-"))&&t.classList.remove(e)})}),document.querySelectorAll(".js-modal-action-open").forEach(function(t){t.addEventListener("click",function(e){e.preventDefault(),e.stopImmediatePropagation(),window.modals.open(t.getAttribute("data-modal-name"))})}),document.querySelectorAll(".js-modal-action").forEach(function(t){t.addEventListener("click",function(e){e.preventDefault(),e.stopImmediatePropagation();let a=t.getAttribute("data-modal-name");window.modals.active===a?window.modals.close(a):window.modals.open(a)})}),document.querySelectorAll(".js-modal-background").forEach(function(t){t.addEventListener("click",function(e){e.preventDefault(),e.stopImmediatePropagation();let a=t.getAttribute("data-modal-name");a!==null?window.modals.close(a):window.modals.close(document.querySelector(".js-modal.is-visible").getAttribute("data-modal-name"))})}),document.querySelectorAll(".js-modal-action-close").forEach(function(t){t.addEventListener("click",function(e){e.preventDefault(),e.stopImmediatePropagation();let a=t.getAttribute("data-modal-name");a!==null?window.modals.close(a):window.modals.close(document.querySelector(".js-modal.is-visible").getAttribute("data-modal-name"))})}),document.addEventListener("keyup",t=>{t.keyCode==27&&window.modals.active!==null&&window.modals.close(window.modals.active,"keyboard")});const s=document.querySelector("#block-head__button--booking");document.querySelectorAll("#block-book__button--booking").forEach(t=>{t.addEventListener("click",function(e){if(s)if(s.hasAttribute("href")){const a=s.getAttribute("href"),d=s.getAttribute("target")||"_self";window.open(a,d)}else if(s.hasAttribute("data-modal-name")){const a=new Event("click",{bubbles:!0});s.dispatchEvent(a)}else s.click()})})});

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.