More actions
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
function LG_create_popup(link) { | function LG_create_popup(link) { | ||
var popup = document.createElement("dialog"); | var popup = document.createElement("dialog"); | ||
popup.innerHTML = "<h2>WARNING</h2><br/><p class='lg_warn_left'>You are about to visit an external link: <br/><strong>"+ link +"</strong><p class='lg_warn'>Content on external sites may vary from what is on our wiki. Would you like to continue?</p><button class='lg_btn' onclick='LG_leave_site(\""+link+"\")'>Yes</button><button class='lg_btn' onclick='LG_stay_site(event)'>No</button>" | popup.innerHTML = "<h2 style='color:white;'>WARNING</h2><br/><p class='lg_warn_left'>You are about to visit an external link: <br/><strong>"+ link +"</strong><p class='lg_warn'>Content on external sites may vary from what is on our wiki. Would you like to continue?</p><button class='lg_btn' onclick='LG_leave_site(\""+link+"\")'>Yes</button><button class='lg_btn' onclick='LG_stay_site(event)'>No</button>" | ||
$("body","html").append(popup); | $("body","html").append(popup); | ||
popup.classList.add("lg_popup"); | popup.classList.add("lg_popup"); |
Revision as of 12:23, 27 October 2024
/* Added by Gabubu and big thanks to Lighty for making it!*/ //Init $(function(){ var allLinks = $("a").filter(function(){ return this.hostname && this.hostname !== location.hostname; //Filter if internal link }).click(function(e) { e.preventDefault(); LG_create_popup(this.href); }); }); function LG_create_popup(link) { var popup = document.createElement("dialog"); popup.innerHTML = "<h2 style='color:white;'>WARNING</h2><br/><p class='lg_warn_left'>You are about to visit an external link: <br/><strong>"+ link +"</strong><p class='lg_warn'>Content on external sites may vary from what is on our wiki. Would you like to continue?</p><button class='lg_btn' onclick='LG_leave_site(\""+link+"\")'>Yes</button><button class='lg_btn' onclick='LG_stay_site(event)'>No</button>" $("body","html").append(popup); popup.classList.add("lg_popup"); popup.showModal(); } function LG_leave_site(link){ location.href = link; } function LG_stay_site(e){ var popup = e.target.parentElement; popup.style.animation = 'lg_hide_popup 0.3s ease-in forwards'; popup.addEventListener('animationend', function() { popup.remove(); }) }