PageSourceSearch

https://www.globetron.com/shared/skins/default/scripts/scripts.js

js globetron.com collected 2026-10-04 04:21:59 UTC 5,432 bytes, 222 lines download raw bytes

1var preventClick = false;
2var resizeTimeout;
3
4function checkMenu() {
5
6	if( $(window).width() <= 1000 ) {
7		$( 'ul#menu li.has_submenu' ).find( 'ul' ).addClass( 'closed_menu' );
8		preventClick = true;
9	}
10	else {
11		preventClick = false;
12	}
13	return;
14}
15
16function makeSameHeight(selector) {
17	var minHeight = 0;
18	$(selector).each(function(){
19		var itemHeight = $(this).outerHeight(true);
20		if(itemHeight > minHeight ) {
21			minHeight = itemHeight;
22		}
23	});
24	$(selector).css('min-height', minHeight );
25}
26
27$(window).scroll(function() {
28	var scroll = $(window).scrollTop();
29	if (scroll >= 50) {
30		$("#header").addClass("active");
31	}
32	else {
33		$("#header").removeClass("active");
34	}
35
36	if( scroll >= 500 ) {
37		$( "#back-top" ).addClass( "active" );
38	}
39	else {
40		$( "#back-top" ).removeClass( "active" );
41	}
42
43});
44
45function handlePartForm( inputId ) {
46
47	$.post( "/home/builder", $( '#part_builder' ).serialize(), function( data ) {
48		if( data.status === true ) {
49			var count = 1;
50			$.each( data.parts, function( index, info ) {
51				//if( count > inputId ) {
52					var list = '<option data-title="" selected="selected" value="">--</option>';
53					var previousValue = $( '#part_builder_' + index ).val();
54					if( info.length > 0 ) {
55						$.each( info, function( index, total ) {
56							if( total.desc != "" ) {
57								list+= '<option data-title=" (' + total.desc + ')" value="' + total.title + '">' + total.title + '</option>';
58							}
59							else {
60								list+= '<option data-title="" value="' + total.title + '">' + total.title + '</option>';
61							}
62						});
63					}
64					else {
65						list = '<option value="">N/A</option>';
66					}
67
68					$( '#part_builder_' + index ).html( list );
69					$( '#part_builder_' + index ).val( previousValue );
70
71					console.log(previousValue);
72				//}
73				count++;
74			});
75
76			$( '.part-selector' ).selectric(
77			{
78				optionsItemBuilder: function(itemData, element, index) {
79					return itemData.text +  itemData.element[0].dataset.title;
80				}
81			}
82			);
83			$( '.part-selector' ).selectric(  'refresh' );
84		}
85		else {
86			console.log( 'Error: No Results..');
87		}
88	}, "json");
89}
90
91$(document).ready(function() {
92/*
93	$('select').on('selectric-select', function(event, element, selectric) {
94		// your code
95		const value = element.value;
96
97		console.log( value );
98		console.log( selectric );
99
100		$( 'div#' + selectric.
101	});
102*/
103
104	if( window.location.hash ) {
105		$(window).scrollTop(0);
106		scrollDownToPage( window.location.hash.substr(1) );
107	}
108
109	$( '#back-top a' ).click(function(e) {
110		$('html,body').animate({ scrollTop: 0}, 300);
111	});
112
113	$( '.menu-trigger').bind( 'click', function() {
114		var $navigation = $( '#navigation' );
115		var $trigger = $( '.menu-trigger' );
116		var $header = $( '#header' );
117
118		if( $navigation.hasClass( 'open' ) ) {
119			$navigation.removeClass( 'open' );
120			$trigger.removeClass( 'active' );
121			$header.removeClass( 'unstick' );
122		}
123		else {
124			$navigation.addClass( 'open' );
125			$trigger.addClass( 'active' );
126			$header.addClass( 'unstick' );
127			$(window).scrollTop(0);
128		}
129	});
130
131	window.onresize = function() {
132		clearTimeout(resizeTimeout);
133		// handle normal resize
134		resizeTimeout = setTimeout(function() {
135			checkMenu();
136		}, 250);
137	};
138
139	checkMenu();
140
141	$('ul#menu li.has_submenu').bind('click', function(e) {
142
143		if( preventClick ) {
144			if( $(this).hasClass( 'clicked_menu' ) === false ) {
145				e.preventDefault();
146
147				$(this).children( 'ul' ).addClass( 'open_menu' );
148				$(this).addClass( 'clicked_menu' );
149			}
150		}
151	});
152
153
154
155	$( '.part-selector' ).change(function(e) {
156		handlePartForm( $(this).attr( 'data-id' ));
157
158		if($(this).val() != ""){
159			$(this).parent().parent().parent().parent().addClass('active');
160		}
161		else {
162			$(this).parent().parent().parent().parent().removeClass('active');
163		}
164
165	});
166
167	handlePartForm( 0 );
168	// $( '.part-selector' ).selectric();
169});
170
171document.addEventListener('DOMContentLoaded', function () {
172	if (document.querySelectorAll('#map').length > 0)
173	{
174		if (document.querySelector('html').lang)
175			lang = document.querySelector('html').lang;
176		else
177			lang = 'en';
178
179		var js_file = document.createElement('script');
180		js_file.type = 'text/javascript';
181		js_file.src = 'https://maps.googleapis.com/maps/api/js?callback=initMap&language=' + lang;
182		document.getElementsByTagName('head')[0].appendChild(js_file);
183	}
184});
185
186function initMap() {
187	var map;
188	var geocoder = new google.maps.Geocoder();
189	var address = '196 King Street, St. Catharines, On, CANADA';
190	geocoder.geocode( { 'address': address }, function( results, status ) {
191		if( status == google.maps.GeocoderStatus.OK ) {
192			map = new google.maps.Map( document.getElementById( 'map' ), {
193				zoom: 13,
194				center: results[ 0 ].geometry.location,
195				mapTypeId: google.maps.MapTypeId.ROADMAP
196			} );
197
198			var marker = new google.maps.Marker( {
199				map: map,
200				position: results[ 0 ].geometry.location
201			});
202		}
203	} );
204}
205
206function scrollDownToPage( anchor ) {
207
208	if ( ( anchor ) > -1 )
209	{
210
211		var headerHeight = $('#header').outerHeight();
212		var scrollDown = ( $('#' + anchor).offset().top - headerHeight - 40 );
213		setTimeout(function () {
214			if ($(this).scrollTop() == 0) {
215				$('html,body').animate({scrollTop: scrollDown}, 800);
216			}
217		}, 800); // four seconds
218
219	}
220
221	return;
222}

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.