PageSourceSearch

https://acadielove.ca/wp-content/themes/witalk/assets/js/theme.js?ver=1.0

js acadielove.ca collected 2026-09-25 09:19:14 UTC 18,387 bytes, 471 lines download raw bytes

1'use strict';
2
3var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
5function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
7(function ($) {
8    var OpalThemeBacktop = function () {
9        function OpalThemeBacktop() {
10            _classCallCheck(this, OpalThemeBacktop);
11
12            this.initBacktotop();
13        }
14
15        _createClass(OpalThemeBacktop, [{
16            key: 'initBacktotop',
17            value: function initBacktotop() {
18                jQuery(window).scroll(function () {
19                    if (jQuery(this).scrollTop() > 200) {
20                        jQuery('.scrollup').fadeIn().addClass('activate');
21                    } else {
22                        jQuery('.scrollup').fadeOut().removeClass('activate');
23                    }
24                });
25                jQuery('.scrollup').on('click', function () {
26                    jQuery("html, body").animate({ scrollTop: 0 }, 600);
27                    return false;
28                });
29            }
30        }]);
31
32        return OpalThemeBacktop;
33    }();
34
35    new OpalThemeBacktop();
36    jQuery('html').removeClass('no-js').addClass('js yes-js js_active');
37
38    var OpalThemeFooter = function () {
39        function OpalThemeFooter() {
40            _classCallCheck(this, OpalThemeFooter);
41
42            this.init();
43        }
44
45        _createClass(OpalThemeFooter, [{
46            key: 'init',
47            value: function init() {
48                var _this = this;
49
50                if (jQuery('body').hasClass('footer-fixed')) {
51                    this.$footer = jQuery('#colophon');
52                    this.$content = jQuery('#page');
53                    this.$footer.css({
54                        position: 'fixed',
55                        left: 0,
56                        bottom: 0,
57                        zIndex: 0
58                    });
59
60                    this.setup();
61
62                    $(window).resize(function () {
63                        _this.setup();
64                    });
65                }
66            }
67        }, {
68            key: 'setup',
69            value: function setup() {
70                this.$content.css({
71                    marginBottom: this.getFooterHeight()
72                });
73            }
74        }, {
75            key: 'getFooterHeight',
76            value: function getFooterHeight() {
77                return this.$footer.outerHeight();
78            }
79        }]);
80
81        return OpalThemeFooter;
82    }();
83
84    new OpalThemeFooter();
85
86    var OpalTheme_Main_Menu = function () {
87        function OpalTheme_Main_Menu() {
88            _classCallCheck(this, OpalTheme_Main_Menu);
89
90            this.initSubmenuHover();
91        }
92
93        _createClass(OpalTheme_Main_Menu, [{
94            key: 'initSubmenuHover',
95            value: function initSubmenuHover() {
96                var _this2 = this;
97
98                $('.site-header .main-navigation .menu-item-has-children').hover(function (event) {
99                    var $item = $(event.currentTarget);
100                    _this2.setPositionLvN($item);
101                });
102            }
103        }, {
104            key: 'setPositionLvN',
105            value: function setPositionLvN($item) {
106                var sub = $item.children('.sub-menu'),
107                    offset = $item.offset(),
108                    width = $item.outerWidth(),
109                    screen_width = $(window).width(),
110                    sub_width = sub.outerWidth();
111                var align_delta = offset.left + width + sub_width - screen_width;
112                if (align_delta >= 0) {
113                    sub.css({ left: 'auto', right: '100%' });
114                } else {
115                    sub.css({ left: '', right: '' });
116                }
117            }
118        }]);
119
120        return OpalTheme_Main_Menu;
121    }();
122
123    new OpalTheme_Main_Menu();
124
125    var OpalThemeOwlCarousel = function OpalThemeOwlCarousel() {
126        _classCallCheck(this, OpalThemeOwlCarousel);
127    };
128
129    new OpalThemeOwlCarousel();
130
131    var OpalThemeSmoothMenu = function () {
132        function OpalThemeSmoothMenu() {
133            var _this3 = this;
134
135            _classCallCheck(this, OpalThemeSmoothMenu);
136
137            witalkJS.smoothCallback = function (selector) {
138                jQuery('.opal-smooth-menu a[href^="' + selector + '"]').trigger('click');
139            };
140
141            jQuery('body').on('click', '.opal-smooth-menu a[href^="#"]', function (e) {
142                e.preventDefault();
143                _this3.menuActiveClass(e);
144                var target = e.currentTarget.hash;
145                var $target = $(target);
146                if ($target.length > 0) {
147                    jQuery('html, body').animate({
148                        'scrollTop': $target.offset().top - _this3.getOffset()
149                    }, 600, 'swing');
150                }
151            });
152        }
153
154        _createClass(OpalThemeSmoothMenu, [{
155            key: 'menuActiveClass',
156            value: function menuActiveClass(e) {
157                var $this = $(e.currentTarget);
158                jQuery('.opal-smooth-menu').find('li.menu-item').removeClass('current-menu-item current_page_item');
159                var selector = $this.closest('li').attr('id');
160                jQuery('.opal-smooth-menu [id="' + selector + '"]').addClass('current-menu-item');
161            }
162        }, {
163            key: 'getOffset',
164            value: function getOffset() {
165                var offset = 0;
166                var $adminBar = jQuery('#wpadminbar');
167                var $stickyHeader = jQuery('#opal-header-sticky');
168
169                if ($adminBar.length > 0) {
170                    offset += $adminBar.outerHeight();
171                }
172
173                if ($stickyHeader.length > 0) {
174                    offset += $stickyHeader.outerHeight();
175                }
176
177                return offset;
178            }
179        }]);
180
181        return OpalThemeSmoothMenu;
182    }();
183
184    new OpalThemeSmoothMenu();
185    // class OpalThemeStickyHeader {
186    //     constructor() {
187    //         this.sticky();
188    //     }
189    //
190    //     sticky() {
191    //         let $scope = $('#opal-header-content');
192    //         if ($scope.length > 0) {
193    //             let section_offset = $scope.offset().top,
194    //                 section_top    = $('#wpadminbar').height(),
195    //                 section_height = $scope.outerHeight();
196    //             if ($(window).width() < 601) {
197    //                 section_top = 0;
198    //             }
199    //             $(window).resize(() => {
200    //                 $scope.removeClass('sticky-show');
201    //                 $scope.css({
202    //                     top: 0,
203    //                 });
204    //                 let $h_animate = $scope.next('.h-animate');
205    //                 $h_animate.remove();
206    //                 if (!$scope.hasClass('sticky-show')) {
207    //                     section_offset = $scope.offset().top;
208    //                 }
209    //                 section_top = $('#wpadminbar').height();
210    //                 if ($(window).width() < 601) {
211    //                     section_top = 0;
212    //                 }
213    //             });
214    //             $(window).scroll(() => {
215    //                 if ($(window).width() > 768) {
216    //                     if ($(window).scrollTop() >= (section_offset + section_height - section_top)) {
217    //                         if (!$scope.hasClass('sticky-show')) {
218    //                             $scope.addClass('sticky-show');
219    //                             $scope.css({
220    //                                 top: section_top,
221    //                             });
222    //                             $("<div class='h-animate'></div>").insertAfter($scope).css({
223    //                                 height: section_height
224    //                             });
225    //                         }
226    //                     } else {
227    //                         $scope.removeClass('sticky-show');
228    //                         $scope.css({
229    //                             top: 0,
230    //                         });
231    //                         let $h_animate = $scope.next('.h-animate');
232    //                         $h_animate.remove();
233    //                     }
234    //                 }
235    //             });
236    //         }
237    //     }
238    // }
239    //
240    // jQuery(document).ready(function ($) {
241    //     new OpalThemeStickyHeader();
242    // });
243
244    var OpalTheme = function () {
245        function OpalTheme() {
246            var _this4 = this;
247
248            _classCallCheck(this, OpalTheme);
249
250            this.SetUpBreacumb();
251            jQuery(window).resize(function () {
252                _this4.SetUpBreacumb();
253            });
254
255            $(window).load(function () {
256                _this4.initBG();
257            });
258        }
259
260        _createClass(OpalTheme, [{
261            key: 'SetUpBreacumb',
262            value: function SetUpBreacumb() {
263
264                var header = jQuery('body.opal-header-absolute #masthead .site-header'),
265                    breacumb = jQuery('.page-title-bar .wrap');
266                if (header.length) {
267                    var Height = header.height(),
268                        breacumbHeight = breacumb.height();
269
270                    if (jQuery(window).width() > 992) {
271                        breacumb.css({
272                            'min-height': 420 + Height - 80,
273                            'padding-top': Height
274                        });
275                    } else {
276                        breacumb.css({
277                            'min-height': '',
278                            'padding-top': ''
279                        });
280                    }
281                }
282            }
283        }, {
284            key: 'initBG',
285            value: function initBG() {
286                var _this5 = this;
287
288                if ($('.body-background-inner').length > 0) {
289                    this.bgScale();
290                    $(document).on('scroll', function () {
291                        _this5.bgScale();
292                    });
293                }
294            }
295        }, {
296            key: 'bgScale',
297            value: function bgScale() {
298                var documentHeight = $(document).height() - $(window).height();
299                var _h = window.pageYOffset;
300                var scale = 1 + _h / documentHeight / 4;
301
302                $('.body-background-inner').css({
303                    "transform": 'translate(-50%, -50%) scale(' + scale + ')'
304                });
305            }
306        }]);
307
308        return OpalTheme;
309    }();
310
311    jQuery(document).ready(function ($) {
312        new OpalTheme();
313    });
314
315    var OpalThemeToogle = function () {
316        function OpalThemeToogle() {
317            _classCallCheck(this, OpalThemeToogle);
318
319            this.setupHeader();
320            this.toggleCollapse();
321            this.ToggleCanvasFilter();
322            this.PositionAccount();
323            this.toggleCollapseSearchFooter();
324        }
325
326        _createClass(OpalThemeToogle, [{
327            key: 'setupHeader',
328            value: function setupHeader() {
329                jQuery('#masthead .search-button[data-search-toggle]').each(function (index, element) {
330                    var $button = $(element);
331                    if ($button.hasClass('top-to-bottom') || $button.hasClass('popup')) {
332                        var $searchform = $($button.data('target'));
333                        $searchform.data('height', $searchform.outerHeight()).prependTo('#page').addClass('loaded');
334                    } else if ($button.hasClass('bottom-to-top')) {
335                        var _$searchform = $($button.data('target'));
336                        _$searchform.data('height', _$searchform.outerHeight()).prependTo('#page');
337                    }
338                });
339            }
340        }, {
341            key: 'toggleCollapse',
342            value: function toggleCollapse() {
343                var _this6 = this;
344
345                jQuery('body').on('click', '[data-search-toggle="toggle"]', function (e) {
346                    e.preventDefault();
347                    var $button = $(e.currentTarget);
348                    var $searchForm = $($button.data('target'));
349                    var $buttonClose = $searchForm.find('[data-search-toggle="close"]');
350                    $buttonClose.on('click', function (e) {
351                        $button.removeClass('active');
352                        $searchForm.removeClass('active');
353                        jQuery('body').removeClass('over-hidden');
354                        if ($buttonClose.closest('.bottom-to-top')) {
355                            $searchForm.css('top', '100%');
356                        }
357                    });
358                    if ($button.is('.top-to-bottom, .bottom-to-top, .popup')) {
359                        $searchForm.toggleClass('active');
360                        $button.toggleClass('active');
361                    }
362                    if ($button.hasClass('top-to-bottom')) {
363                        _this6.setupTopToBottom($button, $searchForm);
364                    } else if ($button.hasClass('bottom-to-top')) {
365                        _this6.setupBottomToTop($button, $searchForm);
366                    } else if ($button.hasClass('popup')) {
367                        _this6.setupFullScreen($button, $searchForm);
368                    } else {
369                        $button.toggleClass('active');
370                        $button.siblings($searchForm).toggleClass('active');
371                        $(document.createElement('div')).addClass('dropdown-backdrop').insertAfter($button.siblings($searchForm)).on('click', function () {
372                            jQuery(this).siblings().removeClass("active");
373                            jQuery(this).remove();
374                        });
375                    }
376                });
377            }
378        }, {
379            key: 'toggleCollapseSearchFooter',
380            value: function toggleCollapseSearchFooter() {
381                jQuery('body').on('click', '.search-footer', function (e) {
382                    e.preventDefault();
383                    $('.handheld-footer-bar .search').toggleClass('active');
384                });
385            }
386        }, {
387            key: 'checkScroll',
388            value: function checkScroll($object) {
389                var element = $object.get(0);
390                return element.scrollHeight > $(window).height();
391            }
392        }, {
393            key: 'setupFullScreen',
394            value: function setupFullScreen($button, $searchForm) {
395                var $body = jQuery('body');
396                if (this.checkScroll($body)) {
397                    $body.toggleClass('over-hidden');
398                }
399            }
400        }, {
401            key: 'setupTopToBottom',
402            value: function setupTopToBottom($button, $searchForm) {
403                jQuery('body').animate({ scrollTop: 0 }, 600);
404            }
405        }, {
406            key: 'setupBottomToTop',
407            value: function setupBottomToTop($button, $searchForm) {
408                var $header = jQuery('.site-header'),
409                    $sticky = jQuery('.sticky-show'),
410                    stickyHeight = $sticky.outerHeight(),
411                    adminbarHeight = jQuery('#wpadminbar').height(),
412                    position = $header.height() + adminbarHeight;
413                if (stickyHeight > 1) {
414                    position = stickyHeight + adminbarHeight;
415                }
416                if ($searchForm.hasClass('active')) {
417                    $searchForm.css('top', position);
418                } else {
419                    $searchForm.css('top', '100%');
420                }
421                var $body = $('body');
422                if (this.checkScroll($body)) {
423                    $body.toggleClass('over-hidden');
424                }
425            }
426        }, {
427            key: 'ToggleCanvasFilter',
428            value: function ToggleCanvasFilter() {
429                jQuery('body').on('click', '.opal-overlay-filter , .filter-close', function () {
430                    jQuery('body').removeClass('opal-canvas-filter-open');
431                    jQuery('.filter-toggle').removeClass('active');
432                }).on('click', '.filter-toggle', function (event) {
433                    var $body = jQuery('body');
434                    var filterToggle = $(event.currentTarget);
435                    if ($body.hasClass('opal-canvas-filter-open')) {
436                        filterToggle.removeClass('active');
437                        $body.removeClass('opal-canvas-filter-open');
438                        $body.find('.opal-canvas-filter.top').slideToggle(1000);
439                    } else {
440                        filterToggle.addClass('active');
441                        $body.addClass('opal-canvas-filter-open');
442                        $body.find('.opal-canvas-filter.top').slideToggle(1000);
443                    }
444                });
445            }
446        }, {
447            key: 'PositionAccount',
448            value: function PositionAccount() {
449                jQuery('body').on('hover', '.site-header-account', function () {
450                    var $drop = jQuery(this).find('.account-dropdown');
451                    if ($drop.length > 0) {
452                        var position = $drop.offset().top - $(window).scrollTop() + $drop.outerHeight(true),
453                            top = position - jQuery(window).height();
454                        if (top > 0) {
455                            $drop.css({
456                                'transform': 'translateY( -' + top + 'px)'
457                            });
458                        }
459                    }
460                });
461            }
462        }]);
463
464        return OpalThemeToogle;
465    }();
466
467    jQuery(document).ready(function ($) {
468        new OpalThemeToogle();
469    });
470})(jQuery);
471//# sourceMappingURL=theme.js.map

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.