2015-02-05 05:19:23 +01:00
|
|
|
window.wp=window.wp||{},function(a,b){b.updates={},b.updates.ajaxNonce=window._wpUpdatesSettings.ajax_nonce,b.updates.l10n=window._wpUpdatesSettings.l10n,b.updates.updateLock=!1,b.updates.updateQueue=[],b.updates.decrementCount=function(b){var c,d,e=a("#wp-admin-bar-updates .ab-label"),f=a('a[href="update-core.php"] .update-plugins');if($pluginsMenuItem=a("#menu-plugins"),c=e.text(),c=parseInt(c,10)-1,!(0>c||isNaN(c))&&(a("#wp-admin-bar-updates .ab-item").removeAttr("title"),e.text(c),f.each(function(a,b){b.className=b.className.replace(/count-\d+/,"count-"+c)}),f.removeAttr("title"),f.find(".update-count").text(c),"plugin"===b)){if(d=$pluginsMenuItem.find(".plugin-count").eq(0).text(),d=parseInt(d,10)-1,0>d||isNaN(d))return;$pluginsMenuItem.find(".plugin-count").text(d),$pluginsMenuItem.find(".update-plugins").each(function(a,b){b.className=b.className.replace(/count-\d+/,"count-"+d)}),d>0?a(".subsubsub .upgrade .count").text("("+d+")"):a(".subsubsub .upgrade").remove()}},b.updates.updatePlugin=function(c,d){var e;if("plugins"===pagenow||"plugins-network"===pagenow?e=a("#"+d).next().find(".update-message"):"plugin-install"===pagenow&&(e=a(".plugin-card-"+d).find(".update-now")),e.addClass("updating-message"),e.text(b.updates.l10n.updating),b.updates.updateLock)return void b.updates.updateQueue.push({type:"update-plugin",data:{plugin:c,slug:d}});b.updates.updateLock=!0;var f={action:"update-plugin",_ajax_nonce:b.updates.ajaxNonce,plugin:c,slug:d};a.ajax({type:"post",url:ajaxurl,data:f,complete:b.updates.updateRequestComplete})},b.updates.updateRequestComplete=function(a){if(b.updates.updateLock=!1,a.responseJSON&&a.responseJSON.success)b.updates.updateSuccess(a.responseJSON);else{var c=b.updates.l10n.updateFailed;a.responseJSON&&a.responseJSON.data&&a.responseJSON.data.error&&(c+=": "+a.responseJSON.data.error),alert(c),a.responseJSON&&a.responseJSON.data&&a.responseJSON.data.slug&&b.updates.updateError(a.responseJSON)}b.updates.queueChecker()},b.updates.updateSuccess=function(c){var d;"plugins"===pagenow||"plugins-network"===pagenow?(d=a("#"+c.data.slug).next().find(".update-message"),a("#"+c.data.slug).addClass("updated").removeClass("update"),a("#"+c.data.slug+"-update").addClass("updated").removeClass("update")):"plugin-install"===pagenow&&(d=a(".plugin-card-"+c.data.slug).find(".update-now"),d.addClass("button-disabled")),d.removeClass("updating-message").addClass("updated-message"),d.text(b.updates.l10n.updated),b.updates.decrementCount("plugin")},b.updates.updateError=function(c){var d;"plugins"===pagenow||"plugins-network"===pagenow?d=a("#"+c.data.slug).next().find(".update-message"):"plugin-install"===pagenow&&(d=a(".plugin-card-"+c.data.slug).find(".update-now")),d.removeClass("updating-message"),d.text(b.updates.l10n.updateFailed)},b.updates.installPlugin=function(c){var d=a(".plugin-card-"+c).find(".install-now");if(d.addClass("updating-message"),d.text(b.updates.l10n.installing),b.updates.updateLock)return void b.updates.updateQueue.push({type:"install-plugin",data:{slug:c}});b.updates.updateLock=!0;var e={action:"install-plugin",_ajax_nonce:b.updates.ajaxNonce,slug:c};a.ajax({type:"post",url:ajaxurl,data:e,complete:b.updates.installRequestComplete})},b.updates.installRequestComplete=function(a){if(b.updates.updateLock=!1,a.responseJSON&&a.responseJSON.success)b.updates.installSuccess(a.responseJSON);else{var c=b.updates.l10n.installFailed;a.responseJSON&&a.responseJSON.data&&a.responseJSON.data.error&&(c+=": "+a.responseJSON.data.error),alert(c),a.responseJSON&&a.responseJSON.data&&a.responseJSON.data.slug&&b.updates.installError(a.responseJSON)}b.updates.queueChecker()},b.updates.installSuccess=function(c){var d=a(".plugin-card-"+c.data.slug).find(".install-now");d.removeClass("updating-message").addClass("updated-message button-disabled"),d.text(b.updates.l10n.installed)},b.updates.installError=function(c){var d=a(".plugin-card-"+c.data.slug).find(".install-now");d.removeClass("updating-message"),d.text(b.updates.l10n.installNow)},b.updates.queueChecker=function(){if(!(b.updates.updateLock||b.updates.upd
|