PageSourceSearch

https://www.peraton.com/wp-content/themes/JointsWP-CSS-master/assets/scripts/scripts.js?ver=1790200668

js peraton.com collected 2026-09-24 18:16:30 UTC 13,720 bytes, 443 lines download raw bytes

1jQuery(document).foundation();
2/*
3These functions make sure WordPress
4and Foundation play nice together.
5*/
6jQuery(document).ready(function() { // Remove empty P tags created by WP inside of Accordion and Orbit
7    jQuery('.accordion p:empty, .orbit p:empty').remove(); // Adds Flex Video to YouTube and Vimeo Embeds
8    jQuery('iframe[src*="youtube.com"], iframe[src*="vimeo.com"]').each(function() { if (jQuery(this).innerWidth() / jQuery(this).innerHeight() > 1.5) { jQuery(this).wrap("<div class='widescreen responsive-embed'/>"); } else { jQuery(this).wrap("<div class='responsive-embed'/>"); } });
9});
10
11function getScrollbarWidth() {
12
13    // Creating invisible container
14    const outer = document.createElement('div');
15    outer.style.visibility = 'hidden';
16    outer.style.overflow = 'scroll'; // forcing scrollbar to appear
17    outer.style.msOverflowStyle = 'scrollbar'; // needed for WinJS apps
18    document.body.appendChild(outer);
19  
20    // Creating inner element and placing it in the container
21    const inner = document.createElement('div');
22    outer.appendChild(inner);
23  
24    // Calculating difference between container's full width and the child width
25    const scrollbarWidth = (outer.offsetWidth - inner.offsetWidth);
26  
27    // Removing temporary elements from the DOM
28    outer.parentNode.removeChild(outer);
29  
30    return scrollbarWidth;
31  
32}
33
34jQuery(document).ready(function($) {
35
36
37       //$('#mega-menu-item-1583').addClass('mega-toggle-on');
38    /*
39    $('#fullpage').fullpage({
40        //options here
41        autoScrolling:true,
42        scrollHorizontally: false,
43        licenseKey: '2C3DA3BE-C71B47EC-85DD649C-C7E67A89'
44    });
45    */
46
47    if ($('body.home').length > 0) {
48
49        // remove width of scrollbar from header
50        jQuery("header.header").css("width", "calc(100% - " + getScrollbarWidth() + "px)");
51        // console.log("Scroll width: " + getScrollbarWidth());
52
53
54
55        jQuery("#home-hero-video").addClass('fadein');
56
57
58        
59
60
61        $('.entry-content > .section-group').each(function(index,item){
62
63            $(this).attr('id','slideitem-'+ index);
64
65            $('.section-wheel').append('<div class="dot"></div>');
66
67        });
68        $('.section-wheel .dot:eq(0)').addClass('active');
69
70
71
72        $('.section-wheel .dot').on('click',function(e){
73
74            clickindex = $(this).index();
75            //clickindex = clickindex + 1;
76            // console.log('#slideitem-'+clickindex);
77            el = $('#slideitem-'+clickindex);
78            
79            //$section = $('#slideitem-'+clickindex);
80            //console.log($section);
81            //$('.section-wheel .dot').removeClass('active');
82            //$(this).addClass('active')
83
84            $('.main').addClass('scrolling');
85            $('.main .entry-content').animate({
86                scrollTop: $('.main .entry-content').scrollTop() + el.offset().top
87                
88            }, 1000,function(){
89                $('.main').removeClass('scrolling');
90                $('.main').trigger('scroll');
91            });
92           
93
94
95        });
96
97     
98        $('.home .next').on('click',function(e){
99
100            el = $(this).parents('.section-group').next('.section-group');
101
102            // console.log(el);
103          
104            $('.main').addClass('scrolling');
105            $('.main .entry-content').animate({
106                scrollTop: $('.main .entry-content').scrollTop() + el.offset().top
107                
108            }, 1000,function(){
109                $('.main').removeClass('scrolling');
110                $('.main').trigger('scroll');
111            });
112           
113
114        });
115
116
117
118
119        ScrollTrigger.create({
120            start: 'bottom 94% ',
121            end: 'top',
122            trigger: "section.slide-awards",
123            onEnter: () => jQuery("body").addClass('disablesnap'),
124            onEnterBack: () => jQuery("body").removeClass('disablesnap')
125        });
126
127
128      //markers: {startColor: "green", endColor: "red", fontSize: "12px"},
129
130    }
131
132
133
134    $('.home .main .entry-content').on('scroll',function(e){
135
136        var scroll = $('.home .main .entry-content').scrollTop();
137        //console.log(scroll)
138
139        if(scroll > 20) {
140            $('header').addClass('is-stuck')
141        } else {
142             $('header').removeClass('is-stuck')
143        }
144
145
146
147        var timer;
148         clearTimeout(timer);        
149                                  
150                         
151        timer = setTimeout(function(){               
152        
153            $('.entry-content > .section-group').each(function(){
154
155                thistop = $(this).offset().top;
156               // console.log(thistop);
157                if(thistop < 10 && thistop >= 0) {
158                    sectionindex = $(this).index();
159                    //console.log("top: " + thistop);
160                    //$('.entry-content > .section-group').removeClass('section-on');
161                    //$(this).addClass('section-on');
162                    // console.log("SECTION: " + sectionindex);
163                    $('.section-wheel .dot').removeClass('active');
164                    $('.section-wheel .dot:eq('+sectionindex+')').addClass('active')
165                }
166
167                //$('.section-group').removeClass('done');
168            });
169         }, 500);
170
171
172
173    });
174
175/*
176    $('#fullpage').fullpage({
177        //options here
178        licenseKey:'2C3DA3BE-C71B47EC-85DD649C-C7E67A89',
179
180
181    });
182
183*/
184
185
186    $('.home .footer').addClass('section-group');
187
188    $('.page-news .mega-sub-menu .mega-menu-item').removeClass('mega-current-menu-item')
189
190
191    jQuery(document).on('click', '.button', function(e){
192    //e.preventDefault();
193      var buttontimer;
194      jQuery(this).addClass('click');
195          clearTimeout(buttontimer);
196          buttontimer = setTimeout(function(){
197          jQuery('.button').removeClass('click');
198      }, 300);
199
200  });
201
202
203
204    $('.peraton-lines-off ').each(function() {
205        $(this).find('.peraton-lines__single').each(function(index) {
206            $(this).css('transition-property', 'margin');
207            $(this).css('transition-delay', (100 * index) + 'ms');
208        })
209    });
210
211
212    if('span.readingtime'){
213        // console.log('time');
214        text= $('.post-content').text();
215        wpm=225;
216        words = text.trim().split(/\s+/).length;
217        time = Math.ceil(words / wpm);
218        readingtime = time + ' min read';
219        // console.log(words);
220        // console.log(time);
221
222        $('span.readingtime').text(readingtime);
223
224        hasintro = $('.peraton-meta + h4').length;
225        if (hasintro > 0) {
226            $('.peraton-meta').insertAfter('.peraton-meta + h4');
227        }
228
229        haslist = $('.peraton-meta + ul').length;
230        if (haslist > 0) {
231            $('.peraton-meta').insertAfter('.peraton-meta + ul');
232        }
233
234    }
235
236
237     if ($('.hero-wrap').length > 0) {
238        $('.hero-wrap .inner-content > .cell:first-child').append('<span class="scroller"></span>');
239    
240        $('.scroller').on('click',function(){
241                $([document.documentElement, document.body]).animate({
242                scrollTop: $(".content").offset().top - 80
243                }, 1000);
244        })
245
246
247    }
248
249
250
251
252    if ($('section.category-posts').length > 0) {
253        $('section.category-posts .inner-content.post-grid').addClass('owl-carousel owl-theme');
254
255        var heroowl = $('section.category-posts .inner-content.post-grid').owlCarousel({
256            //animateOut: 'fadeOut',
257            //animateIn: 'fadeIn',
258            margin: 0,
259            loop: false,
260            dots: false,
261            center: false,
262            startPosition: 0,
263            nav: true,
264            stagePadding:75,
265            autoplayHoverPause: true,
266            autoHeight: true,
267            autoplaySpeed: 1000,
268            navSpeed: 1000,
269            dotsSpeed: 1000,
270            autoWidth: false,
271            navText: ['<span class="mv-left"><img src="/wp-content/themes/JointsWP-CSS-master/assets/images/arrow-left.svg"></span> ', ' <span class="mv-right"><img src="/wp-content/themes/JointsWP-CSS-master/assets/images/arrow.svg"></span>'],
272            items: 3,
273            responsiveClass: true,
274            autoplay: false,
275            autoplayTimeout: 10000,
276            responsive : {
277                // breakpoint from 0 up
278                0 : {
279                     items:1,
280                },
281                // breakpoint from 480 up
282                767 : {
283                   items:2,
284                },
285                1024 : {
286                   items:3,
287                }
288            }
289
290        })
291    } // end news slider
292
293
294
295    if ($('section.featured-posts-slider').length > 0) {
296        $('section.featured-posts-slider').addClass('owl-carousel owl-theme');
297
298        var heroowl = $('section.featured-posts-slider').owlCarousel({
299            //animateOut: 'fadeOut',
300            //animateIn: 'fadeIn',
301            margin: 0,
302            loop: false,
303            dots: true,
304            center: true,
305            nav: false,
306            autoplayHoverPause: true,
307            autoHeight: true,
308            autoplaySpeed: 1000,
309            navSpeed: 1000,
310            dotsSpeed: 1000,
311            autoWidth: false,
312            navText: ['<span class="mv-left"><img src="/wp-content/themes/JointsWP-CSS-master/assets/images/arrow-left.svg"></span> ', ' <span class="mv-right"><img src="/wp-content/themes/JointsWP-CSS-master/assets/images/arrow.svg"></span>'],
313            items: 1,
314            responsiveClass: true,
315            autoplay: false,
316            autoplayTimeout: 10000,
317
318        })
319    } // end news hero
320
321    if ($('.news-container-template').length > 0) {
322        $('.newslist .news-item').each(function(index) {
323            item = index + 1;
324            // console.log(item);
325            $(this).appendTo('.news-container-template .item' + item);
326        })
327    }
328
329    if ($('.cat-links').length > 0) {
330        window.page = 2;
331        $('.cat-links').on('click', function(e) {
332            window.page = 2;
333            $('.cat-links').removeClass('active');
334            $(this).addClass('active');
335            e.preventDefault();
336            archive = $(this).attr('href');
337            pop = archive.replace('/news/category/','').replace('/','');
338            history.pushState(null,null,'#' + pop)
339            $('a.nextpage').attr('href', archive + 'page/' + window.page +'/');
340
341            contentcontainer = '.list';
342
343            $('.newslist').load(archive + "?ajax=1 " + contentcontainer, function(data) {
344
345                $newcontainer = $('.template-wrapper > .news-container-template:first-child').clone();
346                $newcontainer.find('.items').empty();
347
348                $('.template-wrapper').fadeOut('slow', function() {
349                    $('.template-wrapper').empty();
350                    $newcontainer.appendTo('.template-wrapper');
351
352                    $('.newslist .news-item').each(function(index) {
353                        item = index + 1;
354                        $(this).appendTo('.template-wrapper > .news-container-template:last-child .item' + item);
355                    });
356
357                    $('.template-wrapper').fadeIn();
358                })
359            })
360        });
361
362
363        $('.nextpage').on('click', function(e) {
364            e.preventDefault();
365            window.page++;
366
367            archive = $(this).attr('href');;
368            base = archive.split('/');
369            base.pop();
370            base.pop();
371            newurl = base.join('/');
372            // console.log(newurl);
373
374            if(newurl.indexOf('/page/')> -1){
375              $('a.nextpage').attr('href', newurl + "/" + window.page + "/");
376            } else {
377              $('a.nextpage').attr('href', newurl + "/" + window.page + "/");  
378            }
379            
380
381            contentcontainer = '.list';
382            $('.newslist').load(archive + "?ajax=1 " + contentcontainer, function(data) {
383
384                $newcontainer = $('.template-wrapper > .news-container-template:first-child').clone();
385                $newcontainer.find('.items').empty();
386                $newcontainer.hide();
387                $newcontainer.appendTo('.template-wrapper');
388
389                    $('.newslist .news-item').each(function(index) {
390                        item = index + 1;
391                        $(this).appendTo('.template-wrapper > .news-container-template:last-child .item' + item);
392                    });
393
394                $newcontainer.fadeIn();
395              
396            })
397
398        });
399
400
401    if(window.location.hash) {
402        var hash = window.location.hash.substring(1);
403        // console.log(hash);
404        $('.category-filter a[href*="'+hash+'"]').trigger('click');
405        $([document.documentElement, document.body]).animate({
406                scrollTop: $("section.all-news").offset().top - 80
407        }, 1000);
408
409        $('a[href*='+hash+']').parent('li').addClass('mega-current-menu-item');
410
411    }
412
413
414    } // end new page
415
416
417
418    if ($('.parent-pageid-288,.parent-pageid-1579').length > 0) {
419        $('.parent-pageid-288 .cell-column-two p,.parent-pageid-1579 .cell-column-two p').after('<a href="#" class="expand button buttom-more-two">READ MORE</a>');
420
421        $('.button.expand').on('click', function(e) {
422            e.preventDefault();
423            $(this).prev().toggleClass('open');
424        })
425    }
426
427    if ($('section.cards').length > 0) {
428        $('section.cards').each(function() {
429            $(this).find('img').each(function() {
430                img = $(this).attr('src');
431                $(this).wrap('<div class="card-img" style="background-image:url(' + img + ')"></div>');
432            });
433        })
434
435
436    }
437}); // end ready
438
439jQuery(window).load(function() {
440    jQuery('body').addClass('loaded');
441
442
443}); // end loaded

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.