PageSourceSearch

https://members.apsanet.org/NOAH/scripts/Includes/Standard/Display.js

js apsanet.org collected 2026-09-24 08:42:01 UTC 91,686 bytes, 2,390 lines download raw bytes

1try {
2    versioning.reportVersion({
3        major: 1,
4        minor: 0,
5        revision: 4,
6        system: 3,
7        iteration: 3,
8        year: 2024,
9        name: 'Display.js',
10        requires: ['NOAH.Include.Config.js', 'NOAH.Include.js']
11    });
12} catch (ex) { console.log(ex.message); }
13
14$.fn.allowNumericOnly = function (sender, options) {
15    try {
16        $(this).each(function () {
17            try {
18                var _defaults = {
19                    allowDecimals: (($(this).attr('numericOnly') || '').toString().toLowerCase() == 'decimal'),
20                    decimalPlaces: $(this).attr('decimalPlaces') || 2
21                };
22                var settings = $.extend({}, _defaults, options);
23
24                $(this).on('keypress', function (event) {
25                    return $(this).isNumber(event, settings);
26                });
27
28                $(this).on('change', function (event) {
29                    $(this).val(parseFloat($(this).val()).toFixed(settings.decimalPlaces));
30                    if (!settings.allowDecimals) {
31                        $(this).val(parseInt($(this).val()));
32                    }
33                });
34            } catch (ex) {
35                console.log(ex.message);
36            }
37        });
38    } catch (ex) {
39        console.log(ex.message);
40    }
41};
42
43$.fn.isNumber = function (event, options) {
44    var result = false;
45    var key = window.event ? event.keyCode : event.which;
46    try {
47        var _defaults = {
48            allowDecimals: true
49        };
50        var settings = $.extend({}, _defaults, options);
51
52        if (event.keyCode === 8 || (event.keyCode === 46 && settings.allowDecimals)) {
53            result = true;
54        } else if (key >= 48 && key <= 57) {
55            result = true;
56        }
57    } catch (ex) {
58        console.log(ex.message);
59    }
60    return result;
61}
62
63$.fn.test = function (options) {
64    result = { allPassed: true };
65    try {
66        var _defaults = { type: 'required', doPassFailIndicator: true, extendedTest: function () { } };
67        var _settings = $.extend({}, _defaults, options);
68        var thisCollection = $(this).not('[clienttest="RequiredIndicatorOnly"]');
69
70        $.each(thisCollection, function () {
71            try {
72                var thisElement = $(this);
73
74                $.each(_settings.type.split(' '), function () {
75                    try {
76
77                        switch (this.toString().toLowerCase()) {
78                            case 'required'.toLowerCase():
79                                var foundValue = false;
80
81                                try { if (_settings.doPassFailIndicator) { thisElement.attr('passed', ''); } } catch (ex) { console.log(ex.message); }
82
83
84                                switch (true) {
85                                    case thisElement.is('input'):
86                                        try { foundValue = (thisElement.val().length > 0); } catch (ex) { console.log(ex.message); }
87
88                                        switch (thisElement.attr('type').toLowerCase().trim()) {
89                                            case 'radio':
90                                                try {
91                                                    console.log('RADIO Validate group with name [' + thisElement.attr('name') + ']');
92                                                    var allElementsInGroup = $('[name=' + thisElement.attr('name') + '][clienttest]');
93                                                    if (!allElementsInGroup.is(':checked')) { foundValue = allElementsInGroup.is(':checked'); }
94
95                                                } catch (ex) { console.log(ex.message); }
96                                                console.log("Do all required inputs(checkboxes/radios) contain at least 1 checked item? " + foundValue);
97                                                break;
98
99                                            case 'checkbox':
100                                                try {
101                                                    console.log('CHECKBOX Validate group with name [' + thisElement.attr('name') + ']');
102                                                    var allElementsInGroup = $('[name=' + thisElement.attr('name') + '][clienttest]');
103                                                    if (!allElementsInGroup.is(':checked')) { foundValue = allElementsInGroup.is(':checked'); }
104
105                                                } catch (ex) { console.log(ex.message); }
106                                                console.log("Do all required inputs(checkboxes/radios) contain at least 1 checked item? " + foundValue);
107                                                break;
108
109                                            case 'text', 'textbox':
110                                                try {
111                                                    if (thisElement.attr('class').toString().toLowerCase().indexOf('html5-predictive') >= 0) {
112
113                                                        try { foundValue = (thisElement.find('xmlitem').length > 0) } catch (ex) { console.log(ex.message); }
114
115                                                    }
116                                                } catch (ex) { console.log(ex.message); }
117                                                break;
118
119                                            case 'hidden':
120                                                foundValue = true;
121                                                break;
122                                        }
123
124                                        break;
125                                    case thisElement.is('textarea'):
126
127                                        try { foundValue = (thisElement.val().length > 0) } catch (ex) { console.log(ex.message); }
128                                        break;
129                                    case thisElement.is('select'):
130                                        try { foundValue = (thisElement.val().length > 0) } catch (ex) { console.log(ex.message); }
131                                        break;
132                                    default:
133                                        if (thisElement.attr('class').toString().toLowerCase().indexOf('html5-predictive') >= 0) {
134
135                                            try { foundValue = (thisElement.find('xmlitem').length > 0) } catch (ex) { console.log(ex.message); }
136
137                                        }
138
139                                        break;
140                                }
141
142                                if (!foundValue) {
143
144
145                                    var isContainer = thisElement.attr('isClientTestContainer') || false;
146                                    if (isContainer) {
147                                        var containerType = thisElement.attr('clientTestContainerType') || 'unknown';
148
149                                        switch (containerType.toString().toLowerCase()) {
150                                            case 'repository'.toLowerCase():
151                                                try { foundValue = validateRepository(thisElement); } catch (ex) { console.log(ex.message); }
152
153                                                break;
154                                            case 'dfbhtml5'.toLowerCase():
155                                                try { foundValue = validateDFBHTML5(thisElement); } catch (ex) { console.log(ex.message); }
156
157
158
159                                                break;
160                                            case 'imagegallery'.toLowerCase():
161                                                try { foundValue = validateImageGallery(thisElement); } catch (ex) { console.log(ex.message); }
162
163                                                break;
164                                        }
165                                    }
166                                }
167
168
169                                if (foundValue == true || foundValue.toString().trim().toLowerCase() == 'true') {
170                                    if (_settings.doPassFailIndicator) { thisElement.attr('passed', 'required').removeAttr('failed'); }
171                                } else {
172                                    thisElement.attr('failed', 'required');
173                                    result.allPassed = false;
174                                }
175
176
177                                if (result.allPassed == true) {
178
179
180                                    var _dateValidationPassed = true;
181
182                                    var _validateDates = function (item) {
183                                        _result = false;
184                                        try {
185                                            console.log('[VALIDATEDATES] entered');
186
187                                            if (_dateValidationPassed) {
188                                                var controlWrapper = $(item);
189                                                var label = controlWrapper.find('label.DatePicker-Display-Only');
190                                                var dateControl = controlWrapper.find('input[type=date]');
191
192                                                var labelText = label.text().toString().trim().replace(/ /g, '');
193                                                var controlVal = dateControl.text().toString().trim().replace(/ /g, '');
194                                                var controlFormatAttribute = (dateControl.attr('dateformat') || '').toString().trim().replace(/ /g, '');
195
196
197                                                _result = (labelText != '' && controlVal != '' && controlFormatAttribute != '' && labelText.length > 0 && controlVal.length > 0 && controlFormatAttribute.length > 0 &&
198                                                    labelText != controlFormatAttribute);
199                                                console.log('[DATE]', item, 'validation passed?', _result);
200                                                _dateValidationPassed = _result;
201                                            }
202                                        }
203                                        catch (ex) {
204                                            console.log(ex.message);
205                                        }
206                                        return _result;
207                                    }
208
209
210                                    var requiredDateFields = $('[id=wcbFormWrapper]').find('[required-indicator=required-indicator]').find('.DatePicker-Display-Only:visible').closest('.FormControlCol');
211                                    requiredDateFields.each(function (index, item) { _validateDates(item) });
212                                    console.log('[GARYTEST] ' + _dateValidationPassed.toString());
213                                    result.allPassed = _dateValidationPassed;
214                                }
215                                break;
216                        }
217                    } catch (ex) {
218                        console.log(ex.message);
219                    }
220
221                    try { _settings.extendedTest(_settings); } catch (ex) { console.log(ex.message); }
222                });
223
224
225            } catch (ex) {
226                console.log(ex.message);
227            }
228        });
229
230        result.allPassed = ($(thisCollection).map(function () { if ($(this).attr('failed') == 'required') { return this }; }).length < 1);
231    }
232    catch (ex) {
233        console.log(ex.message);
234    }
235    return result;
236}
237
238
239$.fn["iready"] = function (callback) {
240    try {
241        var ifr = this.filter("iframe"),
242            arg = arguments,
243            src = this,
244            clc = null,
245            lng = 50,
246            ivl = -1,
247            chk = function (ifr) {
248                try {
249                    var cnt = ifr.contents(),
250                        doc = cnt[0],
251                        src = ifr.attr("src"),
252                        url = doc.URL;
253                    switch (doc.readyState) {
254                        case "complete":
255                            if (!src || src === "about:blank") {
256
257                                ifr.data("ready", "true");
258                            } else if (!url || url === "about:blank") {
259
260                                ifr.data("ready", undefined);
261                            } else {
262
263
264                                ifr.data("ready", true);
265                            }
266
267                            break;
268                        case "interactive":
269                            ifr.data("ready", "true");
270                            break;
271                        case "loading":
272                        default:
273
274                            break;
275                    }
276                } catch (ignore) {
277
278
279                    ifr.data("ready", "true");
280                }
281
282                return ifr.data("ready") === "true";
283            };
284
285        if (ifr.length) {
286            ifr.each(function () {
287                if (!$(this).data("ready")) {
288
289                    clc = (clc) ? clc.add($(this)) : $(this);
290                }
291            });
292            if (clc) {
293                ivl = setInterval(function () {
294                    var rd = true;
295                    clc.each(function () {
296                        if (!$(this).data("ready")) {
297                            if (!chk($(this))) {
298                                rd = false;
299                            }
300                        }
301                    });
302
303                    if (rd) {
304                        clearInterval(ivl);
305                        clc = null;
306                        callback.apply(src, arg);
307                    }
308                }, lng);
309            } else {
310                clc = null;
311                callback.apply(src, arg);
312            }
313        } else {
314            clc = null;
315            callback.apply(this, arguments);
316        }
317    } catch (ex) { console.log(ex.message) }
318    return this;
319};
320var supportedBrowsers = { opera: 'opera', chrome: 'chrome', firefox: 'firefox', safari: 'safari', edge: 'edge', ie: 'ie', unknown: 'unknown' };
321
322var clientInfo = {
323    currentBrowser: getCurrentBrowser()
324}
325
326function getCurrentBrowser() {
327    var result = supportedBrowsers.unknown
328    try {
329        if ((navigator.userAgent.indexOf("Opera") || navigator.userAgent.indexOf('OPR')) != -1) {
330            result = supportedBrowsers.opera;
331        }
332        else if (navigator.userAgent.indexOf("Chrome") != -1) {
333            result = supportedBrowsers.chrome;
334        }
335        else if (navigator.userAgent.indexOf("Safari") != -1) {
336            result = supportedBrowsers.safari;
337        }
338        else if (navigator.userAgent.indexOf("Firefox") != -1) {
339            result = supportedBrowsers.firefox;
340        }
341        else if (navigator.userAgent.indexOf("Edge") != -1) {
342            result = supportedBrowsers.edge;
343        }
344        else if ((navigator.userAgent.indexOf("MSIE") != -1) || (!!document.documentMode == true)) {
345            result = supportedBrowsers.ie;
346        }
347        else {
348            result = supportedBrowsers.unknown;
349        }
350
351    } catch (ex) { console.log(ex.message); }
352    return result;
353}
354
355function wrapEvery(sourceClass, classToFind, size, wrapClass) {
356    try {
357        $('.' + sourceClass).each(function () {
358            try {
359                var elements = $(this).find('.' + classToFind);
360                for (var i = 0, l = elements.length; i < l; i += size) {
361                    elements.slice(i, i + size).wrapAll('<div class="' + wrapClass + '"></div>');
362                }
363            } catch (ex) { console.log(ex.message); }
364        });
365    } catch (ex) { console.log(ex.message); }
366};
367
368
369
370function setupFormattedStrings() {
371    try {
372        console.log('%c Running setupFormattedStrings() ...', 'color: darkgreen; padding-left: 7em;');
373
374        $('[dateformat]').each(function () {
375            var ele = $(this);
376            var value = ele.attr('value');
377            try {
378                var formatString = ele.attr('dateformat').toLowerCase().replace('mm', 'MM');
379                formatString = formatString + '#';
380                formatString = formatString.replace(/\\yy/g, /\\yyyy/).replace(/#/g, '');
381
382                console.log('value found [' + value + ']');
383                if (value.toString().trim() != '' && value.toString().trim().toLowerCase().indexOf('nan') < 0) {
384
385
386
387
388
389
390
391                    console.log(ele, value, formatString);
392
393                    var newDate = (new Date(value)).format(formatString).toString();
394                    console.log(' new date -> ' + newDate.toString());
395                    if (newDate.toLowerCase().indexOf('nan') < 0) {
396                        ele.val(newDate).change();
397                    }
398
399
400
401
402
403                }
404                else {
405
406                }
407            } catch (ex) {
408
409                console.log("Display -> Skin setupFormattedStrings() [dateformat] " + ex.message);
410            }
411        });
412    } catch (ex) {
413        console.log("Display -> Skin setupFormattedStrings() " + ex.message);
414    }
415}
416
417var lostImageReplaceTimer = null;
418function replaceLostImagesWithPlaceholder() {
419    try {
420        try { replaceLostImagesWithPlaceholder_onBefore(); } catch (ex) { console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;'); }
421
422        console.log('%c Running replaceLostImagesWithPlaceholder() ...', 'color: darkgreen; padding-left: 7em;');
423
424        $('img').not('[exclude-image-automation]').each(function () {
425            try {
426                var thisImage = this;
427                if (thisImage != null || thisImage != undefined || thisImage != 'undefined') {
428                    if (thisImage.naturalWidth <= 0) {
429                        $(thisImage).replaceWith("<div class='image-placeholder'><div class='image-placeholder-text'></div></div>")
430                    }
431                }
432            }
433            catch (ex) {
434                console.log("Display -> Skin replaceLostImagesWithPlaceholder() [img] " + ex.message);
435            }
436        });
437
438        try { replaceLostImagesWithPlaceholder_onAfter(); } catch (ex) { console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;'); }
439    }
440    catch (ex) {
441        console.log("Display -> Skin replaceLostImagesWithPlaceholder() " + ex.message);
442    }
443}
444
445function replaceImagesWithIcons() {
446    try {
447
448
449        $('label[for] + label[for].dnnBoxLabel').prev().hide();
450
451        if (findCss('Font-Awesome')) {
452            $('img[src*="/images/comm-phone."]').replaceWith('<i class="fa fa-phone" aria-hidden="true"></i>');
453            $('img[src*="/images/comm-fax."]').replaceWith('<i class="fa fa-fax" aria-hidden="true"></i>');
454            $('img[src*="/images/comm-email."]').replaceWith('<i class="fa fa-envelope" aria-hidden="true"></i>');
455            $('img[src*="/images/comm-indir."]').replaceWith('<i class="fa fa-search" aria-hidden="true"></i>');
456            $('img[src*="/images/comm-broadcast."]').replaceWith('<i class="fa fa-rss" aria-hidden="true"></i>');
457            $('img[src*="/images/comm-hold."]').replaceWith('<i class="fa fa-ban" aria-hidden="true"></i>');
458
459
460            $('img[src*="/images/addr-home."]').replaceWith('<i class="fa fa-list-alt" aria-hidden="true"></i>');
461            $('img[src*="/images/addr-work."]').replaceWith('<i class="fa fa-list-alt" aria-hidden="true"></i>');
462            $('img[src*="/images/addr-indir."]').replaceWith('<i class="fa fa-search" aria-hidden="true"></i>');
463            $('img[src*="/images/addr-broadcast."]').replaceWith('<i class="fa fa-rss" aria-hidden="true"></i>');
464            $('img[src*="/images/addr-hold."]').replaceWith('<i class="fa fa-ban" aria-hidden="true"></i>');
465
466            $('img[src$="arrowRight.gif"]').replaceWith('<i class="fa fa-angle-right" aria-hidden="true"></i>');
467            $('img[src$="fastNavRight.gif"]').replaceWith('<i class="fa fa-angle-double-right" aria-hidden="true"></i>');
468            $('img[src$="arrowLeft.gif"]').replaceWith('<i class="fa fa-angle-left" aria-hidden="true"></i>');
469            $('img[src$="fastNavLeft.gif"]').replaceWith('<i class="fa fa-angle-double-left" aria-hidden="true"></i>');
470
471            $('img[src="/images/no_avatar.gif"]').replaceWith('<i class="fa fa-user" style="font-size: 6em;"></i>');
472
473
474            $('img[src*="/images/add."]').replaceWith('<i class="fa fa-plus-square" aria-hidden="true"></i>');
475            $('img[src*="/DesktopModules/NOAH_Common/Images/Document%20Add."]').replaceWith('<i class="fa fa-plus-square" aria-hidden="true"></i>');
476            $('img[src*="/images/Upload."]').replaceWith('<i class="fa fa-upload" aria-hidden="true"></i>');
477            $('img[src*="/images/lt."]').replaceWith('<i class="fa fa-times" aria-hidden="true"></i>');
478            $('img[src*="/images/gt."]').replaceWith('<i class="fa fa-chevron-right" aria-hidden="true"></i>');
479
480            $('img[src*="/images/delete."]').replaceWith('<i class="fa fa-times-circle-o" aria-hidden="true"></i>');
481            $('img[src*="/images/view."]').replaceWith('<i class="fa fa-eye" aria-hidden="true"></i>');
482
483            $('[alt="Open the calendar popup."]').attr('alt', 'Calendar');
484            if (lostImageReplaceTimer) { clearTimeout(lostImageReplaceTimer); }
485            lostImageReplaceTimer = setTimeout(replaceLostImagesWithPlaceholder, 3000);
486        }
487    }
488    catch (ex) {
489        console.log(ex.message);
490    }
491}
492
493var doresizeContentAreaMinHeight = true;
494function resizeContentAreaMinHeight() {
495    try {
496        if (doresizeContentAreaMinHeight) {
497            console.log('%c Running resizeContentAreaMinHeight() ...', 'color: darkgreen; padding-left: 7em;');
498
499            var minHeightIfNotFound = 768;
500            var headerArea = $('.Header');
501            var contentArea = $('.Content');
502            var footerArea = $('.Footer');
503
504            var headerHeight = headerArea.height() || parseInt(minHeightIfNotFound * .165);
505            var contentHeight = contentArea.height() || parseInt(minHeightIfNotFound * .66);
506            var footerHeight = footerArea.height() || parseInt(minHeightIfNotFound * .165);
507
508            var windowHeight = $(window).height() || minHeightIfNotFound;
509            var minHeight = windowHeight - headerHeight - footerHeight - 1;
510
511            contentArea.css('min-height', minHeight + "px");
512            contentArea.fadeIn();
513
514
515
516
517
518        }
519    }
520    catch (ex) {
521        console.log("Display -> Skin resizeContentAreaMinHeight() " + ex.message);
522    }
523}
524
525function resizeBackgroundToFit() {
526    try {
527        console.log('%c Running resizeBackgroundToFit() ...', 'color: darkgreen; padding-left: 7em;');
528        $('.Page-Background').css('min-height', (($('.Content').height()) + $('.Header').height()) + "px");
529    }
530    catch (ex) {
531        console.log("Display -> Skin resizeBackgroundToFit() " + ex.message);
532    }
533}
534
535function mobileFriendlyClick(elementID) {
536    try {
537        console.log('%c Running mobileFriendlyClick() ...', 'color: darkgreen; padding-left: 7em;');
538        if (isMobileTouchDevice) {
539            $('[id*=' + elementID + ']').trigger('ontouchend');
540        }
541        else {
542            $('[id*=' + elementID + ']').click();
543        }
544    }
545    catch (ex) {
546        console.log("Display -> Skin mobileFriendlyClick() " + ex.message);
547    }
548}
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568var whatClickTypeAmI = 'unknown';
569function callbackTestClickType(options) {
570    var clickType = 'onclick';
571    try {
572        var _defaults = { attemptedType: 'unknown' };
573        var _settings = $.extend({}, _defaults, options);
574
575        switch (_settings.attemptedType.toString().trim().toLowerCase()) {
576            case 'onclick', 'click':
577                clickType = 'onclick'
578                break;
579            case 'touchstart':
580                clickType = 'touchstart'
581                break;
582            case 'ontouchstart':
583                clickType = 'ontouchstart'
584                break;
585            case 'touchend':
586                clickType = 'touchend'
587                break;
588            case 'ontouchend':
589                clickType = 'ontouchend'
590                break;
591        }
592    }
593    catch (ex) {
594        console.log(ex.message);
595    }
596    whatClickTypeAmI = clickType;
597    return clickType
598}
599
600function makeMobileFriendly() {
601    try {
602        console.log('%c Running makeMobileFriendly() ...', 'color: darkgreen; padding-left: 7em;');
603        if (isMobileTouchDevice) {
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656        }
657    }
658    catch (ex) {
659        console.log(ex.message);
660    }
661}
662
663function setNoAvatarIcon() {
664    try {
665        console.log('%c Running setNoAvatarIcon() ...', 'color: darkgreen; padding-left: 7em;');
666        var imageElement = $('[id*=nProfileImageUpload_imgPhoto]');
667
668        if (imageElement.length > 0) {
669            var parentContainer = null;
670            var userType = 'Company';
671
672            if ($('[id*=divCompanyActions]').length > 0) { userType = 'individual'; }
673
674            userType = JSON.parse($('[id*=hfUserType]').val()).userType.toString().trim().toLowerCase()
675
676            if (imageElement.attr('src').toString().indexOf('no_avatar.') > -1) {
677                parentContainer = imageElement.parent();
678                imageElement.remove();
679
680                var iconToRedraw = 'fa-user';
681                switch (userType.toString().toLowerCase()) {
682                    case 'individual':
683                        iconToRedraw = 'fa-user';
684                        break;
685                    case 'company':
686                        iconToRedraw = 'fa fa-building-o';
687                        break;
688                }
689                parentContainer.css('text-align', 'center');
690                parentContainer.prepend('<i class="User-Icon fa ' + iconToRedraw + '" aria-hidden="true" />');
691            }
692        }
693    }
694    catch (ex) {
695        console.log("Display -> Skin setNoAvatarIcon() " + ex.message);
696    }
697}
698
699
700function setupCards() {
701    try {
702        console.log('%c Running setupCards() ...', 'color: darkgreen; padding-left: 7em;');
703        $('.Card').each(function () {
704            var dataHeight = $(this).find('.Card-Data').height() + 30;
705            if (dataHeight < 60) { dataHeight = 60; }
706            var showPlaceholder = ($(this).find('.Card-Data').html().trim().toString().length == 0);
707            if (showPlaceholder) {
708                $(this).css('overflow', 'none');
709                $(this).find('.Card-Background .Empty-Placeholder-Text').show();
710            }
711            $(this).find('.Card-Background').height(dataHeight);
712        });
713    }
714    catch (ex) {
715        console.log(ex.message);
716    }
717}
718
719function setBadges() {
720    try {
721        console.log('%c Running setBadges() ...', 'color: darkgreen; padding-left: 7em;');
722        window.onresize = function () {
723            try {
724                $('.badge').remove();
725                createBadges();
726            }
727            catch (ex) {
728                console.log(ex.message);
729            }
730        }
731
732        createBadges();
733    }
734    catch (ex) {
735        console.log(ex.message);
736    }
737}
738
739function createBadges() {
740    try {
741        console.log('%c Running createBadges() ...', 'color: darkgreen; padding-left: 7em;');
742        $('[badge-count]').each(function () {
743            try {
744                var element = $(this);
745                var count = element.attr('badge-count');
746                if (count > 0) {
747                    var badgeForId = element.attr('id');
748                    var parent = element.parent();
749                    var top = element.position().top + 7;
750                    var left = element.position().left + element.width() - 14;
751                    parent.append('<div class="badge" for="' + badgeForId + '" style="top: ' + top + 'px; left: ' + left + 'px; position: absolute;">' + count.toString() + '</div>');
752                }
753            }
754            catch (ex) {
755                console.log(ex.message);
756            }
757        });
758    }
759    catch (ex) {
760        console.log(ex.message);
761    }
762}
763
764
765function setupNOTEDITABLES() {
766    try {
767        $('.NOT-EDITABLE').attr('disabled', 'disabled');
768        $('.NOT-EDITABLE').attr('placeholder', '');
769
770        $('.NOT-EDITABLE').each(function () {
771            try {
772                $(this).closest('.FormRow').show();
773                if ($(this).val()) {
774                    if ($(this).val().toString().trim() == '') { $(this).closest('.FormRow').hide(); }
775                }
776            } catch (ex) { console.log(ex.message); }
777        });
778    }
779    catch (ex) {
780        console.log(ex.message);
781    }
782}
783
784function setupUseOther() {
785    try {
786        $('[useother]').each(function () {
787            try {
788                var elementID = $(this).attr('useother');
789                var element = $('[id*=' + elementID + ']');
790                element.hide();
791
792                $(this).on('change', function () {
793                    try {
794                        var elementID = $(this).attr('useother');
795                        var element = $('[id*=' + elementID + ']');
796                        var elementValue = $(this).val();
797                        element.hide();
798                        if (elementValue) {
799                            if (elementValue.toString().toLowerCase().trim() == 'other') {
800                                element.show('fast');
801                            }
802                        }
803                    }
804                    catch (ex) {
805                        console.log(ex.message);
806                    }
807                })
808            }
809            catch (ex) {
810                console.log(ex.message);
811            }
812        })
813    }
814    catch (ex) {
815        console.log(ex.message);
816    }
817}
818
819var imageGalleries = [];
820function initializeGallery() {
821    try {
822        $('[isimagegallery]').each(function () {
823            try {
824                var myGalleryOptions = JSON.parse(JSON.stringify(eval($(this).attr('options') || '[{}]')[0]));
825                var myGallerySettings = $.extend({}, myGalleryOptions);
826                imageGalleries.push($(this).unitegallery(myGalleryOptions));
827                $(this).removeAttr('isimagegallery')
828                $(this).attr('initializedAsUniteGallery', true);
829                $(this).fadeIn();
830            } catch (ex) {
831                console.log(ex.message)
832            }
833        });
834    }
835    catch (ex) {
836        console.log(ex.message);
837    }
838}
839
840var delay = function () {
841    var timer = 0;
842    return function (options, callback, ms) {
843        try {
844            var _defaults = { blindCall: false };
845            var _settings = $.extend({}, _defaults, options);
846
847            switch (_settings.blindCall) {
848                case true:
849                    setTimeout(function () { callback(_settings) }, ms);
850                    break;
851                case false:
852                    clearTimeout(timer);
853                    timer = setTimeout(function () { callback(_settings) }, ms);
854                    break;
855            }
856        } catch (ex) { console.log(ex.message); }
857    };
858};
859
860function setupImageGalleries(options) {
861    try {
862
863        var _defaults = {
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879        };
880
881        var themeLoadedOnScreen = null;
882        var _settings = $.extend({}, _defaults, options);
883        var imageAPI = $("[isImageGallery=true]").each(function () {
884            try {
885
886                var myOptions = JSON.parse(JSON.stringify(eval($(this).attr('options') || '[{}]')[0]));
887                var mySettings = $.extend({}, _settings, myOptions);
888
889                themeLoadedOnScreen = mySettings.gallery_theme;
890
891                switch (themeLoadedOnScreen) {
892                    case 'tiles':
893                        _defaults = {
894                        };
895                        break;
896                    case 'tilesgrid':
897                        _defaults = {
898                        };
899                        break;
900                    case 'slider':
901                        _defaults = {
902                            gallery_theme: "slider",
903
904
905                            gallery_width: '100%',
906                            gallery_height: '275',
907                            gallery_min_width: 320,
908
909                            gallery_skin: "default",
910
911                            gallery_images_preload_type: "minimal",
912
913
914
915
916                            gallery_autoplay: true,
917                            gallery_play_interval: 4000,
918                            gallery_pause_on_mouseover: true,
919
920                            gallery_control_thumbs_mousewheel: false,
921                            gallery_control_keyboard: true,
922                            gallery_carousel: true,
923
924                            gallery_preserve_ratio: true,
925                            gallery_debug_errors: true,
926                            gallery_background_color: "",
927
928
929
930                            slider_scale_mode: "fit",
931
932
933                            slider_scale_mode_media: "fit",
934                            slider_scale_mode_fullscreen: "down",
935                            slider_item_padding_top: 0,
936                            slider_item_padding_bottom: 0,
937                            slider_item_padding_left: 0,
938                            slider_item_padding_right: 0,
939
940                            slider_transition: "slide",
941                            slider_transition_speed: 300,
942                            slider_transition_easing: "easeInOutQuad",
943
944                            slider_control_swipe: true,
945                            slider_control_zoom: false,
946                            slider_zoom_max_ratio: 6,
947                            slider_loader_type: 1,
948                            slider_loader_color: "white",
949
950                            slider_enable_bullets: false,
951                            slider_bullets_skin: "",
952                            slider_bullets_space_between: -1,
953                            slider_bullets_align_hor: "center",
954                            slider_bullets_align_vert: "bottom",
955                            slider_bullets_offset_hor: 0,
956                            slider_bullets_offset_vert: 10,
957
958                            slider_enable_arrows: true,
959                            slider_arrows_skin: "",
960
961                            slider_arrow_left_align_hor: "left",
962                            slider_arrow_left_align_vert: "middle",
963                            slider_arrow_left_offset_hor: 20,
964                            slider_arrow_left_offset_vert: 0,
965
966                            slider_arrow_right_align_hor: "right",
967                            slider_arrow_right_align_vert: "middle",
968                            slider_arrow_right_offset_hor: 20,
969                            slider_arrow_right_offset_vert: 0,
970
971                            slider_enable_progress_indicator: true,
972                            slider_progress_indicator_type: "pie",
973                            slider_progress_indicator_align_hor: "left",
974                            slider_progress_indicator_align_vert: "top",
975                            slider_progress_indicator_offset_hor: 16,
976                            slider_progress_indicator_offset_vert: 36,
977
978                            slider_progressbar_color: "#ffffff",
979                            slider_progressbar_opacity: 0.6,
980                            slider_progressbar_line_width: 5,
981
982                            slider_progresspie_type_fill: false,
983                            slider_progresspie_color1: "#B5B5B5",
984                            slider_progresspie_color2: "#E5E5E5",
985                            slider_progresspie_stroke_width: 6,
986                            slider_progresspie_width: 30,
987                            slider_progresspie_height: 30,
988
989                            slider_enable_play_button: true,
990                            slider_play_button_skin: "",
991                            slider_play_button_align_hor: "left",
992                            slider_play_button_align_vert: "top",
993                            slider_play_button_offset_hor: 40,
994                            slider_play_button_offset_vert: 8,
995
996                            slider_enable_fullscreen_button: true,
997                            slider_fullscreen_button_skin: "",
998                            slider_fullscreen_button_align_hor: "left",
999                            slider_fullscreen_button_align_vert: "top",
1000                            slider_fullscreen_button_offset_hor: 11,
1001                            slider_fullscreen_button_offset_vert: 9,
1002
1003                            slider_enable_zoom_panel: false,
1004                            slider_zoompanel_skin: "",
1005                            slider_zoompanel_align_hor: "right",
1006                            slider_zoompanel_align_vert: "top",
1007                            slider_zoompanel_offset_hor: 12,
1008                            slider_zoompanel_offset_vert: 10,
1009
1010                            slider_controls_always_on: true,
1011                            slider_controls_appear_ontap: true,
1012                            slider_controls_appear_duration: 300,
1013                            slider_videoplay_button_type: "square",
1014
1015                            slider_enable_text_panel: false,
1016                            slider_textpanel_always_on: true,
1017
1018                            slider_textpanel_text_valign: "middle",
1019                            slider_textpanel_padding_top: 10,
1020                            slider_textpanel_padding_bottom: 10,
1021                            slider_textpanel_height: null,
1022                            slider_textpanel_padding_title_description: 5,
1023                            slider_textpanel_padding_right: 11,
1024                            slider_textpanel_padding_left: 11,
1025                            slider_textpanel_fade_duration: 200,
1026                            slider_textpanel_enable_title: true,
1027                            slider_textpanel_enable_description: true,
1028                            slider_textpanel_enable_bg: true,
1029                            slider_textpanel_bg_color: "#000000",
1030                            slider_textpanel_bg_opacity: 0.4,
1031
1032                            slider_textpanel_title_color: null,
1033                            slider_textpanel_title_font_family: null,
1034                            slider_textpanel_title_text_align: null,
1035                            slider_textpanel_title_font_size: null,
1036                            slider_textpanel_title_bold: null,
1037                            slider_textpanel_css_title: {},
1038
1039                            slider_textpanel_desc_color: null,
1040                            slider_textpanel_desc_font_family: null,
1041                            slider_textpanel_desc_text_align: null,
1042                            slider_textpanel_desc_font_size: null,
1043                            slider_textpanel_desc_bold: null,
1044                            slider_textpanel_css_description: {},
1045
1046                            slider_textpanel_bg_css: {},
1047                        };
1048                        break;
1049                    case 'compact':
1050                        _defaults = {
1051                        };
1052                        break;
1053                    case 'carousel':
1054                        _defaults = {
1055
1056
1057                            tile_width: 160,
1058                            tile_height: 160,
1059
1060                            theme_gallery_padding: 0,
1061                            theme_carousel_align: "center",
1062                            theme_carousel_offset: 0,
1063
1064
1065
1066                            gallery_theme: "carousel",
1067                            gallery_width: 1100,
1068                            gallery_min_width: 150,
1069                            gallery_background_color: "",
1070
1071
1072
1073                            carousel_padding: 8,
1074                            carousel_space_between_tiles: 20,
1075                            carousel_navigation_numtiles: 3,
1076                            carousel_scroll_duration: 500,
1077                            carousel_scroll_easing: "easeOutCubic",
1078
1079                            carousel_autoplay: true,
1080                            carousel_autoplay_timeout: 3000,
1081                            carousel_autoplay_direction: "right",
1082                            carousel_autoplay_pause_onhover: true,
1083
1084
1085
1086                            theme_enable_navigation: true,
1087                            theme_navigation_position: "bottom",
1088                            theme_navigation_enable_play: true,
1089                            theme_navigation_align: "center",
1090                            theme_navigation_offset_hor: 0,
1091                            theme_navigation_margin: 20,
1092                            theme_space_between_arrows: 5,
1093
1094
1095                            tile_enable_border: true,
1096                            tile_border_width: 3,
1097                            tile_border_color: "#F0F0F0",
1098                            tile_border_radius: 0,
1099
1100                            tile_enable_outline: true,
1101                            tile_outline_color: "#8B8B8B",
1102
1103                            tile_enable_shadow: true,
1104                            tile_shadow_h: 1,
1105                            tile_shadow_v: 1,
1106                            tile_shadow_blur: 3,
1107                            tile_shadow_spread: 2,
1108                            tile_shadow_color: "#8B8B8B",
1109
1110                            tile_enable_action: true,
1111                            tile_as_link: false,
1112                            tile_link_newpage: true,
1113
1114                            tile_enable_overlay: true,
1115                            tile_overlay_opacity: 0.4,
1116                            tile_overlay_color: "#000000",
1117
1118                            tile_enable_icons: true,
1119                            tile_show_link_icon: false,
1120                            tile_space_between_icons: 26,
1121
1122                            tile_enable_image_effect: false,
1123                            tile_image_effect_type: "bw",
1124                            tile_image_effect_reverse: false,
1125
1126
1127
1128                            tile_enable_textpanel: false,
1129                            tile_textpanel_source: "title",
1130                            tile_textpanel_always_on: false,
1131                            tile_textpanel_appear_type: "slide",
1132                            tile_textpanel_position: "inside_bottom",
1133                            tile_textpanel_offset: 0,
1134
1135                            tile_textpanel_padding_top: 8,
1136                            tile_textpanel_padding_bottom: 8,
1137                            tile_textpanel_padding_right: 11,
1138                            tile_textpanel_padding_left: 11,
1139                            tile_textpanel_bg_opacity: 0.4,
1140                            tile_textpanel_bg_color: "#000000",
1141                            tile_textpanel_bg_css: {},
1142
1143                            tile_textpanel_title_color: null,
1144                            tile_textpanel_title_font_family: null,
1145                            tile_textpanel_title_text_align: null,
1146                            tile_textpanel_title_font_size: null,
1147                            tile_textpanel_title_bold: null,
1148                            tile_textpanel_css_title: {},
1149
1150                            tile_textpanel_desc_color: null,
1151                            tile_textpanel_desc_font_family: null,
1152                            tile_textpanel_desc_text_align: null,
1153                            tile_textpanel_desc_font_size: null,
1154                            tile_textpanel_desc_bold: null,
1155                            tile_textpanel_css_description: {},
1156
1157
1158
1159                            lightbox_type: "wide",
1160
1161                            lightbox_hide_arrows_onvideoplay: true,
1162                            lightbox_arrows_position: "sides",
1163                            lightbox_arrows_offset: 10,
1164                            lightbox_arrows_inside_offset: 10,
1165                            lightbox_arrows_inside_alwayson: false,
1166
1167                            lightbox_overlay_color: null,
1168                            lightbox_overlay_opacity: 1,
1169                            lightbox_top_panel_opacity: null,
1170
1171                            lightbox_close_on_emptyspace: true,
1172
1173                            lightbox_show_numbers: true,
1174                            lightbox_numbers_size: null,
1175                            lightbox_numbers_color: null,
1176                            lightbox_numbers_padding_top: null,
1177                            lightbox_numbers_padding_right: null,
1178
1179                            lightbox_slider_image_border: true,
1180                            lightbox_slider_image_border_width: 10,
1181                            lightbox_slider_image_border_color: "#ffffff",
1182                            lightbox_slider_image_border_radius: 0,
1183
1184                            lightbox_slider_image_shadow: true,
1185
1186                            lightbox_slider_control_swipe: true,
1187                            lightbox_slider_control_zoom: true,
1188
1189
1190
1191                            lightbox_show_textpanel: true,
1192                            lightbox_textpanel_width: 550,
1193
1194                            lightbox_textpanel_enable_title: true,
1195                            lightbox_textpanel_enable_description: false,
1196
1197                            lightbox_textpanel_padding_top: 5,
1198                            lightbox_textpanel_padding_bottom: 5,
1199                            lightbox_textpanel_padding_right: 11,
1200                            lightbox_textpanel_padding_left: 11,
1201
1202                            lightbox_textpanel_title_color: null,
1203                            lightbox_textpanel_title_font_family: null,
1204                            lightbox_textpanel_title_text_align: null,
1205                            lightbox_textpanel_title_font_size: null,
1206                            lightbox_textpanel_title_bold: null,
1207                            lightbox_textpanel_css_title: {},
1208
1209                            lightbox_textpanel_desc_color: null,
1210                            lightbox_textpanel_desc_font_family: null,
1211                            lightbox_textpanel_desc_text_align: null,
1212                            lightbox_textpanel_desc_font_size: null,
1213                            lightbox_textpanel_desc_bold: null,
1214                            lightbox_textpanel_css_description: {},
1215
1216                        };
1217                        break;
1218                    case 'video':
1219                        _defaults = {
1220                        };
1221                        break;
1222                    case 'grid':
1223                        _defaults = {
1224                            gallery_theme: "grid",
1225
1226
1227
1228                            theme_panel_position: "right",
1229                            theme_hide_panel_under_width: 480,
1230
1231
1232
1233                            gallery_width: "100%",
1234
1235                            gallery_min_width: 320,
1236
1237                            gallery_skin: "default",
1238
1239                            gallery_images_preload_type: "minimal",
1240
1241
1242
1243
1244                            gallery_autoplay: false,
1245                            gallery_play_interval: 3000,
1246                            gallery_pause_on_mouseover: true,
1247
1248                            gallery_control_thumbs_mousewheel: false,
1249                            gallery_control_keyboard: true,
1250                            gallery_carousel: true,
1251
1252                            gallery_preserve_ratio: true,
1253                            gallery_debug_errors: true,
1254                            gallery_background_color: "",
1255
1256
1257                            slider_scale_mode: "fit",
1258
1259
1260                            slider_scale_mode_media: "fit",
1261                            slider_scale_mode_fullscreen: "down",
1262                            slider_item_padding_top: 0,
1263                            slider_item_padding_bottom: 0,
1264                            slider_item_padding_left: 0,
1265                            slider_item_padding_right: 0,
1266
1267                            slider_transition: "slide",
1268                            slider_transition_speed: 300,
1269                            slider_transition_easing: "easeInOutQuad",
1270
1271                            slider_control_swipe: true,
1272                            slider_control_zoom: true,
1273                            slider_zoom_max_ratio: 6,
1274                            slider_loader_type: 1,
1275                            slider_loader_color: "white",
1276
1277                            slider_enable_bullets: false,
1278                            slider_bullets_skin: "",
1279                            slider_bullets_space_between: -1,
1280                            slider_bullets_align_hor: "center",
1281                            slider_bullets_align_vert: "bottom",
1282                            slider_bullets_offset_hor: 0,
1283                            slider_bullets_offset_vert: 10,
1284
1285                            slider_enable_arrows: true,
1286                            slider_arrows_skin: "",
1287
1288                            slider_arrow_left_align_hor: "left",
1289                            slider_arrow_left_align_vert: "middle",
1290                            slider_arrow_left_offset_hor: 20,
1291                            slider_arrow_left_offset_vert: 0,
1292
1293                            slider_arrow_right_align_hor: "right",
1294                            slider_arrow_right_align_vert: "middle",
1295                            slider_arrow_right_offset_hor: 20,
1296                            slider_arrow_right_offset_vert: 0,
1297
1298                            slider_enable_progress_indicator: true,
1299                            slider_progress_indicator_type: "pie",
1300                            slider_progress_indicator_align_hor: "left",
1301                            slider_progress_indicator_align_vert: "top",
1302                            slider_progress_indicator_offset_hor: 16,
1303                            slider_progress_indicator_offset_vert: 36,
1304
1305                            slider_progressbar_color: "#ffffff",
1306                            slider_progressbar_opacity: 0.6,
1307                            slider_progressbar_line_width: 5,
1308
1309                            slider_progresspie_type_fill: false,
1310                            slider_progresspie_color1: "#B5B5B5",
1311                            slider_progresspie_color2: "#E5E5E5",
1312                            slider_progresspie_stroke_width: 6,
1313                            slider_progresspie_width: 30,
1314                            slider_progresspie_height: 30,
1315
1316                            slider_enable_play_button: true,
1317                            slider_play_button_skin: "",
1318                            slider_play_button_align_hor: "left",
1319                            slider_play_button_align_vert: "top",
1320                            slider_play_button_offset_hor: 40,
1321                            slider_play_button_offset_vert: 8,
1322
1323                            slider_enable_fullscreen_button: true,
1324                            slider_fullscreen_button_skin: "",
1325                            slider_fullscreen_button_align_hor: "left",
1326                            slider_fullscreen_button_align_vert: "top",
1327                            slider_fullscreen_button_offset_hor: 11,
1328                            slider_fullscreen_button_offset_vert: 9,
1329
1330                            slider_enable_zoom_panel: true,
1331                            slider_zoompanel_skin: "",
1332                            slider_zoompanel_align_hor: "right",
1333                            slider_zoompanel_align_vert: "top",
1334                            slider_zoompanel_offset_hor: 12,
1335                            slider_zoompanel_offset_vert: 10,
1336
1337                            slider_controls_always_on: true,
1338                            slider_controls_appear_ontap: true,
1339                            slider_controls_appear_duration: 300,
1340                            slider_videoplay_button_type: "square",
1341
1342                            slider_enable_text_panel: false,
1343                            slider_textpanel_always_on: true,
1344
1345                            slider_textpanel_text_valign: "middle",
1346                            slider_textpanel_padding_top: 10,
1347                            slider_textpanel_padding_bottom: 10,
1348                            slider_textpanel_height: null,
1349                            slider_textpanel_padding_title_description: 5,
1350                            slider_textpanel_padding_right: 11,
1351                            slider_textpanel_padding_left: 11,
1352                            slider_textpanel_fade_duration: 200,
1353                            slider_textpanel_enable_title: true,
1354                            slider_textpanel_enable_description: true,
1355                            slider_textpanel_enable_bg: true,
1356                            slider_textpanel_bg_color: "#000000",
1357                            slider_textpanel_bg_opacity: 0.4,
1358
1359                            slider_textpanel_title_color: null,
1360                            slider_textpanel_title_font_family: null,
1361                            slider_textpanel_title_text_align: null,
1362                            slider_textpanel_title_font_size: null,
1363                            slider_textpanel_title_bold: null,
1364                            slider_textpanel_css_title: {},
1365
1366                            slider_textpanel_desc_color: null,
1367                            slider_textpanel_desc_font_family: null,
1368                            slider_textpanel_desc_text_align: null,
1369                            slider_textpanel_desc_font_size: null,
1370                            slider_textpanel_desc_bold: null,
1371                            slider_textpanel_css_description: {},
1372
1373                            slider_textpanel_bg_css: {},
1374
1375
1376
1377                            thumb_width: 88,
1378                            thumb_height: 50,
1379                            thumb_fixed_size: true,
1380
1381                            thumb_border_effect: true,
1382                            thumb_border_width: 0,
1383                            thumb_border_color: "#000000",
1384                            thumb_over_border_width: 0,
1385                            thumb_over_border_color: "#d9d9d9",
1386                            thumb_selected_border_width: 1,
1387                            thumb_selected_border_color: "#d9d9d9",
1388
1389                            thumb_round_corners_radius: 0,
1390
1391                            thumb_color_overlay_effect: true,
1392                            thumb_overlay_color: "#000000",
1393                            thumb_overlay_opacity: 0.4,
1394                            thumb_overlay_reverse: false,
1395
1396                            thumb_image_overlay_effect: false,
1397                            thumb_image_overlay_type: "bw",
1398
1399                            thumb_transition_duration: 200,
1400                            thumb_transition_easing: "easeOutQuad",
1401
1402                            thumb_show_loader: true,
1403                            thumb_loader_type: "dark",
1404
1405
1406
1407                            gridpanel_vertical_scroll: true,
1408                            gridpanel_grid_align: "middle",
1409                            gridpanel_padding_border_top: 10,
1410                            gridpanel_padding_border_bottom: 4,
1411                            gridpanel_padding_border_left: 10,
1412                            gridpanel_padding_border_right: 10,
1413
1414                            gridpanel_arrows_skin: "",
1415                            gridpanel_arrows_align_vert: "middle",
1416                            gridpanel_arrows_padding_vert: 4,
1417                            gridpanel_arrows_align_hor: "center",
1418                            gridpanel_arrows_padding_hor: 10,
1419
1420                            gridpanel_space_between_arrows: 20,
1421                            gridpanel_arrows_always_on: false,
1422
1423                            gridpanel_enable_handle: true,
1424                            gridpanel_handle_align: "top",
1425                            gridpanel_handle_offset: 0,
1426                            gridpanel_handle_skin: "",
1427
1428                            gridpanel_background_color: "",
1429
1430                            grid_panes_direction: "left",
1431                            grid_num_cols: 3,
1432                            grid_space_between_cols: 10,
1433                            grid_space_between_rows: 10,
1434                            grid_transition_duration: 300,
1435                            grid_transition_easing: "easeInOutQuad",
1436                            grid_carousel: false
1437                        };
1438                        break;
1439                }
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453                mySettings = $.extend({}, _defaults, mySettings);
1454                var element = $(this);
1455                element.attr('options', "[" + JSON.stringify(mySettings) + "]");
1456
1457            } catch (ex) { console.log(ex.message); }
1458        });
1459
1460        switch (themeLoadedOnScreen) {
1461            case 'tiles':
1462                includeJSFiles(['/NOAH/plugins/unitegallery-master/dist/themes/tiles/ug-theme-tiles.js']);
1463                break;
1464            case 'tilesgrid':
1465                includeJSFiles(['/NOAH/plugins/unitegallery-master/dist/themes/tilesgrid/ug-theme-tilesgrid.js']);
1466                break;
1467            case 'slider':
1468                includeJSFiles(['/NOAH/plugins/unitegallery-master/dist/themes/slider/ug-theme-slider.js']);
1469                break;
1470            case 'compact':
1471                includeJSFiles(['/NOAH/plugins/unitegallery-master/dist/themes/compact/ug-theme-compact.js']);
1472                break;
1473            case 'carousel':
1474                includeJSFiles(['/NOAH/plugins/unitegallery-master/dist/themes/carousel/ug-theme-carousel.js']);
1475                break;
1476            case 'video':
1477                includeJSFiles(['/NOAH/plugins/unitegallery-master/dist/themes/video/ug-theme-video.js']);
1478                break;
1479            case 'grid':
1480                includeJSFiles(['/NOAH/plugins/unitegallery-master/dist/themes/grid/ug-theme-grid.js']);
1481                break;
1482        }
1483
1484
1485
1486
1487    }
1488    catch (ex) {
1489        console.log(ex.message);
1490    }
1491}
1492
1493function makeGallery() {
1494    try {
1495        console.log('%c Running makeGallery() ...', 'color: darkgreen; padding-left: 7em;');
1496        try { makeGallery_onBefore(); } catch (ex) { console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;'); }
1497
1498        lazyLoadImages();
1499        $("[isimagegallery]").each(function () {
1500            try {
1501                var options = null;
1502                var thisImageGallery = null;
1503                thisImageGallery = $(this);
1504                options = JSON.parse(thisImageGallery.attr('options'))[0];
1505                thisImageGallery.unitegallery(options);
1506            } catch (ex) { console.log(ex.message); }
1507        });
1508
1509        try { makeGallery_onAfter(); } catch (ex) { console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;'); }
1510    } catch (ex) {
1511        console.log('makeGallery() ' + ex.message);
1512    }
1513}
1514
1515function lazyLoadImages() {
1516    try {
1517
1518        console.log('%c Running lazyLoadImages() ...', 'color: darkgreen; padding-left: 7em;');
1519        $('img[lazy-load-image-src]').each(function () {
1520            try {
1521                var ele = $(this)
1522                var lazyLoadImageSource = ele.attr('lazy-load-image-src');
1523                var img = new Image();
1524                img.src = lazyLoadImageSource;
1525
1526                console.log('Lazy loading ... ' + ele.attr('src').toString() + ' with ' + lazyLoadImageSource);
1527                ele.replaceWith($(img));
1528
1529            } catch (ex) { console.log(ex.message); }
1530        });
1531    }
1532    catch (ex) { console.log('lazyLoadImages() ' + ex.message); }
1533}
1534
1535function setupFileUploads(options) {
1536    try {
1537        console.log('%c Running setupFileUploads() ...', 'color: darkgreen; padding-left: 7em;');
1538        var _defaults = {};
1539        var _settings = $.extend({}, _defaults, options);
1540
1541        $("[isfileupload=true]").each(function () {
1542            try {
1543                var myOptions = JSON.parse(JSON.stringify(eval($(this).attr('options') || '[{}]')[0]));
1544                var mySettings = $.extend({}, _settings, myOptions);
1545
1546                mySettings.init = function () {
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574                    this.on("thumbnail", function (file, xhr, formData) {
1575                        try { $('.dz-error-message').map(function () { if ($(this).text().length > 0) { return $(this).parent().fadeOut().remove() } }); } catch (ex) { console.log(ex.message); }
1576
1577
1578                    });
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635                }
1636
1637                var thisDropZone = $(this).dropzone(mySettings)
1638            } catch (ex) {
1639                console.log(ex.message);
1640            }
1641        });
1642
1643    }
1644    catch (ex) {
1645        console.log(ex.message);
1646    }
1647}
1648
1649
1650
1651var useSiteWideImageResizePlugin = false;
1652var useSiteWideImageResizePluginDelay = 4000;
1653function resizeAllImagesToFitArea() {
1654    try {
1655
1656        $('.Image').each(function () {
1657            try {
1658                var _self = $(this);
1659
1660                var img = new Image;
1661                var currentBackgroundCSS = _self.css('background-image');
1662                if (currentBackgroundCSS.toString().trim() != '' && currentBackgroundCSS.toString().trim().toLowerCase() != 'none') {
1663                    var data = ("~" + currentBackgroundCSS).toString().split('~');
1664                    data = data[1].split('"')[1].replace(/url\(|\)$/ig, "");
1665                    img.src = data;
1666
1667                    if ((img.width > _self.width()) || (img.height > _self.height())) {
1668                        _self.css('background-size', 'contain').attr('changedSize', true);
1669                        console.log("Resizing background-image to fit area! " + img.src + " : " + img.width + " " + img.height + " " + _self.width() + " " + _self.height());
1670                    }
1671                };
1672            } catch (ex) { console.log(ex.message); }
1673        });
1674    }
1675    catch (ex) {
1676        console.log("Display -> Skin resizeAllImagesToFitArea() " + ex.message);
1677    }
1678}
1679
1680function setupUIElements() {
1681    try {
1682        console.log('%c Running setMobileIcon() ...', 'color: darkgreen; padding-left: 7em;');
1683        try {
1684            $('.nav-icon').on('click', function () { $(this).setMobileIcon(); });
1685        } catch (ex) {
1686            console.log(ex.message);
1687        }
1688
1689        console.log('%c Running setupUIElements() ...', 'color: darkgreen; padding-left: 7em;');
1690        try {
1691            try { clientSetupUIElements_onBefore(); } catch (ex) { console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;'); }
1692        } catch (ex) {
1693            console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;');
1694        }
1695
1696        console.log('%c Running allowNumericOnly() PLUGIN ...', 'color: darkgreen; padding-left: 7em;');
1697        try {
1698            $('[numericOnly]').allowNumericOnly();
1699        } catch (ex) {
1700            console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;');
1701        }
1702
1703        try {
1704            if (typeof lazyLoadImages == 'function') { lazyLoadImages(); }
1705        } catch (ex) {
1706            console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;');
1707        }
1708
1709        try {
1710            $('.User-Badge-Membership .FormButton').addClass('col-lg-12 col-md-12 col-sm-12 col-xs-12');
1711        } catch (ex) {
1712            console.log(ex.message);
1713        }
1714
1715        try {
1716            if (typeof setupCards == 'function') { setupCards() };
1717        } catch (ex) {
1718            console.log(ex.message);
1719        }
1720
1721        try {
1722            $('[data-toggle=confirmation]').confirmation({
1723                rootSelector: '[data-toggle=confirmation]'
1724
1725            });
1726        } catch (ex) {
1727            console.log(ex.message);
1728        }
1729
1730        try {
1731            if (typeof setBadges == 'function') { setBadges() }
1732        } catch (ex) {
1733            console.log(ex.message);
1734        }
1735        try {
1736            if (typeof setupUseOther == 'function') { setupUseOther() }
1737        } catch (ex) {
1738            console.log(ex.message);
1739        }
1740        try {
1741            if (typeof setupNOTEDITABLES == 'function') { setupNOTEDITABLES(); }
1742        } catch (ex) {
1743            console.log(ex.message);
1744        }
1745        try {
1746            if (typeof setupAllAutoPlugins == 'function') { setupAllAutoPlugins(); }
1747        } catch (ex) {
1748            console.log(ex.message);
1749        }
1750
1751
1752        try {
1753            $('.checkbox').find('input[type=checkbox]').bind('change', function () { if ($(this).is(":checked")) { $(this).parent().removeClass('checked'); } else { $(this).parent().addClass('checked'); } });
1754        } catch (ex) {
1755            console.log(ex.message);
1756        }
1757        try {
1758            $('.checkbox-inline').find('input[type=checkbox]').bind('change', function () { if ($(this).is(":checked")) { $(this).parent().removeClass('checked'); } else { $(this).parent().addClass('checked'); } });
1759        } catch (ex) {
1760            console.log(ex.message);
1761        }
1762        try {
1763            $('.radio').find('input[type=radio]').bind('change', function () { var name = $(this).attr('name'); $('input[type=radio][name=' + name + ']').parent().removeClass('checked'); if ($(this).val() != '') { $(this).parent().addClass('checked'); } });
1764        } catch (ex) {
1765            console.log(ex.message);
1766        }
1767        try {
1768            $('.radio-inline').find('input[type=radio]').bind('change', function () { var name = $(this).attr('name'); $('input[type=radio][name=' + name + ']').parent().removeClass('checked'); if ($(this).val() != '') { $(this).parent().addClass('checked'); } });
1769        } catch (ex) {
1770            console.log(ex.message);
1771        }
1772
1773        try {
1774            $('input[type="checkbox"], input[type="radio"]').each(function () {
1775                try {
1776                    var currentInput = $(this)
1777                    var inputID = currentInput.attr('id');
1778                    var label = $('label[for="' + inputID + '"]');
1779
1780                    var nextIsLabel = $(this).next().is("label");
1781
1782                    if (nextIsLabel == false) {
1783
1784                        currentInput.after('<label pluginCorrected="true" for="' + inputID + '"></label>');
1785                    }
1786                } catch (ex) {
1787                    console.log(ex.message);
1788                }
1789            });
1790        } catch (ex) {
1791            console.log(ex.message);
1792        }
1793
1794
1795        try {
1796
1797            $('input ~ label[pluginCorrected][for] ~ label[for]').prev().remove();
1798            $('input ~ label[pluginCorrected][for] ~ label').prev().remove()
1799        } catch (ex) {
1800            console.log(ex.message);
1801        }
1802
1803
1804
1805
1806        try {
1807            $('[data-toggle=popover]').popover();
1808        } catch (ex) {
1809            console.log(ex.message);
1810        }
1811        try {
1812            if (typeof setNoAvatarIcon == 'function') { setNoAvatarIcon(); }
1813        } catch (ex) {
1814            console.log(ex.message);
1815        }
1816
1817        try {
1818            if (typeof replaceImagesWithIcons == 'function') { replaceImagesWithIcons(); }
1819        } catch (ex) {
1820            console.log(ex.message);
1821        }
1822
1823        try {
1824            if (typeof handleBadge == 'function') { handleBadge(); }
1825        } catch (ex) {
1826            console.log(ex.message);
1827        }
1828
1829
1830        try {
1831            try { clientSetupUIElements_onAfter(); } catch (ex) { console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;'); }
1832        } catch (ex) {
1833            console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;');
1834        }
1835
1836        try {
1837            $('input').on('blur', function () { $(this).change(); });
1838        } catch (ex) {
1839            console.log(ex.message);
1840        }
1841
1842        try {
1843            if (useSiteWideImageResizePlugin) {
1844                if (typeof setRequiredFieldsUI == 'function') {
1845                    setTimeout(function () { try { resizeAllImagesToFitArea(); } catch (ex) { console.log(ex.message); } }, useSiteWideImageResizePluginDelay)
1846                }
1847            }
1848        } catch (ex) {
1849            console.log(ex.message);
1850        }
1851
1852        try {
1853
1854
1855        } catch (ex) {
1856            console.log(ex.message);
1857        }
1858
1859
1860    }
1861    catch (ex) {
1862        console.log("Display -> Skin setupUIElements() " + ex.message);
1863    }
1864}
1865
1866
1867function clientSetupJSONCaptureInputPlugins(options) {
1868    try {
1869        console.log('%c Running setupUIElements() ...', 'color: darkgreen; padding-left: 7em;');
1870        try {
1871            try { options = clientSetupJSONCaptureInputPlugins_onBefore(options); } catch (ex) { console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;'); }
1872        } catch (ex) {
1873            console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;');
1874        }
1875
1876        var myOptions = options;
1877
1878        options.searchResultStorage.on('change', function () { try { if (typeof userInputData_onChange == 'function') { userInputData_onChange(this, {}); } } catch (ex) { console.log(ex.message); } })
1879
1880        $('[json-capture-property]').each(function (options) {
1881            try {
1882                var defaultedPageRequest = _JSONRequestForPage || null;
1883                if (defaultedPageRequest) { defaultedPageRequest = defaultedPageRequest.items[0]; }
1884
1885                var _defaults = {
1886                    searchResultStorage: $('[id*=hfJSONSelectionResult]')
1887                    , searchResultJSON: null
1888                    , propertyName: ''
1889                    , defaultObject: defaultedPageRequest || { "userinput": {} }
1890                    , preserver: { preserveSearchCriteria: true, cookieName: 'DictionarySearchInput', expireTime: 10 }
1891                };
1892
1893
1894                var settings = $.extend({}, _defaults, myOptions)
1895                var toPropertyName = settings.propertyName
1896                if (toPropertyName && toPropertyName.trim() != '') {
1897                    settings.defaultObject.userinput[toPropertyName];
1898                    settings.defaultObject.userinput[toPropertyName] = {};
1899                }
1900
1901                var ele = $(this);
1902                ele.attr('json-bind-to', settings.searchResultStorage.attr('id'));
1903
1904                ele.off('change').on('change', function () {
1905                    try {
1906                        try {
1907                            var defaultedPageRequest = _JSONRequestForPage || null;
1908                            if (defaultedPageRequest) { defaultedPageRequest = defaultedPageRequest.items[0]; }
1909
1910                            var thisEle = $(this);
1911                            var _defaults = {
1912                                searchResultStorage: $('[id*=hfJSONSelectionResult]')
1913                                , searchResultJSON: null
1914                                , propertyName: toPropertyName || ''
1915                                , defaultObject: defaultedPageRequest || { "userinput": {} }
1916                            };
1917
1918
1919                            var settings = $.extend({}, _defaults, myOptions)
1920                            if (settings.propertyName && settings.propertyName.trim() != '') {
1921                                if (!settings.defaultObject.userinput[settings.propertyName]) {
1922                                    settings.defaultObject.userinput[settings.propertyName] = {};
1923                                }
1924                            }
1925
1926                            settings.searchResultStorage = $('[id*=' + ele.attr('json-bind-to') + ']');
1927
1928                            if (settings.searchResultStorage.val().toString().trim() != '') {
1929                                settings.searchResultJSON = settings.searchResultStorage.getJSONData();
1930                            } else { settings.searchResultJSON = settings.defaultObject; }
1931
1932                            if (settings && settings.searchResultJSON && settings.searchResultJSON.hasOwnProperty('items')) {
1933                                settings.searchResultJSON = settings.searchResultJSON.items[0];
1934                            }
1935
1936                            var val = thisEle.val();
1937                            var filterProperty = thisEle.attr('json-capture-property');
1938
1939                            if (thisEle.is(":checkbox")) { val = thisEle.is(":checked"); }
1940                            if (thisEle.is(":radio")) { val = thisEle.is(":checked"); }
1941
1942                            if (val && val.toString().trim().length > 0) {
1943                                if (settings.propertyName && settings.propertyName.trim() != '') {
1944                                    if (!settings.searchResultJSON['userinput'][settings.propertyName]) {
1945                                        settings.searchResultJSON['userinput'][settings.propertyName] = {}
1946                                    }
1947                                    settings.searchResultJSON['userinput'][settings.propertyName][filterProperty] = val;
1948                                }
1949                                else {
1950                                    settings.searchResultJSON['userinput'][filterProperty] = val;
1951                                }
1952                            } else {
1953                                if (settings.propertyName && settings.propertyName.trim() != '') {
1954                                    if (!settings.searchResultJSON['userinput'][settings.propertyName]) {
1955                                        settings.searchResultJSON['userinput'][settings.propertyName] = {}
1956                                        settings.searchResultJSON['userinput'][settings.propertyName][filterProperty] = '';
1957                                    }
1958                                    delete settings.searchResultJSON['userinput'][settings.propertyName][filterProperty];
1959                                }
1960                                else {
1961                                    delete settings.searchResultJSON['userinput'][filterProperty];
1962                                }
1963                            }
1964                            settings.searchResultStorage.val(JSON.stringify({ "items": [settings.searchResultJSON] })).change();
1965                            userInputData = settings.searchResultStorage.getJSONData();
1966                        } catch (ex) { console.log(ex.message); }
1967
1968                        try {
1969                            if (typeof $.cookie == 'function') {
1970                                if (settings &&
1971                                    settings.preserver &&
1972                                    settings.preserver.preserveSearchCriteria) {
1973                                    console.log('Updating Cookie.')
1974                                    $.cookie(settings.preserver.cookieName,
1975                                        JSON.stringify(userInputData || {}),
1976                                        { expires: settings.preserver.expireTime });
1977                                    console.log('Cookie updated.')
1978                                }
1979                            }
1980                        } catch (ex) { console.log(ex.message); }
1981
1982                    } catch (ex) { console.log(ex.message); }
1983                });
1984            } catch (ex) { console.log(ex.message); }
1985        });
1986
1987        try {
1988            try { clientSetupJSONCaptureInputPlugins_onAfter(options); } catch (ex) { console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;'); }
1989        } catch (ex) {
1990            console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;');
1991        }
1992    } catch (ex) { console.log(ex.message); }
1993}
1994
1995
1996function showSiteMessage(title, message) {
1997    try {
1998        console.log('%c Running showSiteMessage() ...', 'color: darkgreen; padding-left: 7em;');
1999        if (!title) {
2000            title = '';
2001        }
2002        if (!message) {
2003            message = '';
2004        }
2005
2006        if (title == '') { $('[id=messageModal]').find('.modal-header').hide(); } else { $('[id=messageModal]').find('.modal-header').show(); }
2007        if (message == '') { $('[id=messageModal]').find('.modal-body').hide(); } else { $('[id=messageModal]').find('.modal-body').show(); }
2008
2009        if (title != '' || message != '') {
2010            $('[id=messageModal]').find('[id=messageModalTitle]').html(title);
2011            $('[id=messageModal]').find('[id=messageModalBody]').html(message);
2012
2013            $('#myModal').on('hidden.bs.modal', function () {
2014                $('.Skin').removeClass('blur');
2015            });
2016
2017            $('#myModal').on('shown.bs.modal', function () {
2018                $('.Skin').addClass('blur');
2019            });
2020
2021            $('[id=messageModal]').modal('show');
2022        }
2023    }
2024    catch (ex) {
2025        console.log("Display -> Skin showSiteMessage() " + ex.message);
2026    }
2027}
2028
2029function replaceSignInIcon() {
2030    try {
2031        console.log('%c Running replaceSignInIcon() ...', 'color: darkgreen; padding-left: 7em;');
2032        var currentHTML = $('div[id*=NOAHSignInUser] > a').html();
2033        $($('div[id*=NOAHSignInUser] > a')[1]).html('<i aria-hidden="true" class="fa fa-user"></i>&nbsp;' + currentHTML);
2034    }
2035    catch (ex) {
2036        console.log("ERROR -> Skin replaceSignInIcon() " + ex.message);
2037    }
2038}
2039
2040function toggleAMSOnlyItems() {
2041    try {
2042        $('[showamsonly]').hide();
2043
2044        if (isAMS) {
2045            $('[showamsonly]').show();
2046        }
2047    }
2048    catch (ex) {
2049        console.log(ex.message);
2050    }
2051}
2052
2053var JSTookLongerThenPageLoadOrReady = false;
2054var readyForLoad = false;
2055var loadAttempts = 0;
2056var defaultLoadOccured = false;
2057$(function pageLoad() {
2058    try {
2059        if (!defaultLoadOccured) {
2060            console.log('Running [Display.js] -> pageLoad()');
2061
2062
2063
2064            try {
2065                if (typeof turnOffHTML5Validation == 'function') { turnOffHTML5Validation(); }
2066            } catch (ex) {
2067                console.log(ex.message);
2068            }
2069
2070            try {
2071                if (typeof doLoadFiles == 'function') { doLoadFiles(); }
2072            } catch (ex) {
2073                console.log(ex.message);
2074            }
2075            defaultLoadOccured = true;
2076        }
2077        else {
2078            defaultLoadOccured = false;
2079        }
2080
2081        JSTookLongerThenPageLoadOrReady = true;
2082    } catch (ex) { console.log('Display.js pageLoad() ' + ex.message); }
2083    try { setupVisibleUpdates() } catch (ex) { console.log("%c\tWIDGET [visible updates] : " + ex.message, 'font-style: italic; color: slateblue;'); };
2084});
2085
2086$($(document).ready(function () {
2087    try {
2088        if (!defaultLoadOccured) {
2089            console.log('Running [Display.js] -> $(document).ready()');
2090
2091
2092
2093            try {
2094                if (typeof turnOffHTML5Validation == 'function') { turnOffHTML5Validation(); }
2095            } catch (ex) {
2096                console.log(ex.message);
2097            }
2098
2099            try {
2100                if (typeof doLoadFiles == 'function') { doLoadFiles(); }
2101            } catch (ex) {
2102                console.log(ex.message);
2103            }
2104            defaultLoadOccured = true;
2105        }
2106        else {
2107            defaultLoadOccured = false;
2108        }
2109
2110        JSTookLongerThenPageLoadOrReady = true;
2111    } catch (ex) { console.log('Display.js $(document).ready() ' + ex.message); }
2112    try { setupVisibleUpdates() } catch (ex) { console.log("%c\tWIDGET [visible updates] : " + ex.message, 'font-style: italic; color: slateblue;'); };
2113}));
2114
2115
2116
2117function turnOffHTML5Validation(hiddenOnly) {
2118    try {
2119        console.log('%c FIXING BROWSER BUG FOR INVISIBLE/HIDDEN VALIDATIONS (DISABLE)...', 'color: darkkhaki; padding-left: 7em; text-transform: uppercase;');
2120        if (hiddenOnly == null || hiddenOnly == undefined || hiddenOnly == 'undefined' || hiddenOnly == true) { hiddenOnly = true; }
2121
2122
2123        if (hiddenOnly) {
2124
2125            try {
2126                $('[required]:not(:visible)').attr('makeRequired', true).removeAttr('required');
2127            } catch (ex) {
2128                console.log(ex.message);
2129            }
2130        }
2131        else {
2132
2133            try {
2134                $('[required]').attr('makeRequired', true).removeAttr('required');
2135            } catch (ex) {
2136                console.log(ex.message);
2137            }
2138        }
2139
2140
2141    }
2142    catch (ex) {
2143        console.log(ex.message);
2144    }
2145}
2146
2147function turnOnHTML5Validation() {
2148    try {
2149        console.log('%c FIXING BROWSER BUG FOR INVISIBLE/HIDDEN VALIDATIONS (ENABLE)...', 'color: darkkhaki; padding-left: 7em; text-transform: uppercase;');
2150
2151
2152
2153        $('[makeRequired]').attr('required', 'required').removeAttr('makeRequired');
2154    }
2155    catch (ex) {
2156        console.log(ex.message);
2157    }
2158}
2159
2160var lastDoLoadFileAttempt = null;
2161var executedDoLoadFiles = false;
2162function doLoadFiles() {
2163    try {
2164        if (!executedDoLoadFiles) {
2165            console.log('Running [Display.js] -> doLoadFiles() readyForLoad=' + readyForLoad);
2166            $('.Slow-Load-Handler').hide();
2167
2168            if (readyForLoad) {
2169                executedDoLoadFiles = false;
2170                try {
2171                    if (typeof initNOAHSkin == 'function') {
2172                        initNOAHSkin();
2173                        executedDoLoadFiles = true;
2174                    }
2175                } catch (ex) {
2176                    console.log(ex.message);
2177                }
2178                try {
2179                    if (typeof clientAllJSFilesLoaded == 'function') {
2180                        clientAllJSFilesLoaded();
2181                        executedDoLoadFiles = (executedDoLoadFiles == true);
2182                    }
2183                } catch (ex) {
2184                    console.log(ex.message);
2185                }
2186                try {
2187                    if (typeof onDemandSetupDFBHTML5 == 'function') {
2188                        onDemandSetupDFBHTML5();
2189                        executedDoLoadFiles = (executedDoLoadFiles == true);
2190                    }
2191                } catch (ex) {
2192                    console.log(ex.message);
2193                }
2194
2195                loadAttempts = 0;
2196
2197                try {
2198                    if (typeof turnOnHTML5Validation == 'function') {
2199                        turnOnHTML5Validation();
2200                        executedDoLoadFiles = (executedDoLoadFiles == true);
2201                    }
2202                } catch (ex) {
2203                    console.log(ex.message);
2204                }
2205
2206                try {
2207                    var scriptToRun = null;
2208
2209                    if (!preRunStartUpScripts) { var preRunStartUpScripts = []; }
2210                    runStartUpScripts = $.unique(runStartUpScripts.concat(preRunStartUpScripts || []));
2211                    var functionNames = [];
2212                    runStartUpScripts = $(runStartUpScripts).map(function () { var fn_Name = this.name; if (functionNames.indexOf(fn_Name) < 0) { functionNames.push(fn_Name); return this; } })
2213
2214
2215
2216
2217
2218
2219
2220
2221                    runStartUpScripts = runStartUpScripts.toArray().reverse();
2222
2223                    $(runStartUpScripts).each(function () {
2224                        try {
2225                            scriptToRun = this.toString
2226                            if (typeof scriptToRun == 'function') {
2227                                console.log('%c Attempting to run startup script function -> "' + this.name.toString() + '"', 'text-transform: uppercase; padding-left: 5em; padding-right: 5em; font-size: 1.5em; color: #3081EE; background-color: #AEEAFF55; width: 100%; border-top: 1px solid #3081EE; border-bottom: 1px solid #3081EE;')
2228                                setTimeout(this, 250);
2229                            }
2230                        } catch (ex) {
2231                            console.log(ex.message);
2232                        }
2233                    });
2234                } catch (ex) {
2235                    console.log(ex.message);
2236                }
2237
2238                readyForLoad = false;
2239            }
2240            else {
2241                loadAttempts++;
2242                if (loadAttempts < 20) {
2243                    if (lastDoLoadFileAttempt) { clearTimeout(lastDoLoadFileAttempt); }
2244                    lastDoLoadFileAttempt = setTimeout(function () { try { if (typeof doLoadFiles == 'function') { doLoadFiles() } } catch (ex) { console.log(ex.message); } }, 250);
2245                }
2246                else {
2247                    readyForLoad = false;
2248                    loadAttempts = 0;
2249                    $('.Slow-Load-Handler').fadeIn();
2250                }
2251            }
2252        } else { executedDoLoadFiles = false; }
2253    }
2254    catch (ex) {
2255        console.log(ex.message);
2256    }
2257}
2258
2259try {
2260
2261    var loadingAnomalyDetected = false;
2262} catch (ex) { console.log(ex.message); }
2263
2264function allJSFilesLoaded() {
2265    try {
2266        try { allJSFilesLoaded_onBefore() } catch (ex) { console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;'); };
2267        console.log('Running [Display.js] -> allJSFilesLoaded()');
2268        readyForLoad = true;
2269
2270        if (JSTookLongerThenPageLoadOrReady) {
2271            console.log('%c Running [Display.js] -> LOADING ANOMALY... Code executing late, AFTER pageLoad() or $(document).ready(); Javascripts took too long to load...', 'text-transform: uppercase; padding-left: 5em; padding-right: 5em; font-size: 1.5em; color: #ffffff; background-color: #ff999955; width: 100%; border-top: 1px solid #980000; border-bottom: 1px solid #980000;');
2272            loadingAnomalyDetected = true;
2273
2274
2275
2276            try {
2277                if (typeof turnOffHTML5Validation == 'function') { turnOffHTML5Validation(); }
2278            } catch (ex) {
2279                console.log(ex.message);
2280            }
2281
2282            try {
2283                var isWindowInIFrame = false;
2284                try { isWindowInIFrame = (window.frameElement != null) } catch (ex) { console.log('ERROR Attempting to discover if window is in iFrame...' + ex.message); }
2285                if (!isWindowInIFrame) {
2286                    runStartUpScripts.push(setupFormattedStrings);
2287                }
2288                if (typeof doLoadFiles == 'function') { doLoadFiles(); }
2289            } catch (ex) {
2290                console.log(ex.message);
2291            }
2292            defaultLoadOccured = true;
2293        }
2294        try { allJSFilesLoaded_onAfter() } catch (ex) { console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;'); };
2295    }
2296    catch (ex) {
2297        console.log('Display -> Skin allJSFilesLoaded() ' + ex.message);
2298    }
2299}
2300
2301function setupVisibleUpdates(target) {
2302    try {
2303        var initialize = function (target) {
2304            try {
2305
2306                var selector = 'input' +
2307                    ':not([visibileUpdates*=initialized])' +
2308                    ':not([type="submit"])' +
2309                    ':not([type="button"])' +
2310                    ':visible,' +
2311                    'select' +
2312                    ':not([visibileUpdates*=initialized])' +
2313                    ':not([type="submit"])' +
2314                    ':not([type="button"])' +
2315                    ':visible';
2316
2317                if (target && target.toString().trim() != '') { selector = target; }
2318                var workFunction = function (sender, classToUse) { try { var ele = $(sender); var defaultClass = 'userRefreshUpdate'; var currentValue = ele.val(); if (!classToUse || classToUse.toString().trim() == '') { classToUse = defaultClass; } else { ele.removeClass(defaultClass); } ele.removeClass(classToUse); if (currentValue.toString() != '') { ele.addClass(classToUse); } } catch (ex) { console.log(ex.message); } };
2319                var updateFunction = function (sender) { try { var ele = $(sender); workFunction(sender, 'userUpdating'); ele.attr('visibileUpdates', 'initialized'); } catch (ex) { console.log(ex.message); } };
2320                $(selector).each(function () { workFunction(this) })
2321                $(selector).on('change blur', function () { updateFunction(this) });
2322
2323                try {
2324                    if (typeof setupVisibleUpdates_onAfter == 'function') { setupVisibleUpdates_onAfter(); }
2325                } catch (ex) {
2326                    console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;');
2327                }
2328
2329            } catch (ex) { console.log('setupVisibleUpdates setTimeout() ' + ex.message) }
2330        }
2331        setTimeout(initialize, 1000);
2332    } catch (ex) { console.log('Display -> Skin setupVisibleUpdates() ' + ex.message); }
2333}
2334
2335function allCSSFilesLoaded() {
2336    try {
2337        console.log('Running [Display.js] -> allCSSFilesLoaded()');
2338        try { allCSSFilesLoaded_onBefore() } catch (ex) { console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;'); };
2339
2340        try { allCSSFilesLoaded_onAfter() } catch (ex) { console.log("%c\tUser-Defined [EVENT] : " + ex.message, 'font-style: italic; color: #ccc;'); };
2341    }
2342    catch (ex) {
2343        console.log(ex.message);
2344    }
2345}
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375function handleBadge() {
2376    try {
2377        console.log('%c Running handleBadge() ...', 'color: darkgreen; padding-left: 7em;');
2378        var showBadge = false;
2379        var badgeArea = $('.User-Badge');
2380
2381        badgeArea.hide();
2382        showBadge = ($('.User-Badge-Photo').find('*').not('style').not('script').length > 0)
2383        if (showBadge) {
2384            badgeArea.show();
2385        }
2386    }
2387    catch (ex) {
2388        console.log(ex.message);
2389    }
2390}

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.