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

2 lines
39 KiB
JavaScript

/*! This file is auto-generated */
!function(g,m,h){var f=g(document),w=m.i18n.__,d=m.i18n._x,u=m.i18n.sprintf;(m=m||{}).updates={},m.updates.l10n={searchResults:"",searchResultsLabel:"",noPlugins:"",noItemsSelected:"",updating:"",pluginUpdated:"",themeUpdated:"",update:"",updateNow:"",pluginUpdateNowLabel:"",updateFailedShort:"",updateFailed:"",pluginUpdatingLabel:"",pluginUpdatedLabel:"",pluginUpdateFailedLabel:"",updatingMsg:"",updatedMsg:"",updateCancel:"",beforeunload:"",installNow:"",pluginInstallNowLabel:"",installing:"",pluginInstalled:"",themeInstalled:"",installFailedShort:"",installFailed:"",pluginInstallingLabel:"",themeInstallingLabel:"",pluginInstalledLabel:"",themeInstalledLabel:"",pluginInstallFailedLabel:"",themeInstallFailedLabel:"",installingMsg:"",installedMsg:"",importerInstalledMsg:"",aysDelete:"",aysDeleteUninstall:"",aysBulkDelete:"",aysBulkDeleteThemes:"",deleting:"",deleteFailed:"",pluginDeleted:"",themeDeleted:"",livePreview:"",activatePlugin:"",activateTheme:"",activatePluginLabel:"",activateThemeLabel:"",activateImporter:"",activateImporterLabel:"",unknownError:"",connectionError:"",nonceError:"",pluginsFound:"",noPluginsFound:"",autoUpdatesEnable:"",autoUpdatesEnabling:"",autoUpdatesEnabled:"",autoUpdatesDisable:"",autoUpdatesDisabling:"",autoUpdatesDisabled:"",autoUpdatesError:""},m.updates.l10n=window.wp.deprecateL10nObject("wp.updates.l10n",m.updates.l10n,"5.5.0"),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...")&&s.data("originaltext",s.html()),s.attr("aria-label",n).text(w("Updating...")),f.trigger("wp-plugin-updating",e),m.updates.ajax("update-plugin",e)},m.updates.updatePluginSuccess=function(e){var t,a,s;"plugins"===pagenow||"plugins-network"===pagenow?(a=(t=g('tr[data-plugin="'+e.plugin+'"]').removeClass("update").addClass("updated")).find(".update-message").removeClass("updating-message notice-warning").addClass("updated-message notice-success").find("p"),s=t.find(".plugin-version-author-uri").html().replace(e.oldVersion,e.newVersion),t.find(".plugin-version-author-uri").html(s),t.find(".auto-update-time").empty()):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(a=g(".plugin-card-"+e.slug).find(".update-now").removeClass("updating-message").addClass("button-disabled updated-message")),a.attr("aria-label",u(d("%s updated!","plugin"),e.pluginName)).text(d("Updated!","plugin")),m.a11y.speak(w("Update completed successfully.")),m.updates.decrementCount("plugin"),f.trigger("wp-plugin-update-success",e)},m.updates.updatePluginError=function(e){var t,a,s;m.updates.isValidResponse(e,"update")&&(m.updates.maybeHandleCredentialError(e,"update-plugin")||(s=u(w("Update failed: %s"),e.errorMessage),"plugins"===pagenow||"plugins-network"===pagenow?((a=e.plugin?g('tr[data-plugin="'+e.plugin+'"]').find(".update-message"):g('tr[data-slug="'+e.slug+'"]').find(".update-message")).removeClass("updating-message notice-warning").addClass("notice-error").find("p").html(s),e.pluginName?a.find("p").attr("aria-label",u(d("%s update failed.","plugin"),e.pluginName)):a.find("p").removeAttr("aria-label")):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||((t=g(".plugin-card-"+e.slug).addClass("plugin-card-update-failed").append(m.updates.adminNotice({className:"update-message notice-error notice-alt is-dismissible",message:s}))).find(".update-now").text(w("Update failed.")).removeClass("updating-message"),e.pluginName?t.find(".update-now").attr("aria-label",u(d("%s update failed.","plugin"),e.pluginName)):t.find(".update-now").removeAttr("aria-label"),t.on("click",".notice.is-dismissible .notice-dismiss",function(){setTimeout(function(){t.removeClass("plugin-card-update-failed").find(".column-name a").focus(),t.find(".update-now").attr("aria-label",!1).text(w("Update Now"))},200)})),m.a11y.speak(s,"assertive"),f.trigger("wp-plugin-update-error",e)))},m.updates.installPlugin=function(e){var t=g(".plugin-card-"+e.slug),a=t.find(".install-now");return e=_.extend({success:m.updates.installPluginSuccess,error:m.updates.installPluginError},e),"import"===pagenow&&(a=g('[data-slug="'+e.slug+'"]')),a.html()!==w("Installing...")&&a.data("originaltext",a.html()),a.addClass("updating-message").attr("aria-label",u(d("Installing %s...","plugin"),a.data("name"))).text(w("Installing...")),m.a11y.speak(w("Installing... please wait.")),t.removeClass("plugin-card-install-failed").find(".notice.notice-error").remove(),f.trigger("wp-plugin-installing",e),m.updates.ajax("install-plugin",e)},m.updates.installPluginSuccess=function(e){var t=g(".plugin-card-"+e.slug).find(".install-now");t.removeClass("updating-message").addClass("updated-message installed button-disabled").attr("aria-label",u(d("%s installed!","plugin"),e.pluginName)).text(d("Installed!","plugin")),m.a11y.speak(w("Installation completed successfully.")),f.trigger("wp-plugin-install-success",e),e.activateUrl&&setTimeout(function(){t.removeClass("install-now installed button-disabled updated-message").addClass("activate-now button-primary").attr("href",e.activateUrl),"plugins-network"===pagenow?t.attr("aria-label",u(d("Network Activate %s","plugin"),e.pluginName)).text(w("Network Activate")):t.attr("aria-label",u(d("Activate %s","plugin"),e.pluginName)).text(w("Activate"))},1e3)},m.updates.installPluginError=function(e){var t,a=g(".plugin-card-"+e.slug),s=a.find(".install-now");m.updates.isValidResponse(e,"install")&&(m.updates.maybeHandleCredentialError(e,"install-plugin")||(t=u(w("Installation failed: %s"),e.errorMessage),a.addClass("plugin-card-update-failed").append('<div class="notice notice-error notice-alt is-dismissible"><p>'+t+"</p></div>"),a.on("click",".notice.is-dismissible .notice-dismiss",function(){setTimeout(function(){a.removeClass("plugin-card-update-failed").find(".column-name a").focus()},200)}),s.removeClass("updating-message").addClass("button-disabled").attr("aria-label",u(d("%s installation failed","plugin"),s.data("name"))).text(w("Installation failed.")),m.a11y.speak(t,"assertive"),f.trigger("wp-plugin-install-error",e)))},m.updates.installImporterSuccess=function(e){m.updates.addAdminNotice({id:"install-success",className:"notice-success is-dismissible",message:u(w('Importer installed successfully. <a href="%s">Run importer</a>'),e.activateUrl+"&from=import")}),g('[data-slug="'+e.slug+'"]').removeClass("install-now updating-message").addClass("activate-now").attr({href:e.activateUrl+"&from=import","aria-label":u(w("Run %s"),e.pluginName)}).text(w("Run Importer")),m.a11y.speak(w("Installation completed successfully.")),f.trigger("wp-importer-install-success",e)},m.updates.installImporterError=function(e){var t=u(w("Installation failed: %s"),e.errorMessage),a=g('[data-slug="'+e.slug+'"]'),s=a.data("name");m.updates.isValidResponse(e,"install")&&(m.updates.maybeHandleCredentialError(e,"install-plugin")||(m.updates.addAdminNotice({id:e.errorCode,className:"notice-error is-dismissible",message:t}),a.removeClass("updating-message").attr("aria-label",u(d("Install %s now","plugin"),s)).text(w("Install Now")),m.a11y.speak(t,"assertive"),f.trigger("wp-importer-install-error",e)))},m.updates.deletePlugin=function(e){var t=g('[data-plugin="'+e.plugin+'"]').find(".row-actions a.delete");return e=_.extend({success:m.updates.deletePluginSuccess,error:m.updates.deletePluginError},e),t.html()!==w("Deleting...")&&t.data("originaltext",t.html()).text(w("Deleting...")),m.a11y.speak(w("Deleting...")),f.trigger("wp-plugin-deleting",e),m.updates.ajax("delete-plugin",e)},m.updates.deletePluginSuccess=function(i){g('[data-plugin="'+i.plugin+'"]').css({backgroundColor:"#faafaa"}).fadeOut(350,function(){var e=g("#bulk-action-form"),t=g(".subsubsub"),a=g(this),s=e.find("thead th:not(.hidden), thead td").length,n=m.template("item-deleted-row"),l=h.plugins;a.hasClass("plugin-update-tr")||a.after(n({slug:i.slug,plugin:i.plugin,colspan:s,name:i.pluginName})),a.remove(),-1!==_.indexOf(l.upgrade,i.plugin)&&(l.upgrade=_.without(l.upgrade,i.plugin),m.updates.decrementCount("plugin")),-1!==_.indexOf(l.inactive,i.plugin)&&(l.inactive=_.without(l.inactive,i.plugin),l.inactive.length?t.find(".inactive .count").text("("+l.inactive.length+")"):t.find(".inactive").remove()),-1!==_.indexOf(l.active,i.plugin)&&(l.active=_.without(l.active,i.plugin),l.active.length?t.find(".active .count").text("("+l.active.length+")"):t.find(".active").remove()),-1!==_.indexOf(l.recently_activated,i.plugin)&&(l.recently_activated=_.without(l.recently_activated,i.plugin),l.recently_activated.length?t.find(".recently_activated .count").text("("+l.recently_activated.length+")"):t.find(".recently_activated").remove()),l.all=_.without(l.all,i.plugin),l.all.length?t.find(".all .count").text("("+l.all.length+")"):(e.find(".tablenav").css({visibility:"hidden"}),t.find(".all").remove(),e.find("tr.no-items").length||e.find("#the-list").append('<tr class="no-items"><td class="colspanchange" colspan="'+s+'">'+w("No plugins are currently available.")+"</td></tr>"))}),m.a11y.speak(d("Deleted!","plugin")),f.trigger("wp-plugin-delete-success",i)},m.updates.deletePluginError=function(e){var t,a,s=m.template("item-update-row"),n=m.updates.adminNotice({className:"update-message notice-error notice-alt",message:e.errorMessage});a=e.plugin?(t=g('tr.inactive[data-plugin="'+e.plugin+'"]')).siblings('[data-plugin="'+e.plugin+'"]'):(t=g('tr.inactive[data-slug="'+e.slug+'"]')).siblings('[data-slug="'+e.slug+'"]'),m.updates.isValidResponse(e,"delete")&&(m.updates.maybeHandleCredentialError(e,"delete-plugin")||(a.length?(a.find(".notice-error").remove(),a.find(".plugin-update").append(n)):t.addClass("update").after(s({slug:e.slug,plugin:e.plugin||e.slug,colspan:g("#bulk-action-form").find("thead th:not(.hidden), thead td").length,content:n})),f.trigger("wp-plugin-delete-error",e)))},m.updates.updateTheme=function(e){var t;return e=_.extend({success:m.updates.updateThemeSuccess,error:m.updates.updateThemeError},e),(t="themes-network"===pagenow?g('[data-slug="'+e.slug+'"]').find(".update-message").removeClass("notice-error").addClass("updating-message notice-warning").find("p"):"customize"===pagenow?((t=g('[data-slug="'+e.slug+'"].notice').removeClass("notice-large")).find("h3").remove(),(t=t.add(g("#customize-control-installed_theme_"+e.slug).find(".update-message"))).addClass("updating-message").find("p")):((t=g("#update-theme").closest(".notice").removeClass("notice-large")).find("h3").remove(),(t=t.add(g('[data-slug="'+e.slug+'"]').find(".update-message"))).addClass("updating-message").find("p"))).html()!==w("Updating...")&&t.data("originaltext",t.html()),m.a11y.speak(w("Updating... please wait.")),t.text(w("Updating...")),f.trigger("wp-theme-updating",e),m.updates.ajax("update-theme",e)},m.updates.updateThemeSuccess=function(e){var t,a,s=g("body.modal-open").length,n=g('[data-slug="'+e.slug+'"]'),l={className:"updated-message notice-success notice-alt",message:d("Updated!","theme")};"customize"===pagenow?((n=g(".updating-message").siblings(".theme-name")).length&&(a=n.html().replace(e.oldVersion,e.newVersion),n.html(a)),t=g(".theme-info .notice").add(m.customize.control("installed_theme_"+e.slug).container.find(".theme").find(".update-message"))):"themes-network"===pagenow?(t=n.find(".update-message"),a=n.find(".theme-version-author-uri").html().replace(e.oldVersion,e.newVersion),n.find(".theme-version-author-uri").html(a),n.find(".auto-update-time").empty()):(t=g(".theme-info .notice").add(n.find(".update-message")),s?(g(".load-customize:visible").focus(),g(".theme-info .theme-autoupdate").find(".auto-update-time").empty()):n.find(".load-customize").focus()),m.updates.addAdminNotice(_.extend({selector:t},l)),m.a11y.speak(w("Update completed successfully.")),m.updates.decrementCount("theme"),f.trigger("wp-theme-update-success",e),s&&"customize"!==pagenow&&g(".theme-info .theme-author").after(m.updates.adminNotice(l))},m.updates.updateThemeError=function(e){var t,a=g('[data-slug="'+e.slug+'"]'),s=u(w("Update failed: %s"),e.errorMessage);m.updates.isValidResponse(e,"update")&&(m.updates.maybeHandleCredentialError(e,"update-theme")||("customize"===pagenow&&(a=m.customize.control("installed_theme_"+e.slug).container.find(".theme")),"themes-network"===pagenow?t=a.find(".update-message "):(t=g(".theme-info .notice").add(a.find(".notice")),g("body.modal-open").length?g(".load-customize:visible").focus():a.find(".load-customize").focus()),m.updates.addAdminNotice({selector:t,className:"update-message notice-error notice-alt is-dismissible",message:s}),m.a11y.speak(s),f.trigger("wp-theme-update-error",e)))},m.updates.installTheme=function(e){var t=g('.theme-install[data-slug="'+e.slug+'"]');return e=_.extend({success:m.updates.installThemeSuccess,error:m.updates.installThemeError},e),t.addClass("updating-message"),t.parents(".theme").addClass("focus"),t.html()!==w("Installing...")&&t.data("originaltext",t.html()),t.attr("aria-label",u(d("Installing %s...","theme"),t.data("name"))).text(w("Installing...")),m.a11y.speak(w("Installing... please wait.")),g('.install-theme-info, [data-slug="'+e.slug+'"]').removeClass("theme-install-failed").find(".notice.notice-error").remove(),f.trigger("wp-theme-installing",e),m.updates.ajax("install-theme",e)},m.updates.installThemeSuccess=function(e){var t,a=g(".wp-full-overlay-header, [data-slug="+e.slug+"]");f.trigger("wp-theme-install-success",e),t=a.find(".button-primary").removeClass("updating-message").addClass("updated-message disabled").attr("aria-label",u(d("%s installed!","theme"),e.themeName)).text(d("Installed!","theme")),m.a11y.speak(w("Installation completed successfully.")),setTimeout(function(){e.activateUrl&&(t.attr("href",e.activateUrl).removeClass("theme-install updated-message disabled").addClass("activate"),"themes-network"===pagenow?t.attr("aria-label",u(d("Network Activate %s","theme"),e.themeName)).text(w("Network Enable")):t.attr("aria-label",u(d("Activate %s","theme"),e.themeName)).text(w("Activate"))),e.customizeUrl&&t.siblings(".preview").replaceWith(function(){return g("<a>").attr("href",e.customizeUrl).addClass("button load-customize").text(w("Live Preview"))})},1e3)},m.updates.installThemeError=function(e){var t,a=u(w("Installation failed: %s"),e.errorMessage),s=m.updates.adminNotice({className:"update-message notice-error notice-alt",message:a});m.updates.isValidResponse(e,"install")&&(m.updates.maybeHandleCredentialError(e,"install-theme")||("customize"===pagenow?(f.find("body").hasClass("modal-open")?(t=g('.theme-install[data-slug="'+e.slug+'"]'),g(".theme-overlay .theme-info").prepend(s)):(t=g('.theme-install[data-slug="'+e.slug+'"]')).closest(".theme").addClass("theme-install-failed").append(s),m.customize.notifications.remove("theme_installing")):f.find("body").hasClass("full-overlay-active")?(t=g('.theme-install[data-slug="'+e.slug+'"]'),g(".install-theme-info").prepend(s)):t=g('[data-slug="'+e.slug+'"]').removeClass("focus").addClass("theme-install-failed").append(s).find(".theme-install"),t.removeClass("updating-message").attr("aria-label",u(d("%s installation failed","theme"),t.data("name"))).text(w("Installation failed.")),m.a11y.speak(a,"assertive"),f.trigger("wp-theme-install-error",e)))},m.updates.deleteTheme=function(e){var t;return"themes"===pagenow?t=g(".theme-actions .delete-theme"):"themes-network"===pagenow&&(t=g('[data-slug="'+e.slug+'"]').find(".row-actions a.delete")),e=_.extend({success:m.updates.deleteThemeSuccess,error:m.updates.deleteThemeError},e),t&&t.html()!==w("Deleting...")&&t.data("originaltext",t.html()).text(w("Deleting...")),m.a11y.speak(w("Deleting...")),g(".theme-info .update-message").remove(),f.trigger("wp-theme-deleting",e),m.updates.ajax("delete-theme",e)},m.updates.deleteThemeSuccess=function(n){var e=g('[data-slug="'+n.slug+'"]');"themes-network"===pagenow&&e.css({backgroundColor:"#faafaa"}).fadeOut(350,function(){var e=g(".subsubsub"),t=g(this),a=h.themes,s=m.template("item-deleted-row");t.hasClass("plugin-update-tr")||t.after(s({slug:n.slug,colspan:g("#bulk-action-form").find("thead th:not(.hidden), thead td").length,name:t.find(".theme-title strong").text()})),t.remove(),t.hasClass("update")&&(a.upgrade--,m.updates.decrementCount("theme")),t.hasClass("inactive")&&(a.disabled--,a.disabled?e.find(".disabled .count").text("("+a.disabled+")"):e.find(".disabled").remove()),e.find(".all .count").text("("+--a.all+")")}),m.a11y.speak(d("Deleted!","theme")),f.trigger("wp-theme-delete-success",n)},m.updates.deleteThemeError=function(e){var t=g('tr.inactive[data-slug="'+e.slug+'"]'),a=g(".theme-actions .delete-theme"),s=m.template("item-update-row"),n=t.siblings("#"+e.slug+"-update"),l=u(w("Deletion failed: %s"),e.errorMessage),i=m.updates.adminNotice({className:"update-message notice-error notice-alt",message:l});m.updates.maybeHandleCredentialError(e,"delete-theme")||("themes-network"===pagenow?n.length?(n.find(".notice-error").remove(),n.find(".plugin-update").append(i)):t.addClass("update").after(s({slug:e.slug,colspan:g("#bulk-action-form").find("thead th:not(.hidden), thead td").length,content:i})):g(".theme-info .theme-description").before(i),a.html(a.data("originaltext")),m.a11y.speak(l,"assertive"),f.trigger("wp-theme-delete-error",e))},m.updates._addCallbacks=function(e,t){return"import"===pagenow&&"install-plugin"===t&&(e.success=m.updates.installImporterSuccess,e.error=m.updates.installImporterError),e},m.updates.queueChecker=function(){var e;if(!m.updates.ajaxLocked&&m.updates.queue.length)switch((e=m.updates.queue.shift()).action){case"install-plugin":m.updates.installPlugin(e.data);break;case"update-plugin":m.updates.updatePlugin(e.data);break;case"delete-plugin":m.updates.deletePlugin(e.data);break;case"install-theme":m.updates.installTheme(e.data);break;case"update-theme":m.updates.updateTheme(e.data);break;case"delete-theme":m.updates.deleteTheme(e.data)}},m.updates.requestFilesystemCredentials=function(e){!1===m.updates.filesystemCredentials.available&&(e&&!m.updates.$elToReturnFocusToFromCredentialsModal&&(m.updates.$elToReturnFocusToFromCredentialsModal=g(e.target)),m.updates.ajaxLocked=!0,m.updates.requestForCredentialsModalOpen())},m.updates.maybeRequestFilesystemCredentials=function(e){m.updates.shouldRequestFilesystemCredentials&&!m.updates.ajaxLocked&&m.updates.requestFilesystemCredentials(e)},m.updates.keydown=function(e){27===e.keyCode?m.updates.requestForCredentialsModalCancel():9===e.keyCode&&("upgrade"!==e.target.id||e.shiftKey?"hostname"===e.target.id&&e.shiftKey&&(g("#upgrade").focus(),e.preventDefault()):(g("#hostname").focus(),e.preventDefault()))},m.updates.requestForCredentialsModalOpen=function(){var e=g("#request-filesystem-credentials-dialog");g("body").addClass("modal-open"),e.show(),e.find("input:enabled:first").focus(),e.on("keydown",m.updates.keydown)},m.updates.requestForCredentialsModalClose=function(){g("#request-filesystem-credentials-dialog").hide(),g("body").removeClass("modal-open"),m.updates.$elToReturnFocusToFromCredentialsModal&&m.updates.$elToReturnFocusToFromCredentialsModal.focus()},m.updates.requestForCredentialsModalCancel=function(){(m.updates.ajaxLocked||m.updates.queue.length)&&(_.each(m.updates.queue,function(e){f.trigger("credential-modal-cancel",e)}),m.updates.ajaxLocked=!1,m.updates.queue=[],m.updates.requestForCredentialsModalClose())},m.updates.showErrorInCredentialsForm=function(e){var t=g("#request-filesystem-credentials-form");t.find(".notice").remove(),t.find("#request-filesystem-credentials-title").after('<div class="notice notice-alt notice-error"><p>'+e+"</p></div>")},m.updates.credentialError=function(e,t){e=m.updates._addCallbacks(e,t),m.updates.queue.unshift({action:t,data:e}),m.updates.filesystemCredentials.available=!1,m.updates.showErrorInCredentialsForm(e.errorMessage),m.updates.requestFilesystemCredentials()},m.updates.maybeHandleCredentialError=function(e,t){return!(!m.updates.shouldRequestFilesystemCredentials||!e.errorCode||"unable_to_connect_to_filesystem"!==e.errorCode)&&(m.updates.credentialError(e,t),!0)},m.updates.isValidResponse=function(e,t){var a,s=w("Something went wrong.");if(_.isObject(e)&&!_.isFunction(e.always))return!0;switch(_.isString(e)&&"-1"===e?s=w("An error has occurred. Please reload the page and try again."):_.isString(e)?s=e:void 0!==e.readyState&&0===e.readyState?s=w("Connection lost or the server is busy. Please try again later."):_.isString(e.responseText)&&""!==e.responseText?s=e.responseText:_.isString(e.statusText)&&(s=e.statusText),t){case"update":a=w("Update failed: %s");break;case"install":a=w("Installation failed: %s");break;case"delete":a=w("Deletion failed: %s")}return s=s.replace(/<[\/a-z][^<>]*>/gi,""),a=a.replace("%s",s),m.updates.addAdminNotice({id:"unknown_error",className:"notice-error is-dismissible",message:_.escape(a)}),m.updates.ajaxLocked=!1,m.updates.queue=[],g(".button.updating-message").removeClass("updating-message").removeAttr("aria-label").prop("disabled",!0).text(w("Update failed.")),g(".updating-message:not(.button):not(.thickbox)").removeClass("updating-message notice-warning").addClass("notice-error").find("p").removeAttr("aria-label").text(a),m.a11y.speak(a,"assertive"),!1},m.updates.beforeunload=function(){if(m.updates.ajaxLocked)return w("Updates may not complete if you navigate away from this page.")},g(function(){var l=g("#plugin-filter"),o=g("#bulk-action-form"),e=g("#request-filesystem-credentials-form"),t=g("#request-filesystem-credentials-dialog"),a=g(".plugins-php .wp-filter-search"),s=g(".plugin-install-php .wp-filter-search");(h=_.extend(h,window._wpUpdatesItemCounts||{})).totals&&m.updates.refreshCount(),m.updates.shouldRequestFilesystemCredentials=0<t.length,t.on("submit","form",function(e){e.preventDefault(),m.updates.filesystemCredentials.ftp.hostname=g("#hostname").val(),m.updates.filesystemCredentials.ftp.username=g("#username").val(),m.updates.filesystemCredentials.ftp.password=g("#password").val(),m.updates.filesystemCredentials.ftp.connectionType=g('input[name="connection_type"]:checked').val(),m.updates.filesystemCredentials.ssh.publicKey=g("#public_key").val(),m.updates.filesystemCredentials.ssh.privateKey=g("#private_key").val(),m.updates.filesystemCredentials.fsNonce=g("#_fs_nonce").val(),m.updates.filesystemCredentials.available=!0,m.updates.ajaxLocked=!1,m.updates.queueChecker(),m.updates.requestForCredentialsModalClose()}),t.on("click",'[data-js-action="close"], .notification-dialog-background',m.updates.requestForCredentialsModalCancel),e.on("change",'input[name="connection_type"]',function(){g("#ssh-keys").toggleClass("hidden","ssh"!==g(this).val())}).change(),f.on("credential-modal-cancel",function(e,t){var a,s,n=g(".updating-message");"import"===pagenow?n.removeClass("updating-message"):"plugins"===pagenow||"plugins-network"===pagenow?"update-plugin"===t.action?a=g('tr[data-plugin="'+t.data.plugin+'"]').find(".update-message"):"delete-plugin"===t.action&&(a=g('[data-plugin="'+t.data.plugin+'"]').find(".row-actions a.delete")):"themes"===pagenow||"themes-network"===pagenow?"update-theme"===t.action?a=g('[data-slug="'+t.data.slug+'"]').find(".update-message"):"delete-theme"===t.action&&"themes-network"===pagenow?a=g('[data-slug="'+t.data.slug+'"]').find(".row-actions a.delete"):"delete-theme"===t.action&&"themes"===pagenow&&(a=g(".theme-actions .delete-theme")):a=n,a&&a.hasClass("updating-message")&&(void 0===(s=a.data("originaltext"))&&(s=g("<p>").html(a.find("p").data("originaltext"))),a.removeClass("updating-message").html(s),"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||("update-plugin"===t.action?a.attr("aria-label",u(d("Update %s now","plugin"),a.data("name"))):"install-plugin"===t.action&&a.attr("aria-label",u(d("Install %s now","plugin"),a.data("name"))))),m.a11y.speak(w("Update canceled."))}),o.on("click","[data-plugin] .update-link",function(e){var t=g(e.target),a=t.parents("tr");e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(m.updates.maybeRequestFilesystemCredentials(e),m.updates.$elToReturnFocusToFromCredentialsModal=a.find(".check-column input"),m.updates.updatePlugin({plugin:a.data("plugin"),slug:a.data("slug")}))}),l.on("click",".update-now",function(e){var t=g(e.target);e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(m.updates.maybeRequestFilesystemCredentials(e),m.updates.updatePlugin({plugin:t.data("plugin"),slug:t.data("slug")}))}),l.on("click",".install-now",function(e){var t=g(e.target);e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(m.updates.shouldRequestFilesystemCredentials&&!m.updates.ajaxLocked&&(m.updates.requestFilesystemCredentials(e),f.on("credential-modal-cancel",function(){g(".install-now.updating-message").removeClass("updating-message").text(w("Install Now")),m.a11y.speak(w("Update canceled."))})),m.updates.installPlugin({slug:t.data("slug")}))}),f.on("click",".importer-item .install-now",function(e){var t=g(e.target),a=g(this).data("name");e.preventDefault(),t.hasClass("updating-message")||(m.updates.shouldRequestFilesystemCredentials&&!m.updates.ajaxLocked&&(m.updates.requestFilesystemCredentials(e),f.on("credential-modal-cancel",function(){t.removeClass("updating-message").attr("aria-label",u(d("Install %s now","plugin"),a)).text(w("Install Now")),m.a11y.speak(w("Update canceled."))})),m.updates.installPlugin({slug:t.data("slug"),pagenow:pagenow,success:m.updates.installImporterSuccess,error:m.updates.installImporterError}))}),o.on("click","[data-plugin] a.delete",function(e){var t,a=g(e.target).parents("tr");t=a.hasClass("is-uninstallable")?u(w("Are you sure you want to delete %s and its data?"),a.find(".plugin-title strong").text()):u(w("Are you sure you want to delete %s?"),a.find(".plugin-title strong").text()),e.preventDefault(),window.confirm(t)&&(m.updates.maybeRequestFilesystemCredentials(e),m.updates.deletePlugin({plugin:a.data("plugin"),slug:a.data("slug")}))}),f.on("click",".themes-php.network-admin .update-link",function(e){var t=g(e.target),a=t.parents("tr");e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(m.updates.maybeRequestFilesystemCredentials(e),m.updates.$elToReturnFocusToFromCredentialsModal=a.find(".check-column input"),m.updates.updateTheme({slug:a.data("slug")}))}),f.on("click",".themes-php.network-admin a.delete",function(e){var t=g(e.target).parents("tr"),a=u(w("Are you sure you want to delete %s?"),t.find(".theme-title strong").text());e.preventDefault(),window.confirm(a)&&(m.updates.maybeRequestFilesystemCredentials(e),m.updates.deleteTheme({slug:t.data("slug")}))}),o.on("click",'[type="submit"]:not([name="clear-recent-list"])',function(e){var t,n,l=g(e.target).siblings("select").val(),a=o.find('input[name="checked[]"]:checked'),i=0,d=0,u=[];switch(pagenow){case"plugins":case"plugins-network":t="plugin";break;case"themes-network":t="theme";break;default:return}if(!a.length)return e.preventDefault(),g("html, body").animate({scrollTop:0}),m.updates.addAdminNotice({id:"no-items-selected",className:"notice-error is-dismissible",message:w("Please select at least one item to perform this action on.")});switch(l){case"update-selected":n=l.replace("selected",t);break;case"delete-selected":var s=w("plugin"===t?"Are you sure you want to delete the selected plugins and their data?":"Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?");if(!window.confirm(s))return void e.preventDefault();n=l.replace("selected",t);break;default:return}m.updates.maybeRequestFilesystemCredentials(e),e.preventDefault(),o.find('.manage-column [type="checkbox"]').prop("checked",!1),f.trigger("wp-"+t+"-bulk-"+l,a),a.each(function(e,t){var a=g(t),s=a.parents("tr");"update-selected"!==l||s.hasClass("update")&&!s.find("notice-error").length?m.updates.queue.push({action:n,data:{plugin:s.data("plugin"),slug:s.data("slug")}}):a.prop("checked",!1)}),f.on("wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error",function(e,t){var a,s,n=g('[data-slug="'+t.slug+'"]');"wp-"+t.update+"-update-success"===e.type?i++:(s=t.pluginName?t.pluginName:n.find(".column-primary strong").text(),d++,u.push(s+": "+t.errorMessage)),n.find('input[name="checked[]"]:checked').prop("checked",!1),m.updates.adminNotice=m.template("wp-bulk-updates-admin-notice"),m.updates.addAdminNotice({id:"bulk-action-notice",className:"bulk-action-notice",successes:i,errors:d,errorMessages:u,type:t.update}),a=g("#bulk-action-notice").on("click","button",function(){g(this).toggleClass("bulk-action-errors-collapsed").attr("aria-expanded",!g(this).hasClass("bulk-action-errors-collapsed")),a.find(".bulk-action-errors").toggleClass("hidden")}),0<d&&!m.updates.queue.length&&g("html, body").animate({scrollTop:0})}),f.on("wp-updates-notice-added",function(){m.updates.adminNotice=m.template("wp-updates-admin-notice")}),m.updates.queueChecker()}),s.length&&s.attr("aria-describedby","live-search-desc"),s.on("keyup input",_.debounce(function(e,t){var a,s,n=g(".plugin-install-search");a={_ajax_nonce:m.updates.ajaxNonce,s:e.target.value,tab:"search",type:g("#typeselector").val(),pagenow:pagenow},s=location.href.split("?")[0]+"?"+g.param(_.omit(a,["_ajax_nonce","pagenow"])),"keyup"===e.type&&27===e.which&&(e.target.value=""),m.updates.searchTerm===a.s&&"typechange"!==t||(l.empty(),m.updates.searchTerm=a.s,window.history&&window.history.replaceState&&window.history.replaceState(null,"",s),n.length||(n=g('<li class="plugin-install-search" />').append(g("<a />",{class:"current",href:s,text:w("Search Results")})),g(".wp-filter .filter-links .current").removeClass("current").parents(".filter-links").prepend(n),l.prev("p").remove(),g(".plugins-popular-tags-wrapper").remove()),void 0!==m.updates.searchRequest&&m.updates.searchRequest.abort(),g("body").addClass("loading-content"),m.updates.searchRequest=m.ajax.post("search-install-plugins",a).done(function(e){g("body").removeClass("loading-content"),l.append(e.items),delete m.updates.searchRequest,0===e.count?m.a11y.speak(w("You do not appear to have any plugins available at this time.")):m.a11y.speak(u(w("Number of plugins found: %d"),e.count))}))},1e3)),a.length&&a.attr("aria-describedby","live-search-desc"),a.on("keyup input",_.debounce(function(e){var t,s={_ajax_nonce:m.updates.ajaxNonce,s:e.target.value,pagenow:pagenow,plugin_status:"all"};"keyup"===e.type&&27===e.which&&(e.target.value=""),m.updates.searchTerm!==s.s&&(m.updates.searchTerm=s.s,t=_.object(_.compact(_.map(location.search.slice(1).split("&"),function(e){if(e)return e.split("=")}))),s.plugin_status=t.plugin_status||"all",window.history&&window.history.replaceState&&window.history.replaceState(null,"",location.href.split("?")[0]+"?s="+s.s+"&plugin_status="+s.plugin_status),void 0!==m.updates.searchRequest&&m.updates.searchRequest.abort(),o.empty(),g("body").addClass("loading-content"),g(".subsubsub .current").removeClass("current"),m.updates.searchRequest=m.ajax.post("search-plugins",s).done(function(e){var t=g("<span />").addClass("subtitle").html(u(w("Search results for: %s"),"<strong>"+_.escape(s.s)+"</strong>")),a=g(".wrap .subtitle");s.s.length?a.length?a.replaceWith(t):g(".wp-header-end").before(t):(a.remove(),g(".subsubsub ."+s.plugin_status+" a").addClass("current")),g("body").removeClass("loading-content"),o.append(e.items),delete m.updates.searchRequest,0===e.count?m.a11y.speak(w("No plugins found. Try a different search.")):m.a11y.speak(u(w("Number of plugins found: %d"),e.count))}))},500)),f.on("submit",".search-plugins",function(e){e.preventDefault(),g("input.wp-filter-search").trigger("input")}),f.on("click",".try-again",function(e){e.preventDefault(),s.trigger("input")}),g("#typeselector").on("change",function(){var e=g('input[name="s"]');e.val().length&&e.trigger("input","typechange")}),g("#plugin_update_from_iframe").on("click",function(e){var t,a=window.parent===window?null:window.parent;g.support.postMessage=!!window.postMessage,!1!==g.support.postMessage&&null!==a&&-1===window.parent.location.pathname.indexOf("update-core.php")&&(e.preventDefault(),t={action:"update-plugin",data:{plugin:g(this).data("plugin"),slug:g(this).data("slug")}},a.postMessage(JSON.stringify(t),window.location.origin))}),g("#plugin_install_from_iframe").on("click",function(e){var t,a=window.parent===window?null:window.parent;g.support.postMessage=!!window.postMessage,!1!==g.support.postMessage&&null!==a&&-1===window.parent.location.pathname.indexOf("index.php")&&(e.preventDefault(),t={action:"install-plugin",data:{slug:g(this).data("slug")}},a.postMessage(JSON.stringify(t),window.location.origin))}),g(window).on("message",function(e){var t,a=e.originalEvent,s=document.location.protocol+"//"+document.location.host;if(a.origin===s){try{t=g.parseJSON(a.data)}catch(e){return}if(t&&void 0!==t.action)switch(t.action){case"decrementUpdateCount":m.updates.decrementCount(t.upgradeType);break;case"install-plugin":case"update-plugin":window.tb_remove(),t.data=m.updates._addCallbacks(t.data,t.action),m.updates.queue.push(t),m.updates.queueChecker()}}}),g(window).on("beforeunload",m.updates.beforeunload),f.on("keydown",".column-auto-updates .toggle-auto-update, .theme-overlay .toggle-auto-update",function(e){32===e.which&&e.preventDefault()}),f.on("click keyup",".column-auto-updates .toggle-auto-update, .theme-overlay .toggle-auto-update",function(e){var t,d,u,o,r=g(this),p=r.attr("data-wp-action"),c=r.find(".label");if(("keyup"!==e.type||32===e.which)&&(o="themes"!==pagenow?r.closest(".column-auto-updates"):r.closest(".theme-autoupdate"),e.preventDefault(),"yes"!==r.attr("data-doing-ajax"))){switch(r.attr("data-doing-ajax","yes"),pagenow){case"plugins":case"plugins-network":u="plugin",d=r.closest("tr").attr("data-plugin");break;case"themes-network":u="theme",d=r.closest("tr").attr("data-slug");break;case"themes":u="theme",d=r.attr("data-slug")}o.find(".notice.notice-error").addClass("hidden"),"enable"===p?c.text(w("Enabling...")):c.text(w("Disabling...")),r.find(".dashicons-update").removeClass("hidden"),t={action:"toggle-auto-updates",_ajax_nonce:h.ajax_nonce,state:p,type:u,asset:d},g.post(window.ajaxurl,t).done(function(e){var t,a,s,n,l,i=r.attr("href");if(!e.success)return l=e.data&&e.data.error?e.data.error:w("The request could not be completed."),o.find(".notice.notice-error").removeClass("hidden").find("p").text(l),void m.a11y.speak(l,"assertive");if("themes"!==pagenow){switch(t=g(".auto-update-enabled span"),a=g(".auto-update-disabled span"),s=parseInt(t.text().replace(/[^\d]+/g,""),10)||0,n=parseInt(a.text().replace(/[^\d]+/g,""),10)||0,p){case"enable":++s,--n;break;case"disable":--s,++n}s=Math.max(0,s),n=Math.max(0,n),t.text("("+s+")"),a.text("("+n+")")}"enable"===p?(r[0].hasAttribute("href")&&(i=i.replace("action=enable-auto-update","action=disable-auto-update"),r.attr("href",i)),r.attr("data-wp-action","disable"),c.text(w("Disable auto-updates")),o.find(".auto-update-time").removeClass("hidden"),m.a11y.speak(w("Auto-updates enabled"))):(r[0].hasAttribute("href")&&(i=i.replace("action=disable-auto-update","action=enable-auto-update"),r.attr("href",i)),r.attr("data-wp-action","enable"),c.text(w("Enable auto-updates")),o.find(".auto-update-time").addClass("hidden"),m.a11y.speak(w("Auto-updates disabled"))),f.trigger("wp-auto-update-setting-changed",{state:p,type:u,asset:d})}).fail(function(){o.find(".notice.notice-error").removeClass("hidden").find("p").text(w("The request could not be completed.")),m.a11y.speak(w("The request could not be completed."),"assertive")}).always(function(){r.removeAttr("data-doing-ajax").find(".dashicons-update").addClass("hidden")})}})})}(jQuery,window.wp,window._wpUpdatesSettings);