PageSourceSearch

https://www.thomasvillecabinetry.com/Thomasville/Scripts/TVL/custom.js

js thomasvillecabinetry.com collected 2026-10-05 05:04:27 UTC 20,452 bytes, 531 lines download raw bytes

1$(document).ready(function () {
2    $('.main-content .card-panel h2 a[href="#"]').click(function () {
3        return false;
4    });
5    $('.main-content .card-panel .card-block a[href="#"]').click(function () {
6        return false;
7    });
8    //Mobile Menu
9    $('#mobile-menu').sidr({
10        name: 'sidr-existing-content',
11        source: '.TVL-ham-logo, .main-nav nav, .utility-nav nav',
12        displace: false,
13        renaming: false
14    });
15    // $('.callout-content').matchHeight();
16    // $('.callout-content p').matchHeight();
17    $('.text-callouts h4, .reviews h4').matchHeight();
18    $(".mobile-close").click(function () {
19        $.sidr("close", "sidr-existing-content");
20    });
21    /*PHASE 1B - Favorites page share to work PHASE 1B*/
22    $(document).on('click', '.shareLink', function(){
23        $(this).parent().find('.shareIconContent').slideToggle();
24    });
25    /*PHASE 1B - Favorites page share to work PHASE 1B*/
26    //Footer links show
27    if ($(window).width() <= 768) {
28        $('.footercol-title').each(function () {
29            $(this).click(function () {
30                $(this).parent().find('ul').fadeToggle();
31                $(this).toggleClass('active-footer-link');
32                $(this).parent().find('span').toggleClass('expand');
33            });
34        });
35        $('.footercol-title a').click(function (event) {
36            event.preventDefault();
37        });
38        /*PHASE 1B - moved this to search-results.js PHASE 1B*/
39        /*$('.block-title ').click(function () {
40            $('.fre-search-items').fadeToggle();
41            $(this).toggleClass('expand');
42        });*/
43        /*PHASE 1B - moved this to search-results.js PHASE 1B*/
44    } else {
45        $('.geo-overlay').click(function () {
46            $('#loc-overlay').fadeIn('fast');
47        });
48        $('.overlay-title .close').click(function (e) {
49            $('#loc-overlay').hide();
50
51            e.stopPropagation();
52        });
53        $('.global-search ul').appendTo('.sm-search');
54    }
55    $('.mobile-search, .sm-search').click(function () {
56        $('.global-search').fadeToggle('fast');
57    });
58    /*PHASE 1B - moved out of the if condition as this is needed for max-width 991px PHASE 1B*/
59    $(".sidebar-title").click(function () {
60        $('.sidenav-list, .rc-link, .interior_sidebar .accordion').fadeToggle();
61        $(this).toggleClass('expand');
62    });
63    /*PHASE 1B - moved out of the if condition as this is needed for max-width 991px PHASE 1B*/
64    if ($(window).width() < 992) {
65        $('.mobile-location a').on('click', function (e) {
66            event.preventDefault();
67            $.featherlight($('#loc-overlay'), {
68                variant: 'mobloc-overlay',
69                closeOnClick: false
70            });
71        });
72    }
73    /**
74     * Footer scroll function
75     */
76    $('.footer-links ul li').find('a').click(function () {
77        var getPos = $('#responsiveTabsDemo').position().top;
78        $("html,body").animate({
79            scrollTop: getPos
80        }, "slow");
81    });
82    //Back tot op
83    if ($('#back-to-top').length) {
84        var scrollTrigger = 100, // px
85            backToTop = function () {
86                var scrollTop = $(window).scrollTop();
87                if (scrollTop > scrollTrigger) {
88                    $('#back-to-top').addClass('show');
89                } else {
90                    $('#back-to-top').removeClass('show');
91                }
92            };
93        backToTop();
94        $(document).on('scroll', function () {
95            backToTop();
96        });
97        $('#back-to-top').on('click', function (e) {
98            e.preventDefault();
99            $('html,body').animate({
100                scrollTop: 0
101            }, 700);
102        });
103    }
104    // When User clicks SEARCH ICON
105    ts_search = 0;
106    $('#search-submit, #search-heading').on('click tap', function (e) {
107        e.preventDefault();
108        if (e.timeStamp != ts_search) {
109            ts_search = e.timeStamp;
110            if ($('#search').val().trim() != "") {
111                console.log("Search in progreess");
112                window.location.href = "/search?q=" + $('#search').val() + "&a=1&v=1";
113            } else {
114                /*PHASE 1B - if screen width less than 992, alert to beshown or toggling the search input box PHASE 1B*/
115                if ($(window).width() < 992) {
116                    alert("Please enter a Search Term");
117                } else {
118                    $('.search').toggleClass('search-expand');
119                }
120                /*PHASE 1B - if screen width less than 992, alert to beshown or toggling the search input box PHASE 1B*/
121            }
122        }
123    });
124    /*PHASE 1B - changed to keypress event as keyup was not getting fired and added error message on empty search PHASE 1B*/
125    // When User presses ENTER Key in Search Field (INPUT) 
126    $("#search").on('keypress', function (event) {
127        if (event.keyCode === 13) {
128            if ($('#search').val().trim() != "") {
129                $("#search-submit").click();
130                console.log("Fires when Enter Key pressed & Search Performed");
131            }
132            else {
133                /*should alert be customized??*/
134                alert("Please enter a Search Term");
135                event.preventDefault();
136            }
137        }
138    });
139    /*PHASE 1B - changed to keypress event as keyup was not getting fired and added error message on empty search PHASE 1B*/
140    /*PHASE 1B - search functionality in error page PHASE 1B*/
141    $(".custom-error-page").on('keypress', '#search-form input[type="text"]', function (e) {
142        if (e.keyCode === 13) {
143            e.preventDefault();
144            if ($(this).val().trim() === '') {
145                alert("Please enter a Search Term");
146            } else {
147                window.location.href = "/search?q=" + $(this).val() + "&a=1&v=1";
148            }
149        }
150    });
151    $(".custom-error-page").on('click tap', '#search-form input[type="submit"]', function (e) {    
152        e.preventDefault();
153        if ($('#search-form input[type="text"]').val().trim() != "") {
154            window.location.href = "/search?q=" + $(".custom-error-page").find('#search-form input[type="text"]').val() + "&a=1&v=1";
155        }
156        else {
157            alert("Please enter a Search Term");
158        }
159    });
160    /*PHASE 1B - search functionality in error page PHASE 1B*/
161    /* Search Functionality Ends ... */
162    $('.findDealer_form_submit').click(function () {
163        var zipCodeVal = $('.findDealer_form_input').val();
164        //console.log(zipCodeVal);
165        $.cookie('mb_zipcode', zipCodeVal, {
166            expires: 30,
167            path: '/'
168        })
169        window.location.href = "/dealer-locator";
170    });
171    fluidvids.init({
172        selector: ['iframe', 'object'], // runs querySelectorAll()
173        players: ['www.youtube.com', 'player.vimeo.com'] // players to support
174    });
175    //Remove Search link from hamburger menu
176    $('.sidr-inner li a').each(function (index, element) {
177        if ($(element).attr("href") == "/search") {
178            $(element).parent().remove();
179        }
180    });
181    setvideoPadding();
182    var MbPageName = $.cookie('mb-page');
183    if (MbPageName == "Dealer Locator") {
184        setDelaerZip();
185    }
186
187    if ($('.homebanner-slide').length > 1) {
188        $('.home-banner').bxSlider({
189            pager: true,
190            controls: true,
191            wrapperClass: 'hero-carousal bx-wrapper',
192            infiniteLoop: true,
193            auto: true
194        });
195    }
196    $('.wtb-leftsidebar input[type="submit"]').click(function () {
197        $.cookie('mb_zipcode', $('input[name="content_0$inputZipCode"]').val());
198        window.location.href = "/dealer-locator";
199    });
200
201    //Footer Links - ABOUT PAGES - To open the specific accordion / tab in About Page when a sublink of ABOUT Page is clicked from Global Footer
202    $(function () {
203        if (location.pathname == '/about') {
204            var getStartedSubURL = window.location.href.slice(window.location.href.indexOf('#') + 1);
205            $('#responsiveTabsDemo .r-tabs-accordion-title a[href^="#' + getStartedSubURL + '"]').parent().removeClass('r-tabs-state-default').addClass('r-tabs-state-active');
206            $('#responsiveTabsDemo #' + getStartedSubURL).removeClass('r-tabs-state-default').addClass('r-tabs-state-active');
207        }
208        if (location.pathname == '/cabinet-reviews') {
209            $('.main-content-wrapper').addClass('cabinet-reviews');
210        }
211    });
212    $('img').attr('data-pin-no-hover', 'true');
213    var iframeUrl = $('iframe').attr('src');
214
215    // adding this outside click event to avoid clashing with iframe mutation observer
216    if(!$('.overlayVideo').length) {
217        $("body").append("<div class='overlayVideo' style='display:none'><span class='closeVideo'>X</span></div>");
218    }
219    
220    $(".video-play, .ytp-button").on('click', function () {
221        $('iframe').attr('src', iframeUrl);
222        $("iframe")[0].src += "&autoplay=0";
223        $("body").addClass("scrollNone");
224        $("iframe.fluidvids-item").addClass("playFullWidth"); 
225        const tmp = $('.video-container').html();
226        $('.video-container').empty().append(tmp);
227        $('.video-container').show();
228        $('.overlayVideo').css('display','block');
229    });
230
231
232    $("body").on("click", "span.closeVideo", function () {
233        $("body").removeClass("scrollNone");
234
235        $('.video-container').hide();
236        $('.video-intro, .video-cover').show();
237        $("iframe.fluidvids-item").removeClass("playFullWidth");
238        $('iframe').attr('src', '');
239        $(".overlayVideo").css('display','none');
240    });
241
242    // Homepage Hero Carousel using slick
243    $(".hero-carousel").slick({
244        autoplay: true,
245        dots: true,
246        dotsClass: "vertical-dots"
247    });
248
249}); //Doc ready ends..
250$(window).resize(function () {
251    setvideoPadding();
252});
253function setvideoPadding() {
254    $('.video-play').click(function () {
255        $('.video-intro, .video-cover').hide();
256        var videocontHeight = $('.video-cover').outerHeight();
257        $('.video-container').show();
258        var fluidvidHeight = $('.fluidvids').outerHeight();
259        //var settopPadding = parseInt(videocontHeight - fluidvidHeight) / 2;
260        // $('.video-container').css({ 'padding-top': settopPadding, 'padding-bottom': settopPadding });
261    });
262}
263$(function () {
264    /*PHASE 1B - Room details page should highlight inspiration gallery in header not products PHASE 1B*/
265    if ($('.breadcrumb a:first-child').length > 0 && $('.breadcrumb a:first-child').attr('href') === '/inspiration-gallery') {
266        $('.main-nav nav a[href^="/' + 'inspiration-gallery' + '"]').first().parent().addClass('active');
267    } else if ($('.breadcrumb a:first-child').length > 0 && $('.breadcrumb a:first-child').attr('href') === '/cabinet-information-resources') {
268        $('.main-nav nav a[href^="/' + 'cabinet-information-resources' + '"]').first().parent().addClass('active');
269    } else if (location.pathname != '/') {
270        $('.main-nav nav a[href^="/' + location.pathname.split("/")[1] + '"]').first().parent().addClass('active');
271    } else {
272
273    }
274    /*PHASE 1B - Room details page should highlight inspiration gallery in header not products PHASE 1B*/
275});
276function setDelaerZip() {
277    var zipcodeval = $.cookie('mb_zipcode');
278    if (zipcodeval == "") {
279        $('#dealloc').val("411057");
280        $.featherlight($('#Whb-overlay'), {
281            closeOnClick: false
282        });
283    }
284    $('.zipsubmit').click(function () {
285        $.cookie('mb_zipcode', $('.featherlight-inner #dealloc').val());
286        window.location.href = "/dealer-locator";
287    });
288}
289$(document).ready(function () {
290
291    // var _a;
292    // // inject YouTube iframe API script on page
293    // var tag = document.createElement('script');
294    // tag.id = 'iframe-demo';
295    // tag.src = 'https://www.youtube.com/iframe_api';
296    // var firstScriptTag = document.getElementsByTagName('script')[0];
297    // (_a = firstScriptTag.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(tag, firstScriptTag);
298
299    
300
301    var TVlocation = $(location).attr("href");
302
303    $(document).on('click', 'div >.bv_stars_button_container', function () {
304        if (TVlocation.indexOf("/products") == -1) {
305            window.location.href = '/cabinet-reviews';
306        }
307
308    });
309
310    $(document).on('click', 'div >.bv_avgRating', function () {
311        if (TVlocation.indexOf("/products") == -1) {
312            window.location.href = '/cabinet-reviews';
313        }
314
315    });
316
317    $(document).on('click', 'div >.bv_numReviews_text', function () {
318        if (TVlocation.indexOf("/products") == -1) {
319            window.location.href = '/cabinet-reviews';
320        }
321
322    });
323
324    $('div#TVLoverlay a').click(function () {
325        
326        $.ajax({
327            type: "POST",
328            url: '/Thomasville/Layouts/TVLOneColumnLayout.aspx/OverlaySession',
329            contentType: "application/json; charset=utf-8"
330        });
331    });
332
333    jQuery(document).on('click', '[data-video]', function (e) {
334        e.preventDefault();
335        let video = $(this).data('video');
336        if (!video) return;
337
338        let videoCode = video.includes('http') ? video.split('?v=')[1] : video;
339        let _html = `
340        <div class="video-container">
341            <div class="video-close"></div>
342            <iframe width="560" height="315" src="https://www.youtube.com/embed/${videoCode}?enablejsapi=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
343        </div>`;
344        jQuery('.video-content').html(_html);
345        jQuery('.video-content').fadeIn();
346        jQuery('.video-content').addClass('show');
347
348        jQuery('.video-container .video-close, .vvideo-content').click(function () {
349            jQuery('.video-content').empty();
350            jQuery('.video-content').fadeOut();
351            jQuery('.video-content').removeClass('show');
352        });
353
354    });
355
356    // call only on decora exclusive-email page
357    if (window.location.href.indexOf("thomasvillecabinetry") > -1) {
358        trackEmailSubscription();
359        setTimeout(function() {
360            trackYouTubeVideos();
361        }, 1000);
362    }
363
364    if ((window.location.href.indexOf("dal") > -1 || window.location.href.indexOf("thomasvillecabinetry") > -1) && window.location.href.indexOf("budget-estimator") > -1 ) {
365        trackBudgetEstimatorEmailEstimate();
366        trackBudgetEstimatorSteps();
367    }
368
369
370    /**
371     * Track Series Callout
372     *
373     * Applies to pages:
374     *  - Home
375     *
376     * Usage:
377     *  - call `trackSeriesCallout()` on page load
378     */
379    function trackEmailSubscription() {
380        var seriesCallout = document.querySelector('.series-callout');
381        if (!seriesCallout)
382            return;
383        var callouts = seriesCallout.querySelectorAll('ul li');
384        callouts.forEach(function (callout) {
385            var link = callout.querySelector('a');
386            var header = callout.querySelector('h3');
387            link === null || link === void 0 ? void 0 : link.addEventListener('click', function (e) {
388                window.dataLayer.push({
389                    eventData: "homepage_collections-".concat(header === null || header === void 0 ? void 0 : header.innerText.trim()),
390                });
391            });
392        });
393    }
394
395    /**
396     * Track Budget Estimator Email Estimate
397     *
398     * Applies to pages:
399     *  - Budget Estimator
400     *
401     * Usage:
402     *  - call `trackBudgetEstimatorEmailEstimate()` on page load
403     */
404    function trackBudgetEstimatorEmailEstimate() {
405        var button = document.querySelector('.budget_estimator .sticky_footer .header button');
406        if (!button)
407            return;
408        button.addEventListener('click', function () {
409            window.dataLayer.push({ eventData: 'budget_estimator-Email Estimate' });
410        });
411    }
412    /**
413     * Track Budget Estimator Steps
414     *
415     * Applies to pages:
416     *  - Budget Estimator
417     *
418     * Usage:
419     *  - call `trackBudgetEstimatorSteps()` on page load
420     */
421    function trackBudgetEstimatorSteps() {
422        var tabs = Array.from(document.querySelectorAll('.stickyNav ul li'));
423        function trackStep(stepNumber) {
424            window.dataLayer.push({
425                eventData: "budget_estimator-Step [".concat(stepNumber, "]"),
426            });
427        }
428        function getActiveStep() {
429            return tabs.findIndex(function (tab) {
430                return tab.classList.contains('stickyNav_item-isActive');
431            });
432        }
433        trackStep(getActiveStep() + 1);
434        var classObserver = new MutationObserver(function () {
435            return trackStep(getActiveStep() + 1);
436        });
437        tabs.forEach(function (element) {
438            return classObserver.observe(element, { attributeFilter: ['class'] });
439        });
440    }
441
442    // YouTube iFrame selector
443    const YOUTUBE_IFRAME_SELECTOR = 'iframe[src*="youtube.com"]'
444
445    // YouTube iFrame API script URL
446    const YOUTUBE_IFRAME_API_SCRIPT_URL = "https://www.youtube.com/iframe_api"
447
448    /**
449     * Track a YouTube video.
450     *
451     * @param iframe The iframe to attach analytics to
452     */
453    function trackYoutubeVideo(iframe) {
454        let playing = false
455        const player = new window.YT.Player(iframe, {
456            events: {
457            onStateChange: event => {
458                if (event.data === window.YT.PlayerState.PLAYING && !playing) {
459                window.dataLayer.push({
460                    eventData: `video_play-[${player.getVideoData().title}]`
461                })
462                playing = true
463                } else if (
464                event.data === window.YT.PlayerState.ENDED ||
465                event.data === window.YT.PlayerState.PAUSED
466                ) {
467                playing = false
468                }
469            }
470            }
471        });
472    }
473
474    /**
475     * Track YouTube Videos
476     *
477     * Applies to pages:
478     *  - Multiple
479     *
480     * Usage:
481     *  - call `trackYouTubeVideos()` on page load
482     *
483     * Requires:
484     * - YouTube embeds to be updated to support JS player API by adding
485     *   `enablejsapi=1` query string parameter to iframe embed src
486     */
487    function trackYouTubeVideos() {
488        // inject YouTube iframe API script on page if it isn't already there
489        if (
490            !document.querySelector(`script[src="${YOUTUBE_IFRAME_API_SCRIPT_URL}"]`)
491        ) {
492            const tag = document.createElement("script")
493            tag.id = "iframe-demo"
494            tag.src = YOUTUBE_IFRAME_API_SCRIPT_URL
495            const firstScriptTag = document.getElementsByTagName("script")[0]
496            firstScriptTag.parentNode?.insertBefore(tag, firstScriptTag)
497        }
498
499        // As soon as the YouTube iFrame API is ready, track all current videos
500        window.onYouTubeIframeAPIReady = () => {
501            const iframes = document.querySelectorAll(YOUTUBE_IFRAME_SELECTOR)
502            iframes.forEach(trackYoutubeVideo)
503        }
504
505        // Create a DOM observer to track all future videos added to the page
506        const observer = new MutationObserver(mutations => {
507            mutations.forEach(mutation => {
508            // mutation.addedNodes.match
509            mutation.addedNodes.forEach(node => {
510                const element = node
511                if (!element.tagName) {
512                return
513                }
514
515                const iframe = element.querySelector(YOUTUBE_IFRAME_SELECTOR)
516                if (iframe) {
517                trackYoutubeVideo(iframe)
518                }
519            })
520            })
521        })
522
523        // Start the observer
524        observer.observe(document.body, {
525            childList: true,
526            subtree: true,
527            attributes: false,
528            characterData: false
529        })
530    }
531});

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.