Difference between revisions of "MediaWiki:Common.js"

Jump to: navigation, search

Difference between revisions of "MediaWiki:Common.js"

Line 4: Line 4:
 
const termsModal = $('#termsModal')
 
const termsModal = $('#termsModal')
  
// Check if the "rpm" cookie is present
+
// Check if the "rpmTermsAgreement" cookie is present
if (!document.cookie.includes('rpm')) {
+
if (!document.cookie.includes('rpmTermsAgreement')) {
 
   // Show the Bootstrap modal
 
   // Show the Bootstrap modal
 
   termsModal.modal('show');
 
   termsModal.modal('show');
Line 14: Line 14:
 
   termsModal.modal('hide');
 
   termsModal.modal('hide');
 
   // Set the "rpm" cookie with no expiration date
 
   // Set the "rpm" cookie with no expiration date
   document.cookie = "rpm=true; path=/";
+
   document.cookie = "rpmTermsAgreement=true; path=/";
 
});
 
});
 
})
 
})

Revision as of 17:11, 9 June 2023

// Terns Modal

$(document).ready(function() {
const termsModal = $('#termsModal')

// Check if the "rpmTermsAgreement" cookie is present
if (!document.cookie.includes('rpmTermsAgreement')) {
  // Show the Bootstrap modal
  termsModal.modal('show');
}

// Example close button click event to set the "rpm" cookie
$('#agreeTermsButton').click(function() {
  termsModal.modal('hide');
  // Set the "rpm" cookie with no expiration date
  document.cookie = "rpmTermsAgreement=true; path=/";
});
})