Difference between revisions of "MediaWiki:Common.js"

Jump to: navigation, search

Difference between revisions of "MediaWiki:Common.js"

Line 1: Line 1:
 
// Terns Modal
 
// Terns Modal
const ternsModal = new bootstrap.Modal('#termsModal', {
+
const ternsModal = $('#termsModal')
  keyboard: false
 
})
 
  
 
// Check if the "rpm" cookie is present
 
// Check if the "rpm" cookie is present
 
if (!document.cookie.includes('rpm')) {
 
if (!document.cookie.includes('rpm')) {
 
   // Show the Bootstrap modal
 
   // Show the Bootstrap modal
   ternsModal.show();
+
   ternsModal.modal('show');
 
}
 
}
  
 
// Example close button click event to set the "rpm" cookie
 
// Example close button click event to set the "rpm" cookie
 
$('#agreeTermsButton').click(function() {
 
$('#agreeTermsButton').click(function() {
   ternsModal.hide();
+
   ternsModal.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 = "rpm=true; path=/";
 
});
 
});

Revision as of 16:53, 9 June 2023

// Terns Modal
const ternsModal = $('#termsModal')

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

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