PageSourceSearch

https://liftstroy-spb.ru/wp-content/themes/stratusx/assets/js/main.js?ver=1.1

js liftstroy-spb.ru collected 2026-10-01 15:13:30 UTC 9,883 bytes, 317 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	if (!window.console) {
120		window.console = {};
121	}
122	// union of Chrome, FF, IE, and Safari console methods
123	var m = [
124		"log", "info", "warn", "error", "debug", "trace", "dir", "group",
125		"groupCollapsed", "groupEnd", "time", "timeEnd", "profile", "profileEnd",
126		"dirxml", "assert", "count", "markTimeline", "timeStamp", "clear"
127	];
128	// define undefined methods as noops to prevent errors
129	for (var i = 0; i < m.length; i++) {
130		if (!window.console[m[i]]) {
131			window.console[m[i]] = function() {};
132		}
133	}
134})();
135
136//======================================================================
137// Executes when HTML-Document is loaded and DOM is ready
138//======================================================================
139jQuery(document).ready(function($) {
140	"use strict";
141
142    // Preloader : Is really only used for the flexslider but is added to the body tag.
143    // If flex is detected, we put a timeout on it (5s( so it does not get stuck spinning.
144    // If no flex, then disable.
145    if (jQuery("#main-flex-slider")[0]){
146        // Do nothing / flex will figure it out.
147        setTimeout(function(){
148            jQuery('body').addClass('loaded');
149        }, 10000);
150    }else{
151        jQuery('body').addClass('loaded');
152    }
153
154    // add body class for touch devices.
155    if (themo_is_touch_device()) {
156        jQuery('body').addClass('th-touch');
157    }
158
159	// Add support for mobile navigation
160	themo_support_mobile_navigation($);
161
162    // Support for sub menu navigation / also works with sticky header.
163
164    jQuery("body").on("click", "ul.dropdown-menu .dropdown-submenu > a", function(event){
165        //console.log($(this).text());
166        event.preventDefault();
167        event.stopPropagation();
168        jQuery(this).parents('ul.dropdown-menu .dropdown-submenu').toggleClass('open');
169    });
170
171    // Sticky Header - Set options
172    var options = {
173        // Scroll offset. Accepts Number or "String" (for class/ID)
174        offset: 125, // OR — offset: '.classToActivateAt',
175
176        classes: {
177            clone:   'headhesive--clone',
178            stick:   'headhesive--stick',
179            unstick: 'headhesive--unstick'
180        }
181    };
182    try
183    {
184        // Initialise with options
185        var banner = new Headhesive('body.th-sticky-header .banner', options);
186        jQuery('body.th-sticky-header').addClass('headhesive');
187    }
188    catch (err) {
189        console.log('Sticky header deactivated. WP Dash / Appearance / Customize / Theme Options / Menu & Header');
190    }
191
192    /**
193     * Check a href for an anchor. If exists, and in document, scroll to it.
194     * If href argument ommited, assumes context (this) is HTML Element,
195     * which will be the case when invoked by jQuery after an event
196     */
197    function scroll_if_anchor(href) {
198        href = typeof(href) == "string" ? href : jQuery(this).attr("href");
199
200        var fromTop = 0;
201        if (jQuery("header").hasClass("headhesive--clone")) {
202            fromTop = jQuery(".headhesive--clone").height() ;
203        }
204
205        // You could easily calculate this dynamically if you prefer
206        //var fromTop = 50;
207
208        // If our Href points to a valid, non-empty anchor, and is on the same page (e.g. #foo)
209        // Legacy jQuery and IE7 may have issues: http://stackoverflow.com/q/1593174
210        if(href.indexOf("#") == 0) {
211            var $target = jQuery(href);
212
213            // Older browser without pushState might flicker here, as they momentarily
214            // jump to the wrong position (IE < 10)
215            if($target.length) {
216                //console.log('STRATUS Anchor detected - Scroll  ' + $target.offset().top);
217                //console.log('STRATUS Anchor detected - Offset ' + fromTop);
218                jQuery('html, body').animate({ scrollTop: $target.offset().top - fromTop }, 500, 'linear', function() {
219                    //alert("Finished animating");
220                });
221                if(history && "pushState" in history) {
222                    history.pushState({}, document.title, window.location.pathname + href);
223                    return false;
224                }
225            }
226        }
227    }
228
229    // When our page loads, check to see if it contains and anchor
230    scroll_if_anchor(window.location.hash);
231
232
233    // Detect and set isTouch for touch screens
234    //	var isTouch = themo_is_touch_device();
235
236    // Set off set for waypoints
237    //if(!isTouch){
238        //Setup waypoints plugin
239
240        var th_offset = 0;
241        if (jQuery("header").hasClass("headhesive--clone")) {
242            th_offset = jQuery(".headhesive--clone").height() ;
243        }
244
245        // Add space for Elementor Menu Anchor link
246        jQuery( window ).on( 'elementor/frontend/init', function() {
247            elementorFrontend.hooks.addFilter( 'frontend/handlers/menu_anchor/scroll_top_distance', function( scrollTop ) {
248            	//console.log('ELEM HOOK - Scroll offset ' + th_offset);
249                return scrollTop - th_offset;
250            } );
251        } );
252    //}
253
254
255	if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
256		console.log('Smooth Scroll Off (Safari).');
257	}else{
258		try 
259		{
260			// Initialise with options
261			nice = jQuery("html").niceScroll({
262			zindex:20000,
263			scrollspeed:60,
264			mousescrollstep:60,
265			cursorborderradius: '10px', // Scroll cursor radius
266			cursorborder: '1px solid rgba(255, 255, 255, 0.4)',
267			cursorcolor: 'rgba(0, 0, 0, 0.6)',     // Scroll cursor color
268			//autohidemode: 'true',     // Do not hide scrollbar when mouse out
269			cursorwidth: '10px',       // Scroll cursor width
270			autohidemode: false,
271			
272				});
273		} 
274		catch (err) {
275			console.log('Smooth Scroll Off.');
276		}
277	}
278
279});
280
281
282//======================================================================
283// On Window Load - executes when complete page is fully loaded, including all frames, objects and images
284//======================================================================
285 jQuery(window).load(function($) {
286	 "use strict";
287
288	// Detect and set isTouch for touch screens
289	var isTouch = themo_is_touch_device();
290
291	// Disable Transparent Header for Mobile / touch
292	themo_no_transparent_header_for_mobile(isTouch);
293
294	// Start Scroll Up
295	themo_start_scrollup();
296
297
298
299	
300});
301 
302//======================================================================
303// On Window Resize
304//======================================================================
305 jQuery(window).resize(function($){
306	 "use strict";
307	// Detect and set isTouch for touch screens
308	var isTouch = themo_is_touch_device();
309
310	// Add support for mobile navigation
311	themo_support_mobile_navigation();
312
313	// Disable Transparent Header for Mobile / touch
314	themo_no_transparent_header_for_mobile(isTouch);
315});
316
317

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.