plugin updates
This commit is contained in:
@@ -7,18 +7,18 @@
|
||||
*
|
||||
* <div class="accordion-container">
|
||||
* <div class="accordion-section open">
|
||||
* <h3 class="accordion-section-title"></h3>
|
||||
* <div class="accordion-section-content">
|
||||
* <h3 class="accordion-section-title"><button type="button" aria-expanded="true" aria-controls="target-1"></button></h3>
|
||||
* <div class="accordion-section-content" id="target">
|
||||
* </div>
|
||||
* </div>
|
||||
* <div class="accordion-section">
|
||||
* <h3 class="accordion-section-title"></h3>
|
||||
* <div class="accordion-section-content">
|
||||
* <h3 class="accordion-section-title"><button type="button" aria-expanded="false" aria-controls="target-2"></button></h3>
|
||||
* <div class="accordion-section-content" id="target-2">
|
||||
* </div>
|
||||
* </div>
|
||||
* <div class="accordion-section">
|
||||
* <h3 class="accordion-section-title"></h3>
|
||||
* <div class="accordion-section-content">
|
||||
* <h3 class="accordion-section-title"><button type="button" aria-expanded="false" aria-controls="target-3"></button></h3>
|
||||
* <div class="accordion-section-content" id="target-3">
|
||||
* </div>
|
||||
* </div>
|
||||
* </div>
|
||||
@@ -34,13 +34,7 @@
|
||||
$( function () {
|
||||
|
||||
// Expand/Collapse accordion sections on click.
|
||||
$( '.accordion-container' ).on( 'click keydown', '.accordion-section-title', function( e ) {
|
||||
if ( e.type === 'keydown' && 13 !== e.which ) { // "Return" key.
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault(); // Keep this AFTER the key filter above.
|
||||
|
||||
$( '.accordion-container' ).on( 'click', '.accordion-section-title button', function() {
|
||||
accordionSwitch( $( this ) );
|
||||
});
|
||||
|
||||
@@ -54,7 +48,6 @@
|
||||
*/
|
||||
function accordionSwitch ( el ) {
|
||||
var section = el.closest( '.accordion-section' ),
|
||||
sectionToggleControl = section.find( '[aria-expanded]' ).first(),
|
||||
container = section.closest( '.accordion-container' ),
|
||||
siblings = container.find( '.open' ),
|
||||
siblingsToggleControl = siblings.find( '[aria-expanded]' ).first(),
|
||||
@@ -86,8 +79,8 @@
|
||||
}, 150);
|
||||
|
||||
// If there's an element with an aria-expanded attribute, assume it's a toggle control and toggle the aria-expanded value.
|
||||
if ( sectionToggleControl ) {
|
||||
sectionToggleControl.attr( 'aria-expanded', String( sectionToggleControl.attr( 'aria-expanded' ) === 'false' ) );
|
||||
if ( el ) {
|
||||
el.attr( 'aria-expanded', String( el.attr( 'aria-expanded' ) === 'false' ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(s){s(function(){s(".accordion-container").on("click keydown",".accordion-section-title",function(e){var n,o,a,i,t;"keydown"===e.type&&13!==e.which||(e.preventDefault(),e=(e=s(this)).closest(".accordion-section"),n=e.find("[aria-expanded]").first(),o=e.closest(".accordion-container"),a=o.find(".open"),i=a.find("[aria-expanded]").first(),t=e.find(".accordion-section-content"),e.hasClass("cannot-expand"))||(o.addClass("opening"),e.hasClass("open")?(e.toggleClass("open"),t.toggle(!0).slideToggle(150)):(i.attr("aria-expanded","false"),a.removeClass("open"),a.find(".accordion-section-content").show().slideUp(150),t.toggle(!1).slideToggle(150),e.toggleClass("open")),setTimeout(function(){o.removeClass("opening")},150),n&&n.attr("aria-expanded",String("false"===n.attr("aria-expanded"))))})})}(jQuery);
|
||||
!function(s){s(function(){s(".accordion-container").on("click",".accordion-section-title button",function(){var n,o,e,a,t,i;n=s(this),o=n.closest(".accordion-section"),e=o.closest(".accordion-container"),a=e.find(".open"),t=a.find("[aria-expanded]").first(),i=o.find(".accordion-section-content"),o.hasClass("cannot-expand")||(e.addClass("opening"),o.hasClass("open")?(o.toggleClass("open"),i.toggle(!0).slideToggle(150)):(t.attr("aria-expanded","false"),a.removeClass("open"),a.find(".accordion-section-content").show().slideUp(150),i.toggle(!1).slideToggle(150),o.toggleClass("open")),setTimeout(function(){e.removeClass("opening")},150),n&&n.attr("aria-expanded",String("false"===n.attr("aria-expanded"))))})})}(jQuery);
|
||||
@@ -1114,7 +1114,7 @@ $( function() {
|
||||
});
|
||||
}
|
||||
|
||||
$document.on( 'wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error', makeNoticesDismissible );
|
||||
$document.on( 'wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error wp-notice-added', makeNoticesDismissible );
|
||||
|
||||
// Init screen meta.
|
||||
screenMeta.init();
|
||||
@@ -1276,6 +1276,80 @@ $( function() {
|
||||
// Marry the secondary "Change role to" controls to the primary controls:
|
||||
marryControls( $('#new_role'), $('#changeit'), $('#new_role2'), $('#changeit2') );
|
||||
|
||||
var addAdminNotice = function( data ) {
|
||||
var $notice = $( data.selector ),
|
||||
$headerEnd = $( '.wp-header-end' ),
|
||||
type,
|
||||
dismissible,
|
||||
$adminNotice;
|
||||
|
||||
delete data.selector;
|
||||
|
||||
dismissible = ( data.dismissible && data.dismissible === true ) ? ' is-dismissible' : '';
|
||||
type = ( data.type ) ? data.type : 'info';
|
||||
|
||||
$adminNotice = '<div id="' + data.id + '" class="notice notice-' + data.type + dismissible + '"><p>' + data.message + '</p></div>';
|
||||
|
||||
// Check if this admin notice already exists.
|
||||
if ( ! $notice.length ) {
|
||||
$notice = $( '#' + data.id );
|
||||
}
|
||||
|
||||
if ( $notice.length ) {
|
||||
$notice.replaceWith( $adminNotice );
|
||||
} else if ( $headerEnd.length ) {
|
||||
$headerEnd.after( $adminNotice );
|
||||
} else {
|
||||
if ( 'customize' === pagenow ) {
|
||||
$( '.customize-themes-notifications' ).append( $adminNotice );
|
||||
} else {
|
||||
$( '.wrap' ).find( '> h1' ).after( $adminNotice );
|
||||
}
|
||||
}
|
||||
|
||||
$document.trigger( 'wp-notice-added' );
|
||||
};
|
||||
|
||||
$( '.bulkactions' ).parents( 'form' ).on( 'submit', function( event ) {
|
||||
var form = this,
|
||||
submitterName = event.originalEvent && event.originalEvent.submitter ? event.originalEvent.submitter.name : false;
|
||||
|
||||
// Observe submissions from posts lists for 'bulk_action' or users lists for 'new_role'.
|
||||
var bulkFieldRelations = {
|
||||
'bulk_action' : 'action',
|
||||
'changeit' : 'new_role'
|
||||
};
|
||||
if ( ! Object.keys( bulkFieldRelations ).includes( submitterName ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var values = new FormData(form);
|
||||
var value = values.get( bulkFieldRelations[ submitterName ] ) || '-1';
|
||||
|
||||
// Check that the action is not the default one.
|
||||
if ( value !== '-1' ) {
|
||||
// Check that at least one item is selected.
|
||||
var itemsSelected = form.querySelectorAll( '.wp-list-table tbody .check-column input[type="checkbox"]:checked' );
|
||||
|
||||
if ( itemsSelected.length > 0 ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
$( 'html, body' ).animate( { scrollTop: 0 } );
|
||||
|
||||
var errorMessage = __( 'Please select at least one item to perform this action on.' );
|
||||
addAdminNotice( {
|
||||
id: 'no-items-selected',
|
||||
type: 'error',
|
||||
message: errorMessage,
|
||||
dismissible: true,
|
||||
} );
|
||||
|
||||
wp.a11y.speak( errorMessage );
|
||||
});
|
||||
|
||||
/**
|
||||
* Shows row actions on focus of its parent container element or any other elements contained within.
|
||||
*
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1530,7 +1530,7 @@
|
||||
}
|
||||
|
||||
// Expand/Collapse accordion sections on click.
|
||||
section.container.find( '.accordion-section-title, .customize-section-back' ).on( 'click keydown', function( event ) {
|
||||
section.container.find( '.accordion-section-title button, .customize-section-back' ).on( 'click keydown', function( event ) {
|
||||
if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
|
||||
return;
|
||||
}
|
||||
@@ -1605,7 +1605,7 @@
|
||||
content = section.contentContainer,
|
||||
overlay = section.headContainer.closest( '.wp-full-overlay' ),
|
||||
backBtn = content.find( '.customize-section-back' ),
|
||||
sectionTitle = section.headContainer.find( '.accordion-section-title' ).first(),
|
||||
sectionTitle = section.headContainer.find( '.accordion-section-title button' ).first(),
|
||||
expand, panel;
|
||||
|
||||
if ( expanded && ! content.hasClass( 'open' ) ) {
|
||||
@@ -1615,9 +1615,6 @@
|
||||
} else {
|
||||
expand = function() {
|
||||
section._animateChangeExpanded( function() {
|
||||
sectionTitle.attr( 'tabindex', '-1' );
|
||||
backBtn.attr( 'tabindex', '0' );
|
||||
|
||||
backBtn.trigger( 'focus' );
|
||||
content.css( 'top', '' );
|
||||
container.scrollTop( 0 );
|
||||
@@ -1663,8 +1660,6 @@
|
||||
}
|
||||
}
|
||||
section._animateChangeExpanded( function() {
|
||||
backBtn.attr( 'tabindex', '-1' );
|
||||
sectionTitle.attr( 'tabindex', '0' );
|
||||
|
||||
sectionTitle.trigger( 'focus' );
|
||||
content.css( 'top', '' );
|
||||
@@ -2699,7 +2694,7 @@
|
||||
container = section.headContainer.closest( '.wp-full-overlay-sidebar-content' ),
|
||||
content = section.contentContainer,
|
||||
backBtn = content.find( '.customize-section-back' ),
|
||||
sectionTitle = section.headContainer.find( '.accordion-section-title' ).first(),
|
||||
sectionTitle = section.headContainer.find( '.accordion-section-title button' ).first(),
|
||||
body = $( document.body ),
|
||||
expand, panel;
|
||||
|
||||
@@ -2719,9 +2714,6 @@
|
||||
} else {
|
||||
expand = function() {
|
||||
section._animateChangeExpanded( function() {
|
||||
sectionTitle.attr( 'tabindex', '-1' );
|
||||
backBtn.attr( 'tabindex', '0' );
|
||||
|
||||
backBtn.trigger( 'focus' );
|
||||
content.css( 'top', '' );
|
||||
container.scrollTop( 0 );
|
||||
@@ -2752,8 +2744,6 @@
|
||||
}
|
||||
}
|
||||
section._animateChangeExpanded( function() {
|
||||
backBtn.attr( 'tabindex', '-1' );
|
||||
sectionTitle.attr( 'tabindex', '0' );
|
||||
|
||||
sectionTitle.trigger( 'focus' );
|
||||
content.css( 'top', '' );
|
||||
@@ -2843,7 +2833,7 @@
|
||||
var meta, panel = this;
|
||||
|
||||
// Expand/Collapse accordion sections on click.
|
||||
panel.headContainer.find( '.accordion-section-title' ).on( 'click keydown', function( event ) {
|
||||
panel.headContainer.find( '.accordion-section-title button' ).on( 'click keydown', function( event ) {
|
||||
if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
|
||||
return;
|
||||
}
|
||||
@@ -2947,7 +2937,7 @@
|
||||
accordionSection = panel.contentContainer,
|
||||
overlay = accordionSection.closest( '.wp-full-overlay' ),
|
||||
container = accordionSection.closest( '.wp-full-overlay-sidebar-content' ),
|
||||
topPanel = panel.headContainer.find( '.accordion-section-title' ),
|
||||
topPanel = panel.headContainer.find( '.accordion-section-title button' ),
|
||||
backBtn = accordionSection.find( '.customize-panel-back' ),
|
||||
childSections = panel.sections(),
|
||||
skipTransition;
|
||||
@@ -2974,9 +2964,6 @@
|
||||
} );
|
||||
} else {
|
||||
panel._animateChangeExpanded( function() {
|
||||
topPanel.attr( 'tabindex', '-1' );
|
||||
backBtn.attr( 'tabindex', '0' );
|
||||
|
||||
backBtn.trigger( 'focus' );
|
||||
accordionSection.css( 'top', '' );
|
||||
container.scrollTop( 0 );
|
||||
@@ -2996,8 +2983,6 @@
|
||||
skipTransition = accordionSection.hasClass( 'skip-transition' );
|
||||
if ( ! skipTransition ) {
|
||||
panel._animateChangeExpanded( function() {
|
||||
topPanel.attr( 'tabindex', '0' );
|
||||
backBtn.attr( 'tabindex', '-1' );
|
||||
|
||||
topPanel.focus();
|
||||
accordionSection.css( 'top', '' );
|
||||
@@ -4602,26 +4587,29 @@
|
||||
* @return {Object} Options
|
||||
*/
|
||||
calculateImageSelectOptions: function( attachment, controller ) {
|
||||
var control = controller.get( 'control' ),
|
||||
flexWidth = !! parseInt( control.params.flex_width, 10 ),
|
||||
flexHeight = !! parseInt( control.params.flex_height, 10 ),
|
||||
realWidth = attachment.get( 'width' ),
|
||||
realHeight = attachment.get( 'height' ),
|
||||
xInit = parseInt( control.params.width, 10 ),
|
||||
yInit = parseInt( control.params.height, 10 ),
|
||||
ratio = xInit / yInit,
|
||||
xImg = xInit,
|
||||
yImg = yInit,
|
||||
var control = controller.get( 'control' ),
|
||||
flexWidth = !! parseInt( control.params.flex_width, 10 ),
|
||||
flexHeight = !! parseInt( control.params.flex_height, 10 ),
|
||||
realWidth = attachment.get( 'width' ),
|
||||
realHeight = attachment.get( 'height' ),
|
||||
xInit = parseInt( control.params.width, 10 ),
|
||||
yInit = parseInt( control.params.height, 10 ),
|
||||
requiredRatio = xInit / yInit,
|
||||
realRatio = realWidth / realHeight,
|
||||
xImg = xInit,
|
||||
yImg = yInit,
|
||||
x1, y1, imgSelectOptions;
|
||||
|
||||
controller.set( 'hasRequiredAspectRatio', control.hasRequiredAspectRatio( requiredRatio, realRatio ) );
|
||||
controller.set( 'suggestedCropSize', { width: realWidth, height: realHeight, x1: 0, y1: 0, x2: xInit, y2: yInit } );
|
||||
controller.set( 'canSkipCrop', ! control.mustBeCropped( flexWidth, flexHeight, xInit, yInit, realWidth, realHeight ) );
|
||||
|
||||
if ( realWidth / realHeight > ratio ) {
|
||||
if ( realRatio > requiredRatio ) {
|
||||
yInit = realHeight;
|
||||
xInit = yInit * ratio;
|
||||
xInit = yInit * requiredRatio;
|
||||
} else {
|
||||
xInit = realWidth;
|
||||
yInit = xInit / ratio;
|
||||
yInit = xInit / requiredRatio;
|
||||
}
|
||||
|
||||
x1 = ( realWidth - xInit ) / 2;
|
||||
@@ -4662,13 +4650,13 @@
|
||||
/**
|
||||
* Return whether the image must be cropped, based on required dimensions.
|
||||
*
|
||||
* @param {boolean} flexW
|
||||
* @param {boolean} flexH
|
||||
* @param {number} dstW
|
||||
* @param {number} dstH
|
||||
* @param {number} imgW
|
||||
* @param {number} imgH
|
||||
* @return {boolean}
|
||||
* @param {boolean} flexW Width is flexible.
|
||||
* @param {boolean} flexH Height is flexible.
|
||||
* @param {number} dstW Required width.
|
||||
* @param {number} dstH Required height.
|
||||
* @param {number} imgW Provided image's width.
|
||||
* @param {number} imgH Provided image's height.
|
||||
* @return {boolean} Whether cropping is required.
|
||||
*/
|
||||
mustBeCropped: function( flexW, flexH, dstW, dstH, imgW, imgH ) {
|
||||
if ( true === flexW && true === flexH ) {
|
||||
@@ -4694,6 +4682,25 @@
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if the image's aspect ratio essentially matches the required aspect ratio.
|
||||
*
|
||||
* Floating point precision is low, so this allows a small tolerance. This
|
||||
* tolerance allows for images over 100,000 px on either side to still trigger
|
||||
* the cropping flow.
|
||||
*
|
||||
* @param {number} requiredRatio Required image ratio.
|
||||
* @param {number} realRatio Provided image ratio.
|
||||
* @return {boolean} Whether the image has the required aspect ratio.
|
||||
*/
|
||||
hasRequiredAspectRatio: function ( requiredRatio, realRatio ) {
|
||||
if ( Math.abs( requiredRatio - realRatio ) < 0.000001 ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* If cropping was skipped, apply the image data directly to the setting.
|
||||
*/
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -1107,7 +1107,7 @@
|
||||
var section = this,
|
||||
$title;
|
||||
|
||||
$title = section.container.find( '.accordion-section-title:first' );
|
||||
$title = section.container.find( '.accordion-section-title button:first' );
|
||||
$title.find( '.menu-in-location' ).remove();
|
||||
_.each( themeLocationSlugs, function( themeLocationSlug ) {
|
||||
var $label, locationName;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -1188,6 +1188,7 @@ window.commentReply = {
|
||||
if ( er ) {
|
||||
$errorNotice.removeClass( 'hidden' );
|
||||
$error.html( er );
|
||||
wp.a11y.speak( er );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+11
-23
@@ -79,6 +79,8 @@ window.wp = window.wp || {};
|
||||
var editorHeight, toolbarHeight, iframe,
|
||||
editor = tinymce.get( id ),
|
||||
wrap = $$( '#wp-' + id + '-wrap' ),
|
||||
htmlSwitch = wrap.find( '.switch-tmce' ),
|
||||
tmceSwitch = wrap.find( '.switch-html' ),
|
||||
$textarea = $$( '#' + id ),
|
||||
textarea = $textarea[0];
|
||||
|
||||
@@ -103,18 +105,7 @@ window.wp = window.wp || {};
|
||||
|
||||
editorHeight = parseInt( textarea.style.height, 10 ) || 0;
|
||||
|
||||
var keepSelection = false;
|
||||
if ( editor ) {
|
||||
keepSelection = editor.getParam( 'wp_keep_scroll_position' );
|
||||
} else {
|
||||
keepSelection = window.tinyMCEPreInit.mceInit[ id ] &&
|
||||
window.tinyMCEPreInit.mceInit[ id ].wp_keep_scroll_position;
|
||||
}
|
||||
|
||||
if ( keepSelection ) {
|
||||
// Save the selection.
|
||||
addHTMLBookmarkInTextAreaContent( $textarea );
|
||||
}
|
||||
addHTMLBookmarkInTextAreaContent( $textarea );
|
||||
|
||||
if ( editor ) {
|
||||
editor.show();
|
||||
@@ -130,15 +121,14 @@ window.wp = window.wp || {};
|
||||
}
|
||||
}
|
||||
|
||||
if ( editor.getParam( 'wp_keep_scroll_position' ) ) {
|
||||
// Restore the selection.
|
||||
focusHTMLBookmarkInVisualEditor( editor );
|
||||
}
|
||||
focusHTMLBookmarkInVisualEditor( editor );
|
||||
} else {
|
||||
tinymce.init( window.tinyMCEPreInit.mceInit[ id ] );
|
||||
}
|
||||
|
||||
wrap.removeClass( 'html-active' ).addClass( 'tmce-active' );
|
||||
tmceSwitch.attr( 'aria-pressed', false );
|
||||
htmlSwitch.attr( 'aria-pressed', true );
|
||||
$textarea.attr( 'aria-hidden', true );
|
||||
window.setUserSetting( 'editor', 'tinymce' );
|
||||
|
||||
@@ -168,9 +158,7 @@ window.wp = window.wp || {};
|
||||
|
||||
var selectionRange = null;
|
||||
|
||||
if ( editor.getParam( 'wp_keep_scroll_position' ) ) {
|
||||
selectionRange = findBookmarkedPosition( editor );
|
||||
}
|
||||
selectionRange = findBookmarkedPosition( editor );
|
||||
|
||||
editor.hide();
|
||||
|
||||
@@ -184,6 +172,8 @@ window.wp = window.wp || {};
|
||||
}
|
||||
|
||||
wrap.removeClass( 'tmce-active' ).addClass( 'html-active' );
|
||||
tmceSwitch.attr( 'aria-pressed', true );
|
||||
htmlSwitch.attr( 'aria-pressed', false );
|
||||
$textarea.attr( 'aria-hidden', false );
|
||||
window.setUserSetting( 'editor', 'html' );
|
||||
}
|
||||
@@ -520,7 +510,7 @@ window.wp = window.wp || {};
|
||||
* Focuses the selection markers in Visual mode.
|
||||
*
|
||||
* The method checks for existing selection markers inside the editor DOM (Visual mode)
|
||||
* and create a selection between the two nodes using the DOM `createRange` selection API
|
||||
* and create a selection between the two nodes using the DOM `createRange` selection API.
|
||||
*
|
||||
* If there is only a single node, select only the single node through TinyMCE's selection API
|
||||
*
|
||||
@@ -545,9 +535,7 @@ window.wp = window.wp || {};
|
||||
}
|
||||
}
|
||||
|
||||
if ( editor.getParam( 'wp_keep_scroll_position' ) ) {
|
||||
scrollVisualModeToStartElement( editor, startNode );
|
||||
}
|
||||
scrollVisualModeToStartElement( editor, startNode );
|
||||
|
||||
removeSelectionMarker( startNode );
|
||||
removeSelectionMarker( endNode );
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -143,17 +143,12 @@
|
||||
* @return {void}
|
||||
*/
|
||||
init : function(postid) {
|
||||
var t = this, old = $('#image-editor-' + t.postid),
|
||||
x = t.intval( $('#imgedit-x-' + postid).val() ),
|
||||
y = t.intval( $('#imgedit-y-' + postid).val() );
|
||||
var t = this, old = $('#image-editor-' + t.postid);
|
||||
|
||||
if ( t.postid !== postid && old.length ) {
|
||||
t.close(t.postid);
|
||||
}
|
||||
|
||||
t.hold.w = t.hold.ow = x;
|
||||
t.hold.h = t.hold.oh = y;
|
||||
t.hold.xy_ratio = x / y;
|
||||
t.hold.sizer = parseFloat( $('#imgedit-sizer-' + postid).val() );
|
||||
t.postid = postid;
|
||||
$('#imgedit-response-' + postid).empty();
|
||||
@@ -188,6 +183,29 @@
|
||||
$( document ).on( 'image-editor-ui-ready', this.focusManager );
|
||||
},
|
||||
|
||||
/**
|
||||
* Calculate the image size and save it to memory.
|
||||
*
|
||||
* @since 6.7.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {number} postid The post ID.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
calculateImgSize: function( postid ) {
|
||||
var t = this,
|
||||
x = t.intval( $( '#imgedit-x-' + postid ).val() ),
|
||||
y = t.intval( $( '#imgedit-y-' + postid ).val() );
|
||||
|
||||
t.hold.w = t.hold.ow = x;
|
||||
t.hold.h = t.hold.oh = y;
|
||||
t.hold.xy_ratio = x / y;
|
||||
t.hold.sizer = parseFloat( $( '#imgedit-sizer-' + postid ).val() );
|
||||
t.currentCropSelection = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Toggles the wait/load icon in the editor.
|
||||
*
|
||||
@@ -278,14 +296,16 @@
|
||||
* Navigate popup menu by arrow keys.
|
||||
*
|
||||
* @since 6.3.0
|
||||
* @since 6.7.0 Added the event parameter.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {Event} event The key or click event.
|
||||
* @param {HTMLElement} el The current element.
|
||||
*
|
||||
* @return {boolean} Always returns false.
|
||||
*/
|
||||
browsePopup : function(el) {
|
||||
browsePopup : function(event, el) {
|
||||
var $el = $( el );
|
||||
var $collection = $( el ).parent( '.imgedit-popup-menu' ).find( 'button' );
|
||||
var $index = $collection.index( $el );
|
||||
@@ -298,14 +318,14 @@
|
||||
if ( $next === $last ) {
|
||||
$next = 0;
|
||||
}
|
||||
var $target = false;
|
||||
var target = false;
|
||||
if ( event.keyCode === 40 ) {
|
||||
$target = $collection.get( $next );
|
||||
target = $collection.get( $next );
|
||||
} else if ( event.keyCode === 38 ) {
|
||||
$target = $collection.get( $prev );
|
||||
target = $collection.get( $prev );
|
||||
}
|
||||
if ( $target ) {
|
||||
$target.focus();
|
||||
if ( target ) {
|
||||
target.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
@@ -525,7 +545,7 @@
|
||||
for ( n in history ) {
|
||||
i = history[n];
|
||||
if ( i.hasOwnProperty('c') ) {
|
||||
op[n] = { 'c': { 'x': i.c.x, 'y': i.c.y, 'w': i.c.w, 'h': i.c.h } };
|
||||
op[n] = { 'c': { 'x': i.c.x, 'y': i.c.y, 'w': i.c.w, 'h': i.c.h, 'r': i.c.r } };
|
||||
} else if ( i.hasOwnProperty('r') ) {
|
||||
op[n] = { 'r': i.r.r };
|
||||
} else if ( i.hasOwnProperty('f') ) {
|
||||
@@ -860,6 +880,7 @@
|
||||
if ( 'undefined' === typeof this.hold.sizer ) {
|
||||
this.init( postid );
|
||||
}
|
||||
this.calculateImgSize( postid );
|
||||
|
||||
this.initCrop(postid, img, parent);
|
||||
this.setCropSelection( postid, { 'x1': 0, 'y1': 0, 'x2': 0, 'y2': 0, 'width': img.innerWidth(), 'height': img.innerHeight() } );
|
||||
@@ -909,8 +930,6 @@
|
||||
var t = this,
|
||||
selW = $('#imgedit-sel-width-' + postid),
|
||||
selH = $('#imgedit-sel-height-' + postid),
|
||||
selX = $('#imgedit-start-x-' + postid),
|
||||
selY = $('#imgedit-start-y-' + postid),
|
||||
$image = $( image ),
|
||||
$img;
|
||||
|
||||
@@ -945,13 +964,16 @@
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
parent.children().on( 'mousedown, touchstart', function(e){
|
||||
var ratio = false, sel, defRatio;
|
||||
parent.children().on( 'mousedown touchstart', function(e) {
|
||||
var ratio = false,
|
||||
sel = t.iasapi.getSelection(),
|
||||
cx = t.intval( $( '#imgedit-crop-width-' + postid ).val() ),
|
||||
cy = t.intval( $( '#imgedit-crop-height-' + postid ).val() );
|
||||
|
||||
if ( e.shiftKey ) {
|
||||
sel = t.iasapi.getSelection();
|
||||
defRatio = t.getSelRatio(postid);
|
||||
ratio = ( sel && sel.width && sel.height ) ? sel.width + ':' + sel.height : defRatio;
|
||||
if ( cx && cy ) {
|
||||
ratio = t.getSelRatio( postid );
|
||||
} else if ( e.shiftKey && sel && sel.width && sel.height ) {
|
||||
ratio = sel.width + ':' + sel.height;
|
||||
}
|
||||
|
||||
t.iasapi.setOptions({
|
||||
@@ -1000,11 +1022,17 @@
|
||||
* @return {void}
|
||||
*/
|
||||
onSelectChange: function(img, c) {
|
||||
var sizer = imageEdit.hold.sizer;
|
||||
selW.val( imageEdit.round(c.width / sizer) );
|
||||
selH.val( imageEdit.round(c.height / sizer) );
|
||||
selX.val( imageEdit.round(c.x1 / sizer) );
|
||||
selY.val( imageEdit.round(c.y1 / sizer) );
|
||||
var sizer = imageEdit.hold.sizer,
|
||||
oldSel = imageEdit.currentCropSelection;
|
||||
|
||||
if ( oldSel != null && oldSel.width == c.width && oldSel.height == c.height ) {
|
||||
return;
|
||||
}
|
||||
|
||||
selW.val( Math.min( imageEdit.hold.w, imageEdit.round( c.width / sizer ) ) );
|
||||
selH.val( Math.min( imageEdit.hold.h, imageEdit.round( c.height / sizer ) ) );
|
||||
|
||||
t.currentCropSelection = c;
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -1022,7 +1050,11 @@
|
||||
* @return {boolean}
|
||||
*/
|
||||
setCropSelection : function(postid, c) {
|
||||
var sel;
|
||||
var sel,
|
||||
selW = $( '#imgedit-sel-width-' + postid ),
|
||||
selH = $( '#imgedit-sel-height-' + postid ),
|
||||
sizer = this.hold.sizer,
|
||||
hold = this.hold;
|
||||
|
||||
c = c || 0;
|
||||
|
||||
@@ -1037,7 +1069,15 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
sel = { 'x': c.x1, 'y': c.y1, 'w': c.width, 'h': c.height };
|
||||
// adjust the selection within the bounds of the image on 100% scale
|
||||
var excessW = hold.w - ( Math.round( c.x1 / sizer ) + parseInt( selW.val() ) );
|
||||
var excessH = hold.h - ( Math.round( c.y1 / sizer ) + parseInt( selH.val() ) );
|
||||
var x = Math.round( c.x1 / sizer ) + Math.min( 0, excessW );
|
||||
var y = Math.round( c.y1 / sizer ) + Math.min( 0, excessH );
|
||||
|
||||
// use 100% scaling to prevent rounding errors
|
||||
sel = { 'r': 1, 'x': x, 'y': y, 'w': selW.val(), 'h': selH.val() };
|
||||
|
||||
this.setDisabled($('.imgedit-crop', '#imgedit-panel-' + postid), 1);
|
||||
$('#imgedit-selection-' + postid).val( JSON.stringify(sel) );
|
||||
},
|
||||
@@ -1165,6 +1205,11 @@
|
||||
}
|
||||
this.closePopup(t);
|
||||
this.addStep({ 'r': { 'r': angle, 'fw': this.hold.h, 'fh': this.hold.w }}, postid, nonce);
|
||||
|
||||
// Clear the selection fields after rotating.
|
||||
$( '#imgedit-sel-width-' + postid ).val( '' );
|
||||
$( '#imgedit-sel-height-' + postid ).val( '' );
|
||||
this.currentCropSelection = null;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1187,6 +1232,11 @@
|
||||
}
|
||||
this.closePopup(t);
|
||||
this.addStep({ 'f': { 'f': axis, 'fw': this.hold.w, 'fh': this.hold.h }}, postid, nonce);
|
||||
|
||||
// Clear the selection fields after flipping.
|
||||
$( '#imgedit-sel-width-' + postid ).val( '' );
|
||||
$( '#imgedit-sel-height-' + postid ).val( '' );
|
||||
this.currentCropSelection = null;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1219,10 +1269,11 @@
|
||||
}
|
||||
|
||||
// Clear the selection fields after cropping.
|
||||
$('#imgedit-sel-width-' + postid).val('');
|
||||
$('#imgedit-sel-height-' + postid).val('');
|
||||
$('#imgedit-start-x-' + postid).val('0');
|
||||
$('#imgedit-start-y-' + postid).val('0');
|
||||
$( '#imgedit-sel-width-' + postid ).val( '' );
|
||||
$( '#imgedit-sel-height-' + postid ).val( '' );
|
||||
$( '#imgedit-start-x-' + postid ).val( '0' );
|
||||
$( '#imgedit-start-y-' + postid ).val( '0' );
|
||||
this.currentCropSelection = null;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1312,6 +1363,8 @@
|
||||
img = $('#image-preview-' + postid), imgh = img.height(), imgw = img.width(),
|
||||
sizer = this.hold.sizer, x1, y1, x2, y2, ias = this.iasapi;
|
||||
|
||||
this.currentCropSelection = null;
|
||||
|
||||
if ( false === this.validateNumeric( el ) ) {
|
||||
return;
|
||||
}
|
||||
@@ -1335,18 +1388,19 @@
|
||||
if ( x2 > imgw ) {
|
||||
x1 = 0;
|
||||
x2 = imgw;
|
||||
elX.val( Math.round( x2 / sizer ) );
|
||||
elX.val( Math.min( this.hold.w, Math.round( x2 / sizer ) ) );
|
||||
}
|
||||
|
||||
if ( y2 > imgh ) {
|
||||
y1 = 0;
|
||||
y2 = imgh;
|
||||
elY.val( Math.round( y2 / sizer ) );
|
||||
elY.val( Math.min( this.hold.h, Math.round( y2 / sizer ) ) );
|
||||
}
|
||||
|
||||
ias.setSelection( x1, y1, x2, y2 );
|
||||
ias.update();
|
||||
this.setCropSelection(postid, ias.getSelection());
|
||||
this.currentCropSelection = ias.getSelection();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -128,8 +128,16 @@ window.wp = window.wp || {};
|
||||
inlineEditPost.edit( this );
|
||||
});
|
||||
|
||||
// Clone quick edit categories for the bulk editor.
|
||||
var beCategories = $( '#inline-edit fieldset.inline-edit-categories' ).clone();
|
||||
|
||||
// Make "id" attributes globally unique.
|
||||
beCategories.find( '*[id]' ).each( function() {
|
||||
this.id = 'bulk-edit-' + this.id;
|
||||
});
|
||||
|
||||
$('#bulk-edit').find('fieldset:first').after(
|
||||
$('#inline-edit fieldset.inline-edit-categories').clone()
|
||||
beCategories
|
||||
).siblings( 'fieldset:last' ).prepend(
|
||||
$( '#inline-edit .inline-edit-tags-wrap' ).clone()
|
||||
);
|
||||
@@ -140,7 +148,12 @@ window.wp = window.wp || {};
|
||||
* Adds onclick events to the apply buttons.
|
||||
*/
|
||||
$('#doaction').on( 'click', function(e){
|
||||
var n;
|
||||
var n,
|
||||
$itemsSelected = $( '#posts-filter .check-column input[type="checkbox"]:checked' );
|
||||
|
||||
if ( $itemsSelected.length < 1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
t.whichBulkButtonId = $( this ).attr( 'id' );
|
||||
n = t.whichBulkButtonId.substr( 2 );
|
||||
@@ -242,7 +255,7 @@ window.wp = window.wp || {};
|
||||
if ( ! $( this ).parent().find( 'input[name="indeterminate_post_category[]"]' ).length ) {
|
||||
// Get the term label text.
|
||||
var label = $( this ).parent().text();
|
||||
// Set indeterminate states for the backend. Add accessible text for indeterminate inputs.
|
||||
// Set indeterminate states for the backend. Add accessible text for indeterminate inputs.
|
||||
$( this ).after( '<input type="hidden" name="indeterminate_post_category[]" value="' + $( this ).val() + '">' ).attr( 'aria-label', label.trim() + ': ' + wp.i18n.__( 'Some selected posts have this category' ) );
|
||||
}
|
||||
}
|
||||
@@ -595,9 +608,9 @@ $( function() { inlineEditPost.init(); } );
|
||||
// Show/hide locks on posts.
|
||||
$( function() {
|
||||
|
||||
// Set the heartbeat interval to 15 seconds.
|
||||
// Set the heartbeat interval to 10 seconds.
|
||||
if ( typeof wp !== 'undefined' && wp.heartbeat ) {
|
||||
wp.heartbeat.interval( 15 );
|
||||
wp.heartbeat.interval( 10 );
|
||||
}
|
||||
}).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) {
|
||||
var locked = data['wp-check-locked-posts'] || {};
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+11
-1
@@ -144,7 +144,8 @@
|
||||
var settings,
|
||||
$mediaGridWrap = $( '#wp-media-grid' ),
|
||||
copyAttachmentURLClipboard = new ClipboardJS( '.copy-attachment-url.media-library' ),
|
||||
copyAttachmentURLSuccessTimeout;
|
||||
copyAttachmentURLSuccessTimeout,
|
||||
previousSuccessElement = null;
|
||||
|
||||
// Opens a manage media frame into the grid.
|
||||
if ( $mediaGridWrap.length && window.wp && window.wp.media ) {
|
||||
@@ -224,6 +225,11 @@
|
||||
// Clear the selection and move focus back to the trigger.
|
||||
event.clearSelection();
|
||||
|
||||
// Checking if the previousSuccessElement is present, adding the hidden class to it.
|
||||
if ( previousSuccessElement ) {
|
||||
previousSuccessElement.addClass( 'hidden' );
|
||||
}
|
||||
|
||||
// Show success visual feedback.
|
||||
clearTimeout( copyAttachmentURLSuccessTimeout );
|
||||
successElement.removeClass( 'hidden' );
|
||||
@@ -231,8 +237,12 @@
|
||||
// Hide success visual feedback after 3 seconds since last success and unfocus the trigger.
|
||||
copyAttachmentURLSuccessTimeout = setTimeout( function() {
|
||||
successElement.addClass( 'hidden' );
|
||||
// No need to store the previous success element further.
|
||||
previousSuccessElement = null;
|
||||
}, 3000 );
|
||||
|
||||
previousSuccessElement = successElement;
|
||||
|
||||
// Handle success audible feedback.
|
||||
wp.a11y.speak( wp.i18n.__( 'The file URL has been copied to your clipboard' ) );
|
||||
} );
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(s){window.findPosts={open:function(n,e){var i=s(".ui-find-overlay");return 0===i.length&&(s("body").append('<div class="ui-find-overlay"></div>'),findPosts.overlay()),i.show(),n&&e&&s("#affected").attr("name",n).val(e),s("#find-posts").show(),s("#find-posts-input").trigger("focus").on("keyup",function(n){27==n.which&&findPosts.close()}),findPosts.send(),!1},close:function(){s("#find-posts-response").empty(),s("#find-posts").hide(),s(".ui-find-overlay").hide()},overlay:function(){s(".ui-find-overlay").on("click",function(){findPosts.close()})},send:function(){var n={ps:s("#find-posts-input").val(),action:"find_posts",_ajax_nonce:s("#_ajax_nonce").val()},e=s(".find-box-search .spinner");e.addClass("is-active"),s.ajax(ajaxurl,{type:"POST",data:n,dataType:"json"}).always(function(){e.removeClass("is-active")}).done(function(n){n.success||s("#find-posts-response").text(wp.i18n.__("An error has occurred. Please reload the page and try again.")),s("#find-posts-response").html(n.data)}).fail(function(){s("#find-posts-response").text(wp.i18n.__("An error has occurred. Please reload the page and try again."))})}},s(function(){var o,n,e=s("#wp-media-grid"),i=new ClipboardJS(".copy-attachment-url.media-library");e.length&&window.wp&&window.wp.media&&(n=_wpMediaGridSettings,n=window.wp.media({frame:"manage",container:e,library:n.queryVars}).open(),e.trigger("wp-media-grid-ready",n)),s("#find-posts-submit").on("click",function(n){s('#find-posts-response input[type="radio"]:checked').length||n.preventDefault()}),s("#find-posts .find-box-search :input").on("keypress",function(n){if(13==n.which)return findPosts.send(),!1}),s("#find-posts-search").on("click",findPosts.send),s("#find-posts-close").on("click",findPosts.close),s("#doaction").on("click",function(e){s('select[name="action"]').each(function(){var n=s(this).val();"attach"===n?(e.preventDefault(),findPosts.open()):"delete"!==n||showNotice.warn()||e.preventDefault()})}),s(".find-box-inside").on("click","tr",function(){s(this).find(".found-radio input").prop("checked",!0)}),i.on("success",function(n){var e=s(n.trigger),i=s(".success",e.closest(".copy-to-clipboard-container"));n.clearSelection(),clearTimeout(o),i.removeClass("hidden"),o=setTimeout(function(){i.addClass("hidden")},3e3),wp.a11y.speak(wp.i18n.__("The file URL has been copied to your clipboard"))})})}(jQuery);
|
||||
!function(t){window.findPosts={open:function(n,e){var i=t(".ui-find-overlay");return 0===i.length&&(t("body").append('<div class="ui-find-overlay"></div>'),findPosts.overlay()),i.show(),n&&e&&t("#affected").attr("name",n).val(e),t("#find-posts").show(),t("#find-posts-input").trigger("focus").on("keyup",function(n){27==n.which&&findPosts.close()}),findPosts.send(),!1},close:function(){t("#find-posts-response").empty(),t("#find-posts").hide(),t(".ui-find-overlay").hide()},overlay:function(){t(".ui-find-overlay").on("click",function(){findPosts.close()})},send:function(){var n={ps:t("#find-posts-input").val(),action:"find_posts",_ajax_nonce:t("#_ajax_nonce").val()},e=t(".find-box-search .spinner");e.addClass("is-active"),t.ajax(ajaxurl,{type:"POST",data:n,dataType:"json"}).always(function(){e.removeClass("is-active")}).done(function(n){n.success||t("#find-posts-response").text(wp.i18n.__("An error has occurred. Please reload the page and try again.")),t("#find-posts-response").html(n.data)}).fail(function(){t("#find-posts-response").text(wp.i18n.__("An error has occurred. Please reload the page and try again."))})}},t(function(){var o,n,e=t("#wp-media-grid"),i=new ClipboardJS(".copy-attachment-url.media-library"),s=null;e.length&&window.wp&&window.wp.media&&(n=_wpMediaGridSettings,n=window.wp.media({frame:"manage",container:e,library:n.queryVars}).open(),e.trigger("wp-media-grid-ready",n)),t("#find-posts-submit").on("click",function(n){t('#find-posts-response input[type="radio"]:checked').length||n.preventDefault()}),t("#find-posts .find-box-search :input").on("keypress",function(n){if(13==n.which)return findPosts.send(),!1}),t("#find-posts-search").on("click",findPosts.send),t("#find-posts-close").on("click",findPosts.close),t("#doaction").on("click",function(e){t('select[name="action"]').each(function(){var n=t(this).val();"attach"===n?(e.preventDefault(),findPosts.open()):"delete"!==n||showNotice.warn()||e.preventDefault()})}),t(".find-box-inside").on("click","tr",function(){t(this).find(".found-radio input").prop("checked",!0)}),i.on("success",function(n){var e=t(n.trigger),i=t(".success",e.closest(".copy-to-clipboard-container"));n.clearSelection(),s&&s.addClass("hidden"),clearTimeout(o),i.removeClass("hidden"),o=setTimeout(function(){i.addClass("hidden"),s=null},3e3),s=i,wp.a11y.speak(wp.i18n.__("The file URL has been copied to your clipboard"))})})}(jQuery);
|
||||
+226
-1
@@ -216,6 +216,8 @@
|
||||
checkboxes.prop( 'checked', false );
|
||||
t.find( '.button-controls .select-all' ).prop( 'checked', false );
|
||||
t.find( '.button-controls .spinner' ).removeClass( 'is-active' );
|
||||
t.updateParentDropdown();
|
||||
t.updateOrderDropdown();
|
||||
});
|
||||
});
|
||||
},
|
||||
@@ -288,6 +290,105 @@
|
||||
});
|
||||
});
|
||||
return this;
|
||||
},
|
||||
updateParentDropdown : function() {
|
||||
return this.each(function(){
|
||||
var menuItems = $( '#menu-to-edit li' ),
|
||||
parentDropdowns = $( '.edit-menu-item-parent' );
|
||||
|
||||
$.each( parentDropdowns, function() {
|
||||
var parentDropdown = $( this ),
|
||||
$html = '',
|
||||
$selected = '',
|
||||
currentItemID = parentDropdown.closest( 'li.menu-item' ).find( '.menu-item-data-db-id' ).val(),
|
||||
currentparentID = parentDropdown.closest( 'li.menu-item' ).find( '.menu-item-data-parent-id' ).val(),
|
||||
currentItem = parentDropdown.closest( 'li.menu-item' ),
|
||||
currentMenuItemChild = currentItem.childMenuItems(),
|
||||
excludeMenuItem = [ currentItemID ];
|
||||
|
||||
if ( currentMenuItemChild.length > 0 ) {
|
||||
$.each( currentMenuItemChild, function(){
|
||||
var childItem = $(this),
|
||||
childID = childItem.find( '.menu-item-data-db-id' ).val();
|
||||
|
||||
excludeMenuItem.push( childID );
|
||||
});
|
||||
}
|
||||
|
||||
if ( currentparentID == 0 ) {
|
||||
$selected = 'selected';
|
||||
}
|
||||
|
||||
$html += '<option ' + $selected + ' value="0">No Parent</option>';
|
||||
|
||||
$.each( menuItems, function() {
|
||||
var menuItem = $(this),
|
||||
$selected = '',
|
||||
menuID = menuItem.find( '.menu-item-data-db-id' ).val(),
|
||||
menuTitle = menuItem.find( '.edit-menu-item-title' ).val();
|
||||
|
||||
if ( ! excludeMenuItem.includes( menuID ) ) {
|
||||
if ( currentparentID == menuID ) {
|
||||
$selected = 'selected';
|
||||
}
|
||||
$html += '<option ' + $selected + ' value="' + menuID + '">' + menuTitle + '</option>';
|
||||
}
|
||||
});
|
||||
|
||||
parentDropdown.html( $html );
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
updateOrderDropdown : function() {
|
||||
return this.each( function() {
|
||||
var itemPosition,
|
||||
orderDropdowns = $( '.edit-menu-item-order' );
|
||||
|
||||
$.each( orderDropdowns, function() {
|
||||
var orderDropdown = $( this ),
|
||||
menuItem = orderDropdown.closest( 'li.menu-item' ).first(),
|
||||
depth = menuItem.menuItemDepth(),
|
||||
isPrimaryMenuItem = ( 0 === depth ),
|
||||
$html = '',
|
||||
$selected = '';
|
||||
|
||||
if ( isPrimaryMenuItem ) {
|
||||
var primaryItems = $( '.menu-item-depth-0' ),
|
||||
totalMenuItems = primaryItems.length;
|
||||
|
||||
itemPosition = primaryItems.index( menuItem ) + 1;
|
||||
|
||||
for ( let i = 1; i < totalMenuItems + 1; i++ ) {
|
||||
$selected = '';
|
||||
if ( i == itemPosition ) {
|
||||
$selected = 'selected';
|
||||
}
|
||||
$html += '<option ' + $selected + ' value="' + i + '">' + i + ' of ' + totalMenuItems + '</option>';
|
||||
}
|
||||
|
||||
} else {
|
||||
var parentItem = menuItem.prevAll( '.menu-item-depth-' + parseInt( depth - 1, 10 ) ).first(),
|
||||
parentItemId = parentItem.find( '.menu-item-data-db-id' ).val(),
|
||||
subItems = $( '.menu-item .menu-item-data-parent-id[value="' + parentItemId + '"]' ),
|
||||
totalSubMenuItems = subItems.length;
|
||||
|
||||
itemPosition = $( subItems.parents('.menu-item').get().reverse() ).index( menuItem ) + 1;
|
||||
|
||||
for ( let i = 1; i < totalSubMenuItems + 1; i++ ) {
|
||||
$selected = '';
|
||||
if ( i == itemPosition ) {
|
||||
$selected = 'selected';
|
||||
}
|
||||
$html += '<option ' + $selected + ' value="' + i + '">' + i + ' of ' + totalSubMenuItems + '</option>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
orderDropdown.html( $html );
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -297,7 +398,6 @@
|
||||
},
|
||||
|
||||
moveMenuItem : function( $this, dir ) {
|
||||
|
||||
var items, newItemPosition, newDepth,
|
||||
menuItems = $( '#menu-to-edit li' ),
|
||||
menuItemsCount = menuItems.length,
|
||||
@@ -400,6 +500,8 @@
|
||||
api.registerChange();
|
||||
api.refreshKeyboardAccessibility();
|
||||
api.refreshAdvancedAccessibility();
|
||||
thisItem.updateParentDropdown();
|
||||
thisItem.updateOrderDropdown();
|
||||
|
||||
if ( a11ySpeech ) {
|
||||
wp.a11y.speak( a11ySpeech );
|
||||
@@ -431,6 +533,123 @@
|
||||
api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), dir );
|
||||
}
|
||||
});
|
||||
|
||||
// Set menu parents data for all menu items.
|
||||
menu.updateParentDropdown();
|
||||
|
||||
// Set menu order data for all menu items.
|
||||
menu.updateOrderDropdown();
|
||||
|
||||
// Update menu item parent when value is changed.
|
||||
menu.on( 'change', '.edit-menu-item-parent', function() {
|
||||
api.changeMenuParent( $( this ) );
|
||||
});
|
||||
|
||||
// Update menu item order when value is changed.
|
||||
menu.on( 'change', '.edit-menu-item-order', function() {
|
||||
api.changeMenuOrder( $( this ) );
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* changeMenuParent( [parentDropdown] )
|
||||
*
|
||||
* @since 6.7.0
|
||||
*
|
||||
* @param {object} parentDropdown select field
|
||||
*/
|
||||
changeMenuParent : function( parentDropdown ) {
|
||||
var menuItemNewPosition,
|
||||
menuItems = $( '#menu-to-edit li' ),
|
||||
$this = $( parentDropdown ),
|
||||
newParentID = $this.val(),
|
||||
menuItem = $this.closest( 'li.menu-item' ).first(),
|
||||
menuItemOldDepth = menuItem.menuItemDepth(),
|
||||
menuItemChildren = menuItem.childMenuItems(),
|
||||
menuItemNoChildren = parseInt( menuItem.childMenuItems().length, 10 ),
|
||||
parentItem = $( '#menu-item-' + newParentID ),
|
||||
parentItemDepth = parentItem.menuItemDepth(),
|
||||
menuItemNewDepth = parseInt( parentItemDepth ) + 1;
|
||||
|
||||
if ( newParentID == 0 ) {
|
||||
menuItemNewDepth = 0;
|
||||
}
|
||||
|
||||
menuItem.find( '.menu-item-data-parent-id' ).val( newParentID );
|
||||
menuItem.moveHorizontally( menuItemNewDepth, menuItemOldDepth );
|
||||
|
||||
if ( menuItemNoChildren > 0 ) {
|
||||
menuItem = menuItem.add( menuItemChildren );
|
||||
}
|
||||
menuItem.detach();
|
||||
|
||||
menuItems = $( '#menu-to-edit li' );
|
||||
|
||||
var parentItemPosition = parseInt( parentItem.index(), 10 ),
|
||||
parentItemNoChild = parseInt( parentItem.childMenuItems().length, 10 );
|
||||
|
||||
if ( parentItemNoChild > 0 ){
|
||||
menuItemNewPosition = parentItemPosition + parentItemNoChild;
|
||||
} else {
|
||||
menuItemNewPosition = parentItemPosition;
|
||||
}
|
||||
|
||||
if ( newParentID == 0 ) {
|
||||
menuItemNewPosition = menuItems.length - 1;
|
||||
}
|
||||
|
||||
menuItem.insertAfter( menuItems.eq( menuItemNewPosition ) ).updateParentMenuItemDBId().updateParentDropdown().updateOrderDropdown();
|
||||
|
||||
api.registerChange();
|
||||
api.refreshKeyboardAccessibility();
|
||||
api.refreshAdvancedAccessibility();
|
||||
$this.trigger( 'focus' );
|
||||
wp.a11y.speak( menus.parentUpdated, 'polite' );
|
||||
},
|
||||
|
||||
/**
|
||||
* changeMenuOrder( [OrderDropdown] )
|
||||
*
|
||||
* @since 6.7.0
|
||||
*
|
||||
* @param {object} orderDropdown select field
|
||||
*/
|
||||
changeMenuOrder : function( orderDropdown ) {
|
||||
var menuItems = $( '#menu-to-edit li' ),
|
||||
$this = $( orderDropdown ),
|
||||
newOrderID = parseInt( $this.val(), 10),
|
||||
menuItem = $this.closest( 'li.menu-item' ).first(),
|
||||
menuItemChildren = menuItem.childMenuItems(),
|
||||
menuItemNoChildren = menuItemChildren.length,
|
||||
menuItemCurrentPosition = parseInt( menuItem.index(), 10 ),
|
||||
parentItemID = menuItem.find( '.menu-item-data-parent-id' ).val(),
|
||||
subItems = $( '.menu-item .menu-item-data-parent-id[value="' + parentItemID + '"]' ),
|
||||
currentItemAtPosition = $(subItems[newOrderID - 1]).closest( 'li.menu-item' );
|
||||
|
||||
if ( menuItemNoChildren > 0 ) {
|
||||
menuItem = menuItem.add( menuItemChildren );
|
||||
}
|
||||
|
||||
var currentItemNoChildren = currentItemAtPosition.childMenuItems().length,
|
||||
currentItemPosition = parseInt( currentItemAtPosition.index(), 10 );
|
||||
|
||||
menuItems = $( '#menu-to-edit li' );
|
||||
|
||||
var menuItemNewPosition = currentItemPosition;
|
||||
|
||||
if(menuItemCurrentPosition > menuItemNewPosition){
|
||||
menuItemNewPosition = currentItemPosition;
|
||||
menuItem.detach().insertBefore( menuItems.eq( menuItemNewPosition ) ).updateOrderDropdown();
|
||||
} else {
|
||||
menuItemNewPosition = menuItemNewPosition + currentItemNoChildren;
|
||||
menuItem.detach().insertAfter( menuItems.eq( menuItemNewPosition ) ).updateOrderDropdown();
|
||||
}
|
||||
|
||||
api.registerChange();
|
||||
api.refreshKeyboardAccessibility();
|
||||
api.refreshAdvancedAccessibility();
|
||||
$this.trigger( 'focus' );
|
||||
wp.a11y.speak( menus.orderUpdated, 'polite' );
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -737,6 +956,8 @@
|
||||
|
||||
api.refreshKeyboardAccessibility();
|
||||
api.refreshAdvancedAccessibility();
|
||||
ui.item.updateParentDropdown();
|
||||
ui.item.updateOrderDropdown();
|
||||
api.refreshAdvancedAccessibilityOfItem( ui.item.find( 'a.item-edit' ) );
|
||||
},
|
||||
change: function(e, ui) {
|
||||
@@ -988,6 +1209,8 @@
|
||||
deletionSpeech = menus.itemsDeleted.replace( '%s', itemsPendingDeletion );
|
||||
wp.a11y.speak( deletionSpeech, 'polite' );
|
||||
that.disableBulkSelection();
|
||||
menus.updateParentDropdown();
|
||||
menus.updateOrderDropdown();
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -1527,6 +1750,8 @@
|
||||
}
|
||||
api.refreshAdvancedAccessibility();
|
||||
wp.a11y.speak( menus.itemRemoved );
|
||||
menus.updateParentDropdown();
|
||||
menus.updateOrderDropdown();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+2
-21
@@ -343,9 +343,9 @@ jQuery( function($) {
|
||||
}
|
||||
}).filter(':visible').find('.wp-tab-first').trigger( 'focus' );
|
||||
|
||||
// Set the heartbeat interval to 15 seconds if post lock dialogs are enabled.
|
||||
// Set the heartbeat interval to 10 seconds if post lock dialogs are enabled.
|
||||
if ( wp.heartbeat && $('#post-lock-dialog').length ) {
|
||||
wp.heartbeat.interval( 15 );
|
||||
wp.heartbeat.interval( 10 );
|
||||
}
|
||||
|
||||
// The form is being submitted by the user.
|
||||
@@ -434,25 +434,6 @@ jQuery( function($) {
|
||||
$previewField.val('');
|
||||
});
|
||||
|
||||
// This code is meant to allow tabbing from Title to Post content.
|
||||
$('#title').on( 'keydown.editor-focus', function( event ) {
|
||||
var editor;
|
||||
|
||||
if ( event.keyCode === 9 && ! event.ctrlKey && ! event.altKey && ! event.shiftKey ) {
|
||||
editor = typeof tinymce != 'undefined' && tinymce.get('content');
|
||||
|
||||
if ( editor && ! editor.isHidden() ) {
|
||||
editor.focus();
|
||||
} else if ( $textarea.length ) {
|
||||
$textarea.trigger( 'focus' );
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// Auto save new posts after a title is typed.
|
||||
if ( $( '#auto_draft' ).val() ) {
|
||||
$( '#title' ).on( 'blur', function() {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -595,13 +595,13 @@ window.wp = window.wp || {};
|
||||
initialize: function() {
|
||||
_.bindAll( this, 'setWidth' );
|
||||
|
||||
// Add the button view.
|
||||
this.views.add( new revisions.view.Buttons({
|
||||
// Add the checkbox view.
|
||||
this.views.add( new revisions.view.Checkbox({
|
||||
model: this.model
|
||||
}) );
|
||||
|
||||
// Add the checkbox view.
|
||||
this.views.add( new revisions.view.Checkbox({
|
||||
// Add the button view.
|
||||
this.views.add( new revisions.view.Buttons({
|
||||
model: this.model
|
||||
}) );
|
||||
|
||||
@@ -628,6 +628,9 @@ window.wp = window.wp || {};
|
||||
model: tooltip
|
||||
}) );
|
||||
|
||||
// Add the visually hidden slider help view.
|
||||
this.views.add( new revisions.view.SliderHelp() );
|
||||
|
||||
// Add the slider view.
|
||||
this.views.add( new revisions.view.Slider({
|
||||
model: slider
|
||||
@@ -804,6 +807,12 @@ window.wp = window.wp || {};
|
||||
}
|
||||
});
|
||||
|
||||
// The slider visually hidden help view.
|
||||
revisions.view.SliderHelp = wp.Backbone.View.extend({
|
||||
className: 'revisions-slider-hidden-help',
|
||||
template: wp.template( 'revisions-slider-hidden-help' )
|
||||
});
|
||||
|
||||
// The tooltip view.
|
||||
// Encapsulates the tooltip.
|
||||
revisions.view.Tooltip = wp.Backbone.View.extend({
|
||||
@@ -957,6 +966,20 @@ window.wp = window.wp || {};
|
||||
this.applySliderSettings();
|
||||
},
|
||||
|
||||
accessibilityHelper: function() {
|
||||
var handles = $( '.ui-slider-handle' );
|
||||
handles.first().attr( {
|
||||
role: 'button',
|
||||
'aria-labelledby': 'diff-title-from diff-title-author',
|
||||
'aria-describedby': 'revisions-slider-hidden-help',
|
||||
} );
|
||||
handles.last().attr( {
|
||||
role: 'button',
|
||||
'aria-labelledby': 'diff-title-to diff-title-author',
|
||||
'aria-describedby': 'revisions-slider-hidden-help',
|
||||
} );
|
||||
},
|
||||
|
||||
mouseMove: function( e ) {
|
||||
var zoneCount = this.model.revisions.length - 1, // One fewer zone than models.
|
||||
sliderFrom = this.$el.allOffsets()[this.direction], // "From" edge of slider.
|
||||
@@ -996,9 +1019,12 @@ window.wp = window.wp || {};
|
||||
handles.last()
|
||||
.toggleClass( 'from-handle', !! isRtl )
|
||||
.toggleClass( 'to-handle', ! isRtl );
|
||||
this.accessibilityHelper();
|
||||
} else {
|
||||
handles.removeClass('from-handle to-handle');
|
||||
this.accessibilityHelper();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
start: function( event, ui ) {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -188,6 +188,12 @@
|
||||
$iconPreview.removeClass( 'hidden' );
|
||||
$removeButton.removeClass( 'hidden' );
|
||||
|
||||
// Set the global CSS variable for --site-icon-url to the selected image URL.
|
||||
document.documentElement.style.setProperty(
|
||||
'--site-icon-url',
|
||||
'url(' + attributes.url + ')'
|
||||
);
|
||||
|
||||
// If the choose button is not in the update state, swap the classes.
|
||||
if ( $chooseButton.attr( 'data-state' ) !== '1' ) {
|
||||
$chooseButton.attr( {
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(t){var a,i=t("#choose-from-library-button"),s=t("#site-icon-preview"),r=t("#browser-icon-preview"),n=t("#app-icon-preview"),l=t("#site_icon_hidden_field"),o=t("#js-remove-site-icon");function c(t){var e=t.get("width"),t=t.get("height"),a=512,i=512,s=a/i,r=a,n=i;return s<e/t?a=(i=t)*s:i=(a=e)/s,{aspectRatio:a+":"+i,handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:e,imageHeight:t,minWidth:a<r?a:r,minHeight:i<n?i:n,x1:s=(e-a)/2,y1:r=(t-i)/2,x2:a+s,y2:i+r}}function d(t){var e,a=t.alt?(e=wp.i18n.sprintf(wp.i18n.__("App icon preview: Current image: %s"),t.alt),wp.i18n.sprintf(wp.i18n.__("Browser icon preview: Current image: %s"),t.alt)):(e=wp.i18n.sprintf(wp.i18n.__("App icon preview: The current image has no alternative text. The file name is: %s"),t.filename),wp.i18n.sprintf(wp.i18n.__("Browser icon preview: The current image has no alternative text. The file name is: %s"),t.filename));n.attr({src:t.url,alt:e}),r.attr({src:t.url,alt:a}),s.removeClass("hidden"),o.removeClass("hidden"),"1"!==i.attr("data-state")&&i.attr({class:i.attr("data-alt-classes"),"data-alt-classes":i.attr("class"),"data-state":"1"}),i.text(i.attr("data-update-text"))}i.on("click",function(){var e=t(this);(a=wp.media({button:{text:e.data("update"),close:!1},states:[new wp.media.controller.Library({title:e.data("choose-text"),library:wp.media.query({type:"image"}),date:!1,suggestedWidth:e.data("size"),suggestedHeight:e.data("size")}),new wp.media.controller.SiteIconCropper({control:{params:{width:e.data("size"),height:e.data("size")}},imgSelectOptions:c})]})).on("cropped",function(t){l.val(t.id),d(t),a.close(),a=null}),a.on("select",function(){var t=a.state().get("selection").first();t.attributes.height===e.data("size")&&e.data("size")===t.attributes.width?(d(t.attributes),a.close(),l.val(t.id)):a.setState("cropper")}),a.open()}),o.on("click",function(){l.val("false"),t(this).toggleClass("hidden"),s.toggleClass("hidden"),r.attr({src:"",alt:""}),n.attr({src:"",alt:""}),i.attr({class:i.attr("data-alt-classes"),"data-alt-classes":i.attr("class"),"data-state":""}).text(i.attr("data-choose-text")).trigger("focus")})}(jQuery);
|
||||
!function(t){var a,i=t("#choose-from-library-button"),s=t("#site-icon-preview"),r=t("#browser-icon-preview"),n=t("#app-icon-preview"),l=t("#site_icon_hidden_field"),o=t("#js-remove-site-icon");function c(t){var e=t.get("width"),t=t.get("height"),a=512,i=512,s=a/i,r=a,n=i;return s<e/t?a=(i=t)*s:i=(a=e)/s,{aspectRatio:a+":"+i,handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:e,imageHeight:t,minWidth:a<r?a:r,minHeight:i<n?i:n,x1:s=(e-a)/2,y1:r=(t-i)/2,x2:a+s,y2:i+r}}function d(t){var e,a=t.alt?(e=wp.i18n.sprintf(wp.i18n.__("App icon preview: Current image: %s"),t.alt),wp.i18n.sprintf(wp.i18n.__("Browser icon preview: Current image: %s"),t.alt)):(e=wp.i18n.sprintf(wp.i18n.__("App icon preview: The current image has no alternative text. The file name is: %s"),t.filename),wp.i18n.sprintf(wp.i18n.__("Browser icon preview: The current image has no alternative text. The file name is: %s"),t.filename));n.attr({src:t.url,alt:e}),r.attr({src:t.url,alt:a}),s.removeClass("hidden"),o.removeClass("hidden"),document.documentElement.style.setProperty("--site-icon-url","url("+t.url+")"),"1"!==i.attr("data-state")&&i.attr({class:i.attr("data-alt-classes"),"data-alt-classes":i.attr("class"),"data-state":"1"}),i.text(i.attr("data-update-text"))}i.on("click",function(){var e=t(this);(a=wp.media({button:{text:e.data("update"),close:!1},states:[new wp.media.controller.Library({title:e.data("choose-text"),library:wp.media.query({type:"image"}),date:!1,suggestedWidth:e.data("size"),suggestedHeight:e.data("size")}),new wp.media.controller.SiteIconCropper({control:{params:{width:e.data("size"),height:e.data("size")}},imgSelectOptions:c})]})).on("cropped",function(t){l.val(t.id),d(t),a.close(),a=null}),a.on("select",function(){var t=a.state().get("selection").first();t.attributes.height===e.data("size")&&e.data("size")===t.attributes.width?(d(t.attributes),a.close(),l.val(t.id)):a.setState("cropper")}),a.open()}),o.on("click",function(){l.val("false"),t(this).toggleClass("hidden"),s.toggleClass("hidden"),r.attr({src:"",alt:""}),n.attr({src:"",alt:""}),i.attr({class:i.attr("data-alt-classes"),"data-alt-classes":i.attr("class"),"data-state":""}).text(i.attr("data-choose-text")).trigger("focus")})}(jQuery);
|
||||
@@ -8,123 +8,22 @@ window.wp = window.wp || {};
|
||||
|
||||
wp.svgPainter = ( function( $, window, document, undefined ) {
|
||||
'use strict';
|
||||
var selector, base64, painter,
|
||||
var selector, painter,
|
||||
colorscheme = {},
|
||||
elements = [];
|
||||
|
||||
$( function() {
|
||||
// Detection for browser SVG capability.
|
||||
if ( document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' ) ) {
|
||||
$( document.body ).removeClass( 'no-svg' ).addClass( 'svg' );
|
||||
wp.svgPainter.init();
|
||||
}
|
||||
wp.svgPainter.init();
|
||||
});
|
||||
|
||||
/**
|
||||
* Needed only for IE9
|
||||
*
|
||||
* Based on jquery.base64.js 0.0.3 - https://github.com/yckart/jquery.base64.js
|
||||
*
|
||||
* Based on: https://gist.github.com/Yaffle/1284012
|
||||
*
|
||||
* Copyright (c) 2012 Yannick Albert (http://yckart.com)
|
||||
* Licensed under the MIT license
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
base64 = ( function() {
|
||||
var c,
|
||||
b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
|
||||
a256 = '',
|
||||
r64 = [256],
|
||||
r256 = [256],
|
||||
i = 0;
|
||||
|
||||
function init() {
|
||||
while( i < 256 ) {
|
||||
c = String.fromCharCode(i);
|
||||
a256 += c;
|
||||
r256[i] = i;
|
||||
r64[i] = b64.indexOf(c);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
function code( s, discard, alpha, beta, w1, w2 ) {
|
||||
var tmp, length,
|
||||
buffer = 0,
|
||||
i = 0,
|
||||
result = '',
|
||||
bitsInBuffer = 0;
|
||||
|
||||
s = String(s);
|
||||
length = s.length;
|
||||
|
||||
while( i < length ) {
|
||||
c = s.charCodeAt(i);
|
||||
c = c < 256 ? alpha[c] : -1;
|
||||
|
||||
buffer = ( buffer << w1 ) + c;
|
||||
bitsInBuffer += w1;
|
||||
|
||||
while( bitsInBuffer >= w2 ) {
|
||||
bitsInBuffer -= w2;
|
||||
tmp = buffer >> bitsInBuffer;
|
||||
result += beta.charAt(tmp);
|
||||
buffer ^= tmp << bitsInBuffer;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
if ( ! discard && bitsInBuffer > 0 ) {
|
||||
result += beta.charAt( buffer << ( w2 - bitsInBuffer ) );
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function btoa( plain ) {
|
||||
if ( ! c ) {
|
||||
init();
|
||||
}
|
||||
|
||||
plain = code( plain, false, r256, b64, 8, 6 );
|
||||
return plain + '===='.slice( ( plain.length % 4 ) || 4 );
|
||||
}
|
||||
|
||||
function atob( coded ) {
|
||||
var i;
|
||||
|
||||
if ( ! c ) {
|
||||
init();
|
||||
}
|
||||
|
||||
coded = coded.replace( /[^A-Za-z0-9\+\/\=]/g, '' );
|
||||
coded = String(coded).split('=');
|
||||
i = coded.length;
|
||||
|
||||
do {
|
||||
--i;
|
||||
coded[i] = code( coded[i], true, r64, a256, 6, 8 );
|
||||
} while ( i > 0 );
|
||||
|
||||
coded = coded.join('');
|
||||
return coded;
|
||||
}
|
||||
|
||||
return {
|
||||
atob: atob,
|
||||
btoa: btoa
|
||||
};
|
||||
})();
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
painter = this;
|
||||
selector = $( '#adminmenu .wp-menu-image, #wpadminbar .ab-item' );
|
||||
|
||||
this.setColors();
|
||||
this.findElements();
|
||||
this.paint();
|
||||
painter.setColors();
|
||||
painter.findElements();
|
||||
painter.paint();
|
||||
},
|
||||
|
||||
setColors: function( colors ) {
|
||||
@@ -201,11 +100,7 @@ wp.svgPainter = ( function( $, window, document, undefined ) {
|
||||
}
|
||||
|
||||
try {
|
||||
if ( 'atob' in window ) {
|
||||
xml = window.atob( encoded[1] );
|
||||
} else {
|
||||
xml = base64.atob( encoded[1] );
|
||||
}
|
||||
xml = window.atob( encoded[1] );
|
||||
} catch ( error ) {}
|
||||
|
||||
if ( xml ) {
|
||||
@@ -218,11 +113,7 @@ wp.svgPainter = ( function( $, window, document, undefined ) {
|
||||
// Replace `fill` properties in `<style>` tags.
|
||||
xml = xml.replace( /fill:.*?;/g, 'fill: ' + color + ';');
|
||||
|
||||
if ( 'btoa' in window ) {
|
||||
xml = window.btoa( xml );
|
||||
} else {
|
||||
xml = base64.btoa( xml );
|
||||
}
|
||||
xml = window.btoa( xml );
|
||||
|
||||
$element.data( 'wp-ui-svg-' + color, xml );
|
||||
} else {
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
window.wp=window.wp||{},wp.svgPainter=function(e,i,n){"use strict";var t,o,a,m,r,s,c,u,l,f={},g=[];function p(){for(;l<256;)m=String.fromCharCode(l),s+=m,u[l]=l,c[l]=r.indexOf(m),++l}function d(n,t,e,a,i,o){for(var r,s=0,c=0,u="",l=0,f=(n=String(n)).length;c<f;){for(s=(s<<i)+(m=(m=n.charCodeAt(c))<256?e[m]:-1),l+=i;o<=l;)l-=o,u+=a.charAt(r=s>>l),s^=r<<l;++c}return!t&&0<l&&(u+=a.charAt(s<<o-l)),u}return e(function(){n.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1")&&(e(n.body).removeClass("no-svg").addClass("svg"),wp.svgPainter.init())}),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s="",c=[256],u=[256],l=0,o={atob:function(n){var t;for(m||p(),n=n.replace(/[^A-Za-z0-9\+\/\=]/g,""),t=(n=String(n).split("=")).length;n[--t]=d(n[t],!0,c,s,6,8),0<t;);return n=n.join("")},btoa:function(n){return m||p(),(n=d(n,!1,u,r,8,6))+"====".slice(n.length%4||4)}},{init:function(){a=this,t=e("#adminmenu .wp-menu-image, #wpadminbar .ab-item"),this.setColors(),this.findElements(),this.paint()},setColors:function(n){(n=void 0===n&&void 0!==i._wpColorScheme?i._wpColorScheme:n)&&n.icons&&n.icons.base&&n.icons.current&&n.icons.focus&&(f=n.icons)},findElements:function(){t.each(function(){var n=e(this),t=n.css("background-image");t&&-1!=t.indexOf("data:image/svg+xml;base64")&&g.push(n)})},paint:function(){e.each(g,function(n,t){var e=t.parent().parent();e.hasClass("current")||e.hasClass("wp-has-current-submenu")?a.paintElement(t,"current"):(a.paintElement(t,"base"),e.on("mouseenter",function(){a.paintElement(t,"focus")}).on("mouseleave",function(){i.setTimeout(function(){a.paintElement(t,"base")},100)}))})},paintElement:function(n,t){var e,a;if(t&&f.hasOwnProperty(t)&&(t=f[t]).match(/^(#[0-9a-f]{3}|#[0-9a-f]{6})$/i)&&"none"!==(e=n.data("wp-ui-svg-"+t))){if(!e){if(!(a=n.css("background-image").match(/.+data:image\/svg\+xml;base64,([A-Za-z0-9\+\/\=]+)/))||!a[1])return void n.data("wp-ui-svg-"+t,"none");try{e=("atob"in i?i:o).atob(a[1])}catch(n){}if(!e)return void n.data("wp-ui-svg-"+t,"none");e=(e=(e=e.replace(/fill="(.+?)"/g,'fill="'+t+'"')).replace(/style="(.+?)"/g,'style="fill:'+t+'"')).replace(/fill:.*?;/g,"fill: "+t+";"),e=("btoa"in i?i:o).btoa(e),n.data("wp-ui-svg-"+t,e)}n.attr("style",'background-image: url("data:image/svg+xml;base64,'+e+'") !important;')}}}}(jQuery,window,document);
|
||||
window.wp=window.wp||{},wp.svgPainter=function(a,i){"use strict";var n,t,s={},o=[];return a(function(){wp.svgPainter.init()}),{init:function(){t=this,n=a("#adminmenu .wp-menu-image, #wpadminbar .ab-item"),t.setColors(),t.findElements(),t.paint()},setColors:function(n){(n=void 0===n&&void 0!==i._wpColorScheme?i._wpColorScheme:n)&&n.icons&&n.icons.base&&n.icons.current&&n.icons.focus&&(s=n.icons)},findElements:function(){n.each(function(){var n=a(this),e=n.css("background-image");e&&-1!=e.indexOf("data:image/svg+xml;base64")&&o.push(n)})},paint:function(){a.each(o,function(n,e){var a=e.parent().parent();a.hasClass("current")||a.hasClass("wp-has-current-submenu")?t.paintElement(e,"current"):(t.paintElement(e,"base"),a.on("mouseenter",function(){t.paintElement(e,"focus")}).on("mouseleave",function(){i.setTimeout(function(){t.paintElement(e,"base")},100)}))})},paintElement:function(n,e){var a,t;if(e&&s.hasOwnProperty(e)&&(e=s[e]).match(/^(#[0-9a-f]{3}|#[0-9a-f]{6})$/i)&&"none"!==(a=n.data("wp-ui-svg-"+e))){if(!a){if(!(t=n.css("background-image").match(/.+data:image\/svg\+xml;base64,([A-Za-z0-9\+\/\=]+)/))||!t[1])return void n.data("wp-ui-svg-"+e,"none");try{a=i.atob(t[1])}catch(n){}if(!a)return void n.data("wp-ui-svg-"+e,"none");a=(a=(a=a.replace(/fill="(.+?)"/g,'fill="'+e+'"')).replace(/style="(.+?)"/g,'style="fill:'+e+'"')).replace(/fill:.*?;/g,"fill: "+e+";"),a=i.btoa(a),n.data("wp-ui-svg-"+e,a)}n.attr("style",'background-image: url("data:image/svg+xml;base64,'+a+'") !important;')}}}}(jQuery,window,document);
|
||||
+40
-10
@@ -141,6 +141,15 @@
|
||||
*/
|
||||
wp.updates.searchTerm = '';
|
||||
|
||||
/**
|
||||
* Minimum number of characters before an ajax search is fired.
|
||||
*
|
||||
* @since 6.7.0
|
||||
*
|
||||
* @type {number}
|
||||
*/
|
||||
wp.updates.searchMinCharacters = 2;
|
||||
|
||||
/**
|
||||
* Whether filesystem credentials need to be requested from the user.
|
||||
*
|
||||
@@ -2823,14 +2832,7 @@
|
||||
|
||||
// Bail if there were no items selected.
|
||||
if ( ! itemsSelected.length ) {
|
||||
event.preventDefault();
|
||||
$( 'html, body' ).animate( { scrollTop: 0 } );
|
||||
|
||||
return wp.updates.addAdminNotice( {
|
||||
id: 'no-items-selected',
|
||||
className: 'notice-error is-dismissible',
|
||||
message: __( 'Please select at least one item to perform this action on.' )
|
||||
} );
|
||||
bulkAction = false;
|
||||
}
|
||||
|
||||
// Determine the type of request we're dealing with.
|
||||
@@ -2977,6 +2979,15 @@
|
||||
$pluginInstallSearch.attr( 'aria-describedby', 'live-search-desc' );
|
||||
}
|
||||
|
||||
// Track the previous search string length.
|
||||
var previousSearchStringLength = 0;
|
||||
wp.updates.shouldSearch = function( searchStringLength ) {
|
||||
var shouldSearch = searchStringLength >= wp.updates.searchMinCharacters ||
|
||||
previousSearchStringLength > wp.updates.searchMinCharacters;
|
||||
previousSearchStringLength = searchStringLength;
|
||||
return shouldSearch;
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles changes to the plugin search box on the new-plugin page,
|
||||
* searching the repository dynamically.
|
||||
@@ -2984,7 +2995,8 @@
|
||||
* @since 4.6.0
|
||||
*/
|
||||
$pluginInstallSearch.on( 'keyup input', _.debounce( function( event, eventtype ) {
|
||||
var $searchTab = $( '.plugin-install-search' ), data, searchLocation;
|
||||
var $searchTab = $( '.plugin-install-search' ), data, searchLocation,
|
||||
searchStringLength = $pluginInstallSearch.val().length;
|
||||
|
||||
data = {
|
||||
_ajax_nonce: wp.updates.ajaxNonce,
|
||||
@@ -2995,6 +3007,14 @@
|
||||
};
|
||||
searchLocation = location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, [ '_ajax_nonce', 'pagenow' ] ) );
|
||||
|
||||
// Set the autocomplete attribute, turning off autocomplete 1 character before ajax search kicks in.
|
||||
if ( wp.updates.shouldSearch( searchStringLength ) ) {
|
||||
$pluginInstallSearch.attr( 'autocomplete', 'off' );
|
||||
} else {
|
||||
$pluginInstallSearch.attr( 'autocomplete', 'on' );
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear on escape.
|
||||
if ( 'keyup' === event.type && 27 === event.which ) {
|
||||
event.target.value = '';
|
||||
@@ -3054,6 +3074,7 @@
|
||||
|
||||
if ( $pluginSearch.length ) {
|
||||
$pluginSearch.attr( 'aria-describedby', 'live-search-desc' );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3069,7 +3090,16 @@
|
||||
pagenow: pagenow,
|
||||
plugin_status: 'all'
|
||||
},
|
||||
queryArgs;
|
||||
queryArgs,
|
||||
searchStringLength = $pluginSearch.val().length;
|
||||
|
||||
// Set the autocomplete attribute, turning off autocomplete 1 character before ajax search kicks in.
|
||||
if ( wp.updates.shouldSearch( searchStringLength ) ) {
|
||||
$pluginSearch.attr( 'autocomplete', 'off' );
|
||||
} else {
|
||||
$pluginSearch.attr( 'autocomplete', 'on' );
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear on escape.
|
||||
if ( 'keyup' === event.type && 27 === event.which ) {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -2,11 +2,12 @@
|
||||
* @output wp-admin/js/user-profile.js
|
||||
*/
|
||||
|
||||
/* global ajaxurl, pwsL10n, userProfileL10n */
|
||||
/* global ajaxurl, pwsL10n, userProfileL10n, ClipboardJS */
|
||||
(function($) {
|
||||
var updateLock = false,
|
||||
isSubmitting = false,
|
||||
__ = wp.i18n.__,
|
||||
clipboard = new ClipboardJS( '.application-password-display .copy-button' ),
|
||||
$pass1Row,
|
||||
$pass1,
|
||||
$pass2,
|
||||
@@ -18,7 +19,8 @@
|
||||
currentPass,
|
||||
$form,
|
||||
originalFormContent,
|
||||
$passwordWrapper;
|
||||
$passwordWrapper,
|
||||
successTimeout;
|
||||
|
||||
function generatePassword() {
|
||||
if ( typeof zxcvbn !== 'function' ) {
|
||||
@@ -346,6 +348,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Debug information copy section.
|
||||
clipboard.on( 'success', function( e ) {
|
||||
var triggerElement = $( e.trigger ),
|
||||
successElement = $( '.success', triggerElement.closest( '.application-password-display' ) );
|
||||
|
||||
// Clear the selection and move focus back to the trigger.
|
||||
e.clearSelection();
|
||||
|
||||
// Show success visual feedback.
|
||||
clearTimeout( successTimeout );
|
||||
successElement.removeClass( 'hidden' );
|
||||
|
||||
// Hide success visual feedback after 3 seconds since last success.
|
||||
successTimeout = setTimeout( function() {
|
||||
successElement.addClass( 'hidden' );
|
||||
}, 3000 );
|
||||
|
||||
// Handle success audible feedback.
|
||||
wp.a11y.speak( __( 'Application password has been copied to your clipboard.' ) );
|
||||
} );
|
||||
|
||||
$( function() {
|
||||
var $colorpicker, $stylesheet, user_id, current_user_id,
|
||||
select = $( '#display_name' ),
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user