Difference between revisions of "MediaWiki:Common.js"
Difference between revisions of "MediaWiki:Common.js"
Line 2: | Line 2: | ||
window.addEventListener("DOMContentLoaded", () => { | window.addEventListener("DOMContentLoaded", () => { | ||
− | const termsModal = $('#termsModal') | + | const termsModal = $('#termsModal'); |
// Check if the "rpmTermsAgreement" cookie is present | // Check if the "rpmTermsAgreement" cookie is present | ||
Line 10: | Line 10: | ||
} | } | ||
− | // | + | // Agree button click event to set the "rpm" cookie |
$('#agreeTermsButton').click(function() { | $('#agreeTermsButton').click(function() { | ||
termsModal.modal('hide'); | termsModal.modal('hide'); |
Revision as of 17:44, 9 June 2023
// Terms Modal window.addEventListener("DOMContentLoaded", () => { const termsModal = $('#termsModal'); // Check if the "rpmTermsAgreement" cookie is present if (!document.cookie.includes('rpmTermsAgreement')) { // Show the Bootstrap modal termsModal.modal('show'); } // Agree button click event to set the "rpm" cookie $('#agreeTermsButton').click(function() { termsModal.modal('hide'); // Set the "rpmTermsAgreement" cookie with no expiration date document.cookie = "rpmTermsAgreement=true; path=/"; }); });