PageSourceSearch

https://www.cookremodeling.com/wp-content/themes/volt/js/custom.js?ver=6.2.10

js cookremodeling.com collected 2026-09-26 18:06:18 UTC 6,964 bytes, 238 lines download raw bytes

1/*
2 * custom.js
3 * Custom JS code required by the theme.
4 */
5jQuery(function ($) {
6
7    'use strict';
8
9    // Remove no-js class on page load
10    $('html').removeClass('no-js').addClass('js-enabled');
11
12
13    // Image preloader
14    var target = $('.slide, .entry-thumb a, .minifolio li a, .pl_thumb, .post-thumb, .thumb_big a, .thumb_medium a'),
15        images = target.find('img'),
16        counter = 0,
17        i = 0,
18        loaded = [],
19        nextDelay = 0,
20        timer;
21    images.each(function () {
22        if ($(this).parent().length === 0) {
23            $(this).wrap('<span class="preload" />');
24        } else {
25            $(this).parent().addClass('preload');
26        }
27        i += 1;
28        loaded[i] = false;
29    });
30
31    function removeclass(selector) {
32        return function () {
33            selector.parent().removeClass('preload');
34        };
35    }
36
37    images = $.makeArray(images);
38
39    timer = setInterval(function () {
40        if (counter >= loaded.length) {
41            clearInterval(timer);
42            return;
43        }
44        for (i = 0; i < images.length; i += 1) {
45            if (images[i].complete) {
46                if (loaded[i] === false) {
47                    loaded[i] = true;
48                    counter += 1;
49                    nextDelay = nextDelay + 100;
50                }
51                $(images[i]).css('visibility', 'visible').delay(nextDelay).animate({
52                    opacity: 1
53                }, 300, removeclass($(images[i])));
54            } else {
55                $(images[i]).css({
56                    'visibility': 'hidden',
57                    opacity: 0
58                });
59            }
60        }
61    }, 100);
62});
63
64// document.ready call
65jQuery(document).ready(function ($) {
66
67    'use strict';
68
69    var top_offset,
70        tog = 1;
71
72    // Responsive navigation drop-down
73    if (!(ss_custom === 'undefined') && ss_custom.enable_responsive_menu) {
74        $('<div />').attr('class', 'menu-drop').appendTo('#responsive-menu');
75
76        if ($('#main-nav').html()) {
77            $('ul.nav-menu').clone().removeClass('nav-menu').appendTo('.menu-drop');
78        }
79
80        if ($('#optional-nav').html()) {
81            $('ul.sec-menu').clone().removeClass('sec-menu').appendTo('.menu-drop').addClass('optional-menu');
82        }
83
84        // Clone responsive menu
85        if (ss_custom.main_bar_sticky) {
86            if ($('#responsive-menu').html()) {
87                $('#responsive-menu').clone().appendTo('body').addClass('resp-sticky').attr('id', 'responsive-menu-2');
88            }
89            $('#responsive-menu-2').find('#menu-button-1').attr('id', 'menu-button-2');
90        }
91
92        $('.menu-button').click(function () {
93            $('.menu-drop').slideToggle(300);
94            $('.menu-button').toggleClass('activetoggle');
95            return false;
96        });
97    }
98
99    // Clone menu bars
100    if (!(ss_custom === 'undefined') && ss_custom.top_bar_sticky) {
101        if ($('#utility-top').html()) {
102            $('#utility-top').clone().appendTo('body').addClass('sec-sticky').attr('id', 'utility-top-2');
103        }
104    }
105
106    if (!(ss_custom === 'undefined') && ss_custom.main_bar_sticky) {
107        if ($('#main-nav').html()) {
108            $('#main-nav').clone().appendTo('body').addClass('main-sticky').attr('id', 'main-nav-2');
109            top_offset = $('#utility-top').outerHeight();
110        }
111    }
112
113    if (!(ss_custom === 'undefined') && ss_custom.top_bar_sticky && ss_custom.main_bar_sticky) {
114        $('#main-nav-2, #responsive-menu-2').css({
115            top: top_offset
116        });
117    }
118
119    // Calculate max height for sticky menu and set scroll bars
120    function setScrollBars() {
121        if (!(ss_custom === 'undefined') && ss_custom.enable_responsive_menu && ss_custom.main_bar_sticky) {
122            var win_height = $(window).height(),
123                button_height = $('.menu-button').outerHeight(),
124                top_menu_height = 0,
125                max_height;
126
127            if (!(ss_custom === 'undefined') && ss_custom.top_bar_sticky) {
128                top_menu_height = $('.sec-sticky').outerHeight();
129            }
130            max_height = win_height - button_height - top_menu_height;
131            $('#responsive-menu-2').find('.menu-drop').css({
132                maxHeight: max_height
133            });
134        }
135    }
136
137    setScrollBars();
138
139    $(window).resize(function () {
140        setScrollBars();
141    });
142
143    // Navbar Animation
144    function animateNav() {
145        var win_scroll = $(window).scrollTop(),
146            sec_menu = $('#utility-top-2'),
147            main_menu = $('#main-nav-2'),
148            resp_menu = $('#responsive-menu-2');
149
150        if (win_scroll > 100) {
151            sec_menu.fadeIn();
152        } else {
153            sec_menu.fadeOut();
154        }
155
156        if (win_scroll > 300) {
157            main_menu.fadeIn();
158            resp_menu.fadeIn();
159        } else {
160            main_menu.fadeOut();
161            resp_menu.fadeOut();
162        }
163
164    }
165
166    animateNav();
167
168    $(window).scroll(function () {
169        animateNav();
170    });
171
172    // Navigation drop down effect
173    $('.primary-nav ul.sub-menu, .secondary-nav ul.sub-menu').css({
174        display: "none"
175    });
176
177    function showMenu() {
178        $(this).find('ul:first').css({
179            visibility: "visible",
180            display: "none"
181        }).slideDown(300);
182    }
183
184    function hideMenu() {
185        $(this).find('ul:first').css({
186            visibility: "visible",
187            display: "none"
188        });
189    }
190
191    $('.primary-nav li, .secondary-nav li').hover(showMenu, hideMenu);
192
193
194    // Scroll to top button
195    $('.scroll-to-top').hide();
196    $(window).scroll(function () {
197        if ($(this).scrollTop() > 100) {
198            $('.scroll-to-top').fadeIn(300);
199        } else {
200            $('.scroll-to-top').fadeOut(300);
201        }
202    });
203
204    $('.scroll-to-top a').click(function () {
205        $('html, body').animate({
206            scrollTop: 0
207        }, 500);
208        return false;
209    });
210
211
212    // PrettyPhoto Init
213    $('a[data-rel]').each(function () {
214        $(this).attr('rel', $(this).data('rel'));
215    });
216
217    if ($.fn.prettyPhoto) {
218        $("a[rel^='prettyPhoto[group1]'], a[rel^='prettyPhoto[group2]'], a[rel^='prettyPhoto[inline]'], a[rel^='prettyPhoto']").prettyPhoto();
219    }
220
221    // Live preview option panel
222/*    $('.option-panel').css({
223        left: "-218px"
224    });
225    $('.option-btn a').click(function () {
226        tog += 1;
227        if (tog % 2 === 0) {
228            $('.option-panel').stop().animate({
229                left: "0px"
230            }, 300);
231        } else {
232            $('.option-panel').stop().animate({
233                left: "-218px"
234            }, 300);
235        }
236        return false;
237    });*/
238});

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.