Plugin Updates
This commit is contained in:
@@ -70,7 +70,7 @@ jQuery( function($) {
|
||||
* @param {Event} event The event object.
|
||||
* @return {void}
|
||||
*/
|
||||
$timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels.
|
||||
$timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse branch - multiple OK cancels.
|
||||
var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
|
||||
newD = new Date( aa, mm - 1, jj, hh, mn );
|
||||
|
||||
|
||||
@@ -353,6 +353,21 @@ window.setPostThumbnailL10n = window.setPostThumbnailL10n || {
|
||||
|
||||
window.setPostThumbnailL10n = deprecateL10nObject( 'setPostThumbnailL10n', window.setPostThumbnailL10n, '5.5.0' );
|
||||
|
||||
/**
|
||||
* Removed in 6.5.0, needed for back-compatibility.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @deprecated 6.5.0
|
||||
*/
|
||||
window.uiAutocompleteL10n = window.uiAutocompleteL10n || {
|
||||
noResults: '',
|
||||
oneResult: '',
|
||||
manyResults: '',
|
||||
itemSelected: ''
|
||||
};
|
||||
|
||||
window.uiAutocompleteL10n = deprecateL10nObject( 'uiAutocompleteL10n', window.uiAutocompleteL10n, '6.5.0' );
|
||||
|
||||
/**
|
||||
* Removed in 3.3.0, needed for back-compatibility.
|
||||
*
|
||||
@@ -1154,7 +1169,7 @@ $( function() {
|
||||
lastClicked = this;
|
||||
|
||||
// Toggle the "Select all" checkboxes depending if the other ones are all checked or not.
|
||||
var unchecked = $(this).closest('tbody').find(':checkbox').filter(':visible:enabled').not(':checked');
|
||||
var unchecked = $(this).closest('tbody').find('tr.iedit').find(':checkbox').filter(':visible:enabled').not(':checked');
|
||||
|
||||
/**
|
||||
* Determines if all checkboxes are checked.
|
||||
|
||||
2
wp/wp-admin/js/common.min.js
vendored
2
wp/wp-admin/js/common.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -3866,7 +3866,7 @@
|
||||
var control = this, container, notifications, hasError = false;
|
||||
|
||||
if ( 'undefined' !== typeof console && console.warn ) {
|
||||
console.warn( '[DEPRECATED] wp.customize.Control.prototype.renderNotifications() is deprecated in favor of instantating a wp.customize.Notifications and calling its render() method.' );
|
||||
console.warn( '[DEPRECATED] wp.customize.Control.prototype.renderNotifications() is deprecated in favor of instantiating a wp.customize.Notifications and calling its render() method.' );
|
||||
}
|
||||
|
||||
container = control.getNotificationsContainerElement();
|
||||
|
||||
2
wp/wp-admin/js/customize-controls.min.js
vendored
2
wp/wp-admin/js/customize-controls.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1664,6 +1664,8 @@
|
||||
$reorderNav = control.container.find( '.menu-item-reorder-nav' );
|
||||
$reorderNav.find( '.menus-move-up, .menus-move-down, .menus-move-left, .menus-move-right' ).on( 'click', function() {
|
||||
var moveBtn = $( this );
|
||||
control.params.depth = control.getDepth();
|
||||
|
||||
moveBtn.focus();
|
||||
|
||||
var isMoveUp = moveBtn.is( '.menus-move-up' ),
|
||||
@@ -1677,8 +1679,19 @@
|
||||
control.moveDown();
|
||||
} else if ( isMoveLeft ) {
|
||||
control.moveLeft();
|
||||
if ( 1 === control.params.depth ) {
|
||||
control.container.find( '.is-submenu' ).hide();
|
||||
} else {
|
||||
control.container.find( '.is-submenu' ).show();
|
||||
}
|
||||
} else if ( isMoveRight ) {
|
||||
control.moveRight();
|
||||
control.params.depth += 1;
|
||||
if ( 0 === control.params.depth ) {
|
||||
control.container.find( '.is-submenu' ).hide();
|
||||
} else {
|
||||
control.container.find( '.is-submenu' ).show();
|
||||
}
|
||||
}
|
||||
|
||||
moveBtn.focus(); // Re-focus after the container was moved.
|
||||
|
||||
2
wp/wp-admin/js/customize-nav-menus.min.js
vendored
2
wp/wp-admin/js/customize-nav-menus.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -178,6 +178,8 @@ window.wp = window.wp || {};
|
||||
*/
|
||||
setBulk : function(){
|
||||
var te = '', type = this.type, c = true;
|
||||
var checkedPosts = $( 'tbody th.check-column input[type="checkbox"]:checked' );
|
||||
var categories = {};
|
||||
this.revert();
|
||||
|
||||
$( '#bulk-edit td' ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
|
||||
@@ -217,6 +219,44 @@ window.wp = window.wp || {};
|
||||
// Populate the list of items to bulk edit.
|
||||
$( '#bulk-titles' ).html( '<ul id="bulk-titles-list" role="list">' + te + '</ul>' );
|
||||
|
||||
// Gather up some statistics on which of these checked posts are in which categories.
|
||||
checkedPosts.each( function() {
|
||||
var id = $( this ).val();
|
||||
var checked = $( '#category_' + id ).text().split( ',' );
|
||||
|
||||
checked.map( function( cid ) {
|
||||
categories[ cid ] || ( categories[ cid ] = 0 );
|
||||
// Just record that this category is checked.
|
||||
categories[ cid ]++;
|
||||
} );
|
||||
} );
|
||||
|
||||
// Compute initial states.
|
||||
$( '.inline-edit-categories input[name="post_category[]"]' ).each( function() {
|
||||
if ( categories[ $( this ).val() ] == checkedPosts.length ) {
|
||||
// If the number of checked categories matches the number of selected posts, then all posts are in this category.
|
||||
$( this ).prop( 'checked', true );
|
||||
} else if ( categories[ $( this ).val() ] > 0 ) {
|
||||
// If the number is less than the number of selected posts, then it's indeterminate.
|
||||
$( this ).prop( 'indeterminate', true );
|
||||
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.
|
||||
$( 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' ) );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
$( '.inline-edit-categories input[name="post_category[]"]:indeterminate' ).on( 'change', function() {
|
||||
// Remove accessible label text. Remove the indeterminate flags as there was a specific state change.
|
||||
$( this ).removeAttr( 'aria-label' ).parent().find( 'input[name="indeterminate_post_category[]"]' ).remove();
|
||||
} );
|
||||
|
||||
$( '.inline-edit-save button' ).on( 'click', function() {
|
||||
$( '.inline-edit-categories input[name="post_category[]"]' ).prop( 'indeterminate', false );
|
||||
} );
|
||||
|
||||
/**
|
||||
* Binds on click events to handle the list of items to bulk edit.
|
||||
*
|
||||
@@ -228,6 +268,7 @@ window.wp = window.wp || {};
|
||||
$prev = $this.parent().prev().children( '.ntdelbutton' ),
|
||||
$next = $this.parent().next().children( '.ntdelbutton' );
|
||||
|
||||
$( 'input#cb-select-all-1, input#cb-select-all-2' ).prop( 'checked', false );
|
||||
$( 'table.widefat input[value="' + id + '"]' ).prop( 'checked', false );
|
||||
$( '#_' + id ).parent().remove();
|
||||
wp.a11y.speak( wp.i18n.__( 'Item removed.' ), 'assertive' );
|
||||
|
||||
2
wp/wp-admin/js/inline-edit-post.min.js
vendored
2
wp/wp-admin/js/inline-edit-post.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -223,8 +223,6 @@
|
||||
|
||||
// Clear the selection and move focus back to the trigger.
|
||||
event.clearSelection();
|
||||
// Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680.
|
||||
triggerElement.trigger( 'focus' );
|
||||
|
||||
// Show success visual feedback.
|
||||
clearTimeout( copyAttachmentURLSuccessTimeout );
|
||||
|
||||
2
wp/wp-admin/js/media.min.js
vendored
2
wp/wp-admin/js/media.min.js
vendored
@@ -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(),e.trigger("focus"),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(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);
|
||||
@@ -889,7 +889,7 @@ jQuery( function($) {
|
||||
});
|
||||
|
||||
// Set the selected visibility as current.
|
||||
$postVisibilitySelect.find('.save-post-visibility').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels.
|
||||
$postVisibilitySelect.find('.save-post-visibility').on( 'click', function( event ) { // Crazyhorse branch - multiple OK cancels.
|
||||
var visibilityLabel = '', selectedVisibility = $postVisibilitySelect.find('input:radio:checked').val();
|
||||
|
||||
$postVisibilitySelect.slideUp('fast');
|
||||
@@ -945,7 +945,7 @@ jQuery( function($) {
|
||||
});
|
||||
|
||||
// Save the changed timestamp.
|
||||
$timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels.
|
||||
$timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse branch - multiple OK cancels.
|
||||
if ( updateText() ) {
|
||||
$timestampdiv.slideUp('fast');
|
||||
$timestampdiv.siblings('a.edit-timestamp').show().trigger( 'focus' );
|
||||
@@ -1173,7 +1173,7 @@ jQuery( function($) {
|
||||
}
|
||||
|
||||
/**
|
||||
* When the dragging stopped make sure we return focus and do a sanity check on the height.
|
||||
* When the dragging stopped make sure we return focus and do a confidence check on the height.
|
||||
*/
|
||||
function endDrag() {
|
||||
var height, toolbarHeight;
|
||||
@@ -1198,7 +1198,7 @@ jQuery( function($) {
|
||||
|
||||
$document.off( '.wp-editor-resize' );
|
||||
|
||||
// Sanity check: normalize height to stay within acceptable ranges.
|
||||
// Confidence check: normalize height to stay within acceptable ranges.
|
||||
if ( height && height > 50 && height < 5000 ) {
|
||||
setUserSetting( 'ed_size', height );
|
||||
}
|
||||
@@ -1303,8 +1303,6 @@ jQuery( function($) {
|
||||
|
||||
// Clear the selection and move focus back to the trigger.
|
||||
event.clearSelection();
|
||||
// Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680
|
||||
triggerElement.trigger( 'focus' );
|
||||
|
||||
// Show success visual feedback.
|
||||
clearTimeout( copyAttachmentURLSuccessTimeout );
|
||||
|
||||
2
wp/wp-admin/js/post.min.js
vendored
2
wp/wp-admin/js/post.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -26,8 +26,6 @@ jQuery( function( $ ) {
|
||||
|
||||
// Clear the selection and move focus back to the trigger.
|
||||
e.clearSelection();
|
||||
// Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680
|
||||
triggerElement.trigger( 'focus' );
|
||||
|
||||
// Show success visual feedback.
|
||||
clearTimeout( successTimeout );
|
||||
|
||||
2
wp/wp-admin/js/site-health.min.js
vendored
2
wp/wp-admin/js/site-health.min.js
vendored
File diff suppressed because one or more lines are too long
236
wp/wp-admin/js/site-icon.js
Normal file
236
wp/wp-admin/js/site-icon.js
Normal file
@@ -0,0 +1,236 @@
|
||||
/**
|
||||
* Handle the site icon setting in options-general.php.
|
||||
*
|
||||
* @since 6.5.0
|
||||
* @output wp-admin/js/site-icon.js
|
||||
*/
|
||||
|
||||
/* global jQuery, wp */
|
||||
|
||||
( function ( $ ) {
|
||||
var $chooseButton = $( '#choose-from-library-button' ),
|
||||
$iconPreview = $( '#site-icon-preview' ),
|
||||
$browserIconPreview = $( '#browser-icon-preview' ),
|
||||
$appIconPreview = $( '#app-icon-preview' ),
|
||||
$hiddenDataField = $( '#site_icon_hidden_field' ),
|
||||
$removeButton = $( '#js-remove-site-icon' ),
|
||||
frame;
|
||||
|
||||
/**
|
||||
* Calculate image selection options based on the attachment dimensions.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param {Object} attachment The attachment object representing the image.
|
||||
* @return {Object} The image selection options.
|
||||
*/
|
||||
function calculateImageSelectOptions( attachment ) {
|
||||
var realWidth = attachment.get( 'width' ),
|
||||
realHeight = attachment.get( 'height' ),
|
||||
xInit = 512,
|
||||
yInit = 512,
|
||||
ratio = xInit / yInit,
|
||||
xImg = xInit,
|
||||
yImg = yInit,
|
||||
x1,
|
||||
y1,
|
||||
imgSelectOptions;
|
||||
|
||||
if ( realWidth / realHeight > ratio ) {
|
||||
yInit = realHeight;
|
||||
xInit = yInit * ratio;
|
||||
} else {
|
||||
xInit = realWidth;
|
||||
yInit = xInit / ratio;
|
||||
}
|
||||
|
||||
x1 = ( realWidth - xInit ) / 2;
|
||||
y1 = ( realHeight - yInit ) / 2;
|
||||
|
||||
imgSelectOptions = {
|
||||
aspectRatio: xInit + ':' + yInit,
|
||||
handles: true,
|
||||
keys: true,
|
||||
instance: true,
|
||||
persistent: true,
|
||||
imageWidth: realWidth,
|
||||
imageHeight: realHeight,
|
||||
minWidth: xImg > xInit ? xInit : xImg,
|
||||
minHeight: yImg > yInit ? yInit : yImg,
|
||||
x1: x1,
|
||||
y1: y1,
|
||||
x2: xInit + x1,
|
||||
y2: yInit + y1,
|
||||
};
|
||||
|
||||
return imgSelectOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the media frame for selecting or cropping an image.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*/
|
||||
$chooseButton.on( 'click', function () {
|
||||
var $el = $( this );
|
||||
|
||||
// Create the media frame.
|
||||
frame = wp.media( {
|
||||
button: {
|
||||
// Set the text of the button.
|
||||
text: $el.data( 'update' ),
|
||||
|
||||
// Don't close, we might need to crop.
|
||||
close: false,
|
||||
},
|
||||
states: [
|
||||
new wp.media.controller.Library( {
|
||||
title: $el.data( 'choose-text' ),
|
||||
library: wp.media.query( { type: 'image' } ),
|
||||
date: false,
|
||||
suggestedWidth: $el.data( 'size' ),
|
||||
suggestedHeight: $el.data( 'size' ),
|
||||
} ),
|
||||
new wp.media.controller.SiteIconCropper( {
|
||||
control: {
|
||||
params: {
|
||||
width: $el.data( 'size' ),
|
||||
height: $el.data( 'size' ),
|
||||
},
|
||||
},
|
||||
imgSelectOptions: calculateImageSelectOptions,
|
||||
} ),
|
||||
],
|
||||
} );
|
||||
|
||||
frame.on( 'cropped', function ( attachment ) {
|
||||
$hiddenDataField.val( attachment.id );
|
||||
switchToUpdate( attachment );
|
||||
frame.close();
|
||||
|
||||
// Start over with a frame that is so fresh and so clean clean.
|
||||
frame = null;
|
||||
} );
|
||||
|
||||
// When an image is selected, run a callback.
|
||||
frame.on( 'select', function () {
|
||||
// Grab the selected attachment.
|
||||
var attachment = frame.state().get( 'selection' ).first();
|
||||
|
||||
if (
|
||||
attachment.attributes.height === $el.data( 'size' ) &&
|
||||
$el.data( 'size' ) === attachment.attributes.width
|
||||
) {
|
||||
switchToUpdate( attachment.attributes );
|
||||
frame.close();
|
||||
|
||||
// Set the value of the hidden input to the attachment id.
|
||||
$hiddenDataField.val( attachment.id );
|
||||
} else {
|
||||
frame.setState( 'cropper' );
|
||||
}
|
||||
} );
|
||||
|
||||
frame.open();
|
||||
} );
|
||||
|
||||
/**
|
||||
* Update the UI when a site icon is selected.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param {array} attributes The attributes for the attachment.
|
||||
*/
|
||||
function switchToUpdate( attributes ) {
|
||||
var i18nAppAlternativeString, i18nBrowserAlternativeString;
|
||||
|
||||
if ( attributes.alt ) {
|
||||
i18nAppAlternativeString = wp.i18n.sprintf(
|
||||
/* translators: %s: The selected image alt text. */
|
||||
wp.i18n.__( 'App icon preview: Current image: %s' ),
|
||||
attributes.alt
|
||||
);
|
||||
i18nBrowserAlternativeString = wp.i18n.sprintf(
|
||||
/* translators: %s: The selected image alt text. */
|
||||
wp.i18n.__( 'Browser icon preview: Current image: %s' ),
|
||||
attributes.alt
|
||||
);
|
||||
} else {
|
||||
i18nAppAlternativeString = wp.i18n.sprintf(
|
||||
/* translators: %s: The selected image filename. */
|
||||
wp.i18n.__(
|
||||
'App icon preview: The current image has no alternative text. The file name is: %s'
|
||||
),
|
||||
attributes.filename
|
||||
);
|
||||
i18nBrowserAlternativeString = wp.i18n.sprintf(
|
||||
/* translators: %s: The selected image filename. */
|
||||
wp.i18n.__(
|
||||
'Browser icon preview: The current image has no alternative text. The file name is: %s'
|
||||
),
|
||||
attributes.filename
|
||||
);
|
||||
}
|
||||
|
||||
// Set site-icon-img src and alternative text to app icon preview.
|
||||
$appIconPreview.attr( {
|
||||
src: attributes.url,
|
||||
alt: i18nAppAlternativeString,
|
||||
} );
|
||||
|
||||
// Set site-icon-img src and alternative text to browser preview.
|
||||
$browserIconPreview.attr( {
|
||||
src: attributes.url,
|
||||
alt: i18nBrowserAlternativeString,
|
||||
} );
|
||||
|
||||
// Remove hidden class from icon preview div and remove button.
|
||||
$iconPreview.removeClass( 'hidden' );
|
||||
$removeButton.removeClass( 'hidden' );
|
||||
|
||||
// If the choose button is not in the update state, swap the classes.
|
||||
if ( $chooseButton.attr( 'data-state' ) !== '1' ) {
|
||||
$chooseButton.attr( {
|
||||
class: $chooseButton.attr( 'data-alt-classes' ),
|
||||
'data-alt-classes': $chooseButton.attr( 'class' ),
|
||||
'data-state': '1',
|
||||
} );
|
||||
}
|
||||
|
||||
// Swap the text of the choose button.
|
||||
$chooseButton.text( $chooseButton.attr( 'data-update-text' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the click event of the remove button.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*/
|
||||
$removeButton.on( 'click', function () {
|
||||
$hiddenDataField.val( 'false' );
|
||||
$( this ).toggleClass( 'hidden' );
|
||||
$iconPreview.toggleClass( 'hidden' );
|
||||
$browserIconPreview.attr( {
|
||||
src: '',
|
||||
alt: '',
|
||||
} );
|
||||
$appIconPreview.attr( {
|
||||
src: '',
|
||||
alt: '',
|
||||
} );
|
||||
|
||||
/**
|
||||
* Resets state to the button, for correct visual style and state.
|
||||
* Updates the text of the button.
|
||||
* Sets focus state to the button.
|
||||
*/
|
||||
$chooseButton
|
||||
.attr( {
|
||||
class: $chooseButton.attr( 'data-alt-classes' ),
|
||||
'data-alt-classes': $chooseButton.attr( 'class' ),
|
||||
'data-state': '',
|
||||
} )
|
||||
.text( $chooseButton.attr( 'data-choose-text' ) )
|
||||
.trigger( 'focus' );
|
||||
} );
|
||||
} )( jQuery );
|
||||
2
wp/wp-admin/js/site-icon.min.js
vendored
Normal file
2
wp/wp-admin/js/site-icon.min.js
vendored
Normal file
@@ -0,0 +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);
|
||||
@@ -4,12 +4,11 @@
|
||||
* @output wp-admin/js/tags-suggest.js
|
||||
*/
|
||||
( function( $ ) {
|
||||
if ( typeof window.uiAutocompleteL10n === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tempID = 0;
|
||||
var separator = wp.i18n._x( ',', 'tag delimiter' ) || ',';
|
||||
var __ = wp.i18n.__,
|
||||
_n = wp.i18n._n,
|
||||
sprintf = wp.i18n.sprintf;
|
||||
|
||||
function split( val ) {
|
||||
return val.split( new RegExp( separator + '\\s*' ) );
|
||||
@@ -139,13 +138,17 @@
|
||||
collision: 'none'
|
||||
},
|
||||
messages: {
|
||||
noResults: window.uiAutocompleteL10n.noResults,
|
||||
noResults: __( 'No results found.' ),
|
||||
results: function( number ) {
|
||||
if ( number > 1 ) {
|
||||
return window.uiAutocompleteL10n.manyResults.replace( '%d', number );
|
||||
}
|
||||
|
||||
return window.uiAutocompleteL10n.oneResult;
|
||||
return sprintf(
|
||||
/* translators: %d: Number of search results found. */
|
||||
_n(
|
||||
'%d result found. Use up and down arrow keys to navigate.',
|
||||
'%d results found. Use up and down arrow keys to navigate.',
|
||||
number
|
||||
),
|
||||
number
|
||||
);
|
||||
}
|
||||
}
|
||||
}, options );
|
||||
|
||||
2
wp/wp-admin/js/tags-suggest.min.js
vendored
2
wp/wp-admin/js/tags-suggest.min.js
vendored
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(u){var s,a;function l(e){return e.split(new RegExp(a+"\\s*"))}void 0!==window.uiAutocompleteL10n&&(s=0,a=wp.i18n._x(",","tag delimiter")||",",u.fn.wpTagsSuggest=function(e){var i,o,n,r=u(this);return r.length&&(n=(e=e||{}).taxonomy||r.attr("data-wp-taxonomy")||"post_tag",delete e.taxonomy,e=u.extend({source:function(e,a){var t;o===e.term?a(i):(t=l(e.term).pop(),u.get(window.ajaxurl,{action:"ajax-tag-search",tax:n,q:t,number:20}).always(function(){r.removeClass("ui-autocomplete-loading")}).done(function(e){var t,o=[];if(e){for(t in e=e.split("\n")){var n=++s;o.push({id:n,name:e[t]})}a(i=o)}else a(o)}),o=e.term)},focus:function(e,t){r.attr("aria-activedescendant","wp-tags-autocomplete-"+t.item.id),e.preventDefault()},select:function(e,t){var o=l(r.val());return o.pop(),o.push(t.item.name,""),r.val(o.join(a+" ")),u.ui.keyCode.TAB===e.keyCode?(window.wp.a11y.speak(wp.i18n.__("Term selected."),"assertive"),e.preventDefault()):u.ui.keyCode.ENTER===e.keyCode&&(window.tagBox&&(window.tagBox.userAction="add",window.tagBox.flushTags(u(this).closest(".tagsdiv"))),e.preventDefault(),e.stopPropagation()),!1},open:function(){r.attr("aria-expanded","true")},close:function(){r.attr("aria-expanded","false")},minLength:2,position:{my:"left top+2",at:"left bottom",collision:"none"},messages:{noResults:window.uiAutocompleteL10n.noResults,results:function(e){return 1<e?window.uiAutocompleteL10n.manyResults.replace("%d",e):window.uiAutocompleteL10n.oneResult}}},e),r.on("keydown",function(){r.removeAttr("aria-activedescendant")}),r.autocomplete(e),r.autocomplete("instance"))&&(r.autocomplete("instance")._renderItem=function(e,t){return u('<li role="option" id="wp-tags-autocomplete-'+t.id+'">').text(t.name).appendTo(e)},r.attr({role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-owns":r.autocomplete("widget").attr("id")}).on("focus",function(){l(r.val()).pop()&&r.autocomplete("search")}),r.autocomplete("widget").addClass("wp-tags-autocomplete").attr("role","listbox").removeAttr("tabindex").on("menufocus",function(e,t){t.item.attr("aria-selected","true")}).on("menublur",function(){u(this).find('[aria-selected="true"]').removeAttr("aria-selected")})),this})}(jQuery);
|
||||
!function(s){var u=0,n=wp.i18n._x(",","tag delimiter")||",",t=wp.i18n.__,d=wp.i18n._n,l=wp.i18n.sprintf;function p(e){return e.split(new RegExp(n+"\\s*"))}s.fn.wpTagsSuggest=function(e){var i,o,a,r=s(this);return r.length&&(a=(e=e||{}).taxonomy||r.attr("data-wp-taxonomy")||"post_tag",delete e.taxonomy,e=s.extend({source:function(e,n){var t;o===e.term?n(i):(t=p(e.term).pop(),s.get(window.ajaxurl,{action:"ajax-tag-search",tax:a,q:t,number:20}).always(function(){r.removeClass("ui-autocomplete-loading")}).done(function(e){var t,o=[];if(e){for(t in e=e.split("\n")){var a=++u;o.push({id:a,name:e[t]})}n(i=o)}else n(o)}),o=e.term)},focus:function(e,t){r.attr("aria-activedescendant","wp-tags-autocomplete-"+t.item.id),e.preventDefault()},select:function(e,t){var o=p(r.val());return o.pop(),o.push(t.item.name,""),r.val(o.join(n+" ")),s.ui.keyCode.TAB===e.keyCode?(window.wp.a11y.speak(wp.i18n.__("Term selected."),"assertive"),e.preventDefault()):s.ui.keyCode.ENTER===e.keyCode&&(window.tagBox&&(window.tagBox.userAction="add",window.tagBox.flushTags(s(this).closest(".tagsdiv"))),e.preventDefault(),e.stopPropagation()),!1},open:function(){r.attr("aria-expanded","true")},close:function(){r.attr("aria-expanded","false")},minLength:2,position:{my:"left top+2",at:"left bottom",collision:"none"},messages:{noResults:t("No results found."),results:function(e){return l(d("%d result found. Use up and down arrow keys to navigate.","%d results found. Use up and down arrow keys to navigate.",e),e)}}},e),r.on("keydown",function(){r.removeAttr("aria-activedescendant")}),r.autocomplete(e),r.autocomplete("instance"))&&(r.autocomplete("instance")._renderItem=function(e,t){return s('<li role="option" id="wp-tags-autocomplete-'+t.id+'">').text(t.name).appendTo(e)},r.attr({role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-owns":r.autocomplete("widget").attr("id")}).on("focus",function(){p(r.val()).pop()&&r.autocomplete("search")}),r.autocomplete("widget").addClass("wp-tags-autocomplete").attr("role","listbox").removeAttr("tabindex").on("menufocus",function(e,t){t.item.attr("aria-selected","true")}).on("menublur",function(){s(this).find('[aria-selected="true"]').removeAttr("aria-selected")})),this}}(jQuery);
|
||||
@@ -1300,7 +1300,7 @@ themes.view.Themes = wp.Backbone.View.extend({
|
||||
// Find the next model within the collection.
|
||||
nextModel = self.collection.at( self.collection.indexOf( model ) + 1 );
|
||||
|
||||
// Sanity check which also serves as a boundary test.
|
||||
// Confidence check which also serves as a boundary test.
|
||||
if ( nextModel !== undefined ) {
|
||||
|
||||
// We have a new theme...
|
||||
|
||||
@@ -413,6 +413,31 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends a message from a modal to the main screen to update buttons in plugin cards.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param {Object} data An object of data to use for the button.
|
||||
* @param {string} data.slug The plugin's slug.
|
||||
* @param {string} data.text The text to use for the button.
|
||||
* @param {string} data.ariaLabel The value for the button's aria-label attribute. An empty string removes the attribute.
|
||||
* @param {string=} data.status Optional. An identifier for the status.
|
||||
* @param {string=} data.removeClasses Optional. A space-separated list of classes to remove from the button.
|
||||
* @param {string=} data.addClasses Optional. A space-separated list of classes to add to the button.
|
||||
* @param {string=} data.href Optional. The button's URL.
|
||||
* @param {string=} data.pluginName Optional. The plugin's name.
|
||||
* @param {string=} data.plugin Optional. The plugin file, relative to the plugins directory.
|
||||
*/
|
||||
wp.updates.setCardButtonStatus = function( data ) {
|
||||
var target = window.parent === window ? null : window.parent;
|
||||
|
||||
$.support.postMessage = !! window.postMessage;
|
||||
if ( false !== $.support.postMessage && null !== target && -1 === window.parent.location.pathname.indexOf( 'index.php' ) ) {
|
||||
target.postMessage( JSON.stringify( data ), window.location.origin );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Decrements the update counts throughout the various menus.
|
||||
*
|
||||
@@ -452,7 +477,9 @@
|
||||
*/
|
||||
wp.updates.updatePlugin = function( args ) {
|
||||
var $updateRow, $card, $message, message,
|
||||
$adminBarUpdates = $( '#wp-admin-bar-updates' );
|
||||
$adminBarUpdates = $( '#wp-admin-bar-updates' ),
|
||||
buttonText = __( 'Updating...' ),
|
||||
isPluginInstall = 'plugin-install' === pagenow || 'plugin-install-network' === pagenow;
|
||||
|
||||
args = _.extend( {
|
||||
success: wp.updates.updatePluginSuccess,
|
||||
@@ -467,8 +494,8 @@
|
||||
_x( 'Updating %s...', 'plugin' ),
|
||||
$updateRow.find( '.plugin-title strong' ).text()
|
||||
);
|
||||
} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
|
||||
$card = $( '.plugin-card-' + args.slug );
|
||||
} else if ( isPluginInstall ) {
|
||||
$card = $( '.plugin-card-' + args.slug + ', #plugin-information-footer' );
|
||||
$message = $card.find( '.update-now' ).addClass( 'updating-message' );
|
||||
message = sprintf(
|
||||
/* translators: %s: Plugin name and version. */
|
||||
@@ -488,10 +515,22 @@
|
||||
|
||||
$message
|
||||
.attr( 'aria-label', message )
|
||||
.text( __( 'Updating...' ) );
|
||||
.text( buttonText );
|
||||
|
||||
$document.trigger( 'wp-plugin-updating', args );
|
||||
|
||||
if ( isPluginInstall && 'plugin-information-footer' === $card.attr( 'id' ) ) {
|
||||
wp.updates.setCardButtonStatus(
|
||||
{
|
||||
status: 'updating-plugin',
|
||||
slug: args.slug,
|
||||
addClasses: 'updating-message',
|
||||
text: buttonText,
|
||||
ariaLabel: message
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return wp.updates.ajax( 'update-plugin', args );
|
||||
};
|
||||
|
||||
@@ -511,7 +550,13 @@
|
||||
*/
|
||||
wp.updates.updatePluginSuccess = function( response ) {
|
||||
var $pluginRow, $updateMessage, newText,
|
||||
$adminBarUpdates = $( '#wp-admin-bar-updates' );
|
||||
$adminBarUpdates = $( '#wp-admin-bar-updates' ),
|
||||
buttonText = _x( 'Updated!', 'plugin' ),
|
||||
ariaLabel = sprintf(
|
||||
/* translators: %s: Plugin name and version. */
|
||||
_x( '%s updated!', 'plugin' ),
|
||||
response.pluginName
|
||||
);
|
||||
|
||||
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
|
||||
$pluginRow = $( 'tr[data-plugin="' + response.plugin + '"]' )
|
||||
@@ -528,7 +573,7 @@
|
||||
// Clear the "time to next auto-update" text.
|
||||
$pluginRow.find( '.auto-update-time' ).empty();
|
||||
} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
|
||||
$updateMessage = $( '.plugin-card-' + response.slug ).find( '.update-now' )
|
||||
$updateMessage = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.update-now' )
|
||||
.removeClass( 'updating-message' )
|
||||
.addClass( 'button-disabled updated-message' );
|
||||
}
|
||||
@@ -536,19 +581,25 @@
|
||||
$adminBarUpdates.removeClass( 'spin' );
|
||||
|
||||
$updateMessage
|
||||
.attr(
|
||||
'aria-label',
|
||||
sprintf(
|
||||
/* translators: %s: Plugin name and version. */
|
||||
_x( '%s updated!', 'plugin' ),
|
||||
response.pluginName
|
||||
)
|
||||
)
|
||||
.text( _x( 'Updated!', 'plugin' ) );
|
||||
.attr( 'aria-label', ariaLabel )
|
||||
.text( buttonText );
|
||||
|
||||
wp.a11y.speak( __( 'Update completed successfully.' ) );
|
||||
|
||||
wp.updates.decrementCount( 'plugin' );
|
||||
if ( 'plugin_install_from_iframe' !== $updateMessage.attr( 'id' ) ) {
|
||||
wp.updates.decrementCount( 'plugin' );
|
||||
} else {
|
||||
wp.updates.setCardButtonStatus(
|
||||
{
|
||||
status: 'updated-plugin',
|
||||
slug: response.slug,
|
||||
removeClasses: 'updating-message',
|
||||
addClasses: 'button-disabled updated-message',
|
||||
text: buttonText,
|
||||
ariaLabel: ariaLabel
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$document.trigger( 'wp-plugin-update-success', response );
|
||||
};
|
||||
@@ -567,7 +618,7 @@
|
||||
* @param {string} response.errorMessage The error that occurred.
|
||||
*/
|
||||
wp.updates.updatePluginError = function( response ) {
|
||||
var $pluginRow, $card, $message, errorMessage,
|
||||
var $pluginRow, $card, $message, errorMessage, buttonText, ariaLabel,
|
||||
$adminBarUpdates = $( '#wp-admin-bar-updates' );
|
||||
|
||||
if ( ! wp.updates.isValidResponse( response, 'update' ) ) {
|
||||
@@ -608,28 +659,32 @@
|
||||
$message.find( 'p' ).removeAttr( 'aria-label' );
|
||||
}
|
||||
} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
|
||||
$card = $( '.plugin-card-' + response.slug )
|
||||
.addClass( 'plugin-card-update-failed' )
|
||||
buttonText = __( 'Update failed.' );
|
||||
|
||||
$card = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' )
|
||||
.append( wp.updates.adminNotice( {
|
||||
className: 'update-message notice-error notice-alt is-dismissible',
|
||||
message: errorMessage
|
||||
} ) );
|
||||
|
||||
if ( $card.hasClass( 'plugin-card-' + response.slug ) ) {
|
||||
$card.addClass( 'plugin-card-update-failed' );
|
||||
}
|
||||
|
||||
$card.find( '.update-now' )
|
||||
.text( __( 'Update failed.' ) )
|
||||
.text( buttonText )
|
||||
.removeClass( 'updating-message' );
|
||||
|
||||
if ( response.pluginName ) {
|
||||
$card.find( '.update-now' )
|
||||
.attr(
|
||||
'aria-label',
|
||||
sprintf(
|
||||
/* translators: %s: Plugin name and version. */
|
||||
_x( '%s update failed.', 'plugin' ),
|
||||
response.pluginName
|
||||
)
|
||||
);
|
||||
ariaLabel = sprintf(
|
||||
/* translators: %s: Plugin name and version. */
|
||||
_x( '%s update failed.', 'plugin' ),
|
||||
response.pluginName
|
||||
);
|
||||
|
||||
$card.find( '.update-now' ).attr( 'aria-label', ariaLabel );
|
||||
} else {
|
||||
ariaLabel = '';
|
||||
$card.find( '.update-now' ).removeAttr( 'aria-label' );
|
||||
}
|
||||
|
||||
@@ -652,6 +707,18 @@
|
||||
|
||||
wp.a11y.speak( errorMessage, 'assertive' );
|
||||
|
||||
if ( 'plugin-information-footer' === $card.attr('id' ) ) {
|
||||
wp.updates.setCardButtonStatus(
|
||||
{
|
||||
status: 'plugin-update-failed',
|
||||
slug: response.slug,
|
||||
removeClasses: 'updating-message',
|
||||
text: buttonText,
|
||||
ariaLabel: ariaLabel
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$document.trigger( 'wp-plugin-update-error', response );
|
||||
};
|
||||
|
||||
@@ -668,8 +735,10 @@
|
||||
* decorated with an abort() method.
|
||||
*/
|
||||
wp.updates.installPlugin = function( args ) {
|
||||
var $card = $( '.plugin-card-' + args.slug ),
|
||||
$message = $card.find( '.install-now' );
|
||||
var $card = $( '.plugin-card-' + args.slug + ', #plugin-information-footer' ),
|
||||
$message = $card.find( '.install-now' ),
|
||||
buttonText = __( 'Installing...' ),
|
||||
ariaLabel;
|
||||
|
||||
args = _.extend( {
|
||||
success: wp.updates.installPluginSuccess,
|
||||
@@ -684,17 +753,16 @@
|
||||
$message.data( 'originaltext', $message.html() );
|
||||
}
|
||||
|
||||
ariaLabel = sprintf(
|
||||
/* translators: %s: Plugin name and version. */
|
||||
_x( 'Installing %s...', 'plugin' ),
|
||||
$message.data( 'name' )
|
||||
);
|
||||
|
||||
$message
|
||||
.addClass( 'updating-message' )
|
||||
.attr(
|
||||
'aria-label',
|
||||
sprintf(
|
||||
/* translators: %s: Plugin name and version. */
|
||||
_x( 'Installing %s...', 'plugin' ),
|
||||
$message.data( 'name' )
|
||||
)
|
||||
)
|
||||
.text( __( 'Installing...' ) );
|
||||
.attr( 'aria-label', ariaLabel )
|
||||
.text( buttonText );
|
||||
|
||||
wp.a11y.speak( __( 'Installing... please wait.' ) );
|
||||
|
||||
@@ -703,6 +771,18 @@
|
||||
|
||||
$document.trigger( 'wp-plugin-installing', args );
|
||||
|
||||
if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
|
||||
wp.updates.setCardButtonStatus(
|
||||
{
|
||||
status: 'installing-plugin',
|
||||
slug: args.slug,
|
||||
addClasses: 'updating-message',
|
||||
text: buttonText,
|
||||
ariaLabel: ariaLabel
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return wp.updates.ajax( 'install-plugin', args );
|
||||
};
|
||||
|
||||
@@ -717,20 +797,19 @@
|
||||
* @param {string} response.activateUrl URL to activate the just installed plugin.
|
||||
*/
|
||||
wp.updates.installPluginSuccess = function( response ) {
|
||||
var $message = $( '.plugin-card-' + response.slug ).find( '.install-now' );
|
||||
var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.install-now' ),
|
||||
buttonText = _x( 'Installed!', 'plugin' ),
|
||||
ariaLabel = sprintf(
|
||||
/* translators: %s: Plugin name and version. */
|
||||
_x( '%s installed!', 'plugin' ),
|
||||
response.pluginName
|
||||
);
|
||||
|
||||
$message
|
||||
.removeClass( 'updating-message' )
|
||||
.addClass( 'updated-message installed button-disabled' )
|
||||
.attr(
|
||||
'aria-label',
|
||||
sprintf(
|
||||
/* translators: %s: Plugin name and version. */
|
||||
_x( '%s installed!', 'plugin' ),
|
||||
response.pluginName
|
||||
)
|
||||
)
|
||||
.text( _x( 'Installed!', 'plugin' ) );
|
||||
.attr( 'aria-label', ariaLabel )
|
||||
.text( buttonText );
|
||||
|
||||
wp.a11y.speak( __( 'Installation completed successfully.' ) );
|
||||
|
||||
@@ -738,37 +817,24 @@
|
||||
|
||||
if ( response.activateUrl ) {
|
||||
setTimeout( function() {
|
||||
|
||||
// Transform the 'Install' button into an 'Activate' button.
|
||||
$message.removeClass( 'install-now installed button-disabled updated-message' )
|
||||
.addClass( 'activate-now button-primary' )
|
||||
.attr( 'href', response.activateUrl );
|
||||
|
||||
if ( 'plugins-network' === pagenow ) {
|
||||
$message
|
||||
.attr(
|
||||
'aria-label',
|
||||
sprintf(
|
||||
/* translators: %s: Plugin name. */
|
||||
_x( 'Network Activate %s', 'plugin' ),
|
||||
response.pluginName
|
||||
)
|
||||
)
|
||||
.text( __( 'Network Activate' ) );
|
||||
} else {
|
||||
$message
|
||||
.attr(
|
||||
'aria-label',
|
||||
sprintf(
|
||||
/* translators: %s: Plugin name. */
|
||||
_x( 'Activate %s', 'plugin' ),
|
||||
response.pluginName
|
||||
)
|
||||
)
|
||||
.text( __( 'Activate' ) );
|
||||
}
|
||||
wp.updates.checkPluginDependencies( {
|
||||
slug: response.slug
|
||||
} );
|
||||
}, 1000 );
|
||||
}
|
||||
|
||||
if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
|
||||
wp.updates.setCardButtonStatus(
|
||||
{
|
||||
status: 'installed-plugin',
|
||||
slug: response.slug,
|
||||
removeClasses: 'updating-message',
|
||||
addClasses: 'updated-message installed button-disabled',
|
||||
text: buttonText,
|
||||
ariaLabel: ariaLabel
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -783,8 +849,14 @@
|
||||
* @param {string} response.errorMessage The error that occurred.
|
||||
*/
|
||||
wp.updates.installPluginError = function( response ) {
|
||||
var $card = $( '.plugin-card-' + response.slug ),
|
||||
var $card = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ),
|
||||
$button = $card.find( '.install-now' ),
|
||||
buttonText = __( 'Installation failed.' ),
|
||||
ariaLabel = sprintf(
|
||||
/* translators: %s: Plugin name and version. */
|
||||
_x( '%s installation failed', 'plugin' ),
|
||||
$button.data( 'name' )
|
||||
),
|
||||
errorMessage;
|
||||
|
||||
if ( ! wp.updates.isValidResponse( response, 'install' ) ) {
|
||||
@@ -817,21 +889,334 @@
|
||||
|
||||
$button
|
||||
.removeClass( 'updating-message' ).addClass( 'button-disabled' )
|
||||
.attr(
|
||||
'aria-label',
|
||||
sprintf(
|
||||
/* translators: %s: Plugin name and version. */
|
||||
_x( '%s installation failed', 'plugin' ),
|
||||
$button.data( 'name' )
|
||||
)
|
||||
)
|
||||
.text( __( 'Installation failed.' ) );
|
||||
.attr( 'aria-label', ariaLabel )
|
||||
.text( buttonText );
|
||||
|
||||
wp.a11y.speak( errorMessage, 'assertive' );
|
||||
|
||||
wp.updates.setCardButtonStatus(
|
||||
{
|
||||
status: 'plugin-install-failed',
|
||||
slug: response.slug,
|
||||
removeClasses: 'updating-message',
|
||||
addClasses: 'button-disabled',
|
||||
text: buttonText,
|
||||
ariaLabel: ariaLabel
|
||||
}
|
||||
);
|
||||
|
||||
$document.trigger( 'wp-plugin-install-error', response );
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends an Ajax request to the server to check a plugin's dependencies.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param {Object} args Arguments.
|
||||
* @param {string} args.slug Plugin identifier in the WordPress.org Plugin repository.
|
||||
* @param {checkPluginDependenciesSuccess=} args.success Optional. Success callback. Default: wp.updates.checkPluginDependenciesSuccess
|
||||
* @param {checkPluginDependenciesError=} args.error Optional. Error callback. Default: wp.updates.checkPluginDependenciesError
|
||||
* @return {$.promise} A jQuery promise that represents the request,
|
||||
* decorated with an abort() method.
|
||||
*/
|
||||
wp.updates.checkPluginDependencies = function( args ) {
|
||||
args = _.extend( {
|
||||
success: wp.updates.checkPluginDependenciesSuccess,
|
||||
error: wp.updates.checkPluginDependenciesError
|
||||
}, args );
|
||||
|
||||
wp.a11y.speak( __( 'Checking plugin dependencies... please wait.' ) );
|
||||
$document.trigger( 'wp-checking-plugin-dependencies', args );
|
||||
|
||||
return wp.updates.ajax( 'check_plugin_dependencies', args );
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the UI appropriately after a successful plugin dependencies check.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param {Object} response Response from the server.
|
||||
* @param {string} response.slug Slug of the checked plugin.
|
||||
* @param {string} response.pluginName Name of the checked plugin.
|
||||
* @param {string} response.plugin The plugin file, relative to the plugins directory.
|
||||
* @param {string} response.activateUrl URL to activate the just checked plugin.
|
||||
*/
|
||||
wp.updates.checkPluginDependenciesSuccess = function( response ) {
|
||||
var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.install-now' ),
|
||||
buttonText, ariaLabel;
|
||||
|
||||
// Transform the 'Install' button into an 'Activate' button.
|
||||
$message
|
||||
.removeClass( 'install-now installed button-disabled updated-message' )
|
||||
.addClass( 'activate-now button-primary' )
|
||||
.attr( 'href', response.activateUrl );
|
||||
|
||||
wp.a11y.speak( __( 'Plugin dependencies check completed successfully.' ) );
|
||||
$document.trigger( 'wp-check-plugin-dependencies-success', response );
|
||||
|
||||
if ( 'plugins-network' === pagenow ) {
|
||||
buttonText = _x( 'Network Activate', 'plugin' );
|
||||
ariaLabel = sprintf(
|
||||
/* translators: %s: Plugin name. */
|
||||
_x( 'Network Activate %s', 'plugin' ),
|
||||
response.pluginName
|
||||
);
|
||||
|
||||
$message
|
||||
.attr( 'aria-label', ariaLabel )
|
||||
.text( buttonText );
|
||||
} else {
|
||||
buttonText = _x( 'Activate', 'plugin' );
|
||||
ariaLabel = sprintf(
|
||||
/* translators: %s: Plugin name. */
|
||||
_x( 'Activate %s', 'plugin' ),
|
||||
response.pluginName
|
||||
);
|
||||
|
||||
$message
|
||||
.attr( 'aria-label', ariaLabel )
|
||||
.attr( 'data-name', response.pluginName )
|
||||
.attr( 'data-slug', response.slug )
|
||||
.attr( 'data-plugin', response.plugin )
|
||||
.text( buttonText );
|
||||
}
|
||||
|
||||
if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
|
||||
wp.updates.setCardButtonStatus(
|
||||
{
|
||||
status: 'dependencies-check-success',
|
||||
slug: response.slug,
|
||||
removeClasses: 'install-now installed button-disabled updated-message',
|
||||
addClasses: 'activate-now button-primary',
|
||||
text: buttonText,
|
||||
ariaLabel: ariaLabel,
|
||||
pluginName: response.pluginName,
|
||||
plugin: response.plugin,
|
||||
href: response.activateUrl
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the UI appropriately after a failed plugin dependencies check.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param {Object} response Response from the server.
|
||||
* @param {string} response.slug Slug of the plugin to be checked.
|
||||
* @param {string=} response.pluginName Optional. Name of the plugin to be checked.
|
||||
* @param {string} response.errorCode Error code for the error that occurred.
|
||||
* @param {string} response.errorMessage The error that occurred.
|
||||
*/
|
||||
wp.updates.checkPluginDependenciesError = function( response ) {
|
||||
var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.install-now' ),
|
||||
buttonText = _x( 'Activate', 'plugin' ),
|
||||
ariaLabel = sprintf(
|
||||
/* translators: 1: Plugin name, 2. The reason the plugin cannot be activated. */
|
||||
_x( 'Cannot activate %1$s. %2$s', 'plugin' ),
|
||||
response.pluginName,
|
||||
response.errorMessage
|
||||
),
|
||||
errorMessage;
|
||||
|
||||
if ( ! wp.updates.isValidResponse( response, 'check-dependencies' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
errorMessage = sprintf(
|
||||
/* translators: %s: Error string for a failed activation. */
|
||||
__( 'Activation failed: %s' ),
|
||||
response.errorMessage
|
||||
);
|
||||
|
||||
wp.a11y.speak( errorMessage, 'assertive' );
|
||||
$document.trigger( 'wp-check-plugin-dependencies-error', response );
|
||||
|
||||
$message
|
||||
.removeClass( 'install-now installed updated-message' )
|
||||
.addClass( 'activate-now button-primary' )
|
||||
.attr( 'aria-label', ariaLabel )
|
||||
.text( buttonText );
|
||||
|
||||
if ( 'plugin-information-footer' === $message.parent().attr('id' ) ) {
|
||||
wp.updates.setCardButtonStatus(
|
||||
{
|
||||
status: 'dependencies-check-failed',
|
||||
slug: response.slug,
|
||||
removeClasses: 'install-now installed updated-message',
|
||||
addClasses: 'activate-now button-primary',
|
||||
text: buttonText,
|
||||
ariaLabel: ariaLabel
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends an Ajax request to the server to activate a plugin.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param {Object} args Arguments.
|
||||
* @param {string} args.name The name of the plugin.
|
||||
* @param {string} args.slug Plugin identifier in the WordPress.org Plugin repository.
|
||||
* @param {string} args.plugin The plugin file, relative to the plugins directory.
|
||||
* @param {activatePluginSuccess=} args.success Optional. Success callback. Default: wp.updates.activatePluginSuccess
|
||||
* @param {activatePluginError=} args.error Optional. Error callback. Default: wp.updates.activatePluginError
|
||||
* @return {$.promise} A jQuery promise that represents the request,
|
||||
* decorated with an abort() method.
|
||||
*/
|
||||
wp.updates.activatePlugin = function( args ) {
|
||||
var $message = $( '.plugin-card-' + args.slug + ', #plugin-information-footer' ).find( '.activate-now, .activating-message' );
|
||||
|
||||
args = _.extend( {
|
||||
success: wp.updates.activatePluginSuccess,
|
||||
error: wp.updates.activatePluginError
|
||||
}, args );
|
||||
|
||||
wp.a11y.speak( __( 'Activating... please wait.' ) );
|
||||
$document.trigger( 'wp-activating-plugin', args );
|
||||
|
||||
if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
|
||||
wp.updates.setCardButtonStatus(
|
||||
{
|
||||
status: 'activating-plugin',
|
||||
slug: args.slug,
|
||||
removeClasses: 'installed updated-message button-primary',
|
||||
addClasses: 'activating-message',
|
||||
text: __( 'Activating...' ),
|
||||
ariaLabel: sprintf(
|
||||
/* translators: %s: Plugin name. */
|
||||
_x( 'Activating %s', 'plugin' ),
|
||||
args.name
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return wp.updates.ajax( 'activate-plugin', args );
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the UI appropriately after a successful plugin activation.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param {Object} response Response from the server.
|
||||
* @param {string} response.slug Slug of the activated plugin.
|
||||
* @param {string} response.pluginName Name of the activated plugin.
|
||||
* @param {string} response.plugin The plugin file, relative to the plugins directory.
|
||||
*/
|
||||
wp.updates.activatePluginSuccess = function( response ) {
|
||||
var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.activating-message' ),
|
||||
buttonText = _x( 'Activated!', 'plugin' ),
|
||||
ariaLabel = sprintf(
|
||||
/* translators: %s: The plugin name. */
|
||||
'%s activated successfully.',
|
||||
response.pluginName
|
||||
);
|
||||
|
||||
wp.a11y.speak( __( 'Activation completed successfully.' ) );
|
||||
$document.trigger( 'wp-plugin-activate-success', response );
|
||||
|
||||
$message
|
||||
.removeClass( 'activating-message' )
|
||||
.addClass( 'activated-message button-disabled' )
|
||||
.attr( 'aria-label', ariaLabel )
|
||||
.text( buttonText );
|
||||
|
||||
if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
|
||||
wp.updates.setCardButtonStatus(
|
||||
{
|
||||
status: 'activated-plugin',
|
||||
slug: response.slug,
|
||||
removeClasses: 'activating-message',
|
||||
addClasses: 'activated-message button-disabled',
|
||||
text: buttonText,
|
||||
ariaLabel: ariaLabel
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
setTimeout( function() {
|
||||
$message.removeClass( 'activated-message' )
|
||||
.text( _x( 'Active', 'plugin' ) );
|
||||
|
||||
if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
|
||||
wp.updates.setCardButtonStatus(
|
||||
{
|
||||
status: 'plugin-active',
|
||||
slug: response.slug,
|
||||
removeClasses: 'activated-message',
|
||||
text: _x( 'Active', 'plugin' ),
|
||||
ariaLabel: sprintf(
|
||||
/* translators: %s: The plugin name. */
|
||||
'%s is active.',
|
||||
response.pluginName
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
}, 1000 );
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the UI appropriately after a failed plugin activation.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param {Object} response Response from the server.
|
||||
* @param {string} response.slug Slug of the plugin to be activated.
|
||||
* @param {string=} response.pluginName Optional. Name of the plugin to be activated.
|
||||
* @param {string} response.errorCode Error code for the error that occurred.
|
||||
* @param {string} response.errorMessage The error that occurred.
|
||||
*/
|
||||
wp.updates.activatePluginError = function( response ) {
|
||||
var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.activating-message' ),
|
||||
buttonText = __( 'Activation failed.' ),
|
||||
ariaLabel = sprintf(
|
||||
/* translators: %s: Plugin name. */
|
||||
_x( '%s activation failed', 'plugin' ),
|
||||
response.pluginName
|
||||
),
|
||||
errorMessage;
|
||||
|
||||
if ( ! wp.updates.isValidResponse( response, 'activate' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
errorMessage = sprintf(
|
||||
/* translators: %s: Error string for a failed activation. */
|
||||
__( 'Activation failed: %s' ),
|
||||
response.errorMessage
|
||||
);
|
||||
|
||||
wp.a11y.speak( errorMessage, 'assertive' );
|
||||
$document.trigger( 'wp-plugin-activate-error', response );
|
||||
|
||||
$message
|
||||
.removeClass( 'install-now installed activating-message' )
|
||||
.addClass( 'button-disabled' )
|
||||
.attr( 'aria-label', ariaLabel )
|
||||
.text( buttonText );
|
||||
|
||||
if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
|
||||
wp.updates.setCardButtonStatus(
|
||||
{
|
||||
status: 'plugin-activation-failed',
|
||||
slug: response.slug,
|
||||
removeClasses: 'install-now installed activating-message',
|
||||
addClasses: 'button-disabled',
|
||||
text: buttonText,
|
||||
ariaLabel: ariaLabel
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the UI appropriately after a successful importer install.
|
||||
*
|
||||
@@ -915,7 +1300,7 @@
|
||||
pluginName
|
||||
)
|
||||
)
|
||||
.text( __( 'Install Now' ) );
|
||||
.text( _x( 'Install Now', 'plugin' ) );
|
||||
|
||||
wp.a11y.speak( errorMessage, 'assertive' );
|
||||
|
||||
@@ -1069,7 +1454,7 @@
|
||||
$itemsCount.text(
|
||||
sprintf(
|
||||
/* translators: %s: The remaining number of plugins. */
|
||||
_nx( '%s item', '%s items', 'plugin/plugins', remainingCount ),
|
||||
_nx( '%s item', '%s items', remainingCount, 'plugin/plugins' ),
|
||||
remainingCount
|
||||
)
|
||||
);
|
||||
@@ -1418,7 +1803,7 @@
|
||||
response.themeName
|
||||
)
|
||||
)
|
||||
.text( __( 'Activate' ) );
|
||||
.text( _x( 'Activate', 'theme' ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1970,6 +2355,16 @@
|
||||
errorMessage = __( 'Installation failed: %s' );
|
||||
break;
|
||||
|
||||
case 'check-dependencies':
|
||||
/* translators: %s: Error string for a failed dependencies check. */
|
||||
errorMessage = __( 'Dependencies check failed: %s' );
|
||||
break;
|
||||
|
||||
case 'activate':
|
||||
/* translators: %s: Error string for a failed activation. */
|
||||
errorMessage = __( 'Activation failed: %s' );
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
/* translators: %s: Error string for a failed deletion. */
|
||||
errorMessage = __( 'Deletion failed: %s' );
|
||||
@@ -2025,7 +2420,7 @@
|
||||
};
|
||||
|
||||
$( function() {
|
||||
var $pluginFilter = $( '#plugin-filter' ),
|
||||
var $pluginFilter = $( '#plugin-filter, #plugin-information-footer' ),
|
||||
$bulkActionForm = $( '#bulk-action-form' ),
|
||||
$filesystemForm = $( '#request-filesystem-credentials-form' ),
|
||||
$filesystemModal = $( '#request-filesystem-credentials-dialog' ),
|
||||
@@ -2230,7 +2625,7 @@
|
||||
|
||||
$message
|
||||
.removeClass( 'updating-message' )
|
||||
.text( __( 'Install Now' ) );
|
||||
.text( _x( 'Install Now', 'plugin' ) );
|
||||
|
||||
wp.a11y.speak( __( 'Update canceled.' ) );
|
||||
} );
|
||||
@@ -2241,6 +2636,44 @@
|
||||
} );
|
||||
} );
|
||||
|
||||
/**
|
||||
* Click handler for plugin activations in plugin activation view.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param {Event} event Event interface.
|
||||
*/
|
||||
$pluginFilter.on( 'click', '.activate-now', function( event ) {
|
||||
var $activateButton = $( event.target );
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if ( $activateButton.hasClass( 'activating-message' ) || $activateButton.hasClass( 'button-disabled' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$activateButton
|
||||
.removeClass( 'activate-now button-primary' )
|
||||
.addClass( 'activating-message' )
|
||||
.attr(
|
||||
'aria-label',
|
||||
sprintf(
|
||||
/* translators: %s: Plugin name. */
|
||||
_x( 'Activating %s', 'plugin' ),
|
||||
$activateButton.data( 'name' )
|
||||
)
|
||||
)
|
||||
.text( __( 'Activating...' ) );
|
||||
|
||||
wp.updates.activatePlugin(
|
||||
{
|
||||
name: $activateButton.data( 'name' ),
|
||||
slug: $activateButton.data( 'slug' ),
|
||||
plugin: $activateButton.data( 'plugin' )
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Click handler for importer plugins installs in the Import screen.
|
||||
*
|
||||
@@ -2273,7 +2706,7 @@
|
||||
pluginName
|
||||
)
|
||||
)
|
||||
.text( __( 'Install Now' ) );
|
||||
.text( _x( 'Install Now', 'plugin' ) );
|
||||
|
||||
wp.a11y.speak( __( 'Update canceled.' ) );
|
||||
} );
|
||||
@@ -2766,35 +3199,6 @@
|
||||
target.postMessage( JSON.stringify( update ), window.location.origin );
|
||||
} );
|
||||
|
||||
/**
|
||||
* Click handler for installing a plugin from the details modal on `plugin-install.php`.
|
||||
*
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @param {Event} event Event interface.
|
||||
*/
|
||||
$( '#plugin_install_from_iframe' ).on( 'click', function( event ) {
|
||||
var target = window.parent === window ? null : window.parent,
|
||||
install;
|
||||
|
||||
$.support.postMessage = !! window.postMessage;
|
||||
|
||||
if ( false === $.support.postMessage || null === target || -1 !== window.parent.location.pathname.indexOf( 'index.php' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
install = {
|
||||
action: 'install-plugin',
|
||||
data: {
|
||||
slug: $( this ).data( 'slug' )
|
||||
}
|
||||
};
|
||||
|
||||
target.postMessage( JSON.stringify( install ), window.location.origin );
|
||||
} );
|
||||
|
||||
/**
|
||||
* Handles postMessage events.
|
||||
*
|
||||
@@ -2818,7 +3222,45 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! message || 'undefined' === typeof message.action ) {
|
||||
if ( ! message ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
'undefined' !== typeof message.status &&
|
||||
'undefined' !== typeof message.slug &&
|
||||
'undefined' !== typeof message.text &&
|
||||
'undefined' !== typeof message.ariaLabel
|
||||
) {
|
||||
var $card = $( '.plugin-card-' + message.slug ),
|
||||
$message = $card.find( '[data-slug="' + message.slug + '"]' );
|
||||
|
||||
if ( 'undefined' !== typeof message.removeClasses ) {
|
||||
$message.removeClass( message.removeClasses );
|
||||
}
|
||||
|
||||
if ( 'undefined' !== typeof message.addClasses ) {
|
||||
$message.addClass( message.addClasses );
|
||||
}
|
||||
|
||||
if ( '' === message.ariaLabel ) {
|
||||
$message.removeAttr( 'aria-label' );
|
||||
} else {
|
||||
$message.attr( 'aria-label', message.ariaLabel );
|
||||
}
|
||||
|
||||
if ( 'dependencies-check-success' === message.status ) {
|
||||
$message
|
||||
.attr( 'data-name', message.pluginName )
|
||||
.attr( 'data-slug', message.slug )
|
||||
.attr( 'data-plugin', message.plugin )
|
||||
.attr( 'href', message.href );
|
||||
}
|
||||
|
||||
$message.text( message.text );
|
||||
}
|
||||
|
||||
if ( 'undefined' === typeof message.action ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2832,9 +3274,9 @@
|
||||
|
||||
case 'install-plugin':
|
||||
case 'update-plugin':
|
||||
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
|
||||
window.tb_remove();
|
||||
/* jscs:enable */
|
||||
if ( 'undefined' === typeof message.data || 'undefined' === typeof message.data.slug ) {
|
||||
return;
|
||||
}
|
||||
|
||||
message.data = wp.updates._addCallbacks( message.data, message.action );
|
||||
|
||||
|
||||
2
wp/wp-admin/js/updates.min.js
vendored
2
wp/wp-admin/js/updates.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -311,7 +311,7 @@
|
||||
$('#pass-strength-result').addClass('short').html( pwsL10n.mismatch );
|
||||
break;
|
||||
default:
|
||||
$('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
|
||||
$('#pass-strength-result').addClass('short').html( pwsL10n.short );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user