rebase on oct-10-2023
This commit is contained in:
@@ -1407,8 +1407,8 @@ $( function() {
|
||||
* @return {void}
|
||||
*/
|
||||
$('#contextual-help-link, #show-settings-link').on( 'focus.scroll-into-view', function(e){
|
||||
if ( e.target.scrollIntoView )
|
||||
e.target.scrollIntoView(false);
|
||||
if ( e.target.scrollIntoViewIfNeeded )
|
||||
e.target.scrollIntoViewIfNeeded(false);
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
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
@@ -1,9 +1,15 @@
|
||||
/*!
|
||||
* Farbtastic: jQuery color picker plug-in v1.3u
|
||||
* https://github.com/mattfarina/farbtastic
|
||||
*
|
||||
* Licensed under the GPL license:
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
/**
|
||||
* Modified for WordPress: replaced deprecated jQuery methods.
|
||||
* See https://core.trac.wordpress.org/ticket/57946.
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.fn.farbtastic = function (options) {
|
||||
@@ -49,7 +55,7 @@ $._farbtastic = function (container, callback) {
|
||||
fb.linkTo = function (callback) {
|
||||
// Unbind previous nodes
|
||||
if (typeof fb.callback == 'object') {
|
||||
$(fb.callback).unbind('keyup', fb.updateValue);
|
||||
$(fb.callback).off('keyup', fb.updateValue);
|
||||
}
|
||||
|
||||
// Reset color
|
||||
@@ -61,7 +67,7 @@ $._farbtastic = function (container, callback) {
|
||||
}
|
||||
else if (typeof callback == 'object' || typeof callback == 'string') {
|
||||
fb.callback = $(callback);
|
||||
fb.callback.bind('keyup', fb.updateValue);
|
||||
fb.callback.on('keyup', fb.updateValue);
|
||||
if (fb.callback.get(0).value) {
|
||||
fb.setColor(fb.callback.get(0).value);
|
||||
}
|
||||
@@ -116,7 +122,7 @@ $._farbtastic = function (container, callback) {
|
||||
fb.mousedown = function (event) {
|
||||
// Capture mouse
|
||||
if (!document.dragging) {
|
||||
$(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
|
||||
$(document).on('mousemove', fb.mousemove).on('mouseup', fb.mouseup);
|
||||
document.dragging = true;
|
||||
}
|
||||
|
||||
@@ -155,8 +161,8 @@ $._farbtastic = function (container, callback) {
|
||||
*/
|
||||
fb.mouseup = function () {
|
||||
// Uncapture mouse
|
||||
$(document).unbind('mousemove', fb.mousemove);
|
||||
$(document).unbind('mouseup', fb.mouseup);
|
||||
$(document).off('mousemove', fb.mousemove);
|
||||
$(document).off('mouseup', fb.mouseup);
|
||||
document.dragging = false;
|
||||
};
|
||||
|
||||
@@ -262,7 +268,7 @@ $._farbtastic = function (container, callback) {
|
||||
};
|
||||
|
||||
// Install mousedown handler (the others are set on the document on-demand)
|
||||
$('*', e).mousedown(fb.mousedown);
|
||||
$('*', e).on('mousedown', fb.mousedown);
|
||||
|
||||
// Init color
|
||||
fb.setColor('#000000');
|
||||
|
||||
@@ -22,25 +22,61 @@
|
||||
_view : false,
|
||||
|
||||
/**
|
||||
* Handle crop tool clicks.
|
||||
* Enable crop tool.
|
||||
*/
|
||||
handleCropToolClick: function( postid, nonce, cropButton ) {
|
||||
toggleCropTool: function( postid, nonce, cropButton ) {
|
||||
var img = $( '#image-preview-' + postid ),
|
||||
selection = this.iasapi.getSelection();
|
||||
|
||||
// Ensure selection is available, otherwise reset to full image.
|
||||
if ( isNaN( selection.x1 ) ) {
|
||||
this.setCropSelection( postid, { 'x1': 0, 'y1': 0, 'x2': img.innerWidth(), 'y2': img.innerHeight(), 'width': img.innerWidth(), 'height': img.innerHeight() } );
|
||||
selection = this.iasapi.getSelection();
|
||||
}
|
||||
|
||||
// If we don't already have a selection, select the entire image.
|
||||
if ( 0 === selection.x1 && 0 === selection.y1 && 0 === selection.x2 && 0 === selection.y2 ) {
|
||||
this.iasapi.setSelection( 0, 0, img.innerWidth(), img.innerHeight(), true );
|
||||
this.iasapi.setOptions( { show: true } );
|
||||
this.iasapi.update();
|
||||
imageEdit.toggleControls( cropButton );
|
||||
var $el = $( cropButton );
|
||||
var state = ( $el.attr( 'aria-expanded' ) === 'true' ) ? 'true' : 'false';
|
||||
// Crop tools have been closed.
|
||||
if ( 'false' === state ) {
|
||||
// Cancel selection, but do not unset inputs.
|
||||
this.iasapi.cancelSelection();
|
||||
imageEdit.setDisabled($('.imgedit-crop-clear'), 0);
|
||||
} else {
|
||||
imageEdit.setDisabled($('.imgedit-crop-clear'), 1);
|
||||
// Get values from inputs to restore previous selection.
|
||||
var startX = ( $( '#imgedit-start-x-' + postid ).val() ) ? $('#imgedit-start-x-' + postid).val() : 0;
|
||||
var startY = ( $( '#imgedit-start-y-' + postid ).val() ) ? $('#imgedit-start-y-' + postid).val() : 0;
|
||||
var width = ( $( '#imgedit-sel-width-' + postid ).val() ) ? $('#imgedit-sel-width-' + postid).val() : img.innerWidth();
|
||||
var height = ( $( '#imgedit-sel-height-' + postid ).val() ) ? $('#imgedit-sel-height-' + postid).val() : img.innerHeight();
|
||||
// Ensure selection is available, otherwise reset to full image.
|
||||
if ( isNaN( selection.x1 ) ) {
|
||||
this.setCropSelection( postid, { 'x1': startX, 'y1': startY, 'x2': width, 'y2': height, 'width': width, 'height': height } );
|
||||
selection = this.iasapi.getSelection();
|
||||
}
|
||||
|
||||
// If we don't already have a selection, select the entire image.
|
||||
if ( 0 === selection.x1 && 0 === selection.y1 && 0 === selection.x2 && 0 === selection.y2 ) {
|
||||
this.iasapi.setSelection( 0, 0, img.innerWidth(), img.innerHeight(), true );
|
||||
this.iasapi.setOptions( { show: true } );
|
||||
this.iasapi.update();
|
||||
} else {
|
||||
this.iasapi.setSelection( startX, startY, width, height, true );
|
||||
this.iasapi.setOptions( { show: true } );
|
||||
this.iasapi.update();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle crop tool clicks.
|
||||
*/
|
||||
handleCropToolClick: function( postid, nonce, cropButton ) {
|
||||
|
||||
if ( cropButton.classList.contains( 'imgedit-crop-clear' ) ) {
|
||||
this.iasapi.cancelSelection();
|
||||
imageEdit.setDisabled($('.imgedit-crop-apply'), 0);
|
||||
|
||||
$('#imgedit-sel-width-' + postid).val('');
|
||||
$('#imgedit-sel-height-' + postid).val('');
|
||||
$('#imgedit-start-x-' + postid).val('0');
|
||||
$('#imgedit-start-y-' + postid).val('0');
|
||||
$('#imgedit-selection-' + postid).val('');
|
||||
} else {
|
||||
// Otherwise, perform the crop.
|
||||
imageEdit.crop( postid, nonce , cropButton );
|
||||
}
|
||||
@@ -122,6 +158,17 @@
|
||||
t.postid = postid;
|
||||
$('#imgedit-response-' + postid).empty();
|
||||
|
||||
$('#imgedit-panel-' + postid).on( 'keypress', function(e) {
|
||||
var nonce = $( '#imgedit-nonce-' + postid ).val();
|
||||
if ( e.which === 26 && e.ctrlKey ) {
|
||||
imageEdit.undo( postid, nonce );
|
||||
}
|
||||
|
||||
if ( e.which === 25 && e.ctrlKey ) {
|
||||
imageEdit.redo( postid, nonce );
|
||||
}
|
||||
});
|
||||
|
||||
$('#imgedit-panel-' + postid).on( 'keypress', 'input[type="text"]', function(e) {
|
||||
var k = e.keyCode;
|
||||
|
||||
@@ -169,6 +216,93 @@
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows or hides image menu popup.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {HTMLElement} el The activated control element.
|
||||
*
|
||||
* @return {boolean} Always returns false.
|
||||
*/
|
||||
togglePopup : function(el) {
|
||||
var $el = $( el );
|
||||
var $targetEl = $( el ).attr( 'aria-controls' );
|
||||
var $target = $( '#' + $targetEl );
|
||||
$el
|
||||
.attr( 'aria-expanded', 'false' === $el.attr( 'aria-expanded' ) ? 'true' : 'false' );
|
||||
// Open menu and set z-index to appear above image crop area if it is enabled.
|
||||
$target
|
||||
.toggleClass( 'imgedit-popup-menu-open' ).slideToggle( 'fast' ).css( { 'z-index' : 200000 } );
|
||||
// Move focus to first item in menu.
|
||||
$target.find( 'button' ).first().trigger( 'focus' );
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Navigate popup menu by arrow keys.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {HTMLElement} el The current element.
|
||||
*
|
||||
* @return {boolean} Always returns false.
|
||||
*/
|
||||
browsePopup : function(el) {
|
||||
var $el = $( el );
|
||||
var $collection = $( el ).parent( '.imgedit-popup-menu' ).find( 'button' );
|
||||
var $index = $collection.index( $el );
|
||||
var $prev = $index - 1;
|
||||
var $next = $index + 1;
|
||||
var $last = $collection.length;
|
||||
if ( $prev < 0 ) {
|
||||
$prev = $last - 1;
|
||||
}
|
||||
if ( $next === $last ) {
|
||||
$next = 0;
|
||||
}
|
||||
var $target = false;
|
||||
if ( event.keyCode === 40 ) {
|
||||
$target = $collection.get( $next );
|
||||
} else if ( event.keyCode === 38 ) {
|
||||
$target = $collection.get( $prev );
|
||||
}
|
||||
if ( $target ) {
|
||||
$target.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Close popup menu and reset focus on feature activation.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {HTMLElement} el The current element.
|
||||
*
|
||||
* @return {boolean} Always returns false.
|
||||
*/
|
||||
closePopup : function(el) {
|
||||
var $parent = $(el).parent( '.imgedit-popup-menu' );
|
||||
var $controlledID = $parent.attr( 'id' );
|
||||
var $target = $( 'button[aria-controls="' + $controlledID + '"]' );
|
||||
$target
|
||||
.attr( 'aria-expanded', 'false' ).trigger( 'focus' );
|
||||
$parent
|
||||
.toggleClass( 'imgedit-popup-menu-open' ).slideToggle( 'fast' );
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows or hides the image edit help box.
|
||||
*
|
||||
@@ -189,6 +323,28 @@
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shows or hides image edit input fields when enabled.
|
||||
*
|
||||
* @since 6.3.0
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {HTMLElement} el The element to trigger the edit panel.
|
||||
*
|
||||
* @return {boolean} Always returns false.
|
||||
*/
|
||||
toggleControls : function(el) {
|
||||
var $el = $( el );
|
||||
var $target = $( '#' + $el.attr( 'aria-controls' ) );
|
||||
$el
|
||||
.attr( 'aria-expanded', 'false' === $el.attr( 'aria-expanded' ) ? 'true' : 'false' );
|
||||
$target
|
||||
.parent( '.imgedit-group' ).toggleClass( 'imgedit-panel-active' );
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the value from the image edit target.
|
||||
*
|
||||
@@ -202,10 +358,16 @@
|
||||
* @param {number} postid The post ID.
|
||||
*
|
||||
* @return {string} The value from the imagedit-save-target input field when available,
|
||||
* or 'full' when not available.
|
||||
* 'full' when not selected, or 'all' if it doesn't exist.
|
||||
*/
|
||||
getTarget : function(postid) {
|
||||
return $('input[name="imgedit-target-' + postid + '"]:checked', '#imgedit-save-target-' + postid).val() || 'full';
|
||||
getTarget : function( postid ) {
|
||||
var element = $( '#imgedit-save-target-' + postid );
|
||||
|
||||
if ( element.length ) {
|
||||
return element.find( 'input[name="imgedit-target-' + postid + '"]:checked' ).val() || 'full';
|
||||
}
|
||||
|
||||
return 'all';
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -226,7 +388,8 @@
|
||||
*/
|
||||
scaleChanged : function( postid, x, el ) {
|
||||
var w = $('#imgedit-scale-width-' + postid), h = $('#imgedit-scale-height-' + postid),
|
||||
warn = $('#imgedit-scale-warn-' + postid), w1 = '', h1 = '';
|
||||
warn = $('#imgedit-scale-warn-' + postid), w1 = '', h1 = '',
|
||||
scaleBtn = $('#imgedit-scale-button');
|
||||
|
||||
if ( false === this.validateNumeric( el ) ) {
|
||||
return;
|
||||
@@ -242,8 +405,10 @@
|
||||
|
||||
if ( ( h1 && h1 > this.hold.oh ) || ( w1 && w1 > this.hold.ow ) ) {
|
||||
warn.css('visibility', 'visible');
|
||||
scaleBtn.prop('disabled', true);
|
||||
} else {
|
||||
warn.css('visibility', 'hidden');
|
||||
scaleBtn.prop('disabled', false);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -402,12 +567,14 @@
|
||||
}
|
||||
|
||||
if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() === '0' ) {
|
||||
$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', false);
|
||||
$('button.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', false);
|
||||
} else {
|
||||
$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true);
|
||||
$('button.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true);
|
||||
}
|
||||
var successMessage = __( 'Image updated.' );
|
||||
|
||||
t.toggleEditor(postid, 0);
|
||||
wp.a11y.speak( successMessage, 'assertive' );
|
||||
})
|
||||
.on( 'error', function() {
|
||||
var errorMessage = __( 'Could not load the preview image. Please reload the page and try again.' );
|
||||
@@ -435,7 +602,7 @@
|
||||
*
|
||||
* @return {boolean|void} Executes a post request that refreshes the page
|
||||
* when the action is performed.
|
||||
* Returns false if a invalid action is given,
|
||||
* Returns false if an invalid action is given,
|
||||
* or when the action cannot be performed.
|
||||
*/
|
||||
action : function(postid, nonce, action) {
|
||||
@@ -710,6 +877,8 @@
|
||||
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;
|
||||
|
||||
@@ -768,6 +937,8 @@
|
||||
*/
|
||||
onSelectStart: function() {
|
||||
imageEdit.setDisabled($('#imgedit-crop-sel-' + postid), 1);
|
||||
imageEdit.setDisabled($('.imgedit-crop-clear'), 1);
|
||||
imageEdit.setDisabled($('.imgedit-crop-apply'), 1);
|
||||
},
|
||||
/**
|
||||
* Event triggered when the selection is ended.
|
||||
@@ -781,6 +952,9 @@
|
||||
*/
|
||||
onSelectEnd: function(img, c) {
|
||||
imageEdit.setCropSelection(postid, c);
|
||||
if ( ! $('#imgedit-crop > *').is(':visible') ) {
|
||||
imageEdit.toggleControls($('.imgedit-crop.button'));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -797,6 +971,8 @@
|
||||
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) );
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -823,6 +999,8 @@
|
||||
this.setDisabled( $( '#imgedit-crop-sel-' + postid ), 1 );
|
||||
$('#imgedit-sel-width-' + postid).val('');
|
||||
$('#imgedit-sel-height-' + postid).val('');
|
||||
$('#imgedit-start-x-' + postid).val('0');
|
||||
$('#imgedit-start-y-' + postid).val('0');
|
||||
$('#imgedit-selection-' + postid).val('');
|
||||
return false;
|
||||
}
|
||||
@@ -953,7 +1131,7 @@
|
||||
if ( $(t).hasClass('disabled') ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.closePopup(t);
|
||||
this.addStep({ 'r': { 'r': angle, 'fw': this.hold.h, 'fh': this.hold.w }}, postid, nonce);
|
||||
},
|
||||
|
||||
@@ -975,7 +1153,7 @@
|
||||
if ( $(t).hasClass('disabled') ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.closePopup(t);
|
||||
this.addStep({ 'f': { 'f': axis, 'fw': this.hold.w, 'fh': this.hold.h }}, postid, nonce);
|
||||
},
|
||||
|
||||
@@ -1011,6 +1189,8 @@
|
||||
// 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');
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1094,6 +1274,8 @@
|
||||
*/
|
||||
setNumSelection : function( postid, el ) {
|
||||
var sel, elX = $('#imgedit-sel-width-' + postid), elY = $('#imgedit-sel-height-' + postid),
|
||||
elX1 = $('#imgedit-start-x-' + postid), elY1 = $('#imgedit-start-y-' + postid),
|
||||
xS = this.intval( elX1.val() ), yS = this.intval( elY1.val() ),
|
||||
x = this.intval( elX.val() ), y = this.intval( elY.val() ),
|
||||
img = $('#image-preview-' + postid), imgh = img.height(), imgw = img.width(),
|
||||
sizer = this.hold.sizer, x1, y1, x2, y2, ias = this.iasapi;
|
||||
@@ -1112,11 +1294,11 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( x && y && ( sel = ias.getSelection() ) ) {
|
||||
if ( ( ( x && y ) || ( xS && yS ) ) && ( sel = ias.getSelection() ) ) {
|
||||
x2 = sel.x1 + Math.round( x * sizer );
|
||||
y2 = sel.y1 + Math.round( y * sizer );
|
||||
x1 = sel.x1;
|
||||
y1 = sel.y1;
|
||||
x1 = ( xS === sel.x1 ) ? sel.x1 : Math.round( xS * sizer );
|
||||
y1 = ( yS === sel.y1 ) ? sel.y1 : Math.round( yS * sizer );
|
||||
|
||||
if ( x2 > imgw ) {
|
||||
x1 = 0;
|
||||
@@ -1202,10 +1384,21 @@
|
||||
|
||||
if ( r > h ) {
|
||||
r = h;
|
||||
var errorMessage = __( 'Selected crop ratio exceeds the boundaries of the image. Try a different ratio.' );
|
||||
|
||||
$( '#imgedit-crop-' + postid )
|
||||
.prepend( '<div class="notice notice-error" tabindex="-1" role="alert"><p>' + errorMessage + '</p></div>' );
|
||||
|
||||
wp.a11y.speak( errorMessage, 'assertive' );
|
||||
if ( n ) {
|
||||
$('#imgedit-crop-height-' + postid).val('');
|
||||
$('#imgedit-crop-height-' + postid).val( '' );
|
||||
} else {
|
||||
$('#imgedit-crop-width-' + postid).val('');
|
||||
$('#imgedit-crop-width-' + postid).val( '');
|
||||
}
|
||||
} else {
|
||||
var error = $( '#imgedit-crop-' + postid ).find( '.notice-error' );
|
||||
if ( 'undefined' !== typeof( error ) ) {
|
||||
error.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1228,7 +1421,7 @@
|
||||
* void when it is.
|
||||
*/
|
||||
validateNumeric: function( el ) {
|
||||
if ( ! this.intval( $( el ).val() ) ) {
|
||||
if ( false === this.intval( $( el ).val() ) ) {
|
||||
$( el ).val( '' );
|
||||
return false;
|
||||
}
|
||||
|
||||
2
wp/wp-admin/js/image-edit.min.js
vendored
2
wp/wp-admin/js/image-edit.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -376,9 +376,14 @@ window.wp = window.wp || {};
|
||||
});
|
||||
|
||||
// Handle the post status.
|
||||
var post_date_string = $(':input[name="aa"]').val() + '-' + $(':input[name="mm"]').val() + '-' + $(':input[name="jj"]').val();
|
||||
post_date_string += ' ' + $(':input[name="hh"]').val() + ':' + $(':input[name="mn"]').val() + ':' + $(':input[name="ss"]').val();
|
||||
var post_date = new Date( post_date_string );
|
||||
status = $('._status', rowData).text();
|
||||
if ( 'future' !== status ) {
|
||||
if ( 'future' !== status && Date.now() > post_date ) {
|
||||
$('select[name="_status"] option[value="future"]', editRow).remove();
|
||||
} else {
|
||||
$('select[name="_status"] option[value="publish"]', editRow).remove();
|
||||
}
|
||||
|
||||
pw = $( '.inline-edit-password-input' ).prop( 'disabled', false );
|
||||
@@ -444,6 +449,13 @@ window.wp = window.wp || {};
|
||||
};
|
||||
|
||||
fields = $('#edit-'+id).find(':input').serialize();
|
||||
|
||||
var status = $(':input[name="_status"]').val();
|
||||
|
||||
if ( [ 'draft', 'pending', 'auto-draft' ].includes( status ) ) {
|
||||
params.edit_date = 'false';
|
||||
}
|
||||
|
||||
params = fields + '&' + $.param(params);
|
||||
|
||||
// Make Ajax request.
|
||||
|
||||
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
40
wp/wp-admin/js/password-toggle.js
Normal file
40
wp/wp-admin/js/password-toggle.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Adds functionality for password visibility buttons to toggle between text and password input types.
|
||||
*
|
||||
* @since 6.3.0
|
||||
* @output wp-admin/js/password-toggle.js
|
||||
*/
|
||||
|
||||
( function () {
|
||||
var toggleElements, status, input, icon, label, __ = wp.i18n.__;
|
||||
|
||||
toggleElements = document.querySelectorAll( '.pwd-toggle' );
|
||||
|
||||
toggleElements.forEach( function (toggle) {
|
||||
toggle.classList.remove( 'hide-if-no-js' );
|
||||
toggle.addEventListener( 'click', togglePassword );
|
||||
} );
|
||||
|
||||
function togglePassword() {
|
||||
status = this.getAttribute( 'data-toggle' );
|
||||
input = this.parentElement.children.namedItem( 'pwd' );
|
||||
icon = this.getElementsByClassName( 'dashicons' )[ 0 ];
|
||||
label = this.getElementsByClassName( 'text' )[ 0 ];
|
||||
|
||||
if ( 0 === parseInt( status, 10 ) ) {
|
||||
this.setAttribute( 'data-toggle', 1 );
|
||||
this.setAttribute( 'aria-label', __( 'Hide password' ) );
|
||||
input.setAttribute( 'type', 'text' );
|
||||
label.innerHTML = __( 'Hide' );
|
||||
icon.classList.remove( 'dashicons-visibility' );
|
||||
icon.classList.add( 'dashicons-hidden' );
|
||||
} else {
|
||||
this.setAttribute( 'data-toggle', 0 );
|
||||
this.setAttribute( 'aria-label', __( 'Show password' ) );
|
||||
input.setAttribute( 'type', 'password' );
|
||||
label.innerHTML = __( 'Show' );
|
||||
icon.classList.remove( 'dashicons-hidden' );
|
||||
icon.classList.add( 'dashicons-visibility' );
|
||||
}
|
||||
}
|
||||
} )();
|
||||
2
wp/wp-admin/js/password-toggle.min.js
vendored
Normal file
2
wp/wp-admin/js/password-toggle.min.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(){var t,e,s,i,a=wp.i18n.__;function d(){t=this.getAttribute("data-toggle"),e=this.parentElement.children.namedItem("pwd"),s=this.getElementsByClassName("dashicons")[0],i=this.getElementsByClassName("text")[0],0===parseInt(t,10)?(this.setAttribute("data-toggle",1),this.setAttribute("aria-label",a("Hide password")),e.setAttribute("type","text"),i.innerHTML=a("Hide"),s.classList.remove("dashicons-visibility"),s.classList.add("dashicons-hidden")):(this.setAttribute("data-toggle",0),this.setAttribute("aria-label",a("Show password")),e.setAttribute("type","password"),i.innerHTML=a("Show"),s.classList.remove("dashicons-hidden"),s.classList.add("dashicons-visibility"))}document.querySelectorAll(".pwd-toggle").forEach(function(t){t.classList.remove("hide-if-no-js"),t.addEventListener("click",d)})}();
|
||||
@@ -789,7 +789,7 @@ jQuery( function($) {
|
||||
}
|
||||
|
||||
// Determine what the publish should be depending on the date and post status.
|
||||
if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) {
|
||||
if ( attemptedDate > currentDate ) {
|
||||
publishOn = __( 'Schedule for:' );
|
||||
$('#publish').val( _x( 'Schedule', 'post action/button label' ) );
|
||||
} else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) {
|
||||
|
||||
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
@@ -515,7 +515,7 @@
|
||||
|
||||
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
|
||||
$pluginRow = $( 'tr[data-plugin="' + response.plugin + '"]' )
|
||||
.removeClass( 'update' )
|
||||
.removeClass( 'update is-enqueued' )
|
||||
.addClass( 'updated' );
|
||||
$updateMessage = $pluginRow.find( '.update-message' )
|
||||
.removeClass( 'updating-message notice-warning' )
|
||||
@@ -567,7 +567,7 @@
|
||||
* @param {string} response.errorMessage The error that occurred.
|
||||
*/
|
||||
wp.updates.updatePluginError = function( response ) {
|
||||
var $card, $message, errorMessage,
|
||||
var $pluginRow, $card, $message, errorMessage,
|
||||
$adminBarUpdates = $( '#wp-admin-bar-updates' );
|
||||
|
||||
if ( ! wp.updates.isValidResponse( response, 'update' ) ) {
|
||||
@@ -585,6 +585,8 @@
|
||||
);
|
||||
|
||||
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
|
||||
$pluginRow = $( 'tr[data-plugin="' + response.plugin + '"]' ).removeClass( 'is-enqueued' );
|
||||
|
||||
if ( response.plugin ) {
|
||||
$message = $( 'tr[data-plugin="' + response.plugin + '"]' ).find( '.update-message' );
|
||||
} else {
|
||||
@@ -2468,6 +2470,13 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't add items to the update queue again, even if the user clicks the update button several times.
|
||||
if ( 'update-selected' === bulkAction && $itemRow.hasClass( 'is-enqueued' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$itemRow.addClass( 'is-enqueued' );
|
||||
|
||||
// Add it to the queue.
|
||||
wp.updates.queue.push( {
|
||||
action: 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
@@ -52,7 +52,9 @@
|
||||
$( '#pw-weak-text-label' ).text( __( 'Confirm use of weak password' ) );
|
||||
|
||||
// Focus the password field.
|
||||
$( $pass1 ).trigger( 'focus' );
|
||||
if ( 'mailserver_pass' !== $pass1.prop('id' ) ) {
|
||||
$( $pass1 ).trigger( 'focus' );
|
||||
}
|
||||
}
|
||||
|
||||
function bindPass1() {
|
||||
@@ -171,7 +173,7 @@
|
||||
var $generateButton,
|
||||
$cancelButton;
|
||||
|
||||
$pass1Row = $( '.user-pass1-wrap, .user-pass-wrap, .reset-pass-submit' );
|
||||
$pass1Row = $( '.user-pass1-wrap, .user-pass-wrap, .mailserver-pass-wrap, .reset-pass-submit' );
|
||||
|
||||
// Hide the confirm password field when JavaScript support is enabled.
|
||||
$('.user-pass2-wrap').hide();
|
||||
@@ -188,7 +190,7 @@
|
||||
$submitButtons.prop( 'disabled', ! $weakCheckbox.prop( 'checked' ) );
|
||||
} );
|
||||
|
||||
$pass1 = $('#pass1');
|
||||
$pass1 = $('#pass1, #mailserver_pass');
|
||||
if ( $pass1.length ) {
|
||||
bindPass1();
|
||||
} else {
|
||||
@@ -314,23 +316,27 @@
|
||||
}
|
||||
|
||||
function showOrHideWeakPasswordCheckbox() {
|
||||
var passStrength = $('#pass-strength-result')[0];
|
||||
var passStrengthResult = $('#pass-strength-result');
|
||||
|
||||
if ( passStrength.className ) {
|
||||
$pass1.addClass( passStrength.className );
|
||||
if ( $( passStrength ).is( '.short, .bad' ) ) {
|
||||
if ( ! $weakCheckbox.prop( 'checked' ) ) {
|
||||
$submitButtons.prop( 'disabled', true );
|
||||
}
|
||||
$weakRow.show();
|
||||
} else {
|
||||
if ( $( passStrength ).is( '.empty' ) ) {
|
||||
$submitButtons.prop( 'disabled', true );
|
||||
$weakCheckbox.prop( 'checked', false );
|
||||
if ( passStrengthResult.length ) {
|
||||
var passStrength = passStrengthResult[0];
|
||||
|
||||
if ( passStrength.className ) {
|
||||
$pass1.addClass( passStrength.className );
|
||||
if ( $( passStrength ).is( '.short, .bad' ) ) {
|
||||
if ( ! $weakCheckbox.prop( 'checked' ) ) {
|
||||
$submitButtons.prop( 'disabled', true );
|
||||
}
|
||||
$weakRow.show();
|
||||
} else {
|
||||
$submitButtons.prop( 'disabled', false );
|
||||
if ( $( passStrength ).is( '.empty' ) ) {
|
||||
$submitButtons.prop( 'disabled', true );
|
||||
$weakCheckbox.prop( 'checked', false );
|
||||
} else {
|
||||
$submitButtons.prop( 'disabled', false );
|
||||
}
|
||||
$weakRow.hide();
|
||||
}
|
||||
$weakRow.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
wp/wp-admin/js/user-profile.min.js
vendored
2
wp/wp-admin/js/user-profile.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user