2018-10-09 04:52:45 +02:00
|
|
|
!function(o,p,d){var c=o(document);(p=p||{}).updates={},p.updates.ajaxNonce=d.ajax_nonce,p.updates.l10n=d.l10n,p.updates.searchTerm="",p.updates.shouldRequestFilesystemCredentials=!1,p.updates.filesystemCredentials={ftp:{host:"",username:"",password:"",connectionType:""},ssh:{publicKey:"",privateKey:""},fsNonce:"",available:!1},p.updates.ajaxLocked=!1,p.updates.adminNotice=p.template("wp-updates-admin-notice"),p.updates.queue=[],p.updates.$elToReturnFocusToFromCredentialsModal=void 0,p.updates.addAdminNotice=function(e){var t,a=o(e.selector);delete e.selector,t=p.updates.adminNotice(e),a.length||(a=o("#"+e.id)),a.length?a.replaceWith(t):"customize"===pagenow?o(".customize-themes-notifications").append(t):o(".wrap").find("> h1").after(t),c.trigger("wp-updates-notice-added")},p.updates.ajax=function(e,t){var a={};return p.updates.ajaxLocked?(p.updates.queue.push({action:e,data:t}),o.Deferred()):(p.updates.ajaxLocked=!0,t.success&&(a.success=t.success,delete t.success),t.error&&(a.error=t.error,delete t.error),a.data=_.extend(t,{action:e,_ajax_nonce:p.updates.ajaxNonce,_fs_nonce:p.updates.filesystemCredentials.fsNonce,username:p.updates.filesystemCredentials.ftp.username,password:p.updates.filesystemCredentials.ftp.password,hostname:p.updates.filesystemCredentials.ftp.hostname,connection_type:p.updates.filesystemCredentials.ftp.connectionType,public_key:p.updates.filesystemCredentials.ssh.publicKey,private_key:p.updates.filesystemCredentials.ssh.privateKey}),p.ajax.send(a).always(p.updates.ajaxAlways))},p.updates.ajaxAlways=function(e){e.errorCode&&"unable_to_connect_to_filesystem"===e.errorCode||(p.updates.ajaxLocked=!1,p.updates.queueChecker()),void 0!==e.debug&&window.console&&window.console.log&&_.map(e.debug,function(e){window.console.log(o("<p />").html(e).text())})},p.updates.refreshCount=function(){var e,t=o("#wp-admin-bar-updates"),a=o('a[href="update-core.php"] .update-plugins'),s=o('a[href="plugins.php"] .update-plugins'),n=o('a[href="themes.php"] .update-plugins');t.find(".ab-item").removeAttr("title"),t.find(".ab-label").text(d.totals.counts.total),0===d.totals.counts.total&&t.find(".ab-label").parents("li").remove(),a.each(function(e,t){t.className=t.className.replace(/count-\d+/,"count-"+d.totals.counts.total)}),0<d.totals.counts.total?a.find(".update-count").text(d.totals.counts.total):a.remove(),s.each(function(e,t){t.className=t.className.replace(/count-\d+/,"count-"+d.totals.counts.plugins)}),0<d.totals.counts.total?s.find(".plugin-count").text(d.totals.counts.plugins):s.remove(),n.each(function(e,t){t.className=t.className.replace(/count-\d+/,"count-"+d.totals.counts.themes)}),0<d.totals.counts.total?n.find(".theme-count").text(d.totals.counts.themes):n.remove(),"plugins"===pagenow||"plugins-network"===pagenow?e=d.totals.counts.plugins:"themes"!==pagenow&&"themes-network"!==pagenow||(e=d.totals.counts.themes),0<e?o(".subsubsub .upgrade .count").text("("+e+")"):(o(".subsubsub .upgrade").remove(),o(".subsubsub li:last").html(function(){return o(this).children()}))},p.updates.decrementCount=function(e){d.totals.counts.total=Math.max(--d.totals.counts.total,0),"plugin"===e?d.totals.counts.plugins=Math.max(--d.totals.counts.plugins,0):"theme"===e&&(d.totals.counts.themes=Math.max(--d.totals.counts.themes,0)),p.updates.refreshCount(e)},p.updates.updatePlugin=function(e){var t,a,s,n;return e=_.extend({success:p.updates.updatePluginSuccess,error:p.updates.updatePluginError},e),"plugins"===pagenow||"plugins-network"===pagenow?(s=(t=o('tr[data-plugin="'+e.plugin+'"]')).find(".update-message").removeClass("notice-error").addClass("updating-message notice-warning").find("p"),n=p.updates.l10n.pluginUpdatingLabel.replace("%s",t.find(".plugin-title strong").text())):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(s=(a=o(".plugin-card-"+e.slug)).find(".update-now").addClass("updating-message"),n=p.updates.l10n.pluginUpdatingLabel.replace("%s",s.data("name")),a.removeClass("plugin-card-update-failed").find(".notice.notice-error").remove()),s.html()!==p.updates.l10n.updating&&s.data("originaltext",s.html
|