PageSourceSearch

https://suckleonthis.com/wp-content/plugins/dispensary-age-verific…ensary-age-verification-public.js?ver=3.0.0

js suckleonthis.com collected 2026-10-06 13:41:36 UTC 7,578 bytes, 230 lines download raw bytes

1/**
2 * AVWP Public JS
3 * 
4 * Age Verification for WordPress utilizes the following open source javascript plugin. Thanks Michael!
5 *
6 * Plugin: ageCheck.js
7 * Description: A simple plugin to verify user's age. Uses sessionStorage API to store if user is verified - only kept until browser is closed.
8 * Options can be passed for easy customization.
9 * Author: Michael Soriano
10 * Author's website: http://fearlessflyer.com
11 *
12 */
13(function ($) {
14  "use strict";
15  $.ageCheck = function (options) {
16    const settings = $.extend({
17      bgImage: '',
18      minAge: 18,
19      redirectTo: "",
20      redirectOnFail: "",
21      title: "Age Verification",
22      copy: "You must be [age] years old to enter.",
23      btnYes: "YES",
24      btnNo: "NO",
25      successTitle: "Success!",
26      successText: "You are now being redirected back to the site...",
27      successMessage: "show",
28      failTitle: "Sorry",
29      failText: "You are not old enough to view this site...",
30      failMessage: "show",
31      cookieDays: 30,
32      adminDebug: "",
33      beforeContent: "",
34      afterContent: "",
35      logoHeight: "",
36      logoWidth: "",
37    }, options);
38
39    const _this = {
40      age: "",
41      errors: [],
42      setValues() {
43        const month = $(".avwp-av .month").val();
44        const day = $(".avwp-av .day").val();
45        _this.month = month;
46        _this.day = day.replace(/^0+/, ""); // remove leading zero
47        _this.year = $(".avwp-av .year").val();
48      },
49      validate() {
50        _this.errors = [];
51        if (/^([0-9]|[12]\d|3[0-1])$/.test(_this.day) === false) {
52          _this.errors.push("Day is invalid or empty");
53        }
54        if (/^(19|20)\d{2}$/.test(_this.year) === false) {
55          _this.errors.push("Year is invalid or empty");
56        }
57        _this.clearErrors();
58        _this.displayErrors();
59        return _this.errors.length < 1;
60      },
61      clearErrors() {
62        $(".errors").html("");
63      },
64      displayErrors() {
65        let html = "<ul>";
66        for (let i = 0; i < _this.errors.length; i++) {
67          html += `<li><span>x</span>${_this.errors[i]}</li>`;
68        }
69        html += "</ul>";
70        setTimeout(() => {
71          $(".avwp-av .errors").html(html);
72        }, 200);
73      },
74      reCenter(b) {
75        b.css("top", `${Math.max(0, (($(window).height() - (b.outerHeight() + 150)) / 2))}px`);
76        b.css("left", `${Math.max(0, (($(window).width() - b.outerWidth()) / 2))}px`);
77      },
78      buildHtml() {
79        const copy = settings.copy;
80        let html = "";
81        html += "<div class=\"avwp-av-overlay\"></div>";
82        html += "<div class=\"avwp-av\">";
83        if (settings.beforeContent !== "") {
84          html += settings.beforeContent;
85        }
86        if (settings.imgLogo !== "") {
87          html += "<img src=\"" + settings.imgLogo + "\" alt=\"" + settings.title + "\" width=\"" + settings.logoWidth + "\" height=\"" + settings.logoHeight + "\" />";
88        }
89        if (settings.title !== "") {
90          html += `<h2>${settings.title}</h2>`;
91        }
92        html += `<p>${copy.replace("[age]", `<strong>${settings.minAge}</strong>`)}`; + `</p>`;
93        html += `<p><button class="yes">${settings.btnYes}</button><button class="no">${settings.btnNo}</button></p>`;
94        if (settings.afterContent !== "") {
95          html += settings.afterContent;
96        }
97        html += "</div></div>";
98        $("body").append(html);
99
100        $(".avwp-av-overlay").animate({
101          opacity: 1,
102        }, 500, () => {
103          _this.reCenter($(".avwp-av"));
104          $(".avwp-av").css({
105            opacity: 1,
106          });
107        });
108
109        $(".avwp-av .day, .avwp-av .year").focus(function () {
110          $(this).removeAttr("placeholder");
111        });
112      },
113      setAge() {
114        _this.age = "";
115        _this.age = Math.abs(Date.now() - 1970);
116      },
117      setSessionStorage(key, val) {
118        try {
119          sessionStorage.setItem(key, val);
120          return true;
121        } catch (e) {
122          return false;
123        }
124      },
125      handleSuccess() {
126        const successMsg = `<h2>${settings.successTitle}</h2><p>${settings.successText}</p>`;
127        if (settings.messageTime != 0) {
128          $(".avwp-av").html(successMsg);
129        }
130        setTimeout(() => {
131          $(".avwp-av").animate({
132            top: "-350px",
133          }, settings.successTime, () => {
134            $(".avwp-av-overlay").animate({
135              opacity: "0",
136            }, settings.messageTime, () => {
137              if (settings.redirectTo !== "") {
138                window.location.replace(settings.redirectTo);
139              } else {
140                $(".avwp-av-overlay, .avwp-av").remove();
141              }
142            });
143          });
144        }, settings.messageTime);
145      },
146      handleUnderAge() {
147        const underAgeMsg = `<h2>${settings.failTitle}</h2><p>${settings.failText}</p>`;
148        $(".avwp-av").html(underAgeMsg);
149        if (settings.redirectOnFail !== "") {
150          setTimeout(() => {
151            window.location.replace(settings.redirectOnFail);
152          }, settings.messageTime);
153        }
154      },
155    }; // end _this
156
157    // Check for cookie and reture false if it's set.
158    var cookiereader = readCookie("age-verification");
159    if (cookiereader) {
160      if (settings.adminDebug !== "") {
161        eraseCookie("age-verification");
162      } else {
163        return false;
164      }
165    }
166
167    // Create pop up.
168    _this.buildHtml();
169
170    // Successful "YES" button click.
171    $(".avwp-av button.yes").on("click", () => {
172      createCookie("age-verification", "true", settings.cookieDays);
173      _this.handleSuccess();
174    });
175
176    // Successful "NO" button click.
177    $(".avwp-av button.no").on("click", () => {
178      _this.handleUnderAge();
179    });
180
181    $(window).resize(() => {
182      _this.reCenter($(".avwp-av"));
183      setTimeout(() => {
184        _this.reCenter($(".avwp-av"));
185      }, 500);
186    });
187  };
188}(jQuery));
189
190jQuery(document).ready(function($) {
191    $.ageCheck({
192        "bgImage" : object_name.bgImage,
193        "minAge" : object_name.minAge,
194        "imgLogo" : object_name.imgLogo,
195        "logoWidth" : object_name.logoWidth,
196        "logoHeight" : object_name.logoHeight,
197        "title" : object_name.title,
198        "copy" : object_name.copy,
199        "btnYes" : object_name.btnYes,
200        "btnNo" : object_name.btnNo,
201        "redirectOnFail" : object_name.redirectOnFail,
202        "successTitle" : object_name.successTitle,
203        "successText" : object_name.successText,
204        "successMessage" : object_name.successMessage,
205        "failTitle" : object_name.failTitle,
206        "failText" : object_name.failText,
207        "messageTime" : object_name.messageTime,
208        "cookieDays" : object_name.cookieDays,
209        "adminDebug" : object_name.adminDebug,
210        "beforeContent" : object_name.beforeContent,
211        "afterContent" : object_name.afterContent
212    });
213
214    if (typeof object_name !== "undefined" && object_name.bgImage) {
215        let overlay = document.querySelector(".avwp-av-overlay");
216        if (overlay) {
217            overlay.style.backgroundImage = `url(${object_name.bgImage})`;
218            overlay.style.backgroundRepeat = "no-repeat";
219            overlay.style.backgroundPosition = "center";
220            overlay.style.backgroundSize = "cover";
221            overlay.style.backgroundAttachment = "fixed";
222            overlay.style.boxSizing = "border-box";
223        }
224
225        let avwpAv = document.querySelector(".avwp-av");
226        if (avwpAv) {
227            avwpAv.style.boxShadow = "none";
228        }
229    }
230});

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.