PageSourceSearch

https://matics.live/wp-content/themes/matics/js/new.js

js matics.live collected 2026-09-26 09:38:49 UTC 13,140 bytes, 409 lines download raw bytes

1jQuery(document).ready(function($) { 
2	// var chagnelink = jQuery('body.page-id-5292 .content a').attr('href');
3	// if(chagnelink == 'https://matics.live/it/?page_id=5291'){
4	// 	jQuery('body.page-id-5292 .content a').attr('href', 'https://matics.live/sla/');
5	// }
6
7	if(jQuery(window).width() > 1200){
8		
9		jQuery('.dropdown').mouseover(function () {
10			if(jQuery('.navbar-toggler').is(':hidden')) {
11				jQuery(this).addClass('show').attr('aria-expanded', 'true');
12				jQuery(this).children('.dropdown-menu').addClass('show');
13			}
14		}).mouseout(function () {
15			if(jQuery('.navbar-toggler').is(':hidden')) {
16				jQuery(this).removeClass('show').attr('aria-expanded', 'false');
17				jQuery(this).children('.dropdown-menu').removeClass('show');
18			}
19		});
20	}
21	
22	
23	var cat = getUrlParameter('cat');
24	if(cat == 'case-studies') {
25		// var text = cat.replace('-', '_');
26		// jQuery('#blog-wrap .filters .btn[data-filter=".' + text + '"]').click();
27		jQuery('#blog-wrap .filters .btn[data-filter=".case_study"]').click();
28	} else if(cat == 'ebook') {
29		jQuery('#blog-wrap .filters .btn[data-filter=".press_release"]').click();
30	}
31
32	function getUrlParameter(sParam) {
33		var sPageURL = window.location.search.substring(1),
34			sURLVariables = sPageURL.split('&'),
35			sParameterName,
36			i;
37
38		for (i = 0; i < sURLVariables.length; i++) {
39			sParameterName = sURLVariables[i].split('=');
40
41			if (sParameterName[0] === sParam) {
42				return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
43			}
44		}
45	};
46	
47	
48	
49	
50	// ACTIVE FILTER BUTTON ACCORDING TO CURRENT CATEGORY
51	var current_url = window.location.href;
52	console.log(current_url);
53
54	jQuery('#blog-wrap .filter-wrap .filters .btn').each(function() {
55	   console.log(jQuery(this).get(0).href);
56		   
57		if(jQuery(this).get(0).href == current_url) {
58		   jQuery('#blog-wrap .filters .btn').removeClass('active'); 
59		   jQuery(this).addClass('active'); 
60
61		}
62});
63
64
65// POPUP
66/* setTimeout(function(){
67	jQuery(document).on(‘submit’, ‘.sib_signup_form’, function(e) {
68	SGPBPopup.closePopupById(popupId);
69	});
70}, 1000); */
71jQuery('.popup_close_button_text').click(function() {
72	SGPBPopup.closePopupById(1963);
73	SGPBPopup.closePopupById(2318);
74});
75
76
77
78// WEBSITE BANNER
79var hdr = 250;
80jQuery(window).scroll(function() {
81  if( jQuery(window).scrollTop() > hdr ) {
82	if(!Cookies.get('website_banner_closed')) {
83		jQuery(".website_banner").addClass('active');
84		jQuery('.website_banner img').click(function() {
85			jQuery(".website_banner").removeClass('active');
86			Cookies.set('website_banner_closed', '1', { expires: 1 });
87		});
88	 }
89  } else {
90	jQuery(".website_banner").removeClass('active');
91  }
92});
93
94// CLICK ON MENU ITEM WITH SUB ITEMS
95/* jQuery('#topmenu #topmenu-navbar>ul>li.dropdown ul.dropdown-menu a').click(function() {
96	var href = jQuery(this).get(0).href;
97	window.location.href = href;
98}); */
99if (jQuery(window).width() <= 767){	
100	
101	/* jQuery('#topmenu #topmenu-navbar li.menu-item-has-children').click(function(e) {
102		// e.preventDefault();
103		if(jQuery(this).hasClass('open')) {
104			if(e.target.nodeName == 'A') {
105				var a = jQuery(this).find('a');
106				var href = jQuery(a).get(0).href;
107				window.location.href = href;
108			} else {
109				e.preventDefault();
110				jQuery(this).toggleClass('open');
111				var current_sub_menu = jQuery(this).find('ul.sub-menu');
112				jQuery(current_sub_menu).slideToggle();
113			}
114		} else if(!jQuery(this).hasClass('open')) {
115			e.preventDefault();
116			jQuery(this).toggleClass('open');
117			var current_sub_menu = jQuery(this).find('ul.sub-menu');
118			jQuery(current_sub_menu).slideToggle();
119		}
120	});  */
121}
122/* setTimeout(function(){
123jQuery('#topmenu #topmenu-navbar li.menu-item-has-children.show > a').click(function(e) {
124	alert('fasdas');
125	var href = jQuery(this).get(0).href;
126	window.location.href = href;
127});
128 }, 1000); */
129
130
131
132// CLICK ON TITLE IN RESOURCE POST
133jQuery('.single-post #head-section .post-cat').click(function() {
134	if(jQuery(this).get(0).innerText == 'Case Studies') {
135		window.location.href = 'https://matics.live/resources/case-studies/';
136	} else if(jQuery(this).get(0).innerText == 'Use Cases') {
137		window.location.href = 'https://matics.live/use-cases/';
138	} else if(jQuery(this).get(0).innerText == 'Blog') {
139		window.location.href = 'https://matics.live/blog/';
140	}
141});
142
143
144jQuery('#menu-item-dropdown-2005').click(function(e){
145	e.preventDefault();
146	console.log('you clicked');
147	window.location.href = jQuery(this).attr('href');
148});
149
150});
151
152jQuery(document).ready(function($) { 
153
154var requestFormPortal = jQuery('.hbspt-request-form').attr('portal-id');
155var requestFormID = jQuery('.hbspt-request-form').attr('formid');
156hbspt.forms.create({
157	region: "na1",
158	portalId: requestFormPortal,
159	formId: requestFormID,
160	cssClass: 'ebook-form hbFloatingLabelsForm', 
161	target: '.requestForm .hbspt-request-form',
162	translations: {
163		en: {
164			required: "Required",
165			invalidEmailFormat: "Invalid email",
166			missingSelect: "Required"
167		}
168	},
169	onFormReady: function($form) {
170		// HUBPOST : FLOATING LABELS
171		//$('.requestForm .hs_submit.hs-submit input.hs-button.primary').val('Begin Transformation');
172		$('input[type="text"], input[type="email"], input[type="tel"], textarea', '.hbFloatingLabelsForm').focusin( function(){  
173			$(this).parents('.hs-form-field').addClass('active');
174		}).focusout( function(){  
175			( $(this).val() == '' ? $(this).parents('.hs-form-field').removeClass('active') : '' )
176		});
177		$('input[type="text"], input[type="email"], input[type="tel"], textarea', '.hbFloatingLabelsForm').each(function() {
178			if( $(this).val() ) {
179				$(this).parents('.hs-form-field').addClass('active');
180			}
181		});
182	},
183	onFormSubmit: function($form) {
184		$('.requestForm .hbspt-form').hide();
185		$('.requestForm h3').hide();
186		$('.submitted-message').hide();
187		$('.requestForm .thankmsg').show();
188		
189	} 
190}); 
191
192if(jQuery('.hbspt-subs-form').length > 0){
193	var subFormPortal = jQuery('.hbspt-subs-form').attr('portal-id');
194	var subFormID = jQuery('.hbspt-subs-form').attr('formid');
195	hbspt.forms.create({
196		portalId: subFormPortal,
197		formId: subFormID,
198		cssClass: 'subscribe-form hbFloatingLabelsForm',
199		target: '.hbspt-subs-form',
200		translations: {
201			en: {
202				required: "Required",
203				invalidEmailFormat: "Invalid email",
204				missingSelect: "Required",
205			}
206		},
207		onFormReady: function($form) {
208			// HUBPOST : FLOATING LABELS
209			$('input[type="text"], input[type="email"], input[type="tel"], textarea', '.hbFloatingLabelsForm').focusin( function(){  
210				$(this).parents('.hs-form-field').addClass('active');
211			}).focusout( function(){  
212				( $(this).val() == '' ? $(this).parents('.hs-form-field').removeClass('active') : '' )
213			});
214			$('input[type="text"], input[type="email"], input[type="tel"], textarea', '.hbFloatingLabelsForm').each(function() {
215				if( $(this).val() ) {
216					$(this).parents('.hs-form-field').addClass('active');
217				}
218			});
219		} 
220	});
221}
222
223	// hbspt.forms.create({
224    //     portalId: "6471719",
225    //     formId: "8f1bd945-f9e6-4396-82c3-0830cda6bb46",
226    //     cssClass: 'contactus-form hbFloatingLabelsForm',
227	// 	target: '#contact-main .form-body',
228    //     translations: {
229    //         en: {
230    //             required: "Required",
231    //             invalidEmailFormat: "Invalid email"
232    //         }
233    //     },
234    //     onFormReady: function($form) {
235    //         // HUBPOST : FLOATING LABELS
236    //         $('input[type="text"], input[type="email"], input[type="tel"], textarea', '.hbFloatingLabelsForm').focusin( function(){  
237    //             $(this).parents('.hs-form-field').addClass('active');
238    //         }).focusout( function(){  
239    //             ( $(this).val() == '' ? $(this).parents('.hs-form-field').removeClass('active') : '' )
240    //         });
241
242
243    //         $('input[type="text"], input[type="email"], input[type="tel"], textarea', '.hbFloatingLabelsForm').each(function() {
244    //             if( $(this).val() ) {
245    //                 $(this).parents('.hs-form-field').addClass('active');
246    //             }
247    //         });
248    //     },
249	// 	onFormSubmit: function($form) {
250	// 		window.location.href = 'https://matics.live/contact-us/thank-you/';
251    //     }
252    // });
253
254	// window.addEventListener('message', event => {
255	// 	if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onF
255ormSubmitted' && event.data.id != '4ec21e4d-d311-4b37-9b86-ace51f74da34' && event.data.id != '2ba1e1a4-641f-4026-8347-5ccba4fa4aeb') {
256	// 		window.location.href = 'https://matics.live/contact-us/thank-you/';
257	// 	}
258	//  });
259
260	// window.addEventListener('message', event => {
261	// 	console.log(event);
262	// 	if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmitted' && event.data.id == '4ec21e4d-d311-4b37-9b86-ace51f74da34') {
263	// 		console.log(event.data.data);
264	// 		console.log(event.data.data.redirectUrl);
265	// 		window.open(event.data.data.redirectUrl, '_blank');
266	// 		return false;
267	// 	}
268	//  });
269
270	// hbspt.forms.create({
271	// 	 portalId: "6471719",
272	// 	 formId: "450fbc72-5bea-4c39-a56a-64c77193da62",
273	// 	 cssClass: 'section-form-hb',
274	// 	 translations: {
275	// 	 en: {
276	// 	 required: "Required",
277	// 	 invalidEmailFormat: "Invalid email",
278	// 	 missingSelect: "Required"
279	// 	}
280	// 	 },
281	// 	 onFormReady: function($form) {
282	// 	 $('input[type="text"], input[type="email"], input[type="tel"], textarea', '.hbFloatingLabelsForm').focusin( function(){  
283	// 	 $(this).parents('.hs-form-field').addClass('active');
284	// 	 }).focusout( function(){  
285	// 	 ( $(this).val() == '' ? $(this).parents('.hs-form-field').removeClass('active') : '' )
286	// 	 });
287		
288		
289	// 	 $('input[type="text"], input[type="email"], input[type="tel"], textarea', '.hbFloatingLabelsForm').each(function() {
290	// 	 if( $(this).val() ) {
291	// 	 $(this).parents('.hs-form-field').addClass('active');
292	// 	 }
293	// 	 });
294	// 	 },
295	// 			onFormSubmit: function($form) {
296	// 				window.location.href = 'https://matics.live/request-a-demo/thank-you/';
297	// 			} 
298	// 	});
299
300	
301});
302
303
304
305
306
307//Menu handle for Desktop
308document.addEventListener("DOMContentLoaded", function() {
309  function removeDataToggle() {
310    if (window.innerWidth >= 1200) {
311      var dropdownCustom = document.querySelectorAll('#topmenu-navbar.desktop li.menu-item-object-custom .dropdown-toggle');
312      var dropdownPage = document.querySelectorAll('#topmenu-navbar.desktop li.menu-item-object-page .dropdown-toggle');
313      dropdownCustom.forEach(function(toggleObjCstm) {
314        toggleObjCstm.removeAttribute('data-toggle');
315      });
316	  dropdownPage.forEach(function(togglePage) {
317        togglePage.removeAttribute('data-toggle');
318      });
319	  
320    }
321  }
322
323  
324  removeDataToggle();
325
326});
327
328
329
330//adding span tage inside span in mobile
331function addSpanTag() {
332    var menuItems = document.querySelectorAll('#topmenu-navbar.mobile  .menu-item-has-children');
333		menuItems.forEach(function(item) {
334        var link = item.querySelector('a');
335        var spanTag = document.createElement('span');
336        spanTag.classList.add('openedMenuMobileOnly');
337        link.parentNode.insertBefore(spanTag, link.nextSibling);
338    });
339}
340
341function checkScreenWidth() {
342    if (window.innerWidth < 1200) {
343        addSpanTag();
344    }
345}
346checkScreenWidth();
347
348window.addEventListener('resize', function() {
349   // checkScreenWidth();
350});
351
352
353
354//Menu handle for Mobile
355if (jQuery( window ).width() < 1200) {
356
357	jQuery('#topmenu-navbar.mobile ul li.menu-item-has-children a').on('click', function(event) {
358		var href = jQuery(this).attr('href');
359		if (href && href !== '#') {
360			return;
361		} else {
362			jQuery(this).parents('.menu-item-has-children').addClass('active');
363			jQuery(this).parents('.nav.navbar-nav').addClass('active');
364			jQuery('.backBtn').addClass('active');
365			jQuery('.mobile_cont .fbtn').hide();
366			jQuery('.socialcolMobile').hide();	
367			event.preventDefault();
368		}
369	});
370	
371	jQuery('span.openedMenuMobileOnly').click(function(event){
372		//event.preventDefault();
373		jQuery(this).parents('.menu-item-has-children').addClass('active');
374		jQuery(this).parents('.nav.navbar-nav').addClass('active');
375		jQuery('.backBtn').addClass('active');
376		jQuery('.mobile_cont .fbtn').hide();
377		jQuery('.socialcolMobile').hide();
378	});
379	jQuery('.backBtn').click(function(event){
380		jQuery('.nav.navbar-nav .menu-item-has-children').removeClass('active');
381		jQuery('.nav.navbar-nav').removeClass('active');
382		jQuery('.backBtn').removeClass('active');
383		jQuery('.mobile_cont .fbtn').show();
384		jQuery('.socialcolMobile').show();
385	});
386}
387
388jQuery(document).ready(function($) {
389	jQuery('body').on('click', '.hs_submit.hs-submit .hs-button', function() {
390		var $form = jQuery(this).closest('form');
391		var $invalidError = $form.find('.invalid.error').first();
392		if ($invalidError.length > 0) {
393			$invalidError.focus();
394		}
395	});
396
397	// Set an interval to check for the presence of invalid errors within the specific form
398	
399	var refreshIdhb = setInterval(function() {
400		jQuery('form').each(function() {
401			var $form = jQuery(this);
402			var $invalidError = $form.find('.invalid.error').first();
403			if ($invalidError.length > 0) {
404				$invalidError.focus();
405				clearInterval(refreshIdhb);
406			}
407		});
408	}, 1000);
409});

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.