In wp.updates.decrementCount(), only display the count if it's a valid non-negative integer.
props jdgrimes. fixes #29527. Built from https://develop.svn.wordpress.org/trunk@29960 git-svn-id: http://core.svn.wordpress.org/trunk@29707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d37ce0b0e5
commit
79175d10cb
|
@ -15,7 +15,7 @@ window.wp = window.wp || {};
|
|||
$elem = $( '#wp-admin-bar-updates .ab-label' );
|
||||
count = $elem.text();
|
||||
count = parseInt( count, 10 ) - 1;
|
||||
if ( count < 0 ) {
|
||||
if ( count < 0 || isNaN( count ) ) {
|
||||
return;
|
||||
}
|
||||
$( '#wp-admin-bar-updates .ab-item' ).removeAttr( 'title' );
|
||||
|
@ -32,7 +32,7 @@ window.wp = window.wp || {};
|
|||
$elem = $( '#menu-plugins' );
|
||||
pluginCount = $elem.find( '.plugin-count' ).eq(0).text();
|
||||
pluginCount = parseInt( pluginCount, 10 ) - 1;
|
||||
if ( pluginCount < 0 ) {
|
||||
if ( pluginCount < 0 || isNaN( pluginCount ) ) {
|
||||
return;
|
||||
}
|
||||
$elem.find( '.plugin-count' ).text( pluginCount );
|
||||
|
|
|
@ -1 +1 @@
|
|||
window.wp=window.wp||{},function(a,b){b.updates={},b.updates.decrementCount=function(b){var c,d,e;if(e=a("#wp-admin-bar-updates .ab-label"),c=e.text(),c=parseInt(c,10)-1,!(0>c)&&(a("#wp-admin-bar-updates .ab-item").removeAttr("title"),e.text(c),e=a('a[href="update-core.php"] .update-plugins'),e.each(function(a,b){b.className=b.className.replace(/count-\d+/,"count-"+c)}),e.removeAttr("title"),e.find(".update-count").text(c),"plugin"===b)){if(e=a("#menu-plugins"),d=e.find(".plugin-count").eq(0).text(),d=parseInt(d,10)-1,0>d)return;e.find(".plugin-count").text(d),e.find(".update-plugins").each(function(a,b){b.className=b.className.replace(/count-\d+/,"count-"+d)})}},a(window).on("message",function(c){var d,e=c.originalEvent,f=document.location,g=f.protocol+"//"+f.hostname;e.origin===g&&(d=a.parseJSON(e.data),"undefined"!=typeof d.action&&"decrementUpdateCount"===d.action&&b.updates.decrementCount(d.upgradeType))})}(jQuery,window.wp);
|
||||
window.wp=window.wp||{},function(a,b){b.updates={},b.updates.decrementCount=function(b){var c,d,e;if(e=a("#wp-admin-bar-updates .ab-label"),c=e.text(),c=parseInt(c,10)-1,!(0>c||isNaN(c))&&(a("#wp-admin-bar-updates .ab-item").removeAttr("title"),e.text(c),e=a('a[href="update-core.php"] .update-plugins'),e.each(function(a,b){b.className=b.className.replace(/count-\d+/,"count-"+c)}),e.removeAttr("title"),e.find(".update-count").text(c),"plugin"===b)){if(e=a("#menu-plugins"),d=e.find(".plugin-count").eq(0).text(),d=parseInt(d,10)-1,0>d||isNaN(d))return;e.find(".plugin-count").text(d),e.find(".update-plugins").each(function(a,b){b.className=b.className.replace(/count-\d+/,"count-"+d)})}},a(window).on("message",function(c){var d,e=c.originalEvent,f=document.location,g=f.protocol+"//"+f.hostname;e.origin===g&&(d=a.parseJSON(e.data),"undefined"!=typeof d.action&&"decrementUpdateCount"===d.action&&b.updates.decrementCount(d.upgradeType))})}(jQuery,window.wp);
|
Loading…
Reference in New Issue