PageSourceSearch

https://agility-ilirija.si/modules/mod_image_show_gk4/styles/gk_rockwall/engine.js

js agility-ilirija.si collected 2026-10-02 02:07:34 UTC 7,842 bytes, 235 lines download raw bytes

1window.addEvent("load",function(){
2	setTimeout(function() {
3	    $$(".gkIsWrapper-gk_rockwall").each(function(el){
4	        var elID = el.getProperty("id");
5	        var wrapper = document.id(elID);
6	        var $G = $Gavick[elID];
7	        var slides = [];
8	        var links = [];
9	        var imagesToLoad = [];
10	        var swipe_min_move = 30;
11	        var swipe_max_time = 500;
12	        // animation variables
13	        $G['animation_timer'] = false;
14	        // text block position
15	        $G['text_pos'] = wrapper.getProperty('data-textpos');
16	        // blank flag
17	        $G['blank'] = false;
18	        // load the images
19	        wrapper.getElements('figure').each(function(el,i){
20	            var newImg = new Element('img',{
21	                "title": el.getProperty('data-title'),
22	                "alt" : el.getProperty('data-alt'),
23	                "class": 'gkIsSlide',
24	                "style": 'z-index: ' + el.getProperty('data-zindex') + ';',
25	                "src": el.getProperty('data-url')
26	            });
27	            links[i] = el.getProperty('data-link');
28	            imagesToLoad.push(newImg);
29	            newImg.inject(el, 'top');
30	        });
31	        //
32	        var time = setInterval(function(){
33	            var process = 0;                
34	            imagesToLoad.each(function(el,i){
35	                if(el.complete) process++;
36	            });
37	            
38	            if(process == imagesToLoad.length){
39	                clearInterval(time);
40
41	                setTimeout(function(){
42	        			wrapper.getElement('.gkIsPreloader').setStyle('position', 'absolute');
43	        			wrapper.getElement('.gkIsPreloader').fade('out');
44	        		}, 400);
45	        		
46        		    $G['actual_slide'] = 0;
47        		    
48        		    new Fx.Tween(wrapper, { 
49        		    	duration: 350,
50        		    	onComplete: function() {
51        		    		wrapper.getElement('figure').fade('in');
52        		    		wrapper.getElement('figure').addClass('active');
53        		    		wrapper.setStyle('height', 'auto');
54        		    	}
55        		    }).start('height', wrapper.getElement('figure').getSize().y);
56        		    
57        		    wrapper.addClass('loaded');
58        		    
59        		    wrapper.getElements(".gkIsSlide").each(function(elmt,i){
60        		        slides[i] = elmt;
61        		    }); 
62        		    
63        		    setTimeout(function() {
64        		        var initfig = slides[0].getParent().getElement('figcaption');
65        		        if(initfig) {
66        		        	initfig.set('morph', { duration: 250 });
67        		        	
68        		        	if($G['text_pos'] == 'left') {
69        		        		initfig.morph({
70        		        			'opacity': [0, 1],
71        		        			'left': ['-50%', '0%']
72        		        		});
73        		        	} else {
74        		        		initfig.morph({
75        		        			'opacity': [0, 1],
76        		        			'right': ['-50%', '0%']
77        		        		});
78        		        	}
79        		        }
80        		    }, 250);
81        		    
82        		    if($G['slide_links']){
83        		        wrapper.getElements('.gkIsSlide').addEvent("click", function(e){ 
84        		            window.location = links[$G['actual_slide']]; 
85        		        });
86        		        wrapper.getElements('.gkIsSlide').setStyle('cursor', 'pointer');
87        		    }  
88        		    
89        		    wrapper.getElements('.gkIsPagination li').each(function(item, i) {
90        		    	item.addEvent('click', function() {
91        		    		if(i != $G['actual_slide']) {
92        		    			$G['blank'] = true;
93        		    			gk_rockwall_autoanimate($G, wrapper, 'next', i);
94        		    		}
95        		    	});
96        		    });            
97        		    
98        		    // auto-animation
99        		    if($G['autoanim'] == 1) {	                	
100        		    	$G['animation_timer'] = setTimeout(function() {
101        		    		gk_rockwall_autoanimate($G, wrapper, 'next', null);
102        		    	}, $G['anim_interval']);
103        		    }
104        		    
105        		    // pagination
106    		    	var slide_pos_start_x = 0;
107    		    	var slide_pos_start_y = 0;
108    		    	var slide_time_start = 0;
109    		    	var slide_swipe = false;
110    		    	
111    		    	wrapper.addEvent('touchstart', function(e) {
112    		    		slide_swipe = true;
113    		    		
114    		    		if(e.changedTouches.length > 0) {
115    		    			slide_pos_start_x = e.changedTouches[0].pageX;
116    		    			slide_pos_start_y = e.changedTouches[0].pageY;
117    		    			slide_time_start = new Date().getTime();
118    		    		}
119    		    	});
120    		    	
121    		    	wrapper.addEvent('touchmove', function(e) {
122    		    		if(e.changedTouches.length > 0 && slide_swipe) {
123    		    			if(
124    		    				Math.abs(e.changedTouches[0].pageX - slide_pos_start_x) > Math.abs(e.changedTouches[0].pageY - slide_pos_start_y)
125    		    			) {
126    		    				e.preventDefault();
127    		    			} else {
128    		    				slide_swipe = false;
129    		    			}
130    		    		}
131    		    	});
132    		    	
133    		    	wrapper.addEvent('touchend', function(e) {
134    		    		if(e.changedTouches.length > 0 && slide_swipe) {					
135    		    			if(
136    		    				Math.abs(e.changedTouches[0].pageX - slide_pos_start_x) >= swipe_min_move && 
137    		    				new Date().getTime() - slide_time_start <= swipe_max_time
138    		    			) {
139    		    				if(e.changedTouches[0].pageX - slide_pos_start_x > 0) {
140    		    					$G['blank'] = true;
141    		    					gk_rockwall_autoanimate($G, wrapper, 'prev', null);
142    		    				} else {
143    		    					$G['blank'] = true;
144    		    					gk_rockwall_autoanimate($G, wrapper, 'next', null);
145    		    				}
146    		    			}
147    		    		}
148    		    	});
149	            }
150	        }, 500);
151	    });
152    }, 1000);
153});
154
155var gk_rockwall_animate = function($G, wrapper, imgPrev, imgNext) {	
156	var prevfig = imgPrev.getElement('figcaption');
157	//
158	if(prevfig) {
159		prevfig.set('morph', { duration: 150 });
160		if($G['text_pos'] == 'left') {
161			prevfig.morph({
162				'opacity': [1, 0],
163				'left': ['0%', '-50%']
164			});
165		} else {
166			prevfig.morph({
167				'opacity': [1, 0],
168				'right': ['0%', '-50%']
169			});
170		}
171	}
172	//
173	imgNext.setProperty('class', 'animated');
174	//imgPrev.fade('out');
175	new Fx.Tween(imgPrev, {
176		duration: $G['anim_speed'],
177		onComplete: function() {
178			imgPrev.setProperty('class', '');
179		}
180	}).start('opacity', 0);
181	//imgNext.fade('in');
182	new Fx.Tween(imgNext, {
183		duration: $G['anim_speed'],
184		onComplete: function() {			
185			imgNext.setProperty('class', 'active');
186			var nextfig = imgNext.getElement('figcaption');
187			if(nextfig) {
188				nextfig.set('morph', { duration: 150 });
189				
190				if($G['text_pos'] == 'left') {
191					nextfig.morph({
192						'opacity': [0, 1],
193						'left': ['-50%', '0%']
194					});
195				} else {
196					nextfig.morph({
197						'opacity': [0, 1],
198						'right': ['-50%', '0%']
199					});
200				}
201			}
202			if($G['autoanim'] == 1) {
203				clearTimeout($G['animation_timer']);
204				
205				$G['animation_timer'] = setTimeout(function() {
206					if($G['blank']) {
207						$G['blank'] = false;
208						clearTimeout($G['animation_timer']);
209						
210						$G['animation_timer'] = setTimeout(function() {
211							gk_rockwall_autoanimate($G, wrapper, 'next', null);
212						}, $G['anim_interval']);
213					} else {
214						gk_rockwall_autoanimate($G, wrapper, 'next', null);
215					}
216				}, $G['anim_interval']);
217			}
218		} 
219	}).start('opacity', 1);
220}; 
221
222var gk_rockwall_autoanimate = function($G, wrapper, dir, next) {
223	var i = $G['actual_slide'];
224	var imgs = wrapper.getElements('figure');
225	
226	if(next == null) {
227		next = (dir == 'next') ? ((i < imgs.length - 1) ? i+1 : 0) : ((i == 0) ? imgs.length - 1 : i - 1); // dir: next|prev
228	}
229	
230	gk_rockwall_animate($G, wrapper, imgs[i], imgs[next]);
231	$G['actual_slide'] = next;
232	
233	wrapper.getElements('.gkIsPagination li').removeClass('active');
234	wrapper.getElements('.gkIsPagination li')[next].addClass('active');
235};

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.