PageSourceSearch

https://allstarz.ee/js/custom.js

js allstarz.ee collected 2026-10-02 07:19:20 UTC 18,737 bytes, 593 lines download raw bytes

1/***************************************************************************************
2*
3*        NAVIGATION
4*
5***************************************************************************************/
6
7        $(document).ready(function(){
8            var $body = $("body");
9            var $navWrapper = $("#nav-wrapper");
10            var $navToggle = $(".nav-toggle");
11            var $navItems = $("#nav > li");
12            var $navLinks = $("#nav a");
13            var $searchShell = $(".header-search-shell");
14            var $searchToggle = $(".header-search-toggle");
15            var $searchInput = $("#header-search-input");
16
17            $navItems.each(function(){
18                var $item = $(this);
19                if ($item.children("ul").length) {
20                    $item.addClass("has-submenu");
21                }
22            });
23
24            function isCompactHeader() {
25                return window.innerWidth <= 980;
26            }
27
28            function closeSubmenus() {
29                $("#nav li.has-submenu").removeClass("is-open");
30            }
31
32            function closeSearch() {
33                $searchShell.removeClass("is-open");
34                $searchToggle.attr("aria-expanded", "false");
35            }
36
37            function closeNavigation() {
38                $navWrapper.removeClass("is-open");
39                $navToggle.attr("aria-expanded", "false");
40                $body.removeClass("nav-open");
41                closeSubmenus();
42            }
43
44            function syncHeaderState() {
45                if (!isCompactHeader()) {
46                    closeNavigation();
47                    closeSearch();
48                }
49            }
50
51            $navToggle.on("click", function(){
52                if (!isCompactHeader()) {
53                    return;
54                }
55
56                var isOpen = $navWrapper.toggleClass("is-open").hasClass("is-open");
57                $navToggle.attr("aria-expanded", isOpen ? "true" : "false");
58                $body.toggleClass("nav-open", isOpen);
59
60                if (isOpen) {
61                    closeSearch();
62                } else {
63                    closeSubmenus();
64                }
65            });
66
67            $searchToggle.on("click", function(){
68                if (!isCompactHeader()) {
69                    return;
70                }
71
72                var isOpen = $searchShell.toggleClass("is-open").hasClass("is-open");
73                $searchToggle.attr("aria-expanded", isOpen ? "true" : "false");
74
75                if (isOpen) {
76                    closeNavigation();
77                    $searchInput.trigger("focus");
78                }
79            });
80
81            $("#nav li.has-submenu > a").on("click", function(e){
82                if (!isCompactHeader()) {
83                    return;
84                }
85
86                var $item = $(this).parent();
87                e.preventDefault();
88
89                if ($item.hasClass("is-open")) {
90                    $item.removeClass("is-open");
91                } else {
92                    $item.siblings(".has-submenu").removeClass("is-open");
93                    $item.addClass("is-open");
94                }
95            });
96
97            $navLinks.on("click", function(){
98                if (!isCompactHeader()) {
99                    return;
100                }
101
102                if (!$(this).siblings("ul").length) {
103                    closeNavigation();
104                }
105            });
106
107            $(document).on("click", function(e){
108                var $target = $(e.target);
109
110                if (isCompactHeader() && !$target.closest("#nav-wrapper").length && !$target.closest("#logo").length) {
111                    closeNavigation();
112                }
113
114                if (isCompactHeader() && !$target.closest(".header-search-shell").length) {
115                    closeSearch();
116                }
117            });
118
119            $(document).on("keydown", function(e){
120                if (e.key === "Escape") {
121                    closeNavigation();
122                    closeSearch();
123                }
124            });
125
126            $(window).on("resize", syncHeaderState);
127            syncHeaderState();
128        });
129/***************************************************************************************
130*
131*		ACCORDION PANELS
132*
133***************************************************************************************/
134
135		$(document).ready(function(){
136			function artistGalleryOptions() {
137				return {
138					groupAll: false,
139					hideScrollbar: false,
140					animated: true,
141					showClass: "f-fadeIn",
142					hideClass: "f-fadeOut",
143					Carousel: {
144						infinite: true
145					},
146					Images: {
147						Panzoom: {
148							maxScale: 4
149						}
150					},
151					on: {
152						reveal: function(fancybox, slide) {
153							var current = slide.index + 1;
154							var total = fancybox.userSlides ? fancybox.userSlides.length : fancybox.getSlides().length;
155							var caption = slide.triggerEl ? (slide.triggerEl.getAttribute("data-caption") || "") : "";
156							var html = '<div class="artist-lightbox-meta"><span class="artist-lightbox-counter">' + current + ' / ' + total + '</span>';
157							if (caption !== "") {
158								html += '<span class="artist-lightbox-caption">' + caption + '</span>';
159							}
160							html += '</div>';
161							slide.caption = html;
162						}
163					}
164				};
165			}
166
167			function escapeHtml(value) {
168				return String(value || "")
169					.replace(/&/g, "&amp;")
170					.replace(/</g, "&lt;")
171					.replace(/>/g, "&gt;")
172					.replace(/"/g, "&quot;")
173					.replace(/'/g, "&#39;");
174			}
175
176			function buildFallbackCaption($item, index, total) {
177				var caption = $item.attr("data-caption") || "";
178				var html = '<div class="artist-lightbox-meta"><span class="artist-lightbox-counter">' + (index + 1) + ' / ' + total + '</span>';
179				if (caption !== "") {
180					html += '<span class="artist-lightbox-caption">' + escapeHtml(caption) + '</span>';
181				}
182				html += '</div>';
183				return html;
184			}
185
186			function ensureFallbackLightbox() {
187				if ($("#artist-fallback-lightbox").length) {
188					return $("#artist-fallback-lightbox");
189				}
190
191				var markup = '' +
192					'<div id="artist-fallback-lightbox" class="artist-fallback-lightbox" aria-hidden="true">' +
193						'<button type="button" class="artist-fallback-close" aria-label="Sulge galerii">&times;</button>' +
194						'<button type="button" class="artist-fallback-nav artist-fallback-prev" aria-label="Eelmine pilt">&#10094;
194</button>' +
195						'<div class="artist-fallback-stage">' +
196							'<img class="artist-fallback-image" src="" alt="" />' +
197							'<div class="artist-fallback-caption"></div>' +
198						'</div>' +
199						'<button type="button" class="artist-fallback-nav artist-fallback-next" aria-label="J&auml;rgmine pilt">&#10095;</button>' +
200					'</div>';
201
202				$("body").append(markup);
203				return $("#artist-fallback-lightbox");
204			}
205
206			var fallbackState = {
207				items: $(),
208				index: 0
209			};
210
211			function renderFallbackSlide() {
212				var $lightbox = ensureFallbackLightbox();
213				var $item = fallbackState.items.eq(fallbackState.index);
214				if (!$item.length) {
215					return;
216				}
217
218				$lightbox.find(".artist-fallback-image")
219					.attr("src", $item.attr("href"))
220					.attr("alt", $item.find("img").attr("alt") || "");
221				$lightbox.find(".artist-fallback-caption").html(buildFallbackCaption($item, fallbackState.index, fallbackState.items.length));
222			}
223
224			function openFallbackLightbox($items, startIndex) {
225				var $lightbox = ensureFallbackLightbox();
226				fallbackState.items = $items;
227				fallbackState.index = startIndex;
228				renderFallbackSlide();
229				$lightbox.addClass("is-open").attr("aria-hidden", "false");
230				$("body").addClass("artist-lightbox-open");
231			}
232
233			function closeFallbackLightbox() {
234				$("#artist-fallback-lightbox").removeClass("is-open").attr("aria-hidden", "true");
235				$("body").removeClass("artist-lightbox-open");
236			}
237
238			function stepFallbackLightbox(direction) {
239				if (!fallbackState.items.length) {
240					return;
241				}
242
243				fallbackState.index = (fallbackState.index + direction + fallbackState.items.length) % fallbackState.items.length;
244				renderFallbackSlide();
245			}
246
247			if (window.Fancybox) {
248				Fancybox.bind("a.fancybox-photo", artistGalleryOptions());
249			}
250
251			$(document).on("click", "a.fancybox-photo", function(e){
252				if (!window.Fancybox) {
253					return;
254				}
255
256				e.preventDefault();
257
258				var group = $(this).attr("data-fancybox");
259				var $items = $('a.fancybox-photo[data-fancybox="' + group + '"]');
260				var startIndex = $items.index(this);
261				var slides = [];
262
263				$items.each(function(){
264					slides.push({
265						src: $(this).attr("href"),
266						type: "image",
267						triggerEl: this
268					});
269				});
270
271				if (window.Fancybox) {
272					Fancybox.show(slides, $.extend({}, artistGalleryOptions(), {
273						startIndex: startIndex
274					}));
275				} else {
276					openFallbackLightbox($items, startIndex);
277				}
278			});
279
280			$(document).on("click", ".artist-fallback-close", function(){
281				closeFallbackLightbox();
282			});
283
284			$(document).on("click", ".artist-fallback-prev", function(){
285				stepFallbackLightbox(-1);
286			});
287
288			$(document).on("click", ".artist-fallback-next", function(){
289				stepFallbackLightbox(1);
290			});
291
292			$(document).on("click", "#artist-fallback-lightbox", function(e){
293				if ($(e.target).is("#artist-fallback-lightbox")) {
294					closeFallbackLightbox();
295				}
296			});
297
298			$(document).on("keydown", function(e){
299				if (!$("#artist-fallback-lightbox").hasClass("is-open")) {
300					return;
301				}
302
303				if (e.key === "Escape") {
304					closeFallbackLightbox();
305				}
306				if (e.key === "ArrowLeft") {
307					stepFallbackLightbox(-1);
308				}
309				if (e.key === "ArrowRight") {
310					stepFallbackLightbox(1);
311				}
312			});
313
314			var fallbackTouchStartX = null;
315			$(document).on("touchstart", "#artist-fallback-lightbox", function(e){
316				var point = e.originalEvent.touches ? e.originalEvent.touches[0] : null;
317				fallbackTouchStartX = point ? point.clientX : null;
318			});
319
320			$(document).on("touchend", "#artist-fallback-lightbox", function(e){
321				var point = e.originalEvent.changedTouches ? e.originalEvent.changedTouches[0] : null;
322				if (!point || fallbackTouchStartX === null) {
323					return;
324				}
325
326				var delta = fallbackTouchStartX - point.clientX;
327				fallbackTouchStartX = null;
328
329				if (Math.abs(delta) < 40) {
330					return;
331				}
332
333				if (delta > 0) {
334					stepFallbackLightbox(1);
335				} else {
336					stepFallbackLightbox(-1);
337				}
338			});
339		});
340		
341/***************************************************************************************
342*
343*		FLICKR FEED
344*
345***************************************************************************************/
346		
347		$(document).ready(function(){
348			$('#flickr-feed ul').jflickrfeed({
349				feedapi: 'photoset.gne',
350				limit: 8,
351				qstrings: {
352					nsid: '10729228@N07',
353					set: '72157624798241210'
354				},
355				itemTemplate:
356				'<li>' +
357					'<a class="flickr-feed-photos" data-fancybox="flickr-feed" href="{{image}}" title="{{title}}">' +
358						'<img src="{{image_s}}" alt="{{title}}" width="38" height="38" />' +
359					'</a>' +
360				'</li>'
361			}, function(data) {
362				Fancybox.bind("#flickr-feed a.flickr-feed-photos", {
363					groupAll: false,
364					hideScrollbar: false,
365					animated: true
366				});
367			});
368		});
369		
370/***************************************************************************************
371*
372*		TWITTER FEED
373*
374***************************************************************************************/
375
376		$(document).ready(function(){
377			$('#tweets').tweetable({
378				username: 'mthemes', 
379				time: true, 
380				limit: 1, 
381				replies: true, 
382				position: 'append'
383			});
384		});
385		
386/***************************************************************************************
387*
388*		TOTOP PLUGIN
389*
390***************************************************************************************/
391
392		$(document).ready(function() {
393			
394			$().UItoTop({
395				scrollSpeed: 500,
396				easingType: 'easeOutQuart' 
397	 		});
398			
399		});
400		
401/***************************************************************************************
402*
403*		TESTIMONIAL PLUGIN
404*
405***************************************************************************************/
406		$(document).ready(function() {
407		
408			$('.testimonial').quovolver();
409		
410		});
411
412/***************************************************************************************
413*
414*		NEWSLETTER INPUT
415*
416***************************************************************************************/
417		
418		$(document).ready(function() {  
419			$('.newsletter input[type="text"], .sidebar-search input[type="text"]').addClass("normalfield");  
420			$('.newsletter input[type="text"], .sidebar-search input[type="text"]').focus(function() {  
421				$(this).removeClass("normalfield").addClass("focusfield");  
422				if (this.value == this.defaultValue){  
423					this.value = '';  
424				}  
425				if(this.value != this.defaultValue){  
426					this.select();  
427				}  
428			});  
429			$('.newsletter input[type="text"], .sidebar-search input[type="text"]').blur(function() {  
430				$(this).removeClass("focusfield").addClass("normalfield");  
431				if ($.trim(this.value == '')){  
432					this.value = (this.defaultValue ? this.defaultValue : '');  
433				}  
434			});  
435		});
436
437/***************************************************************************************
438*
439*		PORTFOLIO SORTING
440*
441***************************************************************************************/
442
443		$(document).ready(function(){
444
445			$(document).ready(function(){
446				$(".fancycaption").fancyCaption();
447			});
448			
449			$(".filter li").removeClass("first-child");
450			$(".filter li").removeClass("last-child");	
451
452			function resetMobileArtistDirectoryLayout() {
453				if (!(window.matchMedia && window.matchMedia("(max-width: 760px)").matches)) {
454					return;
455				}
456
457				var $mobilePortfolio = $(".artist-directory-page #portfolio-filterable-wrapper");
458				if (!$mobilePortfolio.length) {
459					return;
460				}
461
462				$mobilePortfolio.find(".quicksand-container").removeAttr("style");
463				$mobilePortfolio.find(".portfolio-filterable").removeAttr("style");
464				$mobilePortfolio.find(".portfolio-filterable > li").removeAttr("style");
465			}
466
467			function filterArtistDirectory(filterClass) {
468				var $directoryList = $(".artist-directory-page .portfolio-filterable");
469				if (!$directoryList.length) {
470					return;
471				}
472
473				resetMobileArtistDirectoryLayout();
474
475				$directoryList.children("li").each(function(){
476					var $item = $(this);
477					if (filterClass === "all" || $item.is("[data-type~='" + filterClass + "']")) {
478						$item.removeClass("is-filter-hidden").removeAttr("hidden").removeAttr("style");
479					} else {
480						$item.addClass("is-filter-hidden").attr("hidden", "hidden").removeAttr("style");
481					}
482				});
483			}
484
485			// Clone portfolio items to get a second collection for Quicksand plugin
486			var $portfolioClone = $(".portfolio-filterable").clone();
487			resetMobileArtistDirectoryLayout();
488			$(window).on("resize", resetMobileArtistDirectoryLayout);
489			
490			// Attempt to call Quicksand on every click event handler
491			$(".filter a").click(function(e){
492				
493				$(".filter li").removeClass("current");	
494				
495				// Get the class attribute value of the clicked link
496				var $filterClass = $(this).parent().attr("class");
497
498				if ( $filterClass == "all" ) {
499					var $filteredPortfolio = $portfolioClone.find("li");
500				} else {
501					var $filteredPortfolio = $portfolioClone.find("li[data-type~=" + $filterClass + "]");
502				}
503				
504				if ($(this).closest(".artist-directory-page").length || $(".artist-directory-page").length) {
505					$(this).parent().addClass("current");
506					filterArtistDirectory($filterClass);
507					$(document).ready(function(){
508						$(".fancycaption").fancyCaption();
509					});
510					e.preventDefault();
511					return;
512				}
513
514				// Call quicksand
515				$(".portfolio-filterable").quicksand( $filteredPortfolio, { 
516					duration: 800, 
517					easing: 'easeInOutQuad'
518				}, function(){
519					resetMobileArtistDirectoryLayout();
520					
521					$(document).ready(function(){
522						$(".fancycaption").fancyCaption();
523					});
524				});
525
526				$(this).parent().addClass("current");
527
528				// Prevent the browser jump to the link anchor
529				e.preventDefault();
530			})
531		});
532
533		$(document).ready(function(){
534			$(".artist-directory-filter-button").on("click", function(){
535				var $button = $(this);
536				var filterValue = $button.data("filter");
537				var $scope = $button.closest(".artist-directory-panel");
538				var $cards = $scope.find(".artist-directory-catalog .artist-directory-card");
539
540				$scope.find(".artist-directory-filter-button").removeClass("is-active");
541				$button.addClass("is-active");
542
543				$cards.each(function(){
544					var $card = $(this);
545					if (filterValue === "all" || $card.attr("data-type") === filterValue) {
546						$card.removeAttr("hidden");
547					} else {
548						$card.attr("hidden", "hidden");
549					}
550				});
551			});
552		});
553
554/***************************************************************************************
555*
556*       ARCHIVE NAV AUTO SCROLL
557*
558***************************************************************************************/
559
560        $(document).ready(function() {
561            $(".birthday-side-nav ul, .week-archive-side-nav ul").each(function() {
562                var nav = this;
563                var activeItem = $(nav).find("li.active").get(0);
564                if (!activeItem) {
565                    return;
566                }
567
568                var targetTop = activeItem.offsetTop - Math.max(12, Math.round((nav.clientHeight - activeItem.offsetHeight) / 2));
569                nav.scrollTop = Math.max(0, targetTop);
570            });
571        });
572
573/***************************************************************************************
574*
575*       PRETTY SEARCH URL
576*
577***************************************************************************************/
578
579        $(document).on("submit", ".js-pretty-search-form", function(event) {
580            var input = $(this).find('input[name="word"]').first();
581            if (!input.length) {
582                return;
583            }
584
585            var value = $.trim(input.val());
586            if (!value) {
587                return;
588            }
589
590            var base = $(this).data("searchBase") || "otsing";
591            event.preventDefault();
592            window.location.href = base + ".html?word=" + encodeURIComponent(value);
593        });

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.