diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-07-27 10:05:23 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-07-27 10:05:23 +0200 |
| commit | 5bf66662a9bdd62c5bccab15e607cd95cfb8fcab (patch) | |
| tree | 39a1a4629749056191c05dfd899f931701b7acf3 /srcs/wordpress/wp-content/themes/twentysixteen/js | |
| parent | 5afd237bbd22028b85532b8c0b3fcead49a00764 (diff) | |
| download | ft_server-master.tar.gz ft_server-master.tar.bz2 ft_server-master.zip | |
Removed wordpress and phpmyadmin, my server doesn't handle it well and it brings shame on my famillyHEADmaster
Diffstat (limited to 'srcs/wordpress/wp-content/themes/twentysixteen/js')
6 files changed, 0 insertions, 738 deletions
diff --git a/srcs/wordpress/wp-content/themes/twentysixteen/js/color-scheme-control.js b/srcs/wordpress/wp-content/themes/twentysixteen/js/color-scheme-control.js deleted file mode 100644 index e65b5bd..0000000 --- a/srcs/wordpress/wp-content/themes/twentysixteen/js/color-scheme-control.js +++ /dev/null @@ -1,96 +0,0 @@ -/* global colorScheme, Color */ -/** - * Add a listener to the Color Scheme control to update other color controls to new values/defaults. - * Also trigger an update of the Color Scheme CSS when a color is changed. - */ - -( function( api ) { - var cssTemplate = wp.template( 'twentysixteen-color-scheme' ), - colorSchemeKeys = [ - 'background_color', - 'page_background_color', - 'link_color', - 'main_text_color', - 'secondary_text_color' - ], - colorSettings = [ - 'background_color', - 'page_background_color', - 'link_color', - 'main_text_color', - 'secondary_text_color' - ]; - - api.controlConstructor.select = api.Control.extend( { - ready: function() { - if ( 'color_scheme' === this.id ) { - this.setting.bind( 'change', function( value ) { - var colors = colorScheme[value].colors; - - // Update Background Color. - var color = colors[0]; - api( 'background_color' ).set( color ); - api.control( 'background_color' ).container.find( '.color-picker-hex' ) - .data( 'data-default-color', color ) - .wpColorPicker( 'defaultColor', color ); - - // Update Page Background Color. - color = colors[1]; - api( 'page_background_color' ).set( color ); - api.control( 'page_background_color' ).container.find( '.color-picker-hex' ) - .data( 'data-default-color', color ) - .wpColorPicker( 'defaultColor', color ); - - // Update Link Color. - color = colors[2]; - api( 'link_color' ).set( color ); - api.control( 'link_color' ).container.find( '.color-picker-hex' ) - .data( 'data-default-color', color ) - .wpColorPicker( 'defaultColor', color ); - - // Update Main Text Color. - color = colors[3]; - api( 'main_text_color' ).set( color ); - api.control( 'main_text_color' ).container.find( '.color-picker-hex' ) - .data( 'data-default-color', color ) - .wpColorPicker( 'defaultColor', color ); - - // Update Secondary Text Color. - color = colors[4]; - api( 'secondary_text_color' ).set( color ); - api.control( 'secondary_text_color' ).container.find( '.color-picker-hex' ) - .data( 'data-default-color', color ) - .wpColorPicker( 'defaultColor', color ); - } ); - } - } - } ); - - // Generate the CSS for the current Color Scheme. - function updateCSS() { - var scheme = api( 'color_scheme' )(), - css, - colors = _.object( colorSchemeKeys, colorScheme[ scheme ].colors ); - - // Merge in color scheme overrides. - _.each( colorSettings, function( setting ) { - colors[ setting ] = api( setting )(); - } ); - - // Add additional color. - // jscs:disable - colors.border_color = Color( colors.main_text_color ).toCSS( 'rgba', 0.2 ); - // jscs:enable - - css = cssTemplate( colors ); - - api.previewer.send( 'update-color-scheme-css', css ); - } - - // Update the CSS whenever a color setting is changed. - _.each( colorSettings, function( setting ) { - api( setting, function( setting ) { - setting.bind( updateCSS ); - } ); - } ); -} )( wp.customize ); diff --git a/srcs/wordpress/wp-content/themes/twentysixteen/js/customize-preview.js b/srcs/wordpress/wp-content/themes/twentysixteen/js/customize-preview.js deleted file mode 100644 index fc99333..0000000 --- a/srcs/wordpress/wp-content/themes/twentysixteen/js/customize-preview.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Live-update changed settings in real time in the Customizer preview. - */ - -( function( $ ) { - var style = $( '#twentysixteen-color-scheme-css' ), - api = wp.customize; - - if ( ! style.length ) { - style = $( 'head' ).append( '<style type="text/css" id="twentysixteen-color-scheme-css" />' ) - .find( '#twentysixteen-color-scheme-css' ); - } - - // Site title. - api( 'blogname', function( value ) { - value.bind( function( to ) { - $( '.site-title a' ).text( to ); - } ); - } ); - - // Site tagline. - api( 'blogdescription', function( value ) { - value.bind( function( to ) { - $( '.site-description' ).text( to ); - } ); - } ); - - // Add custom-background-image body class when background image is added. - api( 'background_image', function( value ) { - value.bind( function( to ) { - $( 'body' ).toggleClass( 'custom-background-image', '' !== to ); - } ); - } ); - - // Color Scheme CSS. - api.bind( 'preview-ready', function() { - api.preview.bind( 'update-color-scheme-css', function( css ) { - style.html( css ); - } ); - } ); -} )( jQuery ); diff --git a/srcs/wordpress/wp-content/themes/twentysixteen/js/functions.js b/srcs/wordpress/wp-content/themes/twentysixteen/js/functions.js deleted file mode 100644 index a15af11..0000000 --- a/srcs/wordpress/wp-content/themes/twentysixteen/js/functions.js +++ /dev/null @@ -1,213 +0,0 @@ -/* global screenReaderText */ -/** - * Theme functions file. - * - * Contains handlers for navigation and widget area. - */ - -( function( $ ) { - var body, masthead, menuToggle, siteNavigation, socialNavigation, siteHeaderMenu, resizeTimer; - - function initMainNavigation( container ) { - - // Add dropdown toggle that displays child menu items. - var dropdownToggle = $( '<button />', { - 'class': 'dropdown-toggle', - 'aria-expanded': false - } ).append( $( '<span />', { - 'class': 'screen-reader-text', - text: screenReaderText.expand - } ) ); - - container.find( '.menu-item-has-children > a' ).after( dropdownToggle ); - - // Toggle buttons and submenu items with active children menu items. - container.find( '.current-menu-ancestor > button' ).addClass( 'toggled-on' ); - container.find( '.current-menu-ancestor > .sub-menu' ).addClass( 'toggled-on' ); - - // Add menu items with submenus to aria-haspopup="true". - container.find( '.menu-item-has-children' ).attr( 'aria-haspopup', 'true' ); - - container.find( '.dropdown-toggle' ).click( function( e ) { - var _this = $( this ), - screenReaderSpan = _this.find( '.screen-reader-text' ); - - e.preventDefault(); - _this.toggleClass( 'toggled-on' ); - _this.next( '.children, .sub-menu' ).toggleClass( 'toggled-on' ); - - // jscs:disable - _this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); - // jscs:enable - screenReaderSpan.text( screenReaderSpan.text() === screenReaderText.expand ? screenReaderText.collapse : screenReaderText.expand ); - } ); - } - initMainNavigation( $( '.main-navigation' ) ); - - masthead = $( '#masthead' ); - menuToggle = masthead.find( '#menu-toggle' ); - siteHeaderMenu = masthead.find( '#site-header-menu' ); - siteNavigation = masthead.find( '#site-navigation' ); - socialNavigation = masthead.find( '#social-navigation' ); - - // Enable menuToggle. - ( function() { - - // Return early if menuToggle is missing. - if ( ! menuToggle.length ) { - return; - } - - // Add an initial values for the attribute. - menuToggle.add( siteNavigation ).add( socialNavigation ).attr( 'aria-expanded', 'false' ); - - menuToggle.on( 'click.twentysixteen', function() { - $( this ).add( siteHeaderMenu ).toggleClass( 'toggled-on' ); - - // jscs:disable - $( this ).add( siteNavigation ).add( socialNavigation ).attr( 'aria-expanded', $( this ).add( siteNavigation ).add( socialNavigation ).attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); - // jscs:enable - } ); - } )(); - - // Fix sub-menus for touch devices and better focus for hidden submenu items for accessibility. - ( function() { - if ( ! siteNavigation.length || ! siteNavigation.children().length ) { - return; - } - - // Toggle `focus` class to allow submenu access on tablets. - function toggleFocusClassTouchScreen() { - if ( window.innerWidth >= 910 ) { - $( document.body ).on( 'touchstart.twentysixteen', function( e ) { - if ( ! $( e.target ).closest( '.main-navigation li' ).length ) { - $( '.main-navigation li' ).removeClass( 'focus' ); - } - } ); - siteNavigation.find( '.menu-item-has-children > a' ).on( 'touchstart.twentysixteen', function( e ) { - var el = $( this ).parent( 'li' ); - - if ( ! el.hasClass( 'focus' ) ) { - e.preventDefault(); - el.toggleClass( 'focus' ); - el.siblings( '.focus' ).removeClass( 'focus' ); - } - } ); - } else { - siteNavigation.find( '.menu-item-has-children > a' ).unbind( 'touchstart.twentysixteen' ); - } - } - - if ( 'ontouchstart' in window ) { - $( window ).on( 'resize.twentysixteen', toggleFocusClassTouchScreen ); - toggleFocusClassTouchScreen(); - } - - siteNavigation.find( 'a' ).on( 'focus.twentysixteen blur.twentysixteen', function() { - $( this ).parents( '.menu-item' ).toggleClass( 'focus' ); - } ); - } )(); - - // Add the default ARIA attributes for the menu toggle and the navigations. - function onResizeARIA() { - if ( window.innerWidth < 910 ) { - if ( menuToggle.hasClass( 'toggled-on' ) ) { - menuToggle.attr( 'aria-expanded', 'true' ); - } else { - menuToggle.attr( 'aria-expanded', 'false' ); - } - - if ( siteHeaderMenu.hasClass( 'toggled-on' ) ) { - siteNavigation.attr( 'aria-expanded', 'true' ); - socialNavigation.attr( 'aria-expanded', 'true' ); - } else { - siteNavigation.attr( 'aria-expanded', 'false' ); - socialNavigation.attr( 'aria-expanded', 'false' ); - } - - menuToggle.attr( 'aria-controls', 'site-navigation social-navigation' ); - } else { - menuToggle.removeAttr( 'aria-expanded' ); - siteNavigation.removeAttr( 'aria-expanded' ); - socialNavigation.removeAttr( 'aria-expanded' ); - menuToggle.removeAttr( 'aria-controls' ); - } - } - - // Add 'below-entry-meta' class to elements. - function belowEntryMetaClass( param ) { - if ( body.hasClass( 'page' ) || body.hasClass( 'search' ) || body.hasClass( 'single-attachment' ) || body.hasClass( 'error404' ) ) { - return; - } - - $( '.entry-content' ).find( param ).each( function() { - var element = $( this ), - elementPos = element.offset(), - elementPosTop = elementPos.top, - entryFooter = element.closest( 'article' ).find( '.entry-footer' ), - entryFooterPos = entryFooter.offset(), - entryFooterPosBottom = entryFooterPos.top + ( entryFooter.height() + 28 ), - caption = element.closest( 'figure' ), - figcaption = element.next( 'figcaption' ), - newImg; - - // Add 'below-entry-meta' to elements below the entry meta. - if ( elementPosTop > entryFooterPosBottom ) { - - // Check if full-size images and captions are larger than or equal to 840px. - if ( 'img.size-full' === param || '.wp-block-image img' === param ) { - - // Create an image to find native image width of resized images (i.e. max-width: 100%). - newImg = new Image(); - newImg.src = element.attr( 'src' ); - - $( newImg ).on( 'load.twentysixteen', function() { - if ( newImg.width >= 840 ) { - - // Check if an image in an image block has a width attribute; if its value is less than 840, return. - if ( '.wp-block-image img' === param && element.is( '[width]' ) && element.attr( 'width' ) < 840 ) { - return; - } - - element.addClass( 'below-entry-meta' ); - - if ( caption.hasClass( 'wp-caption' ) ) { - caption.addClass( 'below-entry-meta' ); - caption.removeAttr( 'style' ); - } - - if ( figcaption ) { - figcaption.addClass( 'below-entry-meta' ); - } - } - } ); - } else { - element.addClass( 'below-entry-meta' ); - } - } else { - element.removeClass( 'below-entry-meta' ); - caption.removeClass( 'below-entry-meta' ); - } - } ); - } - - $( document ).ready( function() { - body = $( document.body ); - - $( window ) - .on( 'load.twentysixteen', onResizeARIA ) - .on( 'resize.twentysixteen', function() { - clearTimeout( resizeTimer ); - resizeTimer = setTimeout( function() { - belowEntryMetaClass( 'img.size-full' ); - belowEntryMetaClass( 'blockquote.alignleft, blockquote.alignright' ); - belowEntryMetaClass( '.wp-block-image img' ); - }, 300 ); - onResizeARIA(); - } ); - - belowEntryMetaClass( 'img.size-full' ); - belowEntryMetaClass( 'blockquote.alignleft, blockquote.alignright' ); - belowEntryMetaClass( '.wp-block-image img' ); - } ); -} )( jQuery ); diff --git a/srcs/wordpress/wp-content/themes/twentysixteen/js/html5.js b/srcs/wordpress/wp-content/themes/twentysixteen/js/html5.js deleted file mode 100644 index 9c1f049..0000000 --- a/srcs/wordpress/wp-content/themes/twentysixteen/js/html5.js +++ /dev/null @@ -1,326 +0,0 @@ -/** -* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed -*/ -;(function(window, document) { -/*jshint evil:true */ - /** version */ - var version = '3.7.3'; - - /** Preset options */ - var options = window.html5 || {}; - - /** Used to skip problem elements */ - var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; - - /** Not all elements can be cloned in IE **/ - var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; - - /** Detect whether the browser supports default html5 styles */ - var supportsHtml5Styles; - - /** Name of the expando, to work with multiple documents or to re-shiv one document */ - var expando = '_html5shiv'; - - /** The id for the the documents expando */ - var expanID = 0; - - /** Cached data for each document */ - var expandoData = {}; - - /** Detect whether the browser supports unknown elements */ - var supportsUnknownElements; - - (function() { - try { - var a = document.createElement('a'); - a.innerHTML = '<xyz></xyz>'; - //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles - supportsHtml5Styles = ('hidden' in a); - - supportsUnknownElements = a.childNodes.length == 1 || (function() { - // assign a false positive if unable to shiv - (document.createElement)('a'); - var frag = document.createDocumentFragment(); - return ( - typeof frag.cloneNode == 'undefined' || - typeof frag.createDocumentFragment == 'undefined' || - typeof frag.createElement == 'undefined' - ); - }()); - } catch(e) { - // assign a false positive if detection fails => unable to shiv - supportsHtml5Styles = true; - supportsUnknownElements = true; - } - - }()); - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a style sheet with the given CSS text and adds it to the document. - * @private - * @param {Document} ownerDocument The document. - * @param {String} cssText The CSS text. - * @returns {StyleSheet} The style element. - */ - function addStyleSheet(ownerDocument, cssText) { - var p = ownerDocument.createElement('p'), - parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; - - p.innerHTML = 'x<style>' + cssText + '</style>'; - return parent.insertBefore(p.lastChild, parent.firstChild); - } - - /** - * Returns the value of `html5.elements` as an array. - * @private - * @returns {Array} An array of shived element node names. - */ - function getElements() { - var elements = html5.elements; - return typeof elements == 'string' ? elements.split(' ') : elements; - } - - /** - * Extends the built-in list of html5 elements - * @memberOf html5 - * @param {String|Array} newElements whitespace separated list or array of new element names to shiv - * @param {Document} ownerDocument The context document. - */ - function addElements(newElements, ownerDocument) { - var elements = html5.elements; - if(typeof elements != 'string'){ - elements = elements.join(' '); - } - if(typeof newElements != 'string'){ - newElements = newElements.join(' '); - } - html5.elements = elements +' '+ newElements; - shivDocument(ownerDocument); - } - - /** - * Returns the data associated to the given document - * @private - * @param {Document} ownerDocument The document. - * @returns {Object} An object of data. - */ - function getExpandoData(ownerDocument) { - var data = expandoData[ownerDocument[expando]]; - if (!data) { - data = {}; - expanID++; - ownerDocument[expando] = expanID; - expandoData[expanID] = data; - } - return data; - } - - /** - * returns a shived element for the given nodeName and document - * @memberOf html5 - * @param {String} nodeName name of the element - * @param {Document|DocumentFragment} ownerDocument The context document. - * @returns {Object} The shived element. - */ - function createElement(nodeName, ownerDocument, data){ - if (!ownerDocument) { - ownerDocument = document; - } - if(supportsUnknownElements){ - return ownerDocument.createElement(nodeName); - } - if (!data) { - data = getExpandoData(ownerDocument); - } - var node; - - if (data.cache[nodeName]) { - node = data.cache[nodeName].cloneNode(); - } else if (saveClones.test(nodeName)) { - node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); - } else { - node = data.createElem(nodeName); - } - - // Avoid adding some elements to fragments in IE < 9 because - // * Attributes like `name` or `type` cannot be set/changed once an element - // is inserted into a document/fragment - // * Link elements with `src` attributes that are inaccessible, as with - // a 403 response, will cause the tab/window to crash - // * Script elements appended to fragments will execute when their `src` - // or `text` property is set - return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; - } - - /** - * returns a shived DocumentFragment for the given document - * @memberOf html5 - * @param {Document} ownerDocument The context document. - * @returns {Object} The shived DocumentFragment. - */ - function createDocumentFragment(ownerDocument, data){ - if (!ownerDocument) { - ownerDocument = document; - } - if(supportsUnknownElements){ - return ownerDocument.createDocumentFragment(); - } - data = data || getExpandoData(ownerDocument); - var clone = data.frag.cloneNode(), - i = 0, - elems = getElements(), - l = elems.length; - for(;i<l;i++){ - clone.createElement(elems[i]); - } - return clone; - } - - /** - * Shivs the `createElement` and `createDocumentFragment` methods of the document. - * @private - * @param {Document|DocumentFragment} ownerDocument The document. - * @param {Object} data of the document. - */ - function shivMethods(ownerDocument, data) { - if (!data.cache) { - data.cache = {}; - data.createElem = ownerDocument.createElement; - data.createFrag = ownerDocument.createDocumentFragment; - data.frag = data.createFrag(); - } - - - ownerDocument.createElement = function(nodeName) { - //abort shiv - if (!html5.shivMethods) { - return data.createElem(nodeName); - } - return createElement(nodeName, ownerDocument, data); - }; - - ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + - 'var n=f.cloneNode(),c=n.createElement;' + - 'h.shivMethods&&(' + - // unroll the `createElement` calls - getElements().join().replace(/[\w\-:]+/g, function(nodeName) { - data.createElem(nodeName); - data.frag.createElement(nodeName); - return 'c("' + nodeName + '")'; - }) + - ');return n}' - )(html5, data.frag); - } - - /*--------------------------------------------------------------------------*/ - - /** - * Shivs the given document. - * @memberOf html5 - * @param {Document} ownerDocument The document to shiv. - * @returns {Document} The shived document. - */ - function shivDocument(ownerDocument) { - if (!ownerDocument) { - ownerDocument = document; - } - var data = getExpandoData(ownerDocument); - - if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { - data.hasCSS = !!addStyleSheet(ownerDocument, - // corrects block display not defined in IE6/7/8/9 - 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' + - // adds styling not present in IE6/7/8/9 - 'mark{background:#FF0;color:#000}' + - // hides non-rendered elements - 'template{display:none}' - ); - } - if (!supportsUnknownElements) { - shivMethods(ownerDocument, data); - } - return ownerDocument; - } - - /*--------------------------------------------------------------------------*/ - - /** - * The `html5` object is exposed so that more elements can be shived and - * existing shiving can be detected on iframes. - * @type Object - * @example - * - * // options can be changed before the script is included - * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false }; - */ - var html5 = { - - /** - * An array or space separated string of node names of the elements to shiv. - * @memberOf html5 - * @type Array|String - */ - 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video', - - /** - * current version of html5shiv - */ - 'version': version, - - /** - * A flag to indicate that the HTML5 style sheet should be inserted. - * @memberOf html5 - * @type Boolean - */ - 'shivCSS': (options.shivCSS !== false), - - /** - * Is equal to true if a browser supports creating unknown/HTML5 elements - * @memberOf html5 - * @type boolean - */ - 'supportsUnknownElements': supportsUnknownElements, - - /** - * A flag to indicate that the document's `createElement` and `createDocumentFragment` - * methods should be overwritten. - * @memberOf html5 - * @type Boolean - */ - 'shivMethods': (options.shivMethods !== false), - - /** - * A string to describe the type of `html5` object ("default" or "default print"). - * @memberOf html5 - * @type String - */ - 'type': 'default', - - // shivs the document according to the specified `html5` object options - 'shivDocument': shivDocument, - - //creates a shived element - createElement: createElement, - - //creates a shived documentFragment - createDocumentFragment: createDocumentFragment, - - //extends list of elements - addElements: addElements - }; - - /*--------------------------------------------------------------------------*/ - - // expose html5 - window.html5 = html5; - - // shiv the document - shivDocument(document); - - if(typeof module == 'object' && module.exports){ - module.exports = html5; - } - -}(typeof window !== "undefined" ? window : this, document));
\ No newline at end of file diff --git a/srcs/wordpress/wp-content/themes/twentysixteen/js/keyboard-image-navigation.js b/srcs/wordpress/wp-content/themes/twentysixteen/js/keyboard-image-navigation.js deleted file mode 100644 index b10927c..0000000 --- a/srcs/wordpress/wp-content/themes/twentysixteen/js/keyboard-image-navigation.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Twenty Sixteen keyboard support for image navigation. - */ - -( function( $ ) { - $( document ).on( 'keydown.twentysixteen', function( e ) { - var url = false; - - // Left arrow key code. - if ( 37 === e.which ) { - url = $( '.nav-previous a' ).attr( 'href' ); - - // Right arrow key code. - } else if ( 39 === e.which ) { - url = $( '.nav-next a' ).attr( 'href' ); - - // Other key code. - } else { - return; - } - - if ( url && ! $( 'textarea, input' ).is( ':focus' ) ) { - window.location = url; - } - } ); -} )( jQuery ); diff --git a/srcs/wordpress/wp-content/themes/twentysixteen/js/skip-link-focus-fix.js b/srcs/wordpress/wp-content/themes/twentysixteen/js/skip-link-focus-fix.js deleted file mode 100644 index ae8a5da..0000000 --- a/srcs/wordpress/wp-content/themes/twentysixteen/js/skip-link-focus-fix.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Makes "skip to content" link work correctly in IE9, Chrome, and Opera - * for better accessibility. - * - * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/ - */ - - ( function() { - var isWebkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1, - isOpera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1, - isIE = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1; - - if ( ( isWebkit || isOpera || isIE ) && document.getElementById && window.addEventListener ) { - window.addEventListener( 'hashchange', function() { - var id = location.hash.substring( 1 ), - element; - - if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { - return; - } - - element = document.getElementById( id ); - - if ( element ) { - if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { - element.tabIndex = -1; - } - - element.focus(); - - // Repositions the window on jump-to-anchor to account for admin bar and border height. - window.scrollBy( 0, -53 ); - } - }, false ); - } -} )(); |
