PageSourceSearch

https://makemagicmoney.com/wp-content/plugins/e-signature/assets/js/esign.js?ver=2.1.6

js makemagicmoney.com collected 2026-10-10 02:14:18 UTC 13,868 bytes, 467 lines download raw bytes

1
2
3var esign = {
4    setCookie: function (cname, cvalue, exdays) {
5        var d = new Date();
6        d.setTime(d.getTime() + (exdays * 1000));
7        var expires = "expires=" + d.toUTCString();
8        document.cookie = cname + "=" + cvalue + "; " + expires;
9    },
10    getCookie: function (name) {
11        var pattern = RegExp(name + "=.[^;]*")
12        matched = document.cookie.match(pattern)
13        if (matched) {
14            var cookie = matched[0].split('=')
15            return cookie[1]
16        }
17        return false
18    },
19    unsetCookie: function (name) {
20        var d = new Date();
21        d.setTime(d.getTime() - (5000 * 24 * 60 * 60 * 1000));
22        var expires = "expires=" + d.toUTCString();
23        document.cookie = name + "=" + +"; " + expires;
24    },
25    is_slv_active: function () {
26        if (typeof esig_slv === 'undefined') {
27            return false;
28        } else {
29            return true;
30        }
31    },
32    is_valid_email: function (email) {
33        var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
34
35        if (re.test(email))
36        {
37            return true;
38        } else {
39            return false;
40        }
41    },
42    isValidNumber: function (number) {
43
44        if (isNaN(number)) {
45            return false;
46        }
47        return true;
48    },
49    isCCNumber: function (name) {
50        var ccName = name.split(" ");
51        for (i = 0; i < ccName.length; i++) {
52            if(this.isValidNumber(ccName[i])){
53                return true;
54            }
55        }
56    },
57    isEmpty: function (str) {
58
59        return (!str || /^\s*$/.test(str));
60    },
61    isFullName: function (value) {
62
63        // check for double consecutive dots.
64       // if (!/^(?!\.)(?!.*\.$)(?!.*?\.\.)/.test(value)) return false;
65        // check for double spaces.
66        if (/\s{2}/.test(value)) return false;
67        // for japanese character checking
68        const japanesRegex = /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g;
69        if (japanesRegex.test(value)) {
70            return true;
71        }
72        
73      
74
75        // Emoji validation
76        const regexExpEmoji = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/gi;
77        if (regexExpEmoji.test(value)) return false;
78        // Name validation: allow letters (incl. accented), hyphens, apostrophes, periods,
79        // commas, and spaces. Single-word names with apostrophes (e.g. O'Brien) are valid.
80        const regexp = new RegExp(/^[^_!¡?÷?¿\/\\+=@#$%ˆ&*{}|~<>;:[\]]([-'.,]?[^_!¡?÷?¿\/\\+=@#$%ˆ&*{}|~<>;:[\]]+)*( [^_!¡?÷?¿\/\\+=@#$%ˆ&*{}|~<>;:[\]]([-'.,]?[^_!¡?÷?¿\/\\+=@#$%ˆ&*{}|~<>;:[\]]+)*)*$/i);
81        return regexp.test(value);
82    },
83    isUrl: function (value) {
84        return  /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(value);
85    },
86    tbResize: function () {
87        var width = jQuery(window).width();
88       // jQuery("#TB_ajaxContent, #TB_iframeContent").css({width: 'auto'});
89
90       // jQuery("#TB_window").css({height: 500});
91    },
92    tbSize: function (height) {
93
94        //jQuery("#TB_ajaxContent, #TB_iframeContent").css({width: 'auto'});
95       // jQuery("#TB_window").css({height: height});
96
97    },
98    addSlashes: function (string) {
99        return string.replace(/\\/g, '\\\\').
100                replace(/\u0008/g, '\\b').
101                replace(/\t/g, '\\t').
102                replace(/\n/g, '\\n').
103                replace(/\f/g, '\\f').
104                replace(/\r/g, '\\r').
105                replace(/'/g, '\\\'').
106                replace(/"/g, '\\"');
107    },
108    validate_signers: function (division, signer_email_name, signer_fname_name) {
109
110        var view_email = jQuery(division + " input[name='" + signer_email_name + "\\[\\]']").map(function () {
111            return jQuery(this).val();
112        });
113
114        var view_fname = jQuery(division + " input[name='" + signer_fname_name + "\\[\\]']").map(function () {
115            return jQuery(this).val();
116        });
117
118        var sorted_email = view_email.sort();
119        // getting new array
120        var exists = false;
121        var blank = false;
122        var blank_email = false;
123
124        if (view_email.length === 0 || view_fname.length === 0) {
125            jQuery(division + ' .esig-error-box').remove();
126            jQuery(division).append('<span class="esig-error-box">*You must add at least one signer.</span>');
127            return true;
128        }
129
130        // if blank signer name is input
131        for (var i = 0; i < view_fname.length; i++) {
132
133
134
135            if (view_fname[i] == undefined || view_fname[i] == '')
136            {
137
138                blank = true;
139            }
140
141            var re = /<(.*)>/;
142            if (re.test(view_fname[i]))
143            {
144                blank = true;
145            }
146
147
148            if (!this.isFullName(view_fname[i])) {
149                    blank = true;
150            }
151           
152
153            if (blank)
154            {
155                jQuery(division + ' .esig-error-box').remove();
156                jQuery(division).append('<span class="esig-error-box">Add a valid signer name</span>');
157                return true;
158            }
159        }
160        // if blank email address is input
161        for (var i = 0; i < view_email.length; i++) {
162
163            if (view_email[i] == undefined || view_email[i] == '')
164            {
165
166                blank_email = true;
167            }
168
169
170            if (!this.is_valid_email(view_email[i]))
171            {
172                blank_email = true;
173            }
174            if (blank_email)
175            {
176                // remove previous error msg
177                jQuery(division + ' .esig-error-box').remove();
178                // add new error msg
179                jQuery(division).append('<span class="esig-error-box">Add a valid email address</span>');
180                return true;
181            }
182        }
183
184
185        for (var i = 0; i < view_email.length - 1; i++) {
186
187            if (sorted_email[i + 1].toLowerCase() == sorted_email[i].toLowerCase())
188            {
189                exists = true;
190            }
191        }
192
193        if (exists)
194        {
195
196            jQuery(division + ' .esig-error-box').remove();
197
198            jQuery(division).append('<span class="esig-error-box">*You can not use duplicate email address.</span>');
199
200            return true;
201        } else
202        {
203            jQuery(division + ' .esig-error-box').remove();
204            return false;
205        }
206
207    },
208    isValidBase64Image: function (base64Image){
209        const regex = /^data:image\/(?:png)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/;
210        return base64Image && regex.test(base64Image);
211    },
212    isIphone: function () {
213        /* Detect mobile browser */
214        if (navigator.userAgent.match(/iPad/i)
215                || navigator.userAgent.match(/iPhone/i)) {
216            return true;
217        } else {
218            return false;
219        }
220    },
221    ccValidate: function (esigSelection, esigError) {
222
223        var view_email = jQuery(esigSelection + " input[name='cc_recipient_emails\\[\\]']").map(function () {
224            return jQuery(this).val();
225        }).get();
226
227        var view_fname = jQuery(esigSelection + " input[name='cc_recipient_fnames\\[\\]']").map(function () {
228            return jQuery(this).val();
229        }).get();
230
231        var sorted_email = view_email.sort();
232
233        // getting new array
234        var exists = false;
235        var blank = false;
236        var blank_email = false;
237        // if blank signer name is input
238        for (var i = 0; i < view_fname.length; i++) {
239
240            if (view_fname[i] == undefined || view_fname[i] == '')
241            {
242
243                blank = true;
244            }
245
246            var re = /<(.*)>/ ;
247            if (re.test(view_fname[i]))
248            {
249                blank = true;
250            }
251
252            // cc first name and last name number validation goes here
253            if (this.isCCNumber(view_fname[i])) {
254                blank = true;
255            }
256
257            // var regexp = new RegExp(/^[a-z]([-']?[a-z]+)*( [a-z]([-']?[a-z]+)*)+$/i);
258            if (!this.isFullName(view_fname[i])) {
259                    blank = true;
260            }
261           
262            if (blank)
263            {
264
265                jQuery('.esig-error-box').remove();
266                jQuery(esigError).append('<span class="esig-error-box">Add a valid signer name</span>').show();
267                return true;
268            }
269        }
270        // if blank email address is input
271        for (var i = 0; i < view_email.length; i++) {
272
273            if (view_email[i] == undefined || view_email[i] == '')
274            {
275
276                blank_email = true;
277            }
278
279
280            if (!this.is_valid_email(view_email[i]))
281            {
282                blank_email = true;
283            }
284            if (blank_email)
285            {
286                // remove previous error msg
287                jQuery('.esig-error-box').remove();
288                // add new error msg
289                jQuery(esigError).append('<span class="esig-error-box">Add a valid email address</span>').show();
290                return true;
291            }
292        }
293
294
295        for (var i = 0; i < view_email.length - 1; i++) {
296
297            if (sorted_email[i + 1].toLowerCase() == sorted_email[i].toLowerCase())
298            {
299                exists = true;
300            }
301        }
302
303        if (exists)
304        {
305
306            jQuery('.esig-error-box').remove();
307
308            jQuery(esigError).append('<span class="esig-error-box"> *You can not use CC duplicate email address.</span>').show();
309
310            return true;
311        } else
312        {
313
314            jQuery('.esig-error-box').remove();
315            return false;
316        }
317    }
318
319};
320
321/**
322 * This method will be used to make a server http request with ajax call.
323 *
324 * @param {string} url
325 * @param {string} method
326 * @param {CallableFunction} callBack
327 * @param {object} postData
328 */
329function esigRemoteRequest(url, method, callBack, postData = false) {
330    // variable xmlhttp object.
331    let xmlhttp;
332
333    if (window.XMLHttpRequest) {
334        // code for modern browsers
335        xmlhttp = new XMLHttpRequest();
336
337    } else {
338        // code for old IE browsers
339        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
340    }
341
342    // concat wordpress ajax url with provided url
343    let requestUrl =  ajaxurl + "?action=" + url ;
344
345    // convert method to uppercase letter.
346    method = method.toUpperCase();
347
348    // Open xmlhttp request
349    xmlhttp.open(method, requestUrl , true);
350
351    //Make get/post form submission from array
352    if ((postData instanceof FormData === false) && method === "POST" && typeof postData === 'object' && postData !== null) {
353        // If method is post set  content type
354        xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
355
356        // Makeing url parameter with given object if that is not a FormData instance
357        postData = Object.keys(postData).map(function (key) {
358            return encodeURIComponent(key) + "=" + encodeURIComponent(postData[key]);
359        }).join('&');
360    }
361
362
363    // get server response when document is ready  after request
364    xmlhttp.onreadystatechange = function () {
365
366        if (this.readyState === 4 && this.status === 200) {
367            // Typical action to be performed when the document is ready:
368            // return the response result to callback functions.
369            callBack(xmlhttp);
370        }
371    };
372
373    // xmlhttp not ready return false
374    if (xmlhttp.readyState === 4) return false;
375
376    // send xml request to server .
377    xmlhttp.send(postData);
378
379}
380
381
382/**
383 * return a document selector  dom object .
384 * @param {string} query
385 */
386
387function esig(query)
388{
389    return document.querySelector(query);
390}
391
392function esigHasWhiteSpace(string) {
393    // check for white space
394    return /\s/g.test(string);
395}
396
397function esigValidateInputs(fieldsList,msgObj)
398{
399    var ret  = false ;
400
401    for (i = 0; i < fieldsList.length; i++)
402    {
403        if (!esig_validation.is_string(fieldsList[i].value))
404        {
405            wpEsig("#" + fieldsList[i].id).insertAfterValidationMsg(msgObj[fieldsList[i].id], true);
406            ret= true;
407        }
408    }
409
410    return ret;
411}
412
413function esigAlertBox(message)
414{
415    //Create the element using the createElement method.
416    var myDiv = document.createElement("div");
417
418    //Set its unique ID.
419    myDiv.id = 'esigAlertBox';
420
421    //Add your content to the DIV
422    myDiv.innerHTML = '<span id="esig-alert-close" class="closebtn" onclick="esigAlertClose();">&times;</span>' + message;
423
424    //Finally, append the element to the HTML body
425    document.body.appendChild(myDiv);
426
427}
428
429function esigAlertClose()
430{
431    esig("#esig-alert-close").parentElement.remove();
432}
433
434/**
435 *  @deprecated 1.8.1
436 */
437/*
438function esigCheckJapaneseCharacters(inputValue)
439{
440
441
442   var japanesRegex = /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g;
443   if(japanesRegex.test(inputValue)) {
444    return "found";
445    }
446    else {
447      return "Not found";
448    }
449
450
451}
452
453function esigCheckapostrophe(inputValue)
454{
455
456
457   var apostropheRegex = /^[A-Z][a-z’]+(\s[A-Z][a-z’]+)*$/;
458   if(apostropheRegex.test(inputValue)) {
459    return "found";
460    }
461    else {
462      return "Not found";
463    }
464
465
466} */
467

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.