summaryrefslogtreecommitdiffstatshomepage
path: root/src/js/_enqueues/admin/common.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/_enqueues/admin/common.js')
-rw-r--r--src/js/_enqueues/admin/common.js48
1 files changed, 25 insertions, 23 deletions
diff --git a/src/js/_enqueues/admin/common.js b/src/js/_enqueues/admin/common.js
index 0541c8d0f2..75c77b3bac 100644
--- a/src/js/_enqueues/admin/common.js
+++ b/src/js/_enqueues/admin/common.js
@@ -168,7 +168,7 @@ window.validateForm = function( form ) {
.length;
};
-// stub for doing better warnings
+// Stub for doing better warnings.
/**
* Shows message pop-up notice or confirmation message.
*
@@ -334,13 +334,13 @@ $('.contextual-help-tabs').delegate('a', 'click', function(e) {
if ( link.is('.active a') )
return false;
- // Links
+ // Links.
$('.contextual-help-tabs .active').removeClass('active');
link.parent('li').addClass('active');
panel = $( link.attr('href') );
- // Panels
+ // Panels.
$('.help-tab-content').not( panel ).removeClass('active').hide();
panel.addClass('active').show();
});
@@ -517,7 +517,7 @@ $document.ready( function() {
$( '#collapse-button' ).on( 'click.collapse-menu', function() {
var viewportWidth = getViewportWidth() || 961;
- // reset any compensation for submenus near the bottom of the screen
+ // Reset any compensation for submenus near the bottom of the screen.
$('#adminmenu div.wp-submenu').css('margin-top', '');
if ( viewportWidth < 960 ) {
@@ -582,12 +582,12 @@ $document.ready( function() {
menutop = $menuItem.offset().top;
wintop = $window.scrollTop();
- maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar
+ maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar.
- bottomOffset = menutop + $submenu.height() + 1; // Bottom offset of the menu
- pageHeight = $wpwrap.height(); // Height of the entire page
+ bottomOffset = menutop + $submenu.height() + 1; // Bottom offset of the menu.
+ pageHeight = $wpwrap.height(); // Height of the entire page.
adjustment = 60 + bottomOffset - pageHeight;
- theFold = $window.height() + wintop - 50; // The fold
+ theFold = $window.height() + wintop - 50; // The fold.
if ( theFold < ( bottomOffset - adjustment ) ) {
adjustment = bottomOffset - theFold;
@@ -604,8 +604,8 @@ $document.ready( function() {
}
}
- if ( 'ontouchstart' in window || /IEMobile\/[1-9]/.test(navigator.userAgent) ) { // touch screen device
- // iOS Safari works with touchstart, the rest work with click
+ if ( 'ontouchstart' in window || /IEMobile\/[1-9]/.test(navigator.userAgent) ) { // Touch screen device.
+ // iOS Safari works with touchstart, the rest work with click.
mobileEvent = isIOS ? 'touchstart' : 'click';
/**
@@ -639,9 +639,11 @@ $document.ready( function() {
return;
}
- // Show the sub instead of following the link if:
- // - the submenu is not open
- // - the submenu is not shown inline or the menu is not folded
+ /*
+ * Show the sub instead of following the link if:
+ * - the submenu is not open.
+ * - the submenu is not shown inline or the menu is not folded.
+ */
if ( ! $menuItem.hasClass( 'opensub' ) && ( ! $menuItem.hasClass( 'wp-menu-open' ) || $menuItem.width() < 40 ) ) {
event.preventDefault();
adjustSubmenu( $menuItem );
@@ -664,12 +666,12 @@ $document.ready( function() {
$submenu = $menuItem.find( '.wp-submenu' ),
top = parseInt( $submenu.css( 'top' ), 10 );
- if ( isNaN( top ) || top > -5 ) { // the submenu is visible
+ if ( isNaN( top ) || top > -5 ) { // The submenu is visible.
return;
}
if ( $adminmenu.data( 'wp-responsive' ) ) {
- // The menu is in responsive mode, bail
+ // The menu is in responsive mode, bail.
return;
}
@@ -685,7 +687,7 @@ $document.ready( function() {
*/
out: function(){
if ( $adminmenu.data( 'wp-responsive' ) ) {
- // The menu is in responsive mode, bail
+ // The menu is in responsive mode, bail.
return;
}
@@ -705,7 +707,7 @@ $document.ready( function() {
*/
$adminmenu.on( 'focus.adminmenu', '.wp-submenu a', function( event ) {
if ( $adminmenu.data( 'wp-responsive' ) ) {
- // The menu is in responsive mode, bail
+ // The menu is in responsive mode, bail.
return;
}
@@ -759,7 +761,7 @@ $document.ready( function() {
$button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' ),
btnText = commonL10n.dismiss || '';
- // Ensure plain text
+ // Ensure plain text.
$button.find( '.screen-reader-text' ).text( btnText );
$button.on( 'click.wp-dismiss-notice', function( event ) {
event.preventDefault();
@@ -776,7 +778,7 @@ $document.ready( function() {
$document.on( 'wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error', makeNoticesDismissible );
- // Init screen meta
+ // Init screen meta.
screenMeta.init();
/**
@@ -902,7 +904,7 @@ $document.ready( function() {
}
}, '.has-row-actions' );
- // Toggle list table rows on small screens
+ // Toggle list table rows on small screens.
$( 'tbody' ).on( 'click', '.toggle-row', function() {
$( this ).closest( 'tr' ).toggleClass( 'is-expanded' );
});
@@ -925,7 +927,7 @@ $document.ready( function() {
// After pressing escape key (keyCode: 27), the tab key should tab out of the textarea.
if ( e.keyCode == 27 ) {
- // when pressing Escape: Opera 12 and 27 blur form fields, IE 8 clears them
+ // When pressing Escape: Opera 12 and 27 blur form fields, IE 8 clears them.
e.preventDefault();
$(el).data('tab-out', true);
return;
@@ -1276,7 +1278,7 @@ $document.ready( function() {
this.maybeDisableSortables = this.maybeDisableSortables.bind( this );
- // Modify functionality based on custom activate/deactivate event
+ // Modify functionality based on custom activate/deactivate event.
$document.on( 'wp-responsive-activate.wp-responsive', function() {
self.activate();
}).on( 'wp-responsive-deactivate.wp-responsive', function() {
@@ -1289,7 +1291,7 @@ $document.ready( function() {
$( '#wp-admin-bar-menu-toggle' ).on( 'click.wp-responsive', function( event ) {
event.preventDefault();
- // close any open toolbar submenus.
+ // Close any open toolbar submenus.
$adminbar.find( '.hover' ).removeClass( 'hover' );
$wpwrap.toggleClass( 'wp-responsive-open' );