mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-12 05:34:07 +01:00
7c466f7c74
This updates the 5.3 branch to support the latest LTS version of NodeJS (currently 14.x), allowing the same version to be used across all WordPress branches that receive security updates as a courtesy. In addition to backporting the package updates that happened after branching 5.3, dependencies that were removed in future releases have also been updated to their latest versions. Props desrosj, dd32, netweb, jorbin. Merges [47404,47867,47872-47873,48213,48705,49636,49933,49937,49939,49940,49983,49989,50017,50126,50176,50185] to the 5.3 branch. See #52341. Built from https://develop.svn.wordpress.org/branches/5.3@50190 git-svn-id: http://core.svn.wordpress.org/branches/5.3@49868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
35 KiB
JavaScript
1 line
35 KiB
JavaScript
!function(r,o,d){var p=r(document);(o=o||{}).updates={},o.updates.ajaxNonce=d.ajax_nonce,o.updates.l10n=d.l10n,o.updates.searchTerm="",o.updates.shouldRequestFilesystemCredentials=!1,o.updates.filesystemCredentials={ftp:{host:"",username:"",password:"",connectionType:""},ssh:{publicKey:"",privateKey:""},fsNonce:"",available:!1},o.updates.ajaxLocked=!1,o.updates.adminNotice=o.template("wp-updates-admin-notice"),o.updates.queue=[],o.updates.$elToReturnFocusToFromCredentialsModal=void 0,o.updates.addAdminNotice=function(e){var t,a=r(e.selector),s=r(".wp-header-end");delete e.selector,t=o.updates.adminNotice(e),(a=!a.length?r("#"+e.id):a).length?a.replaceWith(t):s.length?s.after(t):"customize"===pagenow?r(".customize-themes-notifications").append(t):r(".wrap").find("> h1").after(t),p.trigger("wp-updates-notice-added")},o.updates.ajax=function(e,t){var a={};return o.updates.ajaxLocked?(o.updates.queue.push({action:e,data:t}),r.Deferred()):(o.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:o.updates.ajaxNonce,_fs_nonce:o.updates.filesystemCredentials.fsNonce,username:o.updates.filesystemCredentials.ftp.username,password:o.updates.filesystemCredentials.ftp.password,hostname:o.updates.filesystemCredentials.ftp.hostname,connection_type:o.updates.filesystemCredentials.ftp.connectionType,public_key:o.updates.filesystemCredentials.ssh.publicKey,private_key:o.updates.filesystemCredentials.ssh.privateKey}),o.ajax.send(a).always(o.updates.ajaxAlways))},o.updates.ajaxAlways=function(e){e.errorCode&&"unable_to_connect_to_filesystem"===e.errorCode||(o.updates.ajaxLocked=!1,o.updates.queueChecker()),void 0!==e.debug&&window.console&&window.console.log&&_.map(e.debug,function(e){window.console.log(o.sanitize.stripTagsAndEncodeText(e))})},o.updates.refreshCount=function(){var e,t=r("#wp-admin-bar-updates"),a=r('a[href="update-core.php"] .update-plugins'),s=r('a[href="plugins.php"] .update-plugins'),n=r('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?r(".subsubsub .upgrade .count").text("("+e+")"):(r(".subsubsub .upgrade").remove(),r(".subsubsub li:last").html(function(){return r(this).children()}))},o.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)),o.updates.refreshCount(e)},o.updates.updatePlugin=function(e){var t,a,s;return e=_.extend({success:o.updates.updatePluginSuccess,error:o.updates.updatePluginError},e),"plugins"===pagenow||"plugins-network"===pagenow?(a=(t=r('tr[data-plugin="'+e.plugin+'"]')).find(".update-message").removeClass("notice-error").addClass("updating-message notice-warning").find("p"),s=o.updates.l10n.pluginUpdatingLabel.replace("%s",t.find(".plugin-title strong").text())):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(a=(t=r(".plugin-card-"+e.slug)).find(".update-now").addClass("updating-message"),s=o.updates.l10n.pluginUpdatingLabel.replace("%s",a.data("name")),t.removeClass("plugin-card-update-failed").find(".notice.notice-error").remove()),a.html()!==o.updates.l10n.updating&&a.data("originaltext",a.html()),a.attr("aria-label",s).text(o.updates.l10n.updating),p.trigger("wp-plugin-updating",e),o.updates.ajax("update-plugin",e)},o.updates.updatePluginSuccess=function(e){var t,a,s;"plugins"===pagenow||"plugins-network"===pagenow?(a=(t=r('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=r(".plugin-card-"+e.slug).find(".update-now").removeClass("updating-message").addClass("button-disabled updated-message")),a.attr("aria-label",o.updates.l10n.pluginUpdatedLabel.replace("%s",e.pluginName)).text(o.updates.l10n.pluginUpdated),o.a11y.speak(o.updates.l10n.updatedMsg,"polite"),o.updates.decrementCount("plugin"),p.trigger("wp-plugin-update-success",e)},o.updates.updatePluginError=function(e){var t,a,s;o.updates.isValidResponse(e,"update")&&(o.updates.maybeHandleCredentialError(e,"update-plugin")||(s=o.updates.l10n.updateFailed.replace("%s",e.errorMessage),"plugins"===pagenow||"plugins-network"===pagenow?((a=(e.plugin?r('tr[data-plugin="'+e.plugin+'"]'):r('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",o.updates.l10n.pluginUpdateFailedLabel.replace("%s",e.pluginName)):a.find("p").removeAttr("aria-label")):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||((t=r(".plugin-card-"+e.slug).addClass("plugin-card-update-failed").append(o.updates.adminNotice({className:"update-message notice-error notice-alt is-dismissible",message:s}))).find(".update-now").text(o.updates.l10n.updateFailedShort).removeClass("updating-message"),e.pluginName?t.find(".update-now").attr("aria-label",o.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(o.updates.l10n.updateNow)},200)})),o.a11y.speak(s,"assertive"),p.trigger("wp-plugin-update-error",e)))},o.updates.installPlugin=function(e){var t=r(".plugin-card-"+e.slug),a=t.find(".install-now");return e=_.extend({success:o.updates.installPluginSuccess,error:o.updates.installPluginError},e),(a="import"===pagenow?r('[data-slug="'+e.slug+'"]'):a).html()!==o.updates.l10n.installing&&a.data("originaltext",a.html()),a.addClass("updating-message").attr("aria-label",o.updates.l10n.pluginInstallingLabel.replace("%s",a.data("name"))).text(o.updates.l10n.installing),o.a11y.speak(o.updates.l10n.installingMsg,"polite"),t.removeClass("plugin-card-install-failed").find(".notice.notice-error").remove(),p.trigger("wp-plugin-installing",e),o.updates.ajax("install-plugin",e)},o.updates.installPluginSuccess=function(e){var t=r(".plugin-card-"+e.slug).find(".install-now");t.removeClass("updating-message").addClass("updated-message installed button-disabled").attr("aria-label",o.updates.l10n.pluginInstalledLabel.replace("%s",e.pluginName)).text(o.updates.l10n.pluginInstalled),o.a11y.speak(o.updates.l10n.installedMsg,"polite"),p.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",o.updates.l10n.activatePluginLabel.replace("%s",e.pluginName)).text(o.updates.l10n.activatePlugin)},1e3)},o.updates.installPluginError=function(e){var t,a=r(".plugin-card-"+e.slug),s=a.find(".install-now");o.updates.isValidResponse(e,"install")&&(o.updates.maybeHandleCredentialError(e,"install-plugin")||(t=o.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",o.updates.l10n.pluginInstallFailedLabel.replace("%s",s.data("name"))).text(o.updates.l10n.installFailedShort),o.a11y.speak(t,"assertive"),p.trigger("wp-plugin-install-error",e)))},o.updates.installImporterSuccess=function(e){o.updates.addAdminNotice({id:"install-success",className:"notice-success is-dismissible",message:o.updates.l10n.importerInstalledMsg.replace("%s",e.activateUrl+"&from=import")}),r('[data-slug="'+e.slug+'"]').removeClass("install-now updating-message").addClass("activate-now").attr({href:e.activateUrl+"&from=import","aria-label":o.updates.l10n.activateImporterLabel.replace("%s",e.pluginName)}).text(o.updates.l10n.activateImporter),o.a11y.speak(o.updates.l10n.installedMsg,"polite"),p.trigger("wp-importer-install-success",e)},o.updates.installImporterError=function(e){var t=o.updates.l10n.installFailed.replace("%s",e.errorMessage),a=r('[data-slug="'+e.slug+'"]'),s=a.data("name");o.updates.isValidResponse(e,"install")&&(o.updates.maybeHandleCredentialError(e,"install-plugin")||(o.updates.addAdminNotice({id:e.errorCode,className:"notice-error is-dismissible",message:t}),a.removeClass("updating-message").text(o.updates.l10n.installNow).attr("aria-label",o.updates.l10n.pluginInstallNowLabel.replace("%s",s)),o.a11y.speak(t,"assertive"),p.trigger("wp-importer-install-error",e)))},o.updates.deletePlugin=function(e){var t=r('[data-plugin="'+e.plugin+'"]').find(".row-actions a.delete");return e=_.extend({success:o.updates.deletePluginSuccess,error:o.updates.deletePluginError},e),t.html()!==o.updates.l10n.deleting&&t.data("originaltext",t.html()).text(o.updates.l10n.deleting),o.a11y.speak(o.updates.l10n.deleting,"polite"),p.trigger("wp-plugin-deleting",e),o.updates.ajax("delete-plugin",e)},o.updates.deletePluginSuccess=function(i){r('[data-plugin="'+i.plugin+'"]').css({backgroundColor:"#faafaa"}).fadeOut(350,function(){var e=r("#bulk-action-form"),t=r(".subsubsub"),a=r(this),s=e.find("thead th:not(.hidden), thead td").length,n=o.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),o.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+'">'+o.updates.l10n.noPlugins+"</td></tr>"))}),o.a11y.speak(o.updates.l10n.pluginDeleted,"polite"),p.trigger("wp-plugin-delete-success",i)},o.updates.deletePluginError=function(e){var t,a=o.template("item-update-row"),s=o.updates.adminNotice({className:"update-message notice-error notice-alt",message:e.errorMessage}),n=e.plugin?(t=r('tr.inactive[data-plugin="'+e.plugin+'"]')).siblings('[data-plugin="'+e.plugin+'"]'):(t=r('tr.inactive[data-slug="'+e.slug+'"]')).siblings('[data-slug="'+e.slug+'"]');o.updates.isValidResponse(e,"delete")&&(o.updates.maybeHandleCredentialError(e,"delete-plugin")||(n.length?(n.find(".notice-error").remove(),n.find(".plugin-update").append(s)):t.addClass("update").after(a({slug:e.slug,plugin:e.plugin||e.slug,colspan:r("#bulk-action-form").find("thead th:not(.hidden), thead td").length,content:s})),p.trigger("wp-plugin-delete-error",e)))},o.updates.updateTheme=function(e){var t;return e=_.extend({success:o.updates.updateThemeSuccess,error:o.updates.updateThemeError},e),(t="themes-network"===pagenow?r('[data-slug="'+e.slug+'"]').find(".update-message").removeClass("notice-error").addClass("updating-message notice-warning").find("p"):"customize"===pagenow?((t=r('[data-slug="'+e.slug+'"].notice').removeClass("notice-large")).find("h3").remove(),(t=t.add(r("#customize-control-installed_theme_"+e.slug).find(".update-message"))).addClass("updating-message").find("p")):((t=r("#update-theme").closest(".notice").removeClass("notice-large")).find("h3").remove(),(t=t.add(r('[data-slug="'+e.slug+'"]').find(".update-message"))).addClass("updating-message").find("p"))).html()!==o.updates.l10n.updating&&t.data("originaltext",t.html()),o.a11y.speak(o.updates.l10n.updatingMsg,"polite"),t.text(o.updates.l10n.updating),p.trigger("wp-theme-updating",e),o.updates.ajax("update-theme",e)},o.updates.updateThemeSuccess=function(e){var t,a,s=r("body.modal-open").length,n=r('[data-slug="'+e.slug+'"]'),l={className:"updated-message notice-success notice-alt",message:o.updates.l10n.themeUpdated};"customize"===pagenow?((n=r(".updating-message").siblings(".theme-name")).length&&(a=n.html().replace(e.oldVersion,e.newVersion),n.html(a)),t=r(".theme-info .notice").add(o.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=r(".theme-info .notice").add(n.find(".update-message")),(s?r(".load-customize:visible"):n.find(".load-customize")).focus()),o.updates.addAdminNotice(_.extend({selector:t},l)),o.a11y.speak(o.updates.l10n.updatedMsg,"polite"),o.updates.decrementCount("theme"),p.trigger("wp-theme-update-success",e),s&&"customize"!==pagenow&&r(".theme-info .theme-author").after(o.updates.adminNotice(l))},o.updates.updateThemeError=function(e){var t,a=r('[data-slug="'+e.slug+'"]'),s=o.updates.l10n.updateFailed.replace("%s",e.errorMessage);o.updates.isValidResponse(e,"update")&&(o.updates.maybeHandleCredentialError(e,"update-theme")||("customize"===pagenow&&(a=o.customize.control("installed_theme_"+e.slug).container.find(".theme")),"themes-network"===pagenow?t=a.find(".update-message "):(t=r(".theme-info .notice").add(a.find(".notice")),(r("body.modal-open").length?r(".load-customize:visible"):a.find(".load-customize")).focus()),o.updates.addAdminNotice({selector:t,className:"update-message notice-error notice-alt is-dismissible",message:s}),o.a11y.speak(s,"polite"),p.trigger("wp-theme-update-error",e)))},o.updates.installTheme=function(e){var t=r('.theme-install[data-slug="'+e.slug+'"]');return e=_.extend({success:o.updates.installThemeSuccess,error:o.updates.installThemeError},e),t.addClass("updating-message"),t.parents(".theme").addClass("focus"),t.html()!==o.updates.l10n.installing&&t.data("originaltext",t.html()),t.text(o.updates.l10n.installing).attr("aria-label",o.updates.l10n.themeInstallingLabel.replace("%s",t.data("name"))),o.a11y.speak(o.updates.l10n.installingMsg,"polite"),r('.install-theme-info, [data-slug="'+e.slug+'"]').removeClass("theme-install-failed").find(".notice.notice-error").remove(),p.trigger("wp-theme-installing",e),o.updates.ajax("install-theme",e)},o.updates.installThemeSuccess=function(e){var t,a=r(".wp-full-overlay-header, [data-slug="+e.slug+"]");p.trigger("wp-theme-install-success",e),t=a.find(".button-primary").removeClass("updating-message").addClass("updated-message disabled").attr("aria-label",o.updates.l10n.themeInstalledLabel.replace("%s",e.themeName)).text(o.updates.l10n.themeInstalled),o.a11y.speak(o.updates.l10n.installedMsg,"polite"),setTimeout(function(){e.activateUrl&&t.attr("href",e.activateUrl).removeClass("theme-install updated-message disabled").addClass("activate").attr("aria-label",o.updates.l10n.activateThemeLabel.replace("%s",e.themeName)).text(o.updates.l10n.activateTheme),e.customizeUrl&&t.siblings(".preview").replaceWith(function(){return r("<a>").attr("href",e.customizeUrl).addClass("button load-customize").text(o.updates.l10n.livePreview)})},1e3)},o.updates.installThemeError=function(e){var t,a=o.updates.l10n.installFailed.replace("%s",e.errorMessage),s=o.updates.adminNotice({className:"update-message notice-error notice-alt",message:a});o.updates.isValidResponse(e,"install")&&(o.updates.maybeHandleCredentialError(e,"install-theme")||("customize"===pagenow?(p.find("body").hasClass("modal-open")?(t=r('.theme-install[data-slug="'+e.slug+'"]'),r(".theme-overlay .theme-info").prepend(s)):(t=r('.theme-install[data-slug="'+e.slug+'"]')).closest(".theme").addClass("theme-install-failed").append(s),o.customize.notifications.remove("theme_installing")):p.find("body").hasClass("full-overlay-active")?(t=r('.theme-install[data-slug="'+e.slug+'"]'),r(".install-theme-info").prepend(s)):t=r('[data-slug="'+e.slug+'"]').removeClass("focus").addClass("theme-install-failed").append(s).find(".theme-install"),t.removeClass("updating-message").attr("aria-label",o.updates.l10n.themeInstallFailedLabel.replace("%s",t.data("name"))).text(o.updates.l10n.installFailedShort),o.a11y.speak(a,"assertive"),p.trigger("wp-theme-install-error",e)))},o.updates.deleteTheme=function(e){var t;return"themes"===pagenow?t=r(".theme-actions .delete-theme"):"themes-network"===pagenow&&(t=r('[data-slug="'+e.slug+'"]').find(".row-actions a.delete")),e=_.extend({success:o.updates.deleteThemeSuccess,error:o.updates.deleteThemeError},e),t&&t.html()!==o.updates.l10n.deleting&&t.data("originaltext",t.html()).text(o.updates.l10n.deleting),o.a11y.speak(o.updates.l10n.deleting,"polite"),r(".theme-info .update-message").remove(),p.trigger("wp-theme-deleting",e),o.updates.ajax("delete-theme",e)},o.updates.deleteThemeSuccess=function(n){var e=r('[data-slug="'+n.slug+'"]');"themes-network"===pagenow&&e.css({backgroundColor:"#faafaa"}).fadeOut(350,function(){var e=r(".subsubsub"),t=r(this),a=d.themes,s=o.template("item-deleted-row");t.hasClass("plugin-update-tr")||t.after(s({slug:n.slug,colspan:r("#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--,o.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+")")}),o.a11y.speak(o.updates.l10n.themeDeleted,"polite"),p.trigger("wp-theme-delete-success",n)},o.updates.deleteThemeError=function(e){var t=r('tr.inactive[data-slug="'+e.slug+'"]'),a=r(".theme-actions .delete-theme"),s=o.template("item-update-row"),n=t.siblings("#"+e.slug+"-update"),l=o.updates.l10n.deleteFailed.replace("%s",e.errorMessage),i=o.updates.adminNotice({className:"update-message notice-error notice-alt",message:l});o.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:r("#bulk-action-form").find("thead th:not(.hidden), thead td").length,content:i})):r(".theme-info .theme-description").before(i),a.html(a.data("originaltext")),o.a11y.speak(l,"assertive"),p.trigger("wp-theme-delete-error",e))},o.updates._addCallbacks=function(e,t){return"import"===pagenow&&"install-plugin"===t&&(e.success=o.updates.installImporterSuccess,e.error=o.updates.installImporterError),e},o.updates.queueChecker=function(){var e;if(!o.updates.ajaxLocked&&o.updates.queue.length)switch((e=o.updates.queue.shift()).action){case"install-plugin":o.updates.installPlugin(e.data);break;case"update-plugin":o.updates.updatePlugin(e.data);break;case"delete-plugin":o.updates.deletePlugin(e.data);break;case"install-theme":o.updates.installTheme(e.data);break;case"update-theme":o.updates.updateTheme(e.data);break;case"delete-theme":o.updates.deleteTheme(e.data)}},o.updates.requestFilesystemCredentials=function(e){!1===o.updates.filesystemCredentials.available&&(e&&!o.updates.$elToReturnFocusToFromCredentialsModal&&(o.updates.$elToReturnFocusToFromCredentialsModal=r(e.target)),o.updates.ajaxLocked=!0,o.updates.requestForCredentialsModalOpen())},o.updates.maybeRequestFilesystemCredentials=function(e){o.updates.shouldRequestFilesystemCredentials&&!o.updates.ajaxLocked&&o.updates.requestFilesystemCredentials(e)},o.updates.keydown=function(e){27===e.keyCode?o.updates.requestForCredentialsModalCancel():9===e.keyCode&&("upgrade"!==e.target.id||e.shiftKey?"hostname"===e.target.id&&e.shiftKey&&(r("#upgrade").focus(),e.preventDefault()):(r("#hostname").focus(),e.preventDefault()))},o.updates.requestForCredentialsModalOpen=function(){var e=r("#request-filesystem-credentials-dialog");r("body").addClass("modal-open"),e.show(),e.find("input:enabled:first").focus(),e.on("keydown",o.updates.keydown)},o.updates.requestForCredentialsModalClose=function(){r("#request-filesystem-credentials-dialog").hide(),r("body").removeClass("modal-open"),o.updates.$elToReturnFocusToFromCredentialsModal&&o.updates.$elToReturnFocusToFromCredentialsModal.focus()},o.updates.requestForCredentialsModalCancel=function(){(o.updates.ajaxLocked||o.updates.queue.length)&&(_.each(o.updates.queue,function(e){p.trigger("credential-modal-cancel",e)}),o.updates.ajaxLocked=!1,o.updates.queue=[],o.updates.requestForCredentialsModalClose())},o.updates.showErrorInCredentialsForm=function(e){var t=r("#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>")},o.updates.credentialError=function(e,t){e=o.updates._addCallbacks(e,t),o.updates.queue.unshift({action:t,data:e}),o.updates.filesystemCredentials.available=!1,o.updates.showErrorInCredentialsForm(e.errorMessage),o.updates.requestFilesystemCredentials()},o.updates.maybeHandleCredentialError=function(e,t){return!(!o.updates.shouldRequestFilesystemCredentials||!e.errorCode||"unable_to_connect_to_filesystem"!==e.errorCode)&&(o.updates.credentialError(e,t),!0)},o.updates.isValidResponse=function(e,t){var a,s=o.updates.l10n.unknownError;if(_.isObject(e)&&!_.isFunction(e.always))return!0;switch(_.isString(e)&&"-1"===e?s=o.updates.l10n.nonceError:_.isString(e)?s=e:void 0!==e.readyState&&0===e.readyState?s=o.updates.l10n.connectionError:_.isString(e.responseText)&&""!==e.responseText?s=e.responseText:_.isString(e.statusText)&&(s=e.statusText),t){case"update":a=o.updates.l10n.updateFailed;break;case"install":a=o.updates.l10n.installFailed;break;case"delete":a=o.updates.l10n.deleteFailed}return s=s.replace(/<[\/a-z][^<>]*>/gi,""),a=a.replace("%s",s),o.updates.addAdminNotice({id:"unknown_error",className:"notice-error is-dismissible",message:_.escape(a)}),o.updates.ajaxLocked=!1,o.updates.queue=[],r(".button.updating-message").removeClass("updating-message").removeAttr("aria-label").prop("disabled",!0).text(o.updates.l10n.updateFailedShort),r(".updating-message:not(.button):not(.thickbox)").removeClass("updating-message notice-warning").addClass("notice-error").find("p").removeAttr("aria-label").text(a),o.a11y.speak(a,"assertive"),!1},o.updates.beforeunload=function(){if(o.updates.ajaxLocked)return o.updates.l10n.beforeunload},r(function(){var l=r("#plugin-filter"),u=r("#bulk-action-form"),e=r("#request-filesystem-credentials-form"),t=r("#request-filesystem-credentials-dialog"),a=r(".plugins-php .wp-filter-search"),s=r(".plugin-install-php .wp-filter-search");(d=_.extend(d,window._wpUpdatesItemCounts||{})).totals&&o.updates.refreshCount(),o.updates.shouldRequestFilesystemCredentials=0<t.length,t.on("submit","form",function(e){e.preventDefault(),o.updates.filesystemCredentials.ftp.hostname=r("#hostname").val(),o.updates.filesystemCredentials.ftp.username=r("#username").val(),o.updates.filesystemCredentials.ftp.password=r("#password").val(),o.updates.filesystemCredentials.ftp.connectionType=r('input[name="connection_type"]:checked').val(),o.updates.filesystemCredentials.ssh.publicKey=r("#public_key").val(),o.updates.filesystemCredentials.ssh.privateKey=r("#private_key").val(),o.updates.filesystemCredentials.fsNonce=r("#_fs_nonce").val(),o.updates.filesystemCredentials.available=!0,o.updates.ajaxLocked=!1,o.updates.queueChecker(),o.updates.requestForCredentialsModalClose()}),t.on("click",'[data-js-action="close"], .notification-dialog-background',o.updates.requestForCredentialsModalCancel),e.on("change",'input[name="connection_type"]',function(){r("#ssh-keys").toggleClass("hidden","ssh"!==r(this).val())}).change(),p.on("credential-modal-cancel",function(e,t){var a,s=r(".updating-message");"import"===pagenow?s.removeClass("updating-message"):"plugins"===pagenow||"plugins-network"===pagenow?"update-plugin"===t.action?a=r('tr[data-plugin="'+t.data.plugin+'"]').find(".update-message"):"delete-plugin"===t.action&&(a=r('[data-plugin="'+t.data.plugin+'"]').find(".row-actions a.delete")):"themes"===pagenow||"themes-network"===pagenow?"update-theme"===t.action?a=r('[data-slug="'+t.data.slug+'"]').find(".update-message"):"delete-theme"===t.action&&"themes-network"===pagenow?a=r('[data-slug="'+t.data.slug+'"]').find(".row-actions a.delete"):"delete-theme"===t.action&&"themes"===pagenow&&(a=r(".theme-actions .delete-theme")):a=s,a&&a.hasClass("updating-message")&&(void 0===(s=a.data("originaltext"))&&(s=r("<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",o.updates.l10n.pluginUpdateNowLabel.replace("%s",a.data("name"))):"install-plugin"===t.action&&a.attr("aria-label",o.updates.l10n.pluginInstallNowLabel.replace("%s",a.data("name"))))),o.a11y.speak(o.updates.l10n.updateCancel,"polite")}),u.on("click","[data-plugin] .update-link",function(e){var t=r(e.target),a=t.parents("tr");e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(o.updates.maybeRequestFilesystemCredentials(e),o.updates.$elToReturnFocusToFromCredentialsModal=a.find(".check-column input"),o.updates.updatePlugin({plugin:a.data("plugin"),slug:a.data("slug")}))}),l.on("click",".update-now",function(e){var t=r(e.target);e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(o.updates.maybeRequestFilesystemCredentials(e),o.updates.updatePlugin({plugin:t.data("plugin"),slug:t.data("slug")}))}),l.on("click",".install-now",function(e){var t=r(e.target);e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(o.updates.shouldRequestFilesystemCredentials&&!o.updates.ajaxLocked&&(o.updates.requestFilesystemCredentials(e),p.on("credential-modal-cancel",function(){r(".install-now.updating-message").removeClass("updating-message").text(o.updates.l10n.installNow),o.a11y.speak(o.updates.l10n.updateCancel,"polite")})),o.updates.installPlugin({slug:t.data("slug")}))}),p.on("click",".importer-item .install-now",function(e){var t=r(e.target),a=r(this).data("name");e.preventDefault(),t.hasClass("updating-message")||(o.updates.shouldRequestFilesystemCredentials&&!o.updates.ajaxLocked&&(o.updates.requestFilesystemCredentials(e),p.on("credential-modal-cancel",function(){t.removeClass("updating-message").text(o.updates.l10n.installNow).attr("aria-label",o.updates.l10n.pluginInstallNowLabel.replace("%s",a)),o.a11y.speak(o.updates.l10n.updateCancel,"polite")})),o.updates.installPlugin({slug:t.data("slug"),pagenow:pagenow,success:o.updates.installImporterSuccess,error:o.updates.installImporterError}))}),u.on("click","[data-plugin] a.delete",function(e){var t=r(e.target).parents("tr");e.preventDefault(),window.confirm(o.updates.l10n.aysDeleteUninstall.replace("%s",t.find(".plugin-title strong").text()))&&(o.updates.maybeRequestFilesystemCredentials(e),o.updates.deletePlugin({plugin:t.data("plugin"),slug:t.data("slug")}))}),p.on("click",".themes-php.network-admin .update-link",function(e){var t=r(e.target),a=t.parents("tr");e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(o.updates.maybeRequestFilesystemCredentials(e),o.updates.$elToReturnFocusToFromCredentialsModal=a.find(".check-column input"),o.updates.updateTheme({slug:a.data("slug")}))}),p.on("click",".themes-php.network-admin a.delete",function(e){var t=r(e.target).parents("tr");e.preventDefault(),window.confirm(o.updates.l10n.aysDelete.replace("%s",t.find(".theme-title strong").text()))&&(o.updates.maybeRequestFilesystemCredentials(e),o.updates.deleteTheme({slug:t.data("slug")}))}),u.on("click",'[type="submit"]:not([name="clear-recent-list"])',function(e){var t,s,n=r(e.target).siblings("select").val(),a=u.find('input[name="checked[]"]:checked'),l=0,i=0,d=[];switch(pagenow){case"plugins":case"plugins-network":t="plugin";break;case"themes-network":t="theme";break;default:return}if(!a.length)return e.preventDefault(),r("html, body").animate({scrollTop:0}),o.updates.addAdminNotice({id:"no-items-selected",className:"notice-error is-dismissible",message:o.updates.l10n.noItemsSelected});switch(n){case"update-selected":s=n.replace("selected",t);break;case"delete-selected":if(!window.confirm("plugin"===t?o.updates.l10n.aysBulkDelete:o.updates.l10n.aysBulkDeleteThemes))return void e.preventDefault();s=n.replace("selected",t);break;default:return}o.updates.maybeRequestFilesystemCredentials(e),e.preventDefault(),u.find('.manage-column [type="checkbox"]').prop("checked",!1),p.trigger("wp-"+t+"-bulk-"+n,a),a.each(function(e,t){var a=r(t),t=a.parents("tr");"update-selected"!==n||t.hasClass("update")&&!t.find("notice-error").length?o.updates.queue.push({action:s,data:{plugin:t.data("plugin"),slug:t.data("slug")}}):a.prop("checked",!1)}),p.on("wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error",function(e,t){var a,s=r('[data-slug="'+t.slug+'"]');"wp-"+t.update+"-update-success"===e.type?l++:(e=t.pluginName||s.find(".column-primary strong").text(),i++,d.push(e+": "+t.errorMessage)),s.find('input[name="checked[]"]:checked').prop("checked",!1),o.updates.adminNotice=o.template("wp-bulk-updates-admin-notice"),o.updates.addAdminNotice({id:"bulk-action-notice",className:"bulk-action-notice",successes:l,errors:i,errorMessages:d,type:t.update}),a=r("#bulk-action-notice").on("click","button",function(){r(this).toggleClass("bulk-action-errors-collapsed").attr("aria-expanded",!r(this).hasClass("bulk-action-errors-collapsed")),a.find(".bulk-action-errors").toggleClass("hidden")}),0<i&&!o.updates.queue.length&&r("html, body").animate({scrollTop:0})}),p.on("wp-updates-notice-added",function(){o.updates.adminNotice=o.template("wp-updates-admin-notice")}),o.updates.queueChecker()}),s.length&&s.attr("aria-describedby","live-search-desc"),s.on("keyup input",_.debounce(function(e,t){var a=r(".plugin-install-search"),s={_ajax_nonce:o.updates.ajaxNonce,s:e.target.value,tab:"search",type:r("#typeselector").val(),pagenow:pagenow},n=location.href.split("?")[0]+"?"+r.param(_.omit(s,["_ajax_nonce","pagenow"]));"keyup"===e.type&&27===e.which&&(e.target.value=""),o.updates.searchTerm===s.s&&"typechange"!==t||(l.empty(),o.updates.searchTerm=s.s,window.history&&window.history.replaceState&&window.history.replaceState(null,"",n),a.length||(a=r('<li class="plugin-install-search" />').append(r("<a />",{class:"current",href:n,text:o.updates.l10n.searchResultsLabel})),r(".wp-filter .filter-links .current").removeClass("current").parents(".filter-links").prepend(a),l.prev("p").remove(),r(".plugins-popular-tags-wrapper").remove()),void 0!==o.updates.searchRequest&&o.updates.searchRequest.abort(),r("body").addClass("loading-content"),o.updates.searchRequest=o.ajax.post("search-install-plugins",s).done(function(e){r("body").removeClass("loading-content"),l.append(e.items),delete o.updates.searchRequest,0===e.count?o.a11y.speak(o.updates.l10n.noPluginsFound):o.a11y.speak(o.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 s={_ajax_nonce:o.updates.ajaxNonce,s:e.target.value,pagenow:pagenow,plugin_status:"all"};"keyup"===e.type&&27===e.which&&(e.target.value=""),o.updates.searchTerm!==s.s&&(o.updates.searchTerm=s.s,e=_.object(_.compact(_.map(location.search.slice(1).split("&"),function(e){if(e)return e.split("=")}))),s.plugin_status=e.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!==o.updates.searchRequest&&o.updates.searchRequest.abort(),u.empty(),r("body").addClass("loading-content"),r(".subsubsub .current").removeClass("current"),o.updates.searchRequest=o.ajax.post("search-plugins",s).done(function(e){var t=r("<span />").addClass("subtitle").html(o.updates.l10n.searchResults.replace("%s",_.escape(s.s))),a=r(".wrap .subtitle");s.s.length?a.length?a.replaceWith(t):r(".wp-header-end").before(t):(a.remove(),r(".subsubsub ."+s.plugin_status+" a").addClass("current")),r("body").removeClass("loading-content"),u.append(e.items),delete o.updates.searchRequest,0===e.count?o.a11y.speak(o.updates.l10n.noPluginsFound):o.a11y.speak(o.updates.l10n.pluginsFound.replace("%d",e.count))}))},500)),p.on("submit",".search-plugins",function(e){e.preventDefault(),r("input.wp-filter-search").trigger("input")}),p.on("click",".try-again",function(e){e.preventDefault(),s.trigger("input")}),r("#typeselector").on("change",function(){var e=r('input[name="s"]');e.val().length&&e.trigger("input","typechange")}),r("#plugin_update_from_iframe").on("click",function(e){var t=window.parent===window?null:window.parent;r.support.postMessage=!!window.postMessage,!1!==r.support.postMessage&&null!==t&&-1===window.parent.location.pathname.indexOf("update-core.php")&&(e.preventDefault(),e={action:"update-plugin",data:{plugin:r(this).data("plugin"),slug:r(this).data("slug")}},t.postMessage(JSON.stringify(e),window.location.origin))}),r("#plugin_install_from_iframe").on("click",function(e){var t=window.parent===window?null:window.parent;r.support.postMessage=!!window.postMessage,!1!==r.support.postMessage&&null!==t&&-1===window.parent.location.pathname.indexOf("index.php")&&(e.preventDefault(),e={action:"install-plugin",data:{slug:r(this).data("slug")}},t.postMessage(JSON.stringify(e),window.location.origin))}),r(window).on("message",function(e){var t,a=e.originalEvent,e=document.location.protocol+"//"+document.location.host;if(a.origin===e){try{t=r.parseJSON(a.data)}catch(e){return}if(t&&void 0!==t.action)switch(t.action){case"decrementUpdateCount":o.updates.decrementCount(t.upgradeType);break;case"install-plugin":case"update-plugin":window.tb_remove(),t.data=o.updates._addCallbacks(t.data,t.action),o.updates.queue.push(t),o.updates.queueChecker()}}}),r(window).on("beforeunload",o.updates.beforeunload)})}(jQuery,window.wp,window._wpUpdatesSettings); |