WordPress/wp-admin/js/updates.min.js

2 lines
37 KiB
JavaScript
Raw Normal View History

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