<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[42351] trunk/src/wp-admin/js/common.js: Docs: Improve JSDocs for common.js.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/42351">42351</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/42351","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>adamsilverstein</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2017-12-03 18:10:21 +0000 (Sun, 03 Dec 2017)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Docs: Improve JSDocs for common.js.
Props andizer, rensw90, benvaassen, jipmoors, ireneyoast and nicollle.
Fixes 42679.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjscommonjs">trunk/src/wp-admin/js/common.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjscommonjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/common.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/common.js 2017-12-03 18:10:05 UTC (rev 42350)
+++ trunk/src/wp-admin/js/common.js 2017-12-03 18:10:21 UTC (rev 42351)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,12 +1,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /* global setUserSetting, ajaxurl, commonL10n, alert, confirm, pagenow */
</span><span class="cx" style="display: block; padding: 0 10px"> var showNotice, adminMenu, columns, validateForm, screenMeta;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * @summary Adds common WordPress functionality to the window.
+ *
+ * @param {jQuery} $ jQuery object.
+ * @param {Object} window The window object.
+ * @param {mixed} undefined Unused.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> ( function( $, window, undefined ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var $document = $( document ),
</span><span class="cx" style="display: block; padding: 0 10px"> $window = $( window ),
</span><span class="cx" style="display: block; padding: 0 10px"> $body = $( document.body );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Removed in 3.3.
-// (perhaps) needed for back-compat
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * @summary Removed in 3.3.0, needed for back-compatibility.
+ *
+ * @since 2.7.0
+ * @deprecated 3.3.0
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> adminMenu = {
</span><span class="cx" style="display: block; padding: 0 10px"> init : function() {},
</span><span class="cx" style="display: block; padding: 0 10px"> fold : function() {},
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -15,8 +27,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> favorites : function() {}
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// show/hide/save table columns
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+// Show/hide/save table columns.
</ins><span class="cx" style="display: block; padding: 0 10px"> columns = {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @summary Initializes the column toggles in the screen options.
+ *
+ * Binds an onClick event to the checkboxes to show or hide the table columns
+ * based on their toggled state. And persists the toggled state.
+ *
+ * @since 2.7.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> init : function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var that = this;
</span><span class="cx" style="display: block; padding: 0 10px"> $('.hide-column-tog', '#adv-settings').click( function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -30,6 +53,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Saves the toggled state for the columns.
+ *
+ * Saves whether the columns should be shown or hidden on a page.
+ *
+ * @since 3.0.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> saveManageColumnsState : function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var hidden = this.hidden();
</span><span class="cx" style="display: block; padding: 0 10px"> $.post(ajaxurl, {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -40,22 +72,52 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Makes a column visible and adjusts the column span for the table.
+ *
+ * @since 3.0.0
+ * @param {string} column The column name.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> checked : function(column) {
</span><span class="cx" style="display: block; padding: 0 10px"> $('.column-' + column).removeClass( 'hidden' );
</span><span class="cx" style="display: block; padding: 0 10px"> this.colSpanChange(+1);
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Hides a column and adjusts the column span for the table.
+ *
+ * @since 3.0.0
+ * @param {string} column The column name.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> unchecked : function(column) {
</span><span class="cx" style="display: block; padding: 0 10px"> $('.column-' + column).addClass( 'hidden' );
</span><span class="cx" style="display: block; padding: 0 10px"> this.colSpanChange(-1);
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Get all hidden columns.
+ *
+ * @since 3.0.0
+ *
+ * @returns {string} The hidden column names separated by a comma.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> hidden : function() {
</span><span class="cx" style="display: block; padding: 0 10px"> return $( '.manage-column[id]' ).filter( ':hidden' ).map(function() {
</span><span class="cx" style="display: block; padding: 0 10px"> return this.id;
</span><span class="cx" style="display: block; padding: 0 10px"> }).get().join( ',' );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Gets the checked column toggles from the screen options.
+ *
+ * @since 3.0.0
+ *
+ * @returns {string} String containing the checked column names.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> useCheckboxesForHidden : function() {
</span><span class="cx" style="display: block; padding: 0 10px"> this.hidden = function(){
</span><span class="cx" style="display: block; padding: 0 10px"> return $('.hide-column-tog').not(':checked').map(function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -65,6 +127,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Adjusts the column span for the table.
+ *
+ * @since 3.1.0
+ *
+ * @param {int} diff The modifier for the column span.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> colSpanChange : function(diff) {
</span><span class="cx" style="display: block; padding: 0 10px"> var $t = $('table').find('.colspanchange'), n;
</span><span class="cx" style="display: block; padding: 0 10px"> if ( !$t.length )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -76,6 +145,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $document.ready(function(){columns.init();});
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * @summary Validates that the required form fields are not empty.
+ *
+ * @since 2.9.0
+ *
+ * @param {jQuery} form The form to validate.
+ *
+ * @returns {boolean} Returns true if all required fields are not an empty string.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> validateForm = function( form ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return !$( form )
</span><span class="cx" style="display: block; padding: 0 10px"> .find( '.form-required' )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -87,7 +165,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // stub for doing better warnings
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * @summary Shows message pop-up notice or confirmation message.
+ *
+ * @since 2.7.0
+ *
+ * @type {{warn: showNotice.warn, note: showNotice.note}}
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> showNotice = {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @summary Shows a delete confirmation pop-up message.
+ *
+ * @since 2.7.0
+ *
+ * @returns {boolean} Returns true if the message is confirmed.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> warn : function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var msg = commonL10n.warnDelete || '';
</span><span class="cx" style="display: block; padding: 0 10px"> if ( confirm(msg) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,16 +192,41 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Shows an alert message.
+ *
+ * @since 2.7.0
+ *
+ * @param text The text to display in the message.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> note : function(text) {
</span><span class="cx" style="display: block; padding: 0 10px"> alert(text);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * @summary Represents the functions for the meta screen options panel.
+ *
+ * @since 3.2.0
+ *
+ * @type {{element: null, toggles: null, page: null, init: screenMeta.init,
+ * toggleEvent: screenMeta.toggleEvent, open: screenMeta.open,
+ * close: screenMeta.close}}
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> screenMeta = {
</span><span class="cx" style="display: block; padding: 0 10px"> element: null, // #screen-meta
</span><span class="cx" style="display: block; padding: 0 10px"> toggles: null, // .screen-meta-toggle
</span><span class="cx" style="display: block; padding: 0 10px"> page: null, // #wpcontent
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Initializes the screen meta options panel.
+ *
+ * @since 3.2.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> init: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> this.element = $('#screen-meta');
</span><span class="cx" style="display: block; padding: 0 10px"> this.toggles = $( '#screen-meta-links' ).find( '.show-settings' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -115,6 +235,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> this.toggles.click( this.toggleEvent );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Toggles the screen meta options panel.
+ *
+ * @since 3.2.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> toggleEvent: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var panel = $( '#' + $( this ).attr( 'aria-controls' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -127,11 +254,29 @@
</span><span class="cx" style="display: block; padding: 0 10px"> screenMeta.open( panel, $(this) );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Opens the screen meta options panel.
+ *
+ * @since 3.2.0
+ *
+ * @param {jQuery} panel The screen meta options panel div.
+ * @param {jQuery} button The toggle button.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> open: function( panel, button ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $( '#screen-meta-links' ).find( '.screen-meta-toggle' ).not( button.parent() ).css( 'visibility', 'hidden' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> panel.parent().show();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @summary Sets the focus to the meta options panel and adds the necessary CSS classes.
+ *
+ * @since 3.2.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> panel.slideDown( 'fast', function() {
</span><span class="cx" style="display: block; padding: 0 10px"> panel.focus();
</span><span class="cx" style="display: block; padding: 0 10px"> button.addClass( 'screen-meta-active' ).attr( 'aria-expanded', true );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -140,7 +285,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $document.trigger( 'screen:options:open' );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Closes the screen meta options panel.
+ *
+ * @since 3.2.0
+ *
+ * @param {jQuery} panel The screen meta options panel div.
+ * @param {jQuery} button The toggle button.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> close: function( panel, button ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Hides the screen meta options panel.
+ *
+ * @since 3.2.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> panel.slideUp( 'fast', function() {
</span><span class="cx" style="display: block; padding: 0 10px"> button.removeClass( 'screen-meta-active' ).attr( 'aria-expanded', false );
</span><span class="cx" style="display: block; padding: 0 10px"> $('.screen-meta-toggle').css('visibility', '');
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -152,7 +314,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Help tabs.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @summary Initializes the help tabs in the help panel.
+ *
+ * @param {Event} e The event object.
+ *
+ * @returns {void}
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $('.contextual-help-tabs').delegate('a', 'click', function(e) {
</span><span class="cx" style="display: block; padding: 0 10px"> var link = $(this),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -178,7 +344,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Update custom permalink structure via buttons.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> var permalinkStructureFocused = false,
</span><span class="cx" style="display: block; padding: 0 10px"> $permalinkStructure = $( '#permalink_structure' ),
</span><span class="cx" style="display: block; padding: 0 10px"> $permalinkStructureInputs = $( '.permalink-structure input:radio' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -329,12 +494,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> $headerEnd = $( '.wp-header-end' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // when the menu is folded, make the fly-out submenu header clickable
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Makes the fly-out submenu header clickable, when the menu is folded.
+ *
+ * @param {Event} e The event object.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $adminmenu.on('click.wp-submenu-head', '.wp-submenu-head', function(e){
</span><span class="cx" style="display: block; padding: 0 10px"> $(e.target).parent().siblings('a').get(0).click();
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Collapses the admin menu.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $( '#collapse-button' ).on( 'click.collapse-menu', function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var viewportWidth = getViewportWidth() || 961;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -367,7 +542,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $document.trigger( 'wp-collapse-menu', { state: menuState } );
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Handle the `aria-haspopup` attribute on the current menu item when it has a sub-menu.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Handles the `aria-haspopup` attribute on the current menu item when it has a submenu.
+ *
+ * @since 4.4.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function currentMenuItemHasPopup() {
</span><span class="cx" style="display: block; padding: 0 10px"> var $current = $( 'a.wp-has-current-submenu' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -383,11 +564,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $document.on( 'wp-menu-state-set wp-collapse-menu wp-responsive-activate wp-responsive-deactivate', currentMenuItemHasPopup );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Ensure an admin submenu is within the visual viewport.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @summary Ensures an admin submenu is within the visual viewport.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param {jQuery} $menuItem The parent menu item containing the submenu.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * @returns {void}
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function adjustSubmenu( $menuItem ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var bottomOffset, pageHeight, adjustment, theFold, menutop, wintop, maxtop,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -421,7 +604,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // iOS Safari works with touchstart, the rest work with click
</span><span class="cx" style="display: block; padding: 0 10px"> mobileEvent = isIOS ? 'touchstart' : 'click';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // close any open submenus when touch/click is not on the menu
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Closes any open submenus when touch/click is not on the menu.
+ *
+ * @param {Event} e The event object.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $body.on( mobileEvent+'.wp-mobile-hover', function(e) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $adminmenu.data('wp-responsive') ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -432,6 +621,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Handles the opening or closing the submenu based on the mobile click|touch event.
+ *
+ * @param {Event} event The event object.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $adminmenu.find( 'a.wp-has-submenu' ).on( mobileEvent + '.wp-mobile-hover', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var $menuItem = $(this).parent();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -453,6 +649,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isIOS && ! isAndroid ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $adminmenu.find( 'li.wp-has-submenu' ).hoverIntent({
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @summary Opens the submenu when hovered over the menu item for desktops.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> over: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var $menuItem = $( this ),
</span><span class="cx" style="display: block; padding: 0 10px"> $submenu = $menuItem.find( '.wp-submenu' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -471,6 +673,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $adminmenu.find( 'li.opensub' ).removeClass( 'opensub' );
</span><span class="cx" style="display: block; padding: 0 10px"> $menuItem.addClass( 'opensub' );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @summary Closes the submenu when no longer hovering the menu item.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> out: function(){
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $adminmenu.data( 'wp-responsive' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // The menu is in responsive mode, bail
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -484,6 +692,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> interval: 90
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Opens the submenu on when focused on the menu item.
+ *
+ * @param {Event} event The event object.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $adminmenu.on( 'focus.adminmenu', '.wp-submenu a', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $adminmenu.data( 'wp-responsive' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // The menu is in responsive mode, bail
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -491,12 +706,26 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $( event.target ).closest( 'li.menu-top' ).addClass( 'opensub' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @summary Closes the submenu on blur from the menu item.
+ *
+ * @param {Event} event The event object.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> }).on( 'blur.adminmenu', '.wp-submenu a', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $adminmenu.data( 'wp-responsive' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $( event.target ).closest( 'li.menu-top' ).removeClass( 'opensub' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @summary Adjusts the size for the submenu.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> }).find( 'li.wp-has-submenu.wp-not-current-submenu' ).on( 'focusin.adminmenu', function() {
</span><span class="cx" style="display: block; padding: 0 10px"> adjustSubmenu( $( this ) );
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -513,7 +742,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $( 'div.updated, div.error, div.notice' ).not( '.inline, .below-h2' ).insertAfter( $headerEnd );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Make notices dismissible
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Make notices dismissible.
+ *
+ * @since 4.4.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function makeNoticesDismissible() {
</span><span class="cx" style="display: block; padding: 0 10px"> $( '.notice.is-dismissible' ).each( function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var $el = $( this ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -540,7 +775,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Init screen meta
</span><span class="cx" style="display: block; padding: 0 10px"> screenMeta.init();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // This event needs to be delegated. Ticket #37973.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Checks a checkbox.
+ *
+ * This event needs to be delegated. Ticket #37973.
+ *
+ * @returns {boolean} Returns whether a checkbox is checked or not.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $body.on( 'click', 'tbody > tr > .check-column :checkbox', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Shift click to select a range of checkboxes.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'undefined' == event.shiftKey ) { return true; }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -564,6 +805,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Toggle the "Select all" checkboxes depending if the other ones are all checked or not.
</span><span class="cx" style="display: block; padding: 0 10px"> var unchecked = $(this).closest('tbody').find(':checkbox').filter(':visible:enabled').not(':checked');
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @summary Determines if all checkboxes are checked.
+ *
+ * @returns {boolean} Returns true if there are no unchecked checkboxes.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $(this).closest('table').children('thead, tfoot').find(':checkbox').prop('checked', function() {
</span><span class="cx" style="display: block; padding: 0 10px"> return ( 0 === unchecked.length );
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -571,7 +818,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // This event needs to be delegated. Ticket #37973.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Controls all the toggles on bulk toggle change.
+ *
+ * When the bulk checkbox is changed, all the checkboxes in the tables are changed accordingly.
+ * When the shift-button is pressed while changing the bulk checkbox the checkboxes in the table are inverted.
+ *
+ * This event needs to be delegated. Ticket #37973.
+ *
+ * @param {Event} event The event object.
+ *
+ * @returns {boolean}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $body.on( 'click.wp-toggle-checkboxes', 'thead .check-column :checkbox, tfoot .check-column :checkbox', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var $this = $(this),
</span><span class="cx" style="display: block; padding: 0 10px"> $table = $this.closest( 'table' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -580,6 +838,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $table.children( 'tbody' ).filter(':visible')
</span><span class="cx" style="display: block; padding: 0 10px"> .children().children('.check-column').find(':checkbox')
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Updates the checked state on the checkbox in the table.
+ *
+ * @returns {boolean} True checks the checkbox, False unchecks the checkbox.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> .prop('checked', function() {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $(this).is(':hidden,:disabled') ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -596,6 +859,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $table.children('thead, tfoot').filter(':visible')
</span><span class="cx" style="display: block; padding: 0 10px"> .children().children('.check-column').find(':checkbox')
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @summary Syncs the bulk checkboxes on the top and bottom of the table.
+ *
+ * @returns {boolean} True checks the checkbox, False unchecks the checkbox.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> .prop('checked', function() {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( toggle ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -607,7 +876,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Show row actions on keyboard focus of its parent container element or any other elements contained within
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Shows row actions on focus of its parent container element or any other elements contained within.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $( '#wpbody-content' ).on({
</span><span class="cx" style="display: block; padding: 0 10px"> focusin: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> clearTimeout( transitionTimeout );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -636,20 +909,29 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // tab in textareas
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Handles tab keypresses in theme and plugin editor textareas.
+ *
+ * @param {Event} e The event object.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $('#newcontent').bind('keydown.wpevent_InsertTab', function(e) {
</span><span class="cx" style="display: block; padding: 0 10px"> var el = e.target, selStart, selEnd, val, scroll, sel;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( e.keyCode == 27 ) { // escape key
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // After pressing escape key (keyCode: 27), the tab key should tab out of the textarea.
+ if ( e.keyCode == 27 ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // when pressing Escape: Opera 12 and 27 blur form fields, IE 8 clears them
</span><span class="cx" style="display: block; padding: 0 10px"> e.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px"> $(el).data('tab-out', true);
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( e.keyCode != 9 || e.ctrlKey || e.altKey || e.shiftKey ) // tab key
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Only listen for plain tab key (keyCode: 9) without any modifiers.
+ if ( e.keyCode != 9 || e.ctrlKey || e.altKey || e.shiftKey )
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // After tabbing out, reset it so next time the tab key can be used again.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $(el).data('tab-out') ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $(el).data('tab-out', false);
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -659,6 +941,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> selEnd = el.selectionEnd;
</span><span class="cx" style="display: block; padding: 0 10px"> val = el.value;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If any text is selected, replace the selection with a tab character.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( document.selection ) {
</span><span class="cx" style="display: block; padding: 0 10px"> el.focus();
</span><span class="cx" style="display: block; padding: 0 10px"> sel = document.selection.createRange();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -670,48 +953,103 @@
</span><span class="cx" style="display: block; padding: 0 10px"> this.scrollTop = scroll;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Cancel the regular tab functionality, to prevent losing focus of the textarea.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( e.stopPropagation )
</span><span class="cx" style="display: block; padding: 0 10px"> e.stopPropagation();
</span><span class="cx" style="display: block; padding: 0 10px"> if ( e.preventDefault )
</span><span class="cx" style="display: block; padding: 0 10px"> e.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Reset page number variable for new filters/searches but not for bulk actions. See #17685.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( pageInput.length ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @summary Handles pagination variable when filtering the list table.
+ *
+ * Set the pagination argument to the first page when the post-filter form is submitted.
+ * This happens when pressing the 'filter' button on the list table page.
+ *
+ * The pagination argument should not be touched when the bulk action dropdowns are set to do anything.
+ *
+ * The form closest to the pageInput is the post-filter form.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> pageInput.closest('form').submit( function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Reset paging var for new filters/searches but not for bulk actions. See #17685.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * action = bulk action dropdown at the top of the table
+ * action2 = bulk action dropdow at the bottom of the table
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $('select[name="action"]').val() == -1 && $('select[name="action2"]').val() == -1 && pageInput.val() == currentPage )
</span><span class="cx" style="display: block; padding: 0 10px"> pageInput.val('1');
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Resets the bulk actions when the search button is clicked.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function () {
</span><span class="cx" style="display: block; padding: 0 10px"> $('select[name^="action"]').val('-1');
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Scroll into view when focused
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Scrolls into view when focus.scroll-into-view is triggered.
+ *
+ * @param {Event} e The event object.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> $('#contextual-help-link, #show-settings-link').on( 'focus.scroll-into-view', function(e){
</span><span class="cx" style="display: block; padding: 0 10px"> if ( e.target.scrollIntoView )
</span><span class="cx" style="display: block; padding: 0 10px"> e.target.scrollIntoView(false);
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Disable upload buttons until files are selected
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Disables the submit upload buttons when no data is entered.
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> (function(){
</span><span class="cx" style="display: block; padding: 0 10px"> var button, input, form = $('form.wp-upload-form');
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Exit when no upload form is found.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! form.length )
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> button = form.find('input[type="submit"]');
</span><span class="cx" style="display: block; padding: 0 10px"> input = form.find('input[type="file"]');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Determines if any data is entered in any file upload input.
+ *
+ * @since 3.5.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function toggleUploadButton() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // When no inputs have a value, disable the upload buttons.
</ins><span class="cx" style="display: block; padding: 0 10px"> button.prop('disabled', '' === input.map( function() {
</span><span class="cx" style="display: block; padding: 0 10px"> return $(this).val();
</span><span class="cx" style="display: block; padding: 0 10px"> }).get().join(''));
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Update the status initially.
</ins><span class="cx" style="display: block; padding: 0 10px"> toggleUploadButton();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Update the status when any file input changes.
</ins><span class="cx" style="display: block; padding: 0 10px"> input.on('change', toggleUploadButton);
</span><span class="cx" style="display: block; padding: 0 10px"> })();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Pins the menu while distraction-free writing is enabled.
+ *
+ * @param {Event} event Event data.
+ *
+ * @since 4.1.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function pinMenu( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var windowPos = $window.scrollTop(),
</span><span class="cx" style="display: block; padding: 0 10px"> resizing = ! event || event.type !== 'scroll';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -720,6 +1058,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * When the menu is higher than the window and smaller than the entire page.
+ * It should be adjusted to be able to see the entire menu.
+ *
+ * Otherwise it can be accessed normally.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( height.menu + height.adminbar < height.window ||
</span><span class="cx" style="display: block; padding: 0 10px"> height.menu + height.adminbar + 20 > height.wpwrap ) {
</span><span class="cx" style="display: block; padding: 0 10px"> unpinMenu();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -728,9 +1072,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> menuIsPinned = true;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If the menu is higher than the window, compensate on scroll.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( height.menu + height.adminbar > height.window ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Check for overscrolling
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Check for overscrolling, this happens when swiping up at the top of the document in modern browsers.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( windowPos < 0 ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Stick the menu to the top.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! pinnedMenuTop ) {
</span><span class="cx" style="display: block; padding: 0 10px"> pinnedMenuTop = true;
</span><span class="cx" style="display: block; padding: 0 10px"> pinnedMenuBottom = false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -744,6 +1090,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> } else if ( windowPos + height.window > $document.height() - 1 ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // When overscrolling at the bottom, stick the menu to the bottom.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! pinnedMenuBottom ) {
</span><span class="cx" style="display: block; padding: 0 10px"> pinnedMenuBottom = true;
</span><span class="cx" style="display: block; padding: 0 10px"> pinnedMenuTop = false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -759,10 +1106,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( windowPos > lastScrollPosition ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Scrolling down
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // When a down scroll has been detected.
+
+ // If it was pinned to the top, unpin and calculate relative scroll.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( pinnedMenuTop ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // let it scroll
</del><span class="cx" style="display: block; padding: 0 10px"> pinnedMenuTop = false;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Calculate new offset position.
</ins><span class="cx" style="display: block; padding: 0 10px"> menuTop = $adminMenuWrap.offset().top - height.adminbar - ( windowPos - lastScrollPosition );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( menuTop + height.menu + height.adminbar < windowPos + height.window ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -775,7 +1124,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> bottom: ''
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> } else if ( ! pinnedMenuBottom && $adminMenuWrap.offset().top + height.menu < windowPos + height.window ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // pin the bottom
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Pin it to the bottom.
</ins><span class="cx" style="display: block; padding: 0 10px"> pinnedMenuBottom = true;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $adminMenuWrap.css({
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -785,10 +1134,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else if ( windowPos < lastScrollPosition ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Scrolling up
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // When a scroll up is detected.
+
+ // If it was pinned to the bottom, unpin and calculate relative scroll.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( pinnedMenuBottom ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // let it scroll
</del><span class="cx" style="display: block; padding: 0 10px"> pinnedMenuBottom = false;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Calculate new offset position.
</ins><span class="cx" style="display: block; padding: 0 10px"> menuTop = $adminMenuWrap.offset().top - height.adminbar + ( lastScrollPosition - windowPos );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( menuTop + height.menu > windowPos + height.window ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -801,7 +1153,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> bottom: ''
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> } else if ( ! pinnedMenuTop && $adminMenuWrap.offset().top >= windowPos + height.adminbar ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // pin the top
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Pin it to the top.
</ins><span class="cx" style="display: block; padding: 0 10px"> pinnedMenuTop = true;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $adminMenuWrap.css({
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -811,8 +1164,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else if ( resizing ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Resizing
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Window is being resized.
+
</ins><span class="cx" style="display: block; padding: 0 10px"> pinnedMenuTop = pinnedMenuBottom = false;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Calculate the new offset.
</ins><span class="cx" style="display: block; padding: 0 10px"> menuTop = windowPos + height.window - height.menu - height.adminbar - 1;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( menuTop > 0 ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -830,6 +1186,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> lastScrollPosition = windowPos;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Determines the height of certain elements.
+ *
+ * @since 4.1.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function resetHeights() {
</span><span class="cx" style="display: block; padding: 0 10px"> height = {
</span><span class="cx" style="display: block; padding: 0 10px"> window: $window.height(),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -839,6 +1202,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Unpins the menu.
+ *
+ * @since 4.1.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function unpinMenu() {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isIOS || ! menuIsPinned ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -852,6 +1222,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Pins and unpins the menu when applicable.
+ *
+ * @since 4.1.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function setPinMenu() {
</span><span class="cx" style="display: block; padding: 0 10px"> resetHeights();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -874,7 +1251,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Changes properties of metaboxes and body.
+ *
+ * Changes the sortables and responsiveness of metaboxes.
+ *
+ * @since 3.8.0
+ *
+ *@returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> window.wpResponsive = {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @summary Initializes the wpResponsive object.
+ *
+ * @since 3.8.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> init: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var self = this;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -887,11 +1281,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $( '#wp-admin-bar-menu-toggle a' ).attr( 'aria-expanded', 'false' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Toggle sidebar when toggle is clicked
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Toggle sidebar when toggle is clicked.
</ins><span class="cx" style="display: block; padding: 0 10px"> $( '#wp-admin-bar-menu-toggle' ).on( 'click.wp-responsive', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> event.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // close any open toolbar submenus
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // close any open toolbar submenus.
</ins><span class="cx" style="display: block; padding: 0 10px"> $adminbar.find( '.hover' ).removeClass( 'hover' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $wpwrap.toggleClass( 'wp-responsive-open' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -903,7 +1297,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Add menu events
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Add menu events.
</ins><span class="cx" style="display: block; padding: 0 10px"> $adminmenu.on( 'click.wp-responsive', 'li.wp-has-submenu > a', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $adminmenu.data('wp-responsive') ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -916,7 +1310,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> self.trigger();
</span><span class="cx" style="display: block; padding: 0 10px"> $document.on( 'wp-window-resized.wp-responsive', $.proxy( this.trigger, this ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // This needs to run later as UI Sortable may be initialized later on $(document).ready()
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // This needs to run later as UI Sortable may be initialized later on $(document).ready().
</ins><span class="cx" style="display: block; padding: 0 10px"> $window.on( 'load.wp-responsive', function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var width = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? $window.width() : window.innerWidth;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -926,23 +1320,50 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Changes properties of body and admin menu.
+ *
+ * Pins and unpins the menu and adds the auto-fold class to the body.
+ * Makes the admin menu responsive and disables the metabox sortables.
+ *
+ * @since 3.8.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> activate: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> setPinMenu();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! $body.hasClass( 'auto-fold' ) ) {
- $body.addClass( 'auto-fold' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $body.hasClass( "auto-fold" ) ) {
+ $body.addClass( "auto-fold" );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $adminmenu.data( 'wp-responsive', 1 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $adminmenu.data( "wp-responsive", 1 );
</ins><span class="cx" style="display: block; padding: 0 10px"> this.disableSortables();
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Changes properties of admin menu and enables metabox sortables.
+ *
+ * Pin and unpin the menu.
+ * Removes the responsiveness of the admin menu and enables the metabox sortables.
+ *
+ * @since 3.8.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> deactivate: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> setPinMenu();
</span><span class="cx" style="display: block; padding: 0 10px"> $adminmenu.removeData('wp-responsive');
</span><span class="cx" style="display: block; padding: 0 10px"> this.enableSortables();
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Sets the responsiveness and enables the overlay based on the viewport width.
+ *
+ * @since 3.8.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> trigger: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var viewportWidth = getViewportWidth();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -953,12 +1374,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( viewportWidth <= 782 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! wpResponsiveActive ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $document.trigger( 'wp-responsive-activate' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $document.trigger( "wp-responsive-activate" );
</ins><span class="cx" style="display: block; padding: 0 10px"> wpResponsiveActive = true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( wpResponsiveActive ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $document.trigger( 'wp-responsive-deactivate' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $document.trigger( "wp-responsive-deactivate" );
</ins><span class="cx" style="display: block; padding: 0 10px"> wpResponsiveActive = false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -970,6 +1391,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Inserts a responsive overlay and toggles the window.
+ *
+ * @since 3.8.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> enableOverlay: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $overlay.length === 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $overlay = $( '<div id="wp-responsive-overlay"></div>' )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -986,31 +1414,58 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Disables the responsive overlay and removes the overlay.
+ *
+ * @since 3.8.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> disableOverlay: function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $toolbarPopups.off( 'click.wp-responsive' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $toolbarPopups.off( "click.wp-responsive" );
</ins><span class="cx" style="display: block; padding: 0 10px"> $overlay.hide();
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Disables sortables.
+ *
+ * @since 3.8.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> disableSortables: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $sortables.length ) {
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $sortables.sortable('disable');
- } catch(e) {}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $sortables.sortable( "disable" );
+ } catch ( e ) {}
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Enables sortables.
+ *
+ * @since 3.8.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> enableSortables: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $sortables.length ) {
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $sortables.sortable('enable');
- } catch(e) {}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $sortables.sortable( "enable" );
+ } catch ( e ) {}
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Add an ARIA role `button` to elements that behave like UI controls when JavaScript is on.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Add an ARIA role `button` to elements that behave like UI controls when JavaScript is on.
+ *
+ * @since 4.5.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function aria_button_if_js() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( '.aria-button-if-js' ).attr( 'role', 'button' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( ".aria-button-if-js" ).attr( "role", "button" );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $( document ).ajaxComplete( function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1037,7 +1492,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @summary Set the admin menu collapsed/expanded state.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @summary Sets the admin menu collapsed/expanded state.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Sets the global variable `menuState` and triggers a custom event passing
</span><span class="cx" style="display: block; padding: 0 10px"> * the current menu state.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1064,7 +1519,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $document.on( 'wp-window-resized.set-menu-state', setMenuState );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @summary Set ARIA attributes on the collapse/expand menu button.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @summary Sets ARIA attributes on the collapse/expand menu button.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * When the admin menu is open or folded, updates the `aria-expanded` and
</span><span class="cx" style="display: block; padding: 0 10px"> * `aria-label` attributes of the button to give feedback to assistive
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1122,14 +1577,28 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Fire a custom jQuery event at the end of window resize
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+// Fire a custom jQuery event at the end of window resize.
</ins><span class="cx" style="display: block; padding: 0 10px"> ( function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var timeout;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Triggers the WP window-resize event.
+ *
+ * @since 3.8.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function triggerEvent() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $document.trigger( 'wp-window-resized' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $document.trigger( "wp-window-resized" );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @summary Fires the trigger event again after 200 ms.
+ *
+ * @since 3.8.0
+ *
+ * @returns {void}
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function fireOnce() {
</span><span class="cx" style="display: block; padding: 0 10px"> window.clearTimeout( timeout );
</span><span class="cx" style="display: block; padding: 0 10px"> timeout = window.setTimeout( triggerEvent, 200 );
</span></span></pre>
</div>
</div>
</body>
</html>