WordPress/wp-admin/js/updates.min.js
Andrew Nacin 13e868ac55 Decrement update count bubbles as plugins/themes are updated, live.
props gcorne, mitchoyoshitaka.
fixes #17703.

Built from https://develop.svn.wordpress.org/trunk@27280


git-svn-id: http://core.svn.wordpress.org/trunk@27136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 06:55:14 +00:00

1 line
866 B
JavaScript

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)&&(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.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>c)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);