PageSourceSearch

https://madd.org/wp-content/themes/twentytwentyone-child/js/custom.js?ver=4569

js madd.org collected 2026-10-01 09:12:53 UTC 30,660 bytes, 811 lines download raw bytes

1/**
2 * Version: 1.0
3*/
4
5/* Functions */
6// initMap invoked by Google Map API
7function initMap() {
8    var mapContainer = document.getElementById("attorney-map");
9    var businessLatLong = jQuery('.business-lat-long');
10    var lat = long = labelnew = infoHtml = website = phone = address = email = fax = '';
11    var marker = lats = lngs = [];
12    var markerLocation = {};
13    var latAvg = lngAvg = 0;
14
15    if(mapContainer == null) return;    // Return if map container is not defined in HTML
16
17    // Get Map Center points
18    businessLatLong.map((index, element) => {
19        lat = element.attributes['data-lat'].nodeValue;
20        long = element.attributes['data-lng'].nodeValue;
21        lats = [...lats, Number(lat)];
22        lngs = [...lngs, Number(long)];
23        latAvg = (Math.max(...lats) + Math.min(...lats)) / 2;
24        lngAvg = (Math.max(...lngs) + Math.min(...lngs)) / 2;
25    });
26
27    var mapOptions = {
28        zoom: 5,
29        center: new google.maps.LatLng(latAvg, lngAvg),
30        mapTypeId: google.maps.MapTypeId.ROADMAP
31    };
32    const map = new google.maps.Map(mapContainer, mapOptions);
33
34    var infoWindow = [];
35    // Add pointers with info window to the map.
36    businessLatLong.map((index, element) => {
37        lat = element.attributes['data-lat'].nodeValue;
38        long = element.attributes['data-lng'].nodeValue;
39
40        markerLocation = {
41            position: new google.maps.LatLng(lat, long),
42        }
43        marker[index] = new google.maps.Marker(markerLocation);
44        marker[index].setMap(map);
45
46        infoWindow[index] = new google.maps.InfoWindow({
47            content: "",
48            disableAutoPan: false,
49        });
50        marker[index].addListener("click", () => {
51            lat = element.attributes['data-lat'].nodeValue;
52            long = element.attributes['data-lng'].nodeValue;
53            title = element.attributes['data-title'].nodeValue;
54            website = element.attributes['data-website'].nodeValue;
55            phone = element.attributes['data-phone'].nodeValue;
56            email = element.attributes['data-email'].nodeValue;
57            fax = element.attributes['data-fax'].nodeValue;
58            
59            title = (title != '')? `<p><strong>${title}</strong></p>` : '';
60            website = (website != '')? `<p>Website: <a href="${website}" target="_blank" class="text-red">Visit Site</a></p>` : '';
61            phone = (phone != '')? `<p>Phone: <a href="tel:${phone}" class="text-red">${phone}</a></p>` : '';
62            fax = (fax != '')? `<p>Fax: ${fax}</p>` : '';
63            email = (email != '')? `<p>Email: <a href="mailto:${email}" class="text-red">${email}</a></p>` : '';
64            address = `https://www.google.com/maps/search/${lat},${long}/@${lat},${long},17z`;
65            mapLink = `<p><a href="${address}" target="_blank" class="text-red">View on Google Map</a></p>`;
66
67            infoHtml = `<div style="padding: 10px 10px 0px 10px; font-size: 12px;">
68                            <div style="margin-bottom: 10px;display: flex; flex-direction: column; row-gap: 2px;">
69                                ${title}
70                                ${website}
71                                ${phone}
72                                ${fax}
73                                ${email}
74                                ${mapLink}
75                            </div>
76                        </div>`;
77            infoWindow[index].setContent(infoHtml);
78            infoWindow[index].open(map, marker[index]);
79        });
80    });
81}
82
83function close_history_modal(){
84    jQuery('#history-data-modal-wrapper').css({'display':'none'});
85    jQuery('#year-data-wrapper').css({'overflow-y':'auto'});
86}
87
88
89/* Document Ready */
90jQuery(document).ready(function($){
91
92    if($('body').hasClass('drunk-driving')){ // if is_page 'drunk-driving'
93        setTimeout(() => {
94            var slider1 = jQuery('#doy-slide-1 .swiper-container');
95            var slider1Instance = slider1.data( 'swiper' );
96            console.log('slider1Instance', slider1Instance);
97            var slider2 = jQuery('#doy-slide-2 .swiper-container');
98            var slider2Instance = slider2.data('swiper');
99            console.log('slider2Instance', slider2Instance);
100            slider2Instance.controller.control = slider1Instance;
101        }, 1000);
102    }
103    if($('body').hasClass('find-a-local-office')){ // if is_page 'find-a-local-office'
104        var query = window.location.search;
105        if (query != '') {
106            $('#find-local-madd')[0].scrollIntoView();
107        }
108    }
109
110    /* Save a life section homepage */
111    if(jQuery("#donate_save div.elementor-element").hasClass("selected")) {
112       jQuery("#donate_save div.selected a").addClass("active");
113    }
114
115    jQuery('#donate_save div.elementor-element .elementor-button-wrapper a').on('click', function(){
116        jQuery("#donate_save div.selected a").removeClass("focused");
117    });
118
119    jQuery('#donate_save div.donate-array .elementor-button-wrapper a').click(function () {
120        jQuery("#donate_save div.donate-array .elementor-button-wrapper a").removeClass('active');
121        jQuery(this).addClass('active');
122    });
123
124    /* Home page Save a life button */
125    var reactwait = setInterval(function(){ 
126        if(document.querySelectorAll(".cta_save_a_life").length > 0){
127            clearInterval(reactwait);
128            var giftArray  = document.querySelectorAll(".donate-array");
129            var button = document.getElementById("cta_save_a_life");
130            var other = document.getElementById("cta_other_amount");
131            var url = "https://secure.madd.org/page/66702/donate/1?transaction.donationAmt=";
132            button.addEventListener("click", function(e){
133                e.preventDefault();
134                if(other.value != "" && parseInt(other.value) > 0){
135                    console.log("value:" + other.value);
136                    var newUrl ="";
137                    newUrl= url+other.value;
138                    window.open(newUrl, '_self');
139                }
140            });
141            giftArray.forEach(function(ga){
142                ga.addEventListener("click", function(e){
143                    e.preventDefault();
144                    document.getElementById("cta_other_amount").value = this.id;
145                    var x = parseInt(this.id);
146                    onChangeOther(x);    
147                });
148            });
149            document.querySelector("#cta_other_amount").addEventListener("change",function(){
150                var x = parseInt(this.value);
151                onChangeOther(x);
152            })
153            document.querySelector("#cta_other_amount").addEventListener("keyup",function(){
154                var x = parseInt(this.value);
155                onChangeOther(x);        
156            })
157        }
158    },10);
159
160    function onChangeOther(x){
161        if(x != NaN && x > 0){
162            document.querySelector("#donate_save .donate-other span.left").classList.add("input-dollar");
163        }else{
164            document.querySelector("#donate_save .donate-other span.left").classList.remove("input-dollar");
165        }
166    }
167
168    jQuery("#cta_save_a_life").one("click", function() {
169        window.location = "https://secure.madd.org/page/66702/donate/1?transaction.donationAmt=50";  
170    });
171
172    /* Home page Gallery Donate now button */
173    if ( $('body').hasClass('page-id-1800') || $('body').hasClass('page-id-3452') ) {
174        document.getElementById("cta_donate_amount").defaultValue = "50";
175        document.querySelector("#gallery-section .help-victims div.left").classList.add("input-dollar");
176        document.querySelector("#gallery-section .help-victims div.content .left").classList.add("input-dollar");
177    }
178    
179    jQuery( "#cta_donate_now" ).click(function(e) {
180        e.preventDefault();  
181        var url = "https://secure.madd.org/page/66702/donate/1?transaction.donationAmt="; 
182        var donate_value = $("#cta_donate_amount").val(); 
183        
184        if(donate_value != '' && donate_value > 0){
185            var newUrl ="";
186            newUrl= url+donate_value;
187            window.open(newUrl, '_self');
188        }
189    });
190
191    // Tab click
192    $('#gallery-section .elementor-widget-wrap .elementor-widget-wrap').click(function(event){
193        event.stopPropagation();
194        var link = $(this).find('.elementor-heading-title a'),
195        url = (link[0].href != undefined)? link[0].href : '',
196        target = link.attr('target');
197
198        target = ( target== undefined ) ? '' : `target="${target}"`;
199        
200        if (url.length > 0) {
201            $('body').append(`<a id="temp_link" href='${url}' ${target}></a>`);
202            $('#temp_link')[0].click();
203            $('#temp_link').remove();
204        }
205    });
206
207    // Set style of first Tab button
208    $('section[id*="tabs-list"]').map((index, ele)=>{
209        $(ele).find('.tab-btn:first .elementor-button').addClass('active');
210    });
211   
212    // Tabs Hide / Show on page load
213    var hash = window.location.hash;
214    if(hash != ''){
215        hash = hash.split('#')[1];
216        var link = $('section[id*=tabs-list]').find('a[data-target*='+hash+'-tab]'),
217        tab_btn_section = link.closest('section[id*=tabs-list]');
218
219        if(link.length > 0 ){
220            // Change style of Tab button
221            tab_btn_section.find('.tab-btn .elementor-button').removeClass('active');
222            tab_btn_section.find('a[data-target*='+hash+'-tab]').addClass('active');
223
224            // Hide all tabs and show the selected tab
225            // tab_btn_section.nextUntil('.elementor-section:not(.tab)').fadeOut('fast');
226            // $('#'+hash+'-tab').fadeIn();
227            
228            console.log('hash', hash);
229            console.log('tab', $('.elementor-button[data-target*='+hash+'-tab'));
230            setTimeout(() => {
231                $('.elementor-button[data-target*='+hash+'-tab').click();
232            }, 100);
233
234            $('html, body').animate({
235                scrollTop: $("#tabs-list").offset().top
236            }, 500);
237        }
238    }
239
240    // Tabs Hide / Show on button click
241    $('.tab-btn .elementor-button').click(function(event){
242        event.preventDefault();
243        event.stopPropagation();
244
245        // Get the Tab ID from data-target attribute of button
246        var tab_id = $(this).attr('data-target'),
247        tab_btn_section = $(this).closest('section[id*=tabs-list]');
248
249        // Change style of Tab button
250        tab_btn_section.find('.tab-btn .elementor-button').removeClass('active');
251        $(this).addClass('active');
252
253        // Hide all tabs and show the selected tab
254        tab_btn_section.nextUntil('.elementor-section:not(.tab)').fadeOut('fast');
255        $('#'+tab_id).fadeIn(); // #blog-tab, #psa-tab, #position-tab
256    });
257
258
259    $('.tab-btn .elementor-button').click(function() {
260        $('section#tabs-list').find('.tab-btn').removeClass('current');
261    });
262
263
264    // Stats post description Hide / Show
265    function init_why21_content_display() {
266        $('.stat-btn').click(function(event){
267            event.preventDefault();
268            $(this).siblings('.stat-detail').slideToggle();
269    
270            $('.stat-btn i').removeClass('fas fa-angle-up').addClass('fas fa-angle-down');
271            $(this).find('i').removeClass('fas fa-angle-down').addClass('fas fa-angle-up');
272        });
273    
274        // Why 21? Category Change text View Answer to Close Answer
275        $(".why-21-answer").click(function() {
276            var htmlText = $(this).find(".elementor-button-text").text();
277            if(htmlText == "View Answer") {
278                $(this).find(".elementor-button-text").text("Close Answer");
279            } else {
280                $(this).find(".elementor-button-text").text("View Answer");
281            }    
282        });
283    }
284    init_why21_content_display(); // Initiate event on content buttons
285    
286    // Why 21? Myths load more tab
287    $( '#guest-tab' ).delegate( '.stat-btns', 'click', function(e) {
288        e.preventDefault();
289        $(this).siblings('.stat-detail').slideToggle();
290        $('.stat-btn i').removeClass('fas fa-angle-up').addClass('fas fa-angle-down');
291        $(this).find('i').removeClass('fas fa-angle-down').addClass('fas fa-angle-up');
292    });
293
294
295    // History page Year timeline
296    $('.year a.elementor-button').click(function(event){
297        event.preventDefault();
298    });
299    $('.year').click(function(event){
300        event.preventDefault();
301        $('.year').removeClass('year-active');
302        $(this).addClass('year-active');
303
304        var year = $(this).find('a.elementor-button');
305        var target = year.attr('data-target');
306
307        $('#'+target+'-data').attr('tabindex','-1');
308        $('#'+target+'-data').focus();
309    });
310
311    /* History page timeline section focus*/
312    $.fn.isInViewport = function() {
313        var elementTop = $(this).offset().top;
314        var elementBottom = elementTop + $(this).outerHeight();
315        var viewportTop = $('#year-data-wrapper').scrollTop();
316        var viewportBottom = viewportTop + $('#year-data-wrapper').height();
317        return elementBottom > viewportTop && elementTop < viewportBottom;// && in_center;
318    };
319    $('#year-data-wrapper').on('resize scroll', function() {
320        $('.year-group').each(function(){
321            if($(this).isInViewport()){
322                var target = $(this).attr('id');
323                $('.year').removeClass('year-active');
324                $('.year[data-target='+target+']').addClass('year-active');
325            }
326        });
327    });
328
329    // History fetch post content
330    $('.timelineCont .post-title').click(function(){
331        var post_id = $(this).attr('data-value');
332        var data = new FormData();
333        data.append('action', 'load_history');
334        data.append('post_id', post_id);
335        $.ajax({
336            url: ajaxUrl,
337            type: 'post',
338            data: data,
339            contentType: false,
340            processData: false,
341            success: function(response){
342                $('#history-data-modal-wrapper').html(response);
343            },
344            error: function(response){
345                console.log(response);
346            }
347        });
348    });
349    
350    // Light a Candle page search
351    $('#candle-search').on('change' ,function(event){
352        console.log($(this).val());
353        var formData = new FormData;
354        formData.append('action','search_candles');
355        formData.append('search_term',$(this).val());
356        $.ajax({
357            url: ajaxUrl,
358            type: 'post',
359            data: formData,
360            processData: false,
361            contentType: false,
362            success: function(response){
363                console.log(response);
364                $('#candles-list').html(response);
365            },
366            error: function(response){
367                console.log(response);
368            }
369        });
370    });
371
372    //load more candles
373    var pageNo = 0;
374    $('#load-more-candles').on('click' ,function(event){
375        event.preventDefault();
376        console.log(pageNo);
377        var formData = new FormData;
378        formData.append('action','load_more_candles');
379        formData.append('page_no',pageNo);
380        formData.append('search_term',$('#candle-search').val());
381        $.ajax({
382            url: ajaxUrl,
383            type: 'post',
384            data: formData,
385            processData: false,
386            contentType: false,
387            success: function(response){
388                $('#candles-list').html(response);
389                pageNo++;
390            },
391            error: function(response){
392                console.log(response);
393            }
394        });
395
396    });
397
398    /* Footer section phone number field validate only number */
399    $("#gform_6 .phone-number input[name='input_2']").on('input', function(e) {
400        $(this).val($(this).val().replace(/[^0-9\s]/g, ''));
401    });
402    $("#gform_* .phone-number input[name='input_*']").on('input', function(e) {
403        $(this).val($(this).val().replace(/[^0-9\s]/g, ''));
404    });
405    $("#gform_13 .zipcode-field input[name='input_17']").on('input', function(e) {
406        $(this).val($(this).val().replace(/[^0-9\s]/g, ''));
407    });
408    $("#gform_15 .zipcode-field input[name='input_5']").on('input', function(e) {
409        $(this).val($(this).val().replace(/[^0-9\s]/g, ''));
410    });
411
412    $('.header-cta-wrapper-mobile .header-help-btn').click(function(){
413        
414        $(this).text(function(i, text){
415          return text === "24/7 Help" ? "877-MADD-HELP" : "24/7 Help";
416        })
417         
418    });
419   
420
421    /* History page timeline section social buttons  */
422    var page_url = window.location.href;
423    if ( window.location.hash != '' ) {
424        var section_id = window.location.hash;
425        var url_obj = window.location.valueOf('history');
426        if( url_obj.pathname == '/history/' && section_id ){
427            c_year = section_id.split('#');
428            $('.year a[data-target="'+c_year[1]+'"]').trigger('click');
429            window.location.href = window.location.href;
430        }
431    }
432
433    /* History page timeline section modal popup  */
434    jQuery('.year-group .post-title').click(function() {
435        var div_id = jQuery(this).closest('article').attr('id');
436        if( div_id == '2021-data') {
437            jQuery('#history-data-modal-wrapper').css({'top': 0});
438        }
439        else {
440            var first = jQuery('#year-data-wrapper .elementor-widget-container').innerHeight();     //first element distance from top
441            var second = jQuery('#history-data-modal-wrapper').innerHeight(); 
442            var distance = parseInt(first-second);
443            jQuery('#history-data-modal-wrapper').css({'top': distance});
444        }
445    });   
446
447    /* Leadership page tabs */
448    var selector = '.leader-link a';
449    $(selector).click(function(e){
450        e.preventDefault();
451        var id = $(selector).parents().eq(8).attr('id');
452        var content = $(this).closest('article',id).find('.leader-details').html();
453        var desc = content;
454        if (content!= '') {
455            var details = $('body').find('section.leader-details-popup').html(desc).show();
456            
457            $('body').find('section#directors-tab').hide();
458            $('body').find('section#executive-tab').hide();
459        }
460        $('html, body').animate({
461            scrollTop: $("#tabs-list").offset().top
462        }, 500);
463    });
464
465    $('#tabs-list .tab-btn').click(function() {
466        $('body').find('section.leader-details-popup').hide();
467    });
468
469    $(document).on('click', 'section.leader-details-popup .back-board a', function(e){
470        e.preventDefault();
471        $('body').find('section#directors-tab').show();
472        $('body').find('section.leader-details-popup').css({'display':'none'});
473        $('html, body').animate({
474        scrollTop: $("#tabs-list").offset().top
475        }, 500);
476    });
477
478    $(document).on('click', 'section.leader-details-popup .back-executive a', function(e){
479        e.preventDefault();
480        $('body').find('section#executive-tab').show();
481        $('body').find('section.leader-details-popup').css({'display':'none'});
482        $('html, body').animate({
483            scrollTop: $("#tabs-list").offset().top
484        }, 500);
485    });
486        
487    /* Drunk driving page timer */
488    if(jQuery('body').is('.page-id-2196')){
489        var timerstatus = 0;
490        function isInViewport(el) {
491            const rect = el.getBoundingClientRect();
492            return (
493                rect.top >= 0 &&
494                rect.left >= 0 &&
495                rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
496                rect.right <= (window.innerWidth || document.documentElement.clientWidth)
497
498            );
499        }
500
501        const box = document.querySelector('#countdown');
502        document.addEventListener('scroll', function () {
503            if(isInViewport(box) && timerstatus == 0){
504                function makeTwoDigits(n){
505                    return (n < 10 ? "0" : "") + n;
506                }
507                var timeleft = 56;
508                var downloadTimer = setInterval(function(){
509                    if(timeleft <= 0){
510                    clearInterval(downloadTimer);
511                    document.getElementById("countdown").innerHTML = "00";
512                    } else {
513                    document.getElementById("countdown").innerHTML = makeTwoDigits(timeleft);
514                    }
515                    timeleft -= 1;
516                    if (timeleft == 0) {
517                    fn();
518                    timeleft = 56;
519                    return;
520                    }
521
522                    function fn() {
523                    console.log("timer reset");
524                    }
525                }, 1000);
526                timerstatus = 1;
527            }
528
529        }, {
530            passive: true
531        });
532    }
533
534    /* News page psa tab slider */
535    jQuery(".tab-btn .elementor-button[data-target='psa-tab']").click(function(){
536        jQuery('#psa-tab').css({'height':'auto'});
537        jQuery('#psa-heading').css({'display':'block'});
538    });   
539
540    jQuery(".tab-btn .elementor-button[data-target='psa-tab']").on('click', function() {
541        setTimeout(function() {
542            jQuery('.psa-posts').slick("getSlick").refresh();
543        },100);
544    });
545
546    /* Law enforcement page tabs slider */
547    /*if ( $('body').hasClass('law-enforcement-support') ) {
548        jQuery(".tab-btn .elementor-button[data-target*='-tab']").on('click', function() {
549            setTimeout(function() {
550                jQuery('.les_slider').slick("getSlick").refresh();
551            },100);
552        });
553        jQuery(".tab-btn .elementor-button[data-target='guest-tab']").click(function(){
554            jQuery('#guest-tab').css({'height':'auto'});
555            setTimeout(function() {
556                jQuery('.les_slider').slick("getSlick").refresh();
557            },100);
558        }); 
559    }*/
560    if ( $('body').hasClass('law-enforcement-support') ) {
561        jQuery(".tab-btn .elementor-button[data-target='lodd-tab']").on('click', function() {
562        jQuery('#lodd-tab .wp_rss_retriever_image .feed-desc img').each(function() {
563            var this_src = jQuery(this).attr('src');
564            this_src = this_src.replace('thumb/50', 'thumb/150');
565            jQuery(this).attr('src',this_src);
566        });
567        });
568    }
569
570
571    jQuery(window).load(function() {
572    var les_url = window.location.href;
573    var pathname = window.location.pathname;
574    //console.log(pathname);
575    var les_hash = window.location.hash;
576    setTimeout(function() {
577        
578        if ( les_hash == "#LODD" ) {
579            window.location.replace("https://madd.org/law-enforcement-support/#lodd");
580            window.
580location.reload(1);
581        }
582        /*else if (les_hash == "#mission_moment" || les_hash == "#mission") {
583            window.location.replace("https://madd.org/law-enforcement-support/#mission");
584            //window.location.reload("https://madd.org/law-enforcement-support/#mission");
585        }*/
586        else if (les_hash == "#officer_of_the_month") {
587            window.location.replace("https://madd.org/law-enforcement-support/#officer");
588            window.location.reload(1);
589        }
590        else if (les_hash == "#guest_author") {
591            window.location.replace("https://madd.org/law-enforcement-support/#guest");
592            window.location.reload(1);
593        }
594        else if (les_hash == "#Resources") {
595            window.location.replace("https://madd.org/law-enforcement-support/#resources");
596            window.location.reload(1);
597        }
598        jQuery('html, body').animate({
599            scrollTop: jQuery("#tabs-list").offset().top
600        }, 500);
601    
602    },500);
603    
604    });
605
606    /* Find a local office page scroll to map */
607    jQuery(window).load(function() {
608        if(jQuery('body').is('.page-id-3452')){
609            var href = new URLSearchParams(window.location.search); 
610            var distance = href.get('distance');
611            if (distance!== null) {
612                jQuery('html, body').delay(1500) //wait 1 second
613                    .animate({
614                    'scrollTop': jQuery('#find-local-madd').offset().top
615                }, 0.4);
616            }
617        }
618    });
619
620    var values = jQuery.map(jQuery('#gmw-distance-1 option'), function(e) { return e.value; });
621    values.join(',');
622    jQuery("<option></option>").attr("value", values).text(" Miles").appendTo('#gmw-distance-1 option:not(:first)');
623
624    /* career detail page apply button*/
625    jQuery("#apply-career a").click(function(){
626        $('body').find('.tab-btn .elementor-button[data-target="apply-tab"]').addClass('active');
627        $('body').find('.tab-btn .elementor-button[data-target="role-tab"]').removeClass('active');    
628        $('body').find('section#apply-tab').css({'display':'block'});
629        $('body').find('section#role-tab').css({'display':'none'});
630        $('html, body').animate({
631        scrollTop: $("#tabs-list").offset().top
632        }, 500);
633    });
634
635    /* career page filter */
636    var state = 0;
637    var role = 0;
638    jQuery("#state_filter").change(function () {
639        state = this.value;
640        role = (role == '' || role == undefined) ? '*' : role;
641        var formData = new FormData;
642        formData.append('action','career_search');
643        formData.append('state', state);
644        formData.append('role', role);
645        $.ajax({
646            url: ajaxUrl,
647            type: 'post',
648            data: formData,
649            processData: false,
650            contentType: false,
651            success: function(response){
652                $('#careers-detail').html(response);
653            },
654            error: function(response){
655                console.log(response);
656            }
657        });
658    });
659    jQuery("#role_filter").change(function () {
660        role = this.value;
661        state = (state == '' || state == undefined) ? '*' : state;
662        var formData = new FormData;
663        formData.append('action','career_search');
664        formData.append('state', state);
665        formData.append('role', role);
666        $.ajax({
667            url: ajaxUrl,
668            type: 'post',
669            data: formData,
670            processData: false,
671            contentType: false,
672            success: function(response){
673                $('#careers-detail').html(response);
674            },
675            error: function(response){
676                console.log(response);
677            }
678        });
679    });
680
681    // Advanced technology page
682    $(".view-principle-up1 p").click(function(){
683        $("#fourkey-content1 ").toggle();
684    });
685    $(".view-principle-up2 p").click(function(){
686        $("#fourkey-content2 ").toggle();
687    });
688    $(".view-principle1 p").click(function(){
689        $("#view-principle-content3 ").toggle();
690    });
691    $(".view-principle2 p").click(function(){
692        $("#view-principle-content4").toggle();
693    });
694
695    /* Drugged driving page read more */
696    jQuery('.drugged-section .drug-read').click(function () {
697        var readshow = jQuery(this).siblings('.drugged-section .elementor-widget-wrap .show-more');
698        jQuery(readshow).show();
699        var backtop = jQuery(this).closest('.drugged-section .elementor-widget-wrap .drug-read');
700        jQuery(backtop).hide();
701        return false;
702    });
703
704    /* Influence page copy caption */
705    jQuery('.copy_text').click(function (e) {
706        e.preventDefault();
707        var copyText = jQuery(this).data('content');
708        jQuery(this).find('span').text("Copied");
709
710        document.addEventListener('copy', function(e) {
711            e.clipboardData.setData('text/plain', copyText);
712            e.preventDefault();
713        }, true);
714
715        document.execCommand('copy');
716    });
717
718    /* Sticky Header */
719    var scroll_pos = 0;
720    var url = window.location.origin;
721    jQuery(window).scroll(function(){
722        scroll_pos = jQuery(this).scrollTop();
723        //if(jQuery(window).scrollTop() > jQuery(window).height()){
724        if(scroll_pos > 110) {
725            jQuery("#masthead").addClass('sticky');
726        }
727        else{
728            jQuery("#masthead").removeClass('sticky');
729            jQuery("#masthead").css({"position":"absolute"});
730        }
731
732    });
733
734    /* Law enforcement page initially active latest year month */
735    if($('body').hasClass('law-enforcement-support')){ // if is_page 'find-a-local-office'
736        let searchParams = new URLSearchParams(window.location.search);
737        let year = searchParams.has('yr');
738        let month = searchParams.has('mn');
739        if (year =='' && month =='') {
740            jQuery('.doy-date-archive-wrapper ul').eq(0).find('.doy-month:last-child').addClass('active');
741        }
742        jQuery(".tab-btn .elementor-button[data-target='guest-tab']").click(function(){
743            if (year =='' && month =='') {
744                jQuery('#guest-tab .doy-date-archive-wrapper ul').eq(0).find('.doy-month:last-child').addClass('active');
745            }
746        }); 
747        jQuery(".tab-btn .elementor-button[data-target='officer-tab']").click(function(){
748            if (year =='' && month =='') {
749                jQuery('#officer-tab .doy-date-archive-wrapper ul').eq(0).find('.doy-month:last-child').addClass('active');
750            }
751        });
752
753        /*var les_width = jQuery('.les-content .les-detail').find('.les-img-col');
754        //jQuery('.les-content .les-detail').find('.les-img-col').addClass('les-width');
755        jQuery('.les-content .les-detail').find('.les-img-col');
756        if(les_width.has('img')) {
757            console.log("hello");
758            les_width.hide();
759        }*/ 
760    }
761
762
763    /* News page psa tabs */
764    jQuery('.psa-posts').slick({
765        slidesToShow: 3,
766        slidesToScroll: 1,
767        infinite: true,
768        /*autoplaySpeed: 3000,*/
769        autoplay: false,
770        arrows: true,
771        responsive: [
772            /*{
773                breakpoint: 1300,
774                settings: {
775                    arrows: true,
776                    slidesToShow: 3,
777                    dots: false,
778                }
779            },*/
780            {
781                breakpoint: 990,
782                settings: {
783                arrows: false,
784                slidesToShow: 2,
785                dots: true,
786                }
787            },
788            {
789                breakpoint: 480,
790                settings: {
791                arrows: false,
792                slidesToShow: 1,
793                dots: true,
794                }
795            }
796        ]
797    });
798
799    /* Law enforcement page content slider */
800    jQuery('.les_slider').slick({   
801        slidesToShow: 1,
802        slidesToScroll: 1,
803        infinite: true,
804        autoplay: false,
805        arrows: true,
806        dots: true,
807        adaptiveHeight: true, 
808
809    });
810
811});

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.