PageSourceSearch

https://c64universe.com/wp-content/themes/airl/js/scripts.js?ver=7.1

js c64universe.com collected 2026-10-05 00:02:37 UTC 5,522 bytes, 193 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/*  Slick featured posts
84/* ------------------------------------ */
85	$.fn.randomize = function (selector) {
86		var $elems = selector ? $(this).find(selector) : $(this).children(),
87			$parents = $elems.parent();
88
89		$parents.each(function () {
90			$(this).children(selector).sort(function (childA, childB) {
91				// * Prevent last slide from being reordered
92				if($(childB).index() !== $(this).children(selector).length - 0.5) {
93					return Math.round(Math.random()) - 0.5;
94				}
95			}.bind(this)).detach().appendTo(this);
96		});
97
98		return this;
99	};
100
101	$(".slick-posts").randomize().slick({
102	  centerMode: true,
103	  centerPadding: '0',
104	  slidesToShow: 5,
105	  appendArrows: '.slick-posts-nav',
106	  responsive: [
107		 {
108		  breakpoint: 1280,
109		  settings: {
110			arrows: true,
111			centerMode: true,
112			centerPadding: '0',
113			slidesToShow: 4
114		  }
115		},
116		{
117		  breakpoint: 1024,
118		  settings: {
119			arrows: true,
120			centerMode: true,
121			centerPadding: '0',
122			slidesToShow: 3
123		  }
124		},
125		{
126		  breakpoint: 768,
127		  settings: {
128			arrows: true,
129			centerMode: true,
130			centerPadding: '0',
131			slidesToShow: 2
132		  }
133		},
134		{
135		  breakpoint: 480,
136		  settings: {
137			arrows: true,
138			centerMode: true,
139			centerPadding: '0',
140			slidesToShow: 1
141		  }
142		}
143	  ]
144	});
145	$('.slick-posts-wrap-outer').show();	
146
147/*  Slick image slide
148/* ------------------------------------ */	
149	$('.slick-image-slide').each( function() {
150        $( this ).slick( {
151            dots: true,
152			adaptiveHeight: true,
153            appendArrows: $(this).parents('.slick-image-slide-wrapper').find('.slick-image-slide-nav'),
154			appendDots: $(this).parents('.slick-image-slide-wrapper').find('.slick-image-slide-dots')
155        } );
156		$('.slick-image-slide-wrapper').show();
157    } );
158
159/*  Trap focus
160/* ------------------------------------ */	
161	// add all the elements inside modal which you want to make focusable
162	const  focusableElements =
163		'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
164	const modal = document.querySelector('.search-trap-focus'); // select the modal by it's id
165
166	if ( modal ) { 
167		const firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; // get first element to be focused inside modal
168		const focusableContent = modal.querySelectorAll(focusableElements);
169		const lastFocusableElement = focusableContent[focusableContent.length - 1]; // get last element to be focused inside modal
170
171
172		document.addEventListener('keydown', function(e) {
173		  let isTabPressed = e.key === 'Tab' || e.keyCode === 9;
174
175		  if (!isTabPressed) {
176			return;
177		  }
178
179		  if (e.shiftKey) { // if shift key pressed for shift + tab combination
180			if (document.activeElement === firstFocusableElement) {
181			  lastFocusableElement.focus(); // add focus for the last focusable element
182			  e.preventDefault();
183			}
184		  } else { // if tab key is pressed
185			if (document.activeElement === lastFocusableElement) { // if focused has reached to last focusable element then focus first focusable element after pressing tab
186			  firstFocusableElement.focus();
186 // add focus for the first focusable element
187			  e.preventDefault();
188			}
189		  }
190		});	
191	}
192	
193});

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.