Make WordPress Core

Ticket #25943: dashboard.diff

File dashboard.diff, 3.1 KB (added by tommcfarlin, 11 years ago)

Resolving all errors found when running JSLint against this file.

  • src/wp-admin/js/dashboard.js

     
    1 /* global pagenow */
     1/* global pagenow, ajaxurl, postboxes, wpActiveEditor:true */
    22var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;
    33
    44jQuery(document).ready( function($) {
    55        /* Dashboard Welcome Panel */
    66        var welcomePanel = $('#welcome-panel'),
    77                welcomePanelHide = $('#wp_welcome_panel-hide'),
    8                 updateWelcomePanel = function( visible ) {
     8                updateWelcomePanel = function( visible ) {
    99                        $.post( ajaxurl, {
    1010                                action: 'update-welcome-panel',
    1111                                visible: visible,
     
    1313                        });
    1414                };
    1515
    16         if ( welcomePanel.hasClass('hidden') && welcomePanelHide.prop('checked') )
     16        if ( welcomePanel.hasClass('hidden') && welcomePanelHide.prop('checked') ) {
    1717                welcomePanel.removeClass('hidden');
     18        }
    1819
    1920        $('.welcome-panel-close, .welcome-panel-dismiss a', welcomePanel).click( function(e) {
    2021                e.preventDefault();
     
    4849
    4950                if ( el ) {
    5051                        el = el.toString();
    51                         if ( $.inArray(el, ajaxWidgets) != -1 )
     52                        if ( $.inArray(el, ajaxWidgets) !== -1 ) {
    5253                                show(0, el);
     54                        }
    5355                } else {
    5456                        $.each( ajaxWidgets, show );
    5557                }
     
    9092                $('#title, #tags-input, #content').each( function() {
    9193                        var input = $(this), prompt = $('#' + this.id + '-prompt-text');
    9294
    93                         if ( '' === this.value )
     95                        if ( '' === this.value ) {
    9496                                prompt.removeClass('screen-reader-text');
     97                        }
    9598
    9699                        prompt.click( function() {
    97100                                $(this).addClass('screen-reader-text');
     
    99102                        });
    100103
    101104                        input.blur( function() {
    102                                 if ( '' === this.value )
     105                                if ( '' === this.value ) {
    103106                                        prompt.removeClass('screen-reader-text');
     107                                }
    104108                        });
    105109
    106110                        input.focus( function() {
     
    109113                });
    110114
    111115                $('#quick-press').on( 'click focusin', function() {
    112                         $(this).addClass("quickpress-open");
    113                         $("#description-wrap, p.submit").slideDown(200);
     116                        $(this).addClass('quickpress-open');
     117                        $('#description-wrap, p.submit').slideDown(200);
    114118                        wpActiveEditor = 'content';
    115119                });
    116120        };
     
    120124        $( '.show-more a' ).on( 'click', function(e) {
    121125                $( this ).fadeOut().closest('.activity-block').find( 'li.hidden' ).fadeIn().removeClass( 'hidden' );
    122126                e.preventDefault();
    123         })
     127        });
    124128
    125129        // Dashboard columns
    126         jQuery(document).ready(function ($) {
     130        jQuery(document).ready(function () {
    127131                // Update main column count on load
    128132                updateColumnCount();
    129133        });
     
    134138
    135139        function updateColumnCount() {
    136140                var cols = 1,
    137                         windowWidth = parseInt(jQuery(window).width());
    138                 if (799 < windowWidth && 1299 > windowWidth)
     141                        windowWidth = parseInt(jQuery(window).width(), 10);
     142
     143                if (799 < windowWidth && 1299 > windowWidth) {
    139144                        cols = 2;
    140                 if (1300 < windowWidth && 1799 > windowWidth)
     145                }
     146
     147                if (1300 < windowWidth && 1799 > windowWidth) {
    141148                        cols = 3;
    142                 if (1800 < windowWidth)
     149                }
     150
     151                if (1800 < windowWidth) {
    143152                        cols = 4;
     153                }
    144154                jQuery('.metabox-holder').attr('class', jQuery('.metabox-holder').attr('class').replace(/columns-\d+/, 'columns-' + cols));
    145155        }
    146156