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