2 lines
35 KiB
JavaScript
2 lines
35 KiB
JavaScript
/*! This file is auto-generated */
|
|
!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),s=o(".wp-header-end");delete e.selector,t=p.updates.adminNotice(e),a.length||(a=o("#"+e.id)),a.length?a.replaceWith(t):s.length?s.after(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(p.sanitize.stripTagsAndEncodeText(e))})},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()),s.attr("aria-label",n).text(p.updates.l10n.updating),c.trigger("wp-plugin-updating",e),p.updates.ajax("update-plugin",e)},p.updates.updatePluginSuccess=function(e){var t,a,s;"plugins"===pagenow||"plugins-network"===pagenow?(a=(t=o('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)):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(a=o(".plugin-card-"+e.slug).find(".update-now").removeClass("updating-message").addClass("button-disabled updated-message")),a.attr("aria-label",p.updates.l10n.pluginUpdatedLabel.replace("%s",e.pluginName)).text(p.updates.l10n.pluginUpdated),p.a11y.speak(p.updates.l10n.updatedMsg,"polite"),p.updates.decrementCount("plugin"),c.trigger("wp-plugin-update-success",e)},p.updates.updatePluginError=function(e){var t,a,s;p.updates.isValidResponse(e,"update")&&(p.updates.maybeHandleCredentialError(e,"update-plugin")||(s=p.updates.l10n.updateFailed.replace("%s",e.errorMessage),"plugins"===pagenow||"plugins-network"===pagenow?((a=e.plugin?o('tr[data-plugin="'+e.plugin+'"]').find(".update-message"):o('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",p.updates.l10n.pluginUpdateFailedLabel.replace("%s",e.pluginName)):a.find("p").removeAttr("aria-label")):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||((t=o(".plugin-card-"+e.slug).addClass("plugin-card-update-failed").append(p.updates.adminNotice({className:"update-message notice-error notice-alt is-dismissible",message:s}))).find(".update-now").text(p.updates.l10n.updateFailedShort).removeClass("updating-message"),e.pluginName?t.find(".update-now").attr("aria-label",p.updates.l10n.pluginUpdateFailedLabel.replace("%s",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(p.updates.l10n.updateNow)},200)})),p.a11y.speak(s,"assertive"),c.trigger("wp-plugin-update-error",e)))},p.updates.installPlugin=function(e){var t=o(".plugin-card-"+e.slug),a=t.find(".install-now");return e=_.extend({success:p.updates.installPluginSuccess,error:p.updates.installPluginError},e),"import"===pagenow&&(a=o('[data-slug="'+e.slug+'"]')),a.html()!==p.updates.l10n.installing&&a.data("originaltext",a.html()),a.addClass("updating-message").attr("aria-label",p.updates.l10n.pluginInstallingLabel.replace("%s",a.data("name"))).text(p.updates.l10n.installing),p.a11y.speak(p.updates.l10n.installingMsg,"polite"),t.removeClass("plugin-card-install-failed").find(".notice.notice-error").remove(),c.trigger("wp-plugin-installing",e),p.updates.ajax("install-plugin",e)},p.updates.installPluginSuccess=function(e){var t=o(".plugin-card-"+e.slug).find(".install-now");t.removeClass("updating-message").addClass("updated-message installed button-disabled").attr("aria-label",p.updates.l10n.pluginInstalledLabel.replace("%s",e.pluginName)).text(p.updates.l10n.pluginInstalled),p.a11y.speak(p.updates.l10n.installedMsg,"polite"),c.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).attr("aria-label",p.updates.l10n.activatePluginLabel.replace("%s",e.pluginName)).text(p.updates.l10n.activatePlugin)},1e3)},p.updates.installPluginError=function(e){var t,a=o(".plugin-card-"+e.slug),s=a.find(".install-now");p.updates.isValidResponse(e,"install")&&(p.updates.maybeHandleCredentialError(e,"install-plugin")||(t=p.updates.l10n.installFailed.replace("%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",p.updates.l10n.pluginInstallFailedLabel.replace("%s",s.data("name"))).text(p.updates.l10n.installFailedShort),p.a11y.speak(t,"assertive"),c.trigger("wp-plugin-install-error",e)))},p.updates.installImporterSuccess=function(e){p.updates.addAdminNotice({id:"install-success",className:"notice-success is-dismissible",message:p.updates.l10n.importerInstalledMsg.replace("%s",e.activateUrl+"&from=import")}),o('[data-slug="'+e.slug+'"]').removeClass("install-now updating-message").addClass("activate-now").attr({href:e.activateUrl+"&from=import","aria-label":p.updates.l10n.activateImporterLabel.replace("%s",e.pluginName)}).text(p.updates.l10n.activateImporter),p.a11y.speak(p.updates.l10n.installedMsg,"polite"),c.trigger("wp-importer-install-success",e)},p.updates.installImporterError=function(e){var t=p.updates.l10n.installFailed.replace("%s",e.errorMessage),a=o('[data-slug="'+e.slug+'"]'),s=a.data("name");p.updates.isValidResponse(e,"install")&&(p.updates.maybeHandleCredentialError(e,"install-plugin")||(p.updates.addAdminNotice({id:e.errorCode,className:"notice-error is-dismissible",message:t}),a.removeClass("updating-message").text(p.updates.l10n.installNow).attr("aria-label",p.updates.l10n.pluginInstallNowLabel.replace("%s",s)),p.a11y.speak(t,"assertive"),c.trigger("wp-importer-install-error",e)))},p.updates.deletePlugin=function(e){var t=o('[data-plugin="'+e.plugin+'"]').find(".row-actions a.delete");return e=_.extend({success:p.updates.deletePluginSuccess,error:p.updates.deletePluginError},e),t.html()!==p.updates.l10n.deleting&&t.data("originaltext",t.html()).text(p.updates.l10n.deleting),p.a11y.speak(p.updates.l10n.deleting,"polite"),c.trigger("wp-plugin-deleting",e),p.updates.ajax("delete-plugin",e)},p.updates.deletePluginSuccess=function(i){o('[data-plugin="'+i.plugin+'"]').css({backgroundColor:"#faafaa"}).fadeOut(350,function(){var e=o("#bulk-action-form"),t=o(".subsubsub"),a=o(this),s=e.find("thead th:not(.hidden), thead td").length,n=p.template("item-deleted-row"),l=d.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),p.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+'">'+p.updates.l10n.noPlugins+"</td></tr>"))}),p.a11y.speak(p.updates.l10n.pluginDeleted,"polite"),c.trigger("wp-plugin-delete-success",i)},p.updates.deletePluginError=function(e){var t,a,s=p.template("item-update-row"),n=p.updates.adminNotice({className:"update-message notice-error notice-alt",message:e.errorMessage});a=e.plugin?(t=o('tr.inactive[data-plugin="'+e.plugin+'"]')).siblings('[data-plugin="'+e.plugin+'"]'):(t=o('tr.inactive[data-slug="'+e.slug+'"]')).siblings('[data-slug="'+e.slug+'"]'),p.updates.isValidResponse(e,"delete")&&(p.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:o("#bulk-action-form").find("thead th:not(.hidden), thead td").length,content:n})),c.trigger("wp-plugin-delete-error",e)))},p.updates.updateTheme=function(e){var t;return e=_.extend({success:p.updates.updateThemeSuccess,error:p.updates.updateThemeError},e),(t="themes-network"===pagenow?o('[data-slug="'+e.slug+'"]').find(".update-message").removeClass("notice-error").addClass("updating-message notice-warning").find("p"):"customize"===pagenow?((t=o('[data-slug="'+e.slug+'"].notice').removeClass("notice-large")).find("h3").remove(),(t=t.add(o("#customize-control-installed_theme_"+e.slug).find(".update-message"))).addClass("updating-message").find("p")):((t=o("#update-theme").closest(".notice").removeClass("notice-large")).find("h3").remove(),(t=t.add(o('[data-slug="'+e.slug+'"]').find(".update-message"))).addClass("updating-message").find("p"))).html()!==p.updates.l10n.updating&&t.data("originaltext",t.html()),p.a11y.speak(p.updates.l10n.updatingMsg,"polite"),t.text(p.updates.l10n.updating),c.trigger("wp-theme-updating",e),p.updates.ajax("update-theme",e)},p.updates.updateThemeSuccess=function(e){var t,a,s=o("body.modal-open").length,n=o('[data-slug="'+e.slug+'"]'),l={className:"updated-message notice-success notice-alt",message:p.updates.l10n.themeUpdated};"customize"===pagenow?((n=o(".updating-message").siblings(".theme-name")).length&&(a=n.html().replace(e.oldVersion,e.newVersion),n.html(a)),t=o(".theme-info .notice").add(p.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)):(t=o(".theme-info .notice").add(n.find(".update-message")),s?o(".load-customize:visible").focus():n.find(".load-customize").focus()),p.updates.addAdminNotice(_.extend({selector:t},l)),p.a11y.speak(p.updates.l10n.updatedMsg,"polite"),p.updates.decrementCount("theme"),c.trigger("wp-theme-update-success",e),s&&"customize"!==pagenow&&o(".theme-info .theme-author").after(p.updates.adminNotice(l))},p.updates.updateThemeError=function(e){var t,a=o('[data-slug="'+e.slug+'"]'),s=p.updates.l10n.updateFailed.replace("%s",e.errorMessage);p.updates.isValidResponse(e,"update")&&(p.updates.maybeHandleCredentialError(e,"update-theme")||("customize"===pagenow&&(a=p.customize.control("installed_theme_"+e.slug).container.find(".theme")),"themes-network"===pagenow?t=a.find(".update-message "):(t=o(".theme-info .notice").add(a.find(".notice")),o("body.modal-open").length?o(".load-customize:visible").focus():a.find(".load-customize").focus()),p.updates.addAdminNotice({selector:t,className:"update-message notice-error notice-alt is-dismissible",message:s}),p.a11y.speak(s,"polite"),c.trigger("wp-theme-update-error",e)))},p.updates.installTheme=function(e){var t=o('.theme-install[data-slug="'+e.slug+'"]');return e=_.extend({success:p.updates.installThemeSuccess,error:p.updates.installThemeError},e),t.addClass("updating-message"),t.parents(".theme").addClass("focus"),t.html()!==p.updates.l10n.installing&&t.data("originaltext",t.html()),t.text(p.updates.l10n.installing).attr("aria-label",p.updates.l10n.themeInstallingLabel.replace("%s",t.data("name"))),p.a11y.speak(p.updates.l10n.installingMsg,"polite"),o('.install-theme-info, [data-slug="'+e.slug+'"]').removeClass("theme-install-failed").find(".notice.notice-error").remove(),c.trigger("wp-theme-installing",e),p.updates.ajax("install-theme",e)},p.updates.installThemeSuccess=function(e){var t,a=o(".wp-full-overlay-header, [data-slug="+e.slug+"]");c.trigger("wp-theme-install-success",e),t=a.find(".button-primary").removeClass("updating-message").addClass("updated-message disabled").attr("aria-label",p.updates.l10n.themeInstalledLabel.replace("%s",e.themeName)).text(p.updates.l10n.themeInstalled),p.a11y.speak(p.updates.l10n.installedMsg,"polite"),setTimeout(function(){e.activateUrl&&t.attr("href",e.activateUrl).removeClass("theme-install updated-message disabled").addClass("activate").attr("aria-label",p.updates.l10n.activateThemeLabel.replace("%s",e.themeName)).text(p.updates.l10n.activateTheme),e.customizeUrl&&t.siblings(".preview").replaceWith(function(){return o("<a>").attr("href",e.customizeUrl).addClass("button load-customize").text(p.updates.l10n.livePreview)})},1e3)},p.updates.installThemeError=function(e){var t,a=p.updates.l10n.installFailed.replace("%s",e.errorMessage),s=p.updates.adminNotice({className:"update-message notice-error notice-alt",message:a});p.updates.isValidResponse(e,"install")&&(p.updates.maybeHandleCredentialError(e,"install-theme")||("customize"===pagenow?(c.find("body").hasClass("modal-open")?(t=o('.theme-install[data-slug="'+e.slug+'"]'),o(".theme-overlay .theme-info").prepend(s)):(t=o('.theme-install[data-slug="'+e.slug+'"]')).closest(".theme").addClass("theme-install-failed").append(s),p.customize.notifications.remove("theme_installing")):c.find("body").hasClass("full-overlay-active")?(t=o('.theme-install[data-slug="'+e.slug+'"]'),o(".install-theme-info").prepend(s)):t=o('[data-slug="'+e.slug+'"]').removeClass("focus").addClass("theme-install-failed").append(s).find(".theme-install"),t.removeClass("updating-message").attr("aria-label",p.updates.l10n.themeInstallFailedLabel.replace("%s",t.data("name"))).text(p.updates.l10n.installFailedShort),p.a11y.speak(a,"assertive"),c.trigger("wp-theme-install-error",e)))},p.updates.deleteTheme=function(e){var t;return"themes"===pagenow?t=o(".theme-actions .delete-theme"):"themes-network"===pagenow&&(t=o('[data-slug="'+e.slug+'"]').find(".row-actions a.delete")),e=_.extend({success:p.updates.deleteThemeSuccess,error:p.updates.deleteThemeError},e),t&&t.html()!==p.updates.l10n.deleting&&t.data("originaltext",t.html()).text(p.updates.l10n.deleting),p.a11y.speak(p.updates.l10n.deleting,"polite"),o(".theme-info .update-message").remove(),c.trigger("wp-theme-deleting",e),p.updates.ajax("delete-theme",e)},p.updates.deleteThemeSuccess=function(n){var e=o('[data-slug="'+n.slug+'"]');"themes-network"===pagenow&&e.css({backgroundColor:"#faafaa"}).fadeOut(350,function(){var e=o(".subsubsub"),t=o(this),a=d.themes,s=p.template("item-deleted-row");t.hasClass("plugin-update-tr")||t.after(s({slug:n.slug,colspan:o("#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--,p.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+")")}),p.a11y.speak(p.updates.l10n.themeDeleted,"polite"),c.trigger("wp-theme-delete-success",n)},p.updates.deleteThemeError=function(e){var t=o('tr.inactive[data-slug="'+e.slug+'"]'),a=o(".theme-actions .delete-theme"),s=p.template("item-update-row"),n=t.siblings("#"+e.slug+"-update"),l=p.updates.l10n.deleteFailed.replace("%s",e.errorMessage),i=p.updates.adminNotice({className:"update-message notice-error notice-alt",message:l});p.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:o("#bulk-action-form").find("thead th:not(.hidden), thead td").length,content:i})):o(".theme-info .theme-description").before(i),a.html(a.data("originaltext")),p.a11y.speak(l,"assertive"),c.trigger("wp-theme-delete-error",e))},p.updates._addCallbacks=function(e,t){return"import"===pagenow&&"install-plugin"===t&&(e.success=p.updates.installImporterSuccess,e.error=p.updates.installImporterError),e},p.updates.queueChecker=function(){var e;if(!p.updates.ajaxLocked&&p.updates.queue.length)switch((e=p.updates.queue.shift()).action){case"install-plugin":p.updates.installPlugin(e.data);break;case"update-plugin":p.updates.updatePlugin(e.data);break;case"delete-plugin":p.updates.deletePlugin(e.data);break;case"install-theme":p.updates.installTheme(e.data);break;case"update-theme":p.updates.updateTheme(e.data);break;case"delete-theme":p.updates.deleteTheme(e.data)}},p.updates.requestFilesystemCredentials=function(e){!1===p.updates.filesystemCredentials.available&&(e&&!p.updates.$elToReturnFocusToFromCredentialsModal&&(p.updates.$elToReturnFocusToFromCredentialsModal=o(e.target)),p.updates.ajaxLocked=!0,p.updates.requestForCredentialsModalOpen())},p.updates.maybeRequestFilesystemCredentials=function(e){p.updates.shouldRequestFilesystemCredentials&&!p.updates.ajaxLocked&&p.updates.requestFilesystemCredentials(e)},p.updates.keydown=function(e){27===e.keyCode?p.updates.requestForCredentialsModalCancel():9===e.keyCode&&("upgrade"!==e.target.id||e.shiftKey?"hostname"===e.target.id&&e.shiftKey&&(o("#upgrade").focus(),e.preventDefault()):(o("#hostname").focus(),e.preventDefault()))},p.updates.requestForCredentialsModalOpen=function(){var e=o("#request-filesystem-credentials-dialog");o("body").addClass("modal-open"),e.show(),e.find("input:enabled:first").focus(),e.on("keydown",p.updates.keydown)},p.updates.requestForCredentialsModalClose=function(){o("#request-filesystem-credentials-dialog").hide(),o("body").removeClass("modal-open"),p.updates.$elToReturnFocusToFromCredentialsModal&&p.updates.$elToReturnFocusToFromCredentialsModal.focus()},p.updates.requestForCredentialsModalCancel=function(){(p.updates.ajaxLocked||p.updates.queue.length)&&(_.each(p.updates.queue,function(e){c.trigger("credential-modal-cancel",e)}),p.updates.ajaxLocked=!1,p.updates.queue=[],p.updates.requestForCredentialsModalClose())},p.updates.showErrorInCredentialsForm=function(e){var t=o("#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>")},p.updates.credentialError=function(e,t){e=p.updates._addCallbacks(e,t),p.updates.queue.unshift({action:t,data:e}),p.updates.filesystemCredentials.available=!1,p.updates.showErrorInCredentialsForm(e.errorMessage),p.updates.requestFilesystemCredentials()},p.updates.maybeHandleCredentialError=function(e,t){return!(!p.updates.shouldRequestFilesystemCredentials||!e.errorCode||"unable_to_connect_to_filesystem"!==e.errorCode)&&(p.updates.credentialError(e,t),!0)},p.updates.isValidResponse=function(e,t){var a,s=p.updates.l10n.unknownError;if(_.isObject(e)&&!_.isFunction(e.always))return!0;switch(_.isString(e)&&"-1"===e?s=p.updates.l10n.nonceError:_.isString(e)?s=e:void 0!==e.readyState&&0===e.readyState?s=p.updates.l10n.connectionError:_.isString(e.responseText)&&""!==e.responseText?s=e.responseText:_.isString(e.statusText)&&(s=e.statusText),t){case"update":a=p.updates.l10n.updateFailed;break;case"install":a=p.updates.l10n.installFailed;break;case"delete":a=p.updates.l10n.deleteFailed}return s=s.replace(/<[\/a-z][^<>]*>/gi,""),a=a.replace("%s",s),p.updates.addAdminNotice({id:"unknown_error",className:"notice-error is-dismissible",message:_.escape(a)}),p.updates.ajaxLocked=!1,p.updates.queue=[],o(".button.updating-message").removeClass("updating-message").removeAttr("aria-label").prop("disabled",!0).text(p.updates.l10n.updateFailedShort),o(".updating-message:not(.button):not(.thickbox)").removeClass("updating-message notice-warning").addClass("notice-error").find("p").removeAttr("aria-label").text(a),p.a11y.speak(a,"assertive"),!1},p.updates.beforeunload=function(){if(p.updates.ajaxLocked)return p.updates.l10n.beforeunload},o(function(){var l=o("#plugin-filter"),r=o("#bulk-action-form"),e=o("#request-filesystem-credentials-form"),t=o("#request-filesystem-credentials-dialog"),a=o(".plugins-php .wp-filter-search"),s=o(".plugin-install-php .wp-filter-search");(d=_.extend(d,window._wpUpdatesItemCounts||{})).totals&&p.updates.refreshCount(),p.updates.shouldRequestFilesystemCredentials=0<t.length,t.on("submit","form",function(e){e.preventDefault(),p.updates.filesystemCredentials.ftp.hostname=o("#hostname").val(),p.updates.filesystemCredentials.ftp.username=o("#username").val(),p.updates.filesystemCredentials.ftp.password=o("#password").val(),p.updates.filesystemCredentials.ftp.connectionType=o('input[name="connection_type"]:checked').val(),p.updates.filesystemCredentials.ssh.publicKey=o("#public_key").val(),p.updates.filesystemCredentials.ssh.privateKey=o("#private_key").val(),p.updates.filesystemCredentials.fsNonce=o("#_fs_nonce").val(),p.updates.filesystemCredentials.available=!0,p.updates.ajaxLocked=!1,p.updates.queueChecker(),p.updates.requestForCredentialsModalClose()}),t.on("click",'[data-js-action="close"], .notification-dialog-background',p.updates.requestForCredentialsModalCancel),e.on("change",'input[name="connection_type"]',function(){o("#ssh-keys").toggleClass("hidden","ssh"!==o(this).val())}).change(),c.on("credential-modal-cancel",function(e,t){var a,s,n=o(".updating-message");"import"===pagenow?n.removeClass("updating-message"):"plugins"===pagenow||"plugins-network"===pagenow?"update-plugin"===t.action?a=o('tr[data-plugin="'+t.data.plugin+'"]').find(".update-message"):"delete-plugin"===t.action&&(a=o('[data-plugin="'+t.data.plugin+'"]').find(".row-actions a.delete")):"themes"===pagenow||"themes-network"===pagenow?"update-theme"===t.action?a=o('[data-slug="'+t.data.slug+'"]').find(".update-message"):"delete-theme"===t.action&&"themes-network"===pagenow?a=o('[data-slug="'+t.data.slug+'"]').find(".row-actions a.delete"):"delete-theme"===t.action&&"themes"===pagenow&&(a=o(".theme-actions .delete-theme")):a=n,a&&a.hasClass("updating-message")&&(void 0===(s=a.data("originaltext"))&&(s=o("<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",p.updates.l10n.pluginUpdateNowLabel.replace("%s",a.data("name"))):"install-plugin"===t.action&&a.attr("aria-label",p.updates.l10n.pluginInstallNowLabel.replace("%s",a.data("name"))))),p.a11y.speak(p.updates.l10n.updateCancel,"polite")}),r.on("click","[data-plugin] .update-link",function(e){var t=o(e.target),a=t.parents("tr");e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(p.updates.maybeRequestFilesystemCredentials(e),p.updates.$elToReturnFocusToFromCredentialsModal=a.find(".check-column input"),p.updates.updatePlugin({plugin:a.data("plugin"),slug:a.data("slug")}))}),l.on("click",".update-now",function(e){var t=o(e.target);e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(p.updates.maybeRequestFilesystemCredentials(e),p.updates.updatePlugin({plugin:t.data("plugin"),slug:t.data("slug")}))}),l.on("click",".install-now",function(e){var t=o(e.target);e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(p.updates.shouldRequestFilesystemCredentials&&!p.updates.ajaxLocked&&(p.updates.requestFilesystemCredentials(e),c.on("credential-modal-cancel",function(){o(".install-now.updating-message").removeClass("updating-message").text(p.updates.l10n.installNow),p.a11y.speak(p.updates.l10n.updateCancel,"polite")})),p.updates.installPlugin({slug:t.data("slug")}))}),c.on("click",".importer-item .install-now",function(e){var t=o(e.target),a=o(this).data("name");e.preventDefault(),t.hasClass("updating-message")||(p.updates.shouldRequestFilesystemCredentials&&!p.updates.ajaxLocked&&(p.updates.requestFilesystemCredentials(e),c.on("credential-modal-cancel",function(){t.removeClass("updating-message").text(p.updates.l10n.installNow).attr("aria-label",p.updates.l10n.pluginInstallNowLabel.replace("%s",a)),p.a11y.speak(p.updates.l10n.updateCancel,"polite")})),p.updates.installPlugin({slug:t.data("slug"),pagenow:pagenow,success:p.updates.installImporterSuccess,error:p.updates.installImporterError}))}),r.on("click","[data-plugin] a.delete",function(e){var t=o(e.target).parents("tr");e.preventDefault(),window.confirm(p.updates.l10n.aysDeleteUninstall.replace("%s",t.find(".plugin-title strong").text()))&&(p.updates.maybeRequestFilesystemCredentials(e),p.updates.deletePlugin({plugin:t.data("plugin"),slug:t.data("slug")}))}),c.on("click",".themes-php.network-admin .update-link",function(e){var t=o(e.target),a=t.parents("tr");e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(p.updates.maybeRequestFilesystemCredentials(e),p.updates.$elToReturnFocusToFromCredentialsModal=a.find(".check-column input"),p.updates.updateTheme({slug:a.data("slug")}))}),c.on("click",".themes-php.network-admin a.delete",function(e){var t=o(e.target).parents("tr");e.preventDefault(),window.confirm(p.updates.l10n.aysDelete.replace("%s",t.find(".theme-title strong").text()))&&(p.updates.maybeRequestFilesystemCredentials(e),p.updates.deleteTheme({slug:t.data("slug")}))}),r.on("click",'[type="submit"]:not([name="clear-recent-list"])',function(e){var t,n,l=o(e.target).siblings("select").val(),a=r.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(),o("html, body").animate({scrollTop:0}),p.updates.addAdminNotice({id:"no-items-selected",className:"notice-error is-dismissible",message:p.updates.l10n.noItemsSelected});switch(l){case"update-selected":n=l.replace("selected",t);break;case"delete-selected":if(!window.confirm("plugin"===t?p.updates.l10n.aysBulkDelete:p.updates.l10n.aysBulkDeleteThemes))return void e.preventDefault();n=l.replace("selected",t);break;default:return}p.updates.maybeRequestFilesystemCredentials(e),e.preventDefault(),r.find('.manage-column [type="checkbox"]').prop("checked",!1),c.trigger("wp-"+t+"-bulk-"+l,a),a.each(function(e,t){var a=o(t),s=a.parents("tr");"update-selected"!==l||s.hasClass("update")&&!s.find("notice-error").length?p.updates.queue.push({action:n,data:{plugin:s.data("plugin"),slug:s.data("slug")}}):a.prop("checked",!1)}),c.on("wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error",function(e,t){var a,s,n=o('[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),p.updates.adminNotice=p.template("wp-bulk-updates-admin-notice"),p.updates.addAdminNotice({id:"bulk-action-notice",className:"bulk-action-notice",successes:i,errors:d,errorMessages:u,type:t.update}),a=o("#bulk-action-notice").on("click","button",function(){o(this).toggleClass("bulk-action-errors-collapsed").attr("aria-expanded",!o(this).hasClass("bulk-action-errors-collapsed")),a.find(".bulk-action-errors").toggleClass("hidden")}),0<d&&!p.updates.queue.length&&o("html, body").animate({scrollTop:0})}),c.on("wp-updates-notice-added",function(){p.updates.adminNotice=p.template("wp-updates-admin-notice")}),p.updates.queueChecker()}),s.length&&s.attr("aria-describedby","live-search-desc"),s.on("keyup input",_.debounce(function(e,t){var a,s,n=o(".plugin-install-search");a={_ajax_nonce:p.updates.ajaxNonce,s:e.target.value,tab:"search",type:o("#typeselector").val(),pagenow:pagenow},s=location.href.split("?")[0]+"?"+o.param(_.omit(a,["_ajax_nonce","pagenow"])),"keyup"===e.type&&27===e.which&&(e.target.value=""),p.updates.searchTerm===a.s&&"typechange"!==t||(l.empty(),p.updates.searchTerm=a.s,window.history&&window.history.replaceState&&window.history.replaceState(null,"",s),n.length||(n=o('<li class="plugin-install-search" />').append(o("<a />",{class:"current",href:s,text:p.updates.l10n.searchResultsLabel})),o(".wp-filter .filter-links .current").removeClass("current").parents(".filter-links").prepend(n),l.prev("p").remove(),o(".plugins-popular-tags-wrapper").remove()),void 0!==p.updates.searchRequest&&p.updates.searchRequest.abort(),o("body").addClass("loading-content"),p.updates.searchRequest=p.ajax.post("search-install-plugins",a).done(function(e){o("body").removeClass("loading-content"),l.append(e.items),delete p.updates.searchRequest,0===e.count?p.a11y.speak(p.updates.l10n.noPluginsFound):p.a11y.speak(p.updates.l10n.pluginsFound.replace("%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:p.updates.ajaxNonce,s:e.target.value,pagenow:pagenow,plugin_status:"all"};"keyup"===e.type&&27===e.which&&(e.target.value=""),p.updates.searchTerm!==s.s&&(p.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!==p.updates.searchRequest&&p.updates.searchRequest.abort(),r.empty(),o("body").addClass("loading-content"),o(".subsubsub .current").removeClass("current"),p.updates.searchRequest=p.ajax.post("search-plugins",s).done(function(e){var t=o("<span />").addClass("subtitle").html(p.updates.l10n.searchResults.replace("%s",_.escape(s.s))),a=o(".wrap .subtitle");s.s.length?a.length?a.replaceWith(t):o(".wp-header-end").before(t):(a.remove(),o(".subsubsub ."+s.plugin_status+" a").addClass("current")),o("body").removeClass("loading-content"),r.append(e.items),delete p.updates.searchRequest,0===e.count?p.a11y.speak(p.updates.l10n.noPluginsFound):p.a11y.speak(p.updates.l10n.pluginsFound.replace("%d",e.count))}))},500)),c.on("submit",".search-plugins",function(e){e.preventDefault(),o("input.wp-filter-search").trigger("input")}),c.on("click",".try-again",function(e){e.preventDefault(),s.trigger("input")}),o("#typeselector").on("change",function(){var e=o('input[name="s"]');e.val().length&&e.trigger("input","typechange")}),o("#plugin_update_from_iframe").on("click",function(e){var t,a=window.parent===window?null:window.parent;o.support.postMessage=!!window.postMessage,!1!==o.support.postMessage&&null!==a&&-1===window.parent.location.pathname.indexOf("update-core.php")&&(e.preventDefault(),t={action:"update-plugin",data:{plugin:o(this).data("plugin"),slug:o(this).data("slug")}},a.postMessage(JSON.stringify(t),window.location.origin))}),o("#plugin_install_from_iframe").on("click",function(e){var t,a=window.parent===window?null:window.parent;o.support.postMessage=!!window.postMessage,!1!==o.support.postMessage&&null!==a&&-1===window.parent.location.pathname.indexOf("index.php")&&(e.preventDefault(),t={action:"install-plugin",data:{slug:o(this).data("slug")}},a.postMessage(JSON.stringify(t),window.location.origin))}),o(window).on("message",function(e){var t,a=e.originalEvent,s=document.location.protocol+"//"+document.location.host;if(a.origin===s){try{t=o.parseJSON(a.data)}catch(e){return}if(t&&void 0!==t.action)switch(t.action){case"decrementUpdateCount":p.updates.decrementCount(t.upgradeType);break;case"install-plugin":case"update-plugin":window.tb_remove(),t.data=p.updates._addCallbacks(t.data,t.action),p.updates.queue.push(t),p.updates.queueChecker()}}}),o(window).on("beforeunload",p.updates.beforeunload)})}(jQuery,window.wp,window._wpUpdatesSettings); |