Difference between revisions of "MediaWiki:Common.js"

Jump to: navigation, search

Difference between revisions of "MediaWiki:Common.js"

Line 3: Line 3:
 
   const termsModal = $('#termsModal');
 
   const termsModal = $('#termsModal');
  
   // Check if the "rpmTermsAgreement" cookie is present
+
   if (termsModal){
  if (!document.cookie.includes('rpmTermsAgreement')) {
+
    // Check if the "rpmTermsAgreement" cookie is present
    // Show the Bootstrap modal
+
    if (!document.cookie.includes('rpmTermsAgreement')) {
    termsModal.modal('show');
+
      // Show the Bootstrap modal
  }
+
      termsModal.modal('show');
 +
    }
  
  // Agree button click event to set the "rpm" cookie
+
    // Agree button click event to set the "rpm" cookie
  $('#agreeTermsButton').click(function() {
+
    $('#agreeTermsButton').click(function() {
    termsModal.modal('hide');
+
      termsModal.modal('hide');
    // Set the "rpmTermsAgreement" cookie with no expiration date
+
      // Set the "rpmTermsAgreement" cookie with no expiration date
    document.cookie = "rpmTermsAgreement=true; path=/";
+
      document.cookie = "rpmTermsAgreement=true; path=/";
 +
    });
 
   });
 
   });
  

Revision as of 19:19, 19 June 2023

// Terms Modal
$(document).ready(function() {
  const termsModal = $('#termsModal');

  if (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=/";
    });
  });

  /* MailChimp Form */

  var mailchimpFormHTML =
    '<div id="mc_embed_signup">' +
    '    <form action="https://rcabc.us21.list-manage.com/subscribe/post?u=aa570610c198792349997a983&amp;id=91bc758592&amp;f_id=000857e1f0" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_self">' +
    '        <div id="mc_embed_signup_scroll">' +
    '            <div class="mc-field-group form-group">' +
    '                <label for="mce-EMAIL">Email Address</label>' +
    '                <input type="email" value="" name="EMAIL" class="required email form-control" id="mce-EMAIL" required>' +
    '                <span id="mce-EMAIL-HELPERTEXT" class="helper_text"></span>' +
    '            </div>' +
    '            <div id="mce-responses" class="clear foot">' +
    '                <div class="response" id="mce-error-response" style="display:none"></div>' +
    '                <div class="response" id="mce-success-response" style="display:none"></div>' +
    '            </div>' +
    '            <div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_aa570610c198792349997a983_91bc758592" tabindex="-1" value=""></div>' +
    '            <input type="submit" value="Subscribe To RPM Updates" name="subscribe" id="mc-embedded-subscribe" class="btn btn-primary">' +
    '        </div>' +
    '    </form>' +
    '</div>';

  $('#mailchimpForm').html(mailchimpFormHTML);
});