PageSourceSearch

https://www.cc-deuxrives.fr/wp-content/themes/CC-2rives/assets/js/skip-link-focus-fix.js?ver=20151215

js cc-deuxrives.fr collected 2026-09-27 21:51:50 UTC 1,881 bytes, 70 lines download raw bytes

1/**
2 * File skip-link-focus-fix.js.
3 *
4 * Helps with accessibility for keyboard only users.
5 *
6 * Learn more: https://git.io/vWdr2
7 */
8/*( function() {
9	var isIe = /(trident|msie)/i.test( navigator.userAgent );
10
11	if ( isIe && document.getElementById && window.addEventListener ) {
12		window.addEventListener( 'hashchange', function() {
13			var id = location.hash.substring( 1 ),
14				element;
15
16			if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
17				return;
18			}
19
20			element = document.getElementById( id );
21
22			if ( element ) {
23				if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
24					element.tabIndex = -1;
25				}
26
27				element.focus();
28			}
29		}, false );
30	}
31} )();*/
32
33
34//https://github.com/selfthinker/dokuwiki_template_writr/blob/master/js/skip-link-focus-fix.js
35(function($) {
36
37  jQuery.extend(jQuery.expr[':'], {
38    focusable: function(el, index, selector){
39      var $element = $(el);
40      return $element.is(':input:enabled, a[href], area[href], object, [tabindex]') && !$element.is(':hidden');
41    }
42  });
43
44  function focusOnElement($element) {
45    if (!$element.length) {
46      return;
47    }
48    if (!$element.is(':focusable')) {
49      // add tabindex to make focusable and remove again
50      $element.attr('tabindex', -1).on('blur focusout', function () {
51        $(this).removeAttr('tabindex');
52      });
53    }
54    $element.focus();
55  }
56
57  $(document).ready(function(){
58    // if there is a '#' in the URL (someone linking directly to a page with an anchor)
59    if (document.location.hash) {
60      focusOnElement($(document.location.hash));
61    }
62
63    // if the hash has been changed (activation of an in-page link)
64    $(window).bind('hashchange', function() {
65      var hash = "#"+window.location.hash.replace(/^#/,'');
66      focusOnElement($(hash));
67    });
68  });
69
70})(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.