PageSourceSearch

https://www.polishyourkitchen.com/wp-content/themes/pb-tomato/js/scripts.js?ver=1.1

js polishyourkitchen.com collected 2026-10-02 10:43:08 UTC 3,997 bytes, 165 lines download raw bytes

1/**
2 *	@package PB_Tomato
3 *	@since 1.1
4 */
5(function($) {
6	"use strict";
7
8	var PB_Tomato = {
9
10		cache: {},
11
12		init: function() {
13			this.cacheElements();
14			this.bindEvents();
15		},
16
17		cacheElements: function() {
18			this.cache.$window     = $(window);
19			this.cache.$document   = $(document);
20			this.cache.$body       = $('body');
21			this.cache.$menuWrap   = $('.topbar');
22			this.cache.$menuToggle = $('.menu-toggle');
23			this.cache.$adminbar   = $('#wpadminbar');
24			this.cache.dontClose   = false;
25		},
26
27		bindEvents: function() {
28			var self = this;
29			
30			// FitVids.
31			self.cache.$document.on('ready post-load', function() {
32				self.fitVidsInit();
33			});
34
35			// owlCarousel.
36			self.cache.$document.on('ready post-load', function() {
37				self.owlCarouselInit();
38			});
39
40			// Mobile Menu.
41			self.cache.$menuToggle.on('click', function(e) {
42				e.preventDefault();
43				e.stopPropagation();
44				self.mobileMenu();
45			});
46			self.cache.$document.on('click', 'body.pushed', function() {
47				if ( false === self.cache.dontClose ) {
48					self.mobileMenu();
49				}
50				self.cache.dontClose = false;
51			});
52			self.cache.$menuWrap.on('click', function(e) {
53				self.cache.dontClose = true;
54			});
55
56			// Back to top.
57			self.cache.$document.on('ready post-load', function() {
58				self.backtoTop();
59			});
60
61			// Auto set min height.
62			self.cache.$window.on('load resize', function() {
63				self.setHeights();
64			});
65		},
66
67		// Initialize the FitVids script.
68		fitVidsInit: function() {
69			if ( ! $.fn.fitVids ) {
70				return;
71			};
72			this.cache.$fitvids = $('.site-main');
73			this.cache.$fitvids.fitVids();
74		},
75
76		// Initialize the owlCarousel script.
77		owlCarouselInit: function() {
78			if ( ! $.fn.owlCarousel ) {
79				return;
80			}
81			this.cache.$owlcarousel = $('.featured-content-inner');
82			if ( this.cache.$owlcarousel.length < 1 ) {
83				return;
84			};
85			
86			var args = {
87				autoPlay: true,
88				stopOnHover: true,
89				singleItem: true,
90				pagination: false,
91				navigation: true,
92				navigationText: ['<span class="icon icon-left-long-circle"></span>', '<span class="icon icon-right-long-circle"></span>']
93			};
94			this.cache.$owlcarousel.owlCarousel(args);
95		},
96
97		// Mobile Menu.
98		mobileMenu: function() {
99			var $body     = this.cache.$body,
100				$menuWrap = this.cache.$menuWrap,
101				$adminbar = this.cache.$adminbar;
102			if( ! $body.hasClass('pushed') ) {
103				$adminbar.removeClass('moved');
104				$menuWrap.hide();
105			};
106
107			if ( $menuWrap.hasClass('on-canvas') ) {
108				$body.removeClass('pushed');
109				$menuWrap.removeClass('on-canvas');
110			} else {
111				$body.addClass('pushed');
112				$menuWrap.addClass('on-canvas').show();
113				$adminbar.addClass('moved');
114			};
115		},
116
117		// Back to Top.
118		backtoTop: function() {
119			var $div      = $('.back-to-top'),
120				$window   = this.cache.$window;
121			if( $div.length < 1 ) {
122				return;
123			};
124			$div.on('click', function(e) {
125				e.preventDefault();
126				$('html, body').animate({ scrollTop: 0 }, 300);
127			});
128			$window.scroll( function() {
129				if( $window.scrollTop() > 500 ) {
130					if( $div.is(":visible") === false ) {
131						$div.fadeIn(300);
132					}
133				}
134				else {
135					$div.stop(true, true).fadeOut(50);
136				}
137			});
138		},
139
140		// equal Height.
141		setHeights: function() {
142			var $list = $('.group__height'),
143				$item = $('.item__height');
144			$item.css('min-height', 'auto');
145			var perRow = Math.floor( $list.width() / $item.width() );
146			if( perRow == null || perRow < 2 ) {
147				return true;
148			};
149			for( var i = 0, j = $item.length; i < j; i += perRow ) {
150				var maxHeight = 100,
151					$row = $item.slice(i, i + perRow);
152				$row.each( function() {
153					var itemHeight = parseInt( $(this).outerHeight() );
154					if( itemHeight > maxHeight ) {
155						maxHeight = itemHeight;
156					}
157				});
158				$row.css('min-height', maxHeight);
159			}
160		}
161	};
162
163	PB_Tomato.init();
164	
165})(jQuery);

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.