PageSourceSearch

https://modehaus-ahlert-app.de/wp-content/themes/stratusx/assets/js/main.js?ver=1.1

js modehaus-ahlert-app.de collected 2026-10-02 01:52:15 UTC 10,977 bytes, 345 lines download raw bytes

1"use strict";
2/**
3 * General Custom JS Functions
4 *
5 * @author     Themovation <[email protected]>
6 * @copyright  2014 Themovation INC.
7 * @license    http://themeforest.net/licenses/regular
8 * @version    1.1
9 */
10
11/*
12 # Helper Functions
13 # On Window Resize
14 # On Window Load
15 */
16
17//======================================================================
18// Helper Functions
19//======================================================================
20
21//-----------------------------------------------------
22// NAVIGATION - Adds support for Mobile Navigation
23// Detect screen size, add / subtract data-toggle
24// for mobile dropdown menu.
25//-----------------------------------------------------	
26function themo_support_mobile_navigation(){
27	
28	// If mobile navigation is active, add data attributes for mobile touch / toggle
29	if (Modernizr.mq('(max-width: 767px)')) {
30		//console.log('Adding data-toggle, data-target');
31		jQuery("li.dropdown .dropdown-toggle").attr("data-toggle", "dropdown");
32		jQuery("li.dropdown .dropdown-toggle").attr("data-target", "#");
33	}
34	
35	// If mobile navigation is NOT active, remove data attributes for mobile touch / toggle
36	if (Modernizr.mq('(min-width:768px)')) {
37		//console.log('Removing data-toggle, data-target');
38		jQuery("li.dropdown .dropdown-toggle").removeAttr("data-toggle", "dropdown");
39		jQuery("li.dropdown .dropdown-toggle").removeAttr("data-target", "#");
40	}
41}
42
43
44//-----------------------------------------------------
45// Detect if touch device via modernizr, return true
46//-----------------------------------------------------	
47function themo_is_touch_device(checkScreenSize){
48
49	if (typeof checkScreenSize === "undefined" || checkScreenSize === null) { 
50    	checkScreenSize = true; 
51	}
52
53	var deviceAgent = navigator.userAgent.toLowerCase();
54 
55
56    var isTouch = (deviceAgent.match(/(iphone|ipod|ipad)/) ||
57		deviceAgent.match(/(android)/)  || 
58		deviceAgent.match(/iphone/i) || 
59		deviceAgent.match(/ipad/i) || 
60		deviceAgent.match(/ipod/i) || 
61		deviceAgent.match(/blackberry/i));
62	
63	if(checkScreenSize){
64		var isMobileSize = Modernizr.mq('(max-width:767px)');
65	}else{
66		var isMobileSize = false;
67	}
68	
69	if(isTouch || isMobileSize ){
70		return true;
71	}
72
73	return false;
74}
75
76
77//-----------------------------------------------------
78// Disable Transparent Header for Mobile
79//-----------------------------------------------------
80function themo_no_transparent_header_for_mobile(isTouch){
81	
82	if (jQuery(".navbar[data-transparent-header]").length) {
83		if(isTouch){ 
84			jQuery('.navbar').attr("data-transparent-header", "false");		
85		}
86		else{
87			jQuery('.navbar').attr("data-transparent-header", "true");		
88		}
89	}
90}
91
92
93
94
95
96//-----------------------------------------------------
97// Scroll Up
98//-----------------------------------------------------
99function themo_start_scrollup() {
100	
101	jQuery.scrollUp({
102		animationSpeed: 200,
103		animation: 'fade',
104		scrollSpeed: 500,
105		scrollImg: { active: true, type: 'background', src: '../../images/top.png' }
106	});
107}
108
109
110
111var nice = false;
112
113/**
114 * Protect window.console method calls, e.g. console is not defined on IE
115 * unless dev tools are open, and IE doesn't define console.debug
116 */
117(function() {
118
119	//retinajs();
120
121	if (!window.console) {
122		window.console = {};
123	}
124	// union of Chrome, FF, IE, and Safari console methods
125	var m = [
126		"log", "info", "warn", "error", "debug", "trace", "dir", "group",
127		"groupCollapsed", "groupEnd", "time", "timeEnd", "profile", "profileEnd",
128		"dirxml", "assert", "count", "markTimeline", "timeStamp", "clear"
129	];
130	// define undefined methods as noops to prevent errors
131	for (var i = 0; i < m.length; i++) {
132		if (!window.console[m[i]]) {
133			window.console[m[i]] = function() {};
134		}
135	}
136})();
137
138//======================================================================
139// Executes when HTML-Document is loaded and DOM is ready
140//======================================================================
141jQuery(document).ready(function($) {
142	"use strict";
143
144    // Preloader : Is really only used for the flexslider but is added to the body tag.
145    // If flex is detected, we put a timeout on it (5s( so it does not get stuck spinning.
146    // If no flex, then disable.
147    if (jQuery("#main-flex-slider")[0]){
148        // Do nothing / flex will figure it out.
149        setTimeout(function(){
150            jQuery('body').addClass('loaded');
151        }, 10000);
152    }else{
153        jQuery('body').addClass('loaded');
154    }
155
156    // add body class for touch devices.
157    if (themo_is_touch_device()) {
158        jQuery('body').addClass('th-touch');
159    }
160
161	// Add support for mobile navigation
162	themo_support_mobile_navigation($);
163
164    // Support for sub menu navigation / also works with sticky header.
165
166    jQuery("body").on("click", "ul.dropdown-menu .dropdown-submenu > a[data-toggle='dropdown']", function(event){
167        //console.log($(this).text());
168        event.preventDefault();
169        event.stopPropagation();
170        jQuery(this).parents('ul.dropdown-menu .dropdown-submenu').toggleClass('open');
171    });
172
173    // Sticky Header - Set options
174    var options = {
175        // Scroll offset. Accepts Number or "String" (for class/ID)
176        offset: 125, // OR — offset: '.classToActivateAt',
177
178        classes: {
179            clone:   'headhesive--clone',
180            stick:   'headhesive--stick',
181            unstick: 'headhesive--unstick'
182        },
183
184        // If the top nav bar menu is open, close it.
185        onStick:   function () {
186
187            //jQuery( "header:not('.headhesive--stick') .navbar-toggle").not( ".collapsed" ).trigger( "click" );
188			jQuery('.navbar-collapse').css('height', '0');
189			jQuery('.navbar-collapse').removeClass('in');
190        },
191        // If the top nav bar menu is open, close it.
192        onUnstick:   function () {
193
194            //jQuery( "header:not('.headhesive--stick') .navbar-toggle").not( ".collapsed" ).trigger( "click" );
195			jQuery('.navbar-collapse').css('height', '0');
196			jQuery('.navbar-collapse').removeClass('in');
197        },
198        // Throttle scroll event to fire every 250ms to improve performace
199        throttle: 250,
200    };
201
202
203    try
204    {
205        // Initialise with options
206        var banner = new Headhesive('body.th-sticky-header .banner', options);
207        jQuery('body.th-sticky-header').addClass('headhesive');
208    }
209    catch (err) {
210        console.log('Sticky header deactivated. WP Dash / Appearance / Customize / Theme Options / Menu & Header');
211    }
212
213    // Close sticky header on menu item click.
214    jQuery('.navbar-collapse a:not(.dropdown-toggle)').live( "click", function() {
215        //jQuery( ".navbar-toggle").not( ".collapsed" ).trigger( "click" );
216        jQuery('.navbar-collapse').css('height', '0');
217        jQuery('.navbar-collapse').removeClass('in');
218    });
219
220    /**
221     * Check a href for an anchor. If exists, and in document, scroll to it.
222     * If href argument ommited, assumes context (this) is HTML Element,
223     * which will be the case when invoked by jQuery after an event
224     */
225    function scroll_if_anchor(href) {
226        href = typeof(href) == "string" ? href : jQuery(this).attr("href");
227
228        var fromTop = 0;
229        if (jQuery("header").hasClass("headhesive--clone")) {
230            fromTop = jQuery(".headhesive--clone").height() ;
231        }
232
233        // You could easily calculate this dynamically if you prefer
234        //var fromTop = 50;
235
236        // If our Href points to a valid, non-empty anchor, and is on the same page (e.g. #foo)
237        // Legacy jQuery and IE7 may have issues: http://stackoverflow.com/q/1593174
238        if(href.indexOf("#") == 0) {
239            var $target = jQuery(href);
240
241            // Older browser without pushState might flicker here, as they momentarily
242            // jump to the wrong position (IE < 10)
243            if($target.length) {
244                //console.log('STRATUS Anchor detected - Scroll  ' + $target.offset().top);
245                //console.log('STRATUS Anchor detected - Offset ' + fromTop);
246                jQuery('html, body').animate({ scrollTop: $target.offset().top - fromTop }, 500, 'linear', function() {
247                    //alert("Finished animating");
248                });
249                if(history && "pushState" in history) {
250                    history.pushState({}, document.title, window.location.pathname + href);
251                    return false;
252                }
253            }
254        }
255    }
256
257    // When our page loads, check to see if it contains and anchor
258    scroll_if_anchor(window.location.hash);
259
260
261    // Detect and set isTouch for touch screens
262    //	var isTouch = themo_is_touch_device();
263
264    // Set off set for waypoints
265    //if(!isTouch){
266        //Setup waypoints plugin
267
268        var th_offset = 0;
269        if (jQuery("header").hasClass("headhesive--clone")) {
270            th_offset = jQuery(".headhesive--clone").height() ;
271        }
272
273        // Add space for Elementor Menu Anchor link
274        jQuery( window ).on( 'elementor/frontend/init', function() {
275            elementorFrontend.hooks.addFilter( 'frontend/handlers/menu_anchor/scroll_top_distance', function( scrollTop ) {
276            	//console.log('ELEM HOOK - Scroll offset ' + th_offset);
277                return scrollTop - th_offset;
278            } );
279        } );
280    //}
281
282
283	if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
284		//console.log('Smooth Scroll Off (Safari).');
285	}else{
286		try 
287		{
288			// Initialise with options
289			nice = jQuery("html").niceScroll({
290			zindex:20000,
291			scrollspeed:60,
292			mousescrollstep:60,
293			cursorborderradius: '10px', // Scroll cursor radius
294			cursorborder: '1px solid rgba(255, 255, 255, 0.4)',
295			cursorcolor: 'rgba(0, 0, 0, 0.6)',     // Scroll cursor color
296			//autohidemode: 'true',     // Do not hide scrollbar when mouse out
297			cursorwidth: '10px',       // Scroll cursor width
298			autohidemode: false,
299			
300				});
301		} 
302		catch (err) {
303			//console.log('Smooth Scroll Off.');
304		}
305	}
306
307});
308
309
310//======================================================================
311// On Window Load - executes when complete page is fully loaded, including all frames, objects and images
312//======================================================================
313 jQuery(window).load(function($) {
314	 "use strict";
315
316	// Detect and set isTouch for touch screens
317	var isTouch = themo_is_touch_device();
318
319	// Disable Transparent Header for Mobile / touch
320	themo_no_transparent_header_for_mobile(isTouch);
321
322	// Start Scroll Up
323	themo_start_scrollup();
324
325
326
327	
328});
329 
330//======================================================================
331// On Window Resize
332//======================================================================
333 jQuery(window).resize(function($){
334	 "use strict";
335	// Detect and set isTouch for touch screens
336	var isTouch = themo_is_touch_device();
337
338	// Add support for mobile navigation
339	themo_support_mobile_navigation();
340
341	// Disable Transparent Header for Mobile / touch
342	themo_no_transparent_header_for_mobile(isTouch);
343});
344
345

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.