350 $dashboardNavMenuUpdateCount = $( 'a[href="update-core.php"] .update-plugins' ), |
352 $dashboardNavMenuUpdateCount = $( 'a[href="update-core.php"] .update-plugins' ), |
351 $pluginsNavMenuUpdateCount = $( 'a[href="plugins.php"] .update-plugins' ), |
353 $pluginsNavMenuUpdateCount = $( 'a[href="plugins.php"] .update-plugins' ), |
352 $appearanceNavMenuUpdateCount = $( 'a[href="themes.php"] .update-plugins' ), |
354 $appearanceNavMenuUpdateCount = $( 'a[href="themes.php"] .update-plugins' ), |
353 itemCount; |
355 itemCount; |
354 |
356 |
355 $adminBarUpdates.find( '.ab-item' ).removeAttr( 'title' ); |
|
356 $adminBarUpdates.find( '.ab-label' ).text( settings.totals.counts.total ); |
357 $adminBarUpdates.find( '.ab-label' ).text( settings.totals.counts.total ); |
|
358 $adminBarUpdates.find( '.updates-available-text' ).text( |
|
359 sprintf( |
|
360 /* translators: %s: Total number of updates available. */ |
|
361 _n( '%s update available', '%s updates available', settings.totals.counts.total ), |
|
362 settings.totals.counts.total |
|
363 ) |
|
364 ); |
357 |
365 |
358 // Remove the update count from the toolbar if it's zero. |
366 // Remove the update count from the toolbar if it's zero. |
359 if ( 0 === settings.totals.counts.total ) { |
367 if ( 0 === settings.totals.counts.total ) { |
360 $adminBarUpdates.find( '.ab-label' ).parents( 'li' ).remove(); |
368 $adminBarUpdates.find( '.ab-label' ).parents( 'li' ).remove(); |
361 } |
369 } |
961 // Removes the plugin and updates rows. |
969 // Removes the plugin and updates rows. |
962 $( '[data-plugin="' + response.plugin + '"]' ).css( { backgroundColor: '#faafaa' } ).fadeOut( 350, function() { |
970 $( '[data-plugin="' + response.plugin + '"]' ).css( { backgroundColor: '#faafaa' } ).fadeOut( 350, function() { |
963 var $form = $( '#bulk-action-form' ), |
971 var $form = $( '#bulk-action-form' ), |
964 $views = $( '.subsubsub' ), |
972 $views = $( '.subsubsub' ), |
965 $pluginRow = $( this ), |
973 $pluginRow = $( this ), |
|
974 $currentView = $views.find( '[aria-current="page"]' ), |
|
975 $itemsCount = $( '.displaying-num' ), |
966 columnCount = $form.find( 'thead th:not(.hidden), thead td' ).length, |
976 columnCount = $form.find( 'thead th:not(.hidden), thead td' ).length, |
967 pluginDeletedRow = wp.template( 'item-deleted-row' ), |
977 pluginDeletedRow = wp.template( 'item-deleted-row' ), |
968 /** |
978 /** |
969 * Plugins Base names of plugins in their different states. |
979 * Plugins Base names of plugins in their different states. |
970 * |
980 * |
971 * @type {Object} |
981 * @type {Object} |
972 */ |
982 */ |
973 plugins = settings.plugins; |
983 plugins = settings.plugins, |
|
984 remainingCount; |
974 |
985 |
975 // Add a success message after deleting a plugin. |
986 // Add a success message after deleting a plugin. |
976 if ( ! $pluginRow.hasClass( 'plugin-update-tr' ) ) { |
987 if ( ! $pluginRow.hasClass( 'plugin-update-tr' ) ) { |
977 $pluginRow.after( |
988 $pluginRow.after( |
978 pluginDeletedRow( { |
989 pluginDeletedRow( { |
1047 $views.find( '.all' ).remove(); |
1058 $views.find( '.all' ).remove(); |
1048 |
1059 |
1049 if ( ! $form.find( 'tr.no-items' ).length ) { |
1060 if ( ! $form.find( 'tr.no-items' ).length ) { |
1050 $form.find( '#the-list' ).append( '<tr class="no-items"><td class="colspanchange" colspan="' + columnCount + '">' + __( 'No plugins are currently available.' ) + '</td></tr>' ); |
1061 $form.find( '#the-list' ).append( '<tr class="no-items"><td class="colspanchange" colspan="' + columnCount + '">' + __( 'No plugins are currently available.' ) + '</td></tr>' ); |
1051 } |
1062 } |
|
1063 } |
|
1064 |
|
1065 if ( $itemsCount.length && $currentView.length ) { |
|
1066 remainingCount = plugins[ $currentView.parent( 'li' ).attr('class') ].length; |
|
1067 $itemsCount.text( |
|
1068 sprintf( |
|
1069 /* translators: %s: The remaining number of plugins. */ |
|
1070 _nx( '%s item', '%s items', 'plugin/plugins', remainingCount ), |
|
1071 remainingCount |
|
1072 ) |
|
1073 ); |
1052 } |
1074 } |
1053 } ); |
1075 } ); |
1054 |
1076 |
1055 wp.a11y.speak( _x( 'Deleted!', 'plugin' ) ); |
1077 wp.a11y.speak( _x( 'Deleted!', 'plugin' ) ); |
1056 |
1078 |