PageSourceSearch

https://catcheckup.com/wp-content/plugins/shortcode-runner/js/runner-email.js

js catcheckup.com collected 2026-10-06 17:40:49 UTC 2,529 bytes, 86 lines download raw bytes

1"use strict";
2
3var emailCookieName = "emailAlreadySubmitted";
4
5// source: https://www.w3schools.com/js/js_cookies.asp
6function runr_setCookie(cname, cvalue, exdays) {
7  var d = new Date();
8  d.setTime(d.getTime() + (exdays*24*60*60*1000));
9
10  var expires = "expires="+ d.toUTCString();
11  var cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
12  document.cookie = cookie;
13  return cookie;
14}
15
16// source: https://www.w3schools.com/js/js_cookies.asp
17function runr_getCookie(cname) {
18  var name = cname + "=";
19  var decodedCookie = decodeURIComponent(document.cookie);
20  var ca = decodedCookie.split(';');
21  for (var i = 0; i <ca.length; i++) {
22    var c = ca[i];
23    while (c.charAt(0) == ' ') {
24      c = c.substring(1);
25    }
26    if (c.indexOf(name) == 0) {
27      return c.substring(name.length, c.length);
28    }
29  }
30  return "";
31}
32
33function runr_wasEmailAlreadySubmitted() {
34  return runr_getCookie(emailCookieName) === "true" ? true : false;
35}
36
37function runr_setEmailSubmitted() {
38  runr_setCookie(emailCookieName, "true", 180);
39}
40
41function runr_toggleVisible(displaySuccessMessage) {
42  const els1 = document.querySelectorAll(".runr-email-inner");
43  for (let ctr = 0; ctr < els1.length; ctr++) {
44    els1[ctr].classList.toggle("hidden");
45  }
46
47  // if returningUser is true, don't display success messages
48  if (displaySuccessMessage == true) {
49    const els2 = document.querySelectorAll(".runr-email-success-message");
50    for (let ctr = 0; ctr < els2.length; ctr++) {
51      els2[ctr].classList.toggle("hidden");
52    }
53  }
54}
55
56function runr_emailHandler(endpoint, email) {
57  var xmlHttp = new XMLHttpRequest();
58  // get-req, url, async?
59  xmlHttp.open("get", "/" + endpoint + "?email=" + encodeURIComponent(email), true);
60  // since we're using get, body will be empty/null
61  xmlHttp.send(null);
62
63  const inputEls = document.querySelectorAll(".runr-email-input");
64  for (let ctr = 0; ctr < inputEls.length; ctr++) {
65    inputEls[ctr].value = "";
66  }
67
68  // displaySuccessMessage = true
69  runr_toggleVisible(true);
70
71  runr_setEmailSubmitted();
72
73  // if user is here, the user has javascript functionality;
74  // the plugin always returns false to prevent default form behavior
75  return false;
76}
77
78// wait for page to load before executing the following block
79window.addEventListener('load', function() {
80  // entry point:
81  if (runr_wasEmailAlreadySubmitted() == true) {
82    // default is visible; this inverts the default to make form(s) invisible;
83    // displaySuccessMessage = false
84    runr_toggleVisible(false);
85  }
86});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.