PageSourceSearch

https://vborovnici.si/templates/gk_restaurant/js/gk.scripts.js

js vborovnici.si collected 2026-09-27 08:11:30 UTC 4,210 bytes, 136 lines download raw bytes

1window.addEvent('domready', function(){
2	// smooth anchor scrolling
3	new SmoothScroll(); 
4	// style area
5	if(document.id('gkStyleArea')){
6		$$('#gkStyleArea a').each(function(element,index){
7			element.addEvent('click',function(e){
8	            e.stop();
9				changeStyle(index+1);
10			});
11		});
12	}
13	// font-size switcher
14	if(document.id('gkTools') && document.id('gkComponentWrap')) {
15		var current_fs = 100;
16		var content_fx = new Fx.Tween(document.id('gkComponentWrap'), { property: 'font-size', unit: '%', duration: 200 }).set(100);
17		document.id('gkToolsInc').addEvent('click', function(e){ 
18			e.stop(); 
19			if(current_fs < 150) { 
20				content_fx.start(current_fs + 10); 
21				current_fs += 10; 
22			} 
23		});
24		document.id('gkToolsReset').addEvent('click', function(e){ 
25			e.stop(); 
26			content_fx.start(100); 
27			current_fs = 100; 
28		});
29		document.id('gkToolsDec').addEvent('click', function(e){ 
30			e.stop(); 
31			if(current_fs > 70) { 
32				content_fx.start(current_fs - 10); 
33				current_fs -= 10; 
34			} 
35		});
36	}
37	// login popup
38	if(document.id('gkPopupLogin')) {
39		var popup_overlay = document.id('gkPopupOverlay');
40		popup_overlay.setStyles({'display': 'block', 'opacity': '0'});
41		popup_overlay.fade('out');
42
43		var opened_popup = null;
44		var popup_login = null;
45		var popup_login_h = null;
46		var popup_login_fx = null;
47		
48		if(document.id('gkPopupLogin') && document.getElement('.gkmenu .login')) {
49			popup_login = document.id('gkPopupLogin');
50			popup_login.setStyle('display', 'block');
51			popup_login_h = popup_login.getElement('.gkPopupWrap').getSize().y;
52			popup_login_fx = new Fx.Morph(popup_login, {duration:200, transition: Fx.Transitions.Circ.easeInOut}).set({'opacity': 0, 'height': 0 }); 
53			document.getElement('.gkmenu .login').addEvent('click', function(e) {
54				new Event(e).stop();
55				popup_overlay.fade(0.45);
56				popup_login_fx.start({'opacity':1, 'height': popup_login_h});
57				opened_popup = 'login';
58				
59				(function() {
60					if(document.id('modlgn-username')) {
61						document.id('modlgn-username').focus();
62					}
63				}).delay(600);
64			});
65		}
66		
67		popup_overlay.addEvent('click', function() {
68			if(opened_popup == 'login')	{
69				popup_overlay.fade('out');
70				popup_login_fx.start({
71					'opacity' : 0,
72					'height' : 0
73				});
74			}
75		});
76	}
77	// K2 font-size switcher fix
78	if(document.id('fontIncrease') && document.getElement('.itemIntroText')) {
79		document.id('fontIncrease').addEvent('click', function() {
80			document.getElement('.itemIntroText').set('class', 'itemIntroText largerFontSize');
81		});
82		
83		document.id('fontDecrease').addEvent('click', function() {
84			document.getElement('.itemIntroText').set('class', 'itemIntroText smallerFontSize');
85		});
86	}
87});
88
89window.addEvent('load', function() {
90	// gkHeader typography elements
91	document.getElements('.gkHeader').each(function(header) {
92		var elements = header.getChildren();
93		var animationStack = [];
94		//
95		elements.each(function(element) {
96			//
97			var delay = element.get('data-delay') || 500;
98			var start = JSON.decode(element.get('data-start'));
99			var end = JSON.decode(element.get('data-end'));
100			var time = element.get('data-time') || 500;
101			//
102			element.setStyles(start);
103			//
104			animationStack.push([element, end, time, delay]);
105		});
106		
107		header.addClass('loaded');
108		//
109		animationStack.each(function(animation){
110			gkRunHeaderAnimation(animation);
111		});
112	});
113});
114
115function gkRunHeaderAnimation(animation) {
116	(function() {
117		new Fx.Morph(animation[0], { duration: animation[2] }).start(animation[1]);
118	}).delay(animation[3]);
119}
120
121// function to set cookie
122function setCookie(c_name, value, expire) {
123	var exdate=new Date();
124	exdate.setDate(exdate.getDate()+expire);
125	document.cookie=c_name+ "=" +escape(value) + ((expire==null) ? "" : ";expires=" + exdate.toUTCString());
126}
127// Function to change styles
128function changeStyle(style){
129	var file1 = $GK_TMPL_URL+'/css/style'+style+'.css';
130	var file2 = $GK_TMPL_URL+'/css/typography/typography.style'+style+'.css';
131	var file3 = $GK_TMPL_URL+'/css/typography/typography.iconset.style'+style+'.css';
132	new Asset.css(file1);
133	new Asset.css(file2);
134	new Asset.css(file3);
135	Cookie.write('gk_restaurant_j25_style', style, { duration:365, path: '/' });
136}

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.