PK!`x  tags-box.min.jsnu[/*! This file is auto-generated */ !function(o){var r=wp.i18n._x(",","tag delimiter")||",";window.array_unique_noempty=function(t){var a=[];return o.each(t,function(t,e){(e=(e=e||"").trim())&&-1===o.inArray(e,a)&&a.push(e)}),a},window.tagBox={clean:function(t){return t=(t=","!==r?t.replace(new RegExp(r,"g"),","):t).replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,""),t=","!==r?t.replace(/,/g,r):t},parseTags:function(t){var e=t.id.split("-check-num-")[1],t=o(t).closest(".tagsdiv"),a=t.find(".the-tags"),i=a.val().split(r),n=[];return delete i[e],o.each(i,function(t,e){(e=(e=e||"").trim())&&n.push(e)}),a.val(this.clean(n.join(r))),this.quickClicks(t),!1},quickClicks:function(t){var a,e=o(".the-tags",t),i=o(".tagchecklist",t),n=o(t).attr("id");e.length&&(a=e.prop("disabled"),t=e.val().split(r),i.empty(),o.each(t,function(t,e){(e=(e=e||"").trim())&&(e=o("
  • ").text(e),a||((t=o('")).on("click keypress",function(t){"click"!==t.type&&13!==t.keyCode&&32!==t.keyCode||(13!==t.keyCode&&32!==t.keyCode||o(this).closest(".tagsdiv").find("input.newtag").trigger("focus"),tagBox.userAction="remove",tagBox.parseTags(this))}),e.prepend(" ").prepend(t)),i.append(e))}),tagBox.screenReadersMessage())},flushTags:function(t,e,a){var i,n,s=o(".the-tags",t),c=o("input.newtag",t);return void 0!==(n=(e=e||!1)?o(e).text():c.val())&&""!==n&&(i=s.val(),i=this.clean(i=i?i+r+n:n),i=array_unique_noempty(i.split(r)).join(r),s.val(i),this.quickClicks(t),e||c.val(""),void 0===a)&&c.trigger("focus"),!1},get:function(a){var i=a.substr(a.indexOf("-")+1);o.post(ajaxurl,{action:"get-tagcloud",tax:i},function(t,e){0!==t&&"success"==e&&(t=o('
    '+t+"
    "),o("a",t).on("click",function(){return tagBox.userAction="add",tagBox.flushTags(o("#"+i),this),!1}),o("#"+a).after(t))})},userAction:"",screenReadersMessage:function(){var t;switch(this.userAction){case"remove":t=wp.i18n.__("Term removed.");break;case"add":t=wp.i18n.__("Term added.");break;default:return}window.wp.a11y.speak(t,"assertive")},init:function(){var t=o("div.ajaxtag");o(".tagsdiv").each(function(){tagBox.quickClicks(this)}),o(".tagadd",t).on("click",function(){tagBox.userAction="add",tagBox.flushTags(o(this).closest(".tagsdiv"))}),o("input.newtag",t).on("keypress",function(t){13==t.which&&(tagBox.userAction="add",tagBox.flushTags(o(this).closest(".tagsdiv")),t.preventDefault(),t.stopPropagation())}).each(function(t,e){o(e).wpTagsSuggest()}),o("#post").on("submit",function(){o("div.tagsdiv").each(function(){tagBox.flushTags(this,!1,1)})}),o(".tagcloud-link").on("click",function(){tagBox.get(o(this).attr("id")),o(this).attr("aria-expanded","true").off().on("click",function(){o(this).attr("aria-expanded","false"===o(this).attr("aria-expanded")?"true":"false").siblings(".the-tagcloud").toggle()})})}}}(jQuery);PK!|ii theme.min.jsnu[/*! This file is auto-generated */ window.wp=window.wp||{},function(n){var o,a;function e(e,t){Backbone.history._hasPushState&&Backbone.Router.prototype.navigate.call(this,e,t)}(o=wp.themes=wp.themes||{}).data=_wpThemeSettings,a=o.data.l10n,o.isInstall=!!o.data.settings.isInstall,_.extend(o,{model:{},view:{},routes:{},router:{},template:wp.template}),o.Model=Backbone.Model.extend({initialize:function(){var e;this.get("slug")&&(-1!==_.indexOf(o.data.installedThemes,this.get("slug"))&&this.set({installed:!0}),o.data.activeTheme===this.get("slug"))&&this.set({active:!0}),this.set({id:this.get("slug")||this.get("id")}),this.has("sections")&&(e=this.get("sections").description,this.set({description:e}))}}),o.view.Appearance=wp.Backbone.View.extend({el:"#wpbody-content .wrap .theme-browser",window:n(window),page:0,initialize:function(e){_.bindAll(this,"scroller"),this.SearchView=e.SearchView||o.view.Search,this.window.on("scroll",_.throttle(this.scroller,300))},render:function(){this.view=new o.view.Themes({collection:this.collection,parent:this}),this.search(),this.$el.removeClass("search-loading"),this.view.render(),this.$el.empty().append(this.view.el).addClass("rendered")},searchContainer:n(".search-form"),search:function(){var e;1!==o.data.themes.length&&(e=new this.SearchView({collection:this.collection,parent:this}),(this.SearchView=e).render(),this.searchContainer.find(".search-box").append(n.parseHTML('")).append(e.el),this.searchContainer.on("submit",function(e){e.preventDefault()}))},scroller:function(){var e=this,t=this.window.scrollTop()+e.window.height(),e=e.$el.offset().top+e.$el.outerHeight(!1)-e.window.height();Math.round(.9*e)]+)>)/gi,""),r=e.get("description").replace(/(<([^>]+)>)/gi,""),a=e.get("author").replace(/(<([^>]+)>)/gi,""),s=_.union([s,e.get("id"),r,a,e.get("tags")]),i.test(e.get("author"))&&2

    '+a.addNew+"

    "),this.parent.page++)},currentTheme:function(){var e=this.collection.findWhere({active:!0});e&&(this.collection.remove(e),this.collection.add(e,{at:0}))},setView:function(e){return e},expand:function(e){var t,i=this;this.model=i.collection.get(e),o.router.navigate(o.router.baseUrl(o.router.themePath+this.model.id)),this.setView("detail"),n("body").addClass("modal-open"),this.overlay=new o.view.Details({model:i.model}),this.overlay.render(),this.model.get("hasUpdate")&&(e=n('[data-slug="'+this.model.id+'"]'),t=n(this.overlay.el),e.find(".updating-message").length?(t.find(".notice-warning h3").remove(),t.find(".notice-warning").removeClass("notice-large").addClass("updating-message").find("p").text(wp.updates.l10n.updating)):e.find(".notice-error").length&&t.find(".notice-warning").remove()),this.$overlay.html(this.overlay.el),this.listenTo(this.overlay,"theme:next",function(){i.next([i.model.cid])}).listenTo(this.overlay,"theme:previous",function(){i.previous([i.model.cid])})},next:function(e){e=this.collection.get(e[0]),e=this.collection.at(this.collection.indexOf(e)+1);void 0!==e&&(this.overlay.closeOverlay(),this.theme.trigger("theme:expand",e.cid))},previous:function(e){e=this.collection.get(e[0]),e=this.collection.at(this.collection.indexOf(e)-1);void 0!==e&&(this.overlay.closeOverlay(),this.theme.trigger("theme:expand",e.cid))},announceSearchResults:function(e){0===e?wp.a11y.speak(a.noThemesFound):wp.a11y.speak(a.themesFound.replace("%d",e))}}),o.view.Search=wp.Backbone.View.extend({tagName:"input",className:"wp-filter-search",id:"wp-filter-search-input",searching:!1,attributes:{type:"search","aria-describedby":"live-search-desc"},events:{input:"search",keyup:"search",blur:"pushState"},initialize:function(e){this.parent=e.parent,this.listenTo(this.parent,"theme:close",function(){this.searching=!1})},search:function(e){"keyup"===e.type&&27===e.which&&(e.target.value=""),this.doSearch(e)},doSearch:function(e){var t={};this.collection.doSearch(e.target.value.replace(/\+/g," ")),this.searching&&13!==e.which?t.replace=!0:this.searching=!0,e.target.value?o.router.navigate(o.router.baseUrl(o.router.searchPath+e.target.value),t):o.router.navigate(o.router.baseUrl(""))},pushState:function(e){var t=o.router.baseUrl("");e.target.value&&(t=o.router.baseUrl(o.router.searchPath+encodeURIComponent(e.target.value))),this.searching=!1,o.router.navigate(t)}}),o.Router=Backbone.Router.extend({routes:{"themes.php?theme=:slug":"theme","themes.php?search=:query":"search","themes.php?s=:query":"search","themes.php":"themes","":"themes"},baseUrl:function(e){return"themes.php"+e},themePath:"?theme=",searchPath:"?search=",search:function(e){n(".wp-filter-search").val(e.replace(/\+/g," "))},themes:function(){n(".wp-filter-search").val("")},navigate:e}),o.Run={init:function(){this.themes=new o.Collection(o.data.themes),this.view=new o.view.Appearance({collection:this.themes}),this.render(),this.view.SearchView.doSearch=_.debounce(this.view.SearchView.doSearch,500)},render:function(){this.view.render(),this.routes(),Backbone.History.started&&Backbone.history.stop(),Backbone.history.start({root:o.data.settings.adminUrl,pushState:!0,hashChange:!1})},routes:function(){var t=this;o.router=new o.Router,o.router.on("route:theme",function(e){t.view.view.expand(e)}),o.router.on("route:themes",function(){t.themes.doSearch(""),t.view.trigger("theme:close")}),o.router.on("route:search",function(){n(".wp-filter-search").trigger("keyup")}),this.extraRoutes()},extraRoutes:function(){return!1}},o.view.InstallerSearch=o.view.Search.extend({events:{input:"search",keyup:"search"},terms:"",search:function(e){("keyup"!==e.type||9!==e.which&&16!==e.which)&&(this.collection=this.options.parent.view.collection,"keyup"===e.type&&27===e.which&&(e.target.value=""),this.doSearch(e.target.value))},doSearch:function(e){var t={};this.terms!==e&&(this.terms=e,"author:"===(t.search=e).substring(0,7)&&(t.search="",t.author=e.slice(7)),"tag:"===e.substring(0,4)&&(t.search="",t.tag=[e.slice(4)]),n(".filter-links li > a.current").removeClass("current").removeAttr("aria-current"),n("body").removeClass("show-filters filters-applied show-favorites-form"),n(".drawer-toggle").attr("aria-expanded","false"),this.collection.query(t),o.router.navigate(o.router.baseUrl(o.router.searchPath+encodeURIComponent(e)),{replace:!0}))}}),o.view.Installer=o.view.Appearance.extend({el:"#wpbody-content .wrap",events:{"click .filter-links li > a":"onSort","click .theme-filter":"onFilter","click .drawer-toggle":"moreFilters","click .filter-drawer .apply-filters":"applyFilters",'click .filter-group [type="checkbox"]':"addFilter","click .filter-drawer .clear-filters":"clearFilters","click .edit-filters":"backToFilters","click .favorites-form-submit":"saveUsername","keyup #wporg-username-input":"saveUsername"},render:function(){var e=this;this.search(),this.uploader(),this.collection=new o.Collection,this.listenTo(this,"theme:end",function(){e.collection.loadingThemes||(e.collection.loadingThemes=!0,e.collection.currentQuery.page++,_.extend(e.collection.currentQuery.request,{page:e.collection.currentQuery.page}),e.collection.query(e.collection.currentQuery.request))}),this.listenTo(this.collection,"query:success",function(){n("body").removeClass("loading-content"),n(".theme-browser").find("div.error").remove()}),this.listenTo(this.collection,"query:fail",function(){n("body").removeClass("loading-content"),n(".theme-browser").find("div.error").remove(),n(".theme-browser").find("div.themes").before('

    '+a.error+'

    "),n(".theme-browser .error .try-again").on("click",function(e){e.preventDefault(),n("input.wp-filter-search").trigger("input")})}),this.view&&this.view.remove(),this.view=new o.view.Themes({collection:this.collection,parent:this}),this.page=0,this.$el.find(".themes").remove(),this.view.render(),this.$el.find(".theme-browser").append(this.view.el).addClass("rendered")},browse:function(e){"block-themes"===e?this.collection.query({tag:"full-site-editing"}):this.collection.query({browse:e})},onSort:function(e){var t=n(e.target),i=t.data("sort");e.preventDefault(),n("body").removeClass("filters-applied show-filters"),n(".drawer-toggle").attr("aria-expanded","false"),t.hasClass(this.activeClass)||(this.sort(i),o.router.navigate(o.router.baseUrl(o.router.browsePath+i)))},sort:function(e){this.clearSearch(),o.router.selectedTab=e,n(".filter-links li > a, .theme-filter").removeClass(this.activeClass).removeAttr("aria-current"),n('[data-sort="'+e+'"]').addClass(this.activeClass).attr("aria-current","page"),"favorites"===e?n("body").addClass("show-favorites-form"):n("body").removeClass("show-favorites-form"),this.browse(e)},onFilter:function(e){var e=n(e.target),t=e.data("filter");e.hasClass(this.activeClass)||(n(".filter-links li > a, .theme-section").removeClass(this.activeClass).removeAttr("aria-current"),e.addClass(this.activeClass).attr("aria-current","page"),t&&(t=_.union([t,this.filtersChecked()]),this.collection.query({tag:[t]})))},addFilter:function(){this.filtersChecked()},applyFilters:function(e){var t,i=this.filtersChecked(),s={tag:i},r=n(".filtered-by .tags");e&&e.preventDefault(),i?(n("body").addClass("filters-applied"),n(".filter-links li > a.current").removeClass("current").removeAttr("aria-current"),r.empty(),_.each(i,function(e){t=n('label[for="filter-id-'+e+'"]').text(),r.append(''+t+"")}),this.collection.query(s)):wp.a11y.speak(a.selectFeatureFilter)},saveUsername:function(e){var t=n("#wporg-username-input").val(),i=n("#wporg-username-nonce").val(),s={browse:"favorites",user:t},r=this;if(e&&e.preventDefault(),"keyup"!==e.type||13===e.which)return wp.ajax.send("save-wporg-username",{data:{_wpnonce:i,username:t},success:function(){r.collection.query(s)}})},filtersChecked:function(){var e=n(".filter-group").find(":checkbox"),t=[];return _.each(e.filter(":checked"),function(e){t.push(n(e).prop("value"))}),0===t.length?(n(".filter-drawer .apply-filters").find("span").text(""),n(".filter-drawer .clear-filters").hide(),n("body").removeClass("filters-applied"),!1):(n(".filter-drawer .apply-filters").find("span").text(t.length),n(".filter-drawer .clear-filters").css("display","inline-block"),t)},activeClass:"current",uploader:function(){var e=n(".upload-view-toggle"),t=n(document.body);e.on("click",function(){t.toggleClass("show-upload-view"),e.attr("aria-expanded",t.hasClass("show-upload-view"))})},moreFilters:function(e){var t=n("body"),i=n(".drawer-toggle");if(e.preventDefault(),t.hasClass("filters-applied"))return this.backToFilters();this.clearSearch(),o.router.navigate(o.router.baseUrl("")),t.toggleClass("show-filters"),i.attr("aria-expanded",t.hasClass("show-filters"))},clearFilters:function(e){var t=n(".filter-group").find(":checkbox"),i=this;e.preventDefault(),_.each(t.filter(":checked"),function(e){return n(e).prop("checked",!1),i.filtersChecked()})},backToFilters:function(e){e&&e.preventDefault(),n("body").removeClass("filters-applied")},clearSearch:function(){n("#wp-filter-search-input").val("")}}),o.InstallerRouter=Backbone.Router.extend({routes:{"theme-install.php?theme=:slug":"preview","theme-install.php?browse=:sort":"sort","theme-install.php?search=:query":"search","theme-install.php":"sort"},baseUrl:function(e){return"theme-install.php"+e},themePath:"?theme=",browsePath:"?browse=",searchPath:"?search=",search:function(e){n(".wp-filter-search").val(e.replace(/\+/g," "))},navigate:e}),o.RunInstaller={init:function(){this.view=new o.view.Installer({section:"popular",SearchView:o.view.InstallerSearch}),this.render(),this.view.SearchView.doSearch=_.debounce(this.view.SearchView.doSearch,500)},render:function(){this.view.render(),this.routes(),Backbone.History.started&&Backbone.history.stop(),Backbone.history.start({root:o.data.settings.adminUrl,pushState:!0,hashChange:!1})},routes:function(){var t=this,i={};o.router=new o.InstallerRouter,o.router.on("route:preview",function(e){o.preview&&(o.preview.undelegateEvents(),o.preview.unbind()),t.view.view.theme&&t.view.view.theme.preview?(t.view.view.theme.model=t.view.collection.findWhere({slug:e}),t.view.view.theme.preview()):(i.theme=e,t.view.collection.query(i),t.view.collection.trigger("update"),t.view.collection.once("query:success",function(){n('div[data-slug="'+e+'"]').trigger("click")}))}),o.router.on("route:sort",function(e){e||(e="popular",o.router.navigate(o.router.baseUrl("?browse=popular"),{replace:!0})),t.view.sort(e),o.preview&&o.preview.close()}),o.router.on("route:search",function(){n(".wp-filter-search").trigger("focus").trigger("keyup")}),this.extraRoutes()},extraRoutes:function(){return!1}},n(function(){(o.isInstall?o.RunInstaller:o.Run).init(),n(document.body).on("click",".load-customize",function(){var e=n(this),t=document.createElement("a");t.href=e.prop("href"),t.search=n.param(_.extend(wp.customize.utils.parseQueryString(t.search.substr(1)),{return:window.location.href})),e.prop("href",t.href)}),n(".broken-themes .delete-theme").on("click",function(){return confirm(_wpThemeSettings.settings.confirmDelete)})})}(jQuery),jQuery(function(r){window.tb_position=function(){var e=r("#TB_window"),t=r(window).width(),i=r(window).height(),t=1040' ) .text( item.name ) .appendTo( ul ); }; $element.attr( { 'role': 'combobox', 'aria-autocomplete': 'list', 'aria-expanded': 'false', 'aria-owns': $element.autocomplete( 'widget' ).attr( 'id' ) } ) .on( 'focus', function() { var inputValue = split( $element.val() ).pop(); // Don't trigger a search if the field is empty. // Also, avoids screen readers announce `No search results`. if ( inputValue ) { $element.autocomplete( 'search' ); } } ); // Returns a jQuery object containing the menu element. $element.autocomplete( 'widget' ) .addClass( 'wp-tags-autocomplete' ) .attr( 'role', 'listbox' ) .removeAttr( 'tabindex' ) // Remove the `tabindex=0` attribute added by jQuery UI. /* * Looks like Safari and VoiceOver need an `aria-selected` attribute. See ticket #33301. * The `menufocus` and `menublur` events are the same events used to add and remove * the `ui-state-focus` CSS class on the menu items. See jQuery UI Menu Widget. */ .on( 'menufocus', function( event, ui ) { ui.item.attr( 'aria-selected', 'true' ); }) .on( 'menublur', function() { // The `menublur` event returns an object where the item is `null`, // so we need to find the active item with other means. $( this ).find( '[aria-selected="true"]' ).removeAttr( 'aria-selected' ); }); return this; }; }( jQuery ) ); PK!ġNr application-passwords.min.jsnu[/*! This file is auto-generated */ !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(a=e.responseJSON&&e.responseJSON.message?e.responseJSON.message:a,"error")}function f(e,s){s=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(s),s}function v(){o(".notice",a).remove()}n.on("click",function(e){var s;e.preventDefault(),n.prop("aria-disabled")||(0===(e=t.val()).length?t.trigger("focus"):(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").attr("tabindex","-1").trigger("focus"),r.prepend(c(e)),p.show(),d.remove(),wp.hooks.doAction("wp_application_passwords_created_password",e,s)}).fail(w)))}),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")})})}),t.on("keypress",function(e){13===e.which&&(e.preventDefault(),n.trigger("click"))}),0===r.children("tr").not(d).length&&p.hide()}(jQuery);PK!f[##comment.min.jsnu[/*! This file is auto-generated */ jQuery(function(m){postboxes.add_postbox_toggles("comment");var d=m("#timestampdiv"),o=m("#timestamp"),a=o.html(),v=d.find(".timestamp-wrap"),c=d.siblings("a.edit-timestamp");c.on("click",function(e){d.is(":hidden")&&(d.slideDown("fast",function(){m("input, select",v).first().trigger("focus")}),m(this).hide()),e.preventDefault()}),d.find(".cancel-timestamp").on("click",function(e){c.show().trigger("focus"),d.slideUp("fast"),m("#mm").val(m("#hidden_mm").val()),m("#jj").val(m("#hidden_jj").val()),m("#aa").val(m("#hidden_aa").val()),m("#hh").val(m("#hidden_hh").val()),m("#mn").val(m("#hidden_mn").val()),o.html(a),e.preventDefault()}),d.find(".save-timestamp").on("click",function(e){var a=m("#aa").val(),t=m("#mm").val(),i=m("#jj").val(),s=m("#hh").val(),l=m("#mn").val(),n=new Date(a,t-1,i,s,l);e.preventDefault(),n.getFullYear()!=a||1+n.getMonth()!=t||n.getDate()!=i||n.getMinutes()!=l?v.addClass("form-invalid"):(v.removeClass("form-invalid"),o.html(wp.i18n.__("Submitted on:")+" "+wp.i18n.__("%1$s %2$s, %3$s at %4$s:%5$s").replace("%1$s",m('option[value="'+t+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(i,10)).replace("%3$s",a).replace("%4$s",("00"+s).slice(-2)).replace("%5$s",("00"+l).slice(-2))+" "),c.show().trigger("focus"),d.slideUp("fast"))})});PK!plugin-install.jsnu[/** * @file Functionality for the plugin install screens. * * @output wp-admin/js/plugin-install.js */ /* global tb_click, tb_remove, tb_position */ jQuery( function( $ ) { var tbWindow, $iframeBody, $tabbables, $firstTabbable, $lastTabbable, $focusedBefore = $(), $uploadViewToggle = $( '.upload-view-toggle' ), $wrap = $ ( '.wrap' ), $body = $( document.body ); window.tb_position = function() { var width = $( window ).width(), H = $( window ).height() - ( ( 792 < width ) ? 60 : 20 ), W = ( 792 < width ) ? 772 : width - 20; tbWindow = $( '#TB_window' ); if ( tbWindow.length ) { tbWindow.width( W ).height( H ); $( '#TB_iframeContent' ).width( W ).height( H ); tbWindow.css({ 'margin-left': '-' + parseInt( ( W / 2 ), 10 ) + 'px' }); if ( typeof document.body.style.maxWidth !== 'undefined' ) { tbWindow.css({ 'top': '30px', 'margin-top': '0' }); } } return $( 'a.thickbox' ).each( function() { var href = $( this ).attr( 'href' ); if ( ! href ) { return; } href = href.replace( /&width=[0-9]+/g, '' ); href = href.replace( /&height=[0-9]+/g, '' ); $(this).attr( 'href', href + '&width=' + W + '&height=' + ( H ) ); }); }; $( window ).on( 'resize', function() { tb_position(); }); /* * Custom events: when a Thickbox iframe has loaded and when the Thickbox * modal gets removed from the DOM. */ $body .on( 'thickbox:iframe:loaded', tbWindow, function() { /* * Return if it's not the modal with the plugin details iframe. Other * thickbox instances might want to load an iframe with content from * an external domain. Avoid to access the iframe contents when we're * not sure the iframe loads from the same domain. */ if ( ! tbWindow.hasClass( 'plugin-details-modal' ) ) { return; } iframeLoaded(); }) .on( 'thickbox:removed', function() { // Set focus back to the element that opened the modal dialog. // Note: IE 8 would need this wrapped in a fake setTimeout `0`. $focusedBefore.trigger( 'focus' ); }); function iframeLoaded() { var $iframe = tbWindow.find( '#TB_iframeContent' ); // Get the iframe body. $iframeBody = $iframe.contents().find( 'body' ); // Get the tabbable elements and handle the keydown event on first load. handleTabbables(); // Set initial focus on the "Close" button. $firstTabbable.trigger( 'focus' ); /* * When the "Install" button is disabled (e.g. the Plugin is already installed) * then we can't predict where the last focusable element is. We need to get * the tabbable elements and handle the keydown event again and again, * each time the active tab panel changes. */ $( '#plugin-information-tabs a', $iframeBody ).on( 'click', function() { handleTabbables(); }); // Close the modal when pressing Escape. $iframeBody.on( 'keydown', function( event ) { if ( 27 !== event.which ) { return; } tb_remove(); }); } /* * Get the tabbable elements and detach/attach the keydown event. * Called after the iframe has fully loaded so we have all the elements we need. * Called again each time a Tab gets clicked. * @todo Consider to implement a WordPress general utility for this and don't use jQuery UI. */ function handleTabbables() { var $firstAndLast; // Get all the tabbable elements. $tabbables = $( ':tabbable', $iframeBody ); // Our first tabbable element is always the "Close" button. $firstTabbable = tbWindow.find( '#TB_closeWindowButton' ); // Get the last tabbable element. $lastTabbable = $tabbables.last(); // Make a jQuery collection. $firstAndLast = $firstTabbable.add( $lastTabbable ); // Detach any previously attached keydown event. $firstAndLast.off( 'keydown.wp-plugin-details' ); // Attach again the keydown event on the first and last focusable elements. $firstAndLast.on( 'keydown.wp-plugin-details', function( event ) { constrainTabbing( event ); }); } // Constrain tabbing within the plugin modal dialog. function constrainTabbing( event ) { if ( 9 !== event.which ) { return; } if ( $lastTabbable[0] === event.target && ! event.shiftKey ) { event.preventDefault(); $firstTabbable.trigger( 'focus' ); } else if ( $firstTabbable[0] === event.target && event.shiftKey ) { event.preventDefault(); $lastTabbable.trigger( 'focus' ); } } /* * Open the Plugin details modal. The event is delegated to get also the links * in the plugins search tab, after the Ajax search rebuilds the HTML. It's * delegated on the closest ancestor and not on the body to avoid conflicts * with other handlers, see Trac ticket #43082. */ $( '.wrap' ).on( 'click', '.thickbox.open-plugin-details-modal', function( e ) { // The `data-title` attribute is used only in the Plugin screens. var title = $( this ).data( 'title' ) ? wp.i18n.sprintf( // translators: %s: Plugin name. wp.i18n.__( 'Plugin: %s' ), $( this ).data( 'title' ) ) : wp.i18n.__( 'Plugin details' ); e.preventDefault(); e.stopPropagation(); // Store the element that has focus before opening the modal dialog, i.e. the control which opens it. $focusedBefore = $( this ); tb_click.call(this); // Set ARIA role, ARIA label, and add a CSS class. tbWindow .attr({ 'role': 'dialog', 'aria-label': wp.i18n.__( 'Plugin details' ) }) .addClass( 'plugin-details-modal' ); // Set title attribute on the iframe. tbWindow.find( '#TB_iframeContent' ).attr( 'title', title ); }); /* Plugin install related JS */ $( '#plugin-information-tabs a' ).on( 'click', function( event ) { var tab = $( this ).attr( 'name' ); event.preventDefault(); // Flip the tab. $( '#plugin-information-tabs a.current' ).removeClass( 'current' ); $( this ).addClass( 'current' ); // Only show the fyi box in the description section, on smaller screen, // where it's otherwise always displayed at the top. if ( 'description' !== tab && $( window ).width() < 772 ) { $( '#plugin-information-content' ).find( '.fyi' ).hide(); } else { $( '#plugin-information-content' ).find( '.fyi' ).show(); } // Flip the content. $( '#section-holder div.section' ).hide(); // Hide 'em all. $( '#section-' + tab ).show(); }); /* * When a user presses the "Upload Plugin" button, show the upload form in place * rather than sending them to the devoted upload plugin page. * The `?tab=upload` page still exists for no-js support and for plugins that * might access it directly. When we're in this page, let the link behave * like a link. Otherwise we're in the normal plugin installer pages and the * link should behave like a toggle button. */ if ( ! $wrap.hasClass( 'plugin-install-tab-upload' ) ) { $uploadViewToggle .attr({ role: 'button', 'aria-expanded': 'false' }) .on( 'click', function( event ) { event.preventDefault(); $body.toggleClass( 'show-upload-view' ); $uploadViewToggle.attr( 'aria-expanded', $body.hasClass( 'show-upload-view' ) ); }); } }); PK!2jvllset-post-thumbnail.min.jsnu[/*! This file is auto-generated */ window.WPSetAsThumbnail=function(n,t){var a=jQuery("a#wp-post-thumbnail-"+n);a.text(wp.i18n.__("Saving\u2026")),jQuery.post(ajaxurl,{action:"set-post-thumbnail",post_id:post_id,thumbnail_id:n,_ajax_nonce:t,cookie:encodeURIComponent(document.cookie)},function(t){var e=window.dialogArguments||opener||parent||top;a.text(wp.i18n.__("Use as featured image")),"0"==t?alert(wp.i18n.__("Could not set that as the thumbnail image. Try a different attachment.")):(jQuery("a.wp-post-thumbnail").show(),a.text(wp.i18n.__("Done")),a.fadeOut(2e3),e.WPSetThumbnailID(n),e.WPSetThumbnailHTML(t))})};PK!?.. updates.jsnu[/** * Functions for ajaxified updates, deletions and installs inside the WordPress admin. * * @version 4.2.0 * @output wp-admin/js/updates.js */ /* global pagenow, _wpThemeSettings */ /** * @param {jQuery} $ jQuery object. * @param {object} wp WP object. * @param {object} settings WP Updates settings. * @param {string} settings.ajax_nonce Ajax nonce. * @param {object=} settings.plugins Base names of plugins in their different states. * @param {Array} settings.plugins.all Base names of all plugins. * @param {Array} settings.plugins.active Base names of active plugins. * @param {Array} settings.plugins.inactive Base names of inactive plugins. * @param {Array} settings.plugins.upgrade Base names of plugins with updates available. * @param {Array} settings.plugins.recently_activated Base names of recently activated plugins. * @param {Array} settings.plugins['auto-update-enabled'] Base names of plugins set to auto-update. * @param {Array} settings.plugins['auto-update-disabled'] Base names of plugins set to not auto-update. * @param {object=} settings.themes Slugs of themes in their different states. * @param {Array} settings.themes.all Slugs of all themes. * @param {Array} settings.themes.upgrade Slugs of themes with updates available. * @param {Arrat} settings.themes.disabled Slugs of disabled themes. * @param {Array} settings.themes['auto-update-enabled'] Slugs of themes set to auto-update. * @param {Array} settings.themes['auto-update-disabled'] Slugs of themes set to not auto-update. * @param {object=} settings.totals Combined information for available update counts. * @param {number} settings.totals.count Holds the amount of available updates. */ (function( $, wp, settings ) { var $document = $( document ), __ = wp.i18n.__, _x = wp.i18n._x, _n = wp.i18n._n, _nx = wp.i18n._nx, sprintf = wp.i18n.sprintf; wp = wp || {}; /** * The WP Updates object. * * @since 4.2.0 * * @namespace wp.updates */ wp.updates = {}; /** * Removed in 5.5.0, needed for back-compatibility. * * @since 4.2.0 * @deprecated 5.5.0 * * @type {object} */ wp.updates.l10n = { searchResults: '', searchResultsLabel: '', noPlugins: '', noItemsSelected: '', updating: '', pluginUpdated: '', themeUpdated: '', update: '', updateNow: '', pluginUpdateNowLabel: '', updateFailedShort: '', updateFailed: '', pluginUpdatingLabel: '', pluginUpdatedLabel: '', pluginUpdateFailedLabel: '', updatingMsg: '', updatedMsg: '', updateCancel: '', beforeunload: '', installNow: '', pluginInstallNowLabel: '', installing: '', pluginInstalled: '', themeInstalled: '', installFailedShort: '', installFailed: '', pluginInstallingLabel: '', themeInstallingLabel: '', pluginInstalledLabel: '', themeInstalledLabel: '', pluginInstallFailedLabel: '', themeInstallFailedLabel: '', installingMsg: '', installedMsg: '', importerInstalledMsg: '', aysDelete: '', aysDeleteUninstall: '', aysBulkDelete: '', aysBulkDeleteThemes: '', deleting: '', deleteFailed: '', pluginDeleted: '', themeDeleted: '', livePreview: '', activatePlugin: '', activateTheme: '', activatePluginLabel: '', activateThemeLabel: '', activateImporter: '', activateImporterLabel: '', unknownError: '', connectionError: '', nonceError: '', pluginsFound: '', noPluginsFound: '', autoUpdatesEnable: '', autoUpdatesEnabling: '', autoUpdatesEnabled: '', autoUpdatesDisable: '', autoUpdatesDisabling: '', autoUpdatesDisabled: '', autoUpdatesError: '' }; wp.updates.l10n = window.wp.deprecateL10nObject( 'wp.updates.l10n', wp.updates.l10n, '5.5.0' ); /** * User nonce for ajax calls. * * @since 4.2.0 * * @type {string} */ wp.updates.ajaxNonce = settings.ajax_nonce; /** * Current search term. * * @since 4.6.0 * * @type {string} */ wp.updates.searchTerm = ''; /** * Minimum number of characters before an ajax search is fired. * * @since 6.7.0 * * @type {number} */ wp.updates.searchMinCharacters = 2; /** * Whether filesystem credentials need to be requested from the user. * * @since 4.2.0 * * @type {bool} */ wp.updates.shouldRequestFilesystemCredentials = false; /** * Filesystem credentials to be packaged along with the request. * * @since 4.2.0 * @since 4.6.0 Added `available` property to indicate whether credentials have been provided. * * @type {Object} * @property {Object} filesystemCredentials.ftp Holds FTP credentials. * @property {string} filesystemCredentials.ftp.host FTP host. Default empty string. * @property {string} filesystemCredentials.ftp.username FTP user name. Default empty string. * @property {string} filesystemCredentials.ftp.password FTP password. Default empty string. * @property {string} filesystemCredentials.ftp.connectionType Type of FTP connection. 'ssh', 'ftp', or 'ftps'. * Default empty string. * @property {Object} filesystemCredentials.ssh Holds SSH credentials. * @property {string} filesystemCredentials.ssh.publicKey The public key. Default empty string. * @property {string} filesystemCredentials.ssh.privateKey The private key. Default empty string. * @property {string} filesystemCredentials.fsNonce Filesystem credentials form nonce. * @property {bool} filesystemCredentials.available Whether filesystem credentials have been provided. * Default 'false'. */ wp.updates.filesystemCredentials = { ftp: { host: '', username: '', password: '', connectionType: '' }, ssh: { publicKey: '', privateKey: '' }, fsNonce: '', available: false }; /** * Whether we're waiting for an Ajax request to complete. * * @since 4.2.0 * @since 4.6.0 More accurately named `ajaxLocked`. * * @type {bool} */ wp.updates.ajaxLocked = false; /** * Admin notice template. * * @since 4.6.0 * * @type {function} */ wp.updates.adminNotice = wp.template( 'wp-updates-admin-notice' ); /** * Update queue. * * If the user tries to update a plugin while an update is * already happening, it can be placed in this queue to perform later. * * @since 4.2.0 * @since 4.6.0 More accurately named `queue`. * * @type {Array.object} */ wp.updates.queue = []; /** * Holds a jQuery reference to return focus to when exiting the request credentials modal. * * @since 4.2.0 * * @type {jQuery} */ wp.updates.$elToReturnFocusToFromCredentialsModal = undefined; /** * Adds or updates an admin notice. * * @since 4.6.0 * * @param {Object} data * @param {*=} data.selector Optional. Selector of an element to be replaced with the admin notice. * @param {string=} data.id Optional. Unique id that will be used as the notice's id attribute. * @param {string=} data.className Optional. Class names that will be used in the admin notice. * @param {string=} data.message Optional. The message displayed in the notice. * @param {number=} data.successes Optional. The amount of successful operations. * @param {number=} data.errors Optional. The amount of failed operations. * @param {Array=} data.errorMessages Optional. Error messages of failed operations. * */ wp.updates.addAdminNotice = function( data ) { var $notice = $( data.selector ), $headerEnd = $( '.wp-header-end' ), $adminNotice; delete data.selector; $adminNotice = wp.updates.adminNotice( data ); // Check if this admin notice already exists. if ( ! $notice.length ) { $notice = $( '#' + data.id ); } if ( $notice.length ) { $notice.replaceWith( $adminNotice ); } else if ( $headerEnd.length ) { $headerEnd.after( $adminNotice ); } else { if ( 'customize' === pagenow ) { $( '.customize-themes-notifications' ).append( $adminNotice ); } else { $( '.wrap' ).find( '> h1' ).after( $adminNotice ); } } $document.trigger( 'wp-updates-notice-added' ); }; /** * Handles Ajax requests to WordPress. * * @since 4.6.0 * * @param {string} action The type of Ajax request ('update-plugin', 'install-theme', etc). * @param {Object} data Data that needs to be passed to the ajax callback. * @return {$.promise} A jQuery promise that represents the request, * decorated with an abort() method. */ wp.updates.ajax = function( action, data ) { var options = {}; if ( wp.updates.ajaxLocked ) { wp.updates.queue.push( { action: action, data: data } ); // Return a Deferred object so callbacks can always be registered. return $.Deferred(); } wp.updates.ajaxLocked = true; if ( data.success ) { options.success = data.success; delete data.success; } if ( data.error ) { options.error = data.error; delete data.error; } options.data = _.extend( data, { action: action, _ajax_nonce: wp.updates.ajaxNonce, _fs_nonce: wp.updates.filesystemCredentials.fsNonce, username: wp.updates.filesystemCredentials.ftp.username, password: wp.updates.filesystemCredentials.ftp.password, hostname: wp.updates.filesystemCredentials.ftp.hostname, connection_type: wp.updates.filesystemCredentials.ftp.connectionType, public_key: wp.updates.filesystemCredentials.ssh.publicKey, private_key: wp.updates.filesystemCredentials.ssh.privateKey } ); return wp.ajax.send( options ).always( wp.updates.ajaxAlways ); }; /** * Actions performed after every Ajax request. * * @since 4.6.0 * * @param {Object} response * @param {Array=} response.debug Optional. Debug information. * @param {string=} response.errorCode Optional. Error code for an error that occurred. */ wp.updates.ajaxAlways = function( response ) { if ( ! response.errorCode || 'unable_to_connect_to_filesystem' !== response.errorCode ) { wp.updates.ajaxLocked = false; wp.updates.queueChecker(); } if ( 'undefined' !== typeof response.debug && window.console && window.console.log ) { _.map( response.debug, function( message ) { // Remove all HTML tags and write a message to the console. window.console.log( wp.sanitize.stripTagsAndEncodeText( message ) ); } ); } }; /** * Refreshes update counts everywhere on the screen. * * @since 4.7.0 */ wp.updates.refreshCount = function() { var $adminBarUpdates = $( '#wp-admin-bar-updates' ), $dashboardNavMenuUpdateCount = $( 'a[href="update-core.php"] .update-plugins' ), $pluginsNavMenuUpdateCount = $( 'a[href="plugins.php"] .update-plugins' ), $appearanceNavMenuUpdateCount = $( 'a[href="themes.php"] .update-plugins' ), itemCount; $adminBarUpdates.find( '.ab-label' ).text( settings.totals.counts.total ); $adminBarUpdates.find( '.updates-available-text' ).text( sprintf( /* translators: %s: Total number of updates available. */ _n( '%s update available', '%s updates available', settings.totals.counts.total ), settings.totals.counts.total ) ); // Remove the update count from the toolbar if it's zero. if ( 0 === settings.totals.counts.total ) { $adminBarUpdates.find( '.ab-label' ).parents( 'li' ).remove(); } // Update the "Updates" menu item. $dashboardNavMenuUpdateCount.each( function( index, element ) { element.className = element.className.replace( /count-\d+/, 'count-' + settings.totals.counts.total ); } ); if ( settings.totals.counts.total > 0 ) { $dashboardNavMenuUpdateCount.find( '.update-count' ).text( settings.totals.counts.total ); } else { $dashboardNavMenuUpdateCount.remove(); } // Update the "Plugins" menu item. $pluginsNavMenuUpdateCount.each( function( index, element ) { element.className = element.className.replace( /count-\d+/, 'count-' + settings.totals.counts.plugins ); } ); if ( settings.totals.counts.total > 0 ) { $pluginsNavMenuUpdateCount.find( '.plugin-count' ).text( settings.totals.counts.plugins ); } else { $pluginsNavMenuUpdateCount.remove(); } // Update the "Appearance" menu item. $appearanceNavMenuUpdateCount.each( function( index, element ) { element.className = element.className.replace( /count-\d+/, 'count-' + settings.totals.counts.themes ); } ); if ( settings.totals.counts.total > 0 ) { $appearanceNavMenuUpdateCount.find( '.theme-count' ).text( settings.totals.counts.themes ); } else { $appearanceNavMenuUpdateCount.remove(); } // Update list table filter navigation. if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { itemCount = settings.totals.counts.plugins; } else if ( 'themes' === pagenow || 'themes-network' === pagenow ) { itemCount = settings.totals.counts.themes; } if ( itemCount > 0 ) { $( '.subsubsub .upgrade .count' ).text( '(' + itemCount + ')' ); } else { $( '.subsubsub .upgrade' ).remove(); $( '.subsubsub li:last' ).html( function() { return $( this ).children(); } ); } }; /** * Sends a message from a modal to the main screen to update buttons in plugin cards. * * @since 6.5.0 * * @param {Object} data An object of data to use for the button. * @param {string} data.slug The plugin's slug. * @param {string} data.text The text to use for the button. * @param {string} data.ariaLabel The value for the button's aria-label attribute. An empty string removes the attribute. * @param {string=} data.status Optional. An identifier for the status. * @param {string=} data.removeClasses Optional. A space-separated list of classes to remove from the button. * @param {string=} data.addClasses Optional. A space-separated list of classes to add to the button. * @param {string=} data.href Optional. The button's URL. * @param {string=} data.pluginName Optional. The plugin's name. * @param {string=} data.plugin Optional. The plugin file, relative to the plugins directory. */ wp.updates.setCardButtonStatus = function( data ) { var target = window.parent === window ? null : window.parent; $.support.postMessage = !! window.postMessage; if ( false !== $.support.postMessage && null !== target && -1 === window.parent.location.pathname.indexOf( 'index.php' ) ) { target.postMessage( JSON.stringify( data ), window.location.origin ); } }; /** * Decrements the update counts throughout the various menus. * * This includes the toolbar, the "Updates" menu item and the menu items * for plugins and themes. * * @since 3.9.0 * * @param {string} type The type of item that was updated or deleted. * Can be 'plugin', 'theme'. */ wp.updates.decrementCount = function( type ) { settings.totals.counts.total = Math.max( --settings.totals.counts.total, 0 ); if ( 'plugin' === type ) { settings.totals.counts.plugins = Math.max( --settings.totals.counts.plugins, 0 ); } else if ( 'theme' === type ) { settings.totals.counts.themes = Math.max( --settings.totals.counts.themes, 0 ); } wp.updates.refreshCount( type ); }; /** * Sends an Ajax request to the server to update a plugin. * * @since 4.2.0 * @since 4.6.0 More accurately named `updatePlugin`. * * @param {Object} args Arguments. * @param {string} args.plugin Plugin basename. * @param {string} args.slug Plugin slug. * @param {updatePluginSuccess=} args.success Optional. Success callback. Default: wp.updates.updatePluginSuccess * @param {updatePluginError=} args.error Optional. Error callback. Default: wp.updates.updatePluginError * @return {$.promise} A jQuery promise that represents the request, * decorated with an abort() method. */ wp.updates.updatePlugin = function( args ) { var $updateRow, $card, $message, message, $adminBarUpdates = $( '#wp-admin-bar-updates' ), buttonText = __( 'Updating...' ), isPluginInstall = 'plugin-install' === pagenow || 'plugin-install-network' === pagenow; args = _.extend( { success: wp.updates.updatePluginSuccess, error: wp.updates.updatePluginError }, args ); if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { $updateRow = $( 'tr[data-plugin="' + args.plugin + '"]' ); $message = $updateRow.find( '.update-message' ).removeClass( 'notice-error' ).addClass( 'updating-message notice-warning' ).find( 'p' ); message = sprintf( /* translators: %s: Plugin name and version. */ _x( 'Updating %s...', 'plugin' ), $updateRow.find( '.plugin-title strong' ).text() ); } else if ( isPluginInstall ) { $card = $( '.plugin-card-' + args.slug + ', #plugin-information-footer' ); $message = $card.find( '.update-now' ).addClass( 'updating-message' ); message = sprintf( /* translators: %s: Plugin name and version. */ _x( 'Updating %s...', 'plugin' ), $message.data( 'name' ) ); // Remove previous error messages, if any. $card.removeClass( 'plugin-card-update-failed' ).find( '.notice.notice-error' ).remove(); } $adminBarUpdates.addClass( 'spin' ); if ( $message.html() !== __( 'Updating...' ) ) { $message.data( 'originaltext', $message.html() ); } $message .attr( 'aria-label', message ) .text( buttonText ); $document.trigger( 'wp-plugin-updating', args ); if ( isPluginInstall && 'plugin-information-footer' === $card.attr( 'id' ) ) { wp.updates.setCardButtonStatus( { status: 'updating-plugin', slug: args.slug, addClasses: 'updating-message', text: buttonText, ariaLabel: message } ); } return wp.updates.ajax( 'update-plugin', args ); }; /** * Updates the UI appropriately after a successful plugin update. * * @since 4.2.0 * @since 4.6.0 More accurately named `updatePluginSuccess`. * @since 5.5.0 Auto-update "time to next update" text cleared. * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the plugin to be updated. * @param {string} response.plugin Basename of the plugin to be updated. * @param {string} response.pluginName Name of the plugin to be updated. * @param {string} response.oldVersion Old version of the plugin. * @param {string} response.newVersion New version of the plugin. */ wp.updates.updatePluginSuccess = function( response ) { var $pluginRow, $updateMessage, newText, $adminBarUpdates = $( '#wp-admin-bar-updates' ), buttonText = _x( 'Updated!', 'plugin' ), ariaLabel = sprintf( /* translators: %s: Plugin name and version. */ _x( '%s updated!', 'plugin' ), response.pluginName ); if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { $pluginRow = $( 'tr[data-plugin="' + response.plugin + '"]' ) .removeClass( 'update is-enqueued' ) .addClass( 'updated' ); $updateMessage = $pluginRow.find( '.update-message' ) .removeClass( 'updating-message notice-warning' ) .addClass( 'updated-message notice-success' ).find( 'p' ); // Update the version number in the row. newText = $pluginRow.find( '.plugin-version-author-uri' ).html().replace( response.oldVersion, response.newVersion ); $pluginRow.find( '.plugin-version-author-uri' ).html( newText ); // Clear the "time to next auto-update" text. $pluginRow.find( '.auto-update-time' ).empty(); } else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) { $updateMessage = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.update-now' ) .removeClass( 'updating-message' ) .addClass( 'button-disabled updated-message' ); } $adminBarUpdates.removeClass( 'spin' ); $updateMessage .attr( 'aria-label', ariaLabel ) .text( buttonText ); wp.a11y.speak( __( 'Update completed successfully.' ) ); if ( 'plugin_install_from_iframe' !== $updateMessage.attr( 'id' ) ) { wp.updates.decrementCount( 'plugin' ); } else { wp.updates.setCardButtonStatus( { status: 'updated-plugin', slug: response.slug, removeClasses: 'updating-message', addClasses: 'button-disabled updated-message', text: buttonText, ariaLabel: ariaLabel } ); } $document.trigger( 'wp-plugin-update-success', response ); }; /** * Updates the UI appropriately after a failed plugin update. * * @since 4.2.0 * @since 4.6.0 More accurately named `updatePluginError`. * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the plugin to be updated. * @param {string} response.plugin Basename of the plugin to be updated. * @param {string=} response.pluginName Optional. Name of the plugin to be updated. * @param {string} response.errorCode Error code for the error that occurred. * @param {string} response.errorMessage The error that occurred. */ wp.updates.updatePluginError = function( response ) { var $pluginRow, $card, $message, errorMessage, buttonText, ariaLabel, $adminBarUpdates = $( '#wp-admin-bar-updates' ); if ( ! wp.updates.isValidResponse( response, 'update' ) ) { return; } if ( wp.updates.maybeHandleCredentialError( response, 'update-plugin' ) ) { return; } errorMessage = sprintf( /* translators: %s: Error string for a failed update. */ __( 'Update failed: %s' ), response.errorMessage ); if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { $pluginRow = $( 'tr[data-plugin="' + response.plugin + '"]' ).removeClass( 'is-enqueued' ); if ( response.plugin ) { $message = $( 'tr[data-plugin="' + response.plugin + '"]' ).find( '.update-message' ); } else { $message = $( 'tr[data-slug="' + response.slug + '"]' ).find( '.update-message' ); } $message.removeClass( 'updating-message notice-warning' ).addClass( 'notice-error' ).find( 'p' ).html( errorMessage ); if ( response.pluginName ) { $message.find( 'p' ) .attr( 'aria-label', sprintf( /* translators: %s: Plugin name and version. */ _x( '%s update failed.', 'plugin' ), response.pluginName ) ); } else { $message.find( 'p' ).removeAttr( 'aria-label' ); } } else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) { buttonText = __( 'Update failed.' ); $card = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ) .append( wp.updates.adminNotice( { className: 'update-message notice-error notice-alt is-dismissible', message: errorMessage } ) ); if ( $card.hasClass( 'plugin-card-' + response.slug ) ) { $card.addClass( 'plugin-card-update-failed' ); } $card.find( '.update-now' ) .text( buttonText ) .removeClass( 'updating-message' ); if ( response.pluginName ) { ariaLabel = sprintf( /* translators: %s: Plugin name and version. */ _x( '%s update failed.', 'plugin' ), response.pluginName ); $card.find( '.update-now' ).attr( 'aria-label', ariaLabel ); } else { ariaLabel = ''; $card.find( '.update-now' ).removeAttr( 'aria-label' ); } $card.on( 'click', '.notice.is-dismissible .notice-dismiss', function() { // Use same delay as the total duration of the notice fadeTo + slideUp animation. setTimeout( function() { $card .removeClass( 'plugin-card-update-failed' ) .find( '.column-name a' ).trigger( 'focus' ); $card.find( '.update-now' ) .attr( 'aria-label', false ) .text( __( 'Update Now' ) ); }, 200 ); } ); } $adminBarUpdates.removeClass( 'spin' ); wp.a11y.speak( errorMessage, 'assertive' ); if ( 'plugin-information-footer' === $card.attr('id' ) ) { wp.updates.setCardButtonStatus( { status: 'plugin-update-failed', slug: response.slug, removeClasses: 'updating-message', text: buttonText, ariaLabel: ariaLabel } ); } $document.trigger( 'wp-plugin-update-error', response ); }; /** * Sends an Ajax request to the server to install a plugin. * * @since 4.6.0 * * @param {Object} args Arguments. * @param {string} args.slug Plugin identifier in the WordPress.org Plugin repository. * @param {installPluginSuccess=} args.success Optional. Success callback. Default: wp.updates.installPluginSuccess * @param {installPluginError=} args.error Optional. Error callback. Default: wp.updates.installPluginError * @return {$.promise} A jQuery promise that represents the request, * decorated with an abort() method. */ wp.updates.installPlugin = function( args ) { var $card = $( '.plugin-card-' + args.slug + ', #plugin-information-footer' ), $message = $card.find( '.install-now' ), buttonText = __( 'Installing...' ), ariaLabel; args = _.extend( { success: wp.updates.installPluginSuccess, error: wp.updates.installPluginError }, args ); if ( 'import' === pagenow ) { $message = $( '[data-slug="' + args.slug + '"]' ); } if ( $message.html() !== __( 'Installing...' ) ) { $message.data( 'originaltext', $message.html() ); } ariaLabel = sprintf( /* translators: %s: Plugin name and version. */ _x( 'Installing %s...', 'plugin' ), $message.data( 'name' ) ); $message .addClass( 'updating-message' ) .attr( 'aria-label', ariaLabel ) .text( buttonText ); wp.a11y.speak( __( 'Installing... please wait.' ) ); // Remove previous error messages, if any. $card.removeClass( 'plugin-card-install-failed' ).find( '.notice.notice-error' ).remove(); $document.trigger( 'wp-plugin-installing', args ); if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) { wp.updates.setCardButtonStatus( { status: 'installing-plugin', slug: args.slug, addClasses: 'updating-message', text: buttonText, ariaLabel: ariaLabel } ); } return wp.updates.ajax( 'install-plugin', args ); }; /** * Updates the UI appropriately after a successful plugin install. * * @since 4.6.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the installed plugin. * @param {string} response.pluginName Name of the installed plugin. * @param {string} response.activateUrl URL to activate the just installed plugin. */ wp.updates.installPluginSuccess = function( response ) { var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.install-now' ), buttonText = _x( 'Installed!', 'plugin' ), ariaLabel = sprintf( /* translators: %s: Plugin name and version. */ _x( '%s installed!', 'plugin' ), response.pluginName ); $message .removeClass( 'updating-message' ) .addClass( 'updated-message installed button-disabled' ) .attr( 'aria-label', ariaLabel ) .text( buttonText ); wp.a11y.speak( __( 'Installation completed successfully.' ) ); $document.trigger( 'wp-plugin-install-success', response ); if ( response.activateUrl ) { setTimeout( function() { wp.updates.checkPluginDependencies( { slug: response.slug } ); }, 1000 ); } if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) { wp.updates.setCardButtonStatus( { status: 'installed-plugin', slug: response.slug, removeClasses: 'updating-message', addClasses: 'updated-message installed button-disabled', text: buttonText, ariaLabel: ariaLabel } ); } }; /** * Updates the UI appropriately after a failed plugin install. * * @since 4.6.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the plugin to be installed. * @param {string=} response.pluginName Optional. Name of the plugin to be installed. * @param {string} response.errorCode Error code for the error that occurred. * @param {string} response.errorMessage The error that occurred. */ wp.updates.installPluginError = function( response ) { var $card = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ), $button = $card.find( '.install-now' ), buttonText = __( 'Installation failed.' ), ariaLabel = sprintf( /* translators: %s: Plugin name and version. */ _x( '%s installation failed', 'plugin' ), $button.data( 'name' ) ), errorMessage; if ( ! wp.updates.isValidResponse( response, 'install' ) ) { return; } if ( wp.updates.maybeHandleCredentialError( response, 'install-plugin' ) ) { return; } errorMessage = sprintf( /* translators: %s: Error string for a failed installation. */ __( 'Installation failed: %s' ), response.errorMessage ); $card .addClass( 'plugin-card-update-failed' ) .append( '' ); $card.on( 'click', '.notice.is-dismissible .notice-dismiss', function() { // Use same delay as the total duration of the notice fadeTo + slideUp animation. setTimeout( function() { $card .removeClass( 'plugin-card-update-failed' ) .find( '.column-name a' ).trigger( 'focus' ); }, 200 ); } ); $button .removeClass( 'updating-message' ).addClass( 'button-disabled' ) .attr( 'aria-label', ariaLabel ) .text( buttonText ); wp.a11y.speak( errorMessage, 'assertive' ); wp.updates.setCardButtonStatus( { status: 'plugin-install-failed', slug: response.slug, removeClasses: 'updating-message', addClasses: 'button-disabled', text: buttonText, ariaLabel: ariaLabel } ); $document.trigger( 'wp-plugin-install-error', response ); }; /** * Sends an Ajax request to the server to check a plugin's dependencies. * * @since 6.5.0 * * @param {Object} args Arguments. * @param {string} args.slug Plugin identifier in the WordPress.org Plugin repository. * @param {checkPluginDependenciesSuccess=} args.success Optional. Success callback. Default: wp.updates.checkPluginDependenciesSuccess * @param {checkPluginDependenciesError=} args.error Optional. Error callback. Default: wp.updates.checkPluginDependenciesError * @return {$.promise} A jQuery promise that represents the request, * decorated with an abort() method. */ wp.updates.checkPluginDependencies = function( args ) { args = _.extend( { success: wp.updates.checkPluginDependenciesSuccess, error: wp.updates.checkPluginDependenciesError }, args ); wp.a11y.speak( __( 'Checking plugin dependencies... please wait.' ) ); $document.trigger( 'wp-checking-plugin-dependencies', args ); return wp.updates.ajax( 'check_plugin_dependencies', args ); }; /** * Updates the UI appropriately after a successful plugin dependencies check. * * @since 6.5.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the checked plugin. * @param {string} response.pluginName Name of the checked plugin. * @param {string} response.plugin The plugin file, relative to the plugins directory. * @param {string} response.activateUrl URL to activate the just checked plugin. */ wp.updates.checkPluginDependenciesSuccess = function( response ) { var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.install-now' ), buttonText, ariaLabel; // Transform the 'Install' button into an 'Activate' button. $message .removeClass( 'install-now installed button-disabled updated-message' ) .addClass( 'activate-now button-primary' ) .attr( 'href', response.activateUrl ); wp.a11y.speak( __( 'Plugin dependencies check completed successfully.' ) ); $document.trigger( 'wp-check-plugin-dependencies-success', response ); if ( 'plugins-network' === pagenow ) { buttonText = _x( 'Network Activate', 'plugin' ); ariaLabel = sprintf( /* translators: %s: Plugin name. */ _x( 'Network Activate %s', 'plugin' ), response.pluginName ); $message .attr( 'aria-label', ariaLabel ) .text( buttonText ); } else { buttonText = _x( 'Activate', 'plugin' ); ariaLabel = sprintf( /* translators: %s: Plugin name. */ _x( 'Activate %s', 'plugin' ), response.pluginName ); $message .attr( 'aria-label', ariaLabel ) .attr( 'data-name', response.pluginName ) .attr( 'data-slug', response.slug ) .attr( 'data-plugin', response.plugin ) .text( buttonText ); } if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) { wp.updates.setCardButtonStatus( { status: 'dependencies-check-success', slug: response.slug, removeClasses: 'install-now installed button-disabled updated-message', addClasses: 'activate-now button-primary', text: buttonText, ariaLabel: ariaLabel, pluginName: response.pluginName, plugin: response.plugin, href: response.activateUrl } ); } }; /** * Updates the UI appropriately after a failed plugin dependencies check. * * @since 6.5.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the plugin to be checked. * @param {string=} response.pluginName Optional. Name of the plugin to be checked. * @param {string} response.errorCode Error code for the error that occurred. * @param {string} response.errorMessage The error that occurred. */ wp.updates.checkPluginDependenciesError = function( response ) { var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.install-now' ), buttonText = _x( 'Activate', 'plugin' ), ariaLabel = sprintf( /* translators: 1: Plugin name, 2. The reason the plugin cannot be activated. */ _x( 'Cannot activate %1$s. %2$s', 'plugin' ), response.pluginName, response.errorMessage ), errorMessage; if ( ! wp.updates.isValidResponse( response, 'check-dependencies' ) ) { return; } errorMessage = sprintf( /* translators: %s: Error string for a failed activation. */ __( 'Activation failed: %s' ), response.errorMessage ); wp.a11y.speak( errorMessage, 'assertive' ); $document.trigger( 'wp-check-plugin-dependencies-error', response ); $message .removeClass( 'install-now installed updated-message' ) .addClass( 'activate-now button-primary' ) .attr( 'aria-label', ariaLabel ) .text( buttonText ); if ( 'plugin-information-footer' === $message.parent().attr('id' ) ) { wp.updates.setCardButtonStatus( { status: 'dependencies-check-failed', slug: response.slug, removeClasses: 'install-now installed updated-message', addClasses: 'activate-now button-primary', text: buttonText, ariaLabel: ariaLabel } ); } }; /** * Sends an Ajax request to the server to activate a plugin. * * @since 6.5.0 * * @param {Object} args Arguments. * @param {string} args.name The name of the plugin. * @param {string} args.slug Plugin identifier in the WordPress.org Plugin repository. * @param {string} args.plugin The plugin file, relative to the plugins directory. * @param {activatePluginSuccess=} args.success Optional. Success callback. Default: wp.updates.activatePluginSuccess * @param {activatePluginError=} args.error Optional. Error callback. Default: wp.updates.activatePluginError * @return {$.promise} A jQuery promise that represents the request, * decorated with an abort() method. */ wp.updates.activatePlugin = function( args ) { var $message = $( '.plugin-card-' + args.slug + ', #plugin-information-footer' ).find( '.activate-now, .activating-message' ); args = _.extend( { success: wp.updates.activatePluginSuccess, error: wp.updates.activatePluginError }, args ); wp.a11y.speak( __( 'Activating... please wait.' ) ); $document.trigger( 'wp-activating-plugin', args ); if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) { wp.updates.setCardButtonStatus( { status: 'activating-plugin', slug: args.slug, removeClasses: 'installed updated-message button-primary', addClasses: 'activating-message', text: __( 'Activating...' ), ariaLabel: sprintf( /* translators: %s: Plugin name. */ _x( 'Activating %s', 'plugin' ), args.name ) } ); } return wp.updates.ajax( 'activate-plugin', args ); }; /** * Updates the UI appropriately after a successful plugin activation. * * @since 6.5.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the activated plugin. * @param {string} response.pluginName Name of the activated plugin. * @param {string} response.plugin The plugin file, relative to the plugins directory. */ wp.updates.activatePluginSuccess = function( response ) { var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.activating-message' ), buttonText = _x( 'Activated!', 'plugin' ), ariaLabel = sprintf( /* translators: %s: The plugin name. */ '%s activated successfully.', response.pluginName ); wp.a11y.speak( __( 'Activation completed successfully.' ) ); $document.trigger( 'wp-plugin-activate-success', response ); $message .removeClass( 'activating-message' ) .addClass( 'activated-message button-disabled' ) .attr( 'aria-label', ariaLabel ) .text( buttonText ); if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) { wp.updates.setCardButtonStatus( { status: 'activated-plugin', slug: response.slug, removeClasses: 'activating-message', addClasses: 'activated-message button-disabled', text: buttonText, ariaLabel: ariaLabel } ); } setTimeout( function() { $message.removeClass( 'activated-message' ) .text( _x( 'Active', 'plugin' ) ); if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) { wp.updates.setCardButtonStatus( { status: 'plugin-active', slug: response.slug, removeClasses: 'activated-message', text: _x( 'Active', 'plugin' ), ariaLabel: sprintf( /* translators: %s: The plugin name. */ '%s is active.', response.pluginName ) } ); } }, 1000 ); }; /** * Updates the UI appropriately after a failed plugin activation. * * @since 6.5.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the plugin to be activated. * @param {string=} response.pluginName Optional. Name of the plugin to be activated. * @param {string} response.errorCode Error code for the error that occurred. * @param {string} response.errorMessage The error that occurred. */ wp.updates.activatePluginError = function( response ) { var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.activating-message' ), buttonText = __( 'Activation failed.' ), ariaLabel = sprintf( /* translators: %s: Plugin name. */ _x( '%s activation failed', 'plugin' ), response.pluginName ), errorMessage; if ( ! wp.updates.isValidResponse( response, 'activate' ) ) { return; } errorMessage = sprintf( /* translators: %s: Error string for a failed activation. */ __( 'Activation failed: %s' ), response.errorMessage ); wp.a11y.speak( errorMessage, 'assertive' ); $document.trigger( 'wp-plugin-activate-error', response ); $message .removeClass( 'install-now installed activating-message' ) .addClass( 'button-disabled' ) .attr( 'aria-label', ariaLabel ) .text( buttonText ); if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) { wp.updates.setCardButtonStatus( { status: 'plugin-activation-failed', slug: response.slug, removeClasses: 'install-now installed activating-message', addClasses: 'button-disabled', text: buttonText, ariaLabel: ariaLabel } ); } }; /** * Updates the UI appropriately after a successful importer install. * * @since 4.6.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the installed plugin. * @param {string} response.pluginName Name of the installed plugin. * @param {string} response.activateUrl URL to activate the just installed plugin. */ wp.updates.installImporterSuccess = function( response ) { wp.updates.addAdminNotice( { id: 'install-success', className: 'notice-success is-dismissible', message: sprintf( /* translators: %s: Activation URL. */ __( 'Importer installed successfully. Run importer' ), response.activateUrl + '&from=import' ) } ); $( '[data-slug="' + response.slug + '"]' ) .removeClass( 'install-now updating-message' ) .addClass( 'activate-now' ) .attr({ 'href': response.activateUrl + '&from=import', 'aria-label':sprintf( /* translators: %s: Importer name. */ __( 'Run %s' ), response.pluginName ) }) .text( __( 'Run Importer' ) ); wp.a11y.speak( __( 'Installation completed successfully.' ) ); $document.trigger( 'wp-importer-install-success', response ); }; /** * Updates the UI appropriately after a failed importer install. * * @since 4.6.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the plugin to be installed. * @param {string=} response.pluginName Optional. Name of the plugin to be installed. * @param {string} response.errorCode Error code for the error that occurred. * @param {string} response.errorMessage The error that occurred. */ wp.updates.installImporterError = function( response ) { var errorMessage = sprintf( /* translators: %s: Error string for a failed installation. */ __( 'Installation failed: %s' ), response.errorMessage ), $installLink = $( '[data-slug="' + response.slug + '"]' ), pluginName = $installLink.data( 'name' ); if ( ! wp.updates.isValidResponse( response, 'install' ) ) { return; } if ( wp.updates.maybeHandleCredentialError( response, 'install-plugin' ) ) { return; } wp.updates.addAdminNotice( { id: response.errorCode, className: 'notice-error is-dismissible', message: errorMessage } ); $installLink .removeClass( 'updating-message' ) .attr( 'aria-label', sprintf( /* translators: %s: Plugin name. */ _x( 'Install %s now', 'plugin' ), pluginName ) ) .text( _x( 'Install Now', 'plugin' ) ); wp.a11y.speak( errorMessage, 'assertive' ); $document.trigger( 'wp-importer-install-error', response ); }; /** * Sends an Ajax request to the server to delete a plugin. * * @since 4.6.0 * * @param {Object} args Arguments. * @param {string} args.plugin Basename of the plugin to be deleted. * @param {string} args.slug Slug of the plugin to be deleted. * @param {deletePluginSuccess=} args.success Optional. Success callback. Default: wp.updates.deletePluginSuccess * @param {deletePluginError=} args.error Optional. Error callback. Default: wp.updates.deletePluginError * @return {$.promise} A jQuery promise that represents the request, * decorated with an abort() method. */ wp.updates.deletePlugin = function( args ) { var $link = $( '[data-plugin="' + args.plugin + '"]' ).find( '.row-actions a.delete' ); args = _.extend( { success: wp.updates.deletePluginSuccess, error: wp.updates.deletePluginError }, args ); if ( $link.html() !== __( 'Deleting...' ) ) { $link .data( 'originaltext', $link.html() ) .text( __( 'Deleting...' ) ); } wp.a11y.speak( __( 'Deleting...' ) ); $document.trigger( 'wp-plugin-deleting', args ); return wp.updates.ajax( 'delete-plugin', args ); }; /** * Updates the UI appropriately after a successful plugin deletion. * * @since 4.6.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the plugin that was deleted. * @param {string} response.plugin Base name of the plugin that was deleted. * @param {string} response.pluginName Name of the plugin that was deleted. */ wp.updates.deletePluginSuccess = function( response ) { // Removes the plugin and updates rows. $( '[data-plugin="' + response.plugin + '"]' ).css( { backgroundColor: '#faafaa' } ).fadeOut( 350, function() { var $form = $( '#bulk-action-form' ), $views = $( '.subsubsub' ), $pluginRow = $( this ), $currentView = $views.find( '[aria-current="page"]' ), $itemsCount = $( '.displaying-num' ), columnCount = $form.find( 'thead th:not(.hidden), thead td' ).length, pluginDeletedRow = wp.template( 'item-deleted-row' ), /** * Plugins Base names of plugins in their different states. * * @type {Object} */ plugins = settings.plugins, remainingCount; // Add a success message after deleting a plugin. if ( ! $pluginRow.hasClass( 'plugin-update-tr' ) ) { $pluginRow.after( pluginDeletedRow( { slug: response.slug, plugin: response.plugin, colspan: columnCount, name: response.pluginName } ) ); } $pluginRow.remove(); // Remove plugin from update count. if ( -1 !== _.indexOf( plugins.upgrade, response.plugin ) ) { plugins.upgrade = _.without( plugins.upgrade, response.plugin ); wp.updates.decrementCount( 'plugin' ); } // Remove from views. if ( -1 !== _.indexOf( plugins.inactive, response.plugin ) ) { plugins.inactive = _.without( plugins.inactive, response.plugin ); if ( plugins.inactive.length ) { $views.find( '.inactive .count' ).text( '(' + plugins.inactive.length + ')' ); } else { $views.find( '.inactive' ).remove(); } } if ( -1 !== _.indexOf( plugins.active, response.plugin ) ) { plugins.active = _.without( plugins.active, response.plugin ); if ( plugins.active.length ) { $views.find( '.active .count' ).text( '(' + plugins.active.length + ')' ); } else { $views.find( '.active' ).remove(); } } if ( -1 !== _.indexOf( plugins.recently_activated, response.plugin ) ) { plugins.recently_activated = _.without( plugins.recently_activated, response.plugin ); if ( plugins.recently_activated.length ) { $views.find( '.recently_activated .count' ).text( '(' + plugins.recently_activated.length + ')' ); } else { $views.find( '.recently_activated' ).remove(); } } if ( -1 !== _.indexOf( plugins['auto-update-enabled'], response.plugin ) ) { plugins['auto-update-enabled'] = _.without( plugins['auto-update-enabled'], response.plugin ); if ( plugins['auto-update-enabled'].length ) { $views.find( '.auto-update-enabled .count' ).text( '(' + plugins['auto-update-enabled'].length + ')' ); } else { $views.find( '.auto-update-enabled' ).remove(); } } if ( -1 !== _.indexOf( plugins['auto-update-disabled'], response.plugin ) ) { plugins['auto-update-disabled'] = _.without( plugins['auto-update-disabled'], response.plugin ); if ( plugins['auto-update-disabled'].length ) { $views.find( '.auto-update-disabled .count' ).text( '(' + plugins['auto-update-disabled'].length + ')' ); } else { $views.find( '.auto-update-disabled' ).remove(); } } plugins.all = _.without( plugins.all, response.plugin ); if ( plugins.all.length ) { $views.find( '.all .count' ).text( '(' + plugins.all.length + ')' ); } else { $form.find( '.tablenav' ).css( { visibility: 'hidden' } ); $views.find( '.all' ).remove(); if ( ! $form.find( 'tr.no-items' ).length ) { $form.find( '#the-list' ).append( '' + __( 'No plugins are currently available.' ) + '' ); } } if ( $itemsCount.length && $currentView.length ) { remainingCount = plugins[ $currentView.parent( 'li' ).attr('class') ].length; $itemsCount.text( sprintf( /* translators: %s: The remaining number of plugins. */ _nx( '%s item', '%s items', remainingCount, 'plugin/plugins' ), remainingCount ) ); } } ); wp.a11y.speak( _x( 'Deleted!', 'plugin' ) ); $document.trigger( 'wp-plugin-delete-success', response ); }; /** * Updates the UI appropriately after a failed plugin deletion. * * @since 4.6.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the plugin to be deleted. * @param {string} response.plugin Base name of the plugin to be deleted * @param {string=} response.pluginName Optional. Name of the plugin to be deleted. * @param {string} response.errorCode Error code for the error that occurred. * @param {string} response.errorMessage The error that occurred. */ wp.updates.deletePluginError = function( response ) { var $plugin, $pluginUpdateRow, pluginUpdateRow = wp.template( 'item-update-row' ), noticeContent = wp.updates.adminNotice( { className: 'update-message notice-error notice-alt', message: response.errorMessage } ); if ( response.plugin ) { $plugin = $( 'tr.inactive[data-plugin="' + response.plugin + '"]' ); $pluginUpdateRow = $plugin.siblings( '[data-plugin="' + response.plugin + '"]' ); } else { $plugin = $( 'tr.inactive[data-slug="' + response.slug + '"]' ); $pluginUpdateRow = $plugin.siblings( '[data-slug="' + response.slug + '"]' ); } if ( ! wp.updates.isValidResponse( response, 'delete' ) ) { return; } if ( wp.updates.maybeHandleCredentialError( response, 'delete-plugin' ) ) { return; } // Add a plugin update row if it doesn't exist yet. if ( ! $pluginUpdateRow.length ) { $plugin.addClass( 'update' ).after( pluginUpdateRow( { slug: response.slug, plugin: response.plugin || response.slug, colspan: $( '#bulk-action-form' ).find( 'thead th:not(.hidden), thead td' ).length, content: noticeContent } ) ); } else { // Remove previous error messages, if any. $pluginUpdateRow.find( '.notice-error' ).remove(); $pluginUpdateRow.find( '.plugin-update' ).append( noticeContent ); } $document.trigger( 'wp-plugin-delete-error', response ); }; /** * Sends an Ajax request to the server to update a theme. * * @since 4.6.0 * * @param {Object} args Arguments. * @param {string} args.slug Theme stylesheet. * @param {updateThemeSuccess=} args.success Optional. Success callback. Default: wp.updates.updateThemeSuccess * @param {updateThemeError=} args.error Optional. Error callback. Default: wp.updates.updateThemeError * @return {$.promise} A jQuery promise that represents the request, * decorated with an abort() method. */ wp.updates.updateTheme = function( args ) { var $notice; args = _.extend( { success: wp.updates.updateThemeSuccess, error: wp.updates.updateThemeError }, args ); if ( 'themes-network' === pagenow ) { $notice = $( '[data-slug="' + args.slug + '"]' ).find( '.update-message' ).removeClass( 'notice-error' ).addClass( 'updating-message notice-warning' ).find( 'p' ); } else if ( 'customize' === pagenow ) { // Update the theme details UI. $notice = $( '[data-slug="' + args.slug + '"].notice' ).removeClass( 'notice-large' ); $notice.find( 'h3' ).remove(); // Add the top-level UI, and update both. $notice = $notice.add( $( '#customize-control-installed_theme_' + args.slug ).find( '.update-message' ) ); $notice = $notice.addClass( 'updating-message' ).find( 'p' ); } else { $notice = $( '#update-theme' ).closest( '.notice' ).removeClass( 'notice-large' ); $notice.find( 'h3' ).remove(); $notice = $notice.add( $( '[data-slug="' + args.slug + '"]' ).find( '.update-message' ) ); $notice = $notice.addClass( 'updating-message' ).find( 'p' ); } if ( $notice.html() !== __( 'Updating...' ) ) { $notice.data( 'originaltext', $notice.html() ); } wp.a11y.speak( __( 'Updating... please wait.' ) ); $notice.text( __( 'Updating...' ) ); $document.trigger( 'wp-theme-updating', args ); return wp.updates.ajax( 'update-theme', args ); }; /** * Updates the UI appropriately after a successful theme update. * * @since 4.6.0 * @since 5.5.0 Auto-update "time to next update" text cleared. * * @param {Object} response * @param {string} response.slug Slug of the theme to be updated. * @param {Object} response.theme Updated theme. * @param {string} response.oldVersion Old version of the theme. * @param {string} response.newVersion New version of the theme. */ wp.updates.updateThemeSuccess = function( response ) { var isModalOpen = $( 'body.modal-open' ).length, $theme = $( '[data-slug="' + response.slug + '"]' ), updatedMessage = { className: 'updated-message notice-success notice-alt', message: _x( 'Updated!', 'theme' ) }, $notice, newText; if ( 'customize' === pagenow ) { $theme = $( '.updating-message' ).siblings( '.theme-name' ); if ( $theme.length ) { // Update the version number in the row. newText = $theme.html().replace( response.oldVersion, response.newVersion ); $theme.html( newText ); } $notice = $( '.theme-info .notice' ).add( wp.customize.control( 'installed_theme_' + response.slug ).container.find( '.theme' ).find( '.update-message' ) ); } else if ( 'themes-network' === pagenow ) { $notice = $theme.find( '.update-message' ); // Update the version number in the row. newText = $theme.find( '.theme-version-author-uri' ).html().replace( response.oldVersion, response.newVersion ); $theme.find( '.theme-version-author-uri' ).html( newText ); // Clear the "time to next auto-update" text. $theme.find( '.auto-update-time' ).empty(); } else { $notice = $( '.theme-info .notice' ).add( $theme.find( '.update-message' ) ); // Focus on Customize button after updating. if ( isModalOpen ) { $( '.load-customize:visible' ).trigger( 'focus' ); $( '.theme-info .theme-autoupdate' ).find( '.auto-update-time' ).empty(); } else { $theme.find( '.load-customize' ).trigger( 'focus' ); } } wp.updates.addAdminNotice( _.extend( { selector: $notice }, updatedMessage ) ); wp.a11y.speak( __( 'Update completed successfully.' ) ); wp.updates.decrementCount( 'theme' ); $document.trigger( 'wp-theme-update-success', response ); // Show updated message after modal re-rendered. if ( isModalOpen && 'customize' !== pagenow ) { $( '.theme-info .theme-author' ).after( wp.updates.adminNotice( updatedMessage ) ); } }; /** * Updates the UI appropriately after a failed theme update. * * @since 4.6.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the theme to be updated. * @param {string} response.errorCode Error code for the error that occurred. * @param {string} response.errorMessage The error that occurred. */ wp.updates.updateThemeError = function( response ) { var $theme = $( '[data-slug="' + response.slug + '"]' ), errorMessage = sprintf( /* translators: %s: Error string for a failed update. */ __( 'Update failed: %s' ), response.errorMessage ), $notice; if ( ! wp.updates.isValidResponse( response, 'update' ) ) { return; } if ( wp.updates.maybeHandleCredentialError( response, 'update-theme' ) ) { return; } if ( 'customize' === pagenow ) { $theme = wp.customize.control( 'installed_theme_' + response.slug ).container.find( '.theme' ); } if ( 'themes-network' === pagenow ) { $notice = $theme.find( '.update-message ' ); } else { $notice = $( '.theme-info .notice' ).add( $theme.find( '.notice' ) ); $( 'body.modal-open' ).length ? $( '.load-customize:visible' ).trigger( 'focus' ) : $theme.find( '.load-customize' ).trigger( 'focus'); } wp.updates.addAdminNotice( { selector: $notice, className: 'update-message notice-error notice-alt is-dismissible', message: errorMessage } ); wp.a11y.speak( errorMessage ); $document.trigger( 'wp-theme-update-error', response ); }; /** * Sends an Ajax request to the server to install a theme. * * @since 4.6.0 * * @param {Object} args * @param {string} args.slug Theme stylesheet. * @param {installThemeSuccess=} args.success Optional. Success callback. Default: wp.updates.installThemeSuccess * @param {installThemeError=} args.error Optional. Error callback. Default: wp.updates.installThemeError * @return {$.promise} A jQuery promise that represents the request, * decorated with an abort() method. */ wp.updates.installTheme = function( args ) { var $message = $( '.theme-install[data-slug="' + args.slug + '"]' ); args = _.extend( { success: wp.updates.installThemeSuccess, error: wp.updates.installThemeError }, args ); $message.addClass( 'updating-message' ); $message.parents( '.theme' ).addClass( 'focus' ); if ( $message.html() !== __( 'Installing...' ) ) { $message.data( 'originaltext', $message.html() ); } $message .attr( 'aria-label', sprintf( /* translators: %s: Theme name and version. */ _x( 'Installing %s...', 'theme' ), $message.data( 'name' ) ) ) .text( __( 'Installing...' ) ); wp.a11y.speak( __( 'Installing... please wait.' ) ); // Remove previous error messages, if any. $( '.install-theme-info, [data-slug="' + args.slug + '"]' ).removeClass( 'theme-install-failed' ).find( '.notice.notice-error' ).remove(); $document.trigger( 'wp-theme-installing', args ); return wp.updates.ajax( 'install-theme', args ); }; /** * Updates the UI appropriately after a successful theme install. * * @since 4.6.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the theme to be installed. * @param {string} response.customizeUrl URL to the Customizer for the just installed theme. * @param {string} response.activateUrl URL to activate the just installed theme. */ wp.updates.installThemeSuccess = function( response ) { var $card = $( '.wp-full-overlay-header, [data-slug=' + response.slug + ']' ), $message; $document.trigger( 'wp-theme-install-success', response ); $message = $card.find( '.button-primary' ) .removeClass( 'updating-message' ) .addClass( 'updated-message disabled' ) .attr( 'aria-label', sprintf( /* translators: %s: Theme name and version. */ _x( '%s installed!', 'theme' ), response.themeName ) ) .text( _x( 'Installed!', 'theme' ) ); wp.a11y.speak( __( 'Installation completed successfully.' ) ); setTimeout( function() { if ( response.activateUrl ) { // Transform the 'Install' button into an 'Activate' button. $message .attr( 'href', response.activateUrl ) .removeClass( 'theme-install updated-message disabled' ) .addClass( 'activate' ); if ( 'themes-network' === pagenow ) { $message .attr( 'aria-label', sprintf( /* translators: %s: Theme name. */ _x( 'Network Activate %s', 'theme' ), response.themeName ) ) .text( __( 'Network Enable' ) ); } else { $message .attr( 'aria-label', sprintf( /* translators: %s: Theme name. */ _x( 'Activate %s', 'theme' ), response.themeName ) ) .text( _x( 'Activate', 'theme' ) ); } } if ( response.customizeUrl ) { // Transform the 'Preview' button into a 'Live Preview' button. $message.siblings( '.preview' ).replaceWith( function () { return $( '' ) .attr( 'href', response.customizeUrl ) .addClass( 'button load-customize' ) .text( __( 'Live Preview' ) ); } ); } }, 1000 ); }; /** * Updates the UI appropriately after a failed theme install. * * @since 4.6.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the theme to be installed. * @param {string} response.errorCode Error code for the error that occurred. * @param {string} response.errorMessage The error that occurred. */ wp.updates.installThemeError = function( response ) { var $card, $button, errorMessage = sprintf( /* translators: %s: Error string for a failed installation. */ __( 'Installation failed: %s' ), response.errorMessage ), $message = wp.updates.adminNotice( { className: 'update-message notice-error notice-alt', message: errorMessage } ); if ( ! wp.updates.isValidResponse( response, 'install' ) ) { return; } if ( wp.updates.maybeHandleCredentialError( response, 'install-theme' ) ) { return; } if ( 'customize' === pagenow ) { if ( $document.find( 'body' ).hasClass( 'modal-open' ) ) { $button = $( '.theme-install[data-slug="' + response.slug + '"]' ); $card = $( '.theme-overlay .theme-info' ).prepend( $message ); } else { $button = $( '.theme-install[data-slug="' + response.slug + '"]' ); $card = $button.closest( '.theme' ).addClass( 'theme-install-failed' ).append( $message ); } wp.customize.notifications.remove( 'theme_installing' ); } else { if ( $document.find( 'body' ).hasClass( 'full-overlay-active' ) ) { $button = $( '.theme-install[data-slug="' + response.slug + '"]' ); $card = $( '.install-theme-info' ).prepend( $message ); } else { $card = $( '[data-slug="' + response.slug + '"]' ).removeClass( 'focus' ).addClass( 'theme-install-failed' ).append( $message ); $button = $card.find( '.theme-install' ); } } $button .removeClass( 'updating-message' ) .attr( 'aria-label', sprintf( /* translators: %s: Theme name and version. */ _x( '%s installation failed', 'theme' ), $button.data( 'name' ) ) ) .text( __( 'Installation failed.' ) ); wp.a11y.speak( errorMessage, 'assertive' ); $document.trigger( 'wp-theme-install-error', response ); }; /** * Sends an Ajax request to the server to delete a theme. * * @since 4.6.0 * * @param {Object} args * @param {string} args.slug Theme stylesheet. * @param {deleteThemeSuccess=} args.success Optional. Success callback. Default: wp.updates.deleteThemeSuccess * @param {deleteThemeError=} args.error Optional. Error callback. Default: wp.updates.deleteThemeError * @return {$.promise} A jQuery promise that represents the request, * decorated with an abort() method. */ wp.updates.deleteTheme = function( args ) { var $button; if ( 'themes' === pagenow ) { $button = $( '.theme-actions .delete-theme' ); } else if ( 'themes-network' === pagenow ) { $button = $( '[data-slug="' + args.slug + '"]' ).find( '.row-actions a.delete' ); } args = _.extend( { success: wp.updates.deleteThemeSuccess, error: wp.updates.deleteThemeError }, args ); if ( $button && $button.html() !== __( 'Deleting...' ) ) { $button .data( 'originaltext', $button.html() ) .text( __( 'Deleting...' ) ); } wp.a11y.speak( __( 'Deleting...' ) ); // Remove previous error messages, if any. $( '.theme-info .update-message' ).remove(); $document.trigger( 'wp-theme-deleting', args ); return wp.updates.ajax( 'delete-theme', args ); }; /** * Updates the UI appropriately after a successful theme deletion. * * @since 4.6.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the theme that was deleted. */ wp.updates.deleteThemeSuccess = function( response ) { var $themeRows = $( '[data-slug="' + response.slug + '"]' ); if ( 'themes-network' === pagenow ) { // Removes the theme and updates rows. $themeRows.css( { backgroundColor: '#faafaa' } ).fadeOut( 350, function() { var $views = $( '.subsubsub' ), $themeRow = $( this ), themes = settings.themes, deletedRow = wp.template( 'item-deleted-row' ); if ( ! $themeRow.hasClass( 'plugin-update-tr' ) ) { $themeRow.after( deletedRow( { slug: response.slug, colspan: $( '#bulk-action-form' ).find( 'thead th:not(.hidden), thead td' ).length, name: $themeRow.find( '.theme-title strong' ).text() } ) ); } $themeRow.remove(); // Remove theme from update count. if ( -1 !== _.indexOf( themes.upgrade, response.slug ) ) { themes.upgrade = _.without( themes.upgrade, response.slug ); wp.updates.decrementCount( 'theme' ); } // Remove from views. if ( -1 !== _.indexOf( themes.disabled, response.slug ) ) { themes.disabled = _.without( themes.disabled, response.slug ); if ( themes.disabled.length ) { $views.find( '.disabled .count' ).text( '(' + themes.disabled.length + ')' ); } else { $views.find( '.disabled' ).remove(); } } if ( -1 !== _.indexOf( themes['auto-update-enabled'], response.slug ) ) { themes['auto-update-enabled'] = _.without( themes['auto-update-enabled'], response.slug ); if ( themes['auto-update-enabled'].length ) { $views.find( '.auto-update-enabled .count' ).text( '(' + themes['auto-update-enabled'].length + ')' ); } else { $views.find( '.auto-update-enabled' ).remove(); } } if ( -1 !== _.indexOf( themes['auto-update-disabled'], response.slug ) ) { themes['auto-update-disabled'] = _.without( themes['auto-update-disabled'], response.slug ); if ( themes['auto-update-disabled'].length ) { $views.find( '.auto-update-disabled .count' ).text( '(' + themes['auto-update-disabled'].length + ')' ); } else { $views.find( '.auto-update-disabled' ).remove(); } } themes.all = _.without( themes.all, response.slug ); // There is always at least one theme available. $views.find( '.all .count' ).text( '(' + themes.all.length + ')' ); } ); } // DecrementCount from update count. if ( 'themes' === pagenow ) { var theme = _.find( _wpThemeSettings.themes, { id: response.slug } ); if ( theme.hasUpdate ) { wp.updates.decrementCount( 'theme' ); } } wp.a11y.speak( _x( 'Deleted!', 'theme' ) ); $document.trigger( 'wp-theme-delete-success', response ); }; /** * Updates the UI appropriately after a failed theme deletion. * * @since 4.6.0 * * @param {Object} response Response from the server. * @param {string} response.slug Slug of the theme to be deleted. * @param {string} response.errorCode Error code for the error that occurred. * @param {string} response.errorMessage The error that occurred. */ wp.updates.deleteThemeError = function( response ) { var $themeRow = $( 'tr.inactive[data-slug="' + response.slug + '"]' ), $button = $( '.theme-actions .delete-theme' ), updateRow = wp.template( 'item-update-row' ), $updateRow = $themeRow.siblings( '#' + response.slug + '-update' ), errorMessage = sprintf( /* translators: %s: Error string for a failed deletion. */ __( 'Deletion failed: %s' ), response.errorMessage ), $message = wp.updates.adminNotice( { className: 'update-message notice-error notice-alt', message: errorMessage } ); if ( wp.updates.maybeHandleCredentialError( response, 'delete-theme' ) ) { return; } if ( 'themes-network' === pagenow ) { if ( ! $updateRow.length ) { $themeRow.addClass( 'update' ).after( updateRow( { slug: response.slug, colspan: $( '#bulk-action-form' ).find( 'thead th:not(.hidden), thead td' ).length, content: $message } ) ); } else { // Remove previous error messages, if any. $updateRow.find( '.notice-error' ).remove(); $updateRow.find( '.plugin-update' ).append( $message ); } } else { $( '.theme-info .theme-description' ).before( $message ); } $button.html( $button.data( 'originaltext' ) ); wp.a11y.speak( errorMessage, 'assertive' ); $document.trigger( 'wp-theme-delete-error', response ); }; /** * Adds the appropriate callback based on the type of action and the current page. * * @since 4.6.0 * @private * * @param {Object} data Ajax payload. * @param {string} action The type of request to perform. * @return {Object} The Ajax payload with the appropriate callbacks. */ wp.updates._addCallbacks = function( data, action ) { if ( 'import' === pagenow && 'install-plugin' === action ) { data.success = wp.updates.installImporterSuccess; data.error = wp.updates.installImporterError; } return data; }; /** * Pulls available jobs from the queue and runs them. * * @since 4.2.0 * @since 4.6.0 Can handle multiple job types. */ wp.updates.queueChecker = function() { var job; if ( wp.updates.ajaxLocked || ! wp.updates.queue.length ) { return; } job = wp.updates.queue.shift(); // Handle a queue job. switch ( job.action ) { case 'install-plugin': wp.updates.installPlugin( job.data ); break; case 'update-plugin': wp.updates.updatePlugin( job.data ); break; case 'delete-plugin': wp.updates.deletePlugin( job.data ); break; case 'install-theme': wp.updates.installTheme( job.data ); break; case 'update-theme': wp.updates.updateTheme( job.data ); break; case 'delete-theme': wp.updates.deleteTheme( job.data ); break; default: break; } }; /** * Requests the users filesystem credentials if they aren't already known. * * @since 4.2.0 * * @param {Event=} event Optional. Event interface. */ wp.updates.requestFilesystemCredentials = function( event ) { if ( false === wp.updates.filesystemCredentials.available ) { /* * After exiting the credentials request modal, * return the focus to the element triggering the request. */ if ( event && ! wp.updates.$elToReturnFocusToFromCredentialsModal ) { wp.updates.$elToReturnFocusToFromCredentialsModal = $( event.target ); } wp.updates.ajaxLocked = true; wp.updates.requestForCredentialsModalOpen(); } }; /** * Requests the users filesystem credentials if needed and there is no lock. * * @since 4.6.0 * * @param {Event=} event Optional. Event interface. */ wp.updates.maybeRequestFilesystemCredentials = function( event ) { if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) { wp.updates.requestFilesystemCredentials( event ); } }; /** * Keydown handler for the request for credentials modal. * * Closes the modal when the escape key is pressed and * constrains keyboard navigation to inside the modal. * * @since 4.2.0 * * @param {Event} event Event interface. */ wp.updates.keydown = function( event ) { if ( 27 === event.keyCode ) { wp.updates.requestForCredentialsModalCancel(); } else if ( 9 === event.keyCode ) { // #upgrade button must always be the last focus-able element in the dialog. if ( 'upgrade' === event.target.id && ! event.shiftKey ) { $( '#hostname' ).trigger( 'focus' ); event.preventDefault(); } else if ( 'hostname' === event.target.id && event.shiftKey ) { $( '#upgrade' ).trigger( 'focus' ); event.preventDefault(); } } }; /** * Opens the request for credentials modal. * * @since 4.2.0 */ wp.updates.requestForCredentialsModalOpen = function() { var $modal = $( '#request-filesystem-credentials-dialog' ); $( 'body' ).addClass( 'modal-open' ); $modal.show(); $modal.find( 'input:enabled:first' ).trigger( 'focus' ); $modal.on( 'keydown', wp.updates.keydown ); }; /** * Closes the request for credentials modal. * * @since 4.2.0 */ wp.updates.requestForCredentialsModalClose = function() { $( '#request-filesystem-credentials-dialog' ).hide(); $( 'body' ).removeClass( 'modal-open' ); if ( wp.updates.$elToReturnFocusToFromCredentialsModal ) { wp.updates.$elToReturnFocusToFromCredentialsModal.trigger( 'focus' ); } }; /** * Takes care of the steps that need to happen when the modal is canceled out. * * @since 4.2.0 * @since 4.6.0 Triggers an event for callbacks to listen to and add their actions. */ wp.updates.requestForCredentialsModalCancel = function() { // Not ajaxLocked and no queue means we already have cleared things up. if ( ! wp.updates.ajaxLocked && ! wp.updates.queue.length ) { return; } _.each( wp.updates.queue, function( job ) { $document.trigger( 'credential-modal-cancel', job ); } ); // Remove the lock, and clear the queue. wp.updates.ajaxLocked = false; wp.updates.queue = []; wp.updates.requestForCredentialsModalClose(); }; /** * Displays an error message in the request for credentials form. * * @since 4.2.0 * * @param {string} message Error message. */ wp.updates.showErrorInCredentialsForm = function( message ) { var $filesystemForm = $( '#request-filesystem-credentials-form' ); // Remove any existing error. $filesystemForm.find( '.notice' ).remove(); $filesystemForm.find( '#request-filesystem-credentials-title' ).after( '' ); }; /** * Handles credential errors and runs events that need to happen in that case. * * @since 4.2.0 * * @param {Object} response Ajax response. * @param {string} action The type of request to perform. */ wp.updates.credentialError = function( response, action ) { // Restore callbacks. response = wp.updates._addCallbacks( response, action ); wp.updates.queue.unshift( { action: action, /* * Not cool that we're depending on response for this data. * This would feel more whole in a view all tied together. */ data: response } ); wp.updates.filesystemCredentials.available = false; wp.updates.showErrorInCredentialsForm( response.errorMessage ); wp.updates.requestFilesystemCredentials(); }; /** * Handles credentials errors if it could not connect to the filesystem. * * @since 4.6.0 * * @param {Object} response Response from the server. * @param {string} response.errorCode Error code for the error that occurred. * @param {string} response.errorMessage The error that occurred. * @param {string} action The type of request to perform. * @return {boolean} Whether there is an error that needs to be handled or not. */ wp.updates.maybeHandleCredentialError = function( response, action ) { if ( wp.updates.shouldRequestFilesystemCredentials && response.errorCode && 'unable_to_connect_to_filesystem' === response.errorCode ) { wp.updates.credentialError( response, action ); return true; } return false; }; /** * Validates an Ajax response to ensure it's a proper object. * * If the response deems to be invalid, an admin notice is being displayed. * * @param {(Object|string)} response Response from the server. * @param {function=} response.always Optional. Callback for when the Deferred is resolved or rejected. * @param {string=} response.statusText Optional. Status message corresponding to the status code. * @param {string=} response.responseText Optional. Request response as text. * @param {string} action Type of action the response is referring to. Can be 'delete', * 'update' or 'install'. */ wp.updates.isValidResponse = function( response, action ) { var error = __( 'Something went wrong.' ), errorMessage; // Make sure the response is a valid data object and not a Promise object. if ( _.isObject( response ) && ! _.isFunction( response.always ) ) { return true; } if ( _.isString( response ) && '-1' === response ) { error = __( 'An error has occurred. Please reload the page and try again.' ); } else if ( _.isString( response ) ) { error = response; } else if ( 'undefined' !== typeof response.readyState && 0 === response.readyState ) { error = __( 'Connection lost or the server is busy. Please try again later.' ); } else if ( _.isString( response.responseText ) && '' !== response.responseText ) { error = response.responseText; } else if ( _.isString( response.statusText ) ) { error = response.statusText; } switch ( action ) { case 'update': /* translators: %s: Error string for a failed update. */ errorMessage = __( 'Update failed: %s' ); break; case 'install': /* translators: %s: Error string for a failed installation. */ errorMessage = __( 'Installation failed: %s' ); break; case 'check-dependencies': /* translators: %s: Error string for a failed dependencies check. */ errorMessage = __( 'Dependencies check failed: %s' ); break; case 'activate': /* translators: %s: Error string for a failed activation. */ errorMessage = __( 'Activation failed: %s' ); break; case 'delete': /* translators: %s: Error string for a failed deletion. */ errorMessage = __( 'Deletion failed: %s' ); break; } // Messages are escaped, remove HTML tags to make them more readable. error = error.replace( /<[\/a-z][^<>]*>/gi, '' ); errorMessage = errorMessage.replace( '%s', error ); // Add admin notice. wp.updates.addAdminNotice( { id: 'unknown_error', className: 'notice-error is-dismissible', message: _.escape( errorMessage ) } ); // Remove the lock, and clear the queue. wp.updates.ajaxLocked = false; wp.updates.queue = []; // Change buttons of all running updates. $( '.button.updating-message' ) .removeClass( 'updating-message' ) .removeAttr( 'aria-label' ) .prop( 'disabled', true ) .text( __( 'Update failed.' ) ); $( '.updating-message:not(.button):not(.thickbox)' ) .removeClass( 'updating-message notice-warning' ) .addClass( 'notice-error' ) .find( 'p' ) .removeAttr( 'aria-label' ) .text( errorMessage ); wp.a11y.speak( errorMessage, 'assertive' ); return false; }; /** * Potentially adds an AYS to a user attempting to leave the page. * * If an update is on-going and a user attempts to leave the page, * opens an "Are you sure?" alert. * * @since 4.2.0 */ wp.updates.beforeunload = function() { if ( wp.updates.ajaxLocked ) { return __( 'Updates may not complete if you navigate away from this page.' ); } }; $( function() { var $pluginFilter = $( '#plugin-filter, #plugin-information-footer' ), $bulkActionForm = $( '#bulk-action-form' ), $filesystemForm = $( '#request-filesystem-credentials-form' ), $filesystemModal = $( '#request-filesystem-credentials-dialog' ), $pluginSearch = $( '.plugins-php .wp-filter-search' ), $pluginInstallSearch = $( '.plugin-install-php .wp-filter-search' ); settings = _.extend( settings, window._wpUpdatesItemCounts || {} ); if ( settings.totals ) { wp.updates.refreshCount(); } /* * Whether a user needs to submit filesystem credentials. * * This is based on whether the form was output on the page server-side. * * @see {wp_print_request_filesystem_credentials_modal() in PHP} */ wp.updates.shouldRequestFilesystemCredentials = $filesystemModal.length > 0; /** * File system credentials form submit noop-er / handler. * * @since 4.2.0 */ $filesystemModal.on( 'submit', 'form', function( event ) { event.preventDefault(); // Persist the credentials input by the user for the duration of the page load. wp.updates.filesystemCredentials.ftp.hostname = $( '#hostname' ).val(); wp.updates.filesystemCredentials.ftp.username = $( '#username' ).val(); wp.updates.filesystemCredentials.ftp.password = $( '#password' ).val(); wp.updates.filesystemCredentials.ftp.connectionType = $( 'input[name="connection_type"]:checked' ).val(); wp.updates.filesystemCredentials.ssh.publicKey = $( '#public_key' ).val(); wp.updates.filesystemCredentials.ssh.privateKey = $( '#private_key' ).val(); wp.updates.filesystemCredentials.fsNonce = $( '#_fs_nonce' ).val(); wp.updates.filesystemCredentials.available = true; // Unlock and invoke the queue. wp.updates.ajaxLocked = false; wp.updates.queueChecker(); wp.updates.requestForCredentialsModalClose(); } ); /** * Closes the request credentials modal when clicking the 'Cancel' button or outside of the modal. * * @since 4.2.0 */ $filesystemModal.on( 'click', '[data-js-action="close"], .notification-dialog-background', wp.updates.requestForCredentialsModalCancel ); /** * Hide SSH fields when not selected. * * @since 4.2.0 */ $filesystemForm.on( 'change', 'input[name="connection_type"]', function() { $( '#ssh-keys' ).toggleClass( 'hidden', ( 'ssh' !== $( this ).val() ) ); } ).trigger( 'change' ); /** * Handles events after the credential modal was closed. * * @since 4.6.0 * * @param {Event} event Event interface. * @param {string} job The install/update.delete request. */ $document.on( 'credential-modal-cancel', function( event, job ) { var $updatingMessage = $( '.updating-message' ), $message, originalText; if ( 'import' === pagenow ) { $updatingMessage.removeClass( 'updating-message' ); } else if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { if ( 'update-plugin' === job.action ) { $message = $( 'tr[data-plugin="' + job.data.plugin + '"]' ).find( '.update-message' ); } else if ( 'delete-plugin' === job.action ) { $message = $( '[data-plugin="' + job.data.plugin + '"]' ).find( '.row-actions a.delete' ); } } else if ( 'themes' === pagenow || 'themes-network' === pagenow ) { if ( 'update-theme' === job.action ) { $message = $( '[data-slug="' + job.data.slug + '"]' ).find( '.update-message' ); } else if ( 'delete-theme' === job.action && 'themes-network' === pagenow ) { $message = $( '[data-slug="' + job.data.slug + '"]' ).find( '.row-actions a.delete' ); } else if ( 'delete-theme' === job.action && 'themes' === pagenow ) { $message = $( '.theme-actions .delete-theme' ); } } else { $message = $updatingMessage; } if ( $message && $message.hasClass( 'updating-message' ) ) { originalText = $message.data( 'originaltext' ); if ( 'undefined' === typeof originalText ) { originalText = $( '

    ' ).html( $message.find( 'p' ).data( 'originaltext' ) ); } $message .removeClass( 'updating-message' ) .html( originalText ); if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) { if ( 'update-plugin' === job.action ) { $message.attr( 'aria-label', sprintf( /* translators: %s: Plugin name and version. */ _x( 'Update %s now', 'plugin' ), $message.data( 'name' ) ) ); } else if ( 'install-plugin' === job.action ) { $message.attr( 'aria-label', sprintf( /* translators: %s: Plugin name. */ _x( 'Install %s now', 'plugin' ), $message.data( 'name' ) ) ); } } } wp.a11y.speak( __( 'Update canceled.' ) ); } ); /** * Click handler for plugin updates in List Table view. * * @since 4.2.0 * * @param {Event} event Event interface. */ $bulkActionForm.on( 'click', '[data-plugin] .update-link', function( event ) { var $message = $( event.target ), $pluginRow = $message.parents( 'tr' ); event.preventDefault(); if ( $message.hasClass( 'updating-message' ) || $message.hasClass( 'button-disabled' ) ) { return; } wp.updates.maybeRequestFilesystemCredentials( event ); // Return the user to the input box of the plugin's table row after closing the modal. wp.updates.$elToReturnFocusToFromCredentialsModal = $pluginRow.find( '.check-column input' ); wp.updates.updatePlugin( { plugin: $pluginRow.data( 'plugin' ), slug: $pluginRow.data( 'slug' ) } ); } ); /** * Click handler for plugin updates in plugin install view. * * @since 4.2.0 * * @param {Event} event Event interface. */ $pluginFilter.on( 'click', '.update-now', function( event ) { var $button = $( event.target ); event.preventDefault(); if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) { return; } wp.updates.maybeRequestFilesystemCredentials( event ); wp.updates.updatePlugin( { plugin: $button.data( 'plugin' ), slug: $button.data( 'slug' ) } ); } ); /** * Click handler for plugin installs in plugin install view. * * @since 4.6.0 * * @param {Event} event Event interface. */ $pluginFilter.on( 'click', '.install-now', function( event ) { var $button = $( event.target ); event.preventDefault(); if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) { return; } if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) { wp.updates.requestFilesystemCredentials( event ); $document.on( 'credential-modal-cancel', function() { var $message = $( '.install-now.updating-message' ); $message .removeClass( 'updating-message' ) .text( _x( 'Install Now', 'plugin' ) ); wp.a11y.speak( __( 'Update canceled.' ) ); } ); } wp.updates.installPlugin( { slug: $button.data( 'slug' ) } ); } ); /** * Click handler for plugin activations in plugin activation modal view. * * @since 6.5.0 * @since 6.5.4 Redirect the parent window to the activation URL. * * @param {Event} event Event interface. */ $document.on( 'click', '#plugin-information-footer .activate-now', function( event ) { event.preventDefault(); window.parent.location.href = $( event.target ).attr( 'href' ); }); /** * Click handler for importer plugins installs in the Import screen. * * @since 4.6.0 * * @param {Event} event Event interface. */ $document.on( 'click', '.importer-item .install-now', function( event ) { var $button = $( event.target ), pluginName = $( this ).data( 'name' ); event.preventDefault(); if ( $button.hasClass( 'updating-message' ) ) { return; } if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) { wp.updates.requestFilesystemCredentials( event ); $document.on( 'credential-modal-cancel', function() { $button .removeClass( 'updating-message' ) .attr( 'aria-label', sprintf( /* translators: %s: Plugin name. */ _x( 'Install %s now', 'plugin' ), pluginName ) ) .text( _x( 'Install Now', 'plugin' ) ); wp.a11y.speak( __( 'Update canceled.' ) ); } ); } wp.updates.installPlugin( { slug: $button.data( 'slug' ), pagenow: pagenow, success: wp.updates.installImporterSuccess, error: wp.updates.installImporterError } ); } ); /** * Click handler for plugin deletions. * * @since 4.6.0 * * @param {Event} event Event interface. */ $bulkActionForm.on( 'click', '[data-plugin] a.delete', function( event ) { var $pluginRow = $( event.target ).parents( 'tr' ), confirmMessage; if ( $pluginRow.hasClass( 'is-uninstallable' ) ) { confirmMessage = sprintf( /* translators: %s: Plugin name. */ __( 'Are you sure you want to delete %s and its data?' ), $pluginRow.find( '.plugin-title strong' ).text() ); } else { confirmMessage = sprintf( /* translators: %s: Plugin name. */ __( 'Are you sure you want to delete %s?' ), $pluginRow.find( '.plugin-title strong' ).text() ); } event.preventDefault(); if ( ! window.confirm( confirmMessage ) ) { return; } wp.updates.maybeRequestFilesystemCredentials( event ); wp.updates.deletePlugin( { plugin: $pluginRow.data( 'plugin' ), slug: $pluginRow.data( 'slug' ) } ); } ); /** * Click handler for theme updates. * * @since 4.6.0 * * @param {Event} event Event interface. */ $document.on( 'click', '.themes-php.network-admin .update-link', function( event ) { var $message = $( event.target ), $themeRow = $message.parents( 'tr' ); event.preventDefault(); if ( $message.hasClass( 'updating-message' ) || $message.hasClass( 'button-disabled' ) ) { return; } wp.updates.maybeRequestFilesystemCredentials( event ); // Return the user to the input box of the theme's table row after closing the modal. wp.updates.$elToReturnFocusToFromCredentialsModal = $themeRow.find( '.check-column input' ); wp.updates.updateTheme( { slug: $themeRow.data( 'slug' ) } ); } ); /** * Click handler for theme deletions. * * @since 4.6.0 * * @param {Event} event Event interface. */ $document.on( 'click', '.themes-php.network-admin a.delete', function( event ) { var $themeRow = $( event.target ).parents( 'tr' ), confirmMessage = sprintf( /* translators: %s: Theme name. */ __( 'Are you sure you want to delete %s?' ), $themeRow.find( '.theme-title strong' ).text() ); event.preventDefault(); if ( ! window.confirm( confirmMessage ) ) { return; } wp.updates.maybeRequestFilesystemCredentials( event ); wp.updates.deleteTheme( { slug: $themeRow.data( 'slug' ) } ); } ); /** * Bulk action handler for plugins and themes. * * Handles both deletions and updates. * * @since 4.6.0 * * @param {Event} event Event interface. */ $bulkActionForm.on( 'click', '[type="submit"]:not([name="clear-recent-list"])', function( event ) { var bulkAction = $( event.target ).siblings( 'select' ).val(), itemsSelected = $bulkActionForm.find( 'input[name="checked[]"]:checked' ), success = 0, error = 0, errorMessages = [], type, action; // Determine which type of item we're dealing with. switch ( pagenow ) { case 'plugins': case 'plugins-network': type = 'plugin'; break; case 'themes-network': type = 'theme'; break; default: return; } // Bail if there were no items selected. if ( ! itemsSelected.length ) { bulkAction = false; } // Determine the type of request we're dealing with. switch ( bulkAction ) { case 'update-selected': action = bulkAction.replace( 'selected', type ); break; case 'delete-selected': var confirmMessage = 'plugin' === type ? __( 'Are you sure you want to delete the selected plugins and their data?' ) : __( 'Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?' ); if ( ! window.confirm( confirmMessage ) ) { event.preventDefault(); return; } action = bulkAction.replace( 'selected', type ); break; default: return; } wp.updates.maybeRequestFilesystemCredentials( event ); event.preventDefault(); // Un-check the bulk checkboxes. $bulkActionForm.find( '.manage-column [type="checkbox"]' ).prop( 'checked', false ); $document.trigger( 'wp-' + type + '-bulk-' + bulkAction, itemsSelected ); // Find all the checkboxes which have been checked. itemsSelected.each( function( index, element ) { var $checkbox = $( element ), $itemRow = $checkbox.parents( 'tr' ); // Only add update-able items to the update queue. if ( 'update-selected' === bulkAction && ( ! $itemRow.hasClass( 'update' ) || $itemRow.find( 'notice-error' ).length ) ) { // Un-check the box. $checkbox.prop( 'checked', false ); return; } // Don't add items to the update queue again, even if the user clicks the update button several times. if ( 'update-selected' === bulkAction && $itemRow.hasClass( 'is-enqueued' ) ) { return; } $itemRow.addClass( 'is-enqueued' ); // Add it to the queue. wp.updates.queue.push( { action: action, data: { plugin: $itemRow.data( 'plugin' ), slug: $itemRow.data( 'slug' ) } } ); } ); // Display bulk notification for updates of any kind. $document.on( 'wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error', function( event, response ) { var $itemRow = $( '[data-slug="' + response.slug + '"]' ), $bulkActionNotice, itemName; if ( 'wp-' + response.update + '-update-success' === event.type ) { success++; } else { itemName = response.pluginName ? response.pluginName : $itemRow.find( '.column-primary strong' ).text(); error++; errorMessages.push( itemName + ': ' + response.errorMessage ); } $itemRow.find( 'input[name="checked[]"]:checked' ).prop( 'checked', false ); wp.updates.adminNotice = wp.template( 'wp-bulk-updates-admin-notice' ); var successMessage = null; if ( success ) { if ( 'plugin' === response.update ) { successMessage = sprintf( /* translators: %s: Number of plugins. */ _n( '%s plugin successfully updated.', '%s plugins successfully updated.', success ), success ); } else { successMessage = sprintf( /* translators: %s: Number of themes. */ _n( '%s theme successfully updated.', '%s themes successfully updated.', success ), success ); } } var errorMessage = null; if ( error ) { errorMessage = sprintf( /* translators: %s: Number of failed updates. */ _n( '%s update failed.', '%s updates failed.', error ), error ); } wp.updates.addAdminNotice( { id: 'bulk-action-notice', className: 'bulk-action-notice', successMessage: successMessage, errorMessage: errorMessage, errorMessages: errorMessages, type: response.update } ); $bulkActionNotice = $( '#bulk-action-notice' ).on( 'click', 'button', function() { // $( this ) is the clicked button, no need to get it again. $( this ) .toggleClass( 'bulk-action-errors-collapsed' ) .attr( 'aria-expanded', ! $( this ).hasClass( 'bulk-action-errors-collapsed' ) ); // Show the errors list. $bulkActionNotice.find( '.bulk-action-errors' ).toggleClass( 'hidden' ); } ); if ( error > 0 && ! wp.updates.queue.length ) { $( 'html, body' ).animate( { scrollTop: 0 } ); } } ); // Reset admin notice template after #bulk-action-notice was added. $document.on( 'wp-updates-notice-added', function() { wp.updates.adminNotice = wp.template( 'wp-updates-admin-notice' ); } ); // Check the queue, now that the event handlers have been added. wp.updates.queueChecker(); } ); if ( $pluginInstallSearch.length ) { $pluginInstallSearch.attr( 'aria-describedby', 'live-search-desc' ); } // Track the previous search string length. var previousSearchStringLength = 0; wp.updates.shouldSearch = function( searchStringLength ) { var shouldSearch = searchStringLength >= wp.updates.searchMinCharacters || previousSearchStringLength > wp.updates.searchMinCharacters; previousSearchStringLength = searchStringLength; return shouldSearch; }; /** * Handles changes to the plugin search box on the new-plugin page, * searching the repository dynamically. * * @since 4.6.0 */ $pluginInstallSearch.on( 'keyup input', _.debounce( function( event, eventtype ) { var $searchTab = $( '.plugin-install-search' ), data, searchLocation, searchStringLength = $pluginInstallSearch.val().length; data = { _ajax_nonce: wp.updates.ajaxNonce, s: encodeURIComponent( event.target.value ), tab: 'search', type: $( '#typeselector' ).val(), pagenow: pagenow }; searchLocation = location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, [ '_ajax_nonce', 'pagenow' ] ) ); // Set the autocomplete attribute, turning off autocomplete 1 character before ajax search kicks in. if ( wp.updates.shouldSearch( searchStringLength ) ) { $pluginInstallSearch.attr( 'autocomplete', 'off' ); } else { $pluginInstallSearch.attr( 'autocomplete', 'on' ); return; } // Clear on escape. if ( 'keyup' === event.type && 27 === event.which ) { event.target.value = ''; } if ( wp.updates.searchTerm === data.s && 'typechange' !== eventtype ) { return; } else { $pluginFilter.empty(); wp.updates.searchTerm = data.s; } if ( window.history && window.history.replaceState ) { window.history.replaceState( null, '', searchLocation ); } if ( ! $searchTab.length ) { $searchTab = $( '

  • "+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'"})}v(".export-personal-data-handle").on("click",function(e){var t=v(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&&T(r,"notice-error",t,[e]),setTimeout(function(){i.removeClass("processing")},500)}function m(e){e=Math.round(100*(0'+wp.i18n.__("Your new password for %s is:")+"","")+' ',o=t("
    ").attr("role","alert").attr("tabindex",-1).addClass("notice notice-success notice-alt").append(t("

    ").addClass("application-password-display").html(a)).append("

    "+wp.i18n.__("Be sure to save this in a safe location. You will not be able to retrieve it.")+"

    "),t("strong",o).text(e.name),t("input",o).val(e.password),n.replaceWith(o),o.trigger("focus"))}).fail(function(e,a,o){var s=o,p=null,s=(e.responseJSON&&(p=e.responseJSON).message&&(s=p.message),t("
    ").attr("role","alert").addClass("notice notice-error").append(t("

    ").text(s)));t("h1").after(s),r.removeProp("aria-disabled",!1).removeClass("disabled"),wp.hooks.doAction("wp_application_passwords_approve_app_request_error",p,a,o,e)})))}),e.on("click",function(e){e.preventDefault(),wp.hooks.doAction("wp_application_passwords_reject_app",i),window.location=s.reject}),n.on("submit",function(e){e.preventDefault()})}(jQuery,authApp);PK!D svg-painter.jsnu[/** * Attempt to re-color SVG icons used in the admin menu or the toolbar * * @output wp-admin/js/svg-painter.js */ window.wp = window.wp || {}; wp.svgPainter = ( function( $, window, document, undefined ) { 'use strict'; var selector, painter, colorscheme = {}, elements = []; $( function() { wp.svgPainter.init(); }); return { init: function() { painter = this; selector = $( '#adminmenu .wp-menu-image, #wpadminbar .ab-item' ); painter.setColors(); painter.findElements(); painter.paint(); }, setColors: function( colors ) { if ( typeof colors === 'undefined' && typeof window._wpColorScheme !== 'undefined' ) { colors = window._wpColorScheme; } if ( colors && colors.icons && colors.icons.base && colors.icons.current && colors.icons.focus ) { colorscheme = colors.icons; } }, findElements: function() { selector.each( function() { var $this = $(this), bgImage = $this.css( 'background-image' ); if ( bgImage && bgImage.indexOf( 'data:image/svg+xml;base64' ) != -1 ) { elements.push( $this ); } }); }, paint: function() { // Loop through all elements. $.each( elements, function( index, $element ) { var $menuitem = $element.parent().parent(); if ( $menuitem.hasClass( 'current' ) || $menuitem.hasClass( 'wp-has-current-submenu' ) ) { // Paint icon in 'current' color. painter.paintElement( $element, 'current' ); } else { // Paint icon in base color. painter.paintElement( $element, 'base' ); // Set hover callbacks. $menuitem.on( 'mouseenter', function() { painter.paintElement( $element, 'focus' ); } ).on( 'mouseleave', function() { // Match the delay from hoverIntent. window.setTimeout( function() { painter.paintElement( $element, 'base' ); }, 100 ); } ); } }); }, paintElement: function( $element, colorType ) { var xml, encoded, color; if ( ! colorType || ! colorscheme.hasOwnProperty( colorType ) ) { return; } color = colorscheme[ colorType ]; // Only accept hex colors: #101 or #101010. if ( ! color.match( /^(#[0-9a-f]{3}|#[0-9a-f]{6})$/i ) ) { return; } xml = $element.data( 'wp-ui-svg-' + color ); if ( xml === 'none' ) { return; } if ( ! xml ) { encoded = $element.css( 'background-image' ).match( /.+data:image\/svg\+xml;base64,([A-Za-z0-9\+\/\=]+)/ ); if ( ! encoded || ! encoded[1] ) { $element.data( 'wp-ui-svg-' + color, 'none' ); return; } try { xml = window.atob( encoded[1] ); } catch ( error ) {} if ( xml ) { // Replace `fill` attributes. xml = xml.replace( /fill="(.+?)"/g, 'fill="' + color + '"'); // Replace `style` attributes. xml = xml.replace( /style="(.+?)"/g, 'style="fill:' + color + '"'); // Replace `fill` properties in `").appendTo("head")}(jQuery),function(a,b){var c=function(a,b){return this instanceof c?this._init(a,b):new c(a,b)};c.fn=c.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(a){var c="noop";switch(typeof a){case"object":return a.a!==b&&this.a(a.a),c=a.r!==b?"fromRgb":a.l!==b?"fromHsl":a.v!==b?"fromHsv":c,this[c](a);case"string":return this.fromCSS(a);case"number":return this.fromInt(parseInt(a,10))}return this},_error:function(){return this.error=!0,this},clone:function(){for(var a=new c(this.toInt()),b=["_alpha","_hSpace","_hsl","_hsv","error"],d=b.length-1;d>=0;d--)a[b[d]]=this[b[d]];return a},setHSpace:function(a){return this._hSpace="hsv"===a?a:"hsl",this},noop:function(){return this},fromCSS:function(a){var b,c=/^(rgb|hs(l|v))a?\(/;if(this.error=!1,a=a.replace(/^\s+/,"").replace(/\s+$/,"").replace(/;$/,""),a.match(c)&&a.match(/\)$/)){if(b=a.replace(/(\s|%)/g,"").replace(c,"").replace(/,?\);?$/,"").split(","),b.length<3)return this._error();if(4===b.length&&(this.a(parseFloat(b.pop())),this.error))return this;for(var d=b.length-1;d>=0;d--)if(b[d]=parseInt(b[d],10),isNaN(b[d]))return this._error();return a.match(/^rgb/)?this.fromRgb({r:b[0],g:b[1],b:b[2]}):a.match(/^hsv/)?this.fromHsv({h:b[0],s:b[1],v:b[2]}):this.fromHsl({h:b[0],s:b[1],l:b[2]})}return this.fromHex(a)},fromRgb:function(a,c){return"object"!=typeof a||a.r===b||a.g===b||a.b===b?this._error():(this.error=!1,this.fromInt(parseInt((a.r<<16)+(a.g<<8)+a.b,10),c))},fromHex:function(a){return a=a.replace(/^#/,"").replace(/^0x/,""),3===a.length&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),this.error=!/^[0-9A-F]{6}$/i.test(a),this.fromInt(parseInt(a,16))},fromHsl:function(a){var c,d,e,f,g,h,i,j;return"object"!=typeof a||a.h===b||a.s===b||a.l===b?this._error():(this._hsl=a,this._hSpace="hsl",h=a.h/360,i=a.s/100,j=a.l/100,0===i?c=d=e=j:(f=j<.5?j*(1+i):j+i-j*i,g=2*j-f,c=this.hue2rgb(g,f,h+1/3),d=this.hue2rgb(g,f,h),e=this.hue2rgb(g,f,h-1/3)),this.fromRgb({r:255*c,g:255*d,b:255*e},!0))},fromHsv:function(a){var c,d,e,f,g,h,i,j,k,l,m;if("object"!=typeof a||a.h===b||a.s===b||a.v===b)return this._error();switch(this._hsv=a,this._hSpace="hsv",c=a.h/360,d=a.s/100,e=a.v/100,i=Math.floor(6*c),j=6*c-i,k=e*(1-d),l=e*(1-j*d),m=e*(1-(1-j)*d),i%6){case 0:f=e,g=m,h=k;break;case 1:f=l,g=e,h=k;break;case 2:f=k,g=e,h=m;break;case 3:f=k,g=l,h=e;break;case 4:f=m,g=k,h=e;break;case 5:f=e,g=k,h=l}return this.fromRgb({r:255*f,g:255*g,b:255*h},!0)},fromInt:function(a,c){return this._color=parseInt(a,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),c===b&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(a,b,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?a+6*(b-a)*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a},toString:function(){var a=parseInt(this._color,10).toString(16);if(this.error)return"";if(a.length<6)for(var b=6-a.length-1;b>=0;b--)a="0"+a;return"#"+a},toCSS:function(a,b){switch(a=a||"hex",b=parseFloat(b||this._alpha),a){case"rgb":case"rgba":var c=this.toRgb();return b<1?"rgba( "+c.r+", "+c.g+", "+c.b+", "+b+" )":"rgb( "+c.r+", "+c.g+", "+c.b+" )";case"hsl":case"hsla":var d=this.toHsl();return b<1?"hsla( "+d.h+", "+d.s+"%, "+d.l+"%, "+b+" )":"hsl( "+d.h+", "+d.s+"%, "+d.l+"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var a,b,c=this.toRgb(),d=c.r/255,e=c.g/255,f=c.b/255,g=Math.max(d,e,f),h=Math.min(d,e,f),i=(g+h)/2;if(g===h)a=b=0;else{var j=g-h;switch(b=i>.5?j/(2-g-h):j/(g+h),g){case d:a=(e-f)/j+(ed?(b+.05)/(d+.05):(d+.05)/(b+.05)},getMaxContrastColor:function(){var a=this.getDistanceLuminosityFrom(new c("#000")),b=this.getDistanceLuminosityFrom(new c("#fff"));return new c(a>=b?"#000":"#fff")},getReadableContrastingColor:function(a,d){if(!(a instanceof c))return this;var e,f,g=d===b?5:d,h=a.getDistanceLuminosityFrom(this);if(h>=g)return this;if(e=a.getMaxContrastColor(),e.getDistanceLuminosityFrom(a)<=g)return e;for(f=0===e.toInt()?-1:1;hc.range[1]?c.range[1]:d),f[a]=d,this._spaceFunc("from",c.space,f))}},_spaceFunc:function(a,b,c){var d=b||this._hSpace;return this[a+d.charAt(0).toUpperCase()+d.substr(1)](c)}};var d={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var e in d)d.hasOwnProperty(e)&&(c.fn[e]=c.fn._partial(e));"object"==typeof exports?module.exports=c:a.Color=c}(this);PK!W.llset-post-thumbnail.jsnu[/** * @output wp-admin/js/set-post-thumbnail.js */ /* global ajaxurl, post_id, alert */ /* exported WPSetAsThumbnail */ window.WPSetAsThumbnail = function( id, nonce ) { var $link = jQuery('a#wp-post-thumbnail-' + id); $link.text( wp.i18n.__( 'Saving…' ) ); jQuery.post(ajaxurl, { action: 'set-post-thumbnail', post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie ) }, function(str){ var win = window.dialogArguments || opener || parent || top; $link.text( wp.i18n.__( 'Use as featured image' ) ); if ( str == '0' ) { alert( wp.i18n.__( 'Could not set that as the thumbnail image. Try a different attachment.' ) ); } else { jQuery('a.wp-post-thumbnail').show(); $link.text( wp.i18n.__( 'Done' ) ); $link.fadeOut( 2000 ); win.WPSetThumbnailID(id); win.WPSetThumbnailHTML(str); } } ); }; PK!;;password-toggle.jsnu[/** * Adds functionality for password visibility buttons to toggle between text and password input types. * * @since 6.3.0 * @output wp-admin/js/password-toggle.js */ ( function () { var toggleElements, status, input, icon, label, __ = wp.i18n.__; toggleElements = document.querySelectorAll( '.pwd-toggle' ); toggleElements.forEach( function (toggle) { toggle.classList.remove( 'hide-if-no-js' ); toggle.addEventListener( 'click', togglePassword ); } ); function togglePassword() { status = this.getAttribute( 'data-toggle' ); input = this.parentElement.children.namedItem( 'pwd' ); icon = this.getElementsByClassName( 'dashicons' )[ 0 ]; label = this.getElementsByClassName( 'text' )[ 0 ]; if ( 0 === parseInt( status, 10 ) ) { this.setAttribute( 'data-toggle', 1 ); this.setAttribute( 'aria-label', __( 'Hide password' ) ); input.setAttribute( 'type', 'text' ); label.innerHTML = __( 'Hide' ); icon.classList.remove( 'dashicons-visibility' ); icon.classList.add( 'dashicons-hidden' ); } else { this.setAttribute( 'data-toggle', 0 ); this.setAttribute( 'aria-label', __( 'Show password' ) ); input.setAttribute( 'type', 'password' ); label.innerHTML = __( 'Show' ); icon.classList.remove( 'dashicons-hidden' ); icon.classList.add( 'dashicons-visibility' ); } } } )(); PK!r?\7word-count.min.jsnu[/*! This file is auto-generated */ !function(){function e(e){var t,s;if(e)for(t in e)e.hasOwnProperty(t)&&(this.settings[t]=e[t]);(s=this.settings.l10n.shortcodes)&&s.length&&(this.settings.shortcodesRegExp=new RegExp("\\[\\/?(?:"+s.join("|")+")[^\\]]*?\\]","g"))}e.prototype.settings={HTMLRegExp:/<\/?[a-z][^>]*?>/gi,HTMLcommentRegExp://g,spaceRegExp:/ | /gi,HTMLEntityRegExp:/&\S+?;/g,connectorRegExp:/--|\u2014/g,removeRegExp:new RegExp(["[","!-@[-`{-~","\x80-\xbf\xd7\xf7","\u2000-\u2bff","\u2e00-\u2e7f","]"].join(""),"g"),astralRegExp:/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,wordsRegExp:/\S\s+/g,characters_excluding_spacesRegExp:/\S/g,characters_including_spacesRegExp:/[^\f\n\r\t\v\u00AD\u2028\u2029]/g,l10n:window.wordCountL10n||{}},e.prototype.count=function(e,t){var s=0;return"characters_excluding_spaces"!==(t=t||this.settings.l10n.type)&&"characters_including_spaces"!==t&&(t="words"),s=e&&(e=(e=(e+="\n").replace(this.settings.HTMLRegExp,"\n")).replace(this.settings.HTMLcommentRegExp,""),e=(e=this.settings.shortcodesRegExp?e.replace(this.settings.shortcodesRegExp,"\n"):e).replace(this.settings.spaceRegExp," "),e=(e="words"===t?(e=(e=e.replace(this.settings.HTMLEntityRegExp,"")).replace(this.settings.connectorRegExp," ")).replace(this.settings.removeRegExp,""):(e=e.replace(this.settings.HTMLEntityRegExp,"a")).replace(this.settings.astralRegExp,"a")).match(this.settings[t+"RegExp"]))?e.length:s},window.wp=window.wp||{},window.wp.utils=window.wp.utils||{},window.wp.utils.WordCounter=e}();PK!ڷA1A1widgets.min.jsnu[/*! This file is auto-generated */ !function(w){var l=w(document);window.wpWidgets={hoveredSidebar:null,dirtyWidgets:{},init:function(){var r,o,g=this,d=w(".widgets-chooser"),s=d.find(".widgets-chooser-sidebars"),e=w("div.widgets-sortables"),c=!("undefined"==typeof isRtl||!isRtl);w("#widgets-right .sidebar-name").on("click",function(){var e=w(this),i=e.closest(".widgets-holder-wrap "),t=e.find(".handlediv");i.hasClass("closed")?(i.removeClass("closed"),t.attr("aria-expanded","true"),e.parent().sortable("refresh")):(i.addClass("closed"),t.attr("aria-expanded","false")),l.triggerHandler("wp-pin-menu")}).find(".handlediv").each(function(e){0!==e&&w(this).attr("aria-expanded","false")}),w(window).on("beforeunload.widgets",function(e){var i,t=[];if(w.each(g.dirtyWidgets,function(e,i){i&&t.push(e)}),0!==t.length)return(i=w("#widgets-right").find(".widget").filter(function(){return-1!==t.indexOf(w(this).prop("id").replace(/^widget-\d+_/,""))})).each(function(){w(this).hasClass("open")||w(this).find(".widget-title-action:first").trigger("click")}),i.first().each(function(){this.scrollIntoViewIfNeeded?this.scrollIntoViewIfNeeded():this.scrollIntoView(),w(this).find(".widget-inside :tabbable:first").trigger("focus")}),e.returnValue=wp.i18n.__("The changes you made will be lost if you navigate away from this page."),e.returnValue}),w("#widgets-left .sidebar-name").on("click",function(){var e=w(this).closest(".widgets-holder-wrap");e.toggleClass("closed").find(".handlediv").attr("aria-expanded",!e.hasClass("closed")),l.triggerHandler("wp-pin-menu")}),w(document.body).on("click.widgets-toggle",function(e){var i,t,d,a,s,n,r=w(e.target),o={},l=r.closest(".widget").find(".widget-top button.widget-action");r.parents(".widget-top").length&&!r.parents("#available-widgets").length?(t=(i=r.closest("div.widget")).children(".widget-inside"),d=parseInt(i.find("input.widget-width").val(),10),a=i.parent().width(),n=t.find(".widget-id").val(),i.data("dirty-state-initialized")||((s=t.find(".widget-control-save")).prop("disabled",!0).val(wp.i18n.__("Saved")),t.on("input change",function(){g.dirtyWidgets[n]=!0,i.addClass("widget-dirty"),s.prop("disabled",!1).val(wp.i18n.__("Save"))}),i.data("dirty-state-initialized",!0)),t.is(":hidden")?(250 .widget-top > .widget-title",distance:2,helper:"clone",zIndex:101,containment:"#wpwrap",refreshPositions:!0,start:function(e,i){var t=w(this).find(".widgets-chooser");i.helper.find("div.widget-description").hide(),o=this.id,t.length&&(w("#wpbody-content").append(t.hide()),i.helper.find(".widgets-chooser").remove(),g.clearWidgetSelection())},stop:function(){r&&w(r).hide(),r=""}}),e.droppable({tolerance:"intersect",over:function(e){var i=w(e.target).parent();wpWidgets.hoveredSidebar&&!i.is(wpWidgets.hoveredSidebar)&&wpWidgets.closeSidebar(e),i.hasClass("closed")&&(wpWidgets.hoveredSidebar=i).removeClass("closed").find(".handlediv").attr("aria-expanded","true"),w(this).sortable("refresh")},out:function(e){wpWidgets.hoveredSidebar&&wpWidgets.closeSidebar(e)}}),e.sortable({placeholder:"widget-placeholder",items:"> .widget",handle:"> .widget-top > .widget-title",cursor:"move",distance:2,containment:"#wpwrap",tolerance:"pointer",refreshPositions:!0,start:function(e,i){var t=w(this),d=t.parent(),a=i.item.children(".widget-inside");"block"===a.css("display")&&(i.item.removeClass("open"),i.item.find(".widget-top button.widget-action").attr("aria-expanded","false"),a.hide(),w(this).sortable("refreshPositions")),d.hasClass("closed")||(a=i.item.hasClass("ui-draggable")?t.height():1+t.height(),t.css("min-height",a+"px"))},stop:function(e,i){var t,d,a,s,i=i.item,n=o;wpWidgets.hoveredSidebar=null,i.hasClass("deleting")?(wpWidgets.save(i,1,0,1),i.remove()):(t=i.find("input.add_new").val(),d=i.find("input.multi_number").val(),i.attr("style","").removeClass("ui-draggable"),o="",t&&("multi"===t?(i.html(i.html().replace(/<[^<>]+>/g,function(e){return e.replace(/__i__|%i%/g,d)})),i.attr("id",n.replace("__i__",d)),d++,w("div#"+n).find("input.multi_number").val(d)):"single"===t&&(i.attr("id","new-"+n),r="div#"+n),wpWidgets.save(i,0,0,1),i.find("input.add_new").val(""),l.trigger("widget-added",[i])),(n=i.parent()).parent().hasClass("closed")&&(n.parent().removeClass("closed").find(".handlediv").attr("aria-expanded","true"),1<(a=n.children(".widget")).length)&&(a=a.get(0),s=i.get(0),a.id)&&s.id&&a.id!==s.id&&w(a).before(i),t?i.find(".widget-action").trigger("click"):wpWidgets.saveOrder(n.attr("id")))},activate:function(){w(this).parent().addClass("widget-hover")},deactivate:function(){w(this).css("min-height","").parent().removeClass("widget-hover")},receive:function(e,i){i=w(i.sender);-1"),d=w(" "),p.children(".save").on("click",function(){var i=a.children("input").val();i==h("#editable-post-name-full").text()?p.children(".cancel").trigger("click"):h.post(ajaxurl,{action:"sample-permalink",post_id:f,new_slug:i,new_title:h("#title").val(),samplepermalinknonce:h("#samplepermalinknonce").val()},function(t){var e=h("#edit-slug-box");e.html(t),e.hasClass("hidden")&&e.fadeIn("fast",function(){e.removeClass("hidden")}),p.html(d),l.html(r),s.val(i),h(".edit-slug").trigger("focus"),wp.a11y.speak(x("Permalink saved"))})}),p.children(".cancel").on("click",function(){h("#view-post-btn").show(),a.html(i),p.html(d),l.html(r),s.val(o),h(".edit-slug").trigger("focus")}),t=0;tu.length/4?"":u,e=x("URL Slug"),a.html('').children("input").on("keydown",function(t){var e=t.which;13===e&&(t.preventDefault(),p.children(".save").trigger("click")),27===e&&p.children(".cancel").trigger("click")}).on("keyup",function(){s.val(this.value)}).trigger("focus")}),window.wptitlehint=function(t){var e=h("#"+(t=t||"title")),i=h("#"+t+"-prompt-text");""===e.val()&&i.removeClass("screen-reader-text"),e.on("input",function(){""===this.value?i.removeClass("screen-reader-text"):i.addClass("screen-reader-text")})},wptitlehint(),t=h("#post-status-info"),c=h("#postdivrich"),!u.length||"ontouchstart"in window?h("#content-resize-handle").hide():t.on("mousedown.wp-editor-resize",function(t){(o="undefined"!=typeof tinymce?tinymce.get("content"):o)&&!o.isHidden()?(r=!0,l=h("#content_ifr").height()-t.pageY):(r=!1,l=u.height()-t.pageY,u.trigger("blur")),v.on("mousemove.wp-editor-resize",D).on("mouseup.wp-editor-resize mouseleave.wp-editor-resize",j),t.preventDefault()}).on("mouseup.wp-editor-resize",j),"undefined"!=typeof tinymce&&(h("#post-formats-select input.post-format").on("change.set-editor-class",function(){var t,e,i=this.id;i&&h(this).prop("checked")&&(t=tinymce.get("content"))&&((e=t.getBody()).className=e.className.replace(/\bpost-format-[^ ]+/,""),t.dom.addClass(e,"post-format-0"==i?"post-format-standard":i),h(document).trigger("editor-classchange"))}),h("#page_template").on("change.set-editor-class",function(){var t,e,i=h(this).val()||"";(i=i.substr(i.lastIndexOf("/")+1,i.length).replace(/\.php$/,"").replace(/\./g,"-"))&&(t=tinymce.get("content"))&&((e=t.getBody()).className=e.className.replace(/\bpage-template-[^ ]+/,""),t.dom.addClass(e,"page-template-"+i),h(document).trigger("editor-classchange"))})),u.on("keydown.wp-autosave",function(t){83!==t.which||t.shiftKey||t.altKey||_&&(!t.metaKey||t.ctrlKey)||!_&&!t.ctrlKey||(wp.autosave&&wp.autosave.server.triggerSave(),t.preventDefault())}),"auto-draft"===h("#original_post_status").val()&&window.history.replaceState&&h("#publish").on("click",function(){p=(p=window.location.href)+(-1!==p.indexOf("?")?"&":"?")+"wp-post-new-reload=true",window.history.replaceState(null,null,p)}),y.on("success",function(t){var e=h(t.trigger),i=h(".success",e.closest(".copy-to-clipboard-container"));t.clearSelection(),clearTimeout(s),i.removeClass("hidden"),s=setTimeout(function(){i.addClass("hidden")},3e3),wp.a11y.speak(x("The file URL has been copied to your clipboard"))})}),function(t,o){t(function(){var i,e=t("#content"),a=t("#wp-word-count").find(".word-count"),n=0;function s(){var t=!i||i.isHidden()?e.val():i.getContent({format:"raw"}),t=o.count(t);t!==n&&a.text(t),n=t}t(document).on("tinymce-editor-init",function(t,e){"content"===e.id&&(i=e).on("nodechange keyup",_.debounce(s,1e3))}),e.on("input keyup",_.debounce(s,1e3)),s()})}(jQuery,new wp.utils.WordCounter);PK! n link.min.jsnu[/*! This file is auto-generated */ jQuery(function(a){var t,c,e,i=!1;a("#link_name").trigger("focus"),postboxes.add_postbox_toggles("link"),a("#category-tabs a").on("click",function(){var t=a(this).attr("href");return a(this).parent().addClass("tabs").siblings("li").removeClass("tabs"),a(".tabs-panel").hide(),a(t).show(),"#categories-all"==t?deleteUserSetting("cats"):setUserSetting("cats","pop"),!1}),getUserSetting("cats")&&a('#category-tabs a[href="#categories-pop"]').trigger("click"),t=a("#newcat").one("focus",function(){a(this).val("").removeClass("form-input-tip")}),a("#link-category-add-submit").on("click",function(){t.focus()}),c=function(){var t,e;i||(i=!0,t=(e=a(this)).is(":checked"),e=e.val().toString(),a("#in-link-category-"+e+", #in-popular-link_category-"+e).prop("checked",t),i=!1)},e=function(t,e){a(e.what+" response_data",t).each(function(){a(a(this).text()).find("label").each(function(){var t=a(this),e=t.find("input").val(),i=t.find("input")[0].id,t=t.text().trim();a("#"+i).on("change",c),a('').text(t)})})},a("#categorychecklist").wpList({alt:"",what:"link-category",response:"category-ajax-response",addAfter:e}),a('a[href="#categories-all"]').on("click",function(){deleteUserSetting("cats")}),a('a[href="#categories-pop"]').on("click",function(){setUserSetting("cats","pop")}),"pop"==getUserSetting("cats")&&a('a[href="#categories-pop"]').trigger("click"),a("#category-add-toggle").on("click",function(){return a(this).parents("div:first").toggleClass("wp-hidden-children"),a('#category-tabs a[href="#categories-all"]').trigger("click"),a("#newcategory").trigger("focus"),!1}),a(".categorychecklist :checkbox").on("change",c).filter(":checked").trigger("change")});PK! >iZuser-suggest.jsnu[/** * Suggests users in a multisite environment. * * For input fields where the admin can select a user based on email or * username, this script shows an autocompletion menu for these inputs. Should * only be used in a multisite environment. Only users in the currently active * site are shown. * * @since 3.4.0 * @output wp-admin/js/user-suggest.js */ /* global ajaxurl, current_site_id, isRtl */ (function( $ ) { var id = ( typeof current_site_id !== 'undefined' ) ? '&site_id=' + current_site_id : ''; $( function() { var position = { offset: '0, -1' }; if ( typeof isRtl !== 'undefined' && isRtl ) { position.my = 'right top'; position.at = 'right bottom'; } /** * Adds an autocomplete function to input fields marked with the class * 'wp-suggest-user'. * * A minimum of two characters is required to trigger the suggestions. The * autocompletion menu is shown at the left bottom of the input field. On * RTL installations, it is shown at the right top. Adds the class 'open' to * the input field when the autocompletion menu is shown. * * Does a backend call to retrieve the users. * * Optional data-attributes: * - data-autocomplete-type (add, search) * The action that is going to be performed: search for existing users * or add a new one. Default: add * - data-autocomplete-field (user_login, user_email) * The field that is returned as the value for the suggestion. * Default: user_login * * @see wp-admin/includes/admin-actions.php:wp_ajax_autocomplete_user() */ $( '.wp-suggest-user' ).each( function(){ var $this = $( this ), autocompleteType = ( typeof $this.data( 'autocompleteType' ) !== 'undefined' ) ? $this.data( 'autocompleteType' ) : 'add', autocompleteField = ( typeof $this.data( 'autocompleteField' ) !== 'undefined' ) ? $this.data( 'autocompleteField' ) : 'user_login'; $this.autocomplete({ source: ajaxurl + '?action=autocomplete-user&autocomplete_type=' + autocompleteType + '&autocomplete_field=' + autocompleteField + id, delay: 500, minLength: 2, position: position, open: function() { $( this ).addClass( 'open' ); }, close: function() { $( this ).removeClass( 'open' ); } }); }); }); })( jQuery ); PK!tags.jsnu[/** * Contains logic for deleting and adding tags. * * For deleting tags it makes a request to the server to delete the tag. * For adding tags it makes a request to the server to add the tag. * * @output wp-admin/js/tags.js */ /* global ajaxurl, wpAjax, showNotice, validateForm */ jQuery( function($) { var addingTerm = false; /** * Adds an event handler to the delete term link on the term overview page. * * Cancels default event handling and event bubbling. * * @since 2.8.0 * * @return {boolean} Always returns false to cancel the default event handling. */ $( '#the-list' ).on( 'click', '.delete-tag', function() { var t = $(this), tr = t.parents('tr'), r = true, data; if ( 'undefined' != showNotice ) r = showNotice.warn(); if ( r ) { data = t.attr('href').replace(/[^?]*\?/, '').replace(/action=delete/, 'action=delete-tag'); /** * Makes a request to the server to delete the term that corresponds to the * delete term button. * * @param {string} r The response from the server. * * @return {void} */ $.post(ajaxurl, data, function(r){ if ( '1' == r ) { $('#ajax-response').empty(); tr.fadeOut('normal', function(){ tr.remove(); }); /** * Removes the term from the parent box and the tag cloud. * * `data.match(/tag_ID=(\d+)/)[1]` matches the term ID from the data variable. * This term ID is then used to select the relevant HTML elements: * The parent box and the tag cloud. */ $('select#parent option[value="' + data.match(/tag_ID=(\d+)/)[1] + '"]').remove(); $('a.tag-link-' + data.match(/tag_ID=(\d+)/)[1]).remove(); } else if ( '-1' == r ) { $('#ajax-response').empty().append('

    ' + wp.i18n.__( 'Sorry, you are not allowed to do that.' ) + '

    '); tr.children().css('backgroundColor', ''); } else { $('#ajax-response').empty().append('

    ' + wp.i18n.__( 'Something went wrong.' ) + '

    '); tr.children().css('backgroundColor', ''); } }); tr.children().css('backgroundColor', '#f33'); } return false; }); /** * Adds a deletion confirmation when removing a tag. * * @since 4.8.0 * * @return {void} */ $( '#edittag' ).on( 'click', '.delete', function( e ) { if ( 'undefined' === typeof showNotice ) { return true; } // Confirms the deletion, a negative response means the deletion must not be executed. var response = showNotice.warn(); if ( ! response ) { e.preventDefault(); } }); /** * Adds an event handler to the form submit on the term overview page. * * Cancels default event handling and event bubbling. * * @since 2.8.0 * * @return {boolean} Always returns false to cancel the default event handling. */ $('#submit').on( 'click', function(){ var form = $(this).parents('form'); if ( addingTerm ) { // If we're adding a term, noop the button to avoid duplicate requests. return false; } addingTerm = true; form.find( '.submit .spinner' ).addClass( 'is-active' ); /** * Does a request to the server to add a new term to the database * * @param {string} r The response from the server. * * @return {void} */ $.post(ajaxurl, $('#addtag').serialize(), function(r){ var res, parent, term, indent, i; addingTerm = false; form.find( '.submit .spinner' ).removeClass( 'is-active' ); $('#ajax-response').empty(); res = wpAjax.parseAjaxResponse( r, 'ajax-response' ); if ( res.errors && res.responses[0].errors[0].code === 'empty_term_name' ) { validateForm( form ); } if ( ! res || res.errors ) { return; } parent = form.find( 'select#parent' ).val(); // If the parent exists on this page, insert it below. Else insert it at the top of the list. if ( parent > 0 && $('#tag-' + parent ).length > 0 ) { // As the parent exists, insert the version with - - - prefixed. $( '.tags #tag-' + parent ).after( res.responses[0].supplemental.noparents ); } else { // As the parent is not visible, insert the version with Parent - Child - ThisTerm. $( '.tags' ).prepend( res.responses[0].supplemental.parents ); } $('.tags .no-items').remove(); if ( form.find('select#parent') ) { // Parents field exists, Add new term to the list. term = res.responses[1].supplemental; // Create an indent for the Parent field. indent = ''; for ( i = 0; i < res.responses[1].position; i++ ) indent += '   '; form.find( 'select#parent option:selected' ).after( '' ); } $('input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):visible, textarea:visible', form).val(''); }); return false; }); }); PK!user-suggest.min.jsnu[/*! This file is auto-generated */ !function(a){var n="undefined"!=typeof current_site_id?"&site_id="+current_site_id:"";a(function(){var i={offset:"0, -1"};"undefined"!=typeof isRtl&&isRtl&&(i.my="right top",i.at="right bottom"),a(".wp-suggest-user").each(function(){var e=a(this),t=void 0!==e.data("autocompleteType")?e.data("autocompleteType"):"add",o=void 0!==e.data("autocompleteField")?e.data("autocompleteField"):"user_login";e.autocomplete({source:ajaxurl+"?action=autocomplete-user&autocomplete_type="+t+"&autocomplete_field="+o+n,delay:500,minLength:2,position:i,open:function(){a(this).addClass("open")},close:function(){a(this).removeClass("open")}})})})}(jQuery);PK!A^[_application-passwords.jsnu[/** * @output wp-admin/js/application-passwords.js */ ( function( $ ) { var $appPassSection = $( '#application-passwords-section' ), $newAppPassForm = $appPassSection.find( '.create-application-password' ), $newAppPassField = $newAppPassForm.find( '.input' ), $newAppPassButton = $newAppPassForm.find( '.button' ), $appPassTwrapper = $appPassSection.find( '.application-passwords-list-table-wrapper' ), $appPassTbody = $appPassSection.find( 'tbody' ), $appPassTrNoItems = $appPassTbody.find( '.no-items' ), $removeAllBtn = $( '#revoke-all-application-passwords' ), tmplNewAppPass = wp.template( 'new-application-password' ), tmplAppPassRow = wp.template( 'application-password-row' ), userId = $( '#user_id' ).val(); $newAppPassButton.on( 'click', function( e ) { e.preventDefault(); if ( $newAppPassButton.prop( 'aria-disabled' ) ) { return; } var name = $newAppPassField.val(); if ( 0 === name.length ) { $newAppPassField.trigger( 'focus' ); return; } clearNotices(); $newAppPassButton.prop( 'aria-disabled', true ).addClass( 'disabled' ); var request = { name: name }; /** * Filters the request data used to create a new Application Password. * * @since 5.6.0 * * @param {Object} request The request data. * @param {number} userId The id of the user the password is added for. */ request = wp.hooks.applyFilters( 'wp_application_passwords_new_password_request', request, userId ); wp.apiRequest( { path: '/wp/v2/users/' + userId + '/application-passwords?_locale=user', method: 'POST', data: request } ).always( function() { $newAppPassButton.removeProp( 'aria-disabled' ).removeClass( 'disabled' ); } ).done( function( response ) { $newAppPassField.val( '' ); $newAppPassButton.prop( 'disabled', false ); $newAppPassForm.after( tmplNewAppPass( { name: response.name, password: response.password } ) ); $( '.new-application-password-notice' ).attr( 'tabindex', '-1' ).trigger( 'focus' ); $appPassTbody.prepend( tmplAppPassRow( response ) ); $appPassTwrapper.show(); $appPassTrNoItems.remove(); /** * Fires after an application password has been successfully created. * * @since 5.6.0 * * @param {Object} response The response data from the REST API. * @param {Object} request The request data used to create the password. */ wp.hooks.doAction( 'wp_application_passwords_created_password', response, request ); } ).fail( handleErrorResponse ); } ); $appPassTbody.on( 'click', '.delete', function( e ) { e.preventDefault(); if ( ! window.confirm( wp.i18n.__( 'Are you sure you want to revoke this password? This action cannot be undone.' ) ) ) { return; } var $submitButton = $( this ), $tr = $submitButton.closest( 'tr' ), uuid = $tr.data( 'uuid' ); clearNotices(); $submitButton.prop( 'disabled', true ); wp.apiRequest( { path: '/wp/v2/users/' + userId + '/application-passwords/' + uuid + '?_locale=user', method: 'DELETE' } ).always( function() { $submitButton.prop( 'disabled', false ); } ).done( function( response ) { if ( response.deleted ) { if ( 0 === $tr.siblings().length ) { $appPassTwrapper.hide(); } $tr.remove(); addNotice( wp.i18n.__( 'Application password revoked.' ), 'success' ).trigger( 'focus' ); } } ).fail( handleErrorResponse ); } ); $removeAllBtn.on( 'click', function( e ) { e.preventDefault(); if ( ! window.confirm( wp.i18n.__( 'Are you sure you want to revoke all passwords? This action cannot be undone.' ) ) ) { return; } var $submitButton = $( this ); clearNotices(); $submitButton.prop( 'disabled', true ); wp.apiRequest( { path: '/wp/v2/users/' + userId + '/application-passwords?_locale=user', method: 'DELETE' } ).always( function() { $submitButton.prop( 'disabled', false ); } ).done( function( response ) { if ( response.deleted ) { $appPassTbody.children().remove(); $appPassSection.children( '.new-application-password' ).remove(); $appPassTwrapper.hide(); addNotice( wp.i18n.__( 'All application passwords revoked.' ), 'success' ).trigger( 'focus' ); } } ).fail( handleErrorResponse ); } ); $appPassSection.on( 'click', '.notice-dismiss', function( e ) { e.preventDefault(); var $el = $( this ).parent(); $el.removeAttr( 'role' ); $el.fadeTo( 100, 0, function () { $el.slideUp( 100, function () { $el.remove(); $newAppPassField.trigger( 'focus' ); } ); } ); } ); $newAppPassField.on( 'keypress', function ( e ) { if ( 13 === e.which ) { e.preventDefault(); $newAppPassButton.trigger( 'click' ); } } ); // If there are no items, don't display the table yet. If there are, show it. if ( 0 === $appPassTbody.children( 'tr' ).not( $appPassTrNoItems ).length ) { $appPassTwrapper.hide(); } /** * Handles an error response from the REST API. * * @since 5.6.0 * * @param {jqXHR} xhr The XHR object from the ajax call. * @param {string} textStatus The string categorizing the ajax request's status. * @param {string} errorThrown The HTTP status error text. */ function handleErrorResponse( xhr, textStatus, errorThrown ) { var errorMessage = errorThrown; if ( xhr.responseJSON && xhr.responseJSON.message ) { errorMessage = xhr.responseJSON.message; } addNotice( errorMessage, 'error' ); } /** * Displays a message in the Application Passwords section. * * @since 5.6.0 * * @param {string} message The message to display. * @param {string} type The notice type. Either 'success' or 'error'. * @returns {jQuery} The notice element. */ function addNotice( message, type ) { var $notice = $( '
    ' ) .attr( 'role', 'alert' ) .attr( 'tabindex', '-1' ) .addClass( 'is-dismissible notice notice-' + type ) .append( $( '

    ' ).text( message ) ) .append( $( '' ) .attr( 'type', 'button' ) .addClass( 'notice-dismiss' ) .append( $( '' ).addClass( 'screen-reader-text' ).text( wp.i18n.__( 'Dismiss this notice.' ) ) ) ); $newAppPassForm.after( $notice ); return $notice; } /** * Clears notice messages from the Application Passwords section. * * @since 5.6.0 */ function clearNotices() { $( '.notice', $appPassSection ).remove(); } }( jQuery ) ); PK!l44editor-expand.min.jsnu[/*! This file is auto-generated */ !function(F,I){"use strict";var L=I(F),M=I(document),V=I("#wpadminbar"),N=I("#wpfooter");I(function(){var g,e,u=I("#postdivrich"),h=I("#wp-content-wrap"),m=I("#wp-content-editor-tools"),w=I(),H=I(),b=I("#ed_toolbar"),v=I("#content"),i=v[0],o=0,x=I("#post-status-info"),y=I(),T=I(),B=I("#side-sortables"),C=I("#postbox-container-1"),S=I("#post-body"),O=F.wp.editor&&F.wp.editor.fullscreen,r=function(){},l=function(){},z=!1,E=!1,k=!1,A=!1,W=0,K=56,R=20,Y=300,f=h.hasClass("tmce-active")?"tinymce":"html",U=!!parseInt(F.getUserSetting("hidetb"),10),D={windowHeight:0,windowWidth:0,adminBarHeight:0,toolsHeight:0,menuBarHeight:0,visualTopHeight:0,textTopHeight:0,bottomHeight:0,statusBarHeight:0,sideSortablesHeight:0},a=F._.throttle(function(){var t=F.scrollX||document.documentElement.scrollLeft,e=F.scrollY||document.documentElement.scrollTop,o=parseInt(i.style.height,10);i.style.height=Y+"px",i.scrollHeight>Y&&(i.style.height=i.scrollHeight+"px"),void 0!==t&&F.scrollTo(t,e),i.scrollHeight=u-D.toolsHeight-D.adminBarHeight&&e<=u-D.toolsHeight-D.adminBarHeight+l-n?(z=!0,m.css({position:"fixed",top:D.adminBarHeight,width:f}),i&&y.length&&y.css({position:"fixed",top:D.adminBarHeight+D.toolsHeight,width:f-2-(i?0:a.outerWidth()-a.width())}),a.css({position:"fixed",top:D.adminBarHeight+D.toolsHeight+D.menuBarHeight,width:f-2-(i?0:a.outerWidth()-a.width())})):(z||o)&&(e<=u-D.toolsHeight-D.adminBarHeight?(z=!1,m.css({position:"absolute",top:0,width:f}),i&&y.length&&y.css({position:"absolute",top:0,width:f-2}),a.css({position:"absolute",top:D.menuBarHeight,width:f-2-(i?0:a.outerWidth()-a.width())})):e>=u-D.toolsHeight-D.adminBarHeight+l-n&&(z=!1,m.css({position:"absolute",top:l-n,width:f}),i&&y.length&&y.css({position:"absolute",top:l-n,width:f-2}),a.css({position:"absolute",top:l-n+D.menuBarHeight,width:f-2-(i?0:a.outerWidth()-a.width())}))),(!E||o&&U)&&e+D.windowHeight<=r+l+D.bottomHeight+D.statusBarHeight+1?t&&0r+l+D.bottomHeight+D.statusBarHeight-1)&&(E=!1,T.attr("style",U?"":"visibility: hidden;"),x.attr("style",""))):o&&(m.css({position:"absolute",top:0,width:f}),i&&y.length&&y.css({position:"absolute",top:0,width:f-2}),a.css({position:"absolute",top:D.menuBarHeight,width:f-2-(i?0:a.outerWidth()-a.width())}),T.attr("style",U?"":"visibility: hidden;"),x.attr("style","")),C.width()<300&&600B.height()+s+120&&D.windowHeightD.windowHeight||k||A?e+K<=s?(B.attr("style",""),k=A=!1):W=e+K&&(k=!0,B.css({position:"fixed",top:K,bottom:""}))):(s-K<=e?B.css({position:"fixed",top:K}):B.attr("style",""),k=A=!1),W=e):(B.attr("style",""),k=A=!1),o)&&(h.css({paddingTop:D.toolsHeight}),i?H.css({paddingTop:D.visualTopHeight+D.menuBarHeight}):v.css({marginTop:D.textTopHeight})))}function n(){P(),p()}function X(t){for(var e=1;e<6;e++)setTimeout(t,500*e)}function t(){F.pageYOffset&&130K&&(A=!0,F.scrollBy(0,-1),p(),F.scrollBy(0,1)),p()}).on("wp-window-resized.editor-expand",function(){g&&!g.isHidden()?g.execCommand("wpAutoResize"):P()}),v.on("focus.editor-expand input.editor-expand propertychange.editor-expand",P),r(),O&&O.pubsub.subscribe("hidden",n),g&&(g.settings.wp_autoresize_on=!0,g.execCommand("wpAutoResizeOn"),g.isHidden()||g.execCommand("wpAutoResize")),g&&!g.isHidden()||P(),p(),M.trigger("editor-expand-on")}function s(){var t=parseInt(F.getUserSetting("ed_size",300),10);t<50?t=50:5e3t&&F.scrollTo(F.pageXOffset,t-D.adminBarHeight),P(),p()},100),p()}function c(){U=!U}"content"===f.id&&((g=f).settings.autoresize_min_height=Y,w=h.find(".mce-toolbar-grp"),H=h.find(".mce-edit-area"),T=h.find(".mce-statusbar"),y=h.find(".mce-menubar"),r=function(){f.on("keyup",o),f.on("show",s),f.on("hide",d),f.on("wp-toolbar-toggle",c),f.on("setcontent wp-autoresize wp-toolbar-toggle",p),f.on("undo redo",i),f.on("FullscreenStateChanged",n),L.off("scroll.mce-float-panels").on("scroll.mce-float-panels",e)},l=function(){f.off("keyup",o),f.off("show",s),f.off("hide",d),f.off("wp-toolbar-toggle",c),f.off("setcontent wp-autoresize wp-toolbar-toggle",p),f.off("undo redo",i),f.off("FullscreenStateChanged",n),L.off("scroll.mce-float-panels")},u.hasClass("wp-editor-expand"))&&(r(),X(p))}),u.hasClass("wp-editor-expand")&&(t(),h.hasClass("html-active"))&&X(function(){p(),P()}),I("#adv-settings .editor-expand").show(),I("#editor-expand-toggle").on("change.editor-expand",function(){I(this).prop("checked")?(t(),F.setUserSetting("editor_expand","on")):(s(),F.setUserSetting("editor_expand","off"))}),F.editorExpand={on:t,off:s}}),I(function(){var i,n,t,s,f,a,d,c,u,r,l,p=I(document.body),o=I("#wpcontent"),g=I("#post-body-content"),e=I("#title"),h=I("#content"),m=I(document.createElement("DIV")),w=I("#edit-slug-box"),H=w.find("a").add(w.find("button")).add(w.find("input")),Y=I("#adminmenuwrap"),b=(I(),I(),"on"===F.getUserSetting("editor_expand","on")),v=!!b&&"on"===F.getUserSetting("post_dfw"),x=0,y=0,T=20;function B(){(s=g.offset()).right=s.left+g.outerWidth(),s.bottom=s.top+g.outerHeight()}function C(){b||(b=!0,M.trigger("dfw-activate"),h.on("keydown.focus-shortcut",R))}function S(){b&&(z(),b=!1,M.trigger("dfw-deactivate"),h.off("keydown.focus-shortcut"))}function O(){!v&&b&&(v=!0,h.on("keydown.focus",_),e.add(h).on("blur.focus",A),_(),F.setUserSetting("post_dfw","on"),M.trigger("dfw-on"))}function z(){v&&(v=!1,e.add(h).off(".focus"),k(),g.off(".focus"),F.setUserSetting("post_dfw","off"),M.trigger("dfw-off"))}function E(){(v?z:O)()}function _(t){var e,o=t&&t.keyCode;F.navigator.platform&&(e=-1s.bottom+T)&&k(),c=t})}).on("mouseleave.focus",function(){f=a=null,x=y=0,L.off("scroll.focus")}).on("mousemove.focus",function(t){var e=t.clientX,t=t.clientY,o=F.pageYOffset,i=F.pageXOffset;if(f&&a&&(e!==f||t!==a))if(t<=a&&ts.bottom-o||e<=f&&es.right-i){if(x+=Math.abs(f-e),y+=Math.abs(a-t),(t<=s.top-T-o||t>=s.bottom+T-o||e<=s.left-T-i||e>=s.right+T-i)&&(10').text(t.name).appendTo(e)},r.attr({role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-owns":r.autocomplete("widget").attr("id")}).on("focus",function(){p(r.val()).pop()&&r.autocomplete("search")}),r.autocomplete("widget").addClass("wp-tags-autocomplete").attr("role","listbox").removeAttr("tabindex").on("menufocus",function(e,t){t.item.attr("aria-selected","true")}).on("menublur",function(){s(this).find('[aria-selected="true"]').removeAttr("aria-selected")})),this}}(jQuery);PK!Qsite-health.min.jsnu[/*! This file is auto-generated */ jQuery(function(o){var a,l=wp.i18n.__,n=wp.i18n._n,r=wp.i18n.sprintf,e=new ClipboardJS(".site-health-copy-buttons .copy-button"),c=o(".health-check-body.health-check-status-tab").length,t=o(".health-check-body.health-check-debug-tab").length,i=o("#health-check-accordion-block-wp-paths-sizes"),h=o("#adminmenu .site-health-counter"),u=o("#adminmenu .site-health-counter .count");function d(e){var t,s,a=wp.template("health-check-issue"),i=o("#health-check-issues-"+e.status);!function(e){var t,s,a,i,n={test:"string",label:"string",description:"string"},o=!0;if("object"==typeof e){for(t in n)if("object"==typeof(s=n[t]))for(a in s)i=s[a],void 0!==e[t]&&void 0!==e[t][a]&&i===typeof e[t][a]||(o=!1);else void 0!==e[t]&&s===typeof e[t]||(o=!1);return o}}(e)||(SiteHealth.site_status.issues[e.status]++,s=SiteHealth.site_status.issues[e.status],void 0===e.test&&(e.test=e.status+s),"critical"===e.status?t=r(n("%s critical issue","%s critical issues",s),''+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),u.text(SiteHealth.site_status.issues.critical),0"+e+"

    "+t+"

    ",actions:""};d(wp.hooks.applyFilters("site_status_test_result",e))}function s(){var t=(new Date).getTime(),s=window.setTimeout(function(){g("waiting-for-directory-sizes")},3e3);wp.apiRequest({path:"/wp-site-health/v1/directory-sizes"}).done(function(e){var a,s;a=e||{},e=o("button.button.copy-button"),s=e.attr("data-clipboard-text"),o.each(a,function(e,t){t=t.debug||t.size;void 0!==t&&(s=s.replace(e+": loading...",e+": "+t))}),e.attr("data-clipboard-text",s),i.find("td[class]").each(function(e,t){var t=o(t),s=t.attr("class");a.hasOwnProperty(s)&&a[s].size&&t.text(a[s].size)})}).always(function(){var e=(new Date).getTime()-t;o(".health-check-wp-paths-sizes.spinner").css("visibility","hidden"),3e3 0 ) { t.revert(); } }); }, /** * Toggles the quick edit window, hiding it when it's active and showing it when * inactive. * * @since 2.7.0 * * @memberof inlineEditPost * * @param {Object} el Element within a post table row. */ toggle : function(el){ var t = this; $( t.what + t.getId( el ) ).css( 'display' ) === 'none' ? t.revert() : t.edit( el ); }, /** * Creates the bulk editor row to edit multiple posts at once. * * @since 2.7.0 * * @memberof inlineEditPost */ setBulk : function(){ var te = '', type = this.type, c = true; var checkedPosts = $( 'tbody th.check-column input[type="checkbox"]:checked' ); var categories = {}; this.revert(); $( '#bulk-edit td' ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length ); // Insert the editor at the top of the table with an empty row above to maintain zebra striping. $('table.widefat tbody').prepend( $('#bulk-edit') ).prepend(''); $('#bulk-edit').addClass('inline-editor').show(); /** * Create a HTML div with the title and a link(delete-icon) for each selected * post. * * Get the selected posts based on the checked checkboxes in the post table. */ $( 'tbody th.check-column input[type="checkbox"]' ).each( function() { // If the checkbox for a post is selected, add the post to the edit list. if ( $(this).prop('checked') ) { c = false; var id = $( this ).val(), theTitle = $( '#inline_' + id + ' .post_title' ).html() || wp.i18n.__( '(no title)' ), buttonVisuallyHiddenText = wp.i18n.sprintf( /* translators: %s: Post title. */ wp.i18n.__( 'Remove “%s” from Bulk Edit' ), theTitle ); te += '
  • '; } }); // If no checkboxes where checked, just hide the quick/bulk edit rows. if ( c ) { return this.revert(); } // Populate the list of items to bulk edit. $( '#bulk-titles' ).html( '
      ' + te + '
    ' ); // Gather up some statistics on which of these checked posts are in which categories. checkedPosts.each( function() { var id = $( this ).val(); var checked = $( '#category_' + id ).text().split( ',' ); checked.map( function( cid ) { categories[ cid ] || ( categories[ cid ] = 0 ); // Just record that this category is checked. categories[ cid ]++; } ); } ); // Compute initial states. $( '.inline-edit-categories input[name="post_category[]"]' ).each( function() { if ( categories[ $( this ).val() ] == checkedPosts.length ) { // If the number of checked categories matches the number of selected posts, then all posts are in this category. $( this ).prop( 'checked', true ); } else if ( categories[ $( this ).val() ] > 0 ) { // If the number is less than the number of selected posts, then it's indeterminate. $( this ).prop( 'indeterminate', true ); if ( ! $( this ).parent().find( 'input[name="indeterminate_post_category[]"]' ).length ) { // Get the term label text. var label = $( this ).parent().text(); // Set indeterminate states for the backend. Add accessible text for indeterminate inputs. $( this ).after( '' ).attr( 'aria-label', label.trim() + ': ' + wp.i18n.__( 'Some selected posts have this category' ) ); } } } ); $( '.inline-edit-categories input[name="post_category[]"]:indeterminate' ).on( 'change', function() { // Remove accessible label text. Remove the indeterminate flags as there was a specific state change. $( this ).removeAttr( 'aria-label' ).parent().find( 'input[name="indeterminate_post_category[]"]' ).remove(); } ); $( '.inline-edit-save button' ).on( 'click', function() { $( '.inline-edit-categories input[name="post_category[]"]' ).prop( 'indeterminate', false ); } ); /** * Binds on click events to handle the list of items to bulk edit. * * @listens click */ $( '#bulk-titles .ntdelbutton' ).click( function() { var $this = $( this ), id = $this.attr( 'id' ).substr( 1 ), $prev = $this.parent().prev().children( '.ntdelbutton' ), $next = $this.parent().next().children( '.ntdelbutton' ); $( 'input#cb-select-all-1, input#cb-select-all-2' ).prop( 'checked', false ); $( 'table.widefat input[value="' + id + '"]' ).prop( 'checked', false ); $( '#_' + id ).parent().remove(); wp.a11y.speak( wp.i18n.__( 'Item removed.' ), 'assertive' ); // Move focus to a proper place when items are removed. if ( $next.length ) { $next.focus(); } else if ( $prev.length ) { $prev.focus(); } else { $( '#bulk-titles-list' ).remove(); inlineEditPost.revert(); wp.a11y.speak( wp.i18n.__( 'All selected items have been removed. Select new items to use Bulk Actions.' ) ); } }); // Enable auto-complete for tags when editing posts. if ( 'post' === type ) { $( 'tr.inline-editor textarea[data-wp-taxonomy]' ).each( function ( i, element ) { /* * While Quick Edit clones the form each time, Bulk Edit always re-uses * the same form. Let's check if an autocomplete instance already exists. */ if ( $( element ).autocomplete( 'instance' ) ) { // jQuery equivalent of `continue` within an `each()` loop. return; } $( element ).wpTagsSuggest(); } ); } // Set initial focus on the Bulk Edit region. $( '#bulk-edit .inline-edit-wrapper' ).attr( 'tabindex', '-1' ).focus(); // Scrolls to the top of the table where the editor is rendered. $('html, body').animate( { scrollTop: 0 }, 'fast' ); }, /** * Creates a quick edit window for the post that has been clicked. * * @since 2.7.0 * * @memberof inlineEditPost * * @param {number|Object} id The ID of the clicked post or an element within a post * table row. * @return {boolean} Always returns false at the end of execution. */ edit : function(id) { var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, f, val, pw; t.revert(); if ( typeof(id) === 'object' ) { id = t.getId(id); } fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password', 'post_format', 'menu_order', 'page_template']; if ( t.type === 'page' ) { fields.push('post_parent'); } // Add the new edit row with an extra blank row underneath to maintain zebra striping. editRow = $('#inline-edit').clone(true); $( 'td', editRow ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length ); // Remove the ID from the copied row and let the `for` attribute reference the hidden ID. $( 'td', editRow ).find('#quick-edit-legend').removeAttr('id'); $( 'td', editRow ).find('p[id^="quick-edit-"]').removeAttr('id'); $(t.what+id).removeClass('is-expanded').hide().after(editRow).after(''); // Populate fields in the quick edit window. rowData = $('#inline_'+id); if ( !$(':input[name="post_author"] option[value="' + $('.post_author', rowData).text() + '"]', editRow).val() ) { // The post author no longer has edit capabilities, so we need to add them to the list of authors. $(':input[name="post_author"]', editRow).prepend(''); } if ( $( ':input[name="post_author"] option', editRow ).length === 1 ) { $('label.inline-edit-author', editRow).hide(); } for ( f = 0; f < fields.length; f++ ) { val = $('.'+fields[f], rowData); /** * Replaces the image for a Twemoji(Twitter emoji) with it's alternate text. * * @return {string} Alternate text from the image. */ val.find( 'img' ).replaceWith( function() { return this.alt; } ); val = val.text(); $(':input[name="' + fields[f] + '"]', editRow).val( val ); } if ( $( '.comment_status', rowData ).text() === 'open' ) { $( 'input[name="comment_status"]', editRow ).prop( 'checked', true ); } if ( $( '.ping_status', rowData ).text() === 'open' ) { $( 'input[name="ping_status"]', editRow ).prop( 'checked', true ); } if ( $( '.sticky', rowData ).text() === 'sticky' ) { $( 'input[name="sticky"]', editRow ).prop( 'checked', true ); } /** * Creates the select boxes for the categories. */ $('.post_category', rowData).each(function(){ var taxname, term_ids = $(this).text(); if ( term_ids ) { taxname = $(this).attr('id').replace('_'+id, ''); $('ul.'+taxname+'-checklist :checkbox', editRow).val(term_ids.split(',')); } }); /** * Gets all the taxonomies for live auto-fill suggestions when typing the name * of a tag. */ $('.tags_input', rowData).each(function(){ var terms = $(this), taxname = $(this).attr('id').replace('_' + id, ''), textarea = $('textarea.tax_input_' + taxname, editRow), comma = wp.i18n._x( ',', 'tag delimiter' ).trim(); // Ensure the textarea exists. if ( ! textarea.length ) { return; } terms.find( 'img' ).replaceWith( function() { return this.alt; } ); terms = terms.text(); if ( terms ) { if ( ',' !== comma ) { terms = terms.replace(/,/g, comma); } textarea.val(terms); } textarea.wpTagsSuggest(); }); // Handle the post status. var post_date_string = $(':input[name="aa"]').val() + '-' + $(':input[name="mm"]').val() + '-' + $(':input[name="jj"]').val(); post_date_string += ' ' + $(':input[name="hh"]').val() + ':' + $(':input[name="mn"]').val() + ':' + $(':input[name="ss"]').val(); var post_date = new Date( post_date_string ); status = $('._status', rowData).text(); if ( 'future' !== status && Date.now() > post_date ) { $('select[name="_status"] option[value="future"]', editRow).remove(); } else { $('select[name="_status"] option[value="publish"]', editRow).remove(); } pw = $( '.inline-edit-password-input' ).prop( 'disabled', false ); if ( 'private' === status ) { $('input[name="keep_private"]', editRow).prop('checked', true); pw.val( '' ).prop( 'disabled', true ); } // Remove the current page and children from the parent dropdown. pageOpt = $('select[name="post_parent"] option[value="' + id + '"]', editRow); if ( pageOpt.length > 0 ) { pageLevel = pageOpt[0].className.split('-')[1]; nextPage = pageOpt; while ( pageLoop ) { nextPage = nextPage.next('option'); if ( nextPage.length === 0 ) { break; } nextLevel = nextPage[0].className.split('-')[1]; if ( nextLevel <= pageLevel ) { pageLoop = false; } else { nextPage.remove(); nextPage = pageOpt; } } pageOpt.remove(); } $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show(); $('.ptitle', editRow).trigger( 'focus' ); return false; }, /** * Saves the changes made in the quick edit window to the post. * Ajax saving is only for Quick Edit and not for bulk edit. * * @since 2.7.0 * * @param {number} id The ID for the post that has been changed. * @return {boolean} False, so the form does not submit when pressing * Enter on a focused field. */ save : function(id) { var params, fields, page = $('.post_status_page').val() || ''; if ( typeof(id) === 'object' ) { id = this.getId(id); } $( 'table.widefat .spinner' ).addClass( 'is-active' ); params = { action: 'inline-save', post_type: typenow, post_ID: id, edit_date: 'true', post_status: page }; fields = $('#edit-'+id).find(':input').serialize(); params = fields + '&' + $.param(params); // Make Ajax request. $.post( ajaxurl, params, function(r) { var $errorNotice = $( '#edit-' + id + ' .inline-edit-save .notice-error' ), $error = $errorNotice.find( '.error' ); $( 'table.widefat .spinner' ).removeClass( 'is-active' ); if (r) { if ( -1 !== r.indexOf( ']*?>/g, '' ); $errorNotice.removeClass( 'hidden' ); $error.html( r ); wp.a11y.speak( $error.text() ); } } else { $errorNotice.removeClass( 'hidden' ); $error.text( wp.i18n.__( 'Error while saving the changes.' ) ); wp.a11y.speak( wp.i18n.__( 'Error while saving the changes.' ) ); } }, 'html'); // Prevent submitting the form when pressing Enter on a focused field. return false; }, /** * Hides and empties the Quick Edit and/or Bulk Edit windows. * * @since 2.7.0 * * @memberof inlineEditPost * * @return {boolean} Always returns false. */ revert : function(){ var $tableWideFat = $( '.widefat' ), id = $( '.inline-editor', $tableWideFat ).attr( 'id' ); if ( id ) { $( '.spinner', $tableWideFat ).removeClass( 'is-active' ); if ( 'bulk-edit' === id ) { // Hide the bulk editor. $( '#bulk-edit', $tableWideFat ).removeClass( 'inline-editor' ).hide().siblings( '.hidden' ).remove(); $('#bulk-titles').empty(); // Store the empty bulk editor in a hidden element. $('#inlineedit').append( $('#bulk-edit') ); // Move focus back to the Bulk Action button that was activated. $( '#' + inlineEditPost.whichBulkButtonId ).trigger( 'focus' ); } else { // Remove both the inline-editor and its hidden tr siblings. $('#'+id).siblings('tr.hidden').addBack().remove(); id = id.substr( id.lastIndexOf('-') + 1 ); // Show the post row and move focus back to the Quick Edit button. $( this.what + id ).show().find( '.editinline' ) .attr( 'aria-expanded', 'false' ) .trigger( 'focus' ); } } return false; }, /** * Gets the ID for a the post that you want to quick edit from the row in the quick * edit table. * * @since 2.7.0 * * @memberof inlineEditPost * * @param {Object} o DOM row object to get the ID for. * @return {string} The post ID extracted from the table row in the object. */ getId : function(o) { var id = $(o).closest('tr').attr('id'), parts = id.split('-'); return parts[parts.length - 1]; } }; $( function() { inlineEditPost.init(); } ); // Show/hide locks on posts. $( function() { // Set the heartbeat interval to 10 seconds. if ( typeof wp !== 'undefined' && wp.heartbeat ) { wp.heartbeat.interval( 10 ); } }).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) { var locked = data['wp-check-locked-posts'] || {}; $('#the-list tr').each( function(i, el) { var key = el.id, row = $(el), lock_data, avatar; if ( locked.hasOwnProperty( key ) ) { if ( ! row.hasClass('wp-locked') ) { lock_data = locked[key]; row.find('.column-title .locked-text').text( lock_data.text ); row.find('.check-column checkbox').prop('checked', false); if ( lock_data.avatar_src ) { avatar = $( '', { 'class': 'avatar avatar-18 photo', width: 18, height: 18, alt: '', src: lock_data.avatar_src, srcset: lock_data.avatar_src_2x ? lock_data.avatar_src_2x + ' 2x' : undefined } ); row.find('.column-title .locked-avatar').empty().append( avatar ); } row.addClass('wp-locked'); } } else if ( row.hasClass('wp-locked') ) { row.removeClass( 'wp-locked' ).find( '.locked-info span' ).empty(); } }); }).on( 'heartbeat-send.wp-check-locked-posts', function( e, data ) { var check = []; $('#the-list tr').each( function(i, el) { if ( el.id ) { check.push( el.id ); } }); if ( check.length ) { data['wp-check-locked-posts'] = check; } }); })( jQuery, window.wp ); PK!gÌpassword-strength-meter.jsnu[/** * @output wp-admin/js/password-strength-meter.js */ /* global zxcvbn */ window.wp = window.wp || {}; (function($){ var __ = wp.i18n.__, sprintf = wp.i18n.sprintf; /** * Contains functions to determine the password strength. * * @since 3.7.0 * * @namespace */ wp.passwordStrength = { /** * Determines the strength of a given password. * * Compares first password to the password confirmation. * * @since 3.7.0 * * @param {string} password1 The subject password. * @param {Array} disallowedList An array of words that will lower the entropy of * the password. * @param {string} password2 The password confirmation. * * @return {number} The password strength score. */ meter : function( password1, disallowedList, password2 ) { if ( ! Array.isArray( disallowedList ) ) disallowedList = [ disallowedList.toString() ]; if (password1 != password2 && password2 && password2.length > 0) return 5; if ( 'undefined' === typeof window.zxcvbn ) { // Password strength unknown. return -1; } var result = zxcvbn( password1, disallowedList ); return result.score; }, /** * Builds an array of words that should be penalized. * * Certain words need to be penalized because it would lower the entropy of a * password if they were used. The disallowedList is based on user input fields such * as username, first name, email etc. * * @since 3.7.0 * @deprecated 5.5.0 Use {@see 'userInputDisallowedList()'} instead. * * @return {string[]} The array of words to be disallowed. */ userInputBlacklist : function() { window.console.log( sprintf( /* translators: 1: Deprecated function name, 2: Version number, 3: Alternative function name. */ __( '%1$s is deprecated since version %2$s! Use %3$s instead. Please consider writing more inclusive code.' ), 'wp.passwordStrength.userInputBlacklist()', '5.5.0', 'wp.passwordStrength.userInputDisallowedList()' ) ); return wp.passwordStrength.userInputDisallowedList(); }, /** * Builds an array of words that should be penalized. * * Certain words need to be penalized because it would lower the entropy of a * password if they were used. The disallowed list is based on user input fields such * as username, first name, email etc. * * @since 5.5.0 * * @return {string[]} The array of words to be disallowed. */ userInputDisallowedList : function() { var i, userInputFieldsLength, rawValuesLength, currentField, rawValues = [], disallowedList = [], userInputFields = [ 'user_login', 'first_name', 'last_name', 'nickname', 'display_name', 'email', 'url', 'description', 'weblog_title', 'admin_email' ]; // Collect all the strings we want to disallow. rawValues.push( document.title ); rawValues.push( document.URL ); userInputFieldsLength = userInputFields.length; for ( i = 0; i < userInputFieldsLength; i++ ) { currentField = $( '#' + userInputFields[ i ] ); if ( 0 === currentField.length ) { continue; } rawValues.push( currentField[0].defaultValue ); rawValues.push( currentField.val() ); } /* * Strip out non-alphanumeric characters and convert each word to an * individual entry. */ rawValuesLength = rawValues.length; for ( i = 0; i < rawValuesLength; i++ ) { if ( rawValues[ i ] ) { disallowedList = disallowedList.concat( rawValues[ i ].replace( /\W/g, ' ' ).split( ' ' ) ); } } /* * Remove empty values, short words and duplicates. Short words are likely to * cause many false positives. */ disallowedList = $.grep( disallowedList, function( value, key ) { if ( '' === value || 4 > value.length ) { return false; } return $.inArray( value, disallowedList ) === key; }); return disallowedList; } }; // Backward compatibility. /** * Password strength meter function. * * @since 2.5.0 * @deprecated 3.7.0 Use wp.passwordStrength.meter instead. * * @global * * @type {wp.passwordStrength.meter} */ window.passwordStrength = wp.passwordStrength.meter; })(jQuery); PK!,j word-count.jsnu[/** * Word or character counting functionality. Count words or characters in a * provided text string. * * @namespace wp.utils * * @since 2.6.0 * @output wp-admin/js/word-count.js */ ( function() { /** * Word counting utility * * @namespace wp.utils.wordcounter * @memberof wp.utils * * @class * * @param {Object} settings Optional. Key-value object containing overrides for * settings. * @param {RegExp} settings.HTMLRegExp Optional. Regular expression to find HTML elements. * @param {RegExp} settings.HTMLcommentRegExp Optional. Regular expression to find HTML comments. * @param {RegExp} settings.spaceRegExp Optional. Regular expression to find irregular space * characters. * @param {RegExp} settings.HTMLEntityRegExp Optional. Regular expression to find HTML entities. * @param {RegExp} settings.connectorRegExp Optional. Regular expression to find connectors that * split words. * @param {RegExp} settings.removeRegExp Optional. Regular expression to find remove unwanted * characters to reduce false-positives. * @param {RegExp} settings.astralRegExp Optional. Regular expression to find unwanted * characters when searching for non-words. * @param {RegExp} settings.wordsRegExp Optional. Regular expression to find words by spaces. * @param {RegExp} settings.characters_excluding_spacesRegExp Optional. Regular expression to find characters which * are non-spaces. * @param {RegExp} settings.characters_including_spacesRegExp Optional. Regular expression to find characters * including spaces. * @param {RegExp} settings.shortcodesRegExp Optional. Regular expression to find shortcodes. * @param {Object} settings.l10n Optional. Localization object containing specific * configuration for the current localization. * @param {string} settings.l10n.type Optional. Method of finding words to count. * @param {Array} settings.l10n.shortcodes Optional. Array of shortcodes that should be removed * from the text. * * @return {void} */ function WordCounter( settings ) { var key, shortcodes; // Apply provided settings to object settings. if ( settings ) { for ( key in settings ) { // Only apply valid settings. if ( settings.hasOwnProperty( key ) ) { this.settings[ key ] = settings[ key ]; } } } shortcodes = this.settings.l10n.shortcodes; // If there are any localization shortcodes, add this as type in the settings. if ( shortcodes && shortcodes.length ) { this.settings.shortcodesRegExp = new RegExp( '\\[\\/?(?:' + shortcodes.join( '|' ) + ')[^\\]]*?\\]', 'g' ); } } // Default settings. WordCounter.prototype.settings = { HTMLRegExp: /<\/?[a-z][^>]*?>/gi, HTMLcommentRegExp: //g, spaceRegExp: / | /gi, HTMLEntityRegExp: /&\S+?;/g, // \u2014 = em-dash. connectorRegExp: /--|\u2014/g, // Characters to be removed from input text. removeRegExp: new RegExp( [ '[', // Basic Latin (extract). '\u0021-\u0040\u005B-\u0060\u007B-\u007E', // Latin-1 Supplement (extract). '\u0080-\u00BF\u00D7\u00F7', /* * The following range consists of: * General Punctuation * Superscripts and Subscripts * Currency Symbols * Combining Diacritical Marks for Symbols * Letterlike Symbols * Number Forms * Arrows * Mathematical Operators * Miscellaneous Technical * Control Pictures * Optical Character Recognition * Enclosed Alphanumerics * Box Drawing * Block Elements * Geometric Shapes * Miscellaneous Symbols * Dingbats * Miscellaneous Mathematical Symbols-A * Supplemental Arrows-A * Braille Patterns * Supplemental Arrows-B * Miscellaneous Mathematical Symbols-B * Supplemental Mathematical Operators * Miscellaneous Symbols and Arrows */ '\u2000-\u2BFF', // Supplemental Punctuation. '\u2E00-\u2E7F', ']' ].join( '' ), 'g' ), // Remove UTF-16 surrogate points, see https://en.wikipedia.org/wiki/UTF-16#U.2BD800_to_U.2BDFFF astralRegExp: /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, wordsRegExp: /\S\s+/g, characters_excluding_spacesRegExp: /\S/g, /* * Match anything that is not a formatting character, excluding: * \f = form feed * \n = new line * \r = carriage return * \t = tab * \v = vertical tab * \u00AD = soft hyphen * \u2028 = line separator * \u2029 = paragraph separator */ characters_including_spacesRegExp: /[^\f\n\r\t\v\u00AD\u2028\u2029]/g, l10n: window.wordCountL10n || {} }; /** * Counts the number of words (or other specified type) in the specified text. * * @since 2.6.0 * * @memberof wp.utils.wordcounter * * @param {string} text Text to count elements in. * @param {string} type Optional. Specify type to use. * * @return {number} The number of items counted. */ WordCounter.prototype.count = function( text, type ) { var count = 0; // Use default type if none was provided. type = type || this.settings.l10n.type; // Sanitize type to one of three possibilities: 'words', 'characters_excluding_spaces' or 'characters_including_spaces'. if ( type !== 'characters_excluding_spaces' && type !== 'characters_including_spaces' ) { type = 'words'; } // If we have any text at all. if ( text ) { text = text + '\n'; // Replace all HTML with a new-line. text = text.replace( this.settings.HTMLRegExp, '\n' ); // Remove all HTML comments. text = text.replace( this.settings.HTMLcommentRegExp, '' ); // If a shortcode regular expression has been provided use it to remove shortcodes. if ( this.settings.shortcodesRegExp ) { text = text.replace( this.settings.shortcodesRegExp, '\n' ); } // Normalize non-breaking space to a normal space. text = text.replace( this.settings.spaceRegExp, ' ' ); if ( type === 'words' ) { // Remove HTML Entities. text = text.replace( this.settings.HTMLEntityRegExp, '' ); // Convert connectors to spaces to count attached text as words. text = text.replace( this.settings.connectorRegExp, ' ' ); // Remove unwanted characters. text = text.replace( this.settings.removeRegExp, '' ); } else { // Convert HTML Entities to "a". text = text.replace( this.settings.HTMLEntityRegExp, 'a' ); // Remove surrogate points. text = text.replace( this.settings.astralRegExp, 'a' ); } // Match with the selected type regular expression to count the items. text = text.match( this.settings[ type + 'RegExp' ] ); // If we have any matches, set the count to the number of items found. if ( text ) { count = text.length; } } return count; }; // Add the WordCounter to the WP Utils. window.wp = window.wp || {}; window.wp.utils = window.wp.utils || {}; window.wp.utils.WordCounter = WordCounter; } )(); PK![ farbtastic.jsnu[/*! * Farbtastic: jQuery color picker plug-in v1.3u * https://github.com/mattfarina/farbtastic * * Licensed under the GPL license: * http://www.gnu.org/licenses/gpl.html */ /** * Modified for WordPress: replaced deprecated jQuery methods. * See https://core.trac.wordpress.org/ticket/57946. */ (function($) { $.fn.farbtastic = function (options) { $.farbtastic(this, options); return this; }; $.farbtastic = function (container, callback) { var container = $(container).get(0); return container.farbtastic || (container.farbtastic = new $._farbtastic(container, callback)); }; $._farbtastic = function (container, callback) { // Store farbtastic object var fb = this; // Insert markup $(container).html('
    '); var e = $('.farbtastic', container); fb.wheel = $('.wheel', container).get(0); // Dimensions fb.radius = 84; fb.square = 100; fb.width = 194; // Fix background PNGs in IE6 if (navigator.appVersion.match(/MSIE [0-6]\./)) { $('*', e).each(function () { if (this.currentStyle.backgroundImage != 'none') { var image = this.currentStyle.backgroundImage; image = this.currentStyle.backgroundImage.substring(5, image.length - 2); $(this).css({ 'backgroundImage': 'none', 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')" }); } }); } /** * Link to the given element(s) or callback. */ fb.linkTo = function (callback) { // Unbind previous nodes if (typeof fb.callback == 'object') { $(fb.callback).off('keyup', fb.updateValue); } // Reset color fb.color = null; // Bind callback or elements if (typeof callback == 'function') { fb.callback = callback; } else if (typeof callback == 'object' || typeof callback == 'string') { fb.callback = $(callback); fb.callback.on('keyup', fb.updateValue); if (fb.callback.get(0).value) { fb.setColor(fb.callback.get(0).value); } } return this; }; fb.updateValue = function (event) { if (this.value && this.value != fb.color) { fb.setColor(this.value); } }; /** * Change color with HTML syntax #123456 */ fb.setColor = function (color) { var unpack = fb.unpack(color); if (fb.color != color && unpack) { fb.color = color; fb.rgb = unpack; fb.hsl = fb.RGBToHSL(fb.rgb); fb.updateDisplay(); } return this; }; /** * Change color with HSL triplet [0..1, 0..1, 0..1] */ fb.setHSL = function (hsl) { fb.hsl = hsl; fb.rgb = fb.HSLToRGB(hsl); fb.color = fb.pack(fb.rgb); fb.updateDisplay(); return this; }; ///////////////////////////////////////////////////// /** * Retrieve the coordinates of the given event relative to the center * of the widget. */ fb.widgetCoords = function (event) { var offset = $(fb.wheel).offset(); return { x: (event.pageX - offset.left) - fb.width / 2, y: (event.pageY - offset.top) - fb.width / 2 }; }; /** * Mousedown handler */ fb.mousedown = function (event) { // Capture mouse if (!document.dragging) { $(document).on('mousemove', fb.mousemove).on('mouseup', fb.mouseup); document.dragging = true; } // Check which area is being dragged var pos = fb.widgetCoords(event); fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square; // Process fb.mousemove(event); return false; }; /** * Mousemove handler */ fb.mousemove = function (event) { // Get coordinates relative to color picker center var pos = fb.widgetCoords(event); // Set new HSL parameters if (fb.circleDrag) { var hue = Math.atan2(pos.x, -pos.y) / 6.28; if (hue < 0) hue += 1; fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]); } else { var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5)); var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5)); fb.setHSL([fb.hsl[0], sat, lum]); } return false; }; /** * Mouseup handler */ fb.mouseup = function () { // Uncapture mouse $(document).off('mousemove', fb.mousemove); $(document).off('mouseup', fb.mouseup); document.dragging = false; }; /** * Update the markers and styles */ fb.updateDisplay = function () { // Markers var angle = fb.hsl[0] * 6.28; $('.h-marker', e).css({ left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px', top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px' }); $('.sl-marker', e).css({ left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px', top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px' }); // Saturation/Luminance gradient $('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5]))); // Linked elements or callback if (typeof fb.callback == 'object') { // Set background/foreground color $(fb.callback).css({ backgroundColor: fb.color, color: fb.hsl[2] > 0.5 ? '#000' : '#fff' }); // Change linked value $(fb.callback).each(function() { if (this.value && this.value != fb.color) { this.value = fb.color; } }); } else if (typeof fb.callback == 'function') { fb.callback.call(fb, fb.color); } }; /* Various color utility functions */ fb.pack = function (rgb) { var r = Math.round(rgb[0] * 255); var g = Math.round(rgb[1] * 255); var b = Math.round(rgb[2] * 255); return '#' + (r < 16 ? '0' : '') + r.toString(16) + (g < 16 ? '0' : '') + g.toString(16) + (b < 16 ? '0' : '') + b.toString(16); }; fb.unpack = function (color) { if (color.length == 7) { return [parseInt('0x' + color.substring(1, 3)) / 255, parseInt('0x' + color.substring(3, 5)) / 255, parseInt('0x' + color.substring(5, 7)) / 255]; } else if (color.length == 4) { return [parseInt('0x' + color.substring(1, 2)) / 15, parseInt('0x' + color.substring(2, 3)) / 15, parseInt('0x' + color.substring(3, 4)) / 15]; } }; fb.HSLToRGB = function (hsl) { var m1, m2, r, g, b; var h = hsl[0], s = hsl[1], l = hsl[2]; m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s; m1 = l * 2 - m2; return [this.hueToRGB(m1, m2, h+0.33333), this.hueToRGB(m1, m2, h), this.hueToRGB(m1, m2, h-0.33333)]; }; fb.hueToRGB = function (m1, m2, h) { h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h); if (h * 6 < 1) return m1 + (m2 - m1) * h * 6; if (h * 2 < 1) return m2; if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6; return m1; }; fb.RGBToHSL = function (rgb) { var min, max, delta, h, s, l; var r = rgb[0], g = rgb[1], b = rgb[2]; min = Math.min(r, Math.min(g, b)); max = Math.max(r, Math.max(g, b)); delta = max - min; l = (min + max) / 2; s = 0; if (l > 0 && l < 1) { s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l)); } h = 0; if (delta > 0) { if (max == r && max != g) h += (g - b) / delta; if (max == g && max != b) h += (2 + (b - r) / delta); if (max == b && max != r) h += (4 + (r - g) / delta); h /= 6; } return [h, s, l]; }; // Install mousedown handler (the others are set on the document on-demand) $('*', e).on('mousedown', fb.mousedown); // Init color fb.setColor('#000000'); // Set linked elements/callback if (callback) { fb.linkTo(callback); } }; })(jQuery);PK!I code-editor.min.jsnu[/*! This file is auto-generated */ void 0===window.wp&&(window.wp={}),void 0===window.wp.codeEditor&&(window.wp.codeEditor={}),function(u,d){"use strict";function s(r,s){var a=[],d=[];function c(){s.onUpdateErrorNotice&&!_.isEqual(a,d)&&(s.onUpdateErrorNotice(a,r),d=a)}function i(){var i,t=r.getOption("lint");return!!t&&(!0===t?t={}:_.isObject(t)&&(t=u.extend({},t)),t.options||(t.options={}),"javascript"===s.codemirror.mode&&s.jshint&&u.extend(t.options,s.jshint),"css"===s.codemirror.mode&&s.csslint&&u.extend(t.options,s.csslint),"htmlmixed"===s.codemirror.mode&&s.htmlhint&&(t.options.rules=u.extend({},s.htmlhint),s.jshint&&(t.options.rules.jshint=s.jshint),s.csslint)&&(t.options.rules.csslint=s.csslint),t.onUpdateLinting=(i=t.onUpdateLinting,function(t,e,n){var o=_.filter(t,function(t){return"error"===t.severity});i&&i.apply(t,e,n),!_.isEqual(o,a)&&(a=o,s.onChangeLintingErrors&&s.onChangeLintingErrors(o,t,e,n),!r.state.focused||0===a.length||0 *
    *

    *
    *
    *
    *
    *

    *
    *
    *
    *
    *

    *
    *
    *
    * * * Note that any appropriate tags may be used, as long as the above classes are present. * * @since 3.6.0 * @output wp-admin/js/accordion.js */ ( function( $ ){ $( function () { // Expand/Collapse accordion sections on click. $( '.accordion-container' ).on( 'click', '.accordion-section-title button', function() { accordionSwitch( $( this ) ); }); }); /** * Close the current accordion section and open a new one. * * @param {Object} el Title element of the accordion section to toggle. * @since 3.6.0 */ function accordionSwitch ( el ) { var section = el.closest( '.accordion-section' ), container = section.closest( '.accordion-container' ), siblings = container.find( '.open' ), siblingsToggleControl = siblings.find( '[aria-expanded]' ).first(), content = section.find( '.accordion-section-content' ); // This section has no content and cannot be expanded. if ( section.hasClass( 'cannot-expand' ) ) { return; } // Add a class to the container to let us know something is happening inside. // This helps in cases such as hiding a scrollbar while animations are executing. container.addClass( 'opening' ); if ( section.hasClass( 'open' ) ) { section.toggleClass( 'open' ); content.toggle( true ).slideToggle( 150 ); } else { siblingsToggleControl.attr( 'aria-expanded', 'false' ); siblings.removeClass( 'open' ); siblings.find( '.accordion-section-content' ).show().slideUp( 150 ); content.toggle( false ).slideToggle( 150 ); section.toggleClass( 'open' ); } // We have to wait for the animations to finish. setTimeout(function(){ container.removeClass( 'opening' ); }, 150); // If there's an element with an aria-expanded attribute, assume it's a toggle control and toggle the aria-expanded value. if ( el ) { el.attr( 'aria-expanded', String( el.attr( 'aria-expanded' ) === 'false' ) ); } } })(jQuery); PK!z WW autosave.jsnu[/** * @output wp-includes/js/autosave.js */ /* global tinymce, wpCookies, autosaveL10n, switchEditors */ // Back-compat. window.autosave = function() { return true; }; /** * Adds autosave to the window object on dom ready. * * @since 3.9.0 * * @param {jQuery} $ jQuery object. * @param {window} The window object. * */ ( function( $, window ) { /** * Auto saves the post. * * @since 3.9.0 * * @return {Object} * {{ * getPostData: getPostData, * getCompareString: getCompareString, * disableButtons: disableButtons, * enableButtons: enableButtons, * local: ({hasStorage, getSavedPostData, save, suspend, resume}|*), * server: ({tempBlockSave, triggerSave, postChanged, suspend, resume}|*) * }} * The object with all functions for autosave. */ function autosave() { var initialCompareString, initialCompareData = {}, lastTriggerSave = 0, $document = $( document ); /** * Sets the initial compare data. * * @since 5.6.1 */ function setInitialCompare() { initialCompareData = { post_title: $( '#title' ).val() || '', content: $( '#content' ).val() || '', excerpt: $( '#excerpt' ).val() || '' }; initialCompareString = getCompareString( initialCompareData ); } /** * Returns the data saved in both local and remote autosave. * * @since 3.9.0 * * @param {string} type The type of autosave either local or remote. * * @return {Object} Object containing the post data. */ function getPostData( type ) { var post_name, parent_id, data, time = ( new Date() ).getTime(), cats = [], editor = getEditor(); // Don't run editor.save() more often than every 3 seconds. // It is resource intensive and might slow down typing in long posts on slow devices. if ( editor && editor.isDirty() && ! editor.isHidden() && time - 3000 > lastTriggerSave ) { editor.save(); lastTriggerSave = time; } data = { post_id: $( '#post_ID' ).val() || 0, post_type: $( '#post_type' ).val() || '', post_author: $( '#post_author' ).val() || '', post_title: $( '#title' ).val() || '', content: $( '#content' ).val() || '', excerpt: $( '#excerpt' ).val() || '' }; if ( type === 'local' ) { return data; } $( 'input[id^="in-category-"]:checked' ).each( function() { cats.push( this.value ); }); data.catslist = cats.join(','); if ( post_name = $( '#post_name' ).val() ) { data.post_name = post_name; } if ( parent_id = $( '#parent_id' ).val() ) { data.parent_id = parent_id; } if ( $( '#comment_status' ).prop( 'checked' ) ) { data.comment_status = 'open'; } if ( $( '#ping_status' ).prop( 'checked' ) ) { data.ping_status = 'open'; } if ( $( '#auto_draft' ).val() === '1' ) { data.auto_draft = '1'; } return data; } /** * Concatenates the title, content and excerpt. This is used to track changes * when auto-saving. * * @since 3.9.0 * * @param {Object} postData The object containing the post data. * * @return {string} A concatenated string with title, content and excerpt. */ function getCompareString( postData ) { if ( typeof postData === 'object' ) { return ( postData.post_title || '' ) + '::' + ( postData.content || '' ) + '::' + ( postData.excerpt || '' ); } return ( $('#title').val() || '' ) + '::' + ( $('#content').val() || '' ) + '::' + ( $('#excerpt').val() || '' ); } /** * Disables save buttons. * * @since 3.9.0 * * @return {void} */ function disableButtons() { $document.trigger('autosave-disable-buttons'); // Re-enable 5 sec later. Just gives autosave a head start to avoid collisions. setTimeout( enableButtons, 5000 ); } /** * Enables save buttons. * * @since 3.9.0 * * @return {void} */ function enableButtons() { $document.trigger( 'autosave-enable-buttons' ); } /** * Gets the content editor. * * @since 4.6.0 * * @return {boolean|*} Returns either false if the editor is undefined, * or the instance of the content editor. */ function getEditor() { return typeof tinymce !== 'undefined' && tinymce.get('content'); } /** * Autosave in localStorage. * * @since 3.9.0 * * @return { * { * hasStorage: *, * getSavedPostData: getSavedPostData, * save: save, * suspend: suspend, * resume: resume * } * } * The object with all functions for local storage autosave. */ function autosaveLocal() { var blog_id, post_id, hasStorage, intervalTimer, lastCompareString, isSuspended = false; /** * Checks if the browser supports sessionStorage and it's not disabled. * * @since 3.9.0 * * @return {boolean} True if the sessionStorage is supported and enabled. */ function checkStorage() { var test = Math.random().toString(), result = false; try { window.sessionStorage.setItem( 'wp-test', test ); result = window.sessionStorage.getItem( 'wp-test' ) === test; window.sessionStorage.removeItem( 'wp-test' ); } catch(e) {} hasStorage = result; return result; } /** * Initializes the local storage. * * @since 3.9.0 * * @return {boolean|Object} False if no sessionStorage in the browser or an Object * containing all postData for this blog. */ function getStorage() { var stored_obj = false; // Separate local storage containers for each blog_id. if ( hasStorage && blog_id ) { stored_obj = sessionStorage.getItem( 'wp-autosave-' + blog_id ); if ( stored_obj ) { stored_obj = JSON.parse( stored_obj ); } else { stored_obj = {}; } } return stored_obj; } /** * Sets the storage for this blog. Confirms that the data was saved * successfully. * * @since 3.9.0 * * @return {boolean} True if the data was saved successfully, false if it wasn't saved. */ function setStorage( stored_obj ) { var key; if ( hasStorage && blog_id ) { key = 'wp-autosave-' + blog_id; sessionStorage.setItem( key, JSON.stringify( stored_obj ) ); return sessionStorage.getItem( key ) !== null; } return false; } /** * Gets the saved post data for the current post. * * @since 3.9.0 * * @return {boolean|Object} False if no storage or no data or the postData as an Object. */ function getSavedPostData() { var stored = getStorage(); if ( ! stored || ! post_id ) { return false; } return stored[ 'post_' + post_id ] || false; } /** * Sets (save or delete) post data in the storage. * * If stored_data evaluates to 'false' the storage key for the current post will be removed. * * @since 3.9.0 * * @param {Object|boolean|null} stored_data The post data to store or null/false/empty to delete the key. * * @return {boolean} True if data is stored, false if data was removed. */ function setData( stored_data ) { var stored = getStorage(); if ( ! stored || ! post_id ) { return false; } if ( stored_data ) { stored[ 'post_' + post_id ] = stored_data; } else if ( stored.hasOwnProperty( 'post_' + post_id ) ) { delete stored[ 'post_' + post_id ]; } else { return false; } return setStorage( stored ); } /** * Sets isSuspended to true. * * @since 3.9.0 * * @return {void} */ function suspend() { isSuspended = true; } /** * Sets isSuspended to false. * * @since 3.9.0 * * @return {void} */ function resume() { isSuspended = false; } /** * Saves post data for the current post. * * Runs on a 15 seconds interval, saves when there are differences in the post title or content. * When the optional data is provided, updates the last saved post data. * * @since 3.9.0 * * @param {Object} data The post data for saving, minimum 'post_title' and 'content'. * * @return {boolean} Returns true when data has been saved, otherwise it returns false. */ function save( data ) { var postData, compareString, result = false; if ( isSuspended || ! hasStorage ) { return false; } if ( data ) { postData = getSavedPostData() || {}; $.extend( postData, data ); } else { postData = getPostData('local'); } compareString = getCompareString( postData ); if ( typeof lastCompareString === 'undefined' ) { lastCompareString = initialCompareString; } // If the content, title and excerpt did not change since the last save, don't save again. if ( compareString === lastCompareString ) { return false; } postData.save_time = ( new Date() ).getTime(); postData.status = $( '#post_status' ).val() || ''; result = setData( postData ); if ( result ) { lastCompareString = compareString; } return result; } /** * Initializes the auto save function. * * Checks whether the editor is active or not to use the editor events * to autosave, or uses the values from the elements to autosave. * * Runs on DOM ready. * * @since 3.9.0 * * @return {void} */ function run() { post_id = $('#post_ID').val() || 0; // Check if the local post data is different than the loaded post data. if ( $( '#wp-content-wrap' ).hasClass( 'tmce-active' ) ) { /* * If TinyMCE loads first, check the post 1.5 seconds after it is ready. * By this time the content has been loaded in the editor and 'saved' to the textarea. * This prevents false positives. */ $document.on( 'tinymce-editor-init.autosave', function() { window.setTimeout( function() { checkPost(); }, 1500 ); }); } else { checkPost(); } // Save every 15 seconds. intervalTimer = window.setInterval( save, 15000 ); $( 'form#post' ).on( 'submit.autosave-local', function() { var editor = getEditor(), post_id = $('#post_ID').val() || 0; if ( editor && ! editor.isHidden() ) { // Last onSubmit event in the editor, needs to run after the content has been moved to the textarea. editor.on( 'submit', function() { save({ post_title: $( '#title' ).val() || '', content: $( '#content' ).val() || '', excerpt: $( '#excerpt' ).val() || '' }); }); } else { save({ post_title: $( '#title' ).val() || '', content: $( '#content' ).val() || '', excerpt: $( '#excerpt' ).val() || '' }); } var secure = ( 'https:' === window.location.protocol ); wpCookies.set( 'wp-saving-post', post_id + '-check', 24 * 60 * 60, false, false, secure ); }); } /** * Compares 2 strings. Removes whitespaces in the strings before comparing them. * * @since 3.9.0 * * @param {string} str1 The first string. * @param {string} str2 The second string. * @return {boolean} True if the strings are the same. */ function compare( str1, str2 ) { function removeSpaces( string ) { return string.toString().replace(/[\x20\t\r\n\f]+/g, ''); } return ( removeSpaces( str1 || '' ) === removeSpaces( str2 || '' ) ); } /** * Checks if the saved data for the current post (if any) is different than the * loaded post data on the screen. * * Shows a standard message letting the user restore the post data if different. * * @since 3.9.0 * * @return {void} */ function checkPost() { var content, post_title, excerpt, $notice, postData = getSavedPostData(), cookie = wpCookies.get( 'wp-saving-post' ), $newerAutosaveNotice = $( '#has-newer-autosave' ).parent( '.notice' ), $headerEnd = $( '.wp-header-end' ); if ( cookie === post_id + '-saved' ) { wpCookies.remove( 'wp-saving-post' ); // The post was saved properly, remove old data and bail. setData( false ); return; } if ( ! postData ) { return; } content = $( '#content' ).val() || ''; post_title = $( '#title' ).val() || ''; excerpt = $( '#excerpt' ).val() || ''; if ( compare( content, postData.content ) && compare( post_title, postData.post_title ) && compare( excerpt, postData.excerpt ) ) { return; } /* * If '.wp-header-end' is found, append the notices after it otherwise * after the first h1 or h2 heading found within the main content. */ if ( ! $headerEnd.length ) { $headerEnd = $( '.wrap h1, .wrap h2' ).first(); } $notice = $( '#local-storage-notice' ) .insertAfter( $headerEnd ) .addClass( 'notice-warning' ); if ( $newerAutosaveNotice.length ) { // If there is a "server" autosave notice, hide it. // The data in the session storage is either the same or newer. $newerAutosaveNotice.slideUp( 150, function() { $notice.slideDown( 150 ); }); } else { $notice.slideDown( 200 ); } $notice.find( '.restore-backup' ).on( 'click.autosave-local', function() { restorePost( postData ); $notice.fadeTo( 250, 0, function() { $notice.slideUp( 150 ); }); }); } /** * Restores the current title, content and excerpt from postData. * * @since 3.9.0 * * @param {Object} postData The object containing all post data. * * @return {boolean} True if the post is restored. */ function restorePost( postData ) { var editor; if ( postData ) { // Set the last saved data. lastCompareString = getCompareString( postData ); if ( $( '#title' ).val() !== postData.post_title ) { $( '#title' ).trigger( 'focus' ).val( postData.post_title || '' ); } $( '#excerpt' ).val( postData.excerpt || '' ); editor = getEditor(); if ( editor && ! editor.isHidden() && typeof switchEditors !== 'undefined' ) { if ( editor.settings.wpautop && postData.content ) { postData.content = switchEditors.wpautop( postData.content ); } // Make sure there's an undo level in the editor. editor.undoManager.transact( function() { editor.setContent( postData.content || '' ); editor.nodeChanged(); }); } else { // Make sure the Text editor is selected. $( '#content-html' ).trigger( 'click' ); $( '#content' ).trigger( 'focus' ); // Using document.execCommand() will let the user undo. document.execCommand( 'selectAll' ); document.execCommand( 'insertText', false, postData.content || '' ); } return true; } return false; } blog_id = typeof window.autosaveL10n !== 'undefined' && window.autosaveL10n.blog_id; /* * Check if the browser supports sessionStorage and it's not disabled, * then initialize and run checkPost(). * Don't run if the post type supports neither 'editor' (textarea#content) nor 'excerpt'. */ if ( checkStorage() && blog_id && ( $('#content').length || $('#excerpt').length ) ) { $( run ); } return { hasStorage: hasStorage, getSavedPostData: getSavedPostData, save: save, suspend: suspend, resume: resume }; } /** * Auto saves the post on the server. * * @since 3.9.0 * * @return {Object} { * { * tempBlockSave: tempBlockSave, * triggerSave: triggerSave, * postChanged: postChanged, * suspend: suspend, * resume: resume * } * } The object all functions for autosave. */ function autosaveServer() { var _blockSave, _blockSaveTimer, previousCompareString, lastCompareString, nextRun = 0, isSuspended = false; /** * Blocks saving for the next 10 seconds. * * @since 3.9.0 * * @return {void} */ function tempBlockSave() { _blockSave = true; window.clearTimeout( _blockSaveTimer ); _blockSaveTimer = window.setTimeout( function() { _blockSave = false; }, 10000 ); } /** * Sets isSuspended to true. * * @since 3.9.0 * * @return {void} */ function suspend() { isSuspended = true; } /** * Sets isSuspended to false. * * @since 3.9.0 * * @return {void} */ function resume() { isSuspended = false; } /** * Triggers the autosave with the post data. * * @since 3.9.0 * * @param {Object} data The post data. * * @return {void} */ function response( data ) { _schedule(); _blockSave = false; lastCompareString = previousCompareString; previousCompareString = ''; $document.trigger( 'after-autosave', [data] ); enableButtons(); if ( data.success ) { // No longer an auto-draft. $( '#auto_draft' ).val(''); } } /** * Saves immediately. * * Resets the timing and tells heartbeat to connect now. * * @since 3.9.0 * * @return {void} */ function triggerSave() { nextRun = 0; wp.heartbeat.connectNow(); } /** * Checks if the post content in the textarea has changed since page load. * * This also happens when TinyMCE is active and editor.save() is triggered by * wp.autosave.getPostData(). * * @since 3.9.0 * * @return {boolean} True if the post has been changed. */ function postChanged() { var changed = false; // If there are TinyMCE instances, loop through them. if ( window.tinymce ) { window.tinymce.each( [ 'content', 'excerpt' ], function( field ) { var editor = window.tinymce.get( field ); if ( ! editor || editor.isHidden() ) { if ( ( $( '#' + field ).val() || '' ) !== initialCompareData[ field ] ) { changed = true; // Break. return false; } } else if ( editor.isDirty() ) { changed = true; return false; } } ); if ( ( $( '#title' ).val() || '' ) !== initialCompareData.post_title ) { changed = true; } return changed; } return getCompareString() !== initialCompareString; } /** * Checks if the post can be saved or not. * * If the post hasn't changed or it cannot be updated, * because the autosave is blocked or suspended, the function returns false. * * @since 3.9.0 * * @return {Object} Returns the post data. */ function save() { var postData, compareString; // window.autosave() used for back-compat. if ( isSuspended || _blockSave || ! window.autosave() ) { return false; } if ( ( new Date() ).getTime() < nextRun ) { return false; } postData = getPostData(); compareString = getCompareString( postData ); // First check. if ( typeof lastCompareString === 'undefined' ) { lastCompareString = initialCompareString; } // No change. if ( compareString === lastCompareString ) { return false; } previousCompareString = compareString; tempBlockSave(); disableButtons(); $document.trigger( 'wpcountwords', [ postData.content ] ) .trigger( 'before-autosave', [ postData ] ); postData._wpnonce = $( '#_wpnonce' ).val() || ''; return postData; } /** * Sets the next run, based on the autosave interval. * * @private * * @since 3.9.0 * * @return {void} */ function _schedule() { nextRun = ( new Date() ).getTime() + ( autosaveL10n.autosaveInterval * 1000 ) || 60000; } /** * Sets the autosaveData on the autosave heartbeat. * * @since 3.9.0 * * @return {void} */ $( function() { _schedule(); }).on( 'heartbeat-send.autosave', function( event, data ) { var autosaveData = save(); if ( autosaveData ) { data.wp_autosave = autosaveData; } /** * Triggers the autosave of the post with the autosave data on the autosave * heartbeat. * * @since 3.9.0 * * @return {void} */ }).on( 'heartbeat-tick.autosave', function( event, data ) { if ( data.wp_autosave ) { response( data.wp_autosave ); } /** * Disables buttons and throws a notice when the connection is lost. * * @since 3.9.0 * * @return {void} */ }).on( 'heartbeat-connection-lost.autosave', function( event, error, status ) { // When connection is lost, keep user from submitting changes. if ( 'timeout' === error || 603 === status ) { var $notice = $('#lost-connection-notice'); if ( ! wp.autosave.local.hasStorage ) { $notice.find('.hide-if-no-sessionstorage').hide(); } $notice.show(); disableButtons(); } /** * Enables buttons when the connection is restored. * * @since 3.9.0 * * @return {void} */ }).on( 'heartbeat-connection-restored.autosave', function() { $('#lost-connection-notice').hide(); enableButtons(); }); return { tempBlockSave: tempBlockSave, triggerSave: triggerSave, postChanged: postChanged, suspend: suspend, resume: resume }; } /** * Sets the autosave time out. * * Wait for TinyMCE to initialize plus 1 second. for any external css to finish loading, * then save to the textarea before setting initialCompareString. * This avoids any insignificant differences between the initial textarea content and the content * extracted from the editor. * * @since 3.9.0 * * @return {void} */ $( function() { // Set the initial compare string in case TinyMCE is not used or not loaded first. setInitialCompare(); }).on( 'tinymce-editor-init.autosave', function( event, editor ) { // Reset the initialCompare data after the TinyMCE instances have been initialized. if ( 'content' === editor.id || 'excerpt' === editor.id ) { window.setTimeout( function() { editor.save(); setInitialCompare(); }, 1000 ); } }); return { getPostData: getPostData, getCompareString: getCompareString, disableButtons: disableButtons, enableButtons: enableButtons, local: autosaveLocal(), server: autosaveServer() }; } /** @namespace wp */ window.wp = window.wp || {}; window.wp.autosave = autosave(); }( jQuery, window )); PK!;D* ;;heartbeat.min.jsnu[/*! This file is auto-generated */ !function(w,g){g.wp=g.wp||{},g.wp.heartbeat=new function(){var e,t,n,a,i=w(document),r={suspend:!1,suspendEnabled:!0,screenId:"",url:"",lastTick:0,queue:{},mainInterval:60,tempInterval:0,originalInterval:0,minimalInterval:0,countdown:0,connecting:!1,connectionError:!1,errorcount:0,hasConnected:!1,hasFocus:!0,userActivity:0,userActivityEvents:!1,checkFocusTimer:0,beatTimer:0};function o(){return(new Date).getTime()}function c(e){var t,n=e.src;if(!n||!/^https?:\/\//.test(n)||(t=g.location.origin||g.location.protocol+"//"+g.location.host,0===n.indexOf(t)))try{if(e.contentWindow.document)return 1}catch(e){}}function s(){r.hasFocus&&!document.hasFocus()?v():!r.hasFocus&&document.hasFocus()&&d()}function u(e,t){var n;if(e){switch(e){case"abort":break;case"timeout":n=!0;break;case"error":if(503===t&&r.hasConnected){n=!0;break}case"parsererror":case"empty":case"unknown":r.errorcount++,2 .ab-item' ).focus(); removeClass( wrapper, 'hover' ); } /** * Toggle hover class for top level menu item when enter is pressed. * * @since 5.3.1 * * @param {Event} event The keydown event. */ function toggleHoverIfEnter( event ) { var wrapper; // Follow link if pressing Ctrl and/or Shift with Enter (opening in a new tab or window). if ( event.which !== 13 || event.ctrlKey || event.shiftKey ) { return; } if ( !! getClosest( event.target, '.ab-sub-wrapper' ) ) { return; } wrapper = getClosest( event.target, '.menupop' ); if ( ! wrapper ) { return; } event.preventDefault(); if ( hasClass( wrapper, 'hover' ) ) { removeClass( wrapper, 'hover' ); } else { addClass( wrapper, 'hover' ); } } /** * Toggle hover class for mobile devices. * * @since 5.3.1 * * @param {NodeList} topMenuItems All menu items. * @param {Event} event The click event. */ function mobileHover( topMenuItems, event ) { var wrapper; if ( !! getClosest( event.target, '.ab-sub-wrapper' ) ) { return; } event.preventDefault(); wrapper = getClosest( event.target, '.menupop' ); if ( ! wrapper ) { return; } if ( hasClass( wrapper, 'hover' ) ) { removeClass( wrapper, 'hover' ); } else { removeAllHoverClass( topMenuItems ); addClass( wrapper, 'hover' ); } } /** * Handles the click on the Shortlink link in the adminbar. * * @since 3.1.0 * @since 5.3.1 Use querySelector to clean up the function. * * @param {Event} event The click event. * @return {boolean} Returns false to prevent default click behavior. */ function clickShortlink( event ) { var wrapper = event.target.parentNode, input; if ( wrapper ) { input = wrapper.querySelector( '.shortlink-input' ); } if ( ! input ) { return; } // (Old) IE doesn't support preventDefault, and does support returnValue. if ( event.preventDefault ) { event.preventDefault(); } event.returnValue = false; addClass( wrapper, 'selected' ); input.focus(); input.select(); input.onblur = function() { removeClass( wrapper, 'selected' ); }; return false; } /** * Clear sessionStorage on logging out. * * @since 5.3.1 */ function emptySessionStorage() { if ( 'sessionStorage' in window ) { try { for ( var key in sessionStorage ) { if ( key.indexOf( 'wp-autosave-' ) > -1 ) { sessionStorage.removeItem( key ); } } } catch ( er ) {} } } /** * Check if element has class. * * @since 5.3.1 * * @param {HTMLElement} element The HTML element. * @param {string} className The class name. * @return {boolean} Whether the element has the className. */ function hasClass( element, className ) { var classNames; if ( ! element ) { return false; } if ( element.classList && element.classList.contains ) { return element.classList.contains( className ); } else if ( element.className ) { classNames = element.className.split( ' ' ); return classNames.indexOf( className ) > -1; } return false; } /** * Add class to an element. * * @since 5.3.1 * * @param {HTMLElement} element The HTML element. * @param {string} className The class name. */ function addClass( element, className ) { if ( ! element ) { return; } if ( element.classList && element.classList.add ) { element.classList.add( className ); } else if ( ! hasClass( element, className ) ) { if ( element.className ) { element.className += ' '; } element.className += className; } var menuItemToggle = element.querySelector( 'a' ); if ( className === 'hover' && menuItemToggle && menuItemToggle.hasAttribute( 'aria-expanded' ) ) { menuItemToggle.setAttribute( 'aria-expanded', 'true' ); } } /** * Remove class from an element. * * @since 5.3.1 * * @param {HTMLElement} element The HTML element. * @param {string} className The class name. */ function removeClass( element, className ) { var testName, classes; if ( ! element || ! hasClass( element, className ) ) { return; } if ( element.classList && element.classList.remove ) { element.classList.remove( className ); } else { testName = ' ' + className + ' '; classes = ' ' + element.className + ' '; while ( classes.indexOf( testName ) > -1 ) { classes = classes.replace( testName, '' ); } element.className = classes.replace( /^[\s]+|[\s]+$/g, '' ); } var menuItemToggle = element.querySelector( 'a' ); if ( className === 'hover' && menuItemToggle && menuItemToggle.hasAttribute( 'aria-expanded' ) ) { menuItemToggle.setAttribute( 'aria-expanded', 'false' ); } } /** * Remove hover class for all menu items. * * @since 5.3.1 * * @param {NodeList} topMenuItems All menu items. */ function removeAllHoverClass( topMenuItems ) { if ( topMenuItems && topMenuItems.length ) { for ( var i = 0; i < topMenuItems.length; i++ ) { removeClass( topMenuItems[i], 'hover' ); } } } /** * Scrolls to the top of the page. * * @since 3.4.0 * * @param {Event} event The Click event. * * @return {void} */ function scrollToTop( event ) { // Only scroll when clicking on the wpadminbar, not on menus or submenus. if ( event.target && event.target.id !== 'wpadminbar' && event.target.id !== 'wp-admin-bar-top-secondary' ) { return; } try { window.scrollTo( { top: -32, left: 0, behavior: 'smooth' } ); } catch ( er ) { window.scrollTo( 0, -32 ); } } /** * Get closest Element. * * @since 5.3.1 * * @param {HTMLElement} el Element to get parent. * @param {string} selector CSS selector to match. */ function getClosest( el, selector ) { if ( ! window.Element.prototype.matches ) { // Polyfill from https://developer.mozilla.org/en-US/docs/Web/API/Element/matches. window.Element.prototype.matches = window.Element.prototype.matchesSelector || window.Element.prototype.mozMatchesSelector || window.Element.prototype.msMatchesSelector || window.Element.prototype.oMatchesSelector || window.Element.prototype.webkitMatchesSelector || function( s ) { var matches = ( this.document || this.ownerDocument ).querySelectorAll( s ), i = matches.length; while ( --i >= 0 && matches.item( i ) !== this ) { } return i > -1; }; } // Get the closest matching elent. for ( ; el && el !== document; el = el.parentNode ) { if ( el.matches( selector ) ) { return el; } } return null; } } )( document, window, navigator ); PK!xUUwp-list-revisions.min.jsnu[/*! This file is auto-generated */ !function(e){function t(){var e=document.getElementById("post-revisions"),n=e?e.getElementsByTagName("input"):[];e.onclick=function(){for(var e,t=0,i=0;i tags or HTMLImage nodes. * "emojify" a generic text or DOM Element. * * @overloads * * String replacement for `innerHTML` or server side operations * twemoji.parse(string); * twemoji.parse(string, Function); * twemoji.parse(string, Object); * * HTMLElement tree parsing for safer operations over existing DOM * twemoji.parse(HTMLElement); * twemoji.parse(HTMLElement, Function); * twemoji.parse(HTMLElement, Object); * * @param string|HTMLElement the source to parse and enrich with emoji. * * string replace emoji matches with tags. * Mainly used to inject emoji via `innerHTML` * It does **not** parse the string or validate it, * it simply replaces found emoji with a tag. * NOTE: be sure this won't affect security. * * HTMLElement walk through the DOM tree and find emoji * that are inside **text node only** (nodeType === 3) * Mainly used to put emoji in already generated DOM * without compromising surrounding nodes and * **avoiding** the usage of `innerHTML`. * NOTE: Using DOM elements instead of strings should * improve security without compromising too much * performance compared with a less safe `innerHTML`. * * @param Function|Object [optional] * either the callback that will be invoked or an object * with all properties to use per each found emoji. * * Function if specified, this will be invoked per each emoji * that has been found through the RegExp except * those follwed by the invariant \uFE0E ("as text"). * Once invoked, parameters will be: * * iconId:string the lower case HEX code point * i.e. "1f4a9" * * options:Object all info for this parsing operation * * variant:char the optional \uFE0F ("as image") * variant, in case this info * is anyhow meaningful. * By default this is ignored. * * If such callback will return a falsy value instead * of a valid `src` to use for the image, nothing will * actually change for that specific emoji. * * * Object if specified, an object containing the following properties * * callback Function the callback to invoke per each found emoji. * base string the base url, by default twemoji.base * ext string the image extension, by default twemoji.ext * size string the assets size, by default twemoji.size * * @example * * twemoji.parse("I \u2764\uFE0F emoji!"); * // I ❤️ emoji! * * * twemoji.parse("I \u2764\uFE0F emoji!", function(iconId, options) { * return '/assets/' + iconId + '.gif'; * }); * // I ❤️ emoji! * * * twemoji.parse("I \u2764\uFE0F emoji!", { * size: 72, * callback: function(iconId, options) { * return '/assets/' + options.size + '/' + iconId + options.ext; * } * }); * // I ❤️ emoji! * */ parse: parse, /** * Given a string, invokes the callback argument * per each emoji found in such string. * This is the most raw version used by * the .parse(string) method itself. * * @param string generic string to parse * @param Function a generic callback that will be * invoked to replace the content. * This callback will receive standard * String.prototype.replace(str, callback) * arguments such: * callback( * rawText, // the emoji match * ); * * and others commonly received via replace. */ replace: replace, /** * Simplify string tests against emoji. * * @param string some text that might contain emoji * @return boolean true if any emoji was found, false otherwise. * * @example * * if (twemoji.test(someContent)) { * console.log("emoji All The Things!"); * } */ test: test }, // used to escape HTML special chars in attributes escaper = { '&': '&', '<': '<', '>': '>', "'": ''', '"': '"' }, // RegExp based on emoji's official Unicode standards // http://www.unicode.org/Public/UNIDATA/EmojiSources.txt re = /(?:\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\udc68\udc69]|\ud83e\udef1\ud83c\udffb\u200d\ud83e\udef2\ud83c[\udffc-\udfff]|\ud83e\udef1\ud83c\udffc\u200d\ud83e\udef2\ud83c[\udffb\udffd-\udfff]|\ud83e\udef1\ud83c\udffd\u200d\ud83e\udef2\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\udef1\ud83c\udffe\u200d\ud83e\udef2\ud83c[\udffb-\udffd\udfff]|\ud83e\udef1\ud83c\udfff\u200d\ud83e\udef2\ud83c[\udffb-\udffe]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d[\udc68\udc69]|\ud83e\uddd1\u200d\ud83e\udd1d\u200d\ud83e\uddd1|\ud83d\udc6b\ud83c[\udffb-\udfff]|\ud83d\udc6c\ud83c[\udffb-\udfff]|\ud83d\udc6d\ud83c[\udffb-\udfff]|\ud83d\udc8f\ud83c[\udffb-\udfff]|\ud83d\udc91\ud83c[\udffb-\udfff]|\ud83e\udd1d\ud83c[\udffb-\udfff]|\ud83d[\udc6b-\udc6d\udc8f\udc91]|\ud83e\udd1d)|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\u2695\ufe0f|\u2696\ufe0f|\u2708\ufe0f|\ud83c[\udf3e\udf73\udf7c\udf84\udf93\udfa4\udfa8\udfeb\udfed]|\ud83d[\udcbb\udcbc\udd27\udd2c\ude80\ude92]|\ud83e[\uddaf-\uddb3\uddbc\uddbd])|(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75]|\u26f9)((?:\ud83c[\udffb-\udfff]|\ufe0f)\u200d[\u2640\u2642]\ufe0f)|(?:\ud83c[\udfc3\udfc4\udfca]|\ud83d[\udc6e\udc70\udc71\udc73\udc77\udc81\udc82\udc86\udc87\ude45-\ude47\ude4b\ude4d\ude4e\udea3\udeb4-\udeb6]|\ud83e[\udd26\udd35\udd37-\udd39\udd3d\udd3e\uddb8\uddb9\uddcd-\uddcf\uddd4\uddd6-\udddd])(?:\ud83c[\udffb-\udfff])?\u200d[\u2640\u2642]\ufe0f|(?:\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f|\ud83c\udff3\ufe0f\u200d\ud83c\udf08|\ud83d\ude36\u200d\ud83c\udf2b\ufe0f|\u2764\ufe0f\u200d\ud83d\udd25|\u2764\ufe0f\u200d\ud83e\ude79|\ud83c\udff4\u200d\u2620\ufe0f|\ud83d\udc15\u200d\ud83e\uddba|\ud83d\udc3b\u200d\u2744\ufe0f|\ud83d\udc41\u200d\ud83d\udde8|\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc6f\u200d\u2640\ufe0f|\ud83d\udc6f\u200d\u2642\ufe0f|\ud83d\ude2e\u200d\ud83d\udca8|\ud83d\ude35\u200d\ud83d\udcab|\ud83e\udd3c\u200d\u2640\ufe0f|\ud83e\udd3c\u200d\u2642\ufe0f|\ud83e\uddde\u200d\u2640\ufe0f|\ud83e\uddde\u200d\u2642\ufe0f|\ud83e\udddf\u200d\u2640\ufe0f|\ud83e\udddf\u200d\u2642\ufe0f|\ud83d\udc08\u200d\u2b1b|\ud83d\udc26\u200d\u2b1b)|[#*0-9]\ufe0f?\u20e3|(?:[©®\u2122\u265f]\ufe0f)|(?:\ud83c[\udc04\udd70\udd71\udd7e\udd7f\ude02\ude1a\ude2f\ude37\udf21\udf24-\udf2c\udf36\udf7d\udf96\udf97\udf99-\udf9b\udf9e\udf9f\udfcd\udfce\udfd4-\udfdf\udff3\udff5\udff7]|\ud83d[\udc3f\udc41\udcfd\udd49\udd4a\udd6f\udd70\udd73\udd76-\udd79\udd87\udd8a-\udd8d\udda5\udda8\uddb1\uddb2\uddbc\uddc2-\uddc4\uddd1-\uddd3\udddc-\uddde\udde1\udde3\udde8\uddef\uddf3\uddfa\udecb\udecd-\udecf\udee0-\udee5\udee9\udef0\udef3]|[\u203c\u2049\u2139\u2194-\u2199\u21a9\u21aa\u231a\u231b\u2328\u23cf\u23ed-\u23ef\u23f1\u23f2\u23f8-\u23fa\u24c2\u25aa\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600-\u2604\u260e\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638-\u263a\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267b\u267f\u2692-\u2697\u2699\u269b\u269c\u26a0\u26a1\u26a7\u26aa\u26ab\u26b0\u26b1\u26bd\u26be\u26c4\u26c5\u26c8\u26cf\u26d1\u26d3\u26d4\u26e9\u26ea\u26f0-\u26f5\u26f8\u26fa\u26fd\u2702\u2708\u2709\u270f\u2712\u2714\u2716\u271d\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u2764\u27a1\u2934\u2935\u2b05-\u2b07\u2b1b\u2b1c\u2b50\u2b55\u3030\u303d\u3297\u3299])(?:\ufe0f|(?!\ufe0e))|(?:(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75\udd90]|\ud83e\udef0|[\u261d\u26f7\u26f9\u270c\u270d])(?:\ufe0f|(?!\ufe0e))|(?:\ud83c[\udf85\udfc2-\udfc4\udfc7\udfca]|\ud83d[\udc42\udc43\udc46-\udc50\udc66-\udc69\udc6e\udc70-\udc78\udc7c\udc81-\udc83\udc85-\udc87\udcaa\udd7a\udd95\udd96\ude45-\ude47\ude4b-\ude4f\udea3\udeb4-\udeb6\udec0\udecc]|\ud83e[\udd0c\udd0f\udd18-\udd1c\udd1e\udd1f\udd26\udd30-\udd39\udd3d\udd3e\udd77\uddb5\uddb6\uddb8\uddb9\uddbb\uddcd-\uddcf\uddd1-\udddd\udec3-\udec5\udef1-\udef8]|[\u270a\u270b]))(?:\ud83c[\udffb-\udfff])?|(?:\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc73\udb40\udc63\udb40\udc74\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc77\udb40\udc6c\udb40\udc73\udb40\udc7f|\ud83c\udde6\ud83c[\udde8-\uddec\uddee\uddf1\uddf2\uddf4\uddf6-\uddfa\uddfc\uddfd\uddff]|\ud83c\udde7\ud83c[\udde6\udde7\udde9-\uddef\uddf1-\uddf4\uddf6-\uddf9\uddfb\uddfc\uddfe\uddff]|\ud83c\udde8\ud83c[\udde6\udde8\udde9\uddeb-\uddee\uddf0-\uddf5\uddf7\uddfa-\uddff]|\ud83c\udde9\ud83c[\uddea\uddec\uddef\uddf0\uddf2\uddf4\uddff]|\ud83c\uddea\ud83c[\udde6\udde8\uddea\uddec\udded\uddf7-\uddfa]|\ud83c\uddeb\ud83c[\uddee-\uddf0\uddf2\uddf4\uddf7]|\ud83c\uddec\ud83c[\udde6\udde7\udde9-\uddee\uddf1-\uddf3\uddf5-\uddfa\uddfc\uddfe]|\ud83c\udded\ud83c[\uddf0\uddf2\uddf3\uddf7\uddf9\uddfa]|\ud83c\uddee\ud83c[\udde8-\uddea\uddf1-\uddf4\uddf6-\uddf9]|\ud83c\uddef\ud83c[\uddea\uddf2\uddf4\uddf5]|\ud83c\uddf0\ud83c[\uddea\uddec-\uddee\uddf2\uddf3\uddf5\uddf7\uddfc\uddfe\uddff]|\ud83c\uddf1\ud83c[\udde6-\udde8\uddee\uddf0\uddf7-\uddfb\uddfe]|\ud83c\uddf2\ud83c[\udde6\udde8-\udded\uddf0-\uddff]|\ud83c\uddf3\ud83c[\udde6\udde8\uddea-\uddec\uddee\uddf1\uddf4\uddf5\uddf7\uddfa\uddff]|\ud83c\uddf4\ud83c\uddf2|\ud83c\uddf5\ud83c[\udde6\uddea-\udded\uddf0-\uddf3\uddf7-\uddf9\uddfc\uddfe]|\ud83c\uddf6\ud83c\udde6|\ud83c\uddf7\ud83c[\uddea\uddf4\uddf8\uddfa\uddfc]|\ud83c\uddf8\ud83c[\udde6-\uddea\uddec-\uddf4\uddf7-\uddf9\uddfb\uddfd-\uddff]|\ud83c\uddf9\ud83c[\udde6\udde8\udde9\uddeb-\udded\uddef-\uddf4\uddf7\uddf9\uddfb\uddfc\uddff]|\ud83c\uddfa\ud83c[\udde6\uddec\uddf2\uddf3\uddf8\uddfe\uddff]|\ud83c\uddfb\ud83c[\udde6\udde8\uddea\uddec\uddee\uddf3\uddfa]|\ud83c\uddfc\ud83c[\uddeb\uddf8]|\ud83c\uddfd\ud83c\uddf0|\ud83c\uddfe\ud83c[\uddea\uddf9]|\ud83c\uddff\ud83c[\udde6\uddf2\uddfc]|\ud83c[\udccf\udd8e\udd91-\udd9a\udde6-\uddff\ude01\ude32-\ude36\ude38-\ude3a\ude50\ude51\udf00-\udf20\udf2d-\udf35\udf37-\udf7c\udf7e-\udf84\udf86-\udf93\udfa0-\udfc1\udfc5\udfc6\udfc8\udfc9\udfcf-\udfd3\udfe0-\udff0\udff4\udff8-\udfff]|\ud83d[\udc00-\udc3e\udc40\udc44\udc45\udc51-\udc65\udc6a\udc6f\udc79-\udc7b\udc7d-\udc80\udc84\udc88-\udc8e\udc90\udc92-\udca9\udcab-\udcfc\udcff-\udd3d\udd4b-\udd4e\udd50-\udd67\udda4\uddfb-\ude44\ude48-\ude4a\ude80-\udea2\udea4-\udeb3\udeb7-\udebf\udec1-\udec5\uded0-\uded2\uded5-\uded7\udedc-\udedf\udeeb\udeec\udef4-\udefc\udfe0-\udfeb\udff0]|\ud83e[\udd0d\udd0e\udd10-\udd17\udd20-\udd25\udd27-\udd2f\udd3a\udd3c\udd3f-\udd45\udd47-\udd76\udd78-\uddb4\uddb7\uddba\uddbc-\uddcc\uddd0\uddde-\uddff\ude70-\ude7c\ude80-\ude88\ude90-\udebd\udebf-\udec2\udece-\udedb\udee0-\udee8]|[\u23e9-\u23ec\u23f0\u23f3\u267e\u26ce\u2705\u2728\u274c\u274e\u2753-\u2755\u2795-\u2797\u27b0\u27bf\ue50a])|\ufe0f/g, // avoid runtime RegExp creation for not so smart, // not JIT based, and old browsers / engines UFE0Fg = /\uFE0F/g, // avoid using a string literal like '\u200D' here because minifiers expand it inline U200D = String.fromCharCode(0x200D), // used to find HTML special chars in attributes rescaper = /[&<>'"]/g, // nodes with type 1 which should **not** be parsed shouldntBeParsed = /^(?:iframe|noframes|noscript|script|select|style|textarea)$/, // just a private shortcut fromCharCode = String.fromCharCode; return twemoji; ///////////////////////// // private functions // // declaration // ///////////////////////// /** * Shortcut to create text nodes * @param string text used to create DOM text node * @return Node a DOM node with that text */ function createText(text, clean) { return document.createTextNode(clean ? text.replace(UFE0Fg, '') : text); } /** * Utility function to escape html attribute text * @param string text use in HTML attribute * @return string text encoded to use in HTML attribute */ function escapeHTML(s) { return s.replace(rescaper, replacer); } /** * Default callback used to generate emoji src * based on Twitter CDN * @param string the emoji codepoint string * @param string the default size to use, i.e. "36x36" * @return string the image source to use */ function defaultImageSrcGenerator(icon, options) { return ''.concat(options.base, options.size, '/', icon, options.ext); } /** * Given a generic DOM nodeType 1, walk through all children * and store every nodeType 3 (#text) found in the tree. * @param Element a DOM Element with probably some text in it * @param Array the list of previously discovered text nodes * @return Array same list with new discovered nodes, if any */ function grabAllTextNodes(node, allText) { var childNodes = node.childNodes, length = childNodes.length, subnode, nodeType; while (length--) { subnode = childNodes[length]; nodeType = subnode.nodeType; // parse emoji only in text nodes if (nodeType === 3) { // collect them to process emoji later allText.push(subnode); } // ignore all nodes that are not type 1, that are svg, or that // should not be parsed as script, style, and others else if (nodeType === 1 && !('ownerSVGElement' in subnode) && !shouldntBeParsed.test(subnode.nodeName.toLowerCase())) { // WP start // Use doNotParse() callback if set. if ( twemoji.doNotParse && twemoji.doNotParse( subnode ) ) { continue; } // WP end grabAllTextNodes(subnode, allText); } } return allText; } /** * Used to both remove the possible variant * and to convert utf16 into code points. * If there is a zero-width-joiner (U+200D), leave the variants in. * @param string the raw text of the emoji match * @return string the code point */ function grabTheRightIcon(rawText) { // if variant is present as \uFE0F return toCodePoint(rawText.indexOf(U200D) < 0 ? rawText.replace(UFE0Fg, '') : rawText ); } /** * DOM version of the same logic / parser: * emojify all found sub-text nodes placing images node instead. * @param Element generic DOM node with some text in some child node * @param Object options containing info about how to parse * * .callback Function the callback to invoke per each found emoji. * .base string the base url, by default twemoji.base * .ext string the image extension, by default twemoji.ext * .size string the assets size, by default twemoji.size * * @return Element same generic node with emoji in place, if any. */ function parseNode(node, options) { var allText = grabAllTextNodes(node, []), length = allText.length, attrib, attrname, modified, fragment, subnode, text, match, i, index, img, rawText, iconId, src; while (length--) { modified = false; fragment = document.createDocumentFragment(); subnode = allText[length]; text = subnode.nodeValue; i = 0; while ((match = re.exec(text))) { index = match.index; if (index !== i) { fragment.appendChild( createText(text.slice(i, index), true) ); } rawText = match[0]; iconId = grabTheRightIcon(rawText); i = index + rawText.length; src = options.callback(iconId, options); if (iconId && src) { img = new Image(); img.onerror = options.onerror; img.setAttribute('draggable', 'false'); attrib = options.attributes(rawText, iconId); for (attrname in attrib) { if ( attrib.hasOwnProperty(attrname) && // don't allow any handlers to be set + don't allow overrides attrname.indexOf('on') !== 0 && !img.hasAttribute(attrname) ) { img.setAttribute(attrname, attrib[attrname]); } } img.className = options.className; img.alt = rawText; img.src = src; modified = true; fragment.appendChild(img); } if (!img) fragment.appendChild(createText(rawText, false)); img = null; } // is there actually anything to replace in here ? if (modified) { // any text left to be added ? if (i < text.length) { fragment.appendChild( createText(text.slice(i), true) ); } // replace the text node only, leave intact // anything else surrounding such text subnode.parentNode.replaceChild(fragment, subnode); } } return node; } /** * String/HTML version of the same logic / parser: * emojify a generic text placing images tags instead of surrogates pair. * @param string generic string with possibly some emoji in it * @param Object options containing info about how to parse * * .callback Function the callback to invoke per each found emoji. * .base string the base url, by default twemoji.base * .ext string the image extension, by default twemoji.ext * .size string the assets size, by default twemoji.size * * @return the string with replacing all found and parsed emoji */ function parseString(str, options) { return replace(str, function (rawText) { var ret = rawText, iconId = grabTheRightIcon(rawText), src = options.callback(iconId, options), attrib, attrname; if (iconId && src) { // recycle the match string replacing the emoji // with its image counter part ret = ''); } return ret; }); } /** * Function used to actually replace HTML special chars * @param string HTML special char * @return string encoded HTML special char */ function replacer(m) { return escaper[m]; } /** * Default options.attribute callback * @return null */ function returnNull() { return null; } /** * Given a generic value, creates its squared counterpart if it's a number. * As example, number 36 will return '36x36'. * @param any a generic value. * @return any a string representing asset size, i.e. "36x36" * only in case the value was a number. * Returns initial value otherwise. */ function toSizeSquaredAsset(value) { return typeof value === 'number' ? value + 'x' + value : value; } ///////////////////////// // exported functions // // declaration // ///////////////////////// function fromCodePoint(codepoint) { var code = typeof codepoint === 'string' ? parseInt(codepoint, 16) : codepoint; if (code < 0x10000) { return fromCharCode(code); } code -= 0x10000; return fromCharCode( 0xD800 + (code >> 10), 0xDC00 + (code & 0x3FF) ); } function parse(what, how) { if (!how || typeof how === 'function') { how = {callback: how}; } // WP start // Allow passing of the doNotParse() callback in the settings. // The callback is used in `grabAllTextNodes()` (DOM mode only) as a filter // that allows bypassing of some of the text nodes. It gets the current subnode as argument. twemoji.doNotParse = how.doNotParse; // WP end // if first argument is string, inject html tags // otherwise use the DOM tree and parse text nodes only return (typeof what === 'string' ? parseString : parseNode)(what, { callback: how.callback || defaultImageSrcGenerator, attributes: typeof how.attributes === 'function' ? how.attributes : returnNull, base: typeof how.base === 'string' ? how.base : twemoji.base, ext: how.ext || twemoji.ext, size: how.folder || toSizeSquaredAsset(how.size || twemoji.size), className: how.className || twemoji.className, onerror: how.onerror || twemoji.onerror }); } function replace(text, callback) { return String(text).replace(re, callback); } function test(text) { // IE6 needs a reset before too re.lastIndex = 0; var result = re.test(text); re.lastIndex = 0; return result; } function toCodePoint(unicodeSurrogates, sep) { var r = [], c = 0, p = 0, i = 0; while (i < unicodeSurrogates.length) { c = unicodeSurrogates.charCodeAt(i++); if (p) { r.push((0x10000 + ((p - 0xD800) << 10) + (c - 0xDC00)).toString(16)); p = 0; } else if (0xD800 <= c && c <= 0xDBFF) { p = c; } else { r.push(c.toString(16)); } } return r.join(sep || '-'); } }()); PK!eG G json2.min.jsnu[/*! This file is auto-generated */ "object"!=typeof JSON&&(JSON={}),!function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta,rep;function f(t){return t<10?"0"+t:t}function this_value(){return this.valueOf()}function quote(t){return rx_escapable.lastIndex=0,rx_escapable.test(t)?'"'+t.replace(rx_escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var r,n,o,u,f,a=gap,i=e[t];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(t)),typeof(i="function"==typeof rep?rep.call(e,t,i):i)){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,f=[],"[object Array]"===Object.prototype.toString.apply(i)){for(u=i.length,r=0;r 0 ? injectUrlWithState( url ) : url ); }; } )( history.replaceState ); history.pushState = ( function( nativePushState ) { return function historyPushState( data, title, url ) { currentHistoryState = data; return nativePushState.call( history, data, title, 'string' === typeof url && url.length > 0 ? injectUrlWithState( url ) : url ); }; } )( history.pushState ); window.addEventListener( 'popstate', function( event ) { currentHistoryState = event.state; } ); }( history ) ); /** * Returns a debounced version of the function. * * @todo Require Underscore.js for this file and retire this. */ debounce = function( fn, delay, context ) { var timeout; return function() { var args = arguments; context = context || this; clearTimeout( timeout ); timeout = setTimeout( function() { timeout = null; fn.apply( context, args ); }, delay ); }; }; /** * @memberOf wp.customize * @alias wp.customize.Preview * * @constructor * @augments wp.customize.Messenger * @augments wp.customize.Class * @mixes wp.customize.Events */ api.Preview = api.Messenger.extend(/** @lends wp.customize.Preview.prototype */{ /** * @param {Object} params - Parameters to configure the messenger. * @param {Object} options - Extend any instance parameter or method with this object. */ initialize: function( params, options ) { var preview = this, urlParser = document.createElement( 'a' ); api.Messenger.prototype.initialize.call( preview, params, options ); urlParser.href = preview.origin(); preview.add( 'scheme', urlParser.protocol.replace( /:$/, '' ) ); preview.body = $( document.body ); preview.window = $( window ); if ( api.settings.channel ) { // If in an iframe, then intercept the link clicks and form submissions. preview.body.on( 'click.preview', 'a', function( event ) { preview.handleLinkClick( event ); } ); preview.body.on( 'submit.preview', 'form', function( event ) { preview.handleFormSubmit( event ); } ); preview.window.on( 'scroll.preview', debounce( function() { preview.send( 'scroll', preview.window.scrollTop() ); }, 200 ) ); preview.bind( 'scroll', function( distance ) { preview.window.scrollTop( distance ); }); } }, /** * Handle link clicks in preview. * * @since 4.7.0 * @access public * * @param {jQuery.Event} event Event. */ handleLinkClick: function( event ) { var preview = this, link, isInternalJumpLink; link = $( event.target ).closest( 'a' ); // No-op if the anchor is not a link. if ( _.isUndefined( link.attr( 'href' ) ) ) { return; } // Allow internal jump links and JS links to behave normally without preventing default. isInternalJumpLink = ( '#' === link.attr( 'href' ).substr( 0, 1 ) ); if ( isInternalJumpLink || ! /^https?:$/.test( link.prop( 'protocol' ) ) ) { return; } // If the link is not previewable, prevent the browser from navigating to it. if ( ! api.isLinkPreviewable( link[0] ) ) { wp.a11y.speak( api.settings.l10n.linkUnpreviewable ); event.preventDefault(); return; } // Prevent initiating navigating from click and instead rely on sending url message to pane. event.preventDefault(); /* * Note the shift key is checked so shift+click on widgets or * nav menu items can just result on focusing on the corresponding * control instead of also navigating to the URL linked to. */ if ( event.shiftKey ) { return; } // Note: It's not relevant to send scroll because sending url message will have the same effect. preview.send( 'url', link.prop( 'href' ) ); }, /** * Handle form submit. * * @since 4.7.0 * @access public * * @param {jQuery.Event} event Event. */ handleFormSubmit: function( event ) { var preview = this, urlParser, form; urlParser = document.createElement( 'a' ); form = $( event.target ); urlParser.href = form.prop( 'action' ); // If the link is not previewable, prevent the browser from navigating to it. if ( 'GET' !== form.prop( 'method' ).toUpperCase() || ! api.isLinkPreviewable( urlParser ) ) { wp.a11y.speak( api.settings.l10n.formUnpreviewable ); event.preventDefault(); return; } /* * If the default wasn't prevented already (in which case the form * submission is already being handled by JS), and if it has a GET * request method, then take the serialized form data and add it as * a query string to the action URL and send this in a url message * to the customizer pane so that it will be loaded. If the form's * action points to a non-previewable URL, the customizer pane's * previewUrl setter will reject it so that the form submission is * a no-op, which is the same behavior as when clicking a link to an * external site in the preview. */ if ( ! event.isDefaultPrevented() ) { if ( urlParser.search.length > 1 ) { urlParser.search += '&'; } urlParser.search += form.serialize(); preview.send( 'url', urlParser.href ); } // Prevent default since navigation should be done via sending url message or via JS submit handler. event.preventDefault(); } }); /** * Inject the changeset UUID into links in the document. * * @since 4.7.0 * @access protected * @access private * * @return {void} */ api.addLinkPreviewing = function addLinkPreviewing() { var linkSelectors = 'a[href], area[href]'; // Inject links into initial document. $( document.body ).find( linkSelectors ).each( function() { api.prepareLinkPreview( this ); } ); // Inject links for new elements added to the page. if ( 'undefined' !== typeof MutationObserver ) { api.mutationObserver = new MutationObserver( function( mutations ) { _.each( mutations, function( mutation ) { $( mutation.target ).find( linkSelectors ).each( function() { api.prepareLinkPreview( this ); } ); } ); } ); api.mutationObserver.observe( document.documentElement, { childList: true, subtree: true } ); } else { // If mutation observers aren't available, fallback to just-in-time injection. $( document.documentElement ).on( 'click focus mouseover', linkSelectors, function() { api.prepareLinkPreview( this ); } ); } }; /** * Should the supplied link is previewable. * * @since 4.7.0 * @access public * * @param {HTMLAnchorElement|HTMLAreaElement} element Link element. * @param {string} element.search Query string. * @param {string} element.pathname Path. * @param {string} element.host Host. * @param {Object} [options] * @param {Object} [options.allowAdminAjax=false] Allow admin-ajax.php requests. * @return {boolean} Is appropriate for changeset link. */ api.isLinkPreviewable = function isLinkPreviewable( element, options ) { var matchesAllowedUrl, parsedAllowedUrl, args, elementHost; args = _.extend( {}, { allowAdminAjax: false }, options || {} ); if ( 'javascript:' === element.protocol ) { // jshint ignore:line return true; } // Only web URLs can be previewed. if ( 'https:' !== element.protocol && 'http:' !== element.protocol ) { return false; } elementHost = element.host.replace( /:(80|443)$/, '' ); parsedAllowedUrl = document.createElement( 'a' ); matchesAllowedUrl = ! _.isUndefined( _.find( api.settings.url.allowed, function( allowedUrl ) { parsedAllowedUrl.href = allowedUrl; return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host.replace( /:(80|443)$/, '' ) === elementHost && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) ); } ) ); if ( ! matchesAllowedUrl ) { return false; } // Skip wp login and signup pages. if ( /\/wp-(login|signup)\.php$/.test( element.pathname ) ) { return false; } // Allow links to admin ajax as faux frontend URLs. if ( /\/wp-admin\/admin-ajax\.php$/.test( element.pathname ) ) { return args.allowAdminAjax; } // Disallow links to admin, includes, and content. if ( /\/wp-(admin|includes|content)(\/|$)/.test( element.pathname ) ) { return false; } return true; }; /** * Inject the customize_changeset_uuid query param into links on the frontend. * * @since 4.7.0 * @access protected * * @param {HTMLAnchorElement|HTMLAreaElement} element Link element. * @param {string} element.search Query string. * @param {string} element.host Host. * @param {string} element.protocol Protocol. * @return {void} */ api.prepareLinkPreview = function prepareLinkPreview( element ) { var queryParams, $element = $( element ); // Skip elements with no href attribute. Check first to avoid more expensive checks down the road. if ( ! element.hasAttribute( 'href' ) ) { return; } // Skip links in admin bar. if ( $element.closest( '#wpadminbar' ).length ) { return; } // Ignore links with href="#", href="#id", or non-HTTP protocols (e.g. javascript: and mailto:). if ( '#' === $element.attr( 'href' ).substr( 0, 1 ) || ! /^https?:$/.test( element.protocol ) ) { return; } // Make sure links in preview use HTTPS if parent frame uses HTTPS. if ( api.settings.channel && 'https' === api.preview.scheme.get() && 'http:' === element.protocol && -1 !== api.settings.url.allowedHosts.indexOf( element.host ) ) { element.protocol = 'https:'; } // Ignore links with class wp-playlist-caption. if ( $element.hasClass( 'wp-playlist-caption' ) ) { return; } if ( ! api.isLinkPreviewable( element ) ) { // Style link as unpreviewable only if previewing in iframe; if previewing on frontend, links will be allowed to work normally. if ( api.settings.channel ) { $element.addClass( 'customize-unpreviewable' ); } return; } $element.removeClass( 'customize-unpreviewable' ); queryParams = api.utils.parseQueryString( element.search.substring( 1 ) ); queryParams.customize_changeset_uuid = api.settings.changeset.uuid; if ( api.settings.changeset.autosaved ) { queryParams.customize_autosaved = 'on'; } if ( ! api.settings.theme.active ) { queryParams.customize_theme = api.settings.theme.stylesheet; } if ( api.settings.channel ) { queryParams.customize_messenger_channel = api.settings.channel; } element.search = $.param( queryParams ); }; /** * Inject the changeset UUID into Ajax requests. * * @since 4.7.0 * @access protected * * @return {void} */ api.addRequestPreviewing = function addRequestPreviewing() { /** * Rewrite Ajax requests to inject customizer state. * * @param {Object} options Options. * @param {string} options.type Type. * @param {string} options.url URL. * @param {Object} originalOptions Original options. * @param {XMLHttpRequest} xhr XHR. * @return {void} */ var prefilterAjax = function( options, originalOptions, xhr ) { var urlParser, queryParams, requestMethod, dirtyValues = {}; urlParser = document.createElement( 'a' ); urlParser.href = options.url; // Abort if the request is not for this site. if ( ! api.isLinkPreviewable( urlParser, { allowAdminAjax: true } ) ) { return; } queryParams = api.utils.parseQueryString( urlParser.search.substring( 1 ) ); // Note that _dirty flag will be cleared with changeset updates. api.each( function( setting ) { if ( setting._dirty ) { dirtyValues[ setting.id ] = setting.get(); } } ); if ( ! _.isEmpty( dirtyValues ) ) { requestMethod = options.type.toUpperCase(); // Override underlying request method to ensure unsaved changes to changeset can be included (force Backbone.emulateHTTP). if ( 'POST' !== requestMethod ) { xhr.setRequestHeader( 'X-HTTP-Method-Override', requestMethod ); queryParams._method = requestMethod; options.type = 'POST'; } // Amend the post data with the customized values. if ( options.data ) { options.data += '&'; } else { options.data = ''; } options.data += $.param( { customized: JSON.stringify( dirtyValues ) } ); } // Include customized state query params in URL. queryParams.customize_changeset_uuid = api.settings.changeset.uuid; if ( api.settings.changeset.autosaved ) { queryParams.customize_autosaved = 'on'; } if ( ! api.settings.theme.active ) { queryParams.customize_theme = api.settings.theme.stylesheet; } // Ensure preview nonce is included with every customized request, to allow post data to be read. queryParams.customize_preview_nonce = api.settings.nonce.preview; urlParser.search = $.param( queryParams ); options.url = urlParser.href; }; $.ajaxPrefilter( prefilterAjax ); }; /** * Inject changeset UUID into forms, allowing preview to persist through submissions. * * @since 4.7.0 * @access protected * * @return {void} */ api.addFormPreviewing = function addFormPreviewing() { // Inject inputs for forms in initial document. $( document.body ).find( 'form' ).each( function() { api.prepareFormPreview( this ); } ); // Inject inputs for new forms added to the page. if ( 'undefined' !== typeof MutationObserver ) { api.mutationObserver = new MutationObserver( function( mutations ) { _.each( mutations, function( mutation ) { $( mutation.target ).find( 'form' ).each( function() { api.prepareFormPreview( this ); } ); } ); } ); api.mutationObserver.observe( document.documentElement, { childList: true, subtree: true } ); } }; /** * Inject changeset into form inputs. * * @since 4.7.0 * @access protected * * @param {HTMLFormElement} form Form. * @return {void} */ api.prepareFormPreview = function prepareFormPreview( form ) { var urlParser, stateParams = {}; if ( ! form.action ) { form.action = location.href; } urlParser = document.createElement( 'a' ); urlParser.href = form.action; // Make sure forms in preview use HTTPS if parent frame uses HTTPS. if ( api.settings.channel && 'https' === api.preview.scheme.get() && 'http:' === urlParser.protocol && -1 !== api.settings.url.allowedHosts.indexOf( urlParser.host ) ) { urlParser.protocol = 'https:'; form.action = urlParser.href; } if ( 'GET' !== form.method.toUpperCase() || ! api.isLinkPreviewable( urlParser ) ) { // Style form as unpreviewable only if previewing in iframe; if previewing on frontend, all forms will be allowed to work normally. if ( api.settings.channel ) { $( form ).addClass( 'customize-unpreviewable' ); } return; } $( form ).removeClass( 'customize-unpreviewable' ); stateParams.customize_changeset_uuid = api.settings.changeset.uuid; if ( api.settings.changeset.autosaved ) { stateParams.customize_autosaved = 'on'; } if ( ! api.settings.theme.active ) { stateParams.customize_theme = api.settings.theme.stylesheet; } if ( api.settings.channel ) { stateParams.customize_messenger_channel = api.settings.channel; } _.each( stateParams, function( value, name ) { var input = $( form ).find( 'input[name="' + name + '"]' ); if ( input.length ) { input.val( value ); } else { $( form ).prepend( $( '', { type: 'hidden', name: name, value: value } ) ); } } ); // Prevent links from breaking out of preview iframe. if ( api.settings.channel ) { form.target = '_self'; } }; /** * Watch current URL and send keep-alive (heartbeat) messages to the parent. * * Keep the customizer pane notified that the preview is still alive * and that the user hasn't navigated to a non-customized URL. * * @since 4.7.0 * @access protected */ api.keepAliveCurrentUrl = ( function() { var previousPathName = location.pathname, previousQueryString = location.search.substr( 1 ), previousQueryParams = null, stateQueryParams = [ 'customize_theme', 'customize_changeset_uuid', 'customize_messenger_channel', 'customize_autosaved' ]; return function keepAliveCurrentUrl() { var urlParser, currentQueryParams; // Short-circuit with keep-alive if previous URL is identical (as is normal case). if ( previousQueryString === location.search.substr( 1 ) && previousPathName === location.pathname ) { api.preview.send( 'keep-alive' ); return; } urlParser = document.createElement( 'a' ); if ( null === previousQueryParams ) { urlParser.search = previousQueryString; previousQueryParams = api.utils.parseQueryString( previousQueryString ); _.each( stateQueryParams, function( name ) { delete previousQueryParams[ name ]; } ); } // Determine if current URL minus customized state params and URL hash. urlParser.href = location.href; currentQueryParams = api.utils.parseQueryString( urlParser.search.substr( 1 ) ); _.each( stateQueryParams, function( name ) { delete currentQueryParams[ name ]; } ); if ( previousPathName !== location.pathname || ! _.isEqual( previousQueryParams, currentQueryParams ) ) { urlParser.search = $.param( currentQueryParams ); urlParser.hash = ''; api.settings.url.self = urlParser.href; api.preview.send( 'ready', { currentUrl: api.settings.url.self, activePanels: api.settings.activePanels, activeSections: api.settings.activeSections, activeControls: api.settings.activeControls, settingValidities: api.settings.settingValidities } ); } else { api.preview.send( 'keep-alive' ); } previousQueryParams = currentQueryParams; previousQueryString = location.search.substr( 1 ); previousPathName = location.pathname; }; } )(); api.settingPreviewHandlers = { /** * Preview changes to custom logo. * * @param {number} attachmentId Attachment ID for custom logo. * @return {void} */ custom_logo: function( attachmentId ) { $( 'body' ).toggleClass( 'wp-custom-logo', !! attachmentId ); }, /** * Preview changes to custom css. * * @param {string} value Custom CSS.. * @return {void} */ custom_css: function( value ) { $( '#wp-custom-css' ).text( value ); }, /** * Preview changes to any of the background settings. * * @return {void} */ background: function() { var css = '', settings = {}; _.each( ['color', 'image', 'preset', 'position_x', 'position_y', 'size', 'repeat', 'attachment'], function( prop ) { settings[ prop ] = api( 'background_' + prop ); } ); /* * The body will support custom backgrounds if either the color or image are set. * * See get_body_class() in /wp-includes/post-template.php */ $( document.body ).toggleClass( 'custom-background', !! ( settings.color() || settings.image() ) ); if ( settings.color() ) { css += 'background-color: ' + settings.color() + ';'; } if ( settings.image() ) { css += 'background-image: url("' + settings.image() + '");'; css += 'background-size: ' + settings.size() + ';'; css += 'background-position: ' + settings.position_x() + ' ' + settings.position_y() + ';'; css += 'background-repeat: ' + settings.repeat() + ';'; css += 'background-attachment: ' + settings.attachment() + ';'; } $( '#custom-background-css' ).text( 'body.custom-background { ' + css + ' }' ); } }; $( function() { var bg, setValue, handleUpdatedChangesetUuid; api.settings = window._wpCustomizeSettings; if ( ! api.settings ) { return; } api.preview = new api.Preview({ url: window.location.href, channel: api.settings.channel }); api.addLinkPreviewing(); api.addRequestPreviewing(); api.addFormPreviewing(); /** * Create/update a setting value. * * @param {string} id - Setting ID. * @param {*} value - Setting value. * @param {boolean} [createDirty] - Whether to create a setting as dirty. Defaults to false. */ setValue = function( id, value, createDirty ) { var setting = api( id ); if ( setting ) { setting.set( value ); } else { createDirty = createDirty || false; setting = api.create( id, value, { id: id } ); // Mark dynamically-created settings as dirty so they will get posted. if ( createDirty ) { setting._dirty = true; } } }; api.preview.bind( 'settings', function( values ) { $.each( values, setValue ); }); api.preview.trigger( 'settings', api.settings.values ); $.each( api.settings._dirty, function( i, id ) { var setting = api( id ); if ( setting ) { setting._dirty = true; } } ); api.preview.bind( 'setting', function( args ) { var createDirty = true; setValue.apply( null, args.concat( createDirty ) ); }); api.preview.bind( 'sync', function( events ) { /* * Delete any settings that already exist locally which haven't been * modified in the controls while the preview was loading. This prevents * situations where the JS value being synced from the pane may differ * from the PHP-sanitized JS value in the preview which causes the * non-sanitized JS value to clobber the PHP-sanitized value. This * is particularly important for selective refresh partials that * have a fallback refresh behavior since infinite refreshing would * result. */ if ( events.settings && events['settings-modified-while-loading'] ) { _.each( _.keys( events.settings ), function( syncedSettingId ) { if ( api.has( syncedSettingId ) && ! events['settings-modified-while-loading'][ syncedSettingId ] ) { delete events.settings[ syncedSettingId ]; } } ); } $.each( events, function( event, args ) { api.preview.trigger( event, args ); }); api.preview.send( 'synced' ); }); api.preview.bind( 'active', function() { api.preview.send( 'nonce', api.settings.nonce ); api.preview.send( 'documentTitle', document.title ); // Send scroll in case of loading via non-refresh. api.preview.send( 'scroll', $( window ).scrollTop() ); }); /** * Handle update to changeset UUID. * * @param {string} uuid - UUID. * @return {void} */ handleUpdatedChangesetUuid = function( uuid ) { api.settings.changeset.uuid = uuid; // Update UUIDs in links and forms. $( document.body ).find( 'a[href], area[href]' ).each( function() { api.prepareLinkPreview( this ); } ); $( document.body ).find( 'form' ).each( function() { api.prepareFormPreview( this ); } ); /* * Replace the UUID in the URL. Note that the wrapped history.replaceState() * will handle injecting the current api.settings.changeset.uuid into the URL, * so this is merely to trigger that logic. */ if ( history.replaceState ) { history.replaceState( currentHistoryState, '', location.href ); } }; api.preview.bind( 'changeset-uuid', handleUpdatedChangesetUuid ); api.preview.bind( 'saved', function( response ) { if ( response.next_changeset_uuid ) { handleUpdatedChangesetUuid( response.next_changeset_uuid ); } api.trigger( 'saved', response ); } ); // Update the URLs to reflect the fact we've started autosaving. api.preview.bind( 'autosaving', function() { if ( api.settings.changeset.autosaved ) { return; } api.settings.changeset.autosaved = true; // Start deferring to any autosave once changeset is updated. $( document.body ).find( 'a[href], area[href]' ).each( function() { api.prepareLinkPreview( this ); } ); $( document.body ).find( 'form' ).each( function() { api.prepareFormPreview( this ); } ); if ( history.replaceState ) { history.replaceState( currentHistoryState, '', location.href ); } } ); /* * Clear dirty flag for settings when saved to changeset so that they * won't be needlessly included in selective refresh or ajax requests. */ api.preview.bind( 'changeset-saved', function( data ) { _.each( data.saved_changeset_values, function( value, settingId ) { var setting = api( settingId ); if ( setting && _.isEqual( setting.get(), value ) ) { setting._dirty = false; } } ); } ); api.preview.bind( 'nonce-refresh', function( nonce ) { $.extend( api.settings.nonce, nonce ); } ); /* * Send a message to the parent customize frame with a list of which * containers and controls are active. */ api.preview.send( 'ready', { currentUrl: api.settings.url.self, activePanels: api.settings.activePanels, activeSections: api.settings.activeSections, activeControls: api.settings.activeControls, settingValidities: api.settings.settingValidities } ); // Send ready when URL changes via JS. setInterval( api.keepAliveCurrentUrl, api.settings.timeouts.keepAliveSend ); // Display a loading indicator when preview is reloading, and remove on failure. api.preview.bind( 'loading-initiated', function () { $( 'body' ).addClass( 'wp-customizer-unloading' ); }); api.preview.bind( 'loading-failed', function () { $( 'body' ).removeClass( 'wp-customizer-unloading' ); }); /* Custom Backgrounds */ bg = $.map( ['color', 'image', 'preset', 'position_x', 'position_y', 'size', 'repeat', 'attachment'], function( prop ) { return 'background_' + prop; } ); api.when.apply( api, bg ).done( function() { $.each( arguments, function() { this.bind( api.settingPreviewHandlers.background ); }); }); /** * Custom Logo * * Toggle the wp-custom-logo body class when a logo is added or removed. * * @since 4.5.0 */ api( 'custom_logo', function ( setting ) { api.settingPreviewHandlers.custom_logo.call( setting, setting.get() ); setting.bind( api.settingPreviewHandlers.custom_logo ); } ); api( 'custom_css[' + api.settings.theme.stylesheet + ']', function( setting ) { setting.bind( api.settingPreviewHandlers.custom_css ); } ); api.trigger( 'preview-ready' ); }); })( wp, jQuery ); PK!}e^^backbone.min.jsnu[/*! This file is auto-generated */ !function(n){var s="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;if("function"==typeof define&&define.amd)define(["underscore","jquery","exports"],function(t,e,i){s.Backbone=n(s,i,t,e)});else if("undefined"!=typeof exports){var t,e=require("underscore");try{t=require("jquery")}catch(t){}n(s,exports,e,t)}else s.Backbone=n(s,{},s._,s.jQuery||s.Zepto||s.ender||s.$)}(function(t,h,b,e){function a(t,e,i,n,s){var r,o=0;if(i&&"object"==typeof i){void 0!==n&&"context"in s&&void 0===s.context&&(s.context=n);for(r=b.keys(i);othis.length?this.length:n)<0&&(n+=this.length+1),[]),r=[],o=[],h=[],a={},u=e.add,l=e.merge,c=e.remove,d=!1,f=this.comparator&&null==n&&!1!==e.sort,p=b.isString(this.comparator)?this.comparator:null,g=0;g' ); this.tracks.each(function (model) { if ( ! self.data.images ) { model.set( 'image', false ); } model.set( 'artists', self.data.artists ); model.set( 'index', self.data.tracknumbers ? i : false ); tracklist.append( self.itemTemplate( model.toJSON() ) ); i += 1; }); this.$el.append( tracklist ); this.$( '.wp-playlist-item' ).eq(0).addClass( this.playingClass ); }, events : { 'click .wp-playlist-item' : 'clickTrack', 'click .wp-playlist-next' : 'next', 'click .wp-playlist-prev' : 'prev' }, clickTrack : function (e) { e.preventDefault(); this.index = this.$( '.wp-playlist-item' ).index( e.currentTarget ); this.setCurrent(); }, ended : function () { if ( this.index + 1 < this.tracks.length ) { this.next(); } else { this.index = 0; this.setCurrent(); } }, next : function () { this.index = this.index + 1 >= this.tracks.length ? 0 : this.index + 1; this.setCurrent(); }, prev : function () { this.index = this.index - 1 < 0 ? this.tracks.length - 1 : this.index - 1; this.setCurrent(); }, loadCurrent : function () { var last = this.playerNode.attr( 'src' ) && this.playerNode.attr( 'src' ).split('.').pop(), current = this.current.get( 'src' ).split('.').pop(); this.mejs && this.mejs.pause(); if ( last !== current ) { this.setPlayer( true ); } else { this.playerNode.attr( 'src', this.current.get( 'src' ) ); this.playCurrentSrc(); } }, setCurrent : function () { this.current = this.tracks.at( this.index ); if ( this.data.tracklist ) { this.$( '.wp-playlist-item' ) .removeClass( this.playingClass ) .eq( this.index ) .addClass( this.playingClass ); } this.loadCurrent(); } }); /** * Initialize media playlists in the document. * * Only initializes new playlists not previously-initialized. * * @since 4.9.3 * @return {void} */ function initialize() { $( '.wp-playlist:not(:has(.mejs-container))' ).each( function() { new WPPlaylistView( { el: this } ); } ); } /** * Expose the API publicly on window.wp.playlist. * * @namespace wp.playlist * @since 4.9.3 * @type {object} */ window.wp.playlist = { initialize: initialize }; $( document ).ready( initialize ); window.WPPlaylistView = WPPlaylistView; }(jQuery, _, Backbone)); PK!TXt  $mediaelement/mediaelement-migrate.jsnu[/* global console, MediaElementPlayer, mejs */ (function ( window, $ ) { // Reintegrate `plugins` since they don't exist in MEJS anymore; it won't affect anything in the player if (mejs.plugins === undefined) { mejs.plugins = {}; mejs.plugins.silverlight = []; mejs.plugins.silverlight.push({ types: [] }); } // Inclusion of old `HtmlMediaElementShim` if it doesn't exist mejs.HtmlMediaElementShim = mejs.HtmlMediaElementShim || { getTypeFromFile: mejs.Utils.getTypeFromFile }; // Add missing global variables for backward compatibility if (mejs.MediaFeatures === undefined) { mejs.MediaFeatures = mejs.Features; } if (mejs.Utility === undefined) { mejs.Utility = mejs.Utils; } /** * Create missing variables and have default `classPrefix` overridden to avoid issues. * * `media` is now a fake wrapper needed to simplify manipulation of various media types, * so in order to access the `video` or `audio` tag, use `media.originalNode` or `player.node`; * `player.container` used to be jQuery but now is a HTML element, and many elements inside * the player rely on it being a HTML now, so its conversion is difficult; however, a * `player.$container` new variable has been added to be used as jQuery object */ var init = MediaElementPlayer.prototype.init; MediaElementPlayer.prototype.init = function () { this.options.classPrefix = 'mejs-'; this.$media = this.$node = $( this.node ); init.call( this ); }; var ready = MediaElementPlayer.prototype._meReady; MediaElementPlayer.prototype._meReady = function () { this.container = $( this.container) ; this.controls = $( this.controls ); this.layers = $( this.layers ); ready.apply( this, arguments ); }; // Override method so certain elements can be called with jQuery MediaElementPlayer.prototype.getElement = function ( el ) { return $ !== undefined && el instanceof $ ? el[0] : el; }; // Add jQuery ONLY to most of custom features' arguments for backward compatibility; default features rely 100% // on the arguments being HTML elements to work properly MediaElementPlayer.prototype.buildfeatures = function ( player, controls, layers, media ) { var defaultFeatures = [ 'playpause', 'current', 'progress', 'duration', 'tracks', 'volume', 'fullscreen' ]; for (var i = 0, total = this.options.features.length; i < total; i++) { var feature = this.options.features[i]; if (this['build' + feature]) { try { // Use jQuery for non-default features if (defaultFeatures.indexOf(feature) === -1) { this['build' + feature]( player, $(controls), $(layers), media ); } else { this['build' + feature]( player, controls, layers, media ); } } catch (e) { console.error( 'error building ' + feature, e ); } } } }; })( window, jQuery ); PK!V mediaelement/wp-mediaelement.jsnu[/* global _wpmejsSettings, mejsL10n */ (function( window, $ ) { window.wp = window.wp || {}; function wpMediaElement() { var settings = {}; /** * Initialize media elements. * * Ensures media elements that have already been initialized won't be * processed again. * * @memberOf wp.mediaelement * * @since 4.4.0 * * @return {void} */ function initialize() { var selectors = []; if ( typeof _wpmejsSettings !== 'undefined' ) { settings = $.extend( true, {}, _wpmejsSettings ); } settings.classPrefix = 'mejs-'; settings.success = settings.success || function ( mejs ) { var autoplay, loop; if ( mejs.rendererName && -1 !== mejs.rendererName.indexOf( 'flash' ) ) { autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay; loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop; if ( autoplay ) { mejs.addEventListener( 'canplay', function() { mejs.play(); }, false ); } if ( loop ) { mejs.addEventListener( 'ended', function() { mejs.play(); }, false ); } } }; /** * Custom error handler. * * Sets up a custom error handler in case a video render fails, and provides a download * link as the fallback. * * @since 4.9.3 * * @param {object} media The wrapper that mimics all the native events/properties/methods for all renderers. * @param {object} node The original HTML video, audio, or iframe tag where the media was loaded. * @return {string} */ settings.customError = function ( media, node ) { // Make sure we only fall back to a download link for flash files. if ( -1 !== media.rendererName.indexOf( 'flash' ) || -1 !== media.rendererName.indexOf( 'flv' ) ) { return '
    ' + mejsL10n.strings['mejs.download-file'] + ''; } }; if ( 'undefined' === typeof settings.videoShortcodeLibrary || 'mediaelement' === settings.videoShortcodeLibrary ) { selectors.push( '.wp-video-shortcode' ); } if ( 'undefined' === typeof settings.audioShortcodeLibrary || 'mediaelement' === settings.audioShortcodeLibrary ) { selectors.push( '.wp-audio-shortcode' ); } if ( ! selectors.length ) { return; } // Only initialize new media elements. $( selectors.join( ', ' ) ) .not( '.mejs-container' ) .filter(function () { return ! $( this ).parent().hasClass( 'mejs-mediaelement' ); }) .mediaelementplayer( settings ); } return { initialize: initialize }; } /** * @namespace wp.mediaelement * @memberOf wp */ window.wp.mediaelement = new wpMediaElement(); $( window.wp.mediaelement.initialize ); })( window, jQuery ); PK!A   mediaelement/mediaelement.min.jsnu[/*! * MediaElement.js * http://www.mediaelementjs.com/ * * Wrapper that mimics native HTML5 MediaElement (audio and video) * using a variety of technologies (pure JavaScript, Flash, iframe) * * Copyright 2010-2017, John Dyer (http://j.hn/) * License: MIT * */ !function i(o,l,s){function d(n,e){if(!l[n]){if(!o[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(u)return u(n,!0);var r=new Error("Cannot find module '"+n+"'");throw r.code="MODULE_NOT_FOUND",r}var a=l[n]={exports:{}};o[n][0].call(a.exports,function(e){var t=o[n][1][e];return d(t||e)},a,a.exports,i,o,l,s)}return l[n].exports}for(var u="function"==typeof require&&require,e=0;et[0]||n[0]===t[0]&&n[1]>t[1]||n[0]===t[0]&&n[1]===t[1]&&n[2]>=t[2]},addPlugin:function(e,t,n,r,a){i.plugins[e]=i.detectPlugin(t,n,r,a)},detectPlugin:function(e,t,n,r){var a=[0,0,0],i=void 0,o=void 0;if(null!==O.NAV.plugins&&void 0!==O.NAV.plugins&&"object"===d(O.NAV.plugins[e])){if((i=O.NAV.plugins[e].description)&&(void 0===O.NAV.mimeTypes||!O.NAV.mimeTypes[t]||O.NAV.mimeTypes[t].enabledPlugin))for(var l=0,s=(a=i.replace(e,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".")).length;l
    '+P.default.t("mejs.install-flash")+"
    "}else _=['id="__'+i.id+'"','name="__'+i.id+'"','play="true"','loop="false"','quality="high"','bgcolor="#000000"','wmode="transparent"','allowScriptAccess="'+i.options.shimScriptAccess+'"','allowFullScreen="true"','type="application/x-shockwave-flash"','pluginspage="//www.macromedia.com/go/getflashplayer"','src="'+i.options.pluginPath+i.options.filename+'"','flashvars="'+y.join("&")+'"'],E?(_.push('width="'+w+'"'),_.push('height="'+b+'"')):_.push('style="position: fixed; left: -9999em; top: -9999em;"'),i.flashWrapper.innerHTML="";if(i.flashNode=i.flashWrapper.lastChild,i.hide=function(){r=!1,E&&(i.flashNode.style.display="none")},i.show=function(){r=!0,E&&(i.flashNode.style.display="")},i.setSize=function(e,t){i.flashNode.style.width=e+"px",i.flashNode.style.height=t+"px",null!==i.flashApi&&"function"==typeof i.flashApi.fire_setSize&&i.flashApi.fire_setSize(e,t)},i.destroy=function(){i.flashNode.remove()},n&&0":">",'"':"""};return e.replace(/[&<>"]/g,function(e){return t[e]})}function l(r,a){var i=this,o=arguments,l=2x',t.firstChild.href}function d(e){var t=1.mejs__overlay-button{background-position:-80px -39px}.mejs__overlay-loading{height:80px;width:80px}.mejs__overlay-loading-bg-img{-webkit-animation:a 1s linear infinite;animation:a 1s linear infinite;background:transparent url(mejs-controls.svg) -160px -40px no-repeat;display:block;height:80px;width:80px;z-index:1}@-webkit-keyframes a{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.mejs__controls{bottom:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:40px;left:0;list-style-type:none;margin:0;padding:0 10px;position:absolute;width:100%;z-index:3}.mejs__controls:not([style*="display: none"]){background:rgba(255,0,0,.7);background:-webkit-linear-gradient(transparent,rgba(0,0,0,.35));background:linear-gradient(transparent,rgba(0,0,0,.35))}.mejs__button,.mejs__time,.mejs__time-rail{font-size:10px;height:40px;line-height:10px;margin:0;width:32px}.mejs__button>button{background:transparent url(mejs-controls.svg);border:0;cursor:pointer;display:block;font-size:0;height:20px;line-height:0;margin:10px 6px;overflow:hidden;padding:0;position:absolute;text-decoration:none;width:20px}.mejs__button>button:focus{outline:1px dotted #999}.mejs__container-keyboard-inactive [role=slider],.mejs__container-keyboard-inactive [role=slider]:focus,.mejs__container-keyboard-inactive a,.mejs__container-keyboard-inactive a:focus,.mejs__container-keyboard-inactive button,.mejs__container-keyboard-inactive button:focus{outline:0}.mejs__time{box-sizing:content-box;color:#fff;font-size:11px;font-weight:700;height:24px;overflow:hidden;padding:16px 6px 0;text-align:center;width:auto}.mejs__play>button{background-position:0 0}.mejs__pause>button{background-position:-20px 0}.mejs__replay>button{background-position:-160px 0}.mejs__time-rail{direction:ltr;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;height:40px;margin:0 10px;padding-top:10px;position:relative}.mejs__time-buffering,.mejs__time-current,.mejs__time-float,.mejs__time-float-corner,.mejs__time-float-current,.mejs__time-hovered,.mejs__time-loaded,.mejs__time-marker,.mejs__time-total{border-radius:2px;cursor:pointer;display:block;height:10px;position:absolute}.mejs__time-total{background:hsla(0,0%,100%,.3);margin:5px 0 0;width:100%}.mejs__time-buffering{-webkit-animation:b 2s linear infinite;animation:b 2s linear infinite;background:-webkit-linear-gradient(135deg,hsla(0,0%,100%,.4) 25%,transparent 0,transparent 50%,hsla(0,0%,100%,.4) 0,hsla(0,0%,100%,.4) 75%,transparent 0,transparent);background:linear-gradient(-45deg,hsla(0,0%,100%,.4) 25%,transparent 0,transparent 50%,hsla(0,0%,100%,.4) 0,hsla(0,0%,100%,.4) 75%,transparent 0,transparent);background-size:15px 15px;width:100%}@-webkit-keyframes b{0%{background-position:0 0}to{background-position:30px 0}}@keyframes b{0%{background-position:0 0}to{background-position:30px 0}}.mejs__time-loaded{background:hsla(0,0%,100%,.3)}.mejs__time-current,.mejs__time-handle-content{background:hsla(0,0%,100%,.9)}.mejs__time-hovered{background:hsla(0,0%,100%,.5);z-index:10}.mejs__time-hovered.negative{background:rgba(0,0,0,.2)}.mejs__time-buffering,.mejs__time-current,.mejs__time-hovered,.mejs__time-loaded{left:0;-webkit-transform:scaleX(0);-ms-transform:scaleX(0);transform:scaleX(0);-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;-webkit-transition:all .15s ease-in;transition:all .15s ease-in;width:100%}.mejs__time-buffering{-webkit-transform:scaleX(1);-ms-transform:scaleX(1);transform:scaleX(1)}.mejs__time-hovered{-webkit-transition:height .1s cubic-bezier(.44,0,1,1);transition:height .1s cubic-bezier(.44,0,1,1)}.mejs__time-hovered.no-hover{-webkit-transform:scaleX(0)!important;-ms-transform:scaleX(0)!important;transform:scaleX(0)!important}.mejs__time-handle,.mejs__time-handle-content{border:4px solid transparent;cursor:pointer;left:0;position:absolute;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);z-index:11}.mejs__time-handle-content{border:4px solid hsla(0,0%,100%,.9);border-radius:50%;height:10px;left:-7px;top:-4px;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);width:10px}.mejs__time-rail .mejs__time-handle-content:active,.mejs__time-rail .mejs__time-handle-content:focus,.mejs__time-rail:hover .mejs__time-handle-content{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.mejs__time-float{background:#eee;border:1px solid #333;bottom:100%;color:#111;display:none;height:17px;margin-bottom:9px;position:absolute;text-align:center;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);width:36px}.mejs__time-float-current{display:block;left:0;margin:2px;text-align:center;width:30px}.mejs__time-float-corner{border:5px solid #eee;border-color:#eee transparent transparent;border-radius:0;display:block;height:0;left:50%;line-height:0;position:absolute;top:100%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);width:0}.mejs__long-video .mejs__time-float{margin-left:-23px;width:64px}.mejs__long-video .mejs__time-float-current{width:60px}.mejs__broadcast{color:#fff;height:10px;position:absolute;top:15px;width:100%}.mejs__fullscreen-button>button{background-position:-80px 0}.mejs__unfullscreen>button{background-position:-100px 0}.mejs__mute>button{background-position:-60px 0}.mejs__unmute>button{background-position:-40px 0}.mejs__volume-button{position:relative}.mejs__volume-button>.mejs__volume-slider{-webkit-backface-visibility:hidden;background:rgba(50,50,50,.7);border-radius:0;bottom:100%;display:none;height:115px;left:50%;margin:0;position:absolute;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);width:25px;z-index:1}.mejs__volume-button:hover{border-radius:0 0 4px 4px}.mejs__volume-total{background:hsla(0,0%,100%,.5);height:100px;left:50%;margin:0;position:absolute;top:8px;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);width:2px}.mejs__volume-current{left:0;margin:0;width:100%}.mejs__volume-current,.mejs__volume-handle{background:hsla(0,0%,100%,.9);position:absolute}.mejs__volume-handle{border-radius:1px;cursor:ns-resize;height:6px;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);width:16px}.mejs__horizontal-volume-slider{display:block;height:36px;position:relative;vertical-align:middle;width:56px}.mejs__horizontal-volume-total{background:rgba(50,50,50,.8);height:8px;top:16px;width:50px}.mejs__horizontal-volume-current,.mejs__horizontal-volume-total{border-radius:2px;font-size:1px;left:0;margin:0;padding:0;position:absolute}.mejs__horizontal-volume-current{background:hsla(0,0%,100%,.8);height:100%;top:0;width:100%}.mejs__horizontal-volume-handle{display:none}.mejs__captions-button,.mejs__chapters-button{position:relative}.mejs__captions-button>button{background-position:-140px 0}.mejs__chapters-button>button{background-position:-180px 0}.mejs__captions-button>.mejs__captions-selector,.mejs__chapters-button>.mejs__chapters-selector{background:rgba(50,50,50,.7);border:1px solid transparent;border-radius:0;bottom:100%;margin-right:-43px;overflow:hidden;padding:0;position:absolute;right:50%;visibility:visible;width:86px}.mejs__chapters-button>.mejs__chapters-selector{margin-right:-55px;width:110px}.mejs__captions-selector-list,.mejs__chapters-selector-list{list-style-type:none!important;margin:0;overflow:hidden;padding:0}.mejs__captions-selector-list-item,.mejs__chapters-selector-list-item{color:#fff;cursor:pointer;display:block;list-style-type:none!important;margin:0 0 6px;overflow:hidden;padding:0}.mejs__captions-selector-list-item:hover,.mejs__chapters-selector-list-item:hover{background-color:#c8c8c8!important;background-color:hsla(0,0%,100%,.4)!important}.mejs__captions-selector-input,.mejs__chapters-selector-input{clear:both;float:left;left:-1000px;margin:3px 3px 0 5px;position:absolute}.mejs__captions-selector-label,.mejs__chapters-selector-label{cursor:pointer;float:left;font-size:10px;line-height:15px;padding:4px 10px 0;width:100%}.mejs__captions-selected,.mejs__chapters-selected{color:#21f8f8}.mejs__captions-translations{font-size:10px;margin:0 0 5px}.mejs__captions-layer{bottom:0;color:#fff;font-size:16px;left:0;line-height:20px;position:absolute;text-align:center}.mejs__captions-layer a{color:#fff;text-decoration:underline}.mejs__captions-layer[lang=ar]{font-size:20px;font-weight:400}.mejs__captions-position{bottom:15px;left:0;position:absolute;width:100%}.mejs__captions-position-hover{bottom:35px}.mejs__captions-text,.mejs__captions-text *{background:hsla(0,0%,8%,.5);box-shadow:5px 0 0 hsla(0,0%,8%,.5),-5px 0 0 hsla(0,0%,8%,.5);padding:0;white-space:pre-wrap}.mejs__container.mejs__hide-cues video::-webkit-media-text-track-container{display:none}.mejs__overlay-error{position:relative}.mejs__overlay-error>img{left:0;max-width:100%;position:absolute;top:0;z-index:-1}.mejs__cannotplay,.mejs__cannotplay a{color:#fff;font-size:.8em}.mejs__cannotplay{position:relative}.mejs__cannotplay a,.mejs__cannotplay p{display:inline-block;padding:0 15px;width:100%}PK!'1C C mediaelement/mejs-controls.pngnu[PNG  IHDRxTPLTE?;<# LIJhef1-.vst㟝ǃZWX%7^tRNS0P @`phK$y 'H,?Y7,4-?~`2/Z2G%|想v0DzPC9O cК%3|v8ӅY#4e>!`B6Y$aFNт 9>8E (>pBRgr:d>̈R4 LB+vOP*cB }!{͠,3~^H85 0w)B8  "5UbFH3I6 M ]?BI  nt?|_eRu"gG5ujBxy'Ț(}KB0o2WL@| Y c߲B@-!Wv6VMZQJ}+HqE\»?]!3GJH+ZV>"Jcjr0!t5ZXc]b1IJw$VF|id{ah첦ܾ҄_>CV["%_=֠w.+$0#jFV߽0tK!BN'I`FԌ>::kR?zFI`FԌ?\/#3,Tu URj>}%8QHD^'EGݖJNP!/|ݰ ~,140 0 0 0 0 0 0 0Jņ6b-WKtMln,d=;sAnJ %tÓ,`~&s|7 Erǔv2B=uv`Ì2j9m#u$gcGqL&le~f#h Ҏ7M4/-ҎO1`Xv-*lE#4fIDɒfht QrZs(ur$G+WvJvZ҈\АYG#ھ22TGáɴ_?^ 8w8*&NHPK$ԉpi9_we*9!QT%ByبV'r;&O {Y ͛~ΏyVh`uh R3ACJ;f"!),lhePځXVa.w=fdOUO:wH٣`<J1G Yᄐ}}2$GZATǜ rJt*Ͳ ZTdNHB3Bҝ2X /ѷ-kK-xan';s@(ްQ]͞q=c 5}B{ζ?50sdzt{n@קO[܃%.Xy9&ng %pZ"/aq*ؔn7PϢ/M=M}^)O4aѼEG,j qե uue=Ww{=rku :θkk rg,ٽs,i483,ZzwGèСw}S6wB\/W70!"*?;a cḡg)HZo.r' zOQxÑ},1=o->zQXbڴpLQpXoJY0bDQ!^"yֳU4;,?VlD:Y&ma@ lT2l!y|b^%1tDOS0A/iQC<=5% iܒVbӠmA텞n{q0HuӃ!R'@Vz5S'\.g%EFJwisA`#tA=\(A z+\-r@ȁ-b1ʀ*B9~ AU((f2ޡؚ>bkm[[`hG5 )kagᷴkAF8844}F'H9qlfE~[4 =*9rzf${xR LINh J3ze*I>Cy96`L}!f0 caL aKG`E6aD.}U怎ͽ |-i)lA`0,*Z`^~~Keyl|v0QS/bZ&\V,@.jHs<_4Q0pYZlo!Ї%ґ'-}zM9 yqbw+ʼԺR?HIENDB`PK!Pu u mediaelement/wp-playlist.min.jsnu[!function(r,e,i){"use strict";window.wp=window.wp||{};var t=i.View.extend({initialize:function(t){this.index=0,this.settings={},this.data=t.metadata||r.parseJSON(this.$("script.wp-playlist-script").html()),this.playerNode=this.$(this.data.type),this.tracks=new i.Collection(this.data.tracks),this.current=this.tracks.first(),"audio"===this.data.type&&(this.currentTemplate=wp.template("wp-playlist-current-item"),this.currentNode=this.$(".wp-playlist-current-item")),this.renderCurrent(),this.data.tracklist&&(this.itemTemplate=wp.template("wp-playlist-item"),this.playingClass="wp-playlist-playing",this.renderTracks()),this.playerNode.attr("src",this.current.get("src")),e.bindAll(this,"bindPlayer","bindResetPlayer","setPlayer","ended","clickTrack"),e.isUndefined(window._wpmejsSettings)||(this.settings=e.clone(_wpmejsSettings)),this.settings.success=this.bindPlayer,this.setPlayer()},bindPlayer:function(t){this.mejs=t,this.mejs.addEventListener("ended",this.ended)},bindResetPlayer:function(t){this.bindPlayer(t),this.playCurrentSrc()},setPlayer:function(t){this.player&&(this.player.pause(),this.player.remove(),this.playerNode=this.$(this.data.type)),t&&(this.playerNode.attr("src",this.current.get("src")),this.settings.success=this.bindResetPlayer),this.player=new MediaElementPlayer(this.playerNode.get(0),this.settings)},playCurrentSrc:function(){this.renderCurrent(),this.mejs.setSrc(this.playerNode.attr("src")),this.mejs.load(),this.mejs.play()},renderCurrent:function(){var t;"video"===this.data.type?(this.data.images&&this.current.get("image")&&-1===this.current.get("image").src.indexOf("wp-includes/images/media/video.svg")&&this.playerNode.attr("poster",this.current.get("image").src),(t=this.current.get("dimensions"))&&t.resized&&this.playerNode.attr(t.resized)):(this.data.images||this.current.set("image",!1),this.currentNode.html(this.currentTemplate(this.current.toJSON())))},renderTracks:function(){var e=this,i=1,s=r('
    ');this.tracks.each(function(t){e.data.images||t.set("image",!1),t.set("artists",e.data.artists),t.set("index",!!e.data.tracknumbers&&i),s.append(e.itemTemplate(t.toJSON())),i+=1}),this.$el.append(s),this.$(".wp-playlist-item").eq(0).addClass(this.playingClass)},events:{"click .wp-playlist-item":"clickTrack","click .wp-playlist-next":"next","click .wp-playlist-prev":"prev"},clickTrack:function(t){t.preventDefault(),this.index=this.$(".wp-playlist-item").index(t.currentTarget),this.setCurrent()},ended:function(){this.index+1=this.tracks.length?0:this.index+1,this.setCurrent()},prev:function(){this.index=this.index-1<0?this.tracks.length-1:this.index-1,this.setCurrent()},loadCurrent:function(){var t=this.playerNode.attr("src")&&this.playerNode.attr("src").split(".").pop(),e=this.current.get("src").split(".").pop();this.mejs&&this.mejs.pause(),t!==e?this.setPlayer(!0):(this.playerNode.attr("src",this.current.get("src")),this.playCurrentSrc())},setCurrent:function(){this.current=this.tracks.at(this.index),this.data.tracklist&&this.$(".wp-playlist-item").removeClass(this.playingClass).eq(this.index).addClass(this.playingClass),this.loadCurrent()}});function s(){r(".wp-playlist:not(:has(.mejs-container))").each(function(){new t({el:this})})}window.wp.playlist={initialize:s},r(document).ready(s),window.WPPlaylistView=t}(jQuery,_,Backbone);PK!6mediaelement/mejs-controls.svgnu[ PK!ފ00mediaelement/renderers/vimeo.jsnu[/*! * MediaElement.js * http://www.mediaelementjs.com/ * * Wrapper that mimics native HTML5 MediaElement (audio and video) * using a variety of technologies (pure JavaScript, Flash, iframe) * * Copyright 2010-2017, John Dyer (http://j.hn/) * License: MIT * */(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0) { bufferedTime = duration * loadProgress; if (mediaElement.originalNode.autoplay) { paused = false; ended = false; var event = mejs.Utils.createEvent('play', vimeo); mediaElement.dispatchEvent(event); } } }).catch(function (error) { errorHandler(error, vimeo); }); }); vimeoPlayer.on('progress', function () { vimeoPlayer.getDuration().then(function (loadProgress) { duration = loadProgress; if (duration > 0) { bufferedTime = duration * loadProgress; if (mediaElement.originalNode.autoplay) { var initEvent = mejs.Utils.createEvent('play', vimeo); mediaElement.dispatchEvent(initEvent); var playingEvent = mejs.Utils.createEvent('playing', vimeo); mediaElement.dispatchEvent(playingEvent); } } var event = mejs.Utils.createEvent('progress', vimeo); mediaElement.dispatchEvent(event); }).catch(function (error) { return errorHandler(error); }); }); vimeoPlayer.on('timeupdate', function () { vimeoPlayer.getCurrentTime().then(function (seconds) { currentTime = seconds; var event = mejs.Utils.createEvent('timeupdate', vimeo); mediaElement.dispatchEvent(event); }).catch(function (error) { return errorHandler(error); }); }); vimeoPlayer.on('play', function () { paused = false; ended = false; var event = mejs.Utils.createEvent('play', vimeo); mediaElement.dispatchEvent(event); var playingEvent = mejs.Utils.createEvent('playing', vimeo); mediaElement.dispatchEvent(playingEvent); }); vimeoPlayer.on('pause', function () { paused = true; ended = false; var event = mejs.Utils.createEvent('pause', vimeo); mediaElement.dispatchEvent(event); }); vimeoPlayer.on('ended', function () { paused = false; ended = true; var event = mejs.Utils.createEvent('ended', vimeo); mediaElement.dispatchEvent(event); }); events = ['rendererready', 'loadedmetadata', 'loadeddata', 'canplay']; for (var _i4 = 0, _total4 = events.length; _i4 < _total4; _i4++) { var event = mejs.Utils.createEvent(events[_i4], vimeo); mediaElement.dispatchEvent(event); } }; var height = mediaElement.originalNode.height, width = mediaElement.originalNode.width, vimeoContainer = document.createElement('iframe'), standardUrl = 'https://player.vimeo.com/video/' + VimeoApi.getVimeoId(mediaFiles[0].src); var queryArgs = ~mediaFiles[0].src.indexOf('?') ? '?' + mediaFiles[0].src.slice(mediaFiles[0].src.indexOf('?') + 1) : ''; var args = []; if (mediaElement.originalNode.autoplay && queryArgs.indexOf('autoplay') === -1) { args.push('autoplay=1'); } if (mediaElement.originalNode.loop && queryArgs.indexOf('loop') === -1) { args.push('loop=1'); } queryArgs = '' + queryArgs + (queryArgs ? '&' : '?') + args.join('&'); vimeoContainer.setAttribute('id', vimeo.id); vimeoContainer.setAttribute('width', width); vimeoContainer.setAttribute('height', height); vimeoContainer.setAttribute('frameBorder', '0'); vimeoContainer.setAttribute('src', '' + standardUrl + queryArgs); vimeoContainer.setAttribute('webkitallowfullscreen', 'true'); vimeoContainer.setAttribute('mozallowfullscreen', 'true'); vimeoContainer.setAttribute('allowfullscreen', 'true'); vimeoContainer.setAttribute('allow', 'autoplay'); mediaElement.originalNode.parentNode.insertBefore(vimeoContainer, mediaElement.originalNode); mediaElement.originalNode.style.display = 'none'; VimeoApi.load({ iframe: vimeoContainer, id: vimeo.id }); vimeo.hide = function () { vimeo.pause(); if (vimeoPlayer) { vimeoContainer.style.display = 'none'; } }; vimeo.setSize = function (width, height) { vimeoContainer.setAttribute('width', width); vimeoContainer.setAttribute('height', height); }; vimeo.show = function () { if (vimeoPlayer) { vimeoContainer.style.display = ''; } }; vimeo.destroy = function () {}; return vimeo; } }; mejs.Utils.typeChecks.push(function (url) { return (/(\/\/player\.vimeo|vimeo\.com)/i.test(url) ? 'video/x-vimeo' : null ); }); mejs.Renderers.add(vimeoIframeRenderer); },{}]},{},[1]); PK!>Ok@@#mediaelement/renderers/vimeo.min.jsnu[/*! * MediaElement.js * http://www.mediaelementjs.com/ * * Wrapper that mimics native HTML5 MediaElement (audio and video) * using a variety of technologies (pure JavaScript, Flash, iframe) * * Copyright 2010-2017, John Dyer (http://j.hn/) * License: MIT * */ !function a(o,s,u){function c(n,e){if(!s[n]){if(!o[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(l)return l(n,!0);var r=new Error("Cannot find module '"+n+"'");throw r.code="MODULE_NOT_FOUND",r}var i=s[n]={exports:{}};o[n][0].call(i.exports,function(e){var t=o[n][1][e];return c(t||e)},i,i.exports,a,o,s,u)}return s[n].exports}for(var l="function"==typeof require&&require,e=0;e',o.addControlElement(t,"fullscreen"),t.addEventListener("click",function(){m.HAS_TRUE_NATIVE_FULLSCREEN&&m.IS_FULLSCREEN||n.isFullScreen?n.exitFullScreen():n.enterFullScreen()}),n.fullscreenBtn=t,o.options.keyActions.push({keys:[70],action:function(e,t,n,o){o.ctrlKey||void 0!==e.enterFullScreen&&(e.isFullScreen?e.exitFullScreen():e.enterFullScreen())}}),o.exitFullscreenCallback=function(e){var t=e.which||e.keyCode||0;o.options.enableKeyboard&&27===t&&(m.HAS_TRUE_NATIVE_FULLSCREEN&&m.IS_FULLSCREEN||o.isFullScreen)&&n.exitFullScreen()},o.globalBind("keydown",o.exitFullscreenCallback),o.normalHeight=0,o.normalWidth=0,m.HAS_TRUE_NATIVE_FULLSCREEN){n.globalBind(m.FULLSCREEN_EVENT_NAME,function(){n.isFullScreen&&(m.isFullScreen()?(n.isNativeFullScreen=!0,n.setControlsSize()):(n.isNativeFullScreen=!1,n.exitFullScreen()))})}}},cleanfullscreen:function(e){e.exitFullScreen(),e.globalUnbind("keydown",e.exitFullscreenCallback)},detectFullscreenMode:function(){var e=null!==this.media.rendererName&&/(native|html5)/i.test(this.media.rendererName),t="";return m.HAS_TRUE_NATIVE_FULLSCREEN&&e?t="native-native":m.HAS_TRUE_NATIVE_FULLSCREEN&&!e?t="plugin-native":this.usePluginFullScreen&&m.SUPPORT_POINTER_EVENTS&&(t="plugin-click"),this.fullscreenMode=t},enterFullScreen:function(){var o=this,e=null!==o.media.rendererName&&/(html5|native)/i.test(o.media.rendererName),t=getComputedStyle(o.getElement(o.container));if(o.isVideo)if(!1===o.options.useFakeFullscreen&&(m.IS_IOS||m.IS_SAFARI)&&m.HAS_IOS_FULLSCREEN&&"function"==typeof o.media.originalNode.webkitEnterFullscreen&&o.media.originalNode.canPlayType((0,g.getTypeFromFile)(o.media.getSrc())))o.media.originalNode.webkitEnterFullscreen();else{if((0,v.addClass)(p.default.documentElement,o.options.classPrefix+"fullscreen"),(0,v.addClass)(o.getElement(o.container),o.options.classPrefix+"container-fullscreen"),o.normalHeight=parseFloat(t.height),o.normalWidth=parseFloat(t.width),"native-native"!==o.fullscreenMode&&"plugin-native"!==o.fullscreenMode||(m.requestFullScreen(o.getElement(o.container)),o.isInIframe&&setTimeout(function e(){if(o.isNativeFullScreen){var t=f.default.innerWidth||p.default.documentElement.clientWidth||p.default.body.clientWidth,n=screen.width;.002*n',l.addEventListener("click",function(){i.paused?i.play():i.pause()});var d=l.querySelector("button");function u(e){"play"===e?((0,m.removeClass)(l,i.options.classPrefix+"play"),(0,m.removeClass)(l,i.options.classPrefix+"replay"),(0,m.addClass)(l,i.options.classPrefix+"pause"),d.setAttribute("title",s),d.setAttribute("aria-label",s)):((0,m.removeClass)(l,i.options.classPrefix+"pause"),(0,m.removeClass)(l,i.options.classPrefix+"replay"),(0,m.addClass)(l,i.options.classPrefix+"play"),d.setAttribute("title",a),d.setAttribute("aria-label",a))}i.addControlElement(l,"playpause"),u("pse"),o.addEventListener("loadedmetadata",function(){-1===o.rendererName.indexOf("flash")&&u("pse")}),o.addEventListener("play",function(){u("play")}),o.addEventListener("playing",function(){u("play")}),o.addEventListener("pause",function(){u("pse")}),o.addEventListener("ended",function(){e.options.loop||((0,m.removeClass)(l,i.options.classPrefix+"pause"),(0,m.removeClass)(l,i.options.classPrefix+"play"),(0,m.addClass)(l,i.options.classPrefix+"replay"),d.setAttribute("title",a),d.setAttribute("aria-label",a))})}})},{16:16,2:2,26:26,27:27,5:5}],11:[function(e,t,n){"use strict";var p=r(e(2)),o=e(16),i=r(o),m=r(e(5)),y=e(25),E=e(30),b=e(26);function r(e){return e&&e.__esModule?e:{default:e}}Object.assign(o.config,{enableProgressTooltip:!0,useSmoothHover:!0,forceLive:!1}),Object.assign(i.default.prototype,{buildprogress:function(h,s,e,d){var u=0,v=!1,c=!1,g=this,t=h.options.autoRewind,n=h.options.enableProgressTooltip?'00:00':"",o=p.default.createElement("div");o.className=g.options.classPrefix+"time-rail",o.innerHTML=''+n+"",g.addControlElement(o,"progress"),g.options.keyActions.push({keys:[37,227],action:function(e){if(!isNaN(e.duration)&&0o+n.left&&(d=o+n.left),a=(l=d-n.left)/o,g.newTime=a*g.getDuration(),v&&null!==g.getCurrentTime()&&g.newTime.toFixed(4)!==g.getCurrentTime().toFixed(4)&&(g.setCurrentRailHandle(g.newTime),g.updateCurrent(g.newTime)),!y.IS_IOS&&!y.IS_ANDROID){if(l<0&&(l=0),g.options.useSmoothHover&&null!==r&&void 0!==window[r]){var u=new window[r](getComputedStyle(g.handle)[i]).m41,c=l/parseFloat(getComputedStyle(g.total).width)-u/parseFloat(getComputedStyle(g.total).width);g.hovered.style.left=u+"px",g.setTransformStyle(g.hovered,"scaleX("+c+")"),g.hovered.setAttribute("pos",l),0<=c?(0,b.removeClass)(g.hovered,"negative"):(0,b.addClass)(g.hovered,"negative")}if(g.timefloat){var f=g.timefloat.offsetWidth/2,p=mejs.Utils.offset(g.getElement(g.container)),m=getComputedStyle(g.timefloat);s=d-p.left=g.getElement(g.container).offsetWidth-f?g.total.offsetWidth-f:l,(0,b.hasClass)(g.getElement(g.container),g.options.classPrefix+"long-video")&&(s+=parseFloat(m.marginLeft)/2+g.timefloat.offsetWidth/2),g.timefloat.style.left=s+"px",g.timefloatcurrent.innerHTML=(0,E.secondsToTimeCode)(g.newTime,h.options.alwaysShowHours,h.options.showTimecodeFrameCount,h.options.framesPerSecond,h.options.secondsDecimalLength,h.options.timeFormat),g.timefloat.style.display="block"}}}else y.IS_IOS||y.IS_ANDROID||!g.timefloat||(s=g.timefloat.offsetWidth+o>=g.getElement(g.container).offsetWidth?g.timefloat.offsetWidth/2:0,g.timefloat.style.left=s+"px",g.timefloat.style.left=s+"px",g.timefloat.style.display="block")},f=function(){1e3<=new Date-u&&g.play()};g.slider.addEventListener("focus",function(){h.options.autoRewind=!1}),g.slider.addEventListener("blur",function(){h.options.autoRewind=t}),g.slider.addEventListener("keydown",function(e){if(1e3<=new Date-u&&(c=g.paused),g.options.enableKeyboard&&g.options.keyActions.length){var t=e.which||e.keyCode||0,n=g.getDuration(),o=h.options.defaultSeekForwardInterval(d),i=h.options.defaultSeekBackwardInterval(d),r=g.getCurrentTime(),a=g.getElement(g.container).querySelector("."+g.options.classPrefix+"volume-slider");if(38===t||40===t){a&&(a.style.display="block"),g.isVideo&&(g.showControls(),g.startControlsTimer());var s=38===t?Math.min(g.volume+.1,1):Math.max(g.volume-.1,0),l=s<=0;return g.setVolume(s),void g.setMuted(l)}switch(a&&(a.style.display="none"),t){case 37:g.getDuration()!==1/0&&(r-=i);break;case 39:g.getDuration()!==1/0&&(r+=o);break;case 36:r=0;break;case 35:r=n;break;case 13:case 32:return void(y.IS_FIREFOX&&(g.paused?g.play():g.pause()));default:return}r=r<0||isNaN(r)?0:n<=r?n:Math.floor(r),u=new Date,c||h.pause(),setTimeout(function(){g.setCurrentTime(r)},0),r | "}),Object.assign(i.default.prototype,{buildcurrent:function(e,t,n,o){var i=this,r=a.default.createElement("div");r.className=i.options.classPrefix+"time",r.setAttribute("role","timer"),r.setAttribute("aria-live","off"),r.innerHTML=''+(0,s.secondsToTimeCode)(0,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength,e.options.timeFormat)+"",i.addControlElement(r,"current"),e.updateCurrent(),i.updateTimeCallback=function(){i.controlsAreVisible&&e.updateCurrent()},o.addEventListener("timeupdate",i.updateTimeCallback)},cleancurrent:function(e,t,n,o){o.removeEventListener("timeupdate",e.updateTimeCallback)},buildduration:function(e,t,n,o){var i=this;if(t.lastChild.querySelector("."+i.options.classPrefix+"currenttime"))t.querySelector("."+i.options.classPrefix+"time").innerHTML+=i.options.timeAndDurationSeparator+''+(0,s.secondsToTimeCode)(i.options.duration,i.options.alwaysShowHours,i.options.showTimecodeFrameCount,i.options.framesPerSecond,i.options.secondsDecimalLength,i.options.timeFormat)+"";else{t.querySelector("."+i.options.classPrefix+"currenttime")&&(0,l.addClass)(t.querySelector("."+i.options.classPrefix+"currenttime").parentNode,i.options.classPrefix+"currenttime-container");var r=a.default.createElement("div");r.className=i.options.classPrefix+"time "+i.options.classPrefix+"duration-container",r.innerHTML=''+(0,s.secondsToTimeCode)(i.options.duration,i.options.alwaysShowHours,i.options.showTimecodeFrameCount,i.options.framesPerSecond,i.options.secondsDecimalLength,i.options.timeFormat)+"",i.addControlElement(r,"duration")}i.updateDurationCallback=function(){i.controlsAreVisible&&e.updateDuration()},o.addEventListener("timeupdate",i.updateDurationCallback)},cleanduration:function(e,t,n,o){o.removeEventListener("timeupdate",e.updateDurationCallback)},updateCurrent:function(){var e=this,t=e.getCurrentTime();isNaN(t)&&(t=0);var n=(0,s.secondsToTimeCode)(t,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength,e.options.timeFormat);5',o.captions.style.display="none",t.insertBefore(o.captions,t.firstChild),o.captionsText=o.captions.querySelector("."+i.options.classPrefix+"captions-text"),o.captionsButton=L.default.createElement("div"),o.captionsButton.className=i.options.classPrefix+"button "+i.options.classPrefix+"captions-button",o.captionsButton.innerHTML='
    ",i.addControlElement(o.captionsButton,"tracks"),o.captionsButton.querySelector("."+i.options.classPrefix+"captions-selector-input").disabled=!1,o.chaptersButton=L.default.createElement("div"),o.chaptersButton.className=i.options.classPrefix+"button "+i.options.classPrefix+"chapters-button",o.chaptersButton.innerHTML='
      ';for(var u=0,c=0;c"},checkForTracks:function(){var e=this,t=!1;if(e.options.hideCaptionsButtonWhenEmpty){for(var n=0,o=e.tracks.length;n";for(var o=r.chaptersButton.querySelectorAll('input[type="radio"]'),i=r.chaptersButton.querySelectorAll("."+r.options.classPrefix+"chapters-selector-label"),a=0,s=o.length;a>1].start,a=e[i].stop,r<=t&&t ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,parse:function(e){for(var t=e.split(/\r?\n/),n=[],o=void 0,i=void 0,r=void 0,a=0,s=t.length;a$1"),n.push({identifier:r,start:0===(0,m.convertSMPTEtoSeconds)(o[1])?.2:(0,m.convertSMPTEtoSeconds)(o[1]),stop:(0,m.convertSMPTEtoSeconds)(o[3]),text:i,settings:o[5]})}r=""}return n}},dfxp:{parse:function(e){var t=L.default.adoptNode((new DOMParser).parseFromString(e,"application/xml").documentElement).querySelector("div"),n=t.querySelectorAll("p"),o=L.default.getElementById(t.getAttribute("style")),i=[],r=void 0;if(o){o.removeAttribute("id");var a=o.attributes;if(a.length){r={};for(var s=0,l=a.length;s$1"),i.push(f)}return i}}}},{16:16,2:2,26:26,27:27,30:30,5:5,7:7}],14:[function(e,t,n){"use strict";var x=r(e(2)),o=e(16),i=r(o),w=r(e(5)),P=e(25),T=e(27),C=e(26);function r(e){return e&&e.__esModule?e:{default:e}}Object.assign(o.config,{muteText:null,unmuteText:null,allyVolumeControlText:null,hideVolumeOnTouchDevices:!0,audioVolume:"horizontal",videoVolume:"vertical",startVolume:.8}),Object.assign(i.default.prototype,{buildvolume:function(e,t,n,o){if(!P.IS_ANDROID&&!P.IS_IOS||!this.options.hideVolumeOnTouchDevices){var a=this,s=a.isVideo?a.options.videoVolume:a.options.audioVolume,r=(0,T.isString)(a.options.muteText)?a.options.muteText:w.default.t("mejs.mute"),l=(0,T.isString)(a.options.unmuteText)?a.options.unmuteText:w.default.t("mejs.unmute"),i=(0,T.isString)(a.options.allyVolumeControlText)?a.options.allyVolumeControlText:w.default.t("mejs.volume-help-text"),d=x.default.createElement("div");if(d.className=a.options.classPrefix+"button "+a.options.classPrefix+"volume-button "+a.options.classPrefix+"mute",d.innerHTML="horizontal"===s?'':''+i+'
      ',a.addControlElement(d,"volume"),a.options.keyActions.push({keys:[38],action:function(e){var t=e.getElement(e.container).querySelector("."+a.options.classPrefix+"volume-slider");t&&t.matches(":focus")&&(t.style.display="block"),e.isVideo&&(e.showControls(),e.startControlsTimer());var n=Math.min(e.volume+.1,1);e.setVolume(n),0'+i+'
      ',d.parentNode.insertBefore(u,d.nextSibling)}var c=!1,f=!1,p=!1,m="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-slider"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-slider"),h="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-total"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-total"),v="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-current"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-current"),g="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-handle"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-handle"),y=function(e){if(null!==e&&!isNaN(e)&&void 0!==e){if(e=Math.max(0,e),0===(e=Math.min(e,1))){(0,C.removeClass)(d,a.options.classPrefix+"mute"),(0,C.addClass)(d,a.options.classPrefix+"unmute");var t=d.firstElementChild;t.setAttribute("title",l),t.setAttribute("aria-label",l)}else{(0,C.removeClass)(d,a.options.classPrefix+"unmute"),(0,C.addClass)(d,a.options.classPrefix+"mute");var n=d.firstElementChild;n.setAttribute("title",r),n.setAttribute("aria-label",r)}var o=100*e+"%",i=getComputedStyle(g);"vertical"===s?(v.style.bottom=0,v.style.height=o,g.style.bottom=o,g.style.marginBottom=-parseFloat(i.height)/2+"px"):(v.style.left=0,v.style.width=o,g.style.left=o,g.style.marginLeft=-parseFloat(i.width)/2+"px")}},E=function(e){var t=(0,C.offset)(h),n=getComputedStyle(h);p=!0;var o=null;if("vertical"===s){var i=parseFloat(n.height);if(o=(i-(e.pageY-t.top))/i,0===t.top||0===t.left)return}else{var r=parseFloat(n.width);o=(e.pageX-t.left)/r}o=Math.max(0,o),o=Math.min(o,1),y(o),a.setMuted(0===o),a.setVolume(o),e.preventDefault(),e.stopPropagation()},b=function(){a.muted?(y(0),(0,C.removeClass)(d,a.options.classPrefix+"mute"),(0,C.addClass)(d,a.options.classPrefix+"unmute")):(y(o.volume),(0,C.removeClass)(d,a.options.classPrefix+"unmute"),(0,C.addClass)(d,a.options.classPrefix+"mute"))};e.getElement(e.container).addEventListener("keydown",function(e){!!e.target.closest("."+a.options.classPrefix+"container")||"vertical"!==s||(m.style.display="none")}),d.addEventListener("mouseenter",function(e){e.target===d&&(m.style.display="block",f=!0,e.preventDefault(),e.stopPropagation())}),d.addEventListener("focusin",function(){m.style.display="block",f=!0}),d.addEventListener("focusout",function(e){e.relatedTarget&&(!e.relatedTarget||e.relatedTarget.matches("."+a.options.classPrefix+"volume-slider"))||"vertical"!==s||(m.style.display="none")}),d.addEventListener("mouseleave",function(){f=!1,c||"vertical"!==s||(m.style.display="none")}),d.addEventListener("focusout",function(){f=!1}),d.addEventListener("keydown",function(e){if(a.options.enableKeyboard&&a.options.keyActions.length){var t=e.which||e.keyCode||0,n=o.volume;switch(t){case 38:n=Math.min(n+.1,1);break;case 40:n=Math.max(0,n-.1);break;default:return!0}c=!1,y(n),o.setVolume(n),e.preventDefault(),e.stopPropagation()}}),d.querySelector("button").addEventListener("click",function(){o.setMuted(!o.muted);var e=(0,T.createEvent)("volumechange",o);o.dispatchEvent(e)}),m.addEventListener("dragstart",function(){return!1}),m.addEventListener("mouseover",function(){f=!0}),m.addEventListener("focusin",function(){m.style.display="block",f=!0}),m.addEventListener("focusout",function(){f=!1,c||"vertical"!==s||(m.style.display="none")}),m.addEventListener("mousedown",function(e){E(e),a.globalBind("mousemove.vol",function(e){var t=e.target;c&&(t===m||t.closest("vertical"===s?"."+a.options.classPrefix+"volume-slider":"."+a.options.classPrefix+"horizontal-volume-slider"))&&E(e)}),a.globalBind("mouseup.vol",function(){c=!1,f||"vertical"!==s||(m.style.display="none")}),c=!0,e.preventDefault(),e.stopPropagation()}),o.addEventListener("volumechange",function(e){var t;c||b(),t=Math.floor(100*o.volume),m.setAttribute("aria-valuenow",t),m.setAttribute("aria-valuetext",t+"%")});var S=!1;o.addEventListener("rendererready",function(){p||setTimeout(function(){S=!0,(0===e.options.startVolume||o.originalNode.muted)&&o.setMuted(!0),o.setVolume(e.options.startVolume),a.setControlsSize()},250)}),o.addEventListener("loadedmetadata",function(){setTimeout(function(){p||S||((0===e.options.startVolume||o.originalNode.muted)&&o.setMuted(!0),0===e.options.startVolume&&(e.options.startVolume=0),o.setVolume(e.options.startVolume),a.setControlsSize()),S=!1},250)}),(0===e.options.startVolume||o.originalNode.muted)&&(o.setMuted(!0),0===e.options.startVolume&&(e.options.startVolume=0),b()),a.getElement(a.container).addEventListener("controlsresize",function(){b()})}}})},{16:16,2:2,25:25,26:26,27:27,5:5}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.EN={"mejs.plural-form":1,"mejs.download-file":"Download File","mejs.install-flash":"You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https://get.adobe.com/flashplayer/","mejs.fullscreen":"Fullscreen","mejs.play":"Play","mejs.pause":"Pause","mejs.time-slider":"Time Slider","mejs.time-help-text":"Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.","mejs.live-broadcast":"Live Broadcast","mejs.volume-help-text":"Use Up/Down Arrow keys to increase or decrease volume.","mejs.unmute":"Unmute","mejs.mute":"Mute","mejs.volume-slider":"Volume Slider","mejs.video-player":"Video Player","mejs.audio-player":"Audio Player","mejs.captions-subtitles":"Captions/Subtitles","mejs.captions-chapters":"Chapters","mejs.none":"None","mejs.afrikaans":"Afrikaans","mejs.albanian":"Albanian","mejs.arabic":"Arabic","mejs.belarusian":"Belarusian","mejs.bulgarian":"Bulgarian","mejs.catalan":"Catalan","mejs.chinese":"Chinese","mejs.chinese-simplified":"Chinese (Simplified)","mejs.chinese-traditional":"Chinese (Traditional)","mejs.croatian":"Croatian","mejs.czech":"Czech","mejs.danish":"Danish","mejs.dutch":"Dutch","mejs.english":"English","mejs.estonian":"Estonian","mejs.filipino":"Filipino","mejs.finnish":"Finnish","mejs.french":"French","mejs.galician":"Galician","mejs.german":"German","mejs.greek":"Greek","mejs.haitian-creole":"Haitian Creole","mejs.hebrew":"Hebrew","mejs.hindi":"Hindi","mejs.hungarian":"Hungarian","mejs.icelandic":"Icelandic","mejs.indonesian":"Indonesian","mejs.irish":"Irish","mejs.italian":"Italian","mejs.japanese":"Japanese","mejs.korean":"Korean","mejs.latvian":"Latvian","mejs.lithuanian":"Lithuanian","mejs.macedonian":"Macedonian","mejs.malay":"Malay","mejs.maltese":"Maltese","mejs.norwegian":"Norwegian","mejs.persian":"Persian","mejs.polish":"Polish","mejs.portuguese":"Portuguese","mejs.romanian":"Romanian","mejs.russian":"Russian","mejs.serbian":"Serbian","mejs.slovak":"Slovak","mejs.slovenian":"Slovenian","mejs.spanish":"Spanish","mejs.swahili":"Swahili","mejs.swedish":"Swedish","mejs.tagalog":"Tagalog","mejs.thai":"Thai","mejs.turkish":"Turkish","mejs.ukrainian":"Ukrainian","mejs.vietnamese":"Vietnamese","mejs.welsh":"Welsh","mejs.yiddish":"Yiddish"}},{}],16:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.config=void 0;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function o(e,t){for(var n=0;n
      ',n.getElement(n.container).addEventListener("focus",function(e){if(!n.controlsAreVisible&&!n.hasFocus&&n.controlsEnabled){n.showControls(!0);var t=(0,m.isNodeAfter)(e.relatedTarget,n.getElement(n.container))?"."+n.options.classPrefix+"controls ."+n.options.classPrefix+"button:last-child > button":"."+n.options.classPrefix+"playpause-button > button";n.getElement(n.container).querySelector(t).focus()}}),n.node.parentNode.insertBefore(n.getElement(n.container),n.node),n.options.features.length||n.options.useDefaultControls||(n.getElement(n.container).style.background="transparent",n.getElement(n.container).querySelector("."+n.options.classPrefix+"controls").style.display="none"),n.isVideo&&"fill"===n.options.stretching&&!P.hasClass(n.getElement(n.container).parentNode,n.options.classPrefix+"fill-container")){n.outerContainer=n.media.parentNode;var r=x.default.createElement("div");r.className=n.options.classPrefix+"fill-container",n.getElement(n.container).parentNode.insertBefore(r,n.getElement(n.container)),r.appendChild(n.getElement(n.container))}w.IS_ANDROID&&P.addClass(n.getElement(n.container),n.options.classPrefix+"android"),w.IS_IOS&&P.addClass(n.getElement(n.container),n.options.classPrefix+"ios"),w.IS_IPAD&&P.addClass(n.getElement(n.container),n.options.classPrefix+"ipad"),w.IS_IPHONE&&P.addClass(n.getElement(n.container),n.options.classPrefix+"iphone"),P.addClass(n.getElement(n.container),n.isVideo?n.options.classPrefix+"video":n.options.classPrefix+"audio"),n.getElement(n.container).querySelector("."+n.options.classPrefix+"mediaelement").appendChild(n.node),(n.media.player=n).controls=n.getElement(n.container).querySelector("."+n.options.classPrefix+"controls"),n.layers=n.getElement(n.container).querySelector("."+n.options.classPrefix+"layers");var a=n.isVideo?"video":"audio",s=a.substring(0,1).toUpperCase()+a.substring(1);0=n.width?n.width/n.height:n.height/n.width,n.setPlayerSize(n.width,n.height),e.pluginWidth=n.width,e.pluginHeight=n.height}if(f.default.MepDefaults=e,new d.default(n.media,e,n.mediaFiles),void 0!==n.getElement(n.container)&&n.options.features.length&&n.controlsAreVisible&&!n.options.hideVideoControlsOnLoad){var l=(0,m.createEvent)("controlsshown",n.getElement(n.container));n.getElement(n.container).dispatchEvent(l)}}},{key:"showControls",value:function(e){var i=this;if(e=void 0===e||e,!i.controlsAreVisible&&i.isVideo){if(e)!function(){P.fadeIn(i.getElement(i.controls),200,function(){P.removeClass(i.getElement(i.controls),i.options.classPrefix+"offscreen");var e=(0,m.createEvent)("controlsshown",i.getElement(i.container));i.getElement(i.container).dispatchEvent(e)});for(var n=i.getElement(i.container).querySelectorAll("."+i.options.classPrefix+"control"),e=function(e,t){P.fadeIn(n[e],200,function(){P.removeClass(n[e],i.options.classPrefix+"offscreen")})},t=0,o=n.length;t'),e.message&&(a="

      "+e.message+"

      "),e.urls)for(var d=0,u=e.urls.length;d'+f.default.i18n.t("mejs.download-file")+": "+c.src+""}}a&&o.getElement(o.layers).querySelector("."+o.options.classPrefix+"overlay-error")&&(r.innerHTML=a,o.getElement(o.layers).querySelector("."+o.options.classPrefix+"overlay-error").innerHTML=""+s+r.outerHTML,o.getElement(o.layers).querySelector("."+o.options.classPrefix+"overlay-error").parentNode.style.display="block"),o.controlsEnabled&&o.disableControls()}},{key:"setPlayerSize",value:function(e,t){var n=this;if(!n.options.setDimensions)return!1;switch(void 0!==e&&(n.width=e),void 0!==t&&(n.height=t),n.options.stretching){case"fill":n.isVideo?n.setFillMode():n.setDimensions(n.width,n.height);break;case"responsive":n.setResponsiveMode();break;case"none":n.setDimensions(n.width,n.height);break;default:!0===n.hasFluidMode()?n.setResponsiveMode():n.setDimensions(n.width,n.height)}}},{key:"hasFluidMode",value:function(){var e=this;return-1!==e.height.toString().indexOf("%")||e.node&&e.node.style.maxWidth&&"none"!==e.node.style.maxWidth&&e.node.style.maxWidth!==e.width||e.node&&e.node.currentStyle&&"100%"===e.node.currentStyle.maxWidth}},{key:"setResponsiveMode",value:function(){var o=this,e=function(){for(var t=void 0,n=o.getElement(o.container);n;){try{if(w.IS_FIREFOX&&"html"===n.tagName.toLowerCase()&&S.default.self!==S.default.top&&null!==S.default.frameElement)return S.default.frameElement;t=n.parentElement}catch(e){t=n.parentElement}if(t&&P.visible(t))return t;n=t}return null}(),t=e?getComputedStyle(e,null):getComputedStyle(x.default.body,null),n=o.isVideo?o.node.videoWidth&&0=o.width?o.node.videoWidth/o.node.videoHeight:o.node.videoHeight/o.node.videoWidth:o.initialAspectRatio,(isNaN(e)||e<.01||100=o.width?parseFloat(l/r,10):parseFloat(l*r,10):i,isNaN(s)&&(s=a),0img");a&&(a.style.display="");for(var s=e.getElement(e.container).querySelectorAll("object, embed, iframe, video"),l=e.height,d=e.width,u=i,c=l*i/d,f=d*r/l,p=r,m=i',n.appendChild(r),a.style.display="none",a.className=i.options.classPrefix+"overlay "+i.options.classPrefix+"layer",a.innerHTML='
      ',n.appendChild(a),s.className=i.options.classPrefix+"overlay "+i.options.classPrefix+"layer "+i.options.classPrefix+"overlay-play",s.innerHTML='
      ',s.addEventListener("click",function(){if(i.options.clickToPlayPause){var e=i.getElement(i.container).querySelector("."+i.options.classPrefix+"overlay-button"),t=e.getAttribute("aria-pressed");i.paused?i.play():i.pause(),e.setAttribute("aria-pressed",!!t),i.getElement(i.container).focus()}}),s.addEventListener("keydown",function(e){var t=e.keyCode||e.which||0;if(13===t||w.IS_FIREFOX&&32===t){var n=(0,m.createEvent)("click",s);return s.dispatchEvent(n),!1}}),n.appendChild(s),null!==i.media.rendererName&&(/(youtube|facebook)/i.test(i.media.rendererName)&&!(i.media.originalNode.getAttribute("poster")||t.options.poster||"function"==typeof i.media.renderer.getPosterUrl&&i.media.renderer.getPosterUrl())||w.IS_STOCK_ANDROID||i.media.originalNode.getAttribute("autoplay"))&&(s.style.display="none");var l=!1;o.addEventListener("play",function(){s.style.display="none",r.style.display="none",a.style.display="none",l=!1}),o.addEventListener("playing",function(){s.style.display="none",r.style.display="none",a.style.display="none",l=!1}),o.addEventListener("seeking",function(){s.style.display="none",r.style.display="",l=!1}),o.addEventListener("seeked",function(){s.style.display=i.paused&&!w.IS_STOCK_ANDROID?"":"none",r.style.display="none",l=!1}),o.addEventListener("pause",function(){r.style.display="none",w.IS_STOCK_ANDROID||l||(s.style.display=""),l=!1}),o.addEventListener("waiting",function(){r.style.display="",l=!1}),o.addEventListener("loadeddata",function(){r.style.display="",w.IS_ANDROID&&(o.canplayTimeout=setTimeout(function(){if(x.default.createEvent){var e=x.default.createEvent("HTMLEvents");return e.initEvent("canplay",!0,!0),o.dispatchEvent(e)}},300)),l=!1}),o.addEventListener("canplay",function(){r.style.display="none",clearTimeout(o.canplayTimeout),l=!1}),o.addEventListener("error",function(e){i._handleError(e,i.media,i.node),r.style.display="none",s.style.display="none",l=!0}),o.addEventListener("loadedmetadata",function(){i.controlsEnabled||i.enableControls()}),o.addEventListener("keydown",function(e){i.onkeydown(t,o,e),l=!1})}}},{key:"buildkeyboard",value:function(o,e,t,i){var r=this;r.getElement(r.container).addEventListener("keydown",function(){r.keyboardAction=!0}),r.globalKeydownCallback=function(e){var t=x.default.activeElement.closest("."+r.options.classPrefix+"container"),n=r.media.closest("."+r.options.classPrefix+"container");return r.hasFocus=!(!t||!n||t.id!==n.id),r.onkeydown(o,i,e)},r.globalClickCallback=function(e){r.hasFocus=!!e.target.closest("."+r.options.classPrefix+"container")},r.globalBind("keydown",r.globalKeydownCallback),r.globalBind("click",r.globalClickCallback)}},{key:"onkeydown",value:function(e,t,n){if(e.hasFocus&&e.options.enableKeyboard)for(var o=0,i=e.options.keyActions.length;oimg");(e&&l.node.setAttribute("poster",e.src),delete l.node.autoplay,l.node.setAttribute("src",""),""!==l.media.canPlayType((0,p.getTypeFromFile)(u))&&l.node.setAttribute("src",u),d&&-1t[0]||n[0]===t[0]&&n[1]>t[1]||n[0]===t[0]&&n[1]===t[1]&&n[2]>=t[2]},addPlugin:function(e,t,n,o,i){r.plugins[e]=r.detectPlugin(t,n,o,i)},detectPlugin:function(e,t,n,o){var i=[0,0,0],r=void 0,a=void 0;if(null!==F.NAV.plugins&&void 0!==F.NAV.plugins&&"object"===d(F.NAV.plugins[e])){if((r=F.NAV.plugins[e].description)&&(void 0===F.NAV.mimeTypes||!F.NAV.mimeTypes[t]||F.NAV.mimeTypes[t].enabledPlugin))for(var s=0,l=(i=r.replace(e,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".")).length;s
      '+N.default.t("mejs.install-flash")+"
      "}else x=['id="__'+r.id+'"','name="__'+r.id+'"','play="true"','loop="false"','quality="high"','bgcolor="#000000"','wmode="transparent"','allowScriptAccess="'+r.options.shimScriptAccess+'"','allowFullScreen="true"','type="application/x-shockwave-flash"','pluginspage="//www.macromedia.com/go/getflashplayer"','src="'+r.options.pluginPath+r.options.filename+'"','flashvars="'+y.join("&")+'"'],E?(x.push('width="'+S+'"'),x.push('height="'+b+'"')):x.push('style="position: fixed; left: -9999em; top: -9999em;"'),r.flashWrapper.innerHTML="";if(r.flashNode=r.flashWrapper.lastChild,r.hide=function(){o=!1,E&&(r.flashNode.style.display="none")},r.show=function(){o=!0,E&&(r.flashNode.style.display="")},r.setSize=function(e,t){r.flashNode.style.width=e+"px",r.flashNode.style.height=t+"px",null!==r.flashApi&&"function"==typeof r.flashApi.fire_setSize&&r.flashApi.fire_setSize(e,t)},r.destroy=function(){r.flashNode.remove()},n&&0":">",'"':"""};return e.replace(/[&<>"]/g,function(e){return t[e]})}function s(o,i){var r=this,a=arguments,s=2x',t.firstChild.href}function d(e){var t=1