PageSourceSearch

https://blog.sddc.be/wp-content/themes/blogstream/js/scripts.js?ver=7.1.2

js sddc.be collected 2026-10-06 06:43:55 UTC 6,658 bytes, 246 lines download raw bytes

1/*
2	scripts.js
3	
4	License: GNU General Public License v3.0
5	License URI: http://www.gnu.org/licenses/gpl-3.0.html
6	
7	Copyright: (c) 2013 Alexander "Alx" Agnarson, http://alx.media
8*/
9
10"use strict";
11
12jQuery(document).ready(function($) {
13
14/*  Toggle header search
15/* ------------------------------------ */
16	$('.toggle-search').on('click', function() {
17		$('.toggle-search').toggleClass('active');
18		$('.search-expand').fadeToggle(250);
19            setTimeout(function(){
20                $('.search-expand input').focus();
21            }, 300);
22	});
23
24/*  Scroll to top
25/* ------------------------------------ */
26	$('a#back-to-top').on('click', function() {
27		$('html, body').animate({scrollTop:0},'slow');
28		return false;
29	});
30	
31/*  Tabs widget
32/* ------------------------------------ */	
33	(function() {
34		var $tabsNav       = $('.alx-tabs-nav'),
35			$tabsNavLis    = $tabsNav.children('li'),
36			$tabsContainer = $('.alx-tabs-container');
37
38		$tabsNav.each(function() {
39			var $this = $(this);
40			$this.next().children('.alx-tab').stop(true,true).hide()
41			.siblings( $this.find('a').attr('href') ).show();
42			$this.children('li').first().addClass('active').stop(true,true).show();
43		});
44
45		$tabsNavLis.on('click', function(e) {
46			var $this = $(this);
47
48			$this.siblings().removeClass('active').end()
49			.addClass('active');
50			
51			$this.parent().next().children('.alx-tab').stop(true,true).hide()
52			.siblings( $this.find('a').attr('href') ).fadeIn();
53			e.preventDefault();
54		}).children( window.location.hash ? 'a[href="' + window.location.hash + '"]' : 'a:first' ).trigger('click');
55
56	})();
57	
58/*  Comments / pingbacks tabs
59/* ------------------------------------ */	
60	$('.comment-tabs li').on('click', function() {
61		$('.comment-tabs li').removeClass('active');
62		$(this).addClass('active');
63		$('.comment-tab').hide();
64		var selected_tab = $(this).find('a').attr('href');
65		$(selected_tab).fadeIn();
66		return false;
67	});
68
69/*  Table odd row class
70/* ------------------------------------ */
71	$('table tr:odd').addClass('alt');
72
73/*  Fitvids
74/* ------------------------------------ */
75	function responsiveVideo() {
76			if ( $().fitVids ) {
77				$('#wrapper').fitVids();
78			}	
79		}
80		
81	responsiveVideo();
82	
83/*  Header Sticky
84/* ------------------------------------ */	
85	$('.logged-out #header-sticky').stickThis({
86		top:            0,
87		minscreenwidth: 1081,
88		maxscreenwidth: 999999,
89		zindex:         99,
90		debugmode:      false,
91		pushup:         ''
92	});
93	
94	$('.admin-bar #header-sticky').stickThis({
95		top:            32,
96		minscreenwidth: 1081,
97		maxscreenwidth: 999999,
98		zindex:         99,
99		debugmode:      false,
100		pushup:         ''
101	});
102
103/*  Hide on scroll down
104/* ------------------------------------ */
105	var scrollTimeOut = true,
106		lastYPos = 0,
107		yPos = 0,
108		yPosDelta = 5,
109		nav = $('.hide-on-scroll-down'),
110		navHeight = nav.outerHeight(),
111		setNavClass = function() {
112			scrollTimeOut = false;
113			yPos = $(window).scrollTop();
114
115			if(Math.abs(lastYPos - yPos) >= yPosDelta) {
116				if (yPos > lastYPos && yPos > navHeight){
117					nav.addClass('hide-scroll');
118				} else {
119					nav.removeClass('hide-scroll');
120				}
121				lastYPos = yPos;
122			}
123		};
124
125	$(window).scroll(function(e){
126		scrollTimeOut = true;
127	});
128
129	setInterval(function() {
130		if (scrollTimeOut) {
131			setNavClass();
132		}
133
134	}, 250);
135
136/*  Slick featured posts
137/* ------------------------------------ */
138	$.fn.randomize = function (selector) {
139		var $elems = selector ? $(this).find(selector) : $(this).children(),
140			$parents = $elems.parent();
141
142		$parents.each(function () {
143			$(this).children(selector).sort(function (childA, childB) {
144				// * Prevent last slide from being reordered
145				if($(childB).index() !== $(this).children(selector).length - 0.5) {
146					return Math.round(Math.random()) - 0.5;
147				}
148			}.bind(this)).detach().appendTo(this);
149		});
150
151		return this;
152	};
153
154	$(".slick-featured").randomize().slick({
155	  centerMode: true,
156	  centerPadding: '0',
157	  slidesToShow: 3,
158	  appendArrows: '.slick-featured-nav',
159	  dots: true,
160	  responsive: [
161		 {
162		  breakpoint: 1280,
163		  settings: {
164			arrows: true,
165			centerMode: true,
166			centerPadding: '0',
167			slidesToShow: 3
168		  }
169		},
170		{
171		  breakpoint: 1024,
172		  settings: {
173			arrows: true,
174			centerMode: true,
175			centerPadding: '0',
176			slidesToShow: 3
177		  }
178		},
179		{
180		  breakpoint: 768,
181		  settings: {
182			arrows: true,
183			centerMode: true,
184			centerPadding: '0',
185			slidesToShow: 2
186		  }
187		},
188		{
189		  breakpoint: 480,
190		  settings: {
191			arrows: true,
192			centerMode: true,
193			centerPadding: '0',
194			slidesToShow: 1
195		  }
196		}
197	  ]
198	});
199	$('.slick-featured-wrap-outer').show();	
200	
201/*  Slick image slide
202/* ------------------------------------ */	
203	$('.slick-image-slide').each( function() {
204        $( this ).slick( {
205            dots: true,
206			adaptiveHeight: true,
207            appendArrows: $(this).parents('.slick-image-slide-wrapper').find('.slick-image-slide-nav'),
208			appendDots: $(this).parents('.slick-image-slide-wrapper').find('.slick-image-slide-dots')
209        } );
210    } );
211
212/*  Trap focus
213/* ------------------------------------ */	
214	// add all the elements inside modal which you want to make focusable
215	const  focusableElements =
216		'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
217	const modal = document.querySelector('.search-trap-focus'); // select the modal by it's id
218
219	if ( modal ) { 
220		const firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; // get first element to be focused inside modal
221		const focusableContent = modal.querySelectorAll(focusableElements);
222		const lastFocusableElement = focusableContent[focusableContent.length - 1]; // get last element to be focused inside modal
223
224
225		document.addEventListener('keydown', function(e) {
226		  let isTabPressed = e.key === 'Tab' || e.keyCode === 9;
227
228		  if (!isTabPressed) {
229			return;
230		  }
231
232		  if (e.shiftKey) { // if shift key pressed for shift + tab combination
233			if (document.activeElement === firstFocusableElement) {
234			  lastFocusableElement.focus(); // add focus for the last focusable element
235			  e.preventDefault();
236			}
237		  } else { // if tab key is pressed
238			if (document.activeElement === lastFocusableElement) { // if focused has reached to last focusable element then focus first focusable element after pressing tab
239			  firstFocusableElement.focus();
239 // add focus for the first focusable element
240			  e.preventDefault();
241			}
242		  }
243		});	
244	}
245	
246});

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.