PageSourceSearch

https://kleinzeeinfo.co.za/wp-content/themes/directory2/design/js/custom.js?ver=6.8.11

js kleinzeeinfo.co.za collected 2026-10-07 16:48:50 UTC 8,026 bytes, 274 lines download raw bytes

1/*
2 * AIT WordPress Theme
3 *
4 * Copyright (c) 2012, Affinity Information Technology, s.r.o. (http://ait-themes.com)
5 */
6
7/* Custom Classes Funtions */
8function renameUiClasses(){
9	var classes = [
10		"ui-accordion",
11		"ui-accordion-header", "ui-accordion-header-active", "ui-corner-top", "ui-accordion-icons",
12		"ui-accordion-header-icon", "ui-icon", "ui-icon-triangle-1-s", "ui-icon-triangle-1-e", "ui-accordion-content-active", "ui-accordion-content",
13		"ui-tabs", "ui-widget", "ui-tabs-vertical", "ui-tabs-horizontal",
14		"ui-tabs-nav", "ui-helper-reset", "ui-helper-clearfix", "ui-widget-header", "ui-corner-all",
15		/*"ui-state-default",*/ "ui-tabs-active", /*"ui-state-active",*/ "ui-corner-left", /*"ui-tabs-anchor",*/
16		"ui-tabs-panel", "ui-widget-content", "ui-corner-bottom", "ui-corner-all"
17	];
18	jQuery.each(classes, function(k, v){
19		var nClass = v.replace("ui-", "ait-");
20		jQuery(".elm-toggles-main ."+v).removeClass(v).addClass(nClass);
21	});
22}
23
24function removeUnwantedClasses(){
25	if(isResponsive(1024)){
26		if(jQuery("body").hasClass("preloading-enabled")){
27			jQuery("body").removeClass("preloading-enabled");
28		}
29	}
30}
31/* Custom Classes Funtions */
32
33/* Plugins Init Functions */
34function initWPGallery(){
35	jQuery(".gallery").each(function(){
36		var rel = jQuery(this).attr('id');
37		jQuery(this).find('.gallery-item').each(function(){
38			var link = jQuery(this).find('a');
39			link.attr('rel', rel);
40			link.colorbox({rel: rel});
41		});
42	});
43}
44
45function initColorbox(){
46	jQuery('body.single-ait-item .social-container .soc.pinterest').find('a').addClass('disable-default-colorbox'); //hotfix to prevent colorbox opening after click on pinterest widget in Item Detail Pages
47	jQuery('a:not(.disable-default-colorbox)[href*=".jpg"],a:not(.disable-default-colorbox)[href*=".jpeg"],a:not(.disable-default-colorbox)[href*=".png"],a:not(.disable-default-colorbox)[href*=".gif"]').each(function(){
48	//jQuery('a[href*=".jpg"],a[href*=".jpeg"],a[href*=".png"],a[href*=".gif"]').each(function(){
49		if(typeof jQuery(this).attr('data-rel') === "undefined" || jQuery(this).attr('data-rel') === false || typeof jQuery(this).attr('rel') === "undefined" || jQuery(this).attr('rel') === false){
50			if(!isMobile() || jQuery(this).parent().hasClass("woocommerce-product-gallery__image")){
51				jQuery(this).colorbox({
52					maxWidth: "95%",
53					maxHeight: "95%",
54					onOpen: true,
55					onClosed: true,
56				});
57			} else {
58				jQuery(this).click(function(e){e.preventDefault();})
59				/*jQuery(this).colorbox({
60					maxWidth: "150%",
61					maxHeight: "150%",
62					onOpen: true,
63					onClosed: true,
64				});*/
65			}
66		}
67	});
68}
69
70function initRatings(){
71	jQuery('.item-rating').raty({
72		font		: true,
73		readOnly	: true,
74		halfShow	: true,
75		starHalf	: 'fa-star-half-o',
76		starOff		: 'fa-star-o',
77		starOn		: 'fa-star',
78		score		: function(){
79			return ((5*jQuery(this).attr('data-rating'))/100);
80		}
81	});
82}
83
84function initInfieldLabels(){
85	jQuery('.comment-form label').inFieldLabels();
86}
87
88function initSelectBox(){
89	jQuery('.selectbox').selectbox();
90
91	var selectId;
92	var oldStyle;
93	if(jQuery('body').hasClass('woocommerce-page')){
94		// wocommerce pages
95		// get all selects except the ones in the content
96		jQuery('select:not(.default-disabled)').not('#content select:not(.default-disabled)').selectbox({
97			onOpen: function(inst){
98				selectId = inst.settings.classHolder+"_"+inst.uid;
99				jQuery("#"+selectId).attr('style', 'z-index: 100 !important');
100			},
101			onClose: function(inst){
102				jQuery("#"+selectId).delay(100).queue(function(next){
103					jQuery(this).removeAttr("style");
104					next();
105				});
106			}
107		});
108
109		jQuery('#content .woocommerce-tabs select#rating').selectbox({
110			onOpen: function(inst){
111				selectId = inst.settings.classHolder+"_"+inst.uid;
112				jQuery("#"+selectId).attr('style', 'z-index: 100 !important');
113			},
114			onClose: function(inst){
115				jQuery("#"+selectId).delay(100).queue(function(next){
116					jQuery(this).removeAttr("style");
117					next();
118				});
119			}
120		});
121	} else {
122		// all other pages
123		jQuery('select:not(.default-disabled)').selectbox({
124			onOpen: function(inst){
125				selectId = inst.settings.classHolder+"_"+inst.uid;
126				jQuery("#"+selectId).attr('style', 'z-index: 100 !important');
127			},
128			onClose: function(inst){
129				jQuery("#"+selectId).delay(100).queue(function(next){
130					jQuery(this).removeAttr("style");
131					next();
132				});
133			}
134		});
135	}
136}
137
138function notificationClose(){
139	jQuery('.ait-sc-notification a.close').click(function(e){
140		e.preventDefault();
141		jQuery(this).parent().fadeOut('slow');
142	});
143}
144
145function touchFriendlyHover(elms){
146	var basicClass = ".ait-toggle-hover";
147
148	elms = typeof elms !== 'undefined' ? elms : [];
149	elms.push(basicClass);
150
151	var action = {
152		click: function(elm, isPseudo) {
153			jQuery(elm).click(function(e) {
154				e.preventDefault();
155				var $element = action.createElm(jQuery(this), isPseudo);
156				if(!$element.hasClass('hover')) {
157					action.hideOthers(elms);
158				}
159				$element.toggleClass('hover');
160			});
161		},
162		hover: function(elm, isPseudo) {
163			var $element = action.createElm(jQuery(elm), isPseudo);
164
165			$element.mouseenter(function() {
166				jQuery(this).addClass('hover');
167			});
168
169			$element.mouseleave(function() {
170				jQuery(this).removeClass('hover');
171			});
172		},
173		hideOthers: function(elms) {
174			jQuery.each(elms, function(i, elm) {
175				var isPseudo = action.checkForPseudo(elm);
176				var elm = action.removePseudo(elm, isPseudo);
177				var $element = action.createElm(jQuery(elm), isPseudo);
178				$element.removeClass('hover');
179			});
180			jQuery(document).trigger('touchFriendlyHover_HideOthers');
181		},
182		checkForPseudo: function(elm) {
183			var bool = false;
184			if(elm.indexOf(':before') !== -1 || elm.indexOf(':after') !== -1 ) {
185				bool = true;
186			}
187			return bool;
188		},
189		removePseudo: function(elm, bool) {
190			if(bool) {
191				elm = elm.replace(':before','').replace(':after','');
192			}
193			return elm;
194		},
195		createElm: function($obj, bool) {
196			return $obj = bool ? $obj : $obj.parent();
197		}
198	}
199
200	jQuery.each(elms, function(i, elm){
201		var isPseudo = action.checkForPseudo(elm);
202		var elm = action.removePseudo(elm, isPseudo);
203
204		if(!jQuery(elm).hasClass('ait-click-only') && !isResponsive(640)) {
205			action.hover(elm, isPseudo);
206		}
207		action.click(elm, isPseudo);
208	});
209}
210
211function enableResponsiveToggleAreas(anim) {
212	var toggles = jQuery('.ait-toggle-area-btn');
213	var toggleAreas = function(elm) {
214		if(!anim || !jQuery(elm).hasClass('active')) {
215			jQuery(elm).toggleClass('active');
216		} else {
217			if(jQuery(elm).hasClass('active')) {
218				jQuery(elm).addClass('animate');
219			}
220			setTimeout(function() {
221				jQuery(elm).removeClass('animate');
222				jQuery(elm).toggleClass('active');
223			}, 300);
224		}
225	}
226
227	jQuery.each(toggles, function(i, toggle){
228		jQuery(toggle).click(function(e){
229			e.preventDefault();
230			var group = jQuery(this).parent().parent().parent();
231
232			/* Update group buttons firstly */
233			if(group.hasClass('ait-toggle-area-group-container')) {
234				group.addClass('has-active');
235				var siblings = jQuery(this).siblings('.active');
236				jQuery.each(siblings, function(i, sibling){
237					jQuery(sibling).toggleClass('active');
238					var siblingAreas = jQuery(sibling).data('toggle');
239					if(jQuery.isArray(siblingAreas)){
240						jQuery.each(siblingAreas, function(i, siblingArea){
241							toggleAreas(siblingArea, anim = false);
242						});
243					} else {
244						toggleAreas(siblingAreas, anim = false);
245					}
246				});
247			}
248
249			/* Activate Toggle */
250			jQuery(this).toggleClass('active');
251			if(jQuery(this).attr('id')) {
252				jQuery(document).trigger(jQuery(this).attr('id'));
253			}
254
255			var areas = jQuery(this).data('toggle');
256			if(jQuery.isArray(areas)){
257				jQuery.each(areas, function(i, area){
258					toggleAreas(area);
259				});
260			} else {
261				toggleAreas(areas);
262			}
263
264			/* Update group state */
265			if(group.hasClass('ait-toggle-area-group-container') && group.find('.active:not(.animate)').length != 0) {
266				group.addClass('has-active');
267			} else {
268				group.removeClass('has-active');
269			}
270
271		});
272	});
273}
274/* Plugins Init Functions */

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.