Ticket #25943: dashboard.diff
File dashboard.diff, 3.1 KB (added by , 11 years ago) |
---|
-
src/wp-admin/js/dashboard.js
1 /* global pagenow */1 /* global pagenow, ajaxurl, postboxes, wpActiveEditor:true */ 2 2 var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad; 3 3 4 4 jQuery(document).ready( function($) { 5 5 /* Dashboard Welcome Panel */ 6 6 var welcomePanel = $('#welcome-panel'), 7 7 welcomePanelHide = $('#wp_welcome_panel-hide'), 8 8 updateWelcomePanel = function( visible ) { 9 9 $.post( ajaxurl, { 10 10 action: 'update-welcome-panel', 11 11 visible: visible, … … 13 13 }); 14 14 }; 15 15 16 if ( welcomePanel.hasClass('hidden') && welcomePanelHide.prop('checked') ) 16 if ( welcomePanel.hasClass('hidden') && welcomePanelHide.prop('checked') ) { 17 17 welcomePanel.removeClass('hidden'); 18 } 18 19 19 20 $('.welcome-panel-close, .welcome-panel-dismiss a', welcomePanel).click( function(e) { 20 21 e.preventDefault(); … … 48 49 49 50 if ( el ) { 50 51 el = el.toString(); 51 if ( $.inArray(el, ajaxWidgets) != -1 )52 if ( $.inArray(el, ajaxWidgets) !== -1 ) { 52 53 show(0, el); 54 } 53 55 } else { 54 56 $.each( ajaxWidgets, show ); 55 57 } … … 90 92 $('#title, #tags-input, #content').each( function() { 91 93 var input = $(this), prompt = $('#' + this.id + '-prompt-text'); 92 94 93 if ( '' === this.value ) 95 if ( '' === this.value ) { 94 96 prompt.removeClass('screen-reader-text'); 97 } 95 98 96 99 prompt.click( function() { 97 100 $(this).addClass('screen-reader-text'); … … 99 102 }); 100 103 101 104 input.blur( function() { 102 if ( '' === this.value ) 105 if ( '' === this.value ) { 103 106 prompt.removeClass('screen-reader-text'); 107 } 104 108 }); 105 109 106 110 input.focus( function() { … … 109 113 }); 110 114 111 115 $('#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); 114 118 wpActiveEditor = 'content'; 115 119 }); 116 120 }; … … 120 124 $( '.show-more a' ).on( 'click', function(e) { 121 125 $( this ).fadeOut().closest('.activity-block').find( 'li.hidden' ).fadeIn().removeClass( 'hidden' ); 122 126 e.preventDefault(); 123 }) 127 }); 124 128 125 129 // Dashboard columns 126 jQuery(document).ready(function ( $) {130 jQuery(document).ready(function () { 127 131 // Update main column count on load 128 132 updateColumnCount(); 129 133 }); … … 134 138 135 139 function updateColumnCount() { 136 140 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) { 139 144 cols = 2; 140 if (1300 < windowWidth && 1799 > windowWidth) 145 } 146 147 if (1300 < windowWidth && 1799 > windowWidth) { 141 148 cols = 3; 142 if (1800 < windowWidth) 149 } 150 151 if (1800 < windowWidth) { 143 152 cols = 4; 153 } 144 154 jQuery('.metabox-holder').attr('class', jQuery('.metabox-holder').attr('class').replace(/columns-\d+/, 'columns-' + cols)); 145 155 } 146 156