PageSourceSearch

https://aegina-hiking.com/wp-content/themes/gk-portfolio/js/functions.js?ver=7.1.2

js aegina-hiking.com collected 2026-10-03 00:39:46 UTC 6,250 bytes, 201 lines download raw bytes

1/**
2 * Functionality specific to Portfolio.
3 **/
4function portfolio_is_touch_device() {
5	return (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
6} 
7 
8(function($) {	
9	$(document).ready(function(){
10		// set the information about touch screen
11		if(portfolio_is_touch_device()) {
12			$(document.body).addClass('touch-screen');
13		} else {
14			$(document.body).addClass('no-touch-screen');
15		}
16		// get the post images
17		var blocks = [];
18		
19		jQuery('.article-helper.notloaded').each(function(i, block) {
20			blocks.push(block);
21		});
22		
23		var add_class = function(block, class_name, delay) {
24			setTimeout(function() {
25				jQuery(block).addClass(class_name);
26			}, delay);
27		};
28		
29		for(var i = 0; i < blocks.length; i++) {
30			add_class(blocks[i], 'article-helper animated', i * 200);
31		}
32		
33		// Fix :hover portfolio effect on the touch screens
34		jQuery('.article-helper').each(function(i, block) {
35			block = jQuery(block);
36			
37			if(block.find('.post-preview').length) {
38				var preview = block.find('.post-preview');
39				
40				block.bind('touchstart', function() {
41					block.attr('data-touch-time', new Date());
42				});
43				
44				block.bind('touchend', function(e) {				
45					if(block.attr('data-touch-time') - new Date() < 500) {
46						if(block.hasClass('article-hover')) {
47							block.removeClass('article-hover');
48						} else {
49							block.addClass('article-hover');
50						}
51					}
52				});
53				
54				if(preview.attr('data-url')) {
55					preview.click(function() {
56						window.location.href = preview.attr('data-url');
57					});
58				}
59			} else {
60				var preview = block.find('.entry-header');
61				
62				if(preview.attr('data-url')) {
63					block.click(function() {
64						window.location.href = preview.attr('data-url');
65					});
66				}
67			}
68		});
69		
70		jQuery('.article-helper.notloaded').each(function(i, wrapper) {
71            wrapper = jQuery(wrapper);
72            var img = wrapper.find('header > img')[0];
73
74			var interval = 500;
75			
76			if(wrapper.hasClass('slow-animation')) {
77				interval = 750;
78			}
79			
80			if(wrapper.hasClass('fast-animation')) {
81				interval = 250;
82			}
83
84            if(img) {
85              // wait for the images
86              var timer = setInterval(function() {
87                // when the image is laoded
88                if(img.complete) {
89                  // stop periodical calls
90                  clearInterval(timer);
91                  // generate the image wrapper
92                  var src = jQuery(img).attr('src');
93                  var url = jQuery(img).parent().attr('data-url');
94                  jQuery(img).remove();
95                  var img_container = jQuery('<div class="post-image el-transition-long" data-url="'+url+'" style="background-image: url(\''+src+'\')"></div>');
96                  img_container.appendTo(wrapper);
97                  if(url) {
98                  	img_container.css('cursor', 'pointer');
99                  	
100                  	img_container.bind('touchend', function(e) {
101                  		img_container.attr('data-touched', 'true');
102                  		
103                  		setTimeout(function() {
104                  			img_container.attr('data-touched', 'false');
105                  		}, 250);
106                  	});
107                  	
108                  	img_container.click(function() {
109                  		if(!img_container.attr('data-touched') || img_container.attr('data-touched') === 'false') {
110                  			window.location = img_container.attr('data-url');
111                  		}
112                  	});
113                  }
114                  wrapper.removeClass('notloaded');
115                  // add class with delay
116                  setTimeout(function() {
117                    img_container.addClass('loaded');
118                  }, interval);
119                }          
120              }, 500);
121              // add necessary mouse events
122              wrapper.mouseenter(function() {
123              	if(!wrapper.hasClass('no-anim')) {
124                	wrapper.addClass('article-hover');
125                }
126              });
127
128              wrapper.mouseleave(function() {
129                if(!wrapper.hasClass('no-anim')) {
130                	wrapper.removeClass('article-hover');
131                }
132              });
133            } else {
134              // where there is no image - display the text directly
135              wrapper.addClass('article-hover');
136            }
137          });
138		
139		// fit videos
140		jQuery(".video-wrapper").fitVids();
141	    
142		var main_menu = jQuery(".main-navigation");
143		var main_menu_container = main_menu.find('div').first();
144		var submenu = main_menu.find('ul').first();
145		
146		if(!submenu.length) {
147			main_menu_container = jQuery(main_menu.find('.nav-menu').first());
148			submenu = jQuery(main_menu_container.find('ul').first());
149		}
150		
151		main_menu.click(function() {
152			if(jQuery(window).outerWidth() <= 720) {
153				if(main_menu.hasClass("opened")) {
154					main_menu_container.animate({
155						'height': 0
156					}, 500, function() {
157						main_menu.removeClass("opened");
158					});
159				} else {
160					main_menu.addClass("opened");
161					var h = submenu.outerHeight();
162					main_menu_container.css('height', '0');
163					main_menu_container.animate({
164						'height': h + "px"
165					}, 500);
166				}
167			}
168		});	
169		
170		// Fix for the mobile devices
171		if($(document.body).hasClass('touch-screen') && $(window).outerWidth() > 720) {
172			$('.menu-item-has-children').children('a').each(function(i, link) {
173				$(link).click(function(e) {
174					e.preventDefault();
175				});
176			});
177			
178			$('.menu-item-has-children').children('a').on('touchend', function(e) {
179				e.stopPropagation();
180				e.preventDefault();
181				
182				if(!$(this).attr('data-time')) {
183					$(this).parent().addClass('opened');
184					$(this).attr('data-time', new Date().getTime());
185					return true;
186				}
187				
188				if($(this).attr('data-time') && (parseInt($(this).attr('data-time'), 10) + 500.0) > new Date().getTime()) {
189					window.location.href = $(this).attr('href');
190					return true;
191				}
192				
193				if($(this).attr('data-time') && (parseInt($(this).attr('data-time'), 10) + 500.0) < new Date().getTime()) {
194					$(this).parent().removeClass('opened');
195					$(this).removeAttr('data-time');
196					return true;
197				}
198			});
199		}
200	});
201})(jQuery);

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.