diff --git a/wp-admin/js/application-passwords.js b/wp-admin/js/application-passwords.js index cab592519b..622597e5a8 100644 --- a/wp-admin/js/application-passwords.js +++ b/wp-admin/js/application-passwords.js @@ -25,7 +25,7 @@ var name = $newAppPassField.val(); if ( 0 === name.length ) { - $newAppPassField.focus(); + $newAppPassField.trigger( 'focus' ); return; } @@ -60,7 +60,7 @@ name: response.name, password: response.password } ) ); - $( '.new-application-password-notice' ).focus(); + $( '.new-application-password-notice' ).trigger( 'focus' ); $appPassTbody.prepend( tmplAppPassRow( response ) ); @@ -105,7 +105,7 @@ } $tr.remove(); - addNotice( wp.i18n.__( 'Application password revoked.' ), 'success' ).focus(); + addNotice( wp.i18n.__( 'Application password revoked.' ), 'success' ).trigger( 'focus' ); } } ).fail( handleErrorResponse ); } ); @@ -133,7 +133,7 @@ $appPassSection.children( '.new-application-password' ).remove(); $appPassTwrapper.hide(); - addNotice( wp.i18n.__( 'All application passwords revoked.' ), 'success' ).focus(); + addNotice( wp.i18n.__( 'All application passwords revoked.' ), 'success' ).trigger( 'focus' ); } } ).fail( handleErrorResponse ); } ); @@ -145,7 +145,7 @@ $el.fadeTo( 100, 0, function () { $el.slideUp( 100, function () { $el.remove(); - $newAppPassField.focus(); + $newAppPassField.trigger( 'focus' ); } ); } ); } ); diff --git a/wp-admin/js/application-passwords.min.js b/wp-admin/js/application-passwords.min.js index 5d9fa5010e..a4c3526757 100644 --- a/wp-admin/js/application-passwords.min.js +++ b/wp-admin/js/application-passwords.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -!function(o){var a=o("#application-passwords-section"),i=a.find(".create-application-password"),n=i.find(".input"),t=i.find(".button"),p=a.find(".application-passwords-list-table-wrapper"),r=a.find("tbody"),d=r.find(".no-items"),e=o("#revoke-all-application-passwords"),l=wp.template("new-application-password"),c=wp.template("application-password-row"),u=o("#user_id").val();function w(e,s,a){f(e.responseJSON&&e.responseJSON.message?e.responseJSON.message:a,"error")}function f(e,s){e=o("
").attr("role","alert").attr("tabindex","-1").addClass("is-dismissible notice notice-"+s).append(o("

").text(e)).append(o("").attr("type","button").addClass("notice-dismiss").append(o("").addClass("screen-reader-text").text(wp.i18n.__("Dismiss this notice."))));return i.after(e),e}function v(){o(".notice",a).remove()}t.on("click",function(e){var s;e.preventDefault(),t.prop("aria-disabled")||(0!==(e=n.val()).length?(v(),t.prop("aria-disabled",!0).addClass("disabled"),s={name:e},s=wp.hooks.applyFilters("wp_application_passwords_new_password_request",s,u),wp.apiRequest({path:"/wp/v2/users/"+u+"/application-passwords?_locale=user",method:"POST",data:s}).always(function(){t.removeProp("aria-disabled").removeClass("disabled")}).done(function(e){n.val(""),t.prop("disabled",!1),i.after(l({name:e.name,password:e.password})),o(".new-application-password-notice").focus(),r.prepend(c(e)),p.show(),d.remove(),wp.hooks.doAction("wp_application_passwords_created_password",e,s)}).fail(w)):n.focus())}),r.on("click",".delete",function(e){var s,a;e.preventDefault(),window.confirm(wp.i18n.__("Are you sure you want to revoke this password? This action cannot be undone."))&&(s=o(this),e=(a=s.closest("tr")).data("uuid"),v(),s.prop("disabled",!0),wp.apiRequest({path:"/wp/v2/users/"+u+"/application-passwords/"+e+"?_locale=user",method:"DELETE"}).always(function(){s.prop("disabled",!1)}).done(function(e){e.deleted&&(0===a.siblings().length&&p.hide(),a.remove(),f(wp.i18n.__("Application password revoked."),"success").focus())}).fail(w))}),e.on("click",function(e){var s;e.preventDefault(),window.confirm(wp.i18n.__("Are you sure you want to revoke all passwords? This action cannot be undone."))&&(s=o(this),v(),s.prop("disabled",!0),wp.apiRequest({path:"/wp/v2/users/"+u+"/application-passwords?_locale=user",method:"DELETE"}).always(function(){s.prop("disabled",!1)}).done(function(e){e.deleted&&(r.children().remove(),a.children(".new-application-password").remove(),p.hide(),f(wp.i18n.__("All application passwords revoked."),"success").focus())}).fail(w))}),a.on("click",".notice-dismiss",function(e){e.preventDefault();var s=o(this).parent();s.removeAttr("role"),s.fadeTo(100,0,function(){s.slideUp(100,function(){s.remove(),n.focus()})})}),0===r.children("tr").not(d).length&&p.hide()}(jQuery); \ No newline at end of file +!function(o){var a=o("#application-passwords-section"),i=a.find(".create-application-password"),t=i.find(".input"),n=i.find(".button"),p=a.find(".application-passwords-list-table-wrapper"),r=a.find("tbody"),d=r.find(".no-items"),e=o("#revoke-all-application-passwords"),l=wp.template("new-application-password"),c=wp.template("application-password-row"),u=o("#user_id").val();function w(e,s,a){f(e.responseJSON&&e.responseJSON.message?e.responseJSON.message:a,"error")}function f(e,s){e=o("
").attr("role","alert").attr("tabindex","-1").addClass("is-dismissible notice notice-"+s).append(o("

").text(e)).append(o("").attr("type","button").addClass("notice-dismiss").append(o("").addClass("screen-reader-text").text(wp.i18n.__("Dismiss this notice."))));return i.after(e),e}function v(){o(".notice",a).remove()}n.on("click",function(e){var s;e.preventDefault(),n.prop("aria-disabled")||(0!==(e=t.val()).length?(v(),n.prop("aria-disabled",!0).addClass("disabled"),s={name:e},s=wp.hooks.applyFilters("wp_application_passwords_new_password_request",s,u),wp.apiRequest({path:"/wp/v2/users/"+u+"/application-passwords?_locale=user",method:"POST",data:s}).always(function(){n.removeProp("aria-disabled").removeClass("disabled")}).done(function(e){t.val(""),n.prop("disabled",!1),i.after(l({name:e.name,password:e.password})),o(".new-application-password-notice").trigger("focus"),r.prepend(c(e)),p.show(),d.remove(),wp.hooks.doAction("wp_application_passwords_created_password",e,s)}).fail(w)):t.trigger("focus"))}),r.on("click",".delete",function(e){var s,a;e.preventDefault(),window.confirm(wp.i18n.__("Are you sure you want to revoke this password? This action cannot be undone."))&&(s=o(this),e=(a=s.closest("tr")).data("uuid"),v(),s.prop("disabled",!0),wp.apiRequest({path:"/wp/v2/users/"+u+"/application-passwords/"+e+"?_locale=user",method:"DELETE"}).always(function(){s.prop("disabled",!1)}).done(function(e){e.deleted&&(0===a.siblings().length&&p.hide(),a.remove(),f(wp.i18n.__("Application password revoked."),"success").trigger("focus"))}).fail(w))}),e.on("click",function(e){var s;e.preventDefault(),window.confirm(wp.i18n.__("Are you sure you want to revoke all passwords? This action cannot be undone."))&&(s=o(this),v(),s.prop("disabled",!0),wp.apiRequest({path:"/wp/v2/users/"+u+"/application-passwords?_locale=user",method:"DELETE"}).always(function(){s.prop("disabled",!1)}).done(function(e){e.deleted&&(r.children().remove(),a.children(".new-application-password").remove(),p.hide(),f(wp.i18n.__("All application passwords revoked."),"success").trigger("focus"))}).fail(w))}),a.on("click",".notice-dismiss",function(e){e.preventDefault();var s=o(this).parent();s.removeAttr("role"),s.fadeTo(100,0,function(){s.slideUp(100,function(){s.remove(),t.trigger("focus")})})}),0===r.children("tr").not(d).length&&p.hide()}(jQuery); \ No newline at end of file diff --git a/wp-admin/js/privacy-tools.js b/wp-admin/js/privacy-tools.js index 331cf29959..c4565550da 100644 --- a/wp-admin/js/privacy-tools.js +++ b/wp-admin/js/privacy-tools.js @@ -72,7 +72,7 @@ jQuery( document ).ready( function( $ ) { $rowActions.addClass( 'processing' ); - $action.blur(); + $action.trigger( 'blur' ); clearResultsAfterRow( $requestRow ); setExportProgress( 0 ); @@ -177,7 +177,7 @@ jQuery( document ).ready( function( $ ) { $rowActions.addClass( 'processing' ); - $action.blur(); + $action.trigger( 'blur' ); clearResultsAfterRow( $requestRow ); setErasureProgress( 0 ); diff --git a/wp-admin/js/privacy-tools.min.js b/wp-admin/js/privacy-tools.min.js index 9fd82bde9d..93fc5744f5 100644 --- a/wp-admin/js/privacy-tools.min.js +++ b/wp-admin/js/privacy-tools.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -jQuery(document).ready(function(h){var r,g=wp.i18n.__;function w(e,t){e.children().addClass("hidden"),e.children("."+t).removeClass("hidden")}function x(e){e.removeClass("has-request-results"),e.next().hasClass("request-results")&&e.next().remove()}function y(e,t,a,o){var s="",n="request-results";x(e),o.length&&(h.each(o,function(e,t){s=s+"
  • "+t+"
  • "}),s=""),e.addClass("has-request-results"),e.hasClass("status-request-confirmed")&&(n+=" status-request-confirmed"),e.hasClass("status-request-failed")&&(n+=" status-request-failed"),e.after(function(){return'

    '+a+"

    "+s+"
    "})}h(".export-personal-data-handle").on("click",function(e){var t=h(this),n=t.parents(".export-personal-data"),r=t.parents("tr"),a=r.find(".export-progress"),i=t.parents(".row-actions"),c=n.data("request-id"),d=n.data("nonce"),l=n.data("exporters-count"),u=!!n.data("send-as-email");function p(e){var t=g("An error occurred while attempting to export personal data.");w(n,"export-personal-data-failed"),e&&y(r,"notice-error",t,[e]),setTimeout(function(){i.removeClass("processing")},500)}function m(e){e=0"+t+""}),s=""),e.addClass("has-request-results"),e.hasClass("status-request-confirmed")&&(n+=" status-request-confirmed"),e.hasClass("status-request-failed")&&(n+=" status-request-failed"),e.after(function(){return'

    '+a+"

    "+s+"
    "})}g(".export-personal-data-handle").on("click",function(e){var t=g(this),n=t.parents(".export-personal-data"),r=t.parents("tr"),a=r.find(".export-progress"),i=t.parents(".row-actions"),c=n.data("request-id"),d=n.data("nonce"),l=n.data("exporters-count"),u=!!n.data("send-as-email");function p(e){var t=h("An error occurred while attempting to export personal data.");w(n,"export-personal-data-failed"),e&&y(r,"notice-error",t,[e]),setTimeout(function(){i.removeClass("processing")},500)}function m(e){e=0'+s+""):"recommended"===e.status?t=r(n("%s recommended improvement","%s recommended improvements",s),''+s+""):"good"===e.status&&(t=r(n("%s item with no issues detected","%s items with no issues detected",s),''+s+"")),t&&o(".site-health-issue-count-title",i).html(t),o(".issues","#health-check-issues-"+e.status).append(a(e)))}function u(){var e=o(".site-health-progress"),t=e.closest(".site-health-progress-wrapper"),s=o(".site-health-progress-label",t),a=o(".site-health-progress svg #bar"),i=parseInt(SiteHealth.site_status.issues.good,0)+parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),n=.5*parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),n=100-Math.ceil(n/i*100);0!==i?(t.removeClass("loading"),i=a.attr("r"),i=(100-(n=100<(n=n<0?0:n)?100:n))/100*(Math.PI*(2*i))+"px",a.css({strokeDashoffset:i}),parseInt(SiteHealth.site_status.issues.critical,0)<1&&o("#health-check-issues-critical").addClass("hidden"),parseInt(SiteHealth.site_status.issues.recommended,0)<1&&o("#health-check-issues-recommended").addClass("hidden"),80<=n&&0===parseInt(SiteHealth.site_status.issues.critical,0)?(t.addClass("green").removeClass("orange"),s.text(l("Good")),wp.a11y.speak(l("All site health tests have finished running. Your site is looking good, and the results are now available on the page."))):(t.addClass("orange").removeClass("green"),s.text(l("Should be improved")),wp.a11y.speak(l("All site health tests have finished running. There are items that should be addressed, and the results are now available on the page."))),c||(o.post(ajaxurl,{action:"health-check-site-status-result",_wpnonce:SiteHealth.nonce.site_status_result,counts:SiteHealth.site_status.issues}),100===n&&(o(".site-status-all-clear").removeClass("hide"),o(".site-status-has-issues").addClass("hide")))):e.addClass("hidden")}function p(e,t){t={status:"recommended",label:l("A test is unavailable"),badge:{color:"red",label:l("Unavailable")},description:"

    "+e+"

    "+t+"

    ",actions:""};d(wp.hooks.applyFilters("site_status_test_result",t))}i.on("success",function(e){var t=o(e.trigger),s=o(".success",t.closest("div"));e.clearSelection(),t.focus(),clearTimeout(a),s.removeClass("hidden"),a=setTimeout(function(){s.addClass("hidden"),i.clipboardAction.fakeElem&&i.clipboardAction.removeFake&&i.clipboardAction.removeFake()},3e3),wp.a11y.speak(l("Site information has been copied to your clipboard."))}),o(".health-check-accordion").on("click",".health-check-accordion-trigger",function(){"true"===o(this).attr("aria-expanded")?(o(this).attr("aria-expanded","false"),o("#"+o(this).attr("aria-controls")).attr("hidden",!0)):(o(this).attr("aria-expanded","true"),o("#"+o(this).attr("aria-controls")).attr("hidden",!1))}),o(".site-health-view-passed").on("click",function(){var e=o("#health-check-issues-good");e.toggleClass("hidden"),o(this).attr("aria-expanded",!e.hasClass("hidden"))}),"undefined"==typeof SiteHealth||c||(0===SiteHealth.site_status.direct.length&&0===SiteHealth.site_status.async.length?u():SiteHealth.site_status.issues={good:0,recommended:0,critical:0},0'+s+""):"recommended"===e.status?t=r(n("%s recommended improvement","%s recommended improvements",s),''+s+""):"good"===e.status&&(t=r(n("%s item with no issues detected","%s items with no issues detected",s),''+s+"")),t&&o(".site-health-issue-count-title",i).html(t),o(".issues","#health-check-issues-"+e.status).append(a(e)))}function u(){var e=o(".site-health-progress"),t=e.closest(".site-health-progress-wrapper"),s=o(".site-health-progress-label",t),a=o(".site-health-progress svg #bar"),i=parseInt(SiteHealth.site_status.issues.good,0)+parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),n=.5*parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),n=100-Math.ceil(n/i*100);0!==i?(t.removeClass("loading"),i=a.attr("r"),i=(100-(n=100<(n=n<0?0:n)?100:n))/100*(Math.PI*(2*i))+"px",a.css({strokeDashoffset:i}),parseInt(SiteHealth.site_status.issues.critical,0)<1&&o("#health-check-issues-critical").addClass("hidden"),parseInt(SiteHealth.site_status.issues.recommended,0)<1&&o("#health-check-issues-recommended").addClass("hidden"),80<=n&&0===parseInt(SiteHealth.site_status.issues.critical,0)?(t.addClass("green").removeClass("orange"),s.text(l("Good")),wp.a11y.speak(l("All site health tests have finished running. Your site is looking good, and the results are now available on the page."))):(t.addClass("orange").removeClass("green"),s.text(l("Should be improved")),wp.a11y.speak(l("All site health tests have finished running. There are items that should be addressed, and the results are now available on the page."))),c||(o.post(ajaxurl,{action:"health-check-site-status-result",_wpnonce:SiteHealth.nonce.site_status_result,counts:SiteHealth.site_status.issues}),100===n&&(o(".site-status-all-clear").removeClass("hide"),o(".site-status-has-issues").addClass("hide")))):e.addClass("hidden")}function p(e,t){t={status:"recommended",label:l("A test is unavailable"),badge:{color:"red",label:l("Unavailable")},description:"

    "+e+"

    "+t+"

    ",actions:""};d(wp.hooks.applyFilters("site_status_test_result",t))}i.on("success",function(e){var t=o(e.trigger),s=o(".success",t.closest("div"));e.clearSelection(),t.trigger("focus"),clearTimeout(a),s.removeClass("hidden"),a=setTimeout(function(){s.addClass("hidden"),i.clipboardAction.fakeElem&&i.clipboardAction.removeFake&&i.clipboardAction.removeFake()},3e3),wp.a11y.speak(l("Site information has been copied to your clipboard."))}),o(".health-check-accordion").on("click",".health-check-accordion-trigger",function(){"true"===o(this).attr("aria-expanded")?(o(this).attr("aria-expanded","false"),o("#"+o(this).attr("aria-controls")).attr("hidden",!0)):(o(this).attr("aria-expanded","true"),o("#"+o(this).attr("aria-controls")).attr("hidden",!1))}),o(".site-health-view-passed").on("click",function(){var e=o("#health-check-issues-good");e.toggleClass("hidden"),o(this).attr("aria-expanded",!e.hasClass("hidden"))}),"undefined"==typeof SiteHealth||c||(0===SiteHealth.site_status.direct.length&&0===SiteHealth.site_status.async.length?u():SiteHealth.site_status.issues={good:0,recommended:0,critical:0},0'+s+"")[0],priority:-40})),t.toolbar.set("reverse",{text:a.reverseOrder,priority:80,click:function(){e.reset(e.toArray().reverse())}}))}});t.exports=s},function(t,e){var s=wp.media.model.Selection,o=wp.media.controller.Library,i=o.extend({defaults:_.defaults({multiple:"add",filterable:"uploaded",priority:100,syncSelection:!1},o.prototype.defaults),initialize:function(){var t=this.get("collectionType");"video"===this.get("type")&&(t="video-"+t),this.set("id",t+"-library"),this.set("toolbar",t+"-add"),this.set("menu",t),this.get("library")||this.set("library",wp.media.query({type:this.get("type")})),o.prototype.initialize.apply(this,arguments)},activate:function(){var t=this.get("library"),e=this.get("editLibrary"),i=this.frame.state(this.get("collectionType")+"-edit").get("library");e&&e!==i&&t.unobserve(e),t.validator=function(t){return!!this.mirroring.get(t.cid)&&!i.get(t.cid)&&s.prototype.validator.apply(this,arguments)},t.reset(t.mirroring.models,{silent:!0}),t.observe(i),this.set("editLibrary",i),o.prototype.activate.apply(this,arguments)}});t.exports=i},function(t,e){var s=wp.media.model.Attachment,i=wp.media.controller.Library,o=wp.media.view.l10n,o=i.extend({defaults:_.defaults({id:"featured-image",title:o.setFeaturedImageTitle,multiple:!1,filterable:"uploaded",toolbar:"featured-image",priority:60,syncSelection:!0},i.prototype.defaults),initialize:function(){var t,o;this.get("library")||this.set("library",wp.media.query({type:"image"})),i.prototype.initialize.apply(this,arguments),t=this.get("library"),o=t.comparator,t.comparator=function(t,e){var i=!!this.mirroring.get(t.cid),s=!!this.mirroring.get(e.cid);return!i&&s?-1:i&&!s?1:o.apply(this,arguments)},t.observe(this.get("selection"))},activate:function(){this.updateSelection(),this.frame.on("open",this.updateSelection,this),i.prototype.activate.apply(this,arguments)},deactivate:function(){this.frame.off("open",this.updateSelection,this),i.prototype.deactivate.apply(this,arguments)},updateSelection:function(){var t,e=this.get("selection"),i=wp.media.view.settings.post.featuredImageId;""!==i&&-1!==i&&(t=s.get(i)).fetch(),e.reset(t?[t]:[])}});t.exports=o},function(t,e){var i=wp.media.controller.Library,s=wp.media.view.l10n,s=i.extend({defaults:_.defaults({id:"replace-image",title:s.replaceImageTitle,multiple:!1,filterable:"uploaded",toolbar:"replace",menu:!1,priority:60,syncSelection:!0},i.prototype.defaults),initialize:function(t){var e,o;this.image=t.image,this.get("library")||this.set("library",wp.media.query({type:"image"})),i.prototype.initialize.apply(this,arguments),e=this.get("library"),o=e.comparator,e.comparator=function(t,e){var i=!!this.mirroring.get(t.cid),s=!!this.mirroring.get(e.cid);return!i&&s?-1:i&&!s?1:o.apply(this,arguments)},e.observe(this.get("selection"))},activate:function(){this.updateSelection(),i.prototype.activate.apply(this,arguments)},updateSelection:function(){var t=this.get("selection"),e=this.image.attachment;t.reset(e?[e]:[])}});t.exports=s},function(t,e){var s=wp.media.view.l10n,i=wp.media.controller.State.extend({defaults:{id:"edit-image",title:s.editImage,menu:!1,toolbar:"edit-image",content:"edit-image",url:""},activate:function(){this.frame.on("toolbar:render:edit-image",_.bind(this.toolbar,this))},deactivate:function(){this.frame.off("toolbar:render:edit-image")},toolbar:function(){var t=this.frame,e=t.lastState(),i=e&&e.id;t.toolbar.set(new wp.media.view.Toolbar({controller:t,items:{back:{style:"primary",text:s.back,priority:20,click:function(){i?t.setState(i):t.close()}}}}))}});t.exports=i},function(t,e){var i=wp.media.controller.Library,s=i.extend({defaults:_.defaults({filterable:"uploaded",displaySettings:!1,priority:80,syncSelection:!1},i.prototype.defaults),initialize:function(t){this.media=t.media,this.type=t.type,this.set("library",wp.media.query({type:this.type})),i.prototype.initialize.apply(this,arguments)},activate:function(){wp.media.frame.lastMime&&(this.set("library",wp.media.query({type:wp.media.frame.lastMime})),delete wp.media.frame.lastMime),i.prototype.activate.apply(this,arguments)}});t.exports=s},function(t,e){var i=wp.media.view.l10n,a=Backbone.$,i=wp.media.controller.State.extend({defaults:{id:"embed",title:i.insertFromUrlTitle,content:"embed",menu:"default",toolbar:"main-embed",priority:120,type:"link",url:"",metadata:{}},sensitivity:400,initialize:function(t){this.metadata=t.metadata,this.debouncedScan=_.debounce(_.bind(this.scan,this),this.sensitivity),this.props=new Backbone.Model(this.metadata||{url:""}),this.props.on("change:url",this.debouncedScan,this),this.props.on("change:url",this.refresh,this),this.on("scan",this.scanImage,this)},scan:function(){var t,e=this,i={type:"link",scanners:[]};this.props.get("url")&&this.trigger("scan",i),i.scanners.length?(t=i.scanners=a.when.apply(a,i.scanners)).always(function(){e.get("scanners")===t&&e.set("loading",!1)}):i.scanners=null,i.loading=!!i.scanners,this.set(i)},scanImage:function(t){var e=this.frame,i=this,s=this.props.get("url"),o=new Image,n=a.Deferred();t.scanners.push(n.promise()),o.onload=function(){n.resolve(),i===e.state()&&s===i.props.get("url")&&(i.set({type:"image"}),i.props.set({width:o.width,height:o.height}))},o.onerror=n.reject,o.src=s},refresh:function(){this.frame.toolbar.get().refresh()},reset:function(){this.props.clear().set({url:""}),this.active&&this.refresh()}});t.exports=i},function(t,e){var i=wp.media.view.l10n,s=wp.media.controller.State.extend({defaults:{id:"cropper",title:i.cropImage,toolbar:"crop",content:"crop",router:!1,canSkipCrop:!1,doCropArgs:{}},activate:function(){this.frame.on("content:create:crop",this.createCropContent,this),this.frame.on("close",this.removeCropper,this),this.set("selection",new Backbone.Collection(this.frame._selection.single))},deactivate:function(){this.frame.toolbar.mode("browse")},createCropContent:function(){this.cropperView=new wp.media.view.Cropper({controller:this,attachment:this.get("selection").first()}),this.cropperView.on("image-loaded",this.createCropToolbar,this),this.frame.content.set(this.cropperView)},removeCropper:function(){this.imgSelect.cancelSelection(),this.imgSelect.setOptions({remove:!0}),this.imgSelect.update(),this.cropperView.remove()},createCropToolbar:function(){var t=this.get("canSkipCrop")||!1,e={controller:this.frame,items:{insert:{style:"primary",text:i.cropImage,priority:80,requires:{library:!1,selection:!1},click:function(){var e=this.controller,t=e.state().get("selection").first();t.set({cropDetails:e.state().imgSelect.getSelection()}),this.$el.text(i.cropping),this.$el.attr("disabled",!0),e.state().doCrop(t).done(function(t){e.trigger("cropped",t),e.close()}).fail(function(){e.trigger("content:error:crop")})}}}};t&&_.extend(e.items,{skip:{style:"secondary",text:i.skipCropping,priority:70,requires:{library:!1,selection:!1},click:function(){var t=this.controller.state().get("selection").first();this.controller.state().cropperView.remove(),this.controller.trigger("skippedcrop",t),this.controller.close()}}}),this.frame.toolbar.set(new wp.media.view.Toolbar(e))},doCrop:function(t){return wp.ajax.post("custom-header-crop",_.extend({},this.defaults.doCropArgs,{nonce:t.get("nonces").edit,id:t.get("id"),cropDetails:t.get("cropDetails")}))}});t.exports=s},function(t,e){var i=wp.media.controller.Cropper.extend({doCrop:function(t){var e=t.get("cropDetails"),i=this.get("control"),s=e.width/e.height;return i.params.flex_width&&i.params.flex_height?(e.dst_width=e.width,e.dst_height=e.height):(e.dst_width=i.params.flex_width?i.params.height*s:i.params.width,e.dst_height=i.params.flex_height?i.params.width/s:i.params.height),wp.ajax.post("crop-image",{wp_customize:"on",nonce:t.get("nonces").edit,id:t.get("id"),context:i.id,cropDetails:e})}});t.exports=i},function(t,e){var i=wp.media.controller.Cropper.extend({activate:function(){this.frame.on("content:create:crop",this.createCropContent,this),this.frame.on("close",this.removeCropper,this),this.set("selection",new Backbone.Collection(this.frame._selection.single))},createCropContent:function(){this.cropperView=new wp.media.view.SiteIconCropper({controller:this,attachment:this.get("selection").first()}),this.cropperView.on("image-loaded",this.createCropToolbar,this),this.frame.content.set(this.cropperView)},doCrop:function(t){var e=t.get("cropDetails"),i=this.get("control");return e.dst_width=i.params.width,e.dst_height=i.params.height,wp.ajax.post("crop-image",{nonce:t.get("nonces").edit,id:t.get("id"),context:"site-icon",cropDetails:e})}});t.exports=i},function(t,e){var i=wp.Backbone.View.extend({constructor:function(t){t&&t.controller&&(this.controller=t.controller),wp.Backbone.View.apply(this,arguments)},dispose:function(){return this.undelegateEvents(),this.model&&this.model.off&&this.model.off(null,null,this),this.collection&&this.collection.off&&this.collection.off(null,null,this),this.controller&&this.controller.off&&this.controller.off(null,null,this),this},remove:function(){return this.dispose(),wp.Backbone.View.prototype.remove.apply(this,arguments)}});t.exports=i},function(t,e){var i=wp.media.View.extend({initialize:function(){_.defaults(this.options,{mode:["select"]}),this._createRegions(),this._createStates(),this._createModes()},_createRegions:function(){this.regions=this.regions?this.regions.slice():[],_.each(this.regions,function(t){this[t]=new wp.media.controller.Region({view:this,id:t,selector:".media-frame-"+t})},this)},_createStates:function(){this.states=new Backbone.Collection(null,{model:wp.media.controller.State}),this.states.on("add",function(t){t.frame=this,t.trigger("ready")},this),this.options.states&&this.states.add(this.options.states)},_createModes:function(){this.activeModes=new Backbone.Collection,this.activeModes.on("add remove reset",_.bind(this.triggerModeEvents,this)),_.each(this.options.mode,function(t){this.activateMode(t)},this)},reset:function(){return this.states.invoke("trigger","reset"),this},triggerModeEvents:function(t,e,i){var s,o={add:"activate",remove:"deactivate"};_.each(i,function(t,e){t&&(s=e)}),_.has(o,s)&&(o=t.get("id")+":"+o[s],this.trigger(o))},activateMode:function(t){if(!this.isModeActive(t))return this.activeModes.add([{id:t}]),this.$el.addClass("mode-"+t),this},deactivateMode:function(t){return this.isModeActive(t)&&(this.activeModes.remove(this.activeModes.where({id:t})),this.$el.removeClass("mode-"+t),this.trigger(t+":deactivate")),this},isModeActive:function(t){return Boolean(this.activeModes.where({id:t}).length)}});_.extend(i.prototype,wp.media.controller.StateMachine.prototype),t.exports=i},function(t,e){var i=wp.media.view.Frame,s=wp.media.view.l10n,o=jQuery,n=i.extend({className:"media-frame",template:wp.template("media-frame"),regions:["menu","title","content","toolbar","router"],events:{"click .media-frame-menu-toggle":"toggleMenu"},initialize:function(){i.prototype.initialize.apply(this,arguments),_.defaults(this.options,{title:s.mediaFrameDefaultTitle,modal:!0,uploader:!0}),this.$el.addClass("wp-core-ui"),this.options.modal&&(this.modal=new wp.media.view.Modal({controller:this,title:this.options.title}),this.modal.content(this)),!wp.Uploader.limitExceeded&&wp.Uploader.browser.supported||(this.options.uploader=!1),this.options.uploader&&(this.uploader=new wp.media.view.UploaderWindow({controller:this,uploader:{dropzone:(this.modal||this).$el,container:this.$el}}),this.views.set(".media-frame-uploader",this.uploader)),this.on("attach",_.bind(this.views.ready,this.views),this),this.on("title:create:default",this.createTitle,this),this.title.mode("default"),this.on("menu:create:default",this.createMenu,this),this.on("open",this.setMenuTabPanelAriaAttributes,this),this.on("open",this.setRouterTabPanelAriaAttributes,this),this.on("content:render",this.setMenuTabPanelAriaAttributes,this),this.on("content:render",this.setRouterTabPanelAriaAttributes,this)},setMenuTabPanelAriaAttributes:function(){var t=this.state().get("id"),e=this.$el.find(".media-frame-tab-panel");e.removeAttr("role aria-labelledby tabindex"),this.state().get("menu")&&this.menuView&&this.menuView.isVisible&&(t="menu-item-"+t,e.attr({role:"tabpanel","aria-labelledby":t,tabIndex:"0"}))},setRouterTabPanelAriaAttributes:function(){var t,e=this.$el.find(".media-frame-content");e.removeAttr("role aria-labelledby tabindex"),this.state().get("router")&&this.routerView&&this.routerView.isVisible&&this.content._mode&&(t="menu-item-"+this.content._mode,e.attr({role:"tabpanel","aria-labelledby":t,tabIndex:"0"}))},render:function(){return!this.state()&&this.options.state&&this.setState(this.options.state),i.prototype.render.apply(this,arguments)},createTitle:function(t){t.view=new wp.media.View({controller:this,tagName:"h1"})},createMenu:function(t){t.view=new wp.media.view.Menu({controller:this,attributes:{role:"tablist","aria-orientation":"vertical"}}),this.menuView=t.view},toggleMenu:function(t){var e=this.$el.find(".media-menu");e.toggleClass("visible"),o(t.target).attr("aria-expanded",e.hasClass("visible"))},createToolbar:function(t){t.view=new wp.media.view.Toolbar({controller:this})},createRouter:function(t){t.view=new wp.media.view.Router({controller:this,attributes:{role:"tablist","aria-orientation":"horizontal"}}),this.routerView=t.view},createIframeStates:function(i){var t=wp.media.view.settings,e=t.tabs,s=t.tabUrl;e&&s&&((t=o("#post_ID")).length&&(s+="&post_id="+t.val()),_.each(e,function(t,e){this.state("iframe:"+e).set(_.defaults({tab:e,src:s+"&tab="+e,title:t,content:"iframe",menu:"default"},i))},this),this.on("content:create:iframe",this.iframeContent,this),this.on("content:deactivate:iframe",this.iframeContentCleanup,this),this.on("menu:render:default",this.iframeMenu,this),this.on("open",this.hijackThickbox,this),this.on("close",this.restoreThickbox,this))},iframeContent:function(t){this.$el.addClass("hide-toolbar"),t.view=new wp.media.view.Iframe({controller:this})},iframeContentCleanup:function(){this.$el.removeClass("hide-toolbar")},iframeMenu:function(t){var i={};t&&(_.each(wp.media.view.settings.tabs,function(t,e){i["iframe:"+e]={text:this.state("iframe:"+e).get("title"),priority:200}},this),t.set(i))},hijackThickbox:function(){var t=this;window.tb_remove&&!this._tb_remove&&(this._tb_remove=window.tb_remove,window.tb_remove=function(){t.close(),t.reset(),t.setState(t.options.state),t._tb_remove.call(window)})},restoreThickbox:function(){this._tb_remove&&(window.tb_remove=this._tb_remove,delete this._tb_remove)}});_.each(["open","close","attach","detach","escape"],function(t){n.prototype[t]=function(){return this.modal&&this.modal[t].apply(this.modal,arguments),this}}),t.exports=n},function(t,e){var i=wp.media.view.MediaFrame,s=wp.media.view.l10n,o=i.extend({initialize:function(){i.prototype.initialize.apply(this,arguments),_.defaults(this.options,{selection:[],library:{},multiple:!1,state:"library"}),this.createSelection(),this.createStates(),this.bindHandlers()},createSelection:function(){var t=this.options.selection;t instanceof wp.media.model.Selection||(this.options.selection=new wp.media.model.Selection(t,{multiple:this.options.multiple})),this._selection={attachments:new wp.media.model.Attachments,difference:[]}},editImageContent:function(){var t=this.state().get("image"),t=new wp.media.view.EditImage({model:t,controller:this}).render();this.content.set(t),t.loadEditor()},createStates:function(){var t=this.options;this.options.states||this.states.add([new wp.media.controller.Library({library:wp.media.query(t.library),multiple:t.multiple,title:t.title,priority:20}),new wp.media.controller.EditImage({model:t.editImage})])},bindHandlers:function(){this.on("router:create:browse",this.createRouter,this),this.on("router:render:browse",this.browseRouter,this),this.on("content:create:browse",this.browseContent,this),this.on("content:render:upload",this.uploadContent,this),this.on("toolbar:create:select",this.createSelectToolbar,this),this.on("content:render:edit-image",this.editImageContent,this)},browseRouter:function(t){t.set({upload:{text:s.uploadFilesTitle,priority:20},browse:{text:s.mediaLibraryTitle,priority:40}})},browseContent:function(t){var e=this.state();this.$el.removeClass("hide-toolbar"),t.view=new wp.media.view.AttachmentsBrowser({controller:this,collection:e.get("library"),selection:e.get("selection"),model:e,sortable:e.get("sortable"),search:e.get("searchable"),filters:e.get("filterable"),date:e.get("date"),display:e.has("display")?e.get("display"):e.get("displaySettings"),dragInfo:e.get("dragInfo"),idealColumnWidth:e.get("idealColumnWidth"),suggestedWidth:e.get("suggestedWidth"),suggestedHeight:e.get("suggestedHeight"),AttachmentView:e.get("AttachmentView")})},uploadContent:function(){this.$el.removeClass("hide-toolbar"),this.content.set(new wp.media.view.UploaderInline({controller:this}))},createSelectToolbar:function(t,e){(e=e||this.options.button||{}).controller=this,t.view=new wp.media.view.Toolbar.Select(e)}});t.exports=o},function(t,e){var i=wp.media.view.MediaFrame.Select,s=wp.media.controller.Library,o=wp.media.view.l10n,n=i.extend({initialize:function(){this.counts={audio:{count:wp.media.view.settings.attachmentCounts.audio,state:"playlist"},video:{count:wp.media.view.settings.attachmentCounts.video,state:"video-playlist"}},_.defaults(this.options,{multiple:!0,editing:!1,state:"insert",metadata:{}}),i.prototype.initialize.apply(this,arguments),this.createIframeStates()},createStates:function(){var t=this.options;this.states.add([new s({id:"insert",title:o.insertMediaTitle,priority:20,toolbar:"main-insert",filterable:"all",library:wp.media.query(t.library),multiple:!!t.multiple&&"reset",editable:!0,allowLocalEdits:!0,displaySettings:!0,displayUserSettings:!0}),new s({id:"gallery",title:o.createGalleryTitle,priority:40,toolbar:"main-gallery",filterable:"uploaded",multiple:"add",editable:!1,library:wp.media.query(_.defaults({type:"image"},t.library))}),new wp.media.controller.Embed({metadata:t.metadata}),new wp.media.controller.EditImage({model:t.editImage}),new wp.media.controller.GalleryEdit({library:t.selection,editing:t.editing,menu:"gallery"}),new wp.media.controller.GalleryAdd,new s({id:"playlist",title:o.createPlaylistTitle,priority:60,toolbar:"main-playlist",filterable:"uploaded",multiple:"add",editable:!1,library:wp.media.query(_.defaults({type:"audio"},t.library))}),new wp.media.controller.CollectionEdit({type:"audio",collectionType:"playlist",title:o.editPlaylistTitle,SettingsView:wp.media.view.Settings.Playlist,library:t.selection,editing:t.editing,menu:"playlist",dragInfoText:o.playlistDragInfo,dragInfo:!1}),new wp.media.controller.CollectionAdd({type:"audio",collectionType:"playlist",title:o.addToPlaylistTitle}),new s({id:"video-playlist",title:o.createVideoPlaylistTitle,priority:60,toolbar:"main-video-playlist",filterable:"uploaded",multiple:"add",editable:!1,library:wp.media.query(_.defaults({type:"video"},t.library))}),new wp.media.controller.CollectionEdit({type:"video",collectionType:"playlist",title:o.editVideoPlaylistTitle,SettingsView:wp.media.view.Settings.Playlist,library:t.selection,editing:t.editing,menu:"video-playlist",dragInfoText:o.videoPlaylistDragInfo,dragInfo:!1}),new wp.media.controller.CollectionAdd({type:"video",collectionType:"playlist",title:o.addToVideoPlaylistTitle})]),wp.media.view.settings.post.featuredImageId&&this.states.add(new wp.media.controller.FeaturedImage)},bindHandlers:function(){var t;i.prototype.bindHandlers.apply(this,arguments),this.on("activate",this.activate,this),void 0!==_.find(this.counts,function(t){return 0===t.count})&&this.listenTo(wp.media.model.Attachments.all,"change:type",this.mediaTypeCounts),this.on("menu:create:gallery",this.createMenu,this),this.on("menu:create:playlist",this.createMenu,this),this.on("menu:create:video-playlist",this.createMenu,this),this.on("toolbar:create:main-insert",this.createToolbar,this),this.on("toolbar:create:main-gallery",this.createToolbar,this),this.on("toolbar:create:main-playlist",this.createToolbar,this),this.on("toolbar:create:main-video-playlist",this.createToolbar,this),this.on("toolbar:create:featured-image",this.featuredImageToolbar,this),this.on("toolbar:create:main-embed",this.mainEmbedToolbar,this),t={menu:{default:"mainMenu",gallery:"galleryMenu",playlist:"playlistMenu","video-playlist":"videoPlaylistMenu"},content:{embed:"embedContent","edit-image":"editImageContent","edit-selection":"editSelectionContent"},toolbar:{"main-insert":"mainInsertToolbar","main-gallery":"mainGalleryToolbar","gallery-edit":"galleryEditToolbar","gallery-add":"galleryAddToolbar","main-playlist":"mainPlaylistToolbar","playlist-edit":"playlistEditToolbar","playlist-add":"playlistAddToolbar","main-video-playlist":"mainVideoPlaylistToolbar","video-playlist-edit":"videoPlaylistEditToolbar","video-playlist-add":"videoPlaylistAddToolbar"}},_.each(t,function(t,i){_.each(t,function(t,e){this.on(i+":render:"+e,this[t],this)},this)},this)},activate:function(){_.each(this.counts,function(t){t.count<1&&this.menuItemVisibility(t.state,"hide")},this)},mediaTypeCounts:function(t,e){void 0!==this.counts[e]&&this.counts[e].count<1&&(this.counts[e].count++,this.menuItemVisibility(this.counts[e].state,"show"))},mainMenu:function(t){t.set({"library-separator":new wp.media.View({className:"separator",priority:100,attributes:{role:"presentation"}})})},menuItemVisibility:function(t,e){var i=this.menu.get();"hide"===e?i.hide(t):"show"===e&&i.show(t)},galleryMenu:function(t){var e=this.lastState(),i=e&&e.id,s=this;t.set({cancel:{text:o.cancelGalleryTitle,priority:20,click:function(){i?s.setState(i):s.close(),this.controller.modal.focusManager.focus()}},separateCancel:new wp.media.View({className:"separator",priority:40})})},playlistMenu:function(t){var e=this.lastState(),i=e&&e.id,s=this;t.set({cancel:{text:o.cancelPlaylistTitle,priority:20,click:function(){i?s.setState(i):s.close(),this.controller.modal.focusManager.focus()}},separateCancel:new wp.media.View({className:"separator",priority:40})})},videoPlaylistMenu:function(t){var e=this.lastState(),i=e&&e.id,s=this;t.set({cancel:{text:o.cancelVideoPlaylistTitle,priority:20,click:function(){i?s.setState(i):s.close(),this.controller.modal.focusManager.focus()}},separateCancel:new wp.media.View({className:"separator",priority:40})})},embedContent:function(){var t=new wp.media.view.Embed({controller:this,model:this.state()}).render();this.content.set(t)},editSelectionContent:function(){var t=this.state(),e=t.get("selection"),t=new wp.media.view.AttachmentsBrowser({controller:this,collection:e,selection:e,model:t,sortable:!0,search:!1,date:!1,dragInfo:!0,AttachmentView:wp.media.view.Attachments.EditSelection}).render();t.toolbar.set("backToLibrary",{text:o.returnToLibrary,priority:-100,click:function(){this.controller.content.mode("browse"),this.controller.modal.focusManager.focus()}}),this.content.set(t),this.trigger("edit:selection",this)},editImageContent:function(){var t=this.state().get("image"),t=new wp.media.view.EditImage({model:t,controller:this}).render();this.content.set(t),t.loadEditor()},selectionStatusToolbar:function(t){var e=this.state().get("editable");t.set("selection",new wp.media.view.Selection({controller:this,collection:this.state().get("selection"),priority:-40,editable:e&&function(){this.controller.content.mode("edit-selection")}}).render())},mainInsertToolbar:function(t){var i=this;this.selectionStatusToolbar(t),t.set("insert",{style:"primary",priority:80,text:o.insertIntoPost,requires:{selection:!0},click:function(){var t=i.state(),e=t.get("selection");i.close(),t.trigger("insert",e).reset()}})},mainGalleryToolbar:function(t){var s=this;this.selectionStatusToolbar(t),t.set("gallery",{style:"primary",text:o.createNewGallery,priority:60,requires:{selection:!0},click:function(){var t=s.state().get("selection"),e=s.state("gallery-edit"),i=t.where({type:"image"});e.set("library",new wp.media.model.Selection(i,{props:t.props.toJSON(),multiple:!0})),this.controller.setState("gallery-edit"),this.controller.modal.focusManager.focus()}})},mainPlaylistToolbar:function(t){var s=this;this.selectionStatusToolbar(t),t.set("playlist",{style:"primary",text:o.createNewPlaylist,priority:100,requires:{selection:!0},click:function(){var t=s.state().get("selection"),e=s.state("playlist-edit"),i=t.where({type:"audio"});e.set("library",new wp.media.model.Selection(i,{props:t.props.toJSON(),multiple:!0})),this.controller.setState("playlist-edit"),this.controller.modal.focusManager.focus()}})},mainVideoPlaylistToolbar:function(t){var s=this;this.selectionStatusToolbar(t),t.set("video-playlist",{style:"primary",text:o.createNewVideoPlaylist,priority:100,requires:{selection:!0},click:function(){var t=s.state().get("selection"),e=s.state("video-playlist-edit"),i=t.where({type:"video"});e.set("library",new wp.media.model.Selection(i,{props:t.props.toJSON(),multiple:!0})),this.controller.setState("video-playlist-edit"),this.controller.modal.focusManager.focus()}})},featuredImageToolbar:function(t){this.createSelectToolbar(t,{text:o.setFeaturedImage,state:this.options.state})},mainEmbedToolbar:function(t){t.view=new wp.media.view.Toolbar.Embed({controller:this})},galleryEditToolbar:function(){var t=this.state().get("editing");this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:t?o.updateGallery:o.insertGallery,priority:80,requires:{library:!0},click:function(){var t=this.controller,e=t.state();t.close(),e.trigger("update",e.get("library")),t.setState(t.options.state),t.reset()}}}}))},galleryAddToolbar:function(){this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:o.addToGallery,priority:80,requires:{selection:!0},click:function(){var t=this.controller,e=t.state();t.state("gallery-edit").get("library").add(e.get("selection").models),e.trigger("reset"),t.setState("gallery-edit"),this.controller.modal.focusManager.focus()}}}}))},playlistEditToolbar:function(){var t=this.state().get("editing");this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:t?o.updatePlaylist:o.insertPlaylist,priority:80,requires:{library:!0},click:function(){var t=this.controller,e=t.state();t.close(),e.trigger("update",e.get("library")),t.setState(t.options.state),t.reset()}}}}))},playlistAddToolbar:function(){this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:o.addToPlaylist,priority:80,requires:{selection:!0},click:function(){var t=this.controller,e=t.state();t.state("playlist-edit").get("library").add(e.get("selection").models),e.trigger("reset"),t.setState("playlist-edit"),this.controller.modal.focusManager.focus()}}}}))},videoPlaylistEditToolbar:function(){var t=this.state().get("editing");this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:t?o.updateVideoPlaylist:o.insertVideoPlaylist,priority:140,requires:{library:!0},click:function(){var t=this.controller,e=t.state(),i=e.get("library");i.type="video",t.close(),e.trigger("update",i),t.setState(t.options.state),t.reset()}}}}))},videoPlaylistAddToolbar:function(){this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{insert:{style:"primary",text:o.addToVideoPlaylist,priority:140,requires:{selection:!0},click:function(){var t=this.controller,e=t.state();t.state("video-playlist-edit").get("library").add(e.get("selection").models),e.trigger("reset"),t.setState("video-playlist-edit"),this.controller.modal.focusManager.focus()}}}}))}});t.exports=n},function(t,e){var i=wp.media.view.MediaFrame.Select,s=wp.media.view.l10n,o=i.extend({defaults:{id:"image",url:"",menu:"image-details",content:"image-details",toolbar:"image-details",type:"link",title:s.imageDetailsTitle,priority:120},initialize:function(t){this.image=new wp.media.model.PostImage(t.metadata),this.options.selection=new wp.media.model.Selection(this.image.attachment,{multiple:!1}),i.prototype.initialize.apply(this,arguments)},bindHandlers:function(){i.prototype.bindHandlers.apply(this,arguments),this.on("menu:create:image-details",this.createMenu,this),this.on("content:create:image-details",this.imageDetailsContent,this),this.on("content:render:edit-image",this.editImageContent,this),this.on("toolbar:render:image-details",this.renderImageDetailsToolbar,this),this.on("toolbar:render:replace",this.renderReplaceImageToolbar,this)},createStates:function(){this.states.add([new wp.media.controller.ImageDetails({image:this.image,editable:!1}),new wp.media.controller.ReplaceImage({id:"replace-image",library:wp.media.query({type:"image"}),image:this.image,multiple:!1,title:s.imageReplaceTitle,toolbar:"replace",priority:80,displaySettings:!0}),new wp.media.controller.EditImage({image:this.image,selection:this.options.selection})])},imageDetailsContent:function(t){t.view=new wp.media.view.ImageDetails({controller:this,model:this.state().image,attachment:this.state().image.attachment})},editImageContent:function(){var t=this.state().get("image");t&&(t=new wp.media.view.EditImage({model:t,controller:this}).render(),this.content.set(t),t.loadEditor())},renderImageDetailsToolbar:function(){this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{select:{style:"primary",text:s.update,priority:80,click:function(){var t=this.controller,e=t.state();t.close(),e.trigger("update",t.image.toJSON()),t.setState(t.options.state),t.reset()}}}}))},renderReplaceImageToolbar:function(){var t=this,e=t.lastState(),i=e&&e.id;this.toolbar.set(new wp.media.view.Toolbar({controller:this,items:{back:{text:s.back,priority:80,click:function(){i?t.setState(i):t.close()}},replace:{style:"primary",text:s.replace,priority:20,requires:{selection:!0},click:function(){var t=this.controller,e=t.state(),i=e.get("selection").single();t.close(),t.image.changeAttachment(i,e.display(i)),e.trigger("replace",t.image.toJSON()),t.setState(t.options.state),t.reset()}}}}))}});t.exports=o},function(t,e){var i=jQuery,s=wp.media.View.extend({tagName:"div",template:wp.template("media-modal"),events:{"click .media-modal-backdrop, .media-modal-close":"escapeHandler",keydown:"keydown"},clickedOpenerEl:null,initialize:function(){_.defaults(this.options,{container:document.body,title:"",propagate:!0,hasCloseButton:!0}),this.focusManager=new wp.media.view.FocusManager({el:this.el})},prepare:function(){return{title:this.options.title,hasCloseButton:this.options.hasCloseButton}},attach:function(){return this.views.attached?this:(this.views.rendered||this.render(),this.$el.appendTo(this.options.container),this.views.attached=!0,this.views.ready(),this.propagate("attach"))},detach:function(){return this.$el.is(":visible")&&this.close(),this.$el.detach(),this.views.attached=!1,this.propagate("detach")},open:function(){var t,e=this.$el;return e.is(":visible")?this:(this.clickedOpenerEl=document.activeElement,this.views.attached||this.attach(),i("body").addClass("modal-open"),e.show(),"ontouchend"in document&&(t=window.tinymce&&window.tinymce.activeEditor)&&!t.isHidden()&&t.iframeElement&&(t.iframeElement.focus(),t.iframeElement.blur(),setTimeout(function(){t.iframeElement.blur()},100)),this.$(".media-modal").trigger("focus"),this.focusManager.setAriaHiddenOnBodyChildren(e),this.propagate("open"))},close:function(t){return this.views.attached&&this.$el.is(":visible")&&(i(".mejs-pause button").click(),i("body").removeClass("modal-open"),this.$el.hide().off("keydown"),this.focusManager.removeAriaHiddenFromBodyChildren(),(null!==this.clickedOpenerEl?this.clickedOpenerEl:i("#wpbody-content").attr("tabindex","-1")).focus(),this.propagate("close"),t&&t.escape&&this.propagate("escape")),this},escape:function(){return this.close({escape:!0})},escapeHandler:function(t){t.preventDefault(),this.escape()},content:function(t){return this.views.set(".media-modal-content",t),this},propagate:function(t){return this.trigger(t),this.options.propagate&&this.controller.trigger(t),this},keydown:function(t){27===t.which&&this.$el.is(":visible")&&(this.escape(),t.stopImmediatePropagation())}});t.exports=s},function(t,e){var o=jQuery,i=wp.media.View.extend({events:{keydown:"focusManagementMode"},initialize:function(t){this.mode=t.mode||"constrainTabbing",this.tabsAutomaticActivation=t.tabsAutomaticActivation||!1},focusManagementMode:function(t){"constrainTabbing"===this.mode&&this.constrainTabbing(t),"tabsNavigation"===this.mode&&this.tabsNavigation(t)},getTabbables:function(){return this.$(":tabbable").not('.moxie-shim input[type="file"]')},focus:function(){this.$(".media-modal").trigger("focus")},constrainTabbing:function(t){var e;if(9===t.keyCode)return(e=this.getTabbables()).last()[0]!==t.target||t.shiftKey?e.first()[0]===t.target&&t.shiftKey?(e.last().focus(),!1):void 0:(e.first().focus(),!1)},setAriaHiddenOnBodyChildren:function(e){var t,i=this;this.isBodyAriaHidden||(t=document.body.children,_.each(t,function(t){t!==e[0]&&i.elementShouldBeHidden(t)&&(t.setAttribute("aria-hidden","true"),i.ariaHiddenElements.push(t))}),this.isBodyAriaHidden=!0)},removeAriaHiddenFromBodyChildren:function(){_.each(this.ariaHiddenElements,function(t){t.removeAttribute("aria-hidden")}),this.ariaHiddenElements=[],this.isBodyAriaHidden=!1},elementShouldBeHidden:function(t){var e=t.getAttribute("role");return!("SCRIPT"===t.tagName||t.hasAttribute("aria-hidden")||t.hasAttribute("aria-live")||-1!==["alert","status","log","marquee","timer"].indexOf(e))},isBodyAriaHidden:!1,ariaHiddenElements:[],tabs:o(),setupAriaTabs:function(){this.tabs=this.$('[role="tab"]'),this.tabs.attr({"aria-selected":"false",tabIndex:"-1"}),this.tabs.filter(".active").removeAttr("tabindex").attr("aria-selected","true")},tabsNavigation:function(t){var e="horizontal";-1!==[32,35,36,37,38,39,40].indexOf(t.which)&&("horizontal"===(e="vertical"===this.$el.attr("aria-orientation")?"vertical":e)&&-1!==[38,40].indexOf(t.which)||"vertical"===e&&-1!==[37,39].indexOf(t.which)||this.switchTabs(t,this.tabs))},switchTabs:function(t){var e,i=t.which,s=this.tabs.index(o(t.target));switch(i){case 32:this.activateTab(this.tabs[s]);break;case 35:t.preventDefault(),this.activateTab(this.tabs[this.tabs.length-1]);break;case 36:t.preventDefault(),this.activateTab(this.tabs[0]);break;case 37:case 38:t.preventDefault(),e=s-1<0?this.tabs.length-1:s-1,this.activateTab(this.tabs[e]);break;case 39:case 40:t.preventDefault(),e=s+1===this.tabs.length?0:s+1,this.activateTab(this.tabs[e])}},activateTab:function(t){if(t){if(t.focus(),this.tabsAutomaticActivation)return t.removeAttribute("tabindex"),t.setAttribute("aria-selected","true"),void t.click();o(t).on("click",function(){t.removeAttribute("tabindex"),t.setAttribute("aria-selected","true")})}}});t.exports=i},function(t,e){var i=jQuery,s=wp.media.View.extend({tagName:"div",className:"uploader-window",template:wp.template("uploader-window"),initialize:function(){var t;this.$browser=i('"); - jQuery("#TB_closeWindowButton").click(tb_remove); + jQuery("#TB_closeWindowButton").trigger( 'click', tb_remove ); if (!(TB_PrevHTML === "")) { function goPrev(){ - if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);} + if(jQuery(document).off("click",goPrev)){jQuery(document).off("click",goPrev);} jQuery("#TB_window").remove(); jQuery("body").append("
    "); tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); return false; } - jQuery("#TB_prev").click(goPrev); + jQuery("#TB_prev").trigger( 'click', goPrev ); } if (!(TB_NextHTML === "")) { @@ -161,22 +161,22 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic tb_show(TB_NextCaption, TB_NextURL, imageGroup); return false; } - jQuery("#TB_next").click(goNext); + jQuery("#TB_next").trigger( 'click', goNext ); } - jQuery(document).bind('keydown.thickbox', function(e){ + jQuery(document).on('keydown.thickbox', function(e){ if ( e.which == 27 ){ // close tb_remove(); } else if ( e.which == 190 ){ // display previous image if(!(TB_NextHTML == "")){ - jQuery(document).unbind('thickbox'); + jQuery(document).off('thickbox'); goNext(); } } else if ( e.which == 188 ){ // display next image if(!(TB_PrevHTML == "")){ - jQuery(document).unbind('thickbox'); + jQuery(document).off('thickbox'); goPrev(); } } @@ -185,7 +185,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic tb_position(); jQuery("#TB_load").remove(); - jQuery("#TB_ImageOff").click(tb_remove); + jQuery("#TB_ImageOff").trigger( 'click', tb_remove ); jQuery("#TB_window").css({'visibility':'visible'}); //for safari using css instead of show }; @@ -206,7 +206,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic if(params['modal'] != "true"){//iframe no modal jQuery("#TB_window").append("
    "+caption+"
    "); }else{//iframe modal - jQuery("#TB_overlay").unbind(); + jQuery("#TB_overlay").off(); jQuery("#TB_window").append(""); } }else{// not an iframe, ajax @@ -214,7 +214,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic if(params['modal'] != "true"){//ajax no modal jQuery("#TB_window").append("
    "+caption+"
    "); }else{//ajax modal - jQuery("#TB_overlay").unbind(); + jQuery("#TB_overlay").off(); jQuery("#TB_window").append("
    "); } }else{//this means the window is already up, we are just loading new content via ajax @@ -225,11 +225,11 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic } } - jQuery("#TB_closeWindowButton").click(tb_remove); + jQuery("#TB_closeWindowButton").trigger( 'click', tb_remove ); if(url.indexOf('TB_inline') != -1){ jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children()); - jQuery("#TB_window").bind('tb_unload', function () { + jQuery("#TB_window").on('tb_unload', function () { jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished }); tb_position(); @@ -253,7 +253,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic } if(!params['modal']){ - jQuery(document).bind('keydown.thickbox', function(e){ + jQuery(document).on('keydown.thickbox', function(e){ if ( e.which == 27 ){ // close tb_remove(); return false; @@ -268,7 +268,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic * In other admin screens is hidden and replaced by a different icon. */ if ( $closeBtn.find( '.tb-close-icon' ).is( ':visible' ) ) { - $closeBtn.focus(); + $closeBtn.trigger( 'focus' ); } } catch(e) { @@ -283,10 +283,10 @@ function tb_showIframe(){ } function tb_remove() { - jQuery("#TB_imageOff").unbind("click"); - jQuery("#TB_closeWindowButton").unbind("click"); + jQuery("#TB_imageOff").off("click"); + jQuery("#TB_closeWindowButton").off("click"); jQuery( '#TB_window' ).fadeOut( 'fast', function() { - jQuery( '#TB_window, #TB_overlay, #TB_HideSelect' ).trigger( 'tb_unload' ).unbind().remove(); + jQuery( '#TB_window, #TB_overlay, #TB_HideSelect' ).trigger( 'tb_unload' ).off().remove(); jQuery( 'body' ).trigger( 'thickbox:removed' ); }); jQuery( 'body' ).removeClass( 'modal-open' ); @@ -295,7 +295,7 @@ function tb_remove() { jQuery("body","html").css({height: "auto", width: "auto"}); jQuery("html").css("overflow",""); } - jQuery(document).unbind('.thickbox'); + jQuery(document).off('.thickbox'); return false; } diff --git a/wp-includes/js/wp-pointer.js b/wp-includes/js/wp-pointer.js index 15849bc6ed..9d043f6dee 100644 --- a/wp-includes/js/wp-pointer.js +++ b/wp-includes/js/wp-pointer.js @@ -19,7 +19,7 @@ buttons: function( event, t ) { var button = $('').text( wp.i18n.__( 'Dismiss' ) ); - return button.bind( 'click.pointer', function(e) { + return button.on( 'click.pointer', function(e) { e.preventDefault(); t.element.pointer('close'); }); diff --git a/wp-includes/js/wp-pointer.min.js b/wp-includes/js/wp-pointer.min.js index 73790294f8..a6d50581fb 100644 --- a/wp-includes/js/wp-pointer.min.js +++ b/wp-includes/js/wp-pointer.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -!function(o){var i=0,e=9999;o.widget("wp.pointer",{options:{pointerClass:"wp-pointer",pointerWidth:320,content:function(){return o(this).text()},buttons:function(t,i){return o('').text(wp.i18n.__("Dismiss")).bind("click.pointer",function(t){t.preventDefault(),i.element.pointer("close")})},position:"top",show:function(t,i){i.pointer.show(),i.opened()},hide:function(t,i){i.pointer.hide(),i.closed()},document:document},_create:function(){var t;this.content=o('
    '),this.arrow=o('
    '),t="absolute",this.element.parents().add(this.element).filter(function(){return"fixed"===o(this).css("position")}).length&&(t="fixed"),this.pointer=o("
    ").append(this.content).append(this.arrow).attr("id","wp-pointer-"+i++).addClass(this.options.pointerClass).css({position:t,width:this.options.pointerWidth+"px",display:"none"}).appendTo(this.options.document.body)},_setOption:function(t,i){var e=this.options,n=this.pointer;"document"===t&&i!==e.document?n.detach().appendTo(i.body):"pointerClass"===t&&n.removeClass(e.pointerClass).addClass(i),o.Widget.prototype._setOption.apply(this,arguments),"position"===t?this.reposition():"content"===t&&this.active&&this.update()},destroy:function(){this.pointer.remove(),o.Widget.prototype.destroy.call(this)},widget:function(){return this.pointer},update:function(i){var e=this,t=this.options,n=o.Deferred();if(!t.disabled)return n.done(function(t){e._update(i,t)}),(t="string"==typeof t.content?t.content:t.content.call(this.element[0],n.resolve,i,this._handoff()))&&n.resolve(t),n.promise()},_update:function(t,i){var e=this.options;i&&(this.pointer.stop(),this.content.html(i),(t=e.buttons.call(this.element[0],t,this._handoff()))&&t.wrap('
    ').parent().appendTo(this.content),this.reposition())},reposition:function(){var t;this.options.disabled||(t=this._processPosition(this.options.position),this.pointer.css({top:0,left:0,zIndex:e++}).show().position(o.extend({of:this.element,collision:"fit none"},t)),this.repoint())},repoint:function(){var t=this.options;t.disabled||(t="string"==typeof t.position?t.position:t.position.edge,this.pointer[0].className=this.pointer[0].className.replace(/wp-pointer-[^\s'"]*/,""),this.pointer.addClass("wp-pointer-"+t))},_processPosition:function(t){var i={top:"bottom",bottom:"top",left:"right",right:"left"},t="string"==typeof t?{edge:t+""}:o.extend({},t);return t.edge&&("top"==t.edge||"bottom"==t.edge?(t.align=t.align||"left",t.at=t.at||t.align+" "+i[t.edge],t.my=t.my||t.align+" "+t.edge):(t.align=t.align||"top",t.at=t.at||i[t.edge]+" "+t.align,t.my=t.my||t.edge+" "+t.align)),t},open:function(t){var i=this,e=this.options;this.active||e.disabled||this.element.is(":hidden")||this.update().done(function(){i._open(t)})},_open:function(t){var i=this,e=this.options;this.active||e.disabled||this.element.is(":hidden")||(this.active=!0,this._trigger("open",t,this._handoff()),this._trigger("show",t,this._handoff({opened:function(){i._trigger("opened",t,i._handoff())}})))},close:function(t){var i;this.active&&!this.options.disabled&&((i=this).active=!1,this._trigger("close",t,this._handoff()),this._trigger("hide",t,this._handoff({closed:function(){i._trigger("closed",t,i._handoff())}})))},sendToTop:function(){this.active&&this.pointer.css("z-index",e++)},toggle:function(t){this.pointer.is(":hidden")?this.open(t):this.close(t)},_handoff:function(t){return o.extend({pointer:this.pointer,element:this.element},t)}})}(jQuery); \ No newline at end of file +!function(o){var i=0,e=9999;o.widget("wp.pointer",{options:{pointerClass:"wp-pointer",pointerWidth:320,content:function(){return o(this).text()},buttons:function(t,i){return o('').text(wp.i18n.__("Dismiss")).on("click.pointer",function(t){t.preventDefault(),i.element.pointer("close")})},position:"top",show:function(t,i){i.pointer.show(),i.opened()},hide:function(t,i){i.pointer.hide(),i.closed()},document:document},_create:function(){var t;this.content=o('
    '),this.arrow=o('
    '),t="absolute",this.element.parents().add(this.element).filter(function(){return"fixed"===o(this).css("position")}).length&&(t="fixed"),this.pointer=o("
    ").append(this.content).append(this.arrow).attr("id","wp-pointer-"+i++).addClass(this.options.pointerClass).css({position:t,width:this.options.pointerWidth+"px",display:"none"}).appendTo(this.options.document.body)},_setOption:function(t,i){var e=this.options,n=this.pointer;"document"===t&&i!==e.document?n.detach().appendTo(i.body):"pointerClass"===t&&n.removeClass(e.pointerClass).addClass(i),o.Widget.prototype._setOption.apply(this,arguments),"position"===t?this.reposition():"content"===t&&this.active&&this.update()},destroy:function(){this.pointer.remove(),o.Widget.prototype.destroy.call(this)},widget:function(){return this.pointer},update:function(i){var e=this,t=this.options,n=o.Deferred();if(!t.disabled)return n.done(function(t){e._update(i,t)}),(t="string"==typeof t.content?t.content:t.content.call(this.element[0],n.resolve,i,this._handoff()))&&n.resolve(t),n.promise()},_update:function(t,i){var e=this.options;i&&(this.pointer.stop(),this.content.html(i),(t=e.buttons.call(this.element[0],t,this._handoff()))&&t.wrap('
    ').parent().appendTo(this.content),this.reposition())},reposition:function(){var t;this.options.disabled||(t=this._processPosition(this.options.position),this.pointer.css({top:0,left:0,zIndex:e++}).show().position(o.extend({of:this.element,collision:"fit none"},t)),this.repoint())},repoint:function(){var t=this.options;t.disabled||(t="string"==typeof t.position?t.position:t.position.edge,this.pointer[0].className=this.pointer[0].className.replace(/wp-pointer-[^\s'"]*/,""),this.pointer.addClass("wp-pointer-"+t))},_processPosition:function(t){var i={top:"bottom",bottom:"top",left:"right",right:"left"},t="string"==typeof t?{edge:t+""}:o.extend({},t);return t.edge&&("top"==t.edge||"bottom"==t.edge?(t.align=t.align||"left",t.at=t.at||t.align+" "+i[t.edge],t.my=t.my||t.align+" "+t.edge):(t.align=t.align||"top",t.at=t.at||i[t.edge]+" "+t.align,t.my=t.my||t.edge+" "+t.align)),t},open:function(t){var i=this,e=this.options;this.active||e.disabled||this.element.is(":hidden")||this.update().done(function(){i._open(t)})},_open:function(t){var i=this,e=this.options;this.active||e.disabled||this.element.is(":hidden")||(this.active=!0,this._trigger("open",t,this._handoff()),this._trigger("show",t,this._handoff({opened:function(){i._trigger("opened",t,i._handoff())}})))},close:function(t){var i;this.active&&!this.options.disabled&&((i=this).active=!1,this._trigger("close",t,this._handoff()),this._trigger("hide",t,this._handoff({closed:function(){i._trigger("closed",t,i._handoff())}})))},sendToTop:function(){this.active&&this.pointer.css("z-index",e++)},toggle:function(t){this.pointer.is(":hidden")?this.open(t):this.close(t)},_handoff:function(t){return o.extend({pointer:this.pointer,element:this.element},t)}})}(jQuery); \ No newline at end of file diff --git a/wp-includes/version.php b/wp-includes/version.php index da38c0d89d..d26c94e0a3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.7-beta2-50365'; +$wp_version = '5.7-beta2-50367'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.