PageSourceSearch

https://rittenhouserye.com/js/vendor/plugins.js?ver=2

js rittenhouserye.com collected 2026-10-05 11:34:53 UTC 21,207 bytes, 492 lines download raw bytes

1/** XENOPSI Common JS functions v.1.2.0 (June 2015) **/
2(function ($) {
3    $.expr[':'].external = function (obj) {
4        return !obj.href.match(/^mailto:/) && !obj.href.match(/^tel:/) && !obj.href.match(/^#/) && !obj.href == "" && !obj.href.match(/^javascript:/) && (obj.target.toLowerCase() == "_blank" || (obj.hostname.replace(/^www\./i, '') != document.location.hostname.replace(/^www\./i, '')));
5    };
6}(jQuery));
7var _xm = {
8    timmers: [], refresh: function (elm, forceRefresh) {
9        if ((typeof elm == "undefined")) {
10            elm = $(document);
11        }
12        if ((typeof forceRefresh == "undefined")) {
13            forceRefresh = false;
14        }
15        elm.find('a[href="#"]').each(function (i, v) {
16            if ($(this).data('xmAnchor') != true) {
17                $(this).data('xmAnchor', true).click(function (e) {
18                    e.preventDefault();
19                });
20            }
21        });
22        elm.find("input:text , input:password, textarea").each(function (i, v) {
23            if ($(this).data('xmInput') != true) {
24                $(this).data('xmInput', true).focus(function () {
25                    if ($(this).attr("data-title") && $(this).val() == $(this).attr("data-title")) {
26                        $(this).val("");
27                    }
28                }).blur(function () {
29                    if ($(this).val() == "" && $(this).attr("data-title")) {
30                        $(this).val($(this).attr("data-title"));
31                    }
32                });
33            }
34        });
35        elm.find('a:external').each(function (i, v) {
36            if ($(this).data('xmExternal') != true) {
37                $(this).data('xmExternal', true).click(function (e) {
38                    if (!$(this)[0].hasAttribute('data-track')) {
39                        if ($(this).data("title")) {
40                            _xm.pushEvent("outbound", $(this).data("title"), $(this).attr("href"));
41                        } else {
42                            _xm.pushEvent("outbound", $(this).attr("href"));
43                        }
44                    }
45                });
46            }
47        });
48        elm.find("[data-track]").each(function (i, v) {
49            if ($(this).data('xmTrack') != true) {
50                $(this).data('xmTrack', true).click(function (e) {
51                    var tc = $(this).data("track");
52                    _xm.pushString(tc);
53                    if ($(this).attr("href") == "#") e.preventDefault();
54                })
55            }
56        });
57        elm.find("[data-track-hover]").each(function (i, v) {
58            if ($(this).data('xmTrackHover') != true) {
59                $(this).data('xmTrackHover', true).mouseenter(function (e) {
60                    var tc = $(this).data("track-hover");
61                    _xm.pushString(tc);
62                })
63            }
64        });
65        elm.find('form').each(function (i, v) {
66            _xm.setupForm($(this));
67        })
68
69        elm.find("[data-init]").each(function () {
70            if ($(this).attr('data-initialized') != 1) {
71                var funName = $(this).data("init");
72                window[funName]();
73                $(this).attr('data-initialized', 1);
74            }
75        });
76    }, pushEvent: function (_cat, _act, _param, _value) {
77        if (typeof _value != 'undefined') {
78            gtag('event', _cat, {'event_category': _param,  'event_label': _act, 'value': _value});
79        } else if (typeof _param != 'undefined') {
80            gtag('event', _cat, {'event_category': _param,  'event_label': _act});
81        } else if (typeof _act != 'undefined') {          
82            gtag('event', _cat, {'event_category': _cat,  'event_label': _act});
83        } else if (typeof _cat != 'undefined') {
84            gtag('event', _act, {'event_category': 'Click',  'event_label': _act});
85        }
86    }, pushString: function (str) {
87        var arr = str.split("|");
88        if (arr.length > 3) {
89            _xm.pushEvent(arr[0], arr[1], arr[2], arr[3]);
90        } else if (arr.length > 2) {
91            _xm.pushEvent(arr[0], arr[1], arr[2]);
92        } else if (arr.length > 1) {
93            _xm.pushEvent(arr[0], arr[1]);
94        } else {
95            _xm.pushEvent(arr[0], "click");
96        }
97    }, timerStart: function (_cat) {
98        var ct = new Date().getTime();
99        _xm.timmers[_cat] = ct;
100    }, timerEnd: function (_cat, _act, _param) {
101        var ct = new Date().getTime();
102        var ts = _xm.timmers[_cat];
103        if (ts) {
104            var timeSpent = ct - ts;
105            _xm.timmers[_cat] = null;
106            if (typeof _param == 'undefined') {
107                gtag('event', _cat, {'event_category': _act,  'event_label': 'timing', 'value': timeSpent});
108            } else {
109                gtag('event', _cat, {'event_category': _param,  'event_label': _act, 'value': timeSpent});
110            }
111        }
112    }, cleanupDefaults: function ($frm) {
113        $(".asterik").removeClass("error").html($(".asterik").data("title"));
114        $frm.find("input[type='text'], textarea").each(function (index, element) {
115            if ($(this).val() == $(this).data("title")) $(this).val("");
116        });
117    }, resetForm: function ($frm) {
118        $frm[0].reset();
119        $frm.find('[data-title]').trigger('blur');
120        $frm.find('select').trigger('chosen:updated');
121    }, setupForm: function ($form) {
122        var fieldVal = '';
123        $form.find('[data-empty]').each(function (i, v) {
124
125            var $field = $(this);
126            if (!$field.attr('data-title')) {
127                $field.attr('data-title', '');
128            }
129            if ($field.attr('name'))
130                fieldVal += $field.attr('name') + "|empty|" + $field.data("title") + "|" + $field.data("empty") + "~";
131            if ($field.data('validate')) {
132                fieldVal += $field.attr('name') + "|" + $field.data('validate') + "|" + $field.data("title") + "|" + $field.data("invalid") + "~";
133            }
134        });
135        if ($form.find('input[name="xmsetup"]').length == 0) {
136            $form.prepend('<input type="hidden" name="xmsetup">');
137        }
138        $form.find('input[name="xmsetup"]').val(fieldVal);
139        var notRequiredFields = '';
140        $form.find('input[type="text"],input[type="email"],input[type="url"],input[type="time"],input[type="date"], textarea, select').not('[data-empty]').each(function (i, v) {
141            var $field = $(this);
142            if ($field.attr('name'))
143                notRequiredFields += $field.attr('name') + "|" + $field.data("title") + "~";
144        });
145        if ($form.find('input[name="xmsetupignore"]').length == 0) {
146            $form.prepend('<input type="hidden" name="xmsetupignore">');
147        }
148        $form.find('input[name="xmsetupignore"]').val(notRequiredFields);
149        $form.find('[data-title]').trigger('blur');
150        if ($form.attr('data-action')) {
151            $form.find("input[type='text']").off("keypress").on("keypress", function (e) {
152                if (e.which == 13) {
153                    e.preventDefault();
154                    _xm.submitForm($form);
155                }
156            });
157            $form.find('button[type="submit"], input[type="submit"]').off("
157click").on("click", function (e) {
158                _xm.submitForm($form);
159            });
160        }
161    }, validateForm: function ($frm) {
162        var isValid = true;
163        var errorMessage = '';
164        var $errorField;
165        _xm.removeAllErrors();
166        $frm.find('[data-empty]').each(function (i, v) {
167            var $field = $(this);
168            if (($field.is(':checkbox') && !$field.is(':checked')) || Validate.empty($field.val()) || $field.val() == $field.attr("data-title")) {
169                $field.addClass("error");
170                $errorField = $field;
171                errorMessage = $field.attr("data-empty");
172                if (DEVICE_TYPE == 'phone') alert(errorMessage);
173                else
174                    $(_xm.getErrorHTML(errorMessage)).insertBefore($errorField);
175                if ($field.is('select')) {
176                    setTimeout(function () {
177                        $field.first().trigger('chosen:open');
178                    }, 200);
179                } else {
180                    $field.focus();
181                }
182                $field.on('change', function () {
183                    $field.siblings('.xm-tooltip').remove()
184                });
185                return isValid = false;
186            }
187            if (isValid && $field.attr('data-validate')) {
188                if (!Validate[$field.attr('data-validate')]($field.val())) {
189                    $field.addClass("error");
190                    $errorField = $field;
191                    errorMessage = $field.attr("data-invalid");
192                    if (DEVICE_TYPE == 'phone') alert(errorMessage);
193                    else
194                        $(_xm.getErrorHTML(errorMessage)).insertBefore($errorField);
195                    $field.focus();
196                    $field.on('change', function () {
197                        $field.siblings('.xm-tooltip').remove()
198                    });
199                    return isValid = false;
200                }
201            }
202        });
203        if (!isValid) {
204            return {result: false, field: $errorField, error: errorMessage};
205        } else {
206            return true;
207        }
208
209    }, submitForm: function ($form) {
210        if ($form.attr('data-submitting') == true) {
211            return false;
212        }
213        var isValid = _xm.validateForm($form);
214
215
216        if (isValid != true) {
217            //_xm.removeAllErrors();
218            _xm.pushEvent($form.attr('id'), 'error', isValid.error);
219            if (DEVICE_TYPE == 'phone') {
220                //alert(isValid.error);
221            } else {
222                // $form.prepend(_xm.getErrorHTML(isValid.error));
223            }
224        } else {
225            _xm.cleanupDefaults($form);
226            $form.attr('data-submitting', true);
227            $.ajax({
228                url: $form.attr('data-action'), type: 'POST', data: $form.serialize(), cache: false, dataType: 'json',
229                success: function (data) {
230                    if (data.success == true) {
231                        _xm.resetForm($form);
232                        if($form.attr('data-thankyou') != ''){
233                            $form.prepend(_xm.getThankyouHTML($form.attr('data-thankyou')));
234                        }
235                        
236                        _xm.pushEvent($form.attr('id'), 'submit', "complete");
237                        if ($form.attr('data-submit-complete')) {
238                            var funName = $form.data("submit-complete");
239                            window[funName](data);
240                        }
241                        if ($form.attr('data-track-submit')) {
242                            _xm.pushString($form.attr('data-track-submit'));
243                        }
244                    } else {
245                        if (typeof data.errors.field != 'undefined') {
246                        	
247                        	 if (DEVICE_TYPE == 'phone')
248                        	 {
249                        		 alert(data.errors.reason);
250                                 console.log(data.errors.field);
251                        		 $('input[name="'+data.errors.field +'"]').focus()
252                        		 $.scrollTo($('input[name="'+data.errors.field +'"]').offset().top - 200, 400, {axis: "y"}); 
253                        	 }
254                        	
255                        		 var $errorfield = $form.find('[name="' + data.errors.field + '"]').first();
256                        		 if ($errorfield.length == 1) {
257                        			 $(_xm.getErrorHTML(_xm.getErrorHTML(data.errors.reason))).insertBefore($errorfield);
258                                     $errorfield.focus();
259                        			 
260                        		 } else {
261                        			 $form.prepend(_xm.getErrorHTML(data.errors.reason));
262                        		 }
263                        	
264                        } else
265                            $form.prepend(_xm.getErrorHTML(data.errors.reason));
266
267                        if ($form.attr('data-submit-error')) {
268                            var funName = $form.data("submit-error");
269                            window[funName](data);
270                        }
271                    }
272                    $form.attr('data-submitting', false);
273                },
274                error: function (jqXHR, textStatus, errorThrown) {
275                    $form.attr('data-submitting', false);
276                }
277            });
278        }
279
280    }, removeAllErrors: function () {
281        $('.xm-tooltip').remove();
282        $('.alert').remove();
283        $("form").find('.error').removeClass('error');
284        $("form").find(".valid").removeClass('valid');
285        $("form").find(".invalid").removeClass('invalid');
286    }, getErrorHTML: function (str) {
287        return '<div class="xm-tooltip">' + str + '</div>';
288        return '<div class="alert alert-danger">' + str + '</div>';
289    }, getThankyouHTML: function (str) {
290        return '<div class="alert alert-success">' + str + '</div>';
291    }
292};
293$(document).ready(function () {
294    _xm.refresh();
295    $('[data-mask]').each(function () {
296        if ($(this).data('mask') == 'email') {
297            $(this).inputmask({
298                showMaskOnHover: false,
299                mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,6}][.*{1,2}]",
300                greedy: false,
301                onBeforePaste: function (pastedValue, opts) {
302                    pastedValue = pastedValue.toLowerCase();
303                    return pastedValue.replace("mailto:", "");
304                },
305                definitions: {
306                    '*': {
307                        validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
308                        cardinality: 1,
309                        casing: "lower"
310                    }
311                }
312            });
313        } else {
314            $(this).inputmask({
315                showMaskOnHover: false,
316                mask: $(this).data('mask')
317            });
318        }
319    });
320    if (DEVICE_TYPE != 'computer') {
321        $('input[data-keyboard]').each(function () {
322            if ($(this).data('keyboard') == 'float') {
323                $(this).attr('type', 'number');
324                $(this).attr('pattern', '[0-9]*\.[0-9]*');
325                $(this).attr('inputmode', 'numeric');
326            } else if ($(this).data('keyboard') == 'number') {
327                $(this).attr('type', 'number');
328                $(this).attr('pattern', '[0-9]*');
329                $(this).attr('inputmode', 'numeric');
330            } else if ($(this).data('keyboard') == 'phone') {
331                $(this).attr('type', 'tel');
332                $(this).attr('pattern', '([0-9]3) [0-9]3-[0-9]4');
333                $(this).attr('inputmode', 'numeric');
334            } else if ($(this).data('keyboard') == 'zip') {
335                $(this).attr('type', 'tel');
336                $(this).attr('pattern', '[0-9]*');
337                $(this).attr('inputmode', 'numeric');
338            } else if ($(this).data('keyboard') == 'email') {
339                $(this).attr('type', 'email');
340            }
341        });
342    }
343
344    if ($('.xpMaterial').length) {
345        $('.xpMaterial').find(".form-control").each(function () {
346            if ($(this).val() != "") {
347                $(this).parent('.xpMaterial').addClass('notempty');
348            } else {
349                $(this).parent('.xpMaterial').removeClass('notempty');
350            }
351        });
352
353        $('.form-control').focusout(function () {
354            if ($(this).val() != "") {
355                $(this).parent('.xpMaterial').addClass('notempty');
356            } else {
357                $(this).parent('.xpMaterial').removeClass('notempty');
358            }
359        });
360        $('.form-control').focusin(function () {
361            $(this).parent('.xpMaterial').addClass('notempty');
362        });
363
364        $('.form-control').on('change keyup', function () {
365            if ($(this).val() != "") {
366                $(this).parent('.xpMaterial').addClass('notempty');
367            } else {
368                $(this).parent('.xpMaterial').removeClass('notempty');
369            }
370        });
371        $('select.chosen-select').change(function () {
372            var materialVal = $(this).chosen({disable_search_threshold: 5}).val();
373            if (materialVal != '' || materialVal.length > 0) {
374                $(this).parent('.xpMaterial').addClass('notempty');
375            } else {
376                $(this).parent('.xpMaterial').removeClass('notempty');
377            }
378        }).trigger('change');
379    }
380
381});
382
383// End XenoPsi Common JS functions
384var callAjax = function (config) {
385    var xhr;
386    var attempt = 0;
387    var maxAttempts = config.maxAttempts || 5;
388
389    function processCall() {
390        if (attempt++ < maxAttempts) {
391            xhr = $.ajax({
392                type: config.type || 'GET',
393                url: config.url,
394                data: config.data,
395                success: function (responseData, textStatus, jqXHR) {
396                    config.success(responseData);
397                },
398                error: function (jqXHR, textStatus, errorThrown) {
399                    setTimeout(processCall, config.retryAfter || 1000);
400                }
401            });
402        }
403        else {
404            if (xhr && xhr.readystate != 4) {
405                xhr.abort();
406            }
407            xhr = null;
408            config.error();
409        }
410    }
411
412    processCall();
413    return {
414        abort: function () {
415            attempt = maxAttempts; //no more attempts after abort
416            if (xhr && xhr.readystate != 4) {
417                xhr.abort();
418            }
419        }
420    }
421};
422// Avoid `console` errors in browsers that lack a console.
423!function () {
424    for (var o, e = function () {
425    }, n = ["assert", "clear", "count", "debug", "dir", "dirxml", "error", "exception", "group", "groupCollapsed", "groupEnd", "info", "log", "markTimeline", "profile", "profileEnd", "table", "time", "timeEnd", "timeStamp", "trace", "warn"], r = n.length, i = window.console = window.console || {}; r--;)o = n[r], i[o] || (i[o] = e)
426}();
427//Validate Plugin
428var Validate = {};
429Validate.isset = function (t) {
430    return !!t
431}, Validate.empty = function (t) {
432    return 0 == t.replace(/\s+/g, "").length
433}, Validate.email = function (t) {
434    return /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i.test(t)
435}, Validate.date = function (t, e) {
436    var a = Date.parse(t);
437    if (isFinite(a))return !0;
438    if (e) {
439        var n = new Date;
440        return t = t.replace(/\d{4}/, n.getFullYear()), a = Date.parse(t), isFinite(a)
441    }
442    return !1
443}, Validate.zip = function (t, e) {
444    var a = e ? /^\d{5}-\d{4}$/ : /^\d{5}
444$/;
445    return a.test(t)
446}, Validate.phone = function (t) {
447    return /^\(?([0-9]{3})\)?[-.\s]?([0-9]{3})[-.\s]?([0-9]{4})$/.test(t)
448}, Validate.creditCard = function (t) {
449    var e = /^[\d-\s]$/.test(t);
450    return e ? Validate.luhn(t) : !1
451}, Validate.luhn = function (t) {
452    for (var e = t.replace(/\d+/g, ""), a = e.split(""), n = a.length, r = n % 2, i = 0, u = 0; n > u; u++) {
453        var d = a[u];
454        u % 2 == r && (d *= 2, d > 9 && (d -= 9)), i += d
455    }
456    return i % 10 == 0
457}, Validate.integer = function (t) {
458    return /^\-?\d+$/.test(t)
459}, Validate.numeric = function (t) {
460    return /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)
461}, Validate.currency = function (t) {
462    return /^\$-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)
463}, Validate.ip = function (t) {
464    return /^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/.test(t)
465}, Validate.ssn = function (t) {
466    return /^\d{3}-\d{2}-\d{4}$/.test(t)
467}, Validate.tin = function (t) {
468    return /^\d{2}-\d{7}$/.test(t)
469}, Validate.base64 = function (t) {
470    return /[^a-zA-Z0-9\/\+=]/i.test(t)
471}, Validate.alpha = function (t) {
472    return /^[a-z]$/i.test(t)
473}, Validate.alphaNumeric = function (t) {
474    return /^[a-z0-9]$/i.test(t)
475}, Validate.lowercase = function (t) {
476    return t.toLowerCase() == t
477}, Validate.uppercase = function (t) {
478    return t.toUpperCase() == t
479}, Validate.min = function (t, e) {
480    return t.length >= e
481}, Validate.max = function (t, e) {
482    return t.length <= e
483}, Validate.between = function (t, e, a) {
484    return t.length >= e && t.length <= a
485}, Validate.username = function (t) {
486    return /^[0-9a-zA-Z]+$/.test(t) && t.length >= 3
487},Validate.age = function (t) {
488    return true;
489},Validate.serialno = function (t, e) {
490    var a = e ? /^\d{7}-\d{7}$/ : /^\d{7}$/;
491    return a.test(t)
492};

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.