golden hour
/var/www/nanshen/wp-admin/js
⬆️ Go Up
Upload
File/Folder
Size
Actions
accordion.js
1.56 KB
Del
OK
accordion.min.js
819 B
Del
OK
color-picker.js
4.13 KB
Del
OK
color-picker.min.js
2.35 KB
Del
OK
colors
-
Del
OK
comment.js
1.48 KB
Del
OK
comment.min.js
1.11 KB
Del
OK
common.js
19.5 KB
Del
OK
common.min.js
11.07 KB
Del
OK
custom-background.js
1.91 KB
Del
OK
custom-background.min.js
914 B
Del
OK
custom-header.js
1.47 KB
Del
OK
customize-controls.js
31.24 KB
Del
OK
customize-controls.min.js
16.08 KB
Del
OK
customize-widgets.js
54.57 KB
Del
OK
customize-widgets.min.js
22.48 KB
Del
OK
dashboard.js
5.53 KB
Del
OK
dashboard.min.js
2.96 KB
Del
OK
edit-comments.js
17.12 KB
Del
OK
edit-comments.min.js
10.48 KB
Del
OK
editor.js
9.87 KB
Del
OK
editor.min.js
5.57 KB
Del
OK
farbtastic.js
7.51 KB
Del
OK
gallery.js
5.38 KB
Del
OK
gallery.min.js
3.63 KB
Del
OK
image-edit.js
15.11 KB
Del
OK
image-edit.min.js
8.9 KB
Del
OK
inline-edit-post.js
10.15 KB
Del
OK
inline-edit-post.min.js
6.7 KB
Del
OK
inline-edit-tax.js
3.2 KB
Del
OK
inline-edit-tax.min.js
2.22 KB
Del
OK
iris.min.js
22.02 KB
Del
OK
link.js
2.19 KB
Del
OK
link.min.js
1.6 KB
Del
OK
media-gallery.js
856 B
Del
OK
media-gallery.min.js
578 B
Del
OK
media-upload.js
1.94 KB
Del
OK
media-upload.min.js
1.1 KB
Del
OK
media.js
2.36 KB
Del
OK
media.min.js
1.58 KB
Del
OK
nav-menu.js
37.58 KB
Del
OK
nav-menu.min.js
19.27 KB
Del
OK
password-strength-meter.js
2.26 KB
Del
OK
password-strength-meter.min.js
719 B
Del
OK
plugin-install.js
1.83 KB
Del
OK
plugin-install.min.js
1.18 KB
Del
OK
post.js
30.72 KB
Del
OK
post.min.js
18.47 KB
Del
OK
postbox.js
4.72 KB
Del
OK
postbox.min.js
3.29 KB
Del
OK
revisions.js
31.45 KB
Del
OK
revisions.min.js
17.29 KB
Del
OK
set-post-thumbnail.js
777 B
Del
OK
set-post-thumbnail.min.js
525 B
Del
OK
svg-painter.js
5.36 KB
Del
OK
svg-painter.min.js
2.29 KB
Del
OK
tags.js
2.53 KB
Del
OK
tags.min.js
1.49 KB
Del
OK
theme.js
42.84 KB
Del
OK
theme.min.js
19.87 KB
Del
OK
updates.js
1.63 KB
Del
OK
updates.min.js
915 B
Del
OK
user-profile.js
3.63 KB
Del
OK
user-profile.min.js
2.26 KB
Del
OK
user-suggest.js
1.04 KB
Del
OK
user-suggest.min.js
657 B
Del
OK
widgets.js
13.76 KB
Del
OK
widgets.min.js
8.12 KB
Del
OK
word-count.js
1023 B
Del
OK
word-count.min.js
582 B
Del
OK
wp-fullscreen.js
15.79 KB
Del
OK
wp-fullscreen.min.js
8.37 KB
Del
OK
xfn.js
628 B
Del
OK
xfn.min.js
441 B
Del
OK
Edit: wp-fullscreen.js
/* global deleteUserSetting, setUserSetting, switchEditors, tinymce, tinyMCEPreInit */ /** * Distraction Free Writing * (wp-fullscreen) * * Access the API globally using the window.wp.editor.fullscreen variable. */ ( function( $, window ) { var api, ps, s, toggleUI, uiTimer, PubSub, uiScrollTop = 0, transitionend = 'transitionend webkitTransitionEnd', $body = $( document.body ), $document = $( document ); /** * PubSub * * A lightweight publish/subscribe implementation. * * @access private */ PubSub = function() { this.topics = {}; this.subscribe = function( topic, callback ) { if ( ! this.topics[ topic ] ) this.topics[ topic ] = []; this.topics[ topic ].push( callback ); return callback; }; this.unsubscribe = function( topic, callback ) { var i, l, topics = this.topics[ topic ]; if ( ! topics ) return callback || []; // Clear matching callbacks if ( callback ) { for ( i = 0, l = topics.length; i < l; i++ ) { if ( callback == topics[i] ) topics.splice( i, 1 ); } return callback; // Clear all callbacks } else { this.topics[ topic ] = []; return topics; } }; this.publish = function( topic, args ) { var i, l, broken, topics = this.topics[ topic ]; if ( ! topics ) return; args = args || []; for ( i = 0, l = topics.length; i < l; i++ ) { broken = ( topics[i].apply( null, args ) === false || broken ); } return ! broken; }; }; // Initialize the fullscreen/api object api = {}; // Create the PubSub (publish/subscribe) interface. ps = api.pubsub = new PubSub(); s = api.settings = { // Settings visible: false, mode: 'tinymce', id: '', title_id: '', timer: 0, toolbar_shown: false }; function _hideUI() { $body.removeClass('wp-dfw-show-ui'); } /** * toggleUI * * Toggle the CSS class to show/hide the toolbar, borders and statusbar. */ toggleUI = api.toggleUI = function( show ) { clearTimeout( uiTimer ); if ( ! $body.hasClass('wp-dfw-show-ui') || show === 'show' ) { $body.addClass('wp-dfw-show-ui'); } else if ( show !== 'autohide' ) { $body.removeClass('wp-dfw-show-ui'); } if ( show === 'autohide' ) { uiTimer = setTimeout( _hideUI, 2000 ); } }; function resetCssPosition( add ) { s.$dfwWrap.parents().each( function( i, parent ) { var cssPosition, $parent = $(parent); if ( add ) { if ( parent.style.position ) { $parent.data( 'wp-dfw-css-position', parent.style.position ); } $parent.css( 'position', 'static' ); } else { cssPosition = $parent.data( 'wp-dfw-css-position' ); cssPosition = cssPosition || ''; $parent.css( 'position', cssPosition ); } if ( parent.nodeName === 'BODY' ) { return false; } }); } /** * on() * * Turns fullscreen on. * * @param string mode Optional. Switch to the given mode before opening. */ api.on = function() { var id, $dfwWrap, titleId; if ( s.visible ) { return; } if ( ! s.$fullscreenFader ) { api.ui.init(); } // Settings can be added or changed by defining "wp_fullscreen_settings" JS object. if ( typeof window.wp_fullscreen_settings === 'object' ) $.extend( s, window.wp_fullscreen_settings ); id = s.id || window.wpActiveEditor; if ( ! id ) { if ( s.hasTinymce ) { id = tinymce.activeEditor.id; } else { return; } } s.id = id; $dfwWrap = s.$dfwWrap = $( '#wp-' + id + '-wrap' ); if ( ! $dfwWrap.length ) { return; } s.$dfwTextarea = $( '#' + id ); s.$editorContainer = $dfwWrap.find( '.wp-editor-container' ); uiScrollTop = $document.scrollTop(); if ( s.hasTinymce ) { s.editor = tinymce.get( id ); } if ( s.editor && ! s.editor.isHidden() ) { s.origHeight = $( '#' + id + '_ifr' ).height(); s.mode = 'tinymce'; } else { s.origHeight = s.$dfwTextarea.height(); s.mode = 'html'; } // Try to find title field if ( typeof window.adminpage !== 'undefined' && ( window.adminpage === 'post-php' || window.adminpage === 'post-new-php' ) ) { titleId = 'title'; } else { titleId = id + '-title'; } s.$dfwTitle = $( '#' + titleId ); if ( ! s.$dfwTitle.length ) { s.$dfwTitle = null; } api.ui.fade( 'show', 'showing', 'shown' ); }; /** * off() * * Turns fullscreen off. */ api.off = function() { if ( ! s.visible ) return; api.ui.fade( 'hide', 'hiding', 'hidden' ); }; /** * switchmode() * * @return string - The current mode. * * @param string to - The fullscreen mode to switch to. * @event switchMode * @eventparam string to - The new mode. * @eventparam string from - The old mode. */ api.switchmode = function( to ) { var from = s.mode; if ( ! to || ! s.visible || ! s.hasTinymce || typeof switchEditors === 'undefined' ) { return from; } // Don't switch if the mode is the same. if ( from == to ) return from; if ( to === 'tinymce' && ! s.editor ) { s.editor = tinymce.get( s.id ); if ( ! s.editor && typeof tinyMCEPreInit !== 'undefined' && tinyMCEPreInit.mceInit && tinyMCEPreInit.mceInit[ s.id ] ) { // If the TinyMCE instance hasn't been created, set the "wp_fulscreen" flag on creating it tinyMCEPreInit.mceInit[ s.id ].wp_fullscreen = true; } } s.mode = to; switchEditors.go( s.id, to ); api.refreshButtons( true ); if ( to === 'html' ) { setTimeout( api.resizeTextarea, 200 ); } return to; }; /** * General */ api.save = function() { var $hidden = $('#hiddenaction'), oldVal = $hidden.val(), $spinner = $('#wp-fullscreen-save .spinner'), $saveMessage = $('#wp-fullscreen-save .wp-fullscreen-saved-message'), $errorMessage = $('#wp-fullscreen-save .wp-fullscreen-error-message'); $spinner.show(); $errorMessage.hide(); $saveMessage.hide(); $hidden.val('wp-fullscreen-save-post'); if ( s.editor && ! s.editor.isHidden() ) { s.editor.save(); } $.ajax({ url: window.ajaxurl, type: 'post', data: $('form#post').serialize(), dataType: 'json' }).done( function( response ) { $spinner.hide(); if ( response && response.success ) { $saveMessage.show(); setTimeout( function() { $saveMessage.fadeOut(300); }, 3000 ); if ( response.data && response.data.last_edited ) { $('#wp-fullscreen-save input').attr( 'title', response.data.last_edited ); } } else { $errorMessage.show(); } }).fail( function() { $spinner.hide(); $errorMessage.show(); }); $hidden.val( oldVal ); }; api.dfwWidth = function( pixels, total ) { var width; if ( pixels && pixels.toString().indexOf('%') !== -1 ) { s.$editorContainer.css( 'width', pixels ); s.$statusbar.css( 'width', pixels ); if ( s.$dfwTitle ) { s.$dfwTitle.css( 'width', pixels ); } return; } if ( ! pixels ) { // Reset to theme width width = $('#wp-fullscreen-body').data('theme-width') || 800; s.$editorContainer.width( width ); s.$statusbar.width( width ); if ( s.$dfwTitle ) { s.$dfwTitle.width( width - 16 ); } deleteUserSetting('dfw_width'); return; } if ( total ) { width = pixels; } else { width = s.$editorContainer.width(); width += pixels; } if ( width < 200 || width > 1200 ) { // sanity check return; } s.$editorContainer.width( width ); s.$statusbar.width( width ); if ( s.$dfwTitle ) { s.$dfwTitle.width( width - 16 ); } setUserSetting( 'dfw_width', width ); }; // This event occurs before the overlay blocks the UI. ps.subscribe( 'show', function() { var title = $('#last-edit').text(); if ( title ) { $('#wp-fullscreen-save input').attr( 'title', title ); } }); // This event occurs while the overlay blocks the UI. ps.subscribe( 'showing', function() { $body.addClass( 'wp-fullscreen-active' ); s.$dfwWrap.addClass( 'wp-fullscreen-wrap' ); if ( s.$dfwTitle ) { s.$dfwTitle.after( '<span id="wp-fullscreen-title-placeholder">' ); s.$dfwWrap.prepend( s.$dfwTitle.addClass('wp-fullscreen-title') ); } api.refreshButtons(); resetCssPosition( true ); $('#wpadminbar').hide(); // Show the UI for 2 sec. when opening toggleUI('autohide'); api.bind_resize(); if ( s.editor ) { s.editor.execCommand( 'wpFullScreenOn' ); } if ( 'ontouchstart' in window ) { api.dfwWidth( '90%' ); } else { api.dfwWidth( $( '#wp-fullscreen-body' ).data('dfw-width') || 800, true ); } // scroll to top so the user is not disoriented scrollTo(0, 0); }); // This event occurs after the overlay unblocks the UI ps.subscribe( 'shown', function() { s.visible = true; if ( s.editor && ! s.editor.isHidden() ) { s.editor.execCommand( 'wpAutoResize' ); } else { api.resizeTextarea( 'force' ); } }); ps.subscribe( 'hide', function() { // This event occurs before the overlay blocks DFW. $document.unbind( '.fullscreen' ); s.$dfwTextarea.unbind('.wp-dfw-resize'); }); ps.subscribe( 'hiding', function() { // This event occurs while the overlay blocks the DFW UI. $body.removeClass( 'wp-fullscreen-active' ); if ( s.$dfwTitle ) { $( '#wp-fullscreen-title-placeholder' ).before( s.$dfwTitle.removeClass('wp-fullscreen-title').css( 'width', '' ) ).remove(); } s.$dfwWrap.removeClass( 'wp-fullscreen-wrap' ); s.$editorContainer.css( 'width', '' ); s.$dfwTextarea.add( '#' + s.id + '_ifr' ).height( s.origHeight ); if ( s.editor ) { s.editor.execCommand( 'wpFullScreenOff' ); } resetCssPosition( false ); window.scrollTo( 0, uiScrollTop ); $('#wpadminbar').show(); }); // This event occurs after DFW is removed. ps.subscribe( 'hidden', function() { s.visible = false; }); api.refreshButtons = function( fade ) { if ( s.mode === 'html' ) { $('#wp-fullscreen-mode-bar').removeClass('wp-tmce-mode').addClass('wp-html-mode') .find('a').removeClass( 'active' ).filter('.wp-fullscreen-mode-html').addClass( 'active' ); if ( fade ) { $('#wp-fullscreen-button-bar').fadeOut( 150, function(){ $(this).addClass('wp-html-mode').fadeIn( 150 ); }); } else { $('#wp-fullscreen-button-bar').addClass('wp-html-mode'); } } else if ( s.mode === 'tinymce' ) { $('#wp-fullscreen-mode-bar').removeClass('wp-html-mode').addClass('wp-tmce-mode') .find('a').removeClass( 'active' ).filter('.wp-fullscreen-mode-tinymce').addClass( 'active' ); if ( fade ) { $('#wp-fullscreen-button-bar').fadeOut( 150, function(){ $(this).removeClass('wp-html-mode').fadeIn( 150 ); }); } else { $('#wp-fullscreen-button-bar').removeClass('wp-html-mode'); } } }; /** * UI Elements * * Used for transitioning between states. */ api.ui = { init: function() { var toolbar; s.toolbar = toolbar = $('#fullscreen-topbar'); s.$fullscreenFader = $('#fullscreen-fader'); s.$statusbar = $('#wp-fullscreen-status'); s.hasTinymce = typeof tinymce !== 'undefined'; if ( ! s.hasTinymce ) $('#wp-fullscreen-mode-bar').hide(); $document.keyup( function(e) { var c = e.keyCode || e.charCode, modKey; if ( ! s.visible ) { return; } if ( navigator.platform && navigator.platform.indexOf('Mac') !== -1 ) { modKey = e.ctrlKey; // Ctrl key for Mac } else { modKey = e.altKey; // Alt key for Win & Linux } if ( modKey && ( 61 === c || 107 === c || 187 === c ) ) { // + api.dfwWidth( 25 ); e.preventDefault(); } if ( modKey && ( 45 === c || 109 === c || 189 === c ) ) { // - api.dfwWidth( -25 ); e.preventDefault(); } if ( modKey && 48 === c ) { // 0 api.dfwWidth( 0 ); e.preventDefault(); } }); $document.on( 'keydown.wp-fullscreen', function( event ) { if ( 27 === event.which && s.visible ) { // Esc api.off(); event.stopImmediatePropagation(); } }); if ( 'ontouchstart' in window ) { $body.addClass('wp-dfw-touch'); } toolbar.on( 'mouseenter', function() { toggleUI('show'); }).on( 'mouseleave', function() { toggleUI('autohide'); }); // Bind buttons $('#wp-fullscreen-buttons').on( 'click.wp-fullscreen', 'button', function( event ) { var command = event.currentTarget.id ? event.currentTarget.id.substr(6) : null; if ( s.editor && 'tinymce' === s.mode ) { switch( command ) { case 'bold': s.editor.execCommand('Bold'); break; case 'italic': s.editor.execCommand('Italic'); break; case 'bullist': s.editor.execCommand('InsertUnorderedList'); break; case 'numlist': s.editor.execCommand('InsertOrderedList'); break; case 'link': s.editor.execCommand('WP_Link'); break; case 'unlink': s.editor.execCommand('unlink'); break; case 'help': s.editor.execCommand('WP_Help'); break; case 'blockquote': s.editor.execCommand('mceBlockQuote'); break; } } else if ( command === 'link' && window.wpLink ) { window.wpLink.open(); } if ( command === 'wp-media-library' && typeof wp !== 'undefined' && wp.media && wp.media.editor ) { wp.media.editor.open( s.id ); } }); }, fade: function( before, during, after ) { if ( ! s.$fullscreenFader ) { api.ui.init(); } // If any callback bound to before returns false, bail. if ( before && ! ps.publish( before ) ) { return; } api.fade.In( s.$fullscreenFader, 200, function() { if ( during ) { ps.publish( during ); } api.fade.Out( s.$fullscreenFader, 200, function() { if ( after ) { ps.publish( after ); } }); }); } }; api.fade = { // Sensitivity to allow browsers to render the blank element before animating. sensitivity: 100, In: function( element, speed, callback, stop ) { callback = callback || $.noop; speed = speed || 400; stop = stop || false; if ( api.fade.transitions ) { if ( element.is(':visible') ) { element.addClass( 'fade-trigger' ); return element; } element.show(); element.first().one( transitionend, function() { callback(); }); setTimeout( function() { element.addClass( 'fade-trigger' ); }, this.sensitivity ); } else { if ( stop ) { element.stop(); } element.css( 'opacity', 1 ); element.first().fadeIn( speed, callback ); if ( element.length > 1 ) { element.not(':first').fadeIn( speed ); } } return element; }, Out: function( element, speed, callback, stop ) { callback = callback || $.noop; speed = speed || 400; stop = stop || false; if ( ! element.is(':visible') ) { return element; } if ( api.fade.transitions ) { element.first().one( transitionend, function() { if ( element.hasClass('fade-trigger') ) { return; } element.hide(); callback(); }); setTimeout( function() { element.removeClass( 'fade-trigger' ); }, this.sensitivity ); } else { if ( stop ) { element.stop(); } element.first().fadeOut( speed, callback ); if ( element.length > 1 ) { element.not(':first').fadeOut( speed ); } } return element; }, // Check if the browser supports CSS 3.0 transitions transitions: ( function() { var style = document.documentElement.style; return ( typeof style.WebkitTransition === 'string' || typeof style.MozTransition === 'string' || typeof style.OTransition === 'string' || typeof style.transition === 'string' ); })() }; /** * Resize API * * Automatically updates textarea height. */ api.bind_resize = function() { s.$dfwTextarea.on( 'keydown.wp-dfw-resize click.wp-dfw-resize paste.wp-dfw-resize', function() { api.resizeTextarea(); }); }; api.resizeTextarea = function() { var node = s.$dfwTextarea[0]; if ( node.scrollHeight > node.clientHeight ) { node.style.height = node.scrollHeight + 50 + 'px'; } }; // Export window.wp = window.wp || {}; window.wp.editor = window.wp.editor || {}; window.wp.editor.fullscreen = api; })( jQuery, window );
Save