Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 16 additions & 22 deletions src/js/_enqueues/lib/codemirror/javascript-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import CodeMirror from 'codemirror';
* @see https://codemirror.net/5/doc/manual.html#addon_lint
*
* @typedef {Object} CodeMirrorLintError
* @property {string} message - Error message.
* @property {'error'} severity - Severity.
* @property {CodeMirror.Position} from - From position.
* @property {CodeMirror.Position} to - To position.
* @property {string} message Error message.
* @property {'error'} severity Severity.
* @property {CodeMirror.Position} from From position.
* @property {CodeMirror.Position} to To position.
*/

/**
Expand All @@ -25,22 +25,22 @@ import CodeMirror from 'codemirror';
* @see https://www.npmjs.com/package/espree#options
*
* @typedef {Object} SupportedJSHintOptions
* @property {import('espree').Options['ecmaVersion']} [esversion] - "This option is used to specify the ECMAScript version to which the code must adhere."
* @property {boolean} [es5] - "This option enables syntax first defined in the ECMAScript 5.1 specification. This includes allowing reserved keywords as object properties."
* @property {boolean} [es3] - "This option tells JSHint that your code needs to adhere to ECMAScript 3 specification. Use this option if you need your program to be executable in older browsers—such as Internet Explorer 6/7/8/9—and other legacy JavaScript environments."
* @property {boolean} [module] - "This option informs JSHint that the input code describes an ECMAScript 6 module. All module code is interpreted as strict mode code."
* @property {'implied'} [strict] - "This option requires the code to run in ECMAScript 5's strict mode."
* @property {string} [espreeModuleUrl] - The URL to the espree script module.
* @property {import('espree').Options['ecmaVersion']} [esversion] "This option is used to specify the ECMAScript version to which the code must adhere."
* @property {boolean} [es5] "This option enables syntax first defined in the ECMAScript 5.1 specification. This includes allowing reserved keywords as object properties."
* @property {boolean} [es3] "This option tells JSHint that your code needs to adhere to ECMAScript 3 specification. Use this option if you need your program to be executable in older browsers—such as Internet Explorer 6/7/8/9—and other legacy JavaScript environments."
* @property {boolean} [module] "This option informs JSHint that the input code describes an ECMAScript 6 module. All module code is interpreted as strict mode code."
* @property {'implied'} [strict] "This option requires the code to run in ECMAScript 5's strict mode."
* @property {string} [espreeModuleUrl] The URL to the espree script module.
*/

/**
* Validates JavaScript.
*
* @since 7.0.0
*
* @param {string} text - Source.
* @param {SupportedJSHintOptions} options - Linting options.
* @returns {Promise<CodeMirrorLintError[]>}
* @param {string} text Source.
* @param {SupportedJSHintOptions} options Linting options.
* @return {Promise<CodeMirrorLintError[]>} Linting errors.
*/
async function validator( text, options ) {
if ( ! options.espreeModuleUrl ) {
Expand Down Expand Up @@ -84,14 +84,8 @@ CodeMirror.registerHelper( 'lint', 'javascript', validator );
*
* @since 7.0.0
*
* @param {SupportedJSHintOptions} options - Linting options for JSHint.
* @return {{
* ecmaVersion?: import('espree').Options['ecmaVersion'],
* sourceType?: 'module'|'script',
* ecmaFeatures?: {
* impliedStrict?: true
* }
* }}
* @param {SupportedJSHintOptions} options Linting options for JSHint.
* @return {import('espree').Options} Options for Espree.
*/
function getEspreeOptions( options ) {
/** @type {{ impliedStrict?: true }} */
Expand All @@ -112,7 +106,7 @@ function getEspreeOptions( options ) {
*
* @since 7.0.0
*
* @param {SupportedJSHintOptions} options - Options.
* @param {SupportedJSHintOptions} options Options.
* @return {import('espree').Options['ecmaVersion']} ECMAScript version.
*/
function getEcmaVersion( options ) {
Expand Down
26 changes: 13 additions & 13 deletions src/js/_enqueues/lib/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* global ajaxurl, wpAjax */

/**
* @param {jQuery} $ jQuery object.
* @param {JQueryStatic} $ The jQuery object.
*/
( function( $ ) {
var functions = {
Expand All @@ -22,7 +22,7 @@ var functions = {
wpList = {

/**
* @member {object}
* @member {Object}
*/
settings: {

Expand Down Expand Up @@ -108,9 +108,9 @@ wpList = {
* Callback that's run before a request is made.
*
* @callback wpList~confirm
* @param {object} this
* @param {Object} this
* @param {HTMLElement} list The list DOM element.
* @param {object} settings Settings for the current list.
* @param {Object} settings Settings for the current list.
* @param {string} action The type of action to perform: 'add', 'delete', or 'dim'.
* @param {string} backgroundColor Background color of the list's DOM element.
* @return {boolean} Whether to proceed with the action or not.
Expand All @@ -123,7 +123,7 @@ wpList = {
* Allows to cancel the request.
*
* @callback wpList~addBefore
* @param {object} settings Settings for the Ajax request.
* @param {Object} settings Settings for the Ajax request.
* @return {object|boolean} Settings for the Ajax request or false to abort.
*/
addBefore: null,
Expand All @@ -133,11 +133,11 @@ wpList = {
*
* @callback wpList~addAfter
* @param {XML} returnedResponse Raw response returned from the server.
* @param {object} settings Settings for the Ajax request.
* @param {Object} settings Settings for the Ajax request.
* @param {jqXHR} settings.xml jQuery XMLHttpRequest object.
* @param {string} settings.status Status of the request: 'success', 'notmodified', 'nocontent', 'error',
* 'timeout', 'abort', or 'parsererror'.
* @param {object} settings.parsed Parsed response object.
* @param {Object} settings.parsed Parsed response object.
*/
addAfter: null,

Expand All @@ -147,7 +147,7 @@ wpList = {
* Allows to cancel the request.
*
* @callback wpList~delBefore
* @param {object} settings Settings for the Ajax request.
* @param {Object} settings Settings for the Ajax request.
* @param {HTMLElement} list The list DOM element.
* @return {object|boolean} Settings for the Ajax request or false to abort.
*/
Expand All @@ -158,11 +158,11 @@ wpList = {
*
* @callback wpList~delAfter
* @param {XML} returnedResponse Raw response returned from the server.
* @param {object} settings Settings for the Ajax request.
* @param {Object} settings Settings for the Ajax request.
* @param {jqXHR} settings.xml jQuery XMLHttpRequest object.
* @param {string} settings.status Status of the request: 'success', 'notmodified', 'nocontent', 'error',
* 'timeout', 'abort', or 'parsererror'.
* @param {object} settings.parsed Parsed response object.
* @param {Object} settings.parsed Parsed response object.
*/
delAfter: null,

Expand All @@ -172,7 +172,7 @@ wpList = {
* Allows to cancel the request.
*
* @callback wpList~dimBefore
* @param {object} settings Settings for the Ajax request.
* @param {Object} settings Settings for the Ajax request.
* @return {object|boolean} Settings for the Ajax request or false to abort.
*/
dimBefore: null,
Expand All @@ -182,11 +182,11 @@ wpList = {
*
* @callback wpList~dimAfter
* @param {XML} returnedResponse Raw response returned from the server.
* @param {object} settings Settings for the Ajax request.
* @param {Object} settings Settings for the Ajax request.
* @param {jqXHR} settings.xml jQuery XMLHttpRequest object.
* @param {string} settings.status Status of the request: 'success', 'notmodified', 'nocontent', 'error',
* 'timeout', 'abort', or 'parsererror'.
* @param {object} settings.parsed Parsed response object.
* @param {Object} settings.parsed Parsed response object.
*/
dimAfter: null
},
Expand Down
44 changes: 23 additions & 21 deletions src/js/_enqueues/lib/nav-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
* @version 2.0.0
*
* @package WordPress
* @subpackage Administration
* @output wp-admin/js/nav-menu.js
*/

/* global menus, postboxes, columns, isRtl, ajaxurl, wpNavMenu */

/**
* @param {JQueryStatic} $ The jQuery object.
*/
(function($) {

var api;
Expand Down Expand Up @@ -178,7 +180,7 @@
*
* @ignore
*
* @param jQuery metabox The metabox jQuery object.
* @param {Function} processMethod The method to use for adding the menu items. Defaults to api.addMenuItemToBottom.
*/
addSelectedToMenu : function(processMethod) {
if ( 0 === $('#menu-to-edit').length ) {
Expand Down Expand Up @@ -339,7 +341,7 @@
}
});
});

});
},
updateOrderDropdown : function() {
Expand Down Expand Up @@ -403,7 +405,7 @@

}
});

});
}
});
Expand Down Expand Up @@ -560,7 +562,7 @@
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 ) );
Expand All @@ -569,10 +571,10 @@

/**
* changeMenuParent( [parentDropdown] )
*
*
* @since 6.7.0
*
* @param {object} parentDropdown select field
* @param {Object} parentDropdown select field
*/
changeMenuParent : function( parentDropdown ) {
var menuItemNewPosition,
Expand Down Expand Up @@ -625,10 +627,10 @@

/**
* changeMenuOrder( [OrderDropdown] )
*
*
* @since 6.7.0
*
* @param {object} orderDropdown select field
* @param {Object} orderDropdown select field
*/
changeMenuOrder : function( orderDropdown ) {
var menuItems = $( '#menu-to-edit li' ),
Expand Down Expand Up @@ -1159,7 +1161,7 @@
* Handle toggling bulk selection checkboxes for menu items.
*
* @since 5.8.0
*/
*/
attachBulkSelectButtonListeners : function() {
var that = this;

Expand All @@ -1178,7 +1180,7 @@
* Enable bulk selection checkboxes for menu items.
*
* @since 5.8.0
*/
*/
enableBulkSelection : function() {
var checkbox = $( '#menu-to-edit .menu-item-checkbox' );

Expand All @@ -1195,7 +1197,7 @@
* Disable bulk selection checkboxes for menu items.
*
* @since 5.8.0
*/
*/
disableBulkSelection : function() {
var checkbox = $( '#menu-to-edit .menu-item-checkbox' );

Expand All @@ -1219,7 +1221,7 @@
* Listen for state changes on bulk action checkboxes.
*
* @since 5.8.0
*/
*/
attachMenuCheckBoxListeners : function() {
var that = this;

Expand All @@ -1232,7 +1234,7 @@
* Create delete button to remove menu items from collection.
*
* @since 5.8.0
*/
*/
attachMenuItemDeleteButton : function() {
var that = this;

Expand Down Expand Up @@ -1275,7 +1277,7 @@
* List menu items awaiting deletion.
*
* @since 5.8.0
*/
*/
attachPendingMenuItemsListForDeletion : function() {
$( '#post-body-content' ).on( 'change', '.menu-item-checkbox', function() {
var menuItemName, menuItemType, menuItemID, listedMenuItem;
Expand Down Expand Up @@ -1317,7 +1319,7 @@
* Set status of bulk delete checkbox.
*
* @since 5.8.0
*/
*/
setBulkDeleteCheckboxStatus : function() {
var that = this;
var checkbox = $( '#menu-to-edit .menu-item-checkbox' );
Expand All @@ -1341,7 +1343,7 @@
* Set status of menu items removal button.
*
* @since 5.8.0
*/
*/
setRemoveSelectedButtonStatus : function() {
var button = $( '.menu-items-delete' );

Expand Down Expand Up @@ -1419,7 +1421,7 @@
}

/*
* Reset results when search is less than or equal to
* Reset results when search is less than or equal to
* minimum characters for searched term.
*/
if ( q.length <= minSearchLength ) {
Expand Down Expand Up @@ -1766,9 +1768,9 @@
/**
* Process the quick search response into a search result
*
* @param string resp The server response to the query.
* @param object req The request arguments.
* @param jQuery panel The tabs panel we're searching in.
* @param {string} resp The server response to the query.
* @param {Object} req The request arguments.
* @param {jQuery} panel The tabs panel we're searching in.
*/
processQuickSearchQueryResponse : function(resp, req, panel) {
var matched, newID,
Expand Down
4 changes: 3 additions & 1 deletion src/js/_enqueues/lib/pointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Initializes the wp-pointer widget using jQuery UI Widget Factory.
*
* @param {JQueryStatic} $ The jQuery object.
*/
(function($){
var identifier = 0,
Expand Down Expand Up @@ -146,7 +148,7 @@
*
* @param {Object} event The event that caused the update.
*
* @return {Promise} Resolves when the update has been executed.
* @return {Promise|void} Resolves when the update has been executed.
*/
update: function( event ) {
var self = this,
Expand Down
Loading
Loading