PageSourceSearch

https://baranishoes.com/catalog/view/javascript/alpha.js

js baranishoes.com collected 2026-10-08 20:35:33 UTC 14,471 bytes, 525 lines download raw bytes

1// If value 1 only, then value 1 is address
2// If value 1&2, then value 1 is street, and value 2 is block/unit
3// If value 1,2,3 then value 1 is street, value 2 is building, value 3 is block/unit
4
5// Sample return data
6/*
7	response{
8	results: [
9	0: [
10	ADDRESS"158 KALLANG WAY PERFORMANCE BUILDING SINGAPORE 349245"
11	BLK_NO:"158"
12	BUILDING:"PERFORMANCE BUILDING"
13	LATITUDE:"1.32320025483415"
14	LONGITUDE:"103.876549935471"
15	LONGTITUDE:"103.876549935471"
16	POSTAL:"349245"
17	ROAD_NAME:"KALLANG WAY"
18	SEARCHVAL:"PERFORMANCE BUILDING"
19	X:"32811.2183294455"
20	Y:"33938.3202846274"
21	]
22	]
23	}
24*/
25
26// Multilevel Accordion for Mobile menu
27jQuery(document).ready(function(){var e=$(".cd-accordion-menu");e.length>0&&e.each(function(){$(this).on("change",'input[type="checkbox"]',function(){var e=$(this);console.log(e.prop("checked")),e.prop("checked")?e.siblings("ul").attr("style","display:none;").slideDown(300):e.siblings("ul").attr("style","display:block;").slideUp(300)})})});
28
29// Quantity Increment
30function increment(t) {UpdateQuantity(t.find(".input-number"), !0) } 
31function descrement(t) { UpdateQuantity(t.find(".input-number"), !1) } 
32function UpdateQuantity(t,n){var i=getQuantity(t);if(isNaN(i)) {i = 0}i+=1*(n?1:-1),1>i&&(i=1),t.attr("value",i.toString()).val(i.toString())}
33function getQuantity(t){var n=parseInt(t.val());return("NaN"==typeof n||1>n)&&(n=1),n}
34function quantity_increment(t){UpdateQuantity(t.find(".product-quantity"),!0)}function quantity_decrement(t){UpdateQuantity(t.find(".product-quantity"),!1)}
35
36function postalcode(ele, value1, value2, value3){
37	var loading_tpl = '<i class="loading-prefix-js fa fa-spinner fa-pulse absolute-center-right"></i>';
38	if($(ele).length){
39		var requesting = null;
40		$(ele).on("keyup", function(e){
41
42			e.preventDefault();
43			e.stopPropagation();
44
45			if(Number($(ele).val()) && $(ele).val().length == 6){
46
47				var target_src = $(ele);
48
49				if(target_src.length == 1) {
50					var html = $(target_src[0]).prop("tagName");
51					if(html == 'INPUT'){
52						target_src.parent().addClass('relative');
53						target_src.parent().append(loading_tpl);
54					}
55				}
56				
57				if(requesting){
58					requesting.abort();
59				}
60
61				requesting = $.get("https://developers.onemap.sg/commonapi/search?returnGeom=Y&getAddrDetails=Y&pageNum=1&searchVal=" + $(ele).val(), function(response){
62					if('results' in response && response.found > 0){
63						block = response.results[0].BLK_NO;
64						street = response.results[0].ROAD_NAME;
65						building = response.results[0].BUILDING;
66						
67						//cl(response); // console.log
68						if(value1 && value2 && value3){ 
69							$(value1).val(street);
70							$(value2).val(building);
71							$(value3).val(block);
72						}
73						else if(value1 && value2){
74							$(value1).val(block+" "+street);
75							$(value2).val(building);
76						}
77						else if (value1){ 
78							address = response.results[0].ADDRESS; // As a whole
79							address_only = address.replace(response.results[0].POSTAL, "");
80							
81							$(value1).val(address_only);
82						}
83						else{
84							// No value
85						}
86					}
87
88					$('.loading-prefix-js').remove();
89				});
90			}
91
92		});
93	}
94	$('.loading-prefix-js').remove();
95}
96
97function view_password(el){
98	if (!el) return;
99	var _input = $(el).prev();
100	if (_input.attr('type') == 'password'){
101		_input.attr('type', 'text');
102	}
103	else{
104		_input.attr('type', 'password');
105	}
106
107	// Change icon
108	if($(el).hasClass('fa-eye')){
109		$(el).removeClass('fa-eye').addClass('fa-eye-slash');
110	}
111	else if($(el).hasClass('fa-eye-slash')){
112		$(el).removeClass('fa-eye-slash').addClass('fa-eye');
113	}
114}
115
116$(document).ready(function () {
117
118	var safari_animation_fix = setTimeout(function(){
119		$('.fixed-header').css({'left':'0'});
120		$('.page_transition').css({'opacity':'0'});
121	}, 100);
122
123	$('#main-menu').smartmenus({
124		subMenusSubOffsetY: -1
125	});
126
127	$('input[type="password"]').each(function () {
128
129		$view_password = '<i style="[STYLE]" class="fa fa-eye pointer absolute view-password" aria-hidden="true" onclick="view_password(this);" ></i>';
130		//$view_password = '<i style="[STYLE]" class="fa fa-eye pointer absolute view-password" aria-hidden="true" onmousedown="view_password(this);" onmouseup="view_password(this);" ></i>';
131
132		// Element Control
133		el_password = $(this);
134
135		// Label-control
136		el_password_label = el_password.prev(); //cl(el_password_label);
137
138		// Btn-group
139		el_password_btn = el_password.next('.input-group-btn');
140
141		el_password_parent = el_password.parent();
142		// End Element Control
143
144		// Position Control
145		el_parent_padding_right = el_password_parent.css('padding-right');
146
147		el_parent_padding_right = parseInt(el_parent_padding_right);
148
149		el_password_parent.addClass('relative');
150
151		let half_input_height = el_password.outerHeight() * 0.5;
152
153		el_password_padding_right = el_password.css('padding-right');
154
155		el_password_padding_right = parseInt(el_password_padding_right);
156
157		right_input_padding =  el_parent_padding_right;
158
159		if (el_password_label.length && el_password_label.is(':visible')){
160			let label_height = $(el_password_label).outerHeight(true); 
161			label_height = parseInt(label_height);
162			half_input_height += label_height;
163		}
164
165		if (el_password_btn.length){
166			let label_width = $(el_password_btn).outerWidth(true); 
167			label_width = parseInt(label_width);
168			right_input_padding += label_width;
169		}
170		// End Position Control
171		
172		$view_password_style = "transform: translateY(-50%);";
173		$view_password_style += "height:" + el_password.innerHeight() + "px;";
174		$view_password_style += "top:" + half_input_height + "px;";
175		$view_password_style += "right:" + right_input_padding + "px;";
176		$view_password_style += "padding: 0px " + el_password_padding_right + "px;";
177
178		$view_password = $view_password.replace('[STYLE]', $view_password_style);
179		
180		el_password.after($view_password);
181
182		var eye_render_width = el_password.next('i').width();
183			eye_render_width = parseInt(eye_render_width);
184			eye_render_width += (el_password_padding_right * 2);
185		el_password.css('padding-right', eye_render_width);
186	});
187
188	var $link_condition = 'a[href]';
189		$link_condition += ':not([href="#"])';
190		$link_condition += ':not([href^="tel"])';
191		$link_condition += ':not([href^="mailto"])';
192		$link_condition += ':not([href^="fax"])';	//	 Mobile not supported
193		$link_condition += ':not([download])';
194		$link_condition += ':not(.agree)';
195		$link_condition += ':not(.esc)';
196		$link_condition += ':not(.colorbox)';
197		$link_condition += ':not([data-toggle="tab"])';
198		$link_condition += ':not([data-toggle="collapse"])';
199		$link_condition += ':not([data-toggle="dropdown"])';
200		$link_condition += ':not([data-toggle="modal-content"])';
201		$link_condition += ':not([target])';
202
203	var transition_duration = $('body').css('transition-duration');
204	var transition_delay = $('body').css('transition-delay');
205	var transition_in_seconds = 0; // Step up delay for javascript transition
206	
207	if(transition_duration.indexOf('ms') > 0){ 
208		transition_in_seconds = parseInt(transition_duration.replace('ms', ''));
209	}
210	else if(transition_duration.indexOf('s') > 0){
211		transition_in_seconds = parseFloat(transition_duration.replace('s', '')) * 1000; 
212	}
213
214	if(transition_delay.indexOf('ms') > 0){ 
215		transition_in_seconds += parseInt(transition_delay.replace('ms', ''));
216	}
217	else if(transition_delay.indexOf('s') > 0){
218		transition_in_seconds += parseFloat(transition_delay.replace('s', '')) * 1000; 
219	}
220	
221	$($link_condition).each(function () {
222		$(this).on('click', function (e) {
223			e.preventDefault();
224			var href = this.href;
225			
226			//$('body').removeAttr('style');
227			$('body').addClass('transition-state');
228
229			setTimeout(function(){
230				location = href;
231			}, transition_in_seconds);
232		});
233	});
234	
235	$('body').addClass('done');
236	$(window).resize(function () {
237		padding_top = $('.fixed-header').outerHeight(true);
238		padding_bottom = $('#footer-area').outerHeight(true);
239		$('body').css({ 'padding-top': padding_top, 'padding-bottom': padding_bottom});
240	}).resize();
241	
242	$('#cart .dropdown-menu, #cart .dropdown-menu *').on('click', function (e) {
243		e.stopPropagation();
244	});
245});
246
247var last_click = null;
248$(window).load(function () {
249	
250	$('.cke_iframe').each(function(){
251		ele = $(this);
252		iframe = ele.attr('data-cke-realelement');
253		iframe = decodeURIComponent(iframe);
254		// cl(iframe);
255		ele.after(iframe);
256		ele.remove();
257	});
258
259	$('#side-categories .toggle').on('click', function(e){
260	
261		e.preventDefault();
262		ele = $(this).parent();
263		
264		if(ele.hasClass('active')){
265			ele.removeClass('active');
266		}
267		else{ 
268			if(ele.hasClass('.level-1')){
269				$('.level-1.active').removeClass('active');
270			}
271			else if(ele.hasClass('.level-2')){
272				$('.level-2.active').removeClass('active');
273			}
274			
275			ele.addClass('active');
276		}
277	});
278
279	$(".list-group .input-group .input-group-addon").click(function (e) {
280		e.preventDefault();
281		e.stopPropagation();
282		
283		if (this != last_click) {
284			
285			last_click = this;
286			
287			// Level Parent
288			parent = $(this).data("parent");
289			//cl(parent);
290			$("." + parent).removeClass("active");
291			
292			// Level child
293			level = $(this).data("level");
294			$("." + level).stop().slideUp(300);
295			
296			$(this).prev().addClass("active");
297			
298			child = $("." + this.id);
299			if (child.length) {
300				child.stop().slideDown(300);
301			}
302		} else {
303			
304		}
305	});
306	
307	numbers_only();
308
309});
310
311
312function numbers_only(){
313	$('.input-number').each(function () {
314		$(this).keydown(function (e) {
315			//cl(e.keyCode);
316			// Allow: backspace, delete, tab, escape, enter and .
317			// 110 - dot (.)
318			// 190 - angle right (>)
319
320			if ($.inArray(e.keyCode, [46, 8, 9, 27, 13]) !== -1 ||
321				// Allow: Ctrl/cmd+A
322				(e.keyCode == 65 && (e.ctrlKey === true || e.metaKey === true)) ||
323				// Allow: Ctrl/cmd+C
324				(e.keyCode == 67 && (e.ctrlKey === true || e.metaKey === true)) ||
325				// Allow: Ctrl/cmd+X
326				(e.keyCode == 88 && (e.ctrlKey === true || e.metaKey === true)) ||
327				// Allow: home, end, left, right
328				(e.keyCode >= 35 && e.keyCode <= 39)) {
329				// let it happen, don't do anything
330				return;
331			}
332			// Ensure that it is a number and stop the keypress
333			if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
334				e.preventDefault();
335			}
336		});
337	});
338}
339
340
341/* UItoTop jQuery */
342jQuery(document).ready(function () {
343	$().UItoTop({
344		easingType: 'easeOutQuint'
345	});
346});
347
348(function ($) {
349	$.fn.UItoTop = function (options) {
350		var defaults = {
351			text: 'To Top',
352			min: 200,
353			inDelay: 600,
354			outDelay: 400,
355			containerID: 'ToTop',
356			containerHoverID: 'ToTopHover',
357			scrollSpeed: 800,
358			easingType: 'linear'
359		};
360		
361		var settings = $.extend(defaults, options);
362		var containerIDhash = '#' + settings.containerID;
363		var containerHoverIDHash = '#' + settings.containerHoverID;
364		$('body').append('<span id="' + settings.containerID + '">' + settings.text + '</span>');
365		$(containerIDhash).hide().click(function (event) {
366			$('html, body').animate({
367				scrollTop: 0
368			}, settings.scrollSpeed);
369			event.preventDefault();
370		})
371		.prepend('<span id="' + settings.containerHoverID + '"></span>')
372		.hover(function () {
373			$(containerHoverIDHash, this).stop().animate({
374				'opacity': 1
375			}, 600, 'linear');
376			}, function () {
377			$(containerHoverIDHash, this).stop().animate({
378				'opacity': 0
379			}, 700, 'linear');
380		});
381		
382		$(window).scroll(function () {
383			var sd = $(window).scrollTop();
384			if (typeof document.body.style.maxHeight === "undefined") {
385				$(containerIDhash).css({
386					'position': 'absolute',
387					'top': $(window).scrollTop() + $(window).height() - 50
388				});
389			}
390			if (sd > settings.min)
391			$(containerIDhash).fadeIn(settings.inDelay);
392			else
393			$(containerIDhash).fadeOut(settings.Outdelay);
394		});
395
396		initializeMobileNav();
397	};
398})(jQuery);
399
400function initializeMobileNav(){
401
402	$('#mobileNav').sidr({
403		onOpen: function(){
404			left = $('#sidr').width();
405			$('.fixed-header').css('left', left);
406			$('body').addClass('sidr-custom-open');
407		},
408		onClose: function(){
409			$('.fixed-header').css('left', 0);
410			$('body').addClass('closing');
411		},
412		onCloseEnd: function(){
413			$('body').removeClass('closing');
414			$('body').removeClass('sidr-custom-open');
415		}
416	});
417
418	$('[data-toggle="jquery-accordion"]').accordion();
419}
420function cl(x) {
421	console.log(x);
422}
423
424/* Google Map */
425
426var mapObj = [];
427
428function gmap() {
429	
430	var infowindow = [];
431	var service = [];
432	var marker = [];
433	
434	$("[data-toggle=\'gmap\']").each(function (index, value) {
435		cmap = $(this);
436		loadMapMarker(mapObj, index, cmap);
437	});
438	
439	$("#accordion").on('shown.bs.collapse', function () {
440		reintGmap();
441	});
442}
443
444function loadMapMarker(mapObj, index, cmap) {
445	
446	var lat = cmap.data('lat');
447	var lng = cmap.data('lng');
448	var id = cmap.data('id');
449	var store = cmap.data('store');
450	var address = cmap.data('address');
451	
452	var place = { lat: lat, lng: lng };
453	mapObj[index] = new google.maps.Map(
454	document.getElementById(id), {
455		zoom: 16,
456		center: place
457	});
458	
459	var contentString =
460	'<b>' + store + '</b>' +
461	'<p>' + address + '</p>';
462	
463	var infowindow = new google.maps.InfoWindow({
464		content: contentString
465	});
466	
467	var marker = new google.maps.Marker({
468		position: place,
469		map: mapObj[index],
470		title: store
471	});
472	
473	marker.addListener('click', function () {
474		infowindow.open(mapObj[index], marker);
475	});
476	
477}
478
479function reintGmap() {
480	var center = null;
481	$.each(mapObj, function (index, value) {
482		center = mapObj[index].getCenter();
483		google.maps.event.trigger(mapObj[index], "resize");
484		mapObj[index].setCenter(center);
485	});
486}
487
488
489
490// Data-toggle: modal-content
491$(document).delegate('[data-toggle="modal-content"]', 'click', function (e) {
492	e.preventDefault();
493
494	$('#modal-content-custom').remove();
495
496	var element = this;
497
498	let title = $(element).text();
499	if ($(element).attr('data-title').length){
500		title = $(element).attr('data-title');
501	}
502	
503	$.ajax({
504		url: $(element).attr('href'),
505		type: 'get',
506		dataType: 'html',
507		success: function (data) {
508			html = '<div id="modal-content-custom" class="modal">';
509			html += '  <div class="modal-dialog">';
510			html += '    <div class="modal-content">';
511			html += '      <div class="modal-header">';
512			html += '        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>';
513			html += '        <h4 class="modal-title">' + title + '</h4>';
514			html += '      </div>';
515			html += '      <div class="modal-body">' + data + '</div>';
516			html += '    </div';
517			html += '  </div>';
518			html += '</div>';
519
520			$('body').append(html);
521
522			$('#modal-content-custom').modal('show');
523		}
524	});
525});

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.