PageSourceSearch

https://7thheavenktvcafe.com/catalog/view/javascript/alpha.js

js 7thheavenktvcafe.com collected 2026-09-26 10:18:39 UTC 14,962 bytes, 534 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);" ontouchstart="view_password(this);" ontouchend="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	// turn off because unused
189	// var $link_condition = 'a[href]';
190	// 	$link_condition += ':not([href="#"])';
191	// 	$link_condition += ':not([href^="tel"])';
192	// 	$link_condition += ':not([href^="mailto"])';
193	// 	$link_condition += ':not([href^="fax"])';	//	 Mobile not supported
194	// 	$link_condition += ':not([download])';
195	// 	$link_condition += ':not(.agree)';
196	// 	$link_condition += ':not(.esc)';
197	// 	$link_condition += ':not(.colorbox)';
198	// 	$link_condition += ':not([data-toggle="tab"])';
199	// 	$link_condition += ':not([data-toggle="collapse"])';
200	// 	$link_condition += ':not([data-toggle="dropdown"])';
201	// 	$link_condition += ':not([data-toggle="modal-content"])';
202	// 	$link_condition += ':not([target])';
203
204	// var transition_duration = $('body').css('transition-duration');
205	// var transition_delay = $('body').css('transition-delay');
206	// var transition_in_seconds = 0; // Step up delay for javascript transition
207	
208	// if(transition_duration.indexOf('ms') > 0){ 
209	// 	transition_in_seconds = parseInt(transition_duration.replace('ms', ''));
210	// }
211	// else if(transition_duration.indexOf('s') > 0){
212	// 	transition_in_seconds = parseFloat(transition_duration.replace('s', '')) * 1000; 
213	// }
214
215	// if(transition_delay.indexOf('ms') > 0){ 
216	// 	transition_in_seconds += parseInt(transition_delay.replace('ms', ''));
217	// }
218	// else if(transition_delay.indexOf('s') > 0){
219	// 	transition_in_seconds += parseFloat(transition_delay.replace('s', '')) * 1000; 
220	// }
221	
222	// $($link_condition).each(function () {
223	// 	$(this).on('click', function (e) {
224	// 		e.preventDefault();
225	// 		var href = this.href;
226			
227	// 		//$('body').removeAttr('style');
228	// 		$('body').addClass('transition-state');
229
230	// 		setTimeout(function(){
231	// 			location = href;
232	// 		}, transition_in_seconds);
233	// 	});
234	// });
235	// turn off because unused
236});
237
238var last_click = null;
239$(window).load(function () {
240	
241	$('body').addClass('done');
242	$(window).resize(function () {
243		padding_top = $('.fixed-header').outerHeight(true);
244		padding_bottom = $('#footer-area').outerHeight(true);
245		$('body').css({ 'padding-top': padding_top, 'padding-bottom': padding_bottom});
246
247		if($('body').find('.slideshow:hidden').length > 0 && 
248			$(window).width() <= 1025 && $(window).width() > 769){
249			padding_top = 0;
250			padding_bottom = 0;
251			$('body').css({ 'padding-top': padding_top, 'padding-bottom': padding_bottom});
252		}
253	}).resize();
254	
255	$('#cart .dropdown-menu, #cart .dropdown-menu *').on('click', function (e) {
256		e.stopPropagation();
257	});
258	
259	$('.cke_iframe').each(function(){
260		ele = $(this);
261		iframe = ele.attr('data-cke-realelement');
262		iframe = decodeURIComponent(iframe);
263		// cl(iframe);
264		ele.after(iframe);
265		ele.remove();
266	});
267
268	$('#side-categories .toggle').on('click', function(e){
269	
270		e.preventDefault();
271		ele = $(this).parent();
272		
273		if(ele.hasClass('active')){
274			ele.removeClass('active');
275		}
276		else{ 
277			if(ele.hasClass('.level-1')){
278				$('.level-1.active').removeClass('active');
279			}
280			else if(ele.hasClass('.level-2')){
281				$('.level-2.active').removeClass('active');
282			}
283			
284			ele.addClass('active');
285		}
286	});
287
288	$(".list-group .input-group .input-group-addon").click(function (e) {
289		e.preventDefault();
290		e.stopPropagation();
291		
292		if (this != last_click) {
293			
294			last_click = this;
295			
296			// Level Parent
297			parent = $(this).data("parent");
298			//cl(parent);
299			$("." + parent).removeClass("active");
300			
301			// Level child
302			level = $(this).data("level");
303			$("." + level).stop().slideUp(300);
304			
305			$(this).prev().addClass("active");
306			
307			child = $("." + this.id);
308			if (child.length) {
309				child.stop().slideDown(300);
310			}
311		} else {
312			
313		}
314	});
315	
316	numbers_only();
317
318});
319
320
321function numbers_only(){
322	$('.input-number').each(function () {
323		$(this).keydown(function (e) {
324			//cl(e.keyCode);
325			// Allow: backspace, delete, tab, escape, enter and .
326			// 110 - dot (.)
327			// 190 - angle right (>)
328
329			if ($.inArray(e.keyCode, [46, 8, 9, 27, 13]) !== -1 ||
330				// Allow: Ctrl/cmd+A
331				(e.keyCode == 65 && (e.ctrlKey === true || e.metaKey === true)) ||
332				// Allow: Ctrl/cmd+C
333				(e.keyCode == 67 && (e.ctrlKey === true || e.metaKey === true)) ||
334				// Allow: Ctrl/cmd+X
335				(e.keyCode == 88 && (e.ctrlKey === true || e.metaKey === true)) ||
336				// Allow: home, end, left, right
337				(e.keyCode >= 35 && e.keyCode <= 39)) {
338				// let it happen, don't do anything
339				return;
340			}
341			// Ensure that it is a number and stop the keypress
342			if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
343				e.preventDefault();
344			}
345		});
346	});
347}
348
349
350/* UItoTop jQuery */
351jQuery(document).ready(function () {
352	$().UItoTop({
353		easingType: 'easeOutQuint'
354	});
355});
356
357(function ($) {
358	$.fn.UItoTop = function (options) {
359		var defaults = {
360			text: 'To Top',
361			min: 200,
362			inDelay: 600,
363			outDelay: 400,
364			containerID: 'ToTop',
365			containerHoverID: 'ToTopHover',
366			scrollSpeed: 800,
367			easingType: 'linear'
368		};
369		
370		var settings = $.extend(defaults, options);
371		var containerIDhash = '#' + settings.containerID;
372		var containerHoverIDHash = '#' + settings.containerHoverID;
373		$('body').append('<span id="' + settings.containerID + '">' + settings.text + '</span>');
374		$(containerIDhash).hide().click(function (event) {
375			$('html, body').animate({
376				scrollTop: 0
377			}, settings.scrollSpeed);
378			event.preventDefault();
379		})
380		.prepend('<span id="' + settings.containerHoverID + '"></span>')
381		.hover(function () {
382			$(containerHoverIDHash, this).stop().animate({
383				'opacity': 1
384			}, 600, 'linear');
385			}, function () {
386			$(containerHoverIDHash, this).stop().animate({
387				'opacity': 0
388			}, 700, 'linear');
389		});
390		
391		$(window).scroll(function () {
392			var sd = $(window).scrollTop();
393			if (typeof document.body.style.maxHeight === "undefined") {
394				$(containerIDhash).css({
395					'position': 'absolute',
396					'top': $(window).scrollTop() + $(window).height() - 50
397				});
398			}
399			if (sd > settings.min)
400			$(containerIDhash).fadeIn(settings.inDelay);
401			else
402			$(containerIDhash).fadeOut(settings.Outdelay);
403		});
404
405		initializeMobileNav();
406	};
407})(jQuery);
408
409function initializeMobileNav(){
410
411	$('#mobileNav').sidr({
412		onOpen: function(){
413			left = $('#sidr').width();
414			$('.fixed-header').css('left', left);
415			$('body').addClass('sidr-custom-open');
416		},
417		onClose: function(){
418			$('.fixed-header').css('left', 0);
419			$('body').addClass('closing');
420		},
421		onCloseEnd: function(){
422			$('body').removeClass('closing');
423			$('body').removeClass('sidr-custom-open');
424		}
425	});
426
427	$('[data-toggle="jquery-accordion"]').accordion();
428}
429function cl(x) {
430	console.log(x);
431}
432
433/* Google Map */
434
435var mapObj = [];
436
437function gmap() {
438	
439	var infowindow = [];
440	var service = [];
441	var marker = [];
442	
443	$("[data-toggle=\'gmap\']").each(function (index, value) {
444		cmap = $(this);
445		loadMapMarker(mapObj, index, cmap);
446	});
447	
448	$("#accordion").on('shown.bs.collapse', function () {
449		reintGmap();
450	});
451}
452
453function loadMapMarker(mapObj, index, cmap) {
454	
455	var lat = cmap.data('lat');
456	var lng = cmap.data('lng');
457	var id = cmap.data('id');
458	var store = cmap.data('store');
459	var address = cmap.data('address');
460	
461	var place = { lat: lat, lng: lng };
462	mapObj[index] = new google.maps.Map(
463	document.getElementById(id), {
464		zoom: 16,
465		center: place
466	});
467	
468	var contentString =
469	'<b>' + store + '</b>' +
470	'<p>' + address + '</p>';
471	
472	var infowindow = new google.maps.InfoWindow({
473		content: contentString
474	});
475	
476	var marker = new google.maps.Marker({
477		position: place,
478		map: mapObj[index],
479		title: store
480	});
481	
482	marker.addListener('click', function () {
483		infowindow.open(mapObj[index], marker);
484	});
485	
486}
487
488function reintGmap() {
489	var center = null;
490	$.each(mapObj, function (index, value) {
491		center = mapObj[index].getCenter();
492		google.maps.event.trigger(mapObj[index], "resize");
493		mapObj[index].setCenter(center);
494	});
495}
496
497
498
499// Data-toggle: modal-content
500$(document).delegate('[data-toggle="modal-content"]', 'click', function (e) {
501	e.preventDefault();
502
503	$('#modal-content-custom').remove();
504
505	var element = this;
506
507	let title = $(element).text();
508	if ($(element).attr('data-title').length){
509		title = $(element).attr('data-title');
510	}
511	
512	$.ajax({
513		url: $(element).attr('href'),
514		type: 'get',
515		dataType: 'html',
516		success: function (data) {
517			html = '<div id="modal-content-custom" class="modal">';
518			html += '  <div class="modal-dialog">';
519			html += '    <div class="modal-content">';
520			html += '      <div class="modal-header">';
521			html += '        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>';
522			html += '        <h4 class="modal-title">' + title + '</h4>';
523			html += '      </div>';
524			html += '      <div class="modal-body">' + data + '</div>';
525			html += '    </div';
526			html += '  </div>';
527			html += '</div>';
528
529			$('body').append(html);
530
531			$('#modal-content-custom').modal('show');
532		}
533	});
534});

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.