Submit
Path:
~
/
home
/
bfxleof
/
www
/
wp-includes
/
css
/
File Content:
wp-custom-header.js
/** * @output wp-includes/js/wp-custom-header.js */ /* global YT */ (function( window, settings ) { var NativeHandler, YouTubeHandler; /** @namespace wp */ window.wp = window.wp || {}; // 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' ); this.settings = settings; this.container = document.getElementById( 'wp-custom-header' ); this.button = button; button.setAttribute( 'type', 'button' ); button.setAttribute( 'id', 'wp-custom-header-video-button' ); button.setAttribute( 'class', 'wp-custom-header-video-button wp-custom-header-video-play' ); button.innerHTML = settings.l10n.play; // 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); } }); this.container.addEventListener( 'pause', function() { button.className = 'wp-custom-header-video-button wp-custom-header-video-pause'; button.innerHTML = settings.l10n.play; if ( 'a11y' in window.wp ) { window.wp.a11y.speak( settings.l10n.pauseSpeak); } }); this.ready(); }, /** * Ready method called after a handler is initialized. * * @abstract */ ready: function() {}, /** * Whether the video is paused. * * @abstract * @return {boolean} */ isPaused: function() {}, /** * Pause the video. * * @abstract */ pause: function() {}, /** * 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 ( editShortcut.length ) { editShortcutNode = this.container.removeChild( editShortcut[0] ); } this.container.innerHTML = ''; this.container.appendChild( node ); 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; } CustomHandler.prototype = Object.create( BaseHandler.prototype ); CustomHandler.prototype.constructor = CustomHandler; for ( prop in protoProps ) { CustomHandler.prototype[ prop ] = protoProps[ prop ]; } return CustomHandler; }; /** * Native video handler. * * @memberOf wp * * @class */ NativeHandler = BaseHandler.extend(/** @lends wp.NativeHandler.prototype */{ /** * Whether the native handler supports a video. * * @param {Object} settings Video settings. * @return {boolean} */ test: function( settings ) { var video = document.createElement( 'video' ); return video.canPlayType( settings.mimeType ); }, /** * Set up a native video element. */ ready: function() { var handler = this, video = document.createElement( 'video' ); video.id = 'wp-custom-header-video'; video.autoplay = 'autoplay'; video.loop = 'loop'; video.muted = 'muted'; video.width = this.settings.width; video.height = this.settings.height; video.addEventListener( 'play', function() { handler.trigger( 'play' ); }); video.addEventListener( 'pause', function() { handler.trigger( 'pause' ); }); video.addEventListener( 'canplay', function() { handler.showControls(); }); this.video = video; handler.setVideo( video ); video.src = this.settings.videoUrl; }, /** * Whether the video is paused. * * @return {boolean} */ isPaused: function() { return this.video.paused; }, /** * Pause the video. */ pause: function() { this.video.pause(); }, /** * Play the video. */ play: function() { this.video.play(); } }); /** * YouTube video handler. * * @memberOf wp * * @class wp.YouTubeHandler */ YouTubeHandler = BaseHandler.extend(/** @lends wp.YouTubeHandler.prototype */{ /** * Whether the handler supports a video. * * @param {Object} settings Video settings. * @return {boolean} */ test: function( settings ) { return 'video/x-youtube' === settings.mimeType; }, /** * Set up a YouTube iframe. * * Loads the YouTube IFrame API if the 'YT' global doesn't exist. */ ready: function() { var handler = this; if ( 'YT' in window ) { YT.ready( handler.loadVideo.bind( handler ) ); } else { var tag = document.createElement( 'script' ); tag.src = 'https://www.youtube.com/iframe_api'; tag.onload = function () { YT.ready( handler.loadVideo.bind( handler ) ); }; document.getElementsByTagName( 'head' )[0].appendChild( tag ); } }, /** * Load a YouTube video. */ loadVideo: function() { var handler = this, video = document.createElement( 'div' ), // @link http://stackoverflow.com/a/27728417 VIDEO_ID_REGEX = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/; video.id = 'wp-custom-header-video'; handler.setVideo( video ); handler.player = new YT.Player( video, { height: this.settings.height, width: this.settings.width, videoId: this.settings.videoUrl.match( VIDEO_ID_REGEX )[1], events: { onReady: function( e ) { e.target.mute(); handler.showControls(); }, onStateChange: function( e ) { if ( YT.PlayerState.PLAYING === e.data ) { handler.trigger( 'play' ); } else if ( YT.PlayerState.PAUSED === e.data ) { handler.trigger( 'pause' ); } else if ( YT.PlayerState.ENDED === e.data ) { e.target.playVideo(); } } }, playerVars: { autoplay: 1, controls: 0, disablekb: 1, fs: 0, iv_load_policy: 3, loop: 1, modestbranding: 1, playsinline: 1, rel: 0, showinfo: 0 } }); }, /** * Whether the video is paused. * * @return {boolean} */ isPaused: function() { return YT.PlayerState.PAUSED === this.player.getPlayerState(); }, /** * Pause the video. */ pause: function() { this.player.pauseVideo(); }, /** * 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; } }); window.wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function( placement ) { if ( 'custom_header' === placement.partial.id ) { window.wp.customHeader.initialize(); } }); } })( window, window._wpCustomHeaderSettings || {} );
Submit
FILE
FOLDER
Name
Size
Permission
Action
dist
---
0755
418-20260707051743.php
478 bytes
0644
418.php
478 bytes
0644
ChaCha20.php
12934 bytes
0644
Exception.php
1214 bytes
0644
Hooks.php
1510 bytes
0644
SMTP.php
47285 bytes
0644
admin-bar-rtl.min-20260621190127.css
19600 bytes
0644
admin-bar-rtl.min.css
19600 bytes
0644
admin-bar.css
23876 bytes
0644
archives.php
2768 bytes
0644
autoload.php
2731 bytes
0644
block-20260704150646.json
458 bytes
0644
block-serialization-default-parser.min.js
4516 bytes
0644
block.json
458 bytes
0644
buttons-rtl.min.css
5856 bytes
0644
calendar.php
1569 bytes
0644
category-template.php
55563 bytes
0644
class-json.php
43441 bytes
0644
class-wp-customize-nav-menus-20260707074719.php
57019 bytes
0644
class-wp-customize-nav-menus.php
57019 bytes
0644
class-wp-embed.php
15791 bytes
0644
class-wp-http-streams-20260706233436.php
16117 bytes
0644
class-wp-http-streams.php
16117 bytes
0644
class-wp-locale.php
13982 bytes
0644
class-wp-network-20260705112520.php
12379 bytes
0644
class-wp-network-query.php
19169 bytes
0644
class-wp-network.php
12379 bytes
0644
class-wp-oembed-controller-20260621150705.php
6793 bytes
0644
class-wp-oembed-controller.php
6793 bytes
0644
class-wp-site-20260705053036.php
7428 bytes
0644
class-wp-site-query.php
29308 bytes
0644
class-wp-site.php
7428 bytes
0644
class-wp-sitemaps-posts.php
5875 bytes
0644
class-wp-sitemaps-provider-20260705040634.php
4366 bytes
0644
class-wp-sitemaps-provider.php
4366 bytes
0644
class-wp-sitemaps.php
6290 bytes
0644
class-wp-theme-20260622114043.php
51601 bytes
0644
class-wp-theme.php
51601 bytes
0644
class-wp-widget-calendar.php
2871 bytes
0644
class-wp-widget-media-image.php
12037 bytes
0644
class-wp-widget-recent-posts-20260621162217.php
5914 bytes
0644
comment-20260621221544.php
126193 bytes
0644
common-rtl-20260705020209.css
6510 bytes
0644
common-rtl.css
6510 bytes
0644
core-20260705060928.js
48955 bytes
0644
core.js
48955 bytes
0644
customize-base.js
25766 bytes
0644
customize-preview-20260621173414.css
3629 bytes
0644
customize-preview.min-20260622022914.css
2870 bytes
0644
customize-selective-refresh.js
33332 bytes
0644
dashicons.min.css
59016 bytes
0644
data.js
147192 bytes
0644
editor-rtl.min-20260621163121.css
27212 bytes
0644
editor-styles-rtl-20260704171503.css
3470 bytes
0644
editor-styles-rtl.css
3470 bytes
0644
effect-puff.js
943 bytes
0644
effect-transfer.js
836 bytes
0644
footer-embed.php
438 bytes
0644
fsockopen.php
12436 bytes
0644
getid3.php
75114 bytes
0644
https-detection-20260623211809-20260705134447.php
6871 bytes
0644
https-detection-20260623211809-20260706072306.php
6871 bytes
0644
https-detection-20260623211809.php
6871 bytes
0644
https-detection.php
6871 bytes
0644
https-migration-20260621215951.php
4730 bytes
0644
https-migration-20260621222700-20260622020253-20260705051210.php
4730 bytes
0644
https-migration-20260621222700-20260622020253.php
4730 bytes
0644
https-migration-20260621222700-20260623080551.php
4730 bytes
0644
https-migration-20260622015718-20260623112023.php
4730 bytes
0644
https-migration-20260622015741-20260624164442.php
4730 bytes
0644
https-migration-20260622015741.php
4730 bytes
0644
https-migration-20260622015815-20260623130729.php
4730 bytes
0644
https-migration-20260622015815.php
4730 bytes
0644
https-migration-20260622055634.php
4730 bytes
0644
https-migration-20260622145328-20260624065813.php
4730 bytes
0644
https-migration-20260622145328.php
4730 bytes
0644
https-migration-20260622165410-20260624025941.php
4730 bytes
0644
https-migration-20260622194220.php
4730 bytes
0644
https-migration-20260622204948.php
4730 bytes
0644
https-migration-20260622210714.php
4730 bytes
0644
https-migration-20260622211332-20260624144153.php
4730 bytes
0644
https-migration-20260622211332.php
4730 bytes
0644
https-migration.php
4730 bytes
0644
jquery-ui-dialog-20260621190135.css
5928 bytes
0644
jquery-ui-dialog-rtl.css
5967 bytes
0644
jquery-ui-dialog-rtl.min.css
4552 bytes
0644
jquery-ui-dialog.min.css
4548 bytes
0644
json2.js
18422 bytes
0644
latest-comments.php
4999 bytes
0644
locale-20260707074821.php
162 bytes
0644
locale.php
162 bytes
0644
media-views-rtl.css
56076 bytes
0644
media-views-rtl.min.css
45507 bytes
0644
media-views.css
56034 bytes
0644
media-views.min.css
45500 bytes
0644
ms-blogs.php
25174 bytes
0644
ms-site-20260705004413.php
43512 bytes
0644
ms-site.php
43512 bytes
0644
nav-menu-template.php
23296 bytes
0644
php72compat_const-20260705065845.php
4597 bytes
0644
php72compat_const-20260705195122.php
4597 bytes
0644
php72compat_const-20260705201332.php
4597 bytes
0644
php72compat_const-20260706081739.php
4597 bytes
0644
php72compat_const.php
4597 bytes
0644
post-thumbnail-template.php
9353 bytes
0644
progressbar.min.js
2514 bytes
0644
revision-20260705053011.php
22027 bytes
0644
revision.php
22027 bytes
0644
shortcode-20260622122648.php
697 bytes
0644
shortcode.min-20260705111012.js
4096 bytes
0644
shortcode.min.js
4096 bytes
0644
shortcode.php
697 bytes
0644
sitemaps-20260621162408.php
3236 bytes
0644
style-rtl.css
27819 bytes
0644
taxonomy.php
165888 bytes
0644
tiny_mce_popup.js
15988 bytes
0644
tinymce.min.js
365570 bytes
0644
utils.js
4665 bytes
0644
wp-auth-check-20260621163143.css
2508 bytes
0644
wp-auth-check-rtl.css
2545 bytes
0644
wp-auth-check-rtl.min.css
1918 bytes
0644
wp-content.css
8624 bytes
0644
wp-custom-header.js
10447 bytes
0644
wp-embed-template-20260621162209.css
7937 bytes
0644
wp-embed-template-ie.min.css
1473 bytes
0604
wp-embed.min.js
1478 bytes
0644
N4ST4R_ID | Naxtarrr