IP : 3.145.86.34Hostname : server86.web-hosting.comKernel : Linux server86.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64Disable Function : None :) OS : Linux
PATH:
/
home/
servlmvm/
puppiesoftexas.com/
wp-includes/
js/
./
wp-custom-header.js/
/
// Fail gracefully in unsupported browsers. if ( ! ( 'addEventListener' in window ) ) { return; }
/** * Trigger an event. * * @param {Element} target HTML element to dispatch the event on. * @param {string} name Event name. */ function trigger( target, name ) { var evt;
if ( 'function' === typeof window.Event ) { evt = new Event( name ); } else { evt = document.createEvent( 'Event' ); evt.initEvent( name, true, true ); }
target.dispatchEvent( evt ); }
/** * Create a custom header instance. * * @memberOf wp * * @class */ function CustomHeader() { this.handlers = { nativeVideo: new NativeHandler(), youtube: new YouTubeHandler() }; }
CustomHeader.prototype = { /** * Initialize the custom header. * * If the environment supports video, loops through registered handlers * until one is found that can handle the video. */ initialize: function() { if ( this.supportsVideo() ) { for ( var id in this.handlers ) { var handler = this.handlers[ id ];
if ( 'test' in handler && handler.test( settings ) ) { this.activeHandler = handler.initialize.call( handler, settings );
// Dispatch custom event when the video is loaded. trigger( document, 'wp-custom-header-video-loaded' ); break; } } } },
/** * Determines if the current environment supports video. * * Themes and plugins can override this method to change the criteria. * * @return {boolean} */ supportsVideo: function() { // Don't load video on small screens. @todo Consider bandwidth and other factors. if ( window.innerWidth < settings.minWidth || window.innerHeight < settings.minHeight ) { return false; }
return true; },
/** * Base handler for custom handlers to extend. * * @type {BaseHandler} */ BaseVideoHandler: BaseHandler };
/** * Create a video handler instance. * * @memberOf wp * * @class */ function BaseHandler() {}
BaseHandler.prototype = { /** * Initialize the video handler. * * @param {Object} settings Video settings. */ initialize: function( settings ) { var handler = this, button = document.createElement( 'button' );
// Toggle video playback when the button is clicked. button.addEventListener( 'click', function() { if ( handler.isPaused() ) { handler.play(); } else { handler.pause(); } });
// Update the button class and text when the video state changes. this.container.addEventListener( 'play', function() { button.className = 'wp-custom-header-video-button wp-custom-header-video-play'; button.innerHTML = settings.l10n.pause; if ( 'a11y' in window.wp ) { window.wp.a11y.speak( settings.l10n.playSpeak); } });
/** * Play the video. * * @abstract */ play: function() {},
/** * Append a video node to the header container. * * @param {Element} node HTML element. */ setVideo: function( node ) { var editShortcutNode, editShortcut = this.container.getElementsByClassName( 'customize-partial-edit-shortcut' );
if ( editShortcutNode ) { this.container.appendChild( editShortcutNode ); } },
/** * Show the video controls. * * Appends a play/pause button to header container. */ showControls: function() { if ( ! this.container.contains( this.button ) ) { this.container.appendChild( this.button ); } },
/** * Whether the handler can process a video. * * @abstract * @param {Object} settings Video settings. * @return {boolean} */ test: function() { return false; },
/** * Trigger an event on the header container. * * @param {string} name Event name. */ trigger: function( name ) { trigger( this.container, name ); } };
/** * Create a custom handler. * * @memberOf wp * * @param {Object} protoProps Properties to apply to the prototype. * @return CustomHandler The subclass. */ BaseHandler.extend = function( protoProps ) { var prop;
function CustomHandler() { var result = BaseHandler.apply( this, arguments ); return result; }
/** * Play the video. */ play: function() { this.player.playVideo(); } });
// Initialize the custom header when the DOM is ready. window.wp.customHeader = new CustomHeader(); document.addEventListener( 'DOMContentLoaded', window.wp.customHeader.initialize.bind( window.wp.customHeader ), false );
// Selective refresh support in the Customizer. if ( 'customize' in window.wp ) { window.wp.customize.selectiveRefresh.bind( 'render-partials-response', function( response ) { if ( 'custom_header_settings' in response ) { settings = response.custom_header_settings; } });