window.addEventListener("DOMContentLoaded", async function() { setupPopup() const style = document.createElement('style') style.innerHTML = ` #blackhole{background:rgba(0, 0, 0, .5); position:fixed; top:0; left:0; width:100%; height:100%; cursor : pointer; z-index:99} #popup{background:#fff; position:fixed; width:400px; left:50%; top:50%; transform:translate(-50%, -50%); border-radius: 20px; padding: 10px 20px; z-index:999} #popup h2{text-align:center; margin-top:10px} #popup #popupReponse{text-align:center;} #popup #popupReponse #accepter{display:block; margin-bottom:20px; } #popup #popupReponse #refuser{display:block; cursor : pointer} ` const head = document.querySelector('head') head.appendChild(style) }); function setupPopup() { if(!document.querySelector('._accueil')) return; const blackhole = document.createElement('div') blackhole.id = 'blackhole' document.body.appendChild(blackhole) const popup = document.createElement('div') popup.id = 'popup' document.body.appendChild(popup) const titre = document.createElement('h2') titre.innerText = 'Ce site est à louer' popup.appendChild(titre) const txt = document.createElement('p') txt.innerText = 'Si vous êtes Maçon à la recherche de clients, contactez nous maintenant' popup.appendChild(txt) const reponse = document.createElement('div') reponse.innerHTML = '

Contacter Non merci

' popup.appendChild(reponse) const btnFermer = popup.querySelector('#popupReponse span') btnFermer.addEventListener('click', fermerPopup) blackhole.addEventListener('click', fermerPopup) } function fermerPopup() { const popup = document.querySelector('#popup') popup.remove() const blackhole = document.querySelector('#blackhole') blackhole.remove() }