PageSourceSearch

https://markbland.ca/wp-content/themes/dolpa/assets/lib/custom/js/custom.js?ver=7.1.2

js markbland.ca collected 2026-10-02 01:19:29 UTC 20,041 bytes, 612 lines download raw bytes

1jQuery(document).ready(function ($) {
2    "use strict";
3
4    $(window).load(function () {
5        $("body").addClass("page-loaded");
6    });
7    // Hide Comments
8    $('.dolpa-no-comment .booster-block.booster-ratings-block, .dolpa-no-comment .comment-form-ratings, .dolpa-no-comment .twp-star-rating').hide();
9
10    // Hide pagination
11    if( $('html').hasClass('js') ){
12        $('.pagination-no-js').remove();
13    }
14    // AOS
15    AOS.init({
16        duration: 800,
17    });
18
19    $('.tooltips').append("<span></span>");
20    $(".tooltips").mouseenter(function(){
21        $(this).find('span').empty().append($(this).attr('data-tooltip'));
22    });
23    
24    // Background
25    var pageSection = $(".data-bg");
26    pageSection.each(function (indx) {
27        if ($(this).attr("data-background")) {
28            $(this).css("background-image", "url(" + $(this).data("background") + ")");
29        }
30    });
31
32    $('.bg-image').each(function () {
33        var src = $(this).children('img').attr('src');
34        $(this).css('background-image', 'url(' + src + ')').children('img').hide();
35    });
36
37    // Content Gallery Start
38    var i = 1;
39    $('.entry-content .wp-block-gallery ').each(function () {
40
41        $(this).attr('gallery-data', 'gallery-num-' + i);
42        $(this).addClass('gallery-data-slick');
43        $(this).addClass('gallery-data-gallery-num-' + i);
44        i++;
45
46        var k = 0;
47        $(this).find('.blocks-gallery-item').each(function () {
48            $(this).attr('gallery-index', k);
49            k++;
50        });
51    });
52
53    var j = 1;
54    $('.footer-galleries .wp-block-gallery ').each(function () {
55
56        $(this).append('<div class="gallery-popup-close"><i class="ion ion-ios-close" aria-hidden="true"></i></div>');
57
58        $(this).addClass('gallery-num-' + j);
59        j++;
60
61        $(this).addClass('dolpa-slick-dactivated');
62    });
63
64    $('.gallery-data-slick .blocks-gallery-item a').click(function (event) {
65
66        event.preventDefault();
67
68    });
69
70    $('.gallery-data-slick .blocks-gallery-item').click(function () {
71
72        if (!$(this).closest('.gallery-data-slick').hasClass('columns-1')) {
73
74            $('html').attr('style', 'margin: 0; height: 100%; overflow: hidden');
75
76            var galid = $(this).closest('.gallery-data-slick').attr('gallery-data');
77            $('.' + galid).addClass('gallery-show fullscreen');
78
79            if ($('.' + galid).hasClass('dolpa-slick-dactivated')) {
80
81                $('.' + galid + ' .blocks-gallery-grid').slick({
82                    slidesToShow: 1,
83                    slidesToScroll: 1,
84                    fade: true,
85                    autoplay: false,
86                    autoplaySpeed: 8000,
87                    infinite: true,
88                    nextArrow: '<button type="button" class="slide-btn slide-next-icon ion ion-ios-arrow-forward"></button>',
89                    prevArrow: '<button type="button" class="slide-btn slide-prev-icon ion ion-ios-arrow-back"></button>',
90                    dots: false,
91                });
92            }
93            var galindex = $(this).attr('gallery-index');
94            $('.' + galid + ' .blocks-gallery-grid').slick('slickGoTo', galindex);
95            $('.' + galid).removeClass('dolpa-slick-dactivated');
96
97        }
98
99    });
100
101    $('.wp-block-gallery.columns-1').append('<div class="gallery-popup"><i class="ion ion-ios-add-circle-outline" aria-hidden="true"></i></div>');
102    $('.wp-block-gallery.columns-1').append('<div class="gallery-popup-close"><i class="ion ion-ios-close" aria-hidden="true"></i></div>');
103    $('.gallery-popup').click(function () {
104        $(this).closest('.wp-block-gallery').addClass('fullscreen');
105        $('html').attr('style', 'margin: 0; height: 100%; overflow: hidden');
106        $('.wp-block-gallery.columns-1 .blocks-gallery-grid').slick("slickSetOption", "speed", 500, !0);
107
108    });
109
110    $('.gallery-popup-close').click(function () {
111
112        $(this).closest('.wp-block-gallery').removeClass('fullscreen gallery-show');
113        $('html').attr('style', '');
114        $('.wp-block-gallery.columns-1 .blocks-gallery-grid').slick("slickSetOption", "speed", 500, !0);
115
116    });
117
118    // Content Gallery End
119
120    // Widget Gallery Start
121
122    $('.widget_media_gallery a').click(function (event) {
123
124        event.preventDefault();
125
126    });
127
128    var k = 1;
129    $('.widget_media_gallery').each(function () {
130
131        if (!$(this).find('.gallery').hasClass('gallery-columns-1')) {
132
133            $(this).attr('gallery-id', 'gallery-' + k);
134            var gallhtml = $(this).find('.gallery').html();
135            $('.widget-footer-galleries').append('<div class="footer-gallery-main"><div class="footer-gallery-' + k + '">' + gallhtml + '</div><div class="gallery-popup-close"><i class="ion ion-ios-close" aria-hidden="true"></i></div></div>');
136
137            var l = 0;
138            $(this).find('.gallery-item').each(function () {
139                $(this).attr('index-item', l);
140                l++;
141            });
142
143            k++;
144        }
145
146        if ($(this).find('.gallery').hasClass('gallery-columns-1')) {
147
148            $(this).append('<div class="gallery-popup"><i class="ion ion-ios-add-circle-outline" aria-hidden="true"></i></div>');
149            $(this).append('<div class="gallery-popup-close"><i class="ion ion-ios-close" aria-hidden="true"></i></div>');
150
151        }
152
153    });
154
155    $('.footer-gallery-main a').click(function (event) {
156
157        event.preventDefault();
158
159    });
160
161    $('figure.gallery-item').click(function () {
162
163        if (!$(this).closest('.gallery').hasClass('gallery-columns-1')) {
164            $('html').attr('style', 'margin: 0; height: 100%; overflow: hidden');
165        }
166        var clickedgal = $(this).closest('.widget_media_gallery').attr('gallery-id');
167        $('.footer-' + clickedgal).closest('.footer-gallery-main').addClass('fullscreen');
168        if (!$('.footer-' + clickedgal).hasClass('widget-slider-active')) {
169
170            $('.footer-' + clickedgal).addClass('widget-slider-active');
171
172            $('.footer-' + clickedgal).slick({
173                slidesToShow: 1,
174                slidesToScroll: 1,
175                fade: true,
176                autoplay: false,
177                autoplaySpeed: 8000,
178                infinite: true,
179                nextArrow: '<button type="button" class="slide-btn slide-next-icon ion ion-ios-arrow-forward"></button>',
180                prevArrow: '<button type="button" class="slide-btn slide-prev-icon ion ion-ios-arrow-back"></button>',
181                dots: false,
182            });
183
184        }
185        var galindex = $(this).attr('index-item');
186        $('.footer-' + clickedgal).slick('slickGoTo', galindex);
187
188    });
189
190    $('.gallery-popup-close').click(function () {
191
192        $(this).closest('.footer-gallery-main').removeClass('fullscreen gallery-show');
193        $('html').attr('style', '');
194
195    });
196
197    $('.widget.widget_media_gallery .gallery-popup').click(function () {
198
199        $(this).closest('.widget_media_gallery').addClass('fullscreen');
200        $('html').attr('style', 'margin: 0; height: 100%; overflow: hidden');
201        $('.gallery-columns-1').slick("slickSetOption", "speed", 500, !0);
202
203    });
204
205    $('.widget.widget_media_gallery .gallery-popup-close').click(function () {
206
207        $(this).closest('.widget_media_gallery').removeClass('fullscreen');
208        $('html').attr('style', '');
209        $('.gallery-columns-1').slick("slickSetOption", "speed", 500, !0);
210
211    });
212
213    // Widget Gallery End
214
215    // Scroll To
216    $(".scroll-content").click(function () {
217        $('html, body').animate({
218            scrollTop: $("#content").offset().top
219        }, 500);
220    });
221
222    // Rating disable
223    if (dolpa_custom.single_post == 1 && dolpa_custom.dolpa_ed_post_reaction) {
224
225        $('.tpk-single-rating').remove();
226        $('.tpk-comment-rating-label').remove();
227        $('.comments-rating').remove();
228        $('.tpk-star-rating').remove();
229
230    }
231    // Add Class on article
232    $('.theme-article.post').each(function () {
233        $(this).addClass('theme-article-loaded');
234    });
235
236    // Aub Menu Toggle
237    $('.submenu-toggle').click(function () {
238        $(this).toggleClass('button-toggle-active');
239        var currentClass = $(this).attr('data-toggle-target');
240        $(currentClass).toggleClass('submenu-toggle-active');
241    });
242
243    
244
245    // Toggle Search
246    $('.navbar-control-search').click(function () {
247        $('.header-searchbar').toggleClass('header-searchbar-active');
248
249        $('#search-closer').focus();
250
251    });
252
253    $('.aside-search-js').click(function () {
254
255        $('.header-searchbar-area .search-field-default').focus();
256
257    });
258
259    // Header Search show
260    $('.header-searchbar').click(function () {
261
262        $('.header-searchbar').removeClass('header-searchbar-active');
263
264    });
265
266    $(".header-searchbar-inner").click(function (e) {
267
268        e.stopPropagation(); //stops click event from reaching document
269
270    });
271
272    // Header Search hide
273    $('#search-closer').click(function () {
274        $('.header-searchbar').removeClass('header-searchbar-active');
275        setTimeout(function () {
276            $('.navbar-control-search').focus();
277        }, 300);
278    });
279
280    // Focus on search input on search icon expand
281    $('.navbar-control-search').click(function(){
282
283        setTimeout(function () {
284            $('.header-searchbar .search-field').focus();
285        }, 300);
286
287    });
288
289    $( 'input, a, button' ).on( 'focus', function() {
290        if ( $( '.header-searchbar' ).hasClass( 'header-searchbar-active' ) ) {
291
292            if( $(this).hasClass('skip-link-search-top') ){
293                $('#search-closer').focus();
294            }
295            if (  ! $( this ).parents( '.header-searchbar' ).length ) {
296                $('.header-searchbar .search-field').focus();
297                $('.header-searchbar-area .search-field-default').focus();
298            }
299        }
300    } );
301
302    $(document).keyup(function(j) {
303        if (j.key === "Escape") { // escape key maps to keycode `27`
304            if ( $( '.header-searchbar' ).hasClass( 'header-searchbar-active' ) ) {
305                 $('.header-searchbar').removeClass('header-searchbar-active');
306
307                setTimeout(function () {
308                    $('.navbar-control-search').focus();
309                }, 300);
310
311                setTimeout(function () {
312                    $('.aside-search-js').focus();
313                }, 300);
314
315            }
316        }
317    });
318
319    // Action On Esc Button
320    $(document).keyup(function (j) {
321        if (j.key === "Escape") { // escape key maps to keycode `27`
322
323            if( $('#offcanvas-menu').hasClass('offcanvas-menu-active') ){
324                $('.header-searchbar').removeClass('header-searchbar-active');
325                $('#offcanvas-menu').removeClass('offcanvas-menu-active');
326                $('.navbar-control-offcanvas').removeClass('active');
327                $('html').removeAttr('style');
328
329                setTimeout(function () {
330                    $('.navbar-control-offcanvas').focus();
331                }, 300);
332
333            }
334        }
335    });
336
337    // Toggle Menu
338    $('.navbar-control-offcanvas').click(function () {
339
340        $(this).addClass('active');
341        $('html').attr('style', 'overflow-y: scroll; position: fixed; width: 100%; left: 0px; top: 0px;');
342        $('#offcanvas-menu').toggleClass('offcanvas-menu-active');
343        $('.button-offcanvas-close').focus();
344
345    });
346
347    // Offcanvas Close
348    $('.offcanvas-close .button-offcanvas-close').click(function () {
349        $('#offcanvas-menu').removeClass('offcanvas-menu-active');
350        $('.navbar-control-offcanvas').removeClass('active');
351        $('html').removeAttr('style');
352
353        setTimeout(function () {
354            $('.navbar-control-offcanvas').focus();
355        }, 300);
356
357    });
358
359    // Offcanvas Close
360    $('#offcanvas-menu').click(function () {
361
362        $('#offcanvas-menu').removeClass('offcanvas-menu-active');
363        $('.navbar-control-offcanvas').removeClass('active');
364        $('html').removeAttr('style');
365
366    });
367
368    $(".offcanvas-wraper").click(function (e) {
369
370        e.stopPropagation(); //stops click event from reaching document
371
372    });
373
374    // Offcanvas re focus on close button
375    $('input, a, button').on('focus', function () {
376        if ($('#offcanvas-menu').hasClass('offcanvas-menu-active')) {
377
378            if( $(this).hasClass('skip-link-off-canvas') ){
379
380                if( !$("#offcanvas-menu #social-nav-offcanvas").length == 0 ){
381
382                    $("#offcanvas-menu #social-nav-offcanvas ul li:last-child a").focus();
383
384                }else if( !$("#offcanvas-menu #primary-nav-offcanvas").length == 0 ){
385
386                    $("#offcanvas-menu #primary-nav-offcanvas ul li:last-child a").focus();
387
388                }
389            }
390
391            if ($(this).hasClass('skip-link-offcanvas') ) {
392                $('.button-offcanvas-close').focus();
393            }
394        }
395    });
396
397    $("ul.wp-block-gallery.columns-1, .wp-block-gallery.columns-1 .blocks-gallery-grid, .gallery-columns-1").each(function () {
398        $(this).slick({
399            slidesToShow: 1,
400            slidesToScroll: 1,
401            fade: true,
402            autoplay: false,
403            autoplaySpeed: 8000,
404            infinite: true,
405            nextArrow: '<button type="button" class="slide-btn slide-next-icon ion ion-ios-arrow-forward"></button>',
406            prevArrow: '<button type="button" class="slide-btn slide-prev-icon ion ion-ios-arrow-back"></button>',
407            dots: false,
408        });
409    });
410
411    // Template Carousel Slider
412    $(".template-carousel-slide").each(function () {
413        $(this).slick({
414            autoplay: true,
415            slidesToShow: 4,
416            slidesToScroll: 4,
417            autoplaySpeed: 8000,
418            infinite: true,
419            nextArrow: '<button type="button" class="slide-btn slide-next-icon ion ion-ios-arrow-forward"></button>',
420            prevArrow: '<button type="button" class="slide-btn slide-prev-icon ion ion-ios-arrow-back"></button>',
421            responsive: [
422                {
423                    breakpoint: 991,
424                    settings: {
425                        slidesToShow: 3,
426                        slidesToScroll: 3
427                    }
428                },
429                {
430                    breakpoint: 768,
431                    settings: {
432                        slidesToShow: 2,
433                        slidesToScroll: 2
434                    }
435                },
436                {
437                    breakpoint: 480,
438                    settings: {
439                        slidesToShow: 1,
440                        slidesToScroll: 1
441                    }
442                }
443            ]
444        });
445    });
446
447    //Template Slide Slider
448    $(".template-slide").each(function () {
449        $(this).slick({
450            slidesToShow: 1,
451            slidesToScroll: 1,
452            fade: true,
453            autoplay: false,
454            autoplaySpeed: 8000,
455            infinite: true,
456            nextArrow: '<button type="button" class="slide-btn slide-next-icon ion ion-ios-arrow-forward"></button>',
457            prevArrow: '<button type="button" class="slide-btn slide-prev-icon ion ion-ios-arrow-back"></button>',
458            dots: false
459        });
460    });
461
462    // Sticky Components
463    $('.widget-area, .post-content-share').theiaStickySidebar({
464        additionalMarginTop: 30
465    });
466
467    var pageSection = $(".data-bg");
468    pageSection.each(function (indx) {
469        if ($(this).attr("data-background")) {
470            $(this).css("background-image", "url(" + $(this).data("background") + ")");
471        }
472    });
473
474    // Masonry Grid
475    if ($('.archive-layout-masonry').length > 0) {
476        /*Default masonry animation*/
477        var grid;
478        var hidden = 'scale(0.5)';
479        var visible = 'scale(1)';
480        grid = $('.archive-layout-masonry').imagesLoaded(function () {
481            grid.masonry({
482                itemSelector: '.theme-article',
483                hiddenStyle: {
484                    transform: hidden,
485                    opacity: 0
486                },
487                visibleStyle: {
488                    transform: visible,
489                    opacity: 1
490                }
491            });
492        });
493    }
494
495    // Widget Tab
496    $('.twp-nav-tabs .tab').on('click', function (event) {
497        var tabid = $(this).attr('id');
498        $(this).closest('.tabbed-container').find('.tab').removeClass('active');
499        $(this).addClass('active');
500        $(this).closest('.tabbed-container').find('.tab-pane').removeClass('active');
501        $('#content-' + tabid).addClass('active');
502    });
503
504    // Scroll TO Top Hide & show
505
506    $(window).scroll(function () {
507        
508        if ($(window).scrollTop() > $(window).height() / 2) {
509            $(".scroll-up").fadeIn(300);
510        } else {
511            $(".scroll-up").fadeOut(300);
512        }
513
514    });
515
516    // Scroll to Top on Click
517    $('.scroll-up').click(function () {
518        $("html, body").animate({
519            scrollTop: 0
520        }, 700);
521        return false;
522    });
523
524    $(window).scroll(function () {
525        
526        if ($(window).scrollTop() > $(window).height() / 2) {
527            $(".scroll-up").fadeIn(300);
528        } else {
529            $(".scroll-up").fadeOut(300);
530        }
531
532    });
533
534    // Scroll to Top on Click
535    $('.scroll-up').click(function () {
536        $("html, body").animate({
537            scrollTop: 0
538        }, 700);
539        return false;
540    });
541
542});
543
544/*  -----------------------------------------------------------------------------------------------
545    Intrinsic Ratio Embeds
546--------------------------------------------------------------------------------------------------- */
547
548var dolpa = dolpa || {},
549    $ = jQuery;
550
551var $dolpa_doc = $(document),
552    $dolpa_win = $(window),
553
554viewport = {};
555viewport.top = $dolpa_win.scrollTop();
556viewport.bottom = viewport.top + $dolpa_win.height();
557
558dolpa.instrinsicRatioVideos = {
559
560    init: function () {
561
562        dolpa.instrinsicRatioVideos.makeFit();
563
564        $dolpa_win.on('resize fit-videos', function () {
565
566            dolpa.instrinsicRatioVideos.makeFit();
567
568        });
569
570    },
571
572    makeFit: function () {
573
574        var vidSelector = "iframe, object, video";
575
576        $(vidSelector).each(function () {
577
578            var $dolpa_video = $(this),
579                $dolpa_container = $dolpa_video.parent(),
580                dolpa_iTargetWidth = $dolpa_container.width();
581
582            // Skip videos we want to ignore
583            if ($dolpa_video.hasClass('intrinsic-ignore') || $dolpa_video.parent().hasClass('intrinsic-ignore')) {
584                return true;
585            }
586
587            if (!$dolpa_video.attr('data-origwidth')) {
588
589                // Get the video element proportions
590                $dolpa_video.attr('data-origwidth', $dolpa_video.attr('width'));
591                $dolpa_video.attr('data-origheight', $dolpa_video.attr('height'));
592
593            }
594
595            // Get ratio from proportions
596            var dolpa_ratio = dolpa_iTargetWidth / $dolpa_video.attr('data-origwidth');
597
598            // Scale based on ratio, thus retaining proportions
599            $dolpa_video.css('width', dolpa_iTargetWidth + 'px');
600            $dolpa_video.css('height', ($dolpa_video.attr('data-origheight') * dolpa_ratio) + 'px');
601
602        });
603
604    }
605
606};
607
608$dolpa_doc.ready(function () {
609
610    dolpa.instrinsicRatioVideos.init();      // Retain aspect ratio of videos on window resize
611
612});

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.