PDF rausgenommen
This commit is contained in:
@ -0,0 +1,78 @@
|
||||
/* 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( 'twentyfifteen-color-scheme' ),
|
||||
colorSchemeKeys = [
|
||||
'background_color',
|
||||
'header_background_color',
|
||||
'box_background_color',
|
||||
'textcolor',
|
||||
'sidebar_textcolor',
|
||||
'meta_box_background_color'
|
||||
],
|
||||
colorSettings = [
|
||||
'background_color',
|
||||
'header_background_color',
|
||||
'sidebar_textcolor'
|
||||
];
|
||||
|
||||
api.controlConstructor.select = api.Control.extend( {
|
||||
ready: function() {
|
||||
if ( 'color_scheme' === this.id ) {
|
||||
this.setting.bind( 'change', function( value ) {
|
||||
// Update Background Color.
|
||||
api( 'background_color' ).set( colorScheme[value].colors[0] );
|
||||
api.control( 'background_color' ).container.find( '.color-picker-hex' )
|
||||
.data( 'data-default-color', colorScheme[value].colors[0] )
|
||||
.wpColorPicker( 'defaultColor', colorScheme[value].colors[0] );
|
||||
|
||||
// Update Header/Sidebar Background Color.
|
||||
api( 'header_background_color' ).set( colorScheme[value].colors[1] );
|
||||
api.control( 'header_background_color' ).container.find( '.color-picker-hex' )
|
||||
.data( 'data-default-color', colorScheme[value].colors[1] )
|
||||
.wpColorPicker( 'defaultColor', colorScheme[value].colors[1] );
|
||||
|
||||
// Update Header/Sidebar Text Color.
|
||||
api( 'sidebar_textcolor' ).set( colorScheme[value].colors[4] );
|
||||
api.control( 'sidebar_textcolor' ).container.find( '.color-picker-hex' )
|
||||
.data( 'data-default-color', colorScheme[value].colors[4] )
|
||||
.wpColorPicker( 'defaultColor', colorScheme[value].colors[4] );
|
||||
} );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
// 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 colors.
|
||||
colors.secondary_textcolor = Color( colors.textcolor ).toCSS( 'rgba', 0.7 );
|
||||
colors.border_color = Color( colors.textcolor ).toCSS( 'rgba', 0.1 );
|
||||
colors.border_focus_color = Color( colors.textcolor ).toCSS( 'rgba', 0.3 );
|
||||
colors.secondary_sidebar_textcolor = Color( colors.sidebar_textcolor ).toCSS( 'rgba', 0.7 );
|
||||
colors.sidebar_border_color = Color( colors.sidebar_textcolor ).toCSS( 'rgba', 0.1 );
|
||||
colors.sidebar_border_focus_color = Color( colors.sidebar_textcolor ).toCSS( 'rgba', 0.3 );
|
||||
|
||||
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 );
|
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Live-update changed settings in real time in the Customizer preview.
|
||||
*/
|
||||
|
||||
( function( $ ) {
|
||||
var $style = $( '#twentyfifteen-color-scheme-css' ),
|
||||
api = wp.customize;
|
||||
|
||||
if ( ! $style.length ) {
|
||||
$style = $( 'head' ).append( '<style type="text/css" id="twentyfifteen-color-scheme-css" />' )
|
||||
.find( '#twentyfifteen-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 );
|
||||
} );
|
||||
} );
|
||||
|
||||
// Color Scheme CSS.
|
||||
api.bind( 'preview-ready', function() {
|
||||
api.preview.bind( 'update-color-scheme-css', function( css ) {
|
||||
$style.html( css );
|
||||
} );
|
||||
} );
|
||||
|
||||
} )( jQuery );
|
179
msd2/wordpress/wp-content/themes/twentyfifteen/js/functions.js
Normal file
179
msd2/wordpress/wp-content/themes/twentyfifteen/js/functions.js
Normal file
@ -0,0 +1,179 @@
|
||||
/* global screenReaderText */
|
||||
/**
|
||||
* Theme functions file.
|
||||
*
|
||||
* Contains handlers for navigation and widget area.
|
||||
*/
|
||||
|
||||
( function( $ ) {
|
||||
var $body, $window, $sidebar, adminbarOffset, top = false,
|
||||
bottom = false, windowWidth, windowHeight, lastWindowPos = 0,
|
||||
topOffset = 0, bodyHeight, sidebarHeight, resizeTimer,
|
||||
secondary, button;
|
||||
|
||||
function initMainNavigation( container ) {
|
||||
// Add dropdown toggle that display child menu items.
|
||||
container.find( '.menu-item-has-children > a' ).after( '<button class="dropdown-toggle" aria-expanded="false">' + screenReaderText.expand + '</button>' );
|
||||
|
||||
// Toggle buttons and submenu items with active children menu items.
|
||||
container.find( '.current-menu-ancestor > button' ).addClass( 'toggle-on' );
|
||||
container.find( '.current-menu-ancestor > .sub-menu' ).addClass( 'toggled-on' );
|
||||
|
||||
container.find( '.dropdown-toggle' ).click( function( e ) {
|
||||
var _this = $( this );
|
||||
e.preventDefault();
|
||||
_this.toggleClass( 'toggle-on' );
|
||||
_this.next( '.children, .sub-menu' ).toggleClass( 'toggled-on' );
|
||||
_this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' );
|
||||
_this.html( _this.html() === screenReaderText.expand ? screenReaderText.collapse : screenReaderText.expand );
|
||||
} );
|
||||
}
|
||||
initMainNavigation( $( '.main-navigation' ) );
|
||||
|
||||
// Re-initialize the main navigation when it is updated, persisting any existing submenu expanded states.
|
||||
$( document ).on( 'customize-preview-menu-refreshed', function( e, params ) {
|
||||
if ( 'primary' === params.wpNavMenuArgs.theme_location ) {
|
||||
initMainNavigation( params.newContainer );
|
||||
|
||||
// Re-sync expanded states from oldContainer.
|
||||
params.oldContainer.find( '.dropdown-toggle.toggle-on' ).each(function() {
|
||||
var containerId = $( this ).parent().prop( 'id' );
|
||||
$( params.newContainer ).find( '#' + containerId + ' > .dropdown-toggle' ).triggerHandler( 'click' );
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
secondary = $( '#secondary' );
|
||||
button = $( '.site-branding' ).find( '.secondary-toggle' );
|
||||
|
||||
// Enable menu toggle for small screens.
|
||||
( function() {
|
||||
var menu, widgets, social;
|
||||
if ( ! secondary.length || ! button.length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide button if there are no widgets and the menus are missing or empty.
|
||||
menu = secondary.find( '.nav-menu' );
|
||||
widgets = secondary.find( '#widget-area' );
|
||||
social = secondary.find( '#social-navigation' );
|
||||
if ( ! widgets.length && ! social.length && ( ! menu.length || ! menu.children().length ) ) {
|
||||
button.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
button.on( 'click.twentyfifteen', function() {
|
||||
secondary.toggleClass( 'toggled-on' );
|
||||
secondary.trigger( 'resize' );
|
||||
$( this ).toggleClass( 'toggled-on' );
|
||||
if ( $( this, secondary ).hasClass( 'toggled-on' ) ) {
|
||||
$( this ).attr( 'aria-expanded', 'true' );
|
||||
secondary.attr( 'aria-expanded', 'true' );
|
||||
} else {
|
||||
$( this ).attr( 'aria-expanded', 'false' );
|
||||
secondary.attr( 'aria-expanded', 'false' );
|
||||
}
|
||||
} );
|
||||
} )();
|
||||
|
||||
/**
|
||||
* Add or remove ARIA attributes.
|
||||
*
|
||||
* Uses jQuery's width() function to determine the size of the window and add
|
||||
* the default ARIA attributes for the menu toggle if it's visible.
|
||||
* @since Twenty Fifteen 1.1
|
||||
*/
|
||||
function onResizeARIA() {
|
||||
if ( 955 > $window.width() ) {
|
||||
button.attr( 'aria-expanded', 'false' );
|
||||
secondary.attr( 'aria-expanded', 'false' );
|
||||
button.attr( 'aria-controls', 'secondary' );
|
||||
} else {
|
||||
button.removeAttr( 'aria-expanded' );
|
||||
secondary.removeAttr( 'aria-expanded' );
|
||||
button.removeAttr( 'aria-controls' );
|
||||
}
|
||||
}
|
||||
|
||||
// Sidebar scrolling.
|
||||
function resize() {
|
||||
windowWidth = $window.width();
|
||||
|
||||
if ( 955 > windowWidth ) {
|
||||
top = bottom = false;
|
||||
$sidebar.removeAttr( 'style' );
|
||||
}
|
||||
}
|
||||
|
||||
function scroll() {
|
||||
var windowPos = $window.scrollTop();
|
||||
|
||||
if ( 955 > windowWidth ) {
|
||||
return;
|
||||
}
|
||||
|
||||
sidebarHeight = $sidebar.height();
|
||||
windowHeight = $window.height();
|
||||
bodyHeight = $body.height();
|
||||
|
||||
if ( sidebarHeight + adminbarOffset > windowHeight ) {
|
||||
if ( windowPos > lastWindowPos ) {
|
||||
if ( top ) {
|
||||
top = false;
|
||||
topOffset = ( $sidebar.offset().top > 0 ) ? $sidebar.offset().top - adminbarOffset : 0;
|
||||
$sidebar.attr( 'style', 'top: ' + topOffset + 'px;' );
|
||||
} else if ( ! bottom && windowPos + windowHeight > sidebarHeight + $sidebar.offset().top && sidebarHeight + adminbarOffset < bodyHeight ) {
|
||||
bottom = true;
|
||||
$sidebar.attr( 'style', 'position: fixed; bottom: 0;' );
|
||||
}
|
||||
} else if ( windowPos < lastWindowPos ) {
|
||||
if ( bottom ) {
|
||||
bottom = false;
|
||||
topOffset = ( $sidebar.offset().top > 0 ) ? $sidebar.offset().top - adminbarOffset : 0;
|
||||
$sidebar.attr( 'style', 'top: ' + topOffset + 'px;' );
|
||||
} else if ( ! top && windowPos + adminbarOffset < $sidebar.offset().top ) {
|
||||
top = true;
|
||||
$sidebar.attr( 'style', 'position: fixed;' );
|
||||
}
|
||||
} else {
|
||||
top = bottom = false;
|
||||
topOffset = ( $sidebar.offset().top > 0 ) ? $sidebar.offset().top - adminbarOffset : 0;
|
||||
$sidebar.attr( 'style', 'top: ' + topOffset + 'px;' );
|
||||
}
|
||||
} else if ( ! top ) {
|
||||
top = true;
|
||||
$sidebar.attr( 'style', 'position: fixed;' );
|
||||
}
|
||||
|
||||
lastWindowPos = windowPos;
|
||||
}
|
||||
|
||||
function resizeAndScroll() {
|
||||
resize();
|
||||
scroll();
|
||||
}
|
||||
|
||||
$( document ).ready( function() {
|
||||
$body = $( document.body );
|
||||
$window = $( window );
|
||||
$sidebar = $( '#sidebar' ).first();
|
||||
adminbarOffset = $body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0;
|
||||
|
||||
$window
|
||||
.on( 'scroll.twentyfifteen', scroll )
|
||||
.on( 'load.twentyfifteen', onResizeARIA )
|
||||
.on( 'resize.twentyfifteen', function() {
|
||||
clearTimeout( resizeTimer );
|
||||
resizeTimer = setTimeout( resizeAndScroll, 500 );
|
||||
onResizeARIA();
|
||||
} );
|
||||
$sidebar.on( 'click.twentyfifteen keydown.twentyfifteen', 'button', resizeAndScroll );
|
||||
|
||||
resizeAndScroll();
|
||||
|
||||
for ( var i = 1; i < 6; i++ ) {
|
||||
setTimeout( resizeAndScroll, 100 * i );
|
||||
}
|
||||
} );
|
||||
|
||||
} )( jQuery );
|
@ -0,0 +1,9 @@
|
||||
/*
|
||||
* HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
|
||||
(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
|
||||
a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}</style>";
|
||||
c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?: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,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
|
||||
"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);
|
||||
if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
|
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Twenty Fifteen keyboard support for image navigation.
|
||||
*/
|
||||
|
||||
( function( $ ) {
|
||||
$( document ).on( 'keydown.twentyfifteen', function( e ) {
|
||||
var url = false;
|
||||
|
||||
// Left arrow key code.
|
||||
if ( e.which === 37 ) {
|
||||
url = $( '.nav-previous a' ).attr( 'href' );
|
||||
|
||||
// Right arrow key code.
|
||||
} else if ( e.which === 39 ) {
|
||||
url = $( '.nav-next a' ).attr( 'href' );
|
||||
}
|
||||
|
||||
if ( url && ( ! $( 'textarea, input' ).is( ':focus' ) ) ) {
|
||||
window.location = url;
|
||||
}
|
||||
} );
|
||||
} )( jQuery );
|
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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 ua = navigator.userAgent.toLowerCase();
|
||||
|
||||
if ( ( ua.indexOf( 'webkit' ) > -1 || ua.indexOf( 'opera' ) > -1 || ua.indexOf( 'msie' ) > -1 ) &&
|
||||
document.getElementById && window.addEventListener ) {
|
||||
|
||||
window.addEventListener( 'hashchange', function() {
|
||||
var element = document.getElementById( location.hash.substring( 1 ) );
|
||||
|
||||
if ( element ) {
|
||||
if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.nodeName ) ) {
|
||||
element.tabIndex = -1;
|
||||
}
|
||||
|
||||
element.focus();
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
} )();
|
Reference in New Issue
Block a user