PageSourceSearch

https://theaccrueagency.com/_static/??wp-content/plugins/metform/b…/libs/cute-alert/cute-alert.js?m=1788142286

js theaccrueagency.com collected 2026-10-09 01:37:08 UTC 6,483 bytes, 217 lines download raw bytes

1!function(){"use strict";function e(e){if(e)if(e.closest('[mf-condition-hidden="true"]')){var t=e.value;e.value="",e.dispatchEvent(new Event("input",{bubbles:!0})),e.value=t}else""!==e.value&&e.dispatchEvent(new Event("input",{bubbles:!0}))}function t(t){if(t&&!t.__mfDefaultNumberSyncInit){var n=function(){t.querySelectorAll('input[type="number"][data-mf-default-number-sync="true"]').forEach(e)};n();var u=function(){setTimeout(n,100)};t.addEventListener("change",u),t.__mfDefaultNumberSyncHandler=u,t.__mfDefaultNumberSyncInit=!0}}function n(){document.querySelectorAll(".mf-form-wrapper").forEach(t)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",function(){setTimeout(n,200)}):setTimeout(n,200),window.addEventListener("load",function(){setTimeout(n,200)})}();;
2// Alert box design by Igor Ferrão de Souza: https://www.linkedin.com/in/igor-ferr%C3%A3o-de-souza-4122407b/
3
4const cuteAlert = ({
5  url,
6  type,
7  title,
8  message,
9  img,
10  buttonText = 'OK',
11  confirmText = 'OK',
12  vibrate = [],
13  playSound = null,
14  cancelText = 'Cancel',
15  closeStyle,
16}) => {
17  return new Promise(resolve => {
18    const existingAlert = document.querySelector('.alert-wrapper');
19
20    if (existingAlert) {
21      existingAlert.remove();
22    }
23
24    const body = document.querySelector('body');
25
26    const scripts = document.getElementsByTagName('script');
27
28    let src = '';
29
30    for (let script of scripts) {
31      if (script.src.includes('cute-alert.js')) {
32        src = script.src.substring(0, script.src.lastIndexOf('/'));
33      }
34    }
35
36    let btnTemplate = `
37    <button class="alert-button ${type}-bg ${type}-btn">${buttonText}</button>
38    `;
39
40    if (type === 'question') {
41      btnTemplate = `
42      <div class="question-buttons">
43        <button class="confirm-button ${type}-bg ${type}-btn">${confirmText}</button>
44        <button class="cancel-button error-bg error-btn">${cancelText}</button>
45      </div>
46      `;
47    }
48
49    if (vibrate.length > 0) {
50      navigator.vibrate(vibrate);
51    }
52
53    if (playSound !== null) {
54      let sound = new Audio(playSound);
55      sound.play();
56    }
57
58    const template = `
59    <div class="alert-wrapper">
60      <div class="alert-frame">
61        ${
62          img === undefined
63            ? '<div class="alert-header ' + type + '-bg">'
64            : '<div class="alert-header-base">'
65        }
66          <span class="alert-close ${
67            closeStyle === 'circle'
68              ? 'alert-close-circle'
69              : 'alert-close-default'
70          }">X</span>
71          ${
72            img === undefined
73              ? '<img class="alert-img" src="' +
74                src +
75                "/img/" +
76                type +
77                ".svg" +
78                '" />'
79              : '<div class="custom-img-wrapper">' + img + "</div>"
80          }
81        </div>
82        <div class="alert-body">
83          <span class="alert-title">${title}</span>
84          <span class="alert-message">${message}</span>
85          ${btnTemplate}
86        </div>
87      </div>
88    </div>
89    `;
90
91    body.insertAdjacentHTML('afterend', template);
92
93    const alertWrapper = document.querySelector('.alert-wrapper');
94    const alertFrame = document.querySelector('.alert-frame');
95    const alertClose = document.querySelector('.alert-close');
96
97    if (type === 'question') {
98      const confirmButton = document.querySelector('.confirm-button');
99      const cancelButton = document.querySelector('.cancel-button');
100
101      confirmButton.addEventListener('click', () => {
102        alertWrapper.remove();
103        resolve('confirm');
104      });
105
106      cancelButton.addEventListener('click', () => {
107        alertWrapper.remove();
108        resolve();
109      });
110    } else {
111      const alertButton = document.querySelector('.alert-button');
112
113      alertButton.addEventListener('click', () => {
114        alertWrapper.remove();
115        resolve('ok');
116      });
117    }
118
119    alertClose.addEventListener('click', () => {
120      alertWrapper.remove();
121      resolve('close');
122    });
123
124/*     alertWrapper.addEventListener('click', () => {
125      alertWrapper.remove();
126      resolve();
127    }); */
128
129    alertFrame.addEventListener('click', e => {
130      e.stopPropagation();
131    });
132  });
133};
134
135const cuteToast = ({ type, title, message, timer = 5000,  vibrate = [], playSound = null }) => {
136  return new Promise(resolve => {
137    const body = document.querySelector('body');
138
139    const scripts = document.getElementsByTagName('script');
140
141    let src = '';
142
143    for (let script of scripts) {
144      if (script.src.includes('cute-alert.js')) {
145        src = script.src.substring(0, script.src.lastIndexOf('/'));
146      }
147    }
148
149    let templateContainer = document.querySelector('.toast-container');
150
151    if (!templateContainer) {
152      body.insertAdjacentHTML(
153        'afterend',
154        '<div class="toast-container"></div>',
155      );
156      templateContainer = document.querySelector('.toast-container');
157    }
158
159    const toastId = mfCaoId();
160
161    const templateContent = `
162    <div class="toast-content ${type}-bg" id="${toastId}-toast-content">
163      <div>
164        <div class="toast-frame">
165          <div class="toast-body">
166            <img class="toast-body-img" src="${src}/img/${type}.svg" />'
167            <div class="toast-body-content">
168              <span class="toast-title">${title}</span>
169              <span class="toast-message">${message}</span>
170            </div>
171            <div class="toast-close" id="${toastId}-toast-close">X</div>
172          </div>
173        </div>
174        <div class="toast-timer ${type}-timer"  style="animation: timer${timer}ms linear;>
175      </div>
176    </div>
177    `;
178
179    const toasts = document.querySelectorAll('.toast-content');
180
181    if (toasts.length) {
182      toasts[0].insertAdjacentHTML('beforebegin', templateContent);
183    } else {
184      templateContainer.innerHTML = templateContent;
185    }
186
187    const toastContent = document.getElementById(`${toastId}-toast-content`);
188
189    if (vibrate.length > 0) {
190      navigator.vibrate(vibrate);
191    }
192
193    if (playSound !== null) {
194      let sound = new Audio(playSound);
195      sound.play();
196    }
197
198    setTimeout(() => {
199      toastContent.remove();
200      resolve();
201    }, timer);
202
203    const toastClose = document.getElementById(`${toastId}-toast-close`);
204
205    toastClose.addEventListener('click', () => {
206      toastContent.remove();
207      resolve();
208    });
209  });
210};
211
212const mfCaId = () => {
213  return '_' + Math.random().toString(36).substr(2, 9);
214};
215
216
217;

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.