PageSourceSearch

https://www.fpcanada.ca/ResourcePackages/FPCanadaBootstrap/assets/…?v=4.3.4&package=FPCanadaBootstrap

js fpcanada.ca collected 2026-09-24 22:18:41 UTC 19,836 bytes, 575 lines download raw bytes

1function sidebarToggle() {
2    if ($(window).width() < 992) {
3        $('.sidebar-header').click(function () {
4            $('.sidebar-body').stop().slideToggle();
5        })
6    } else {
7        $('.sidebar-header').unbind("click");
8    }
9}
10
11function MoveDashBoardBannerToMobile() {
12    if ($(".dashboard-scroll-area").length && $(".dashboard-area-row").length) {
13        $(".dashboard-scroll-area .profile-user").detach().appendTo(".dashboard-area-row")
14    }
15}
16
17function MoveDashBoardBannerToDesktop() {
18    if ($(".dashboard-scroll-area").length && $(".dashboard-area-row").length) {
19        $(".dashboard-area-row .profile-user").detach().prependTo(".dashboard-scroll-area")
20    }
21}
22
23
24var didScroll = false;
25
26var gtagConfig = ''
27function setGtagValue(gtag) {
28    gtagConfig = gtag
29}
30
31$(document).ready(function () {
32    //set accordion title and add unique mark, resume-your-journey is an universal class name for accordion in the site, please do not change it
33
34    $('.resume-your-journey.accordion').each(function (index) {
35        
36        let accordionId = 'accordion-' + (index + 1);
37        let $button = $(this).find('.accordion-btn');
38        let $content = $(this).next('.divider-space-12').next('.accordion-collapse');
39        
40        $button.attr('data-bs-target', '#' + accordionId);
41        $button.attr('aria-controls', accordionId);
42        $button.attr('aria-expanded', 'true');
43        $button.removeClass('collapsed');
44        
45        $content.attr('id', accordionId);
46        $content.attr('aria-expanded', 'true');
47        $content.addClass('show');
48
49        let $sourceDiv = $content.find('[data-sf-element="Accordion"]');
50        
51        
52        let placeholderLabel = $sourceDiv.attr('data-placeholder-label');
53        if (placeholderLabel) {
54            $(this).find('h4').html(placeholderLabel);
55        }
56    });
57    
58    //set accordion title and add unique mark ends
59    $(".btn-close-alert").click(function () {
60        $(".alert-success").hide();
61        $(".alert-danger").hide();
62    })
63    
64    if ($(window).width() < 992) {
65        MoveDashBoardBannerToMobile()
66        sidebarToggle();
67    }
68
69    $(window).on('resize', function () {
70        sidebarToggle();
71
72        if ($(window).width() < 992) {
73            MoveDashBoardBannerToMobile()
74        } else {
75            MoveDashBoardBannerToDesktop()
76        }
77    });
78
79    window.addEventListener('load', async () => {
80        let video = document.querySelector('video[muted][autoplay]');
81        if (video) {
82            try {
83                await video.play();
84            } catch (err) {
85                video.controls = true;
86            }
87        }
88    });
89
90    $('body .dropdown-toggle').each(function () { $(this).attr('href', '#') })
91
92    $(document).click(function (event) {
93        if ($('.menuDropdown').hasClass('show')) {
94            $('body').addClass('overlayMenu');
95        } else {
96            $('body').removeClass('overlayMenu');
97        }
98    });
99
100    $('[data-bs-toggle="tooltip"]').tooltip();
101
102
103    $('.menuToggle').click(function () {
104        $(this).toggleClass('closeToggle');
105        $('body').toggleClass('overlayOpen');
106        $('.mainMenu').toggleClass('show');
107    });
108
109    $('.filterToggle .btn').click(function () {
110        $('.mobilefilterhide').slideToggle();
111        $('html').toggleClass('overflow-hidden');
112    })
113
114    function loadAndTrack(canTrack) {
115        if (!canTrack) {
116            return;
117        }
118
119        window.dataLayer = window.dataLayer || [];
120        function gtag() { dataLayer.push(arguments); }
121        gtag('js', new Date());
122        if(gtagConfig) gtag('config', gtagConfig);
123    }
124
125    (function () {
126        if (window.TrackingConsentManager) {
127            TrackingConsentManager.addEventListener('ConsentChanged', loadAndTrack);
128            loadAndTrack(TrackingConsentManager.canTrackCurrentUser());
129        }
130        else {
131            loadAndTrack(true);
132        }
133    })();
134
135    $(window).resize(function () {
136        var getHeaderH = $('header').outerHeight() + ($(".breadcrumb-height").length > 0 ? $(".breadcrumb-height").outerHeight() : 0);
137
138        $('.headerSpacer').css('height', getHeaderH);
139
140        if ($(window).width() < 990) {
141            $('.headerTop .searchBar').prependTo('.mainMenu');
142            $('.topMenu ul li').appendTo('.mainMenu > ul')
143        } else {
144            $('body').removeClass('overflow-hidden');
145            $('.mainMenu .searchBar').appendTo('.headerTop .right_MS');
146            $('.mainMenu ul li.top-nav').appendTo('.topMenu ul')
147        }
148
149    });
150
151    //function filterScrollDesktop() {
152    //    $(".filterWidth").mCustomScrollbar({
153    //        theme: "dark-3",
154    //        scrollInertia: 60,
155    //        scrollButtons: { enable: false }
156    //    });
157    //}
158
159    //function filterScrollMobile() {
160    //    $(".mobilefilterhide").mCustomScrollbar({
161    //        theme: "dark-3",
162    //        scrollInertia: 60,
163    //        scrollButtons: { enable: false }
164    //    });
165    //}
166
167    //$(window).resize(function () {
168    //    if ($(window).width() > 991) {
169    //        filterScrollDesktop()
170    //    }
171    //});
172
173    //$(window).resize(function () {
174    //    if ($(window).width() < 992) {
175    //        filterScrollMobile()
176    //    }
177    //});
178
179
180    if ($(window).width() < 991) {
181        $('.headerTop .searchBar').prependTo('.mainMenu');
182        $('.topMenu ul li').appendTo('.mainMenu > ul')
183    } else {
184        $('.mainMenu .searchBar').appendTo('.headerTop .right_MS');
185        $('.mainMenu ul li.top-nav').appendTo('.topMenu ul')
186    }
187    var getHeaderH = $('header').outerHeight() + ($(".breadcrumb-height").length > 0? $(".breadcrumb-height").outerHeight():0);
188
189    $('.headerSpacer').css('height', getHeaderH);
190
191
192    if ($('.single_select') && $('.single_select').length > 0) {
193        $('.single_select').select2({
194            minimumResultsForSearch: -1
195        });
196    }
197
198
199    var sync1 = $("#sync1");
200    var sync2 = $("#sync2");
201    var slidesPerPage = 3; //globaly define number of elements per page
202    var syncedSecondary = true;
203
204    if (sync1 && sync1.length > 0) {
205        sync1
206            .owlCarousel({
207                items: 1,
208                slideSpeed: 7500,
209                nav: false,
210                // animateIn: "fadeIn",
211                // autoplayHoverPause: true,
212                autoplaySpeed: 1000,
213                // autoplay: true,
214                dots: false,
215                loop: true,
216                responsiveClass: true,
217                // loop: true,
218                autoplay: true,
219                autoplayTimeout: 10000,
220                onInitialized: startProgressBar,
221                onTranslate: resetProgressBar,
222                onTranslated: startProgressBar,
223                autoplayHoverPause: true,
224                // responsive: {
225                //   0: {
226                //     item: 1,
227                //     autoplay: false
228                //   },
229                //   600: {
230                //     items: 1,
231                //     autoplay: true
232                //   }
233                // },
234                responsiveRefreshRate: 100,
235            })
236            .on("changed.owl.carousel", syncPosition);
237    }
238
239    if (sync2 && sync2.length > 0) {
240        sync2
241            .on("initialized.owl.carousel", function () {
242                sync2
243                    .find(".owl-item")
244                    .eq(0)
245                    .addClass("current");
246            })
247            .owlCarousel({
248                // items: slidesPerPage,
249                dots: false,
250                nav: false,
251                smartSpeed: 1000,
252                slideSpeed: 1000,
253                slideBy: slidesPerPage, //alternatively you can slide by 1, this way the active slide will stick to the first item in the second carousel
254                responsiveRefreshRate: 150,
255                autoplay: true,
256                autoplayHoverPause: true,
257                autoplayTimeout: 10000,
258                responsive: {
259                    0: {
260                        items: 1.5
261                    },
262                    600: {
263                        items: 2
264                    },
265                    1000: {
266                        items: 5
267                    }
268                },
269            })
270            .on("changed.owl.carousel", syncPosition2);
271    }
272
273    function syncPosition(el) {
274        //if you set loop to false, you have to restore this next line
275        //var current = el.item.index;
276
277        //if you disable loop you have to comment this block
278        var count = el.item.count - 1;
279        var current = Math.round(el.item.index - el.item.count / 2 - 0.5);
280
281        if (current < 0) {
282            current = count;
283        }
284        if (current > count) {
285            current = 0;
286        }
287
288        //end block
289
290        sync2
291            .find(".owl-item")
292            .removeClass("current")
293            .eq(current)
294            .addClass("current");
295        var onscreen = sync2.find(".owl-item.active").length - 1;
296        var start = sync2
297            .find(".owl-item.active")
298            .first()
299            .index();
300        var end = sync2
301            .find(".owl-item.active")
302            .last()
303            .index();
304
305        if (current > end) {
306            sync2.data("owl.carousel").to(current, 100, true);
307        }
308        if (current < start) {
309            sync2.data("owl.carousel").to(current - onscreen, 100, true);
310        }
311    }
312
313    function syncPosition2(el) {
314        if (syncedSecondary) {
315            var number = el.item.index;
316            sync1.data("owl.carousel").to(number, 100, true);
317        }
318    }
319    sync2.on("click", ".owl-item", function (e) {
320        e.preventDefault();
321        var number = jQuery(this).index();
322        sync1.data("owl.carousel").to(number, 300, true);
323    });
324    function startProgressBar() {
325        // apply keyframe animation
326        $(".slide-progress").css({
327            width: "100%",
328            transition: "width 7500ms"
329        });
330    }
331
332    function resetProgressBar() {
333        $(".slide-progress").css({
334            width: 0,
335            transition: "width 0s"
336        });
337    }
338    function progressBar(elem) {
339        $elem = elem;
340        //build progress bar elements
341        buildProgressBar();
342        //start counting
343        start();
344    }
345
346
347    $(function () {
348        $('.popup-vimeo').magnificPopup({
349            // disableOn: 700,
350            type: 'iframe',
351            mainClass: 'mfp-fade',
352            removalDelay: 160,
353            preloader: false,
354            fixedContentPos: false
355        });
356    });
357
358    $('.doc-panel-toggle .btn').click(function () {
359        $('.doc-panel-wrapper .doc-panel').slideToggle();
360        $('body').toggleClass('overflow-hidden');
361        $('.doc-panel-wrapper .list-group .list-group-item a').click(function () {
362            $('.doc-panel-wrapper .doc-panel').slideUp();
363            $('body').removeClass('overflow-hidden');
364        });
365    });
366
367    //search planner bar in the header start
368    if ($("#searchPlannerByPostalCodeHeader") && $("#searchPlannerByPostalCodeHeader").length > 0) {
369        $("#searchPlannerByPostalCodeHeader").keyup(function () {
370            if ($("#searchPlannerByPostalCodeHeader").val().length > 0) {
371                $("#searchPlannerByPostalCodeHeaderButton").prop("disabled", false)
372            } else {
373                $("#searchPlannerByPostalCodeButton").prop("disabled", true)
374            }
375        })
376    }
377
378    if ($("#searchPlannerByPostalCodeHeaderButton") && ("#searchPlannerByPostalCodeHeaderButton").length > 0) {
379        $("#searchPlannerByPostalCodeHeaderButton").click(function (e) {
380            e.preventDefault()
381            window.location.href = `/find-planner?postalCode=${$("#searchPlannerByPostalCodeHeader").val()}&distance=${$(".form-select[name=distanceSelectorHeader]").val()}`//change the url to dynamic one
382        })
383    }
384    //search planner bar in the header end
385
386    //search planner bar in the footer start
387    if ($("#searchPlannerByPostalCode") && $("#searchPlannerByPostalCode").length > 0) {
388        $("#searchPlannerByPostalCode").keyup(function () {
389            if ($("#searchPlannerByPostalCode").val().length > 0) {
390                $("#searchPlannerByPostalCodeButton").prop("disabled", false)
391            } else {
392                $("#searchPlannerByPostalCodeButton").prop("disabled", true)
393            }
394        })
395    }
396
397    if ($("#searchPlannerByPostalCodeButton") && ("#searchPlannerByPostalCodeButton").length > 0) {
398        $("#searchPlannerByPostalCodeButton").click(function () {
399            window.location.href = `/find-planner?postalCode=${$("#searchPlannerByPostalCode").val()}&distance=${$(".form-select[name=distanceSelectorFooter]").val()}`//change the url to dynamic one
400        })
401    }
402    //search planner bar in the footer end
403
404
405    /*professional site start*/
406    var firstTile = $('.comparisonMatrixTileFirst .comparisonMatrixCol.position-relative');
407    $(firstTile).prepend("<span class='skyblueLeft'></span>")
408
409    var lastTile = $('.comparisonMatrixTileLast .comparisonMatrixCol.position-relative');
410    $(lastTile).append("<span class='skyblue bg-warning'></span>")
411
412    $(window).scroll(function () {
413        didScroll = true;
414    });
415    setInterval(function () {
416        if (didScroll) {
417            didScroll = false;
418            // Check page position
419            if (window.pageYOffset > 100) {
420                $('.headerTop').slideUp();
421            } else {
422                $('.headerTop').slideDown();
423            }
424        }
425    }, 250);
426});
427
428function setCookie(name, value, days) {
429    var expires = "";
430    if (days) {
431        var date = new Date();
432        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
433        expires = "; expires=" + date.toUTCString();
434    }
435    document.cookie = name + "=" + (value || "") + expires + "; path=/";
436}
437function getCookie(name) {
438    var nameEQ = name + "=";
439    var ca = document.cookie.split(';');
440    for (var i = 0; i < ca.length; i++) {
441        var c = ca[i];
442        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
443        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
444    }
445    return null;
446}
447function eraseCookie(name) {
448    document.cookie = name + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
449}
450
451TrackingConsentManager = (function () {
452    var consentCookieName = "sf-tracking-consent";
453    var consentDialogHtml = "";
454    var consentDialog = null;
455    var eventListeners = { AfterDialogDisplayed: [], BeforeDialogClosed: [], ConsentChanged: [], };
456    function closeConsentDialog() {
457        if (consentDialog == null) {
458            return;
459        } invokeEventListeners("BeforeDialogClosed", [consentDialog]);
460        document.body.removeChild(consentDialog);
461        consentDialog = null;
462    } function openConsentDialog() {
463        if (!document.body) {
464            return;
465        } closeConsentDialog();
466        consentDialog = document.createElement("div");
467        consentDialog.classList.add("cookie-consent")
468        var dialogHtml = document.getElementById("sf-tracking-consent-manager");
469        if (dialogHtml) {
470            consentDialogHtml = dialogHtml.textContent;
471            consentDialog.innerHTML = consentDialogHtml;
472            document.body.insertBefore(consentDialog, document.body.childNodes[0]);
473        } var scripts = consentDialog.getElementsByTagName("script");
474        for (var idx = 0;
475            idx < scripts.length;
476            idx++) {
477            try {
478                eval(scripts[idx].textContent);
479            } catch (err) {
480                console.error(err);
481            }
482        } invokeEventListeners("AfterDialogDisplayed", [consentDialog]);
483    } function openDialogIfConsentNotProvided() {
484        var userConsent = readCookie(consentCookieName);
485        if (userConsent != null) {
486            return;
487        } openConsentDialog();
488    } function createCookie(name, value, days) {
489        if (days) {
490            var date = new Date();
491            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
492            var expires = "; expires=" + date.toGMTString();
493        } else {
494            var expires = "";
495        } document.cookie = name + "=" + value + expires + "; path=/";
496    } function readCookie(name) {
497        var nameEQ = name + "=";
498        var ca = document.cookie.split(";");
499        for (var i = 0;
500            i < ca.length;
501            i++) {
502            var c = ca[i];
503            while (c.charAt(0) == " ") {
504                c = c.substring(1, c.length);
505            } if (c.indexOf(nameEQ) == 0) {
506                return c.substring(nameEQ.length, c.length);
507            }
508        } return null;
509    } function findChildById(root, id) {
510        if (!root) {
511            return null;
512        } if (!root.childNodes) {
513            return null;
514        } for (var index = 0;
515            index < root.childNodes.length;
516            index++) {
517            var child = root.childNodes[index];
518            if (child.id == id) {
519                return child;
520            } var subChild = findChildById(child, id);
521            if (subChild != null) {
522                return subChild;
523            }
524        } return null;
525    } function invokeEventListeners(eventName, args) {
526        var collection = eventListeners[eventName];
527        if (!collection) {
528            return;
529        } for (var index = 0;
530            index < collection.length;
531            index++) {
532            try {
533                collection[index].apply(this, args);
534            } catch (err) {
535                console.error("TrackingConsentManager: Event listener of " + eventName + " event thew error: " + err);
536            }
537        }
538    } if (window.addEventListener) {
539        window.addEventListener("DOMContentLoaded", openDialogIfConsentNotProvided, false);
540    } else {
541        if (window.attachEvent) {
542            window.attachEvent("onload", openDialogIfConsentNotProvided);
543        }
544    } return {
545        canTrackCurrentUser: function () {
546            return readCookie(consentCookieName) == "true";
547        }, askForUserConsent: function () {
548            openConsentDialog();
549        }, updateUserConsent: function (consent) {
550            var accepted = Boolean(consent);
551            var oldState = this.canTrackCurrentUser();
552            createCookie(consentCookieName, accepted, 9999);
553            if (accepted != oldState) {
554                invokeEventListeners("ConsentChanged", [accepted]);
555            } closeConsentDialog();
556        }, addEventListener: function (eventName, listener) {
557            if (typeof listener != "function") {
558                return;
559            } var collection = eventListeners[eventName];
560            if (!collection) {
561                return;
562            } collection.push(listener);
563        }, removeEventListener: function (eventName, listener) {
564            if (typeof listener != "function") {
565                return;
566            } var collection = eventListeners[eventName];
567            if (!collection) {
568                return;
569            } var index = collection.indexOf(listener);
570            if (index < 0) {
571                return;
572            } collection.splice(index, 1);
573        }
574    };
575})();

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.