File Editor
Directories:
.. (Back)
Files:
accordion.js
accordion.min.js
bookmarklet.js
bookmarklet.min.js
color-picker.js
color-picker.min.js
comment.js
comment.min.js
common.js
common.min.js
custom-background.js
custom-background.min.js
custom-header.js
customize-controls.js
customize-controls.min.js
customize-nav-menus.js
customize-nav-menus.min.js
customize-widgets.js
customize-widgets.min.js
dashboard.js
dashboard.min.js
edit-comments.js
edit-comments.min.js
editor-expand.js
editor-expand.min.js
editor.js
editor.min.js
farbtastic.js
gallery.js
gallery.min.js
image-edit.js
image-edit.min.js
inline-edit-post.js
inline-edit-post.min.js
inline-edit-tax.js
inline-edit-tax.min.js
iris.min.js
language-chooser.js
language-chooser.min.js
link.js
link.min.js
media-gallery.js
media-gallery.min.js
media-upload.js
media-upload.min.js
media.js
media.min.js
nav-menu.js
nav-menu.min.js
password-strength-meter.js
password-strength-meter.min.js
plugin-install.js
plugin-install.min.js
post.js
post.min.js
postbox.js
postbox.min.js
press-this.js
press-this.min.js
revisions.js
revisions.min.js
set-post-thumbnail.js
set-post-thumbnail.min.js
svg-painter.js
svg-painter.min.js
tags-box.js
tags-box.min.js
tags.js
tags.min.js
theme.js
theme.min.js
updates.js
updates.min.js
user-profile.js
user-profile.min.js
user-suggest.js
user-suggest.min.js
widgets.js
widgets.min.js
word-count.js
word-count.min.js
wp-fullscreen-stub.js
wp-fullscreen-stub.min.js
xfn.js
xfn.min.js
Create New File
Create
Edit File: customize-controls.min.js
!function(f){var i,e,t,m=wp.customize;m.Setting=m.Value.extend({initialize:function(e,t,n){m.Value.prototype.initialize.call(this,t,n),this.id=e,this.transport=this.transport||"refresh",this._dirty=n.dirty||!1,this.notifications=new m.Values({defaultConstructor:m.Notification}),this.bind(this.preview)},preview:function(){switch(this.transport){case"refresh":return this.previewer.refresh();case"postMessage":return this.previewer.send("setting",[this.id,this()])}},findControls:function(){var n=this,i=[];return m.control.each(function(t){_.each(t.settings,function(e){e.id===n.id&&i.push(t)})}),i}}),m.utils={},m.utils.bubbleChildValueChanges=function(n,e){f.each(e,function(e,t){n[t].bind(function(e,t){n.parent&&e!==t&&n.parent.trigger("change",n)})})},e=function(e){var t,n,i=this,o=function(){var e=i.extended(m.Panel)&&i.expanded&&i.expanded()?i.container.find("ul.control-panel-content"):i.extended(m.Section)&&i.expanded&&i.expanded()?i.container.find("ul.accordion-section-content"):i.container;(n=0===(n=e.find(".control-focus:first")).length?e.find("input, select, textarea, button, object, a[href], [tabindex]").filter(":visible").first():n).focus()};(e=e||{}).completeCallback?(t=e.completeCallback,e.completeCallback=function(){o(),t()}):e.completeCallback=o,i.expand?i.expand(e):e.completeCallback()},m.utils.prioritySort=function(e,t){return e.priority()===t.priority()&&"number"==typeof e.params.instanceNumber&&"number"==typeof t.params.instanceNumber?e.params.instanceNumber-t.params.instanceNumber:e.priority()-t.priority()},m.utils.isKeydownButNotEnterEvent=function(e){return"keydown"===e.type&&13!==e.which},m.utils.areElementListsEqual=function(e,t){return e.length===t.length&&-1===_.indexOf(_.map(_.zip(e,t),function(e){return f(e[0]).is(e[1])}),!1)},i=m.Class.extend({defaultActiveArguments:{duration:"fast",completeCallback:f.noop},defaultExpandedArguments:{duration:"fast",completeCallback:f.noop},containerType:"container",defaults:{title:"",description:"",priority:100,type:"default",content:null,active:!0,instanceNumber:null},initialize:function(e,t){var n=this;n.id=e,(t=t||{}).params=_.defaults(t.params||{},n.defaults),f.extend(n,t),n.templateSelector="customize-"+n.containerType+"-"+n.params.type,n.container=f(n.params.content),0===n.container.length&&(n.container=f(n.getContainer())),n.deferred={embedded:new f.Deferred},n.priority=new m.Value,n.active=new m.Value,n.activeArgumentsQueue=[],n.expanded=new m.Value,n.expandedArgumentsQueue=[],n.active.bind(function(e){var t=n.activeArgumentsQueue.shift(),t=f.extend({},n.defaultActiveArguments,t);e=e&&n.isContextuallyActive(),n.onChangeActive(e,t)}),n.expanded.bind(function(e){var t=n.expandedArgumentsQueue.shift(),t=f.extend({},n.defaultExpandedArguments,t);n.onChangeExpanded(e,t)}),n.deferred.embedded.done(function(){n.attachEvents()}),m.utils.bubbleChildValueChanges(n,["priority","active"]),n.priority.set(n.params.priority),n.active.set(n.params.active),n.expanded.set(!1)},ready:function(){},_children:function(t,e){var n=this,i=[];return m[e].each(function(e){e[t].get()===n.id&&i.push(e)}),i.sort(m.utils.prioritySort),i},isContextuallyActive:function(){throw new Error("Container.isContextuallyActive() must be overridden in a subclass.")},onChangeActive:function(e,t){var n,i,o=this;t.unchanged?t.completeCallback&&t.completeCallback():(n="resolved"===m.previewer.deferred.active.state()?t.duration:0,o.extended(m.Panel)&&(m.panel.each(function(e){e!==o&&e.expanded()&&(i=e,n=0)}),e||_.each(o.sections(),function(e){e.collapse({duration:0})})),f.contains(document,o.container[0])?e?o.container.stop(!0,!0).slideDown(n,t.completeCallback):o.expanded()?o.collapse({duration:n,completeCallback:function(){o.container.stop(!0,!0).slideUp(n,t.completeCallback)}}):o.container.stop(!0,!0).slideUp(n,t.completeCallback):(o.container.toggle(e),t.completeCallback&&t.completeCallback()),i&&i._recalculateTopMargin())},_toggleActive:function(e,t){return t=t||{},e&&this.active.get()||!e&&!this.active.get()?(t.unchanged=!0,this.onChangeActive(this.active.get(),t),!1):(t.unchanged=!1,this.activeArgumentsQueue.push(t),this.active.set(e),!0)},activate:function(e){return this._toggleActive(!0,e)},deactivate:function(e){return this._toggleActive(!1,e)},onChangeExpanded:function(){throw new Error("Must override with subclass.")},_toggleExpanded:function(e,t){var n,i=this;return n=(t=t||{}).completeCallback,!(e&&!i.active())&&(t.completeCallback=function(){n&&n.apply(i,arguments),e?i.container.trigger("expanded"):i.container.trigger("collapsed")},e&&i.expanded.get()||!e&&!i.expanded.get()?(t.unchanged=!0,i.onChangeExpanded(i.expanded.get(),t),!1):(t.unchanged=!1,i.expandedArgumentsQueue.push(t),i.expanded.set(e),!0))},expand:function(e){return this._toggleExpanded(!0,e)},collapse:function(e){return this._toggleExpanded(!1,e)},focus:e,getContainer:function(){var e=this,t=0!==f("#tmpl-"+e.templateSelector).length?wp.template(e.templateSelector):wp.template("customize-"+e.containerType+"-default");return t&&e.container?f.trim(t(e.params)):"<li></li>"}}),m.Section=i.extend({containerType:"section",defaults:{title:"",description:"",priority:100,type:"default",content:null,active:!0,instanceNumber:null,panel:null,customizeAction:""},initialize:function(e,t){var n=this;i.prototype.initialize.call(n,e,t),n.id=e,n.panel=new m.Value,n.panel.bind(function(e){f(n.container).toggleClass("control-subsection",!!e)}),n.panel.set(n.params.panel||""),m.utils.bubbleChildValueChanges(n,["panel"]),n.embed(),n.deferred.embedded.done(function(){n.ready()})},embed:function(){var n=this,e=function(e){var t;e?m.panel(e,function(e){e.deferred.embedded.done(function(){t=e.container.find("ul:first"),n.container.parent().is(t)||t.append(n.container),n.deferred.embedded.resolve()})}):(t=f("#customize-theme-controls").children("ul"),n.container.parent().is(t)||t.append(n.container),n.deferred.embedded.resolve())};n.panel.bind(e),e(n.panel.get()),n.deferred.embedded.done(function(){m.bind("pane-contents-reflowed",_.debounce(function(){n._recalculateTopMargin()},100))})},attachEvents:function(){var t=this;t.container.find(".accordion-section-title, .customize-section-back").on("click keydown",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),t.expanded()?t.collapse():t.expand())})},isContextuallyActive:function(){var e=this.controls(),t=0;return _(e).each(function(e){e.active()&&(t+=1)}),0!==t},controls:function(){return this._children("section","control")},onChangeExpanded:function(e,t){var n,i,o,a,r=this,s=r.container.closest(".wp-full-overlay-sidebar-content"),c=r.container.find(".accordion-section-content"),l=r.container.closest(".wp-full-overlay"),d=r.container.find(".customize-section-back"),u=r.container.find(".accordion-section-title").first(),p=f("#customize-header-actions").height();e&&!r.container.hasClass("open")?(i=t.unchanged?t.completeCallback:(s.scrollTop(0),n=function(){var e=window.matchMedia||window.msMatchMedia,t=90;e&&e("(max-width: 640px)").matches&&(t=45),c.css("height",window.innerHeight-t)},function(){r.container.addClass("open"),l.addClass("section-open"),o=c.offset().top,a=s.scrollTop(),c.css("margin-top",p-o-a),n(),u.attr("tabindex","-1"),d.attr("tabindex","0"),d.focus(),t.completeCallback&&t.completeCallback(),f(window).on("resize.customizer-section",_.debounce(n,100)),setTimeout(_.bind(r._recalculateTopMargin,r),0)}),t.allowMultiple||m.section.each(function(e){e!==r&&e.collapse({duration:t.duration})}),r.panel()?m.panel(r.panel()).expand({duration:t.duration,completeCallback:i}):(m.panel.each(function(e){e.collapse()}),i())):!e&&r.container.hasClass("open")?(r.container.removeClass("open"),l.removeClass("section-open"),c.css("margin-top",""),s.scrollTop(0),d.attr("tabindex","-1"),u.attr("tabindex","0"),u.focus(),t.completeCallback&&t.completeCallback(),f(window).off("resize.customizer-section")):t.completeCallback&&t.completeCallback()},_recalculateTopMargin:function(){var e,t=this.container.find(".accordion-section-content");0!==t.length&&(e=f("#customize-header-actions").height(),0<(e=t.offset().top-e)&&t.css("margin-top",parseInt(t.css("margin-top"),10)-e))}}),m.ThemesSection=m.Section.extend({currentTheme:"",overlay:"",template:"",screenshotQueue:null,$window:f(window),initialize:function(){return this.$customizeSidebar=f(".wp-full-overlay-sidebar-content:first"),m.Section.prototype.initialize.apply(this,arguments)},ready:function(){var t=this;t.overlay=t.container.find(".theme-overlay"),t.template=wp.template("customize-themes-details-view"),f("body").on("keyup",function(e){t.overlay.find(".theme-wrap").is(":visible")&&(39===e.keyCode&&t.nextTheme(),37===e.keyCode&&t.previousTheme(),27===e.keyCode&&t.closeDetails())}),_.bindAll(this,"renderScreenshots")},isContextuallyActive:function(){return this.active()},attachEvents:function(){var n=this;n.container.find(".change-theme, .customize-theme").on("click keydown",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()?n.collapse():n.expand())}),n.container.on("click keydown",".left",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.previousTheme())}),n.container.on("click keydown",".right",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.nextTheme())}),n.container.on("click keydown",".theme-backdrop, .close",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.closeDetails())});var i=_.throttle(_.bind(n.renderScreenshots,this),100);n.container.on("input","#themes-filter",function(e){var t=e.currentTarget.value.toLowerCase().trim().replace("-"," "),e=n.controls();_.each(e,function(e){e.filter(t)}),i(),e=n.container.find("li.customize-control:visible").length,n.container.find(".theme-count").text(e)}),m.bind("ready",function(){_.each(n.controls().slice(0,3),function(e){e=e.params.theme.screenshot[0];e&&((new Image).src=e)})})},onChangeExpanded:function(e,t){var n,i,o,a,r,s,c,l,d,u;t.unchanged?t.completeCallback&&t.completeCallback():(a=(o=this).container.closest(".accordion-section"),r=a.closest(".wp-full-overlay"),c=(s=a.closest(".wp-full-overlay-sidebar-content")).find(".open"),l=a.find(".customize-theme"),d=a.find(".change-theme"),u=a.find(".control-panel-content"),e?(m.section.each(function(e){e!==o&&e.collapse({duration:t.duration})}),m.panel.each(function(e){e.collapse({duration:0})}),u.show(0,function(){n=u.offset().top,i=s.scrollTop(),u.css("margin-top",f("#customize-header-actions").height()-n-i),a.addClass("current-panel"),r.addClass("in-themes-panel"),s.scrollTop(0),_.delay(o.renderScreenshots,10),o.$customizeSidebar.on("scroll.customize-themes-section",_.throttle(o.renderScreenshots,300)),t.completeCallback&&t.completeCallback()}),l.focus()):(c.removeClass("open"),a.removeClass("current-panel"),r.removeClass("in-themes-panel"),o.$customizeSidebar.off("scroll.customize-themes-section"),u.delay(180).hide(0,function(){u.css("margin-top","inherit"),t.completeCallback&&t.completeCallback()}),l.attr("tabindex","0"),d.focus(),s.scrollTop(0)))},_recalculateTopMargin:function(){m.Panel.prototype._recalculateTopMargin.call(this)},renderScreenshots:function(){var r=this;null===r.screenshotQueue&&(r.screenshotQueue=r.controls()),r.screenshotQueue.length&&(r.screenshotQueue=_.filter(r.screenshotQueue,function(e){var t=e.container.find(".theme-screenshot"),n=t.find("img");if(!n.length)return!1;if(n.is(":hidden"))return!0;var i=r.$window.scrollTop(),o=i+r.$window.height(),a=n.offset().top,n=t.height(),t=3*n,t=i-t<=a+n&&a<=o+t;return t&&e.container.trigger("render-screenshot"),!t}))},nextTheme:function(){var e=this;e.getNextTheme()&&e.showDetails(e.getNextTheme(),function(){e.overlay.find(".right").focus()})},getNextTheme:function(){var e=m.control("theme_"+this.currentTheme),t=e.container.next("li.customize-control-theme");return!!t.length&&(t=t[0].id.replace("customize-control-",""),(e=m.control(t)).params.theme)},previousTheme:function(){var e=this;e.getPreviousTheme()&&e.showDetails(e.getPreviousTheme(),function(){e.overlay.find(".left").focus()})},getPreviousTheme:function(){var e=m.control("theme_"+this.currentTheme),t=e.container.prev("li.customize-control-theme");return!!t.length&&(t=t[0].id.replace("customize-control-",""),(e=m.control(t)).params.theme)},updateLimits:function(){this.getNextTheme()||this.overlay.find(".right").addClass("disabled"),this.getPreviousTheme()||this.overlay.find(".left").addClass("disabled")},showDetails:function(e,t){var n=this;t=t||function(){},n.currentTheme=e.id,n.overlay.html(n.template(e)).fadeIn("fast").focus(),f("body").addClass("modal-open"),n.containFocus(n.overlay),n.updateLimits(),t()},closeDetails:function(){f("body").removeClass("modal-open"),this.overlay.fadeOut("fast"),m.control("theme_"+this.currentTheme).focus()},containFocus:function(t){var n;t.on("keydown",function(e){if(9===e.keyCode)return(n=f(":tabbable",t)).last()[0]!==e.target||e.shiftKey?n.first()[0]===e.target&&e.shiftKey?(n.last().focus(),!1):void 0:(n.first().focus(),!1)})}}),m.Panel=i.extend({containerType:"panel",initialize:function(e,t){var n=this;i.prototype.initialize.call(n,e,t),n.embed(),n.deferred.embedded.done(function(){n.ready()})},embed:function(){var e=this,t=f("#customize-theme-controls > ul");e.container.parent().is(t)||(t.append(e.container),e.renderContent()),m.bind("pane-contents-reflowed",_.debounce(function(){e._recalculateTopMargin()},100)),e.deferred.embedded.resolve()},attachEvents:function(){var t,n=this;n.container.find(".accordion-section-title").on("click keydown",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()||n.expand())}),n.container.find(".customize-panel-back").on("click keydown",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()&&n.collapse())}),(t=n.container.find(".panel-meta:first")).find("> .accordion-section-title .customize-help-toggle").on("click keydown",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),(t=n.container.find(".panel-meta")).hasClass("cannot-expand")||(e=t.find(".customize-panel-description:first"),t.hasClass("open")?(t.toggleClass("open"),e.slideUp(n.defaultExpandedArguments.duration),f(this).attr("aria-expanded",!1)):(e.slideDown(n.defaultExpandedArguments.duration),t.toggleClass("open"),f(this).attr("aria-expanded",!0))))})},sections:function(){return this._children("panel","section")},isContextuallyActive:function(){var e=this.sections(),t=0;return _(e).each(function(e){e.active()&&e.isContextuallyActive()&&(t+=1)}),0!==t},onChangeExpanded:function(e,t){var n,i,o,a,r,s,c,l,d,u,p,h;t.unchanged?t.completeCallback&&t.completeCallback():(a=(o=this).container.closest(".accordion-section"),r=a.closest(".wp-full-overlay"),c=(s=a.closest(".wp-full-overlay-sidebar-content")).find(".open"),l=r.find("#customize-theme-controls > ul > .accordion-section > .accordion-section-title"),d=a.find(".customize-panel-back"),u=a.find(".accordion-section-title").first(),p=a.find(".control-panel-content"),h=f("#customize-header-actions").height(),e?(m.section.each(function(e){o.id!==e.panel()&&e.collapse({duration:0})}),m.panel.each(function(e){o!==e&&e.collapse({duration:0})}),p.show(0,function(){p.parent().show(),n=p.offset().top,i=s.scrollTop(),p.css("margin-top",h-n-i),a.addClass("current-panel"),r.addClass("in-sub-panel"),s.scrollTop(0),t.completeCallback&&t.completeCallback()}),l.attr("tabindex","-1"),d.attr("tabindex","0"),d.focus(),o._recalculateTopMargin()):(c.removeClass("open"),a.removeClass("current-panel"),r.removeClass("in-sub-panel"),p.delay(180).hide(0,function(){p.css("margin-top","inherit"),t.completeCallback&&t.completeCallback()}),l.attr("tabindex","0"),d.attr("tabindex","-1"),u.focus(),s.scrollTop(0)))},_recalculateTopMargin:function(){var e=f("#customize-header-actions").height(),t=this.container.closest(".accordion-section").find(".control-panel-content");t.css("margin-top",parseInt(t.css("margin-top"),10)-(t.offset().top-e))},renderContent:function(){var e=this,t=0!==f("#tmpl-"+e.templateSelector+"-content").length?wp.template(e.templateSelector+"-content"):wp.template("customize-panel-default-content");t&&e.container&&e.container.find(".accordion-sub-container").html(t(e.params))}}),m.Control=m.Class.extend({defaultActiveArguments:{duration:"fast",completeCallback:f.noop},initialize:function(e,t){var i,o,a=this;a.params={},f.extend(a,t||{}),a.id=e,a.selector="#customize-control-"+e.replace(/\]/g,"").replace(/\[/g,"-"),a.templateSelector="customize-control-"+a.params.type+"-content",a.container=a.params.content?f(a.params.content):f(a.selector),a.deferred={embedded:new f.Deferred},a.section=new m.Value,a.priority=new m.Value,a.active=new m.Value,a.activeArgumentsQueue=[],a.notifications=new m.Values({defaultConstructor:m.Notification}),a.elements=[],i=a.container.find("[data-customize-setting-link]"),o={},i.each(function(){var e,n=f(this);if(n.is(":radio")){if(e=n.prop("name"),o[e])return;o[e]=!0,n=i.filter('[name="'+e+'"]')}m(n.data("customizeSettingLink"),function(e){var t=new m.Element(n);a.elements.push(t),t.sync(e),t.set(e())})}),a.active.bind(function(e){var t=a.activeArgumentsQueue.shift(),t=f.extend({},a.defaultActiveArguments,t);a.onChangeActive(e,t)}),a.section.set(a.params.section),a.priority.set(isNaN(a.params.priority)?10:a.params.priority),a.active.set(a.params.active),m.utils.bubbleChildValueChanges(a,["section","priority","active"]),0===(e=f.map(a.params.settings,function(e){return e})).length?(a.setting=null,a.settings={},a.embed()):m.apply(m,e.concat(function(){for(var e in a.settings={},a.params.settings)a.settings[e]=m(a.params.settings[e]);a.setting=a.settings["default"]||null,_.each(a.settings,function(n){n.notifications.bind("add",function(e){var t=n.id+":"+e.code,e=_.extend({},e,{setting:n.id}),e=new m.Notification(t,e);a.notifications.add(e.code,e)}),n.notifications.bind("remove",function(e){a.notifications.remove(n.id+":"+e.code)})}),a.embed()})),a.deferred.embedded.done(function(){var t=_.debounce(function(){a.renderNotifications()});a.notifications.bind("add",function(e){wp.a11y.speak(e.message,"assertive"),t()}),a.notifications.bind("remove",t),a.renderNotifications(),a.ready()})},embed:function(){var n=this,e=function(e){var t;e&&m.section(e,function(e){e.deferred.embedded.done(function(){t=e.container.find("ul:first"),n.container.parent().is(t)||(t.append(n.container),n.renderContent()),n.deferred.embedded.resolve()})})};n.section.bind(e),e(n.section.get())},ready:function(){},getNotificationsContainerElement:function(){var e,t=this,n=t.container.find(".customize-control-notifications-container:first");return n.length||(n=f('<div class="customize-control-notifications-container"></div>'),t.container.hasClass("customize-control-nav_menu_item")?t.container.find(".menu-item-settings:first").prepend(n):t.container.hasClass("customize-control-widget_form")?t.container.find(".widget-inside:first").prepend(n):(e=t.container.find(".customize-control-title")).length?e.after(n):t.container.prepend(n)),n},renderNotifications:function(){var t,e=this,n=!1,i=e.getNotificationsContainerElement();i&&i.length&&(t=[],e.notifications.each(function(e){t.push(e),"error"===e.type&&(n=!0)}),0===t.length?i.stop().slideUp("fast"):i.stop().slideDown("fast",null,function(){f(this).css("height","auto")}),e.notificationsTemplate||(e.notificationsTemplate=wp.template("customize-control-notifications")),e.container.toggleClass("has-notifications",0!==t.length),e.container.toggleClass("has-error",n),i.empty().append(f.trim(e.notificationsTemplate({notifications:t,altNotice:Boolean(e.altNotice)}))))},expand:function(e){m.section(this.section()).expand(e)},focus:e,onChangeActive:function(e,t){t.unchanged?t.completeCallback&&t.completeCallback():f.contains(document,this.container[0])?e?this.container.slideDown(t.duration,t.completeCallback):this.container.slideUp(t.duration,t.completeCallback):(this.container.toggle(e),t.completeCallback&&t.completeCallback())},toggle:function(e){return this.onChangeActive(e,this.defaultActiveArguments)},activate:i.prototype.activate,deactivate:i.prototype.deactivate,_toggleActive:i.prototype._toggleActive,dropdownInit:function(){function e(e){"string"==typeof e&&i.statuses&&i.statuses[e]?n.html(i.statuses[e]).show():n.hide()}var t=this,n=this.container.find(".dropdown-status"),i=this.params,o=!1;this.container.on("click keydown",".dropdown",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),o||t.container.toggleClass("open"),t.container.hasClass("open")&&t.container.parent().parent().find("li.library-selected").focus(),o=!0,setTimeout(function(){o=!1},400))}),this.setting.bind(e),e(this.setting())},renderContent:function(){var e,t=this;0!==f("#tmpl-"+t.templateSelector).length&&(e=wp.template(t.templateSelector))&&t.container&&t.container.html(e(t.params))}}),m.ColorControl=m.Control.extend({ready:function(){var e=this,t=this.container.find(".color-picker-hex");t.val(e.setting()).wpColorPicker({change:function(){e.setting.set(t.wpColorPicker("color"))},clear:function(){e.setting.set("")}}),this.setting.bind(function(e){t.val(e),t.wpColorPicker("color",e)})}}),m.MediaControl=m.Control.extend({ready:function(){var n=this;function e(e){var t=f.Deferred();n.extended(m.UploadControl)?t.resolve():(e=parseInt(e,10),_.isNaN(e)||e<=0?(delete n.params.attachment,t.resolve()):n.params.attachment&&n.params.attachment.id===e&&t.resolve()),"pending"===t.state()&&wp.media.attachment(e).fetch().done(function(){n.params.attachment=this.attributes,t.resolve(),wp.customize.previewer.send(n.setting.id+"-attachment-data",this.attributes)}),t.done(function(){n.renderContent()})}_.bindAll(n,"restoreDefault","removeFile","openFrame","select","pausePlayer"),n.container.on("click keydown",".upload-button",n.openFrame),n.container.on("click keydown",".upload-button",n.pausePlayer),n.container.on("click keydown",".thumbnail-image img",n.openFrame),n.container.on("click keydown",".default-button",n.restoreDefault),n.container.on("click keydown",".remove-button",n.pausePlayer),n.container.on("click keydown",".remove-button",n.removeFile),n.container.on("click keydown",".remove-button",n.cleanupPlayer),m.section(n.section()).container.on("expanded",function(){n.player&&n.player.setControlsSize()}).on("collapsed",function(){n.pausePlayer()}),e(n.setting()),n.setting.bind(e)},pausePlayer:function(){this.player&&this.player.pause()},cleanupPlayer:function(){this.player&&wp.media.mixin.removePlayer(this.player)},openFrame:function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.frame||this.initFrame(),this.frame.open())},initFrame:function(){this.frame=wp.media({button:{text:this.params.button_labels.frame_button},states:[new wp.media.controller.Library({title:this.params.button_labels.frame_title,library:wp.media.query({type:this.params.mime_type}),multiple:!1,date:!1})]}),this.frame.on("select",this.select)},select:function(){var e=this.frame.state().get("selection").first().toJSON(),t=window._wpmejsSettings||{};this.params.attachment=e,this.setting(e.id),(e=this.container.find("audio, video").get(0))?this.player=new MediaElementPlayer(e,t):this.cleanupPlayer()},restoreDefault:function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment=this.params.defaultAttachment,this.setting(this.params.defaultAttachment.url))},removeFile:function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment={},this.setting(""),this.renderContent())}}),m.UploadControl=m.MediaControl.extend({select:function(){var e=this.frame.state().get("selection").first().toJSON(),t=window._wpmejsSettings||{};this.params.attachment=e,this.setting(e.url),(e=this.container.find("audio, video").get(0))?this.player=new MediaElementPlayer(e,t):this.cleanupPlayer()},success:function(){},removerVisibility:function(){}}),m.ImageControl=m.UploadControl.extend({thumbnailSrc:function(){}}),m.BackgroundControl=m.UploadControl.extend({ready:function(){m.UploadControl.prototype.ready.apply(this,arguments)},select:function(){m.UploadControl.prototype.select.apply(this,arguments),wp.ajax.post("custom-background-add",{nonce:_wpCustomizeBackground.nonces.add,wp_customize:"on",theme:m.settings.theme.stylesheet,attachment_id:this.params.attachment.id})}}),m.CroppedImageControl=m.MediaControl.extend({openFrame:function(e){m.utils.isKeydownButNotEnterEvent(e)||(this.initFrame(),this.frame.setState("library").open())},initFrame:function(){var e=_wpMediaViewsL10n;this.frame=wp.media({button:{text:e.select,close:!1},states:[new wp.media.controller.Library({title:this.params.button_labels.frame_title,library:wp.media.query({type:"image"}),multiple:!1,date:!1,priority:20,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.CustomizeImageCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelect,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){var e=this.frame.state().get("selection").first().toJSON();this.params.width!==e.width||this.params.height!==e.height||this.params.flex_width||this.params.flex_height?this.frame.setState("cropper"):(this.setImageFromAttachment(e),this.frame.close())},onCropped:function(e){this.setImageFromAttachment(e)},calculateImageSelectOptions:function(e,t){var n=t.get("control"),i=!!parseInt(n.params.flex_width,10),o=!!parseInt(n.params.flex_height,10),a=e.get("width"),r=e.get("height"),s=parseInt(n.params.width,10),c=parseInt(n.params.height,10),l=s/c,d=s,e=c;return t.set("canSkipCrop",!n.mustBeCropped(i,o,s,c,a,r)),l<a/r?s=(c=r)*l:c=(s=a)/l,!(e={handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:a,imageHeight:r,minWidth:s<d?s:d,minHeight:c<e?c:e,x1:d=(a-s)/2,y1:e=(r-c)/2,x2:s+d,y2:c+e})==o&&!1==i&&(e.aspectRatio=s+":"+c),!0==o&&(delete e.minHeight,e.maxWidth=a),!0==i&&(delete e.minWidth,e.maxHeight=r),e},mustBeCropped:function(e,t,n,i,o,a){return(!0!==e||!0!==t)&&((!0!==e||i!==a)&&((!0!==t||n!==o)&&((n!==o||i!==a)&&!(o<=n))))},onSkippedCrop:function(){var e=this.frame.state().get("selection").first().toJSON();this.setImageFromAttachment(e)},setImageFromAttachment:function(e){this.params.attachment=e,this.setting(e.id)}}),m.SiteIconControl=m.CroppedImageControl.extend({initFrame:function(){var e=_wpMediaViewsL10n;this.frame=wp.media({button:{text:e.select,close:!1},states:[new wp.media.controller.Library({title:this.params.button_labels.frame_title,library:wp.media.query({type:"image"}),multiple:!1,date:!1,priority:20,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.SiteIconCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelect,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){var e=this.frame.state().get("selection").first().toJSON(),t=this;this.params.width!==e.width||this.params.height!==e.height||this.params.flex_width||this.params.flex_height?this.frame.setState("cropper"):wp.ajax.post("crop-image",{nonce:e.nonces.edit,id:e.id,context:"site-icon",cropDetails:{x1:0,y1:0,width:this.params.width,height:this.params.height,dst_width:this.params.width,dst_height:this.params.height}}).done(function(e){t.setImageFromAttachment(e),t.frame.close()}).fail(function(){t.frame.trigger("content:error:crop")})},setImageFromAttachment:function(t){var n;_.each(["site_icon-32","thumbnail","full"],function(e){n||_.isUndefined(t.sizes[e])||(n=t.sizes[e])}),this.params.attachment=t,this.setting(t.id),f('link[sizes="32x32"]').attr("href",n.url)},removeFile:function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment={},this.setting(""),this.renderContent(),f('link[rel="icon"]').attr("href",""))}}),m.HeaderControl=m.Control.extend({ready:function(){this.btnRemove=f("#customize-control-header_image .actions .remove"),this.btnNew=f("#customize-control-header_image .actions .new"),_.bindAll(this,"openMedia","removeImage"),this.btnNew.on("click",this.openMedia),this.btnRemove.on("click",this.removeImage),m.HeaderTool.currentHeader=this.getInitialHeaderImage(),new m.HeaderTool.CurrentView({model:m.HeaderTool.currentHeader,el:"#customize-control-header_image .current .container"}),new m.HeaderTool.ChoiceListView({collection:m.HeaderTool.UploadsList=new m.HeaderTool.ChoiceList,el:"#customize-control-header_image .choices .uploaded .list"}),new m.HeaderTool.ChoiceListView({collection:m.HeaderTool.DefaultsList=new m.HeaderTool.DefaultsList,el:"#customize-control-header_image .choices .default .list"}),m.HeaderTool.combinedList=m.HeaderTool.CombinedList=new m.HeaderTool.CombinedList([m.HeaderTool.UploadsList,m.HeaderTool.DefaultsList]),wp.media.controller.Cropper.prototype.defaults.doCropArgs.wp_customize="on",wp.media.controller.Cropper.prototype.defaults.doCropArgs.theme=m.settings.theme.stylesheet},getInitialHeaderImage:function(){if(!m.get().header_image||!m.get().header_image_data||_.contains(["remove-header","random-default-image","random-uploaded-image"],m.get().header_image))return new m.HeaderTool.ImageModel;var e=(e=_.find(_wpCustomizeHeader.uploads,function(e){return e.attachment_id===m.get().header_image_data.attachment_id}))||{url:m.get().header_image,thumbnail_url:m.get().header_image,attachment_id:m.get().header_image_data.attachment_id};return new m.HeaderTool.ImageModel({header:e,choice:e.url.split("/").pop()})},calculateImageSelectOptions:function(e,t){var n=parseInt(_wpCustomizeHeader.data.width,10),i=parseInt(_wpCustomizeHeader.data.height,10),o=!!parseInt(_wpCustomizeHeader.data["flex-width"],10),a=!!parseInt(_wpCustomizeHeader.data["flex-height"],10),r=e.get("width"),e=e.get("height");return this.headerImage=new m.HeaderTool.ImageModel,this.headerImage.set({themeWidth:n,themeHeight:i,themeFlexWidth:o,themeFlexHeight:a,imageWidth:r,imageHeight:e}),t.set("canSkipCrop",!this.headerImage.shouldBeCropped()),(t=n/i)<r/e?n=(i=e)*t:i=(n=r)/t,!(e={handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:r,imageHeight:e,x1:0,y1:0,x2:n,y2:i})==a&&!1==o&&(e.aspectRatio=n+":"+i),!1==a&&(e.maxHeight=i),!1==o&&(e.maxWidth=n),e},openMedia:function(e){var t=_wpMediaViewsL10n;e.preventDefault(),this.frame=wp.media({button:{text:t.selectAndCrop,close:!1},states:[new wp.media.controller.Library({title:t.chooseImage,library:wp.media.query({type:"image"}),multiple:!1,date:!1,priority:20,suggestedWidth:_wpCustomizeHeader.data.width,suggestedHeight:_wpCustomizeHeader.data.height}),new wp.media.controller.Cropper({imgSelectOptions:this.calculateImageSelectOptions})]}),this.frame.on("select",this.onSelect,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this),this.frame.open()},onSelect:function(){this.frame.setState("cropper")},onCropped:function(e){var t=e.url,n=e.attachment_id,i=e.width,e=e.height;this.setImageFromURL(t,n,i,e)},onSkippedCrop:function(e){var t=e.get("url"),n=e.get("width"),i=e.get("height");this.setImageFromURL(t,e.id,n,i)},setImageFromURL:function(e,t,n,i){var o={};o.url=e,o.thumbnail_url=e,o.timestamp=_.now(),t&&(o.attachment_id=t),n&&(o.width=n),i&&(o.height=i),e=new m.HeaderTool.ImageModel({header:o,choice:e.split("/").pop()}),m.HeaderTool.UploadsList.add(e),m.HeaderTool.currentHeader.set(e.toJSON()),e.save(),e.importImage()},removeImage:function(){m.HeaderTool.currentHeader.trigger("hide"),m.HeaderTool.CombinedList.trigger("control:removeImage")}}),m.ThemeControl=m.Control.extend({touchDrag:!1,isRendered:!1,renderContent:function(){var t=this,n=arguments;m.section(t.section(),function(e){e.expanded()?(m.Control.prototype.renderContent.apply(t,n),t.isRendered=!0):e.expanded.bind(function(e){e&&!t.isRendered&&(m.Control.prototype.renderContent.apply(t,n),t.isRendered=!0)})})},ready:function(){var t=this;t.container.on("touchmove",".theme",function(){t.touchDrag=!0}),t.container.on("click keydown touchend",".theme",function(e){if(!m.utils.isKeydownButNotEnterEvent(e)){if(!0===t.touchDrag)return t.touchDrag=!1;f(e.target).is(".theme-actions .button")||(e=f(this).data("previewUrl"),f(".wp-full-overlay").addClass("customize-loading"),window.parent.location=e)}}),t.container.on("click keydown",".theme-actions .theme-details",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),m.section(t.section()).showDetails(t.params.theme))}),t.container.on("render-screenshot",function(){var e=f(this).find("img"),t=e.data("src");t&&e.attr("src",t)})},filter:function(e){var t=this;-1!==(t.params.theme.name+" "+t.params.theme.description+" "+t.params.theme.tags+" "+t.params.theme.author).toLowerCase().replace("-"," ").search(e)?t.activate():t.deactivate()}}),m.defaultConstructor=m.Setting,m.control=new m.Values({defaultConstructor:m.Control}),m.section=new m.Values({defaultConstructor:m.Section}),m.panel=new m.Values({defaultConstructor:m.Panel}),m.PreviewFrame=m.Messenger.extend({sensitivity:2e3,initialize:function(e,t){var n=f.Deferred();n.promise(this),this.container=e.container,this.signature=e.signature,f.extend(e,{channel:m.PreviewFrame.uuid()}),m.Messenger.prototype.initialize.call(this,e,t),this.add("previewUrl",e.previewUrl),this.query=f.extend(e.query||{},{customize_messenger_channel:this.channel()}),this.run(n)},run:function(i){var o=this,a=!1,r=!1;this._ready&&this.unbind("ready",this._ready),this._ready=function(){r=!0,a&&i.resolveWith(o)},this.bind("ready",this._ready),this.bind("ready",function(e){var t;this.container.addClass("iframe-ready"),e&&(t={panel:e.activePanels,section:e.activeSections,control:e.activeControls},_(t).each(function(n,e){m[e].each(function(e,t){!(!n||!n[t])?e.activate():e.deactivate()})}),e.settingValidities&&m._handleSettingValidities({settingValidities:e.settingValidities,focusInvalidControl:!1}))}),this.request=f.ajax(this.previewUrl(),{type:"POST",data:this.query,xhrFields:{withCredentials:!0}}),this.request.fail(function(){i.rejectWith(o,["request failure"])}),this.request.done(function(e){var t=o.request.getResponseHeader("Location"),n=o.signature;t&&t!==o.previewUrl()?i.rejectWith(o,["redirect",t]):"0"!==e?"-1"!==e?-1===(t=e.lastIndexOf(n))||t<e.lastIndexOf("</html>")?i.rejectWith(o,["unsigned"]):(e=e.slice(0,t)+e.slice(t+n.length),o.iframe=f("<iframe />",{title:m.l10n.previewIframeTitle}).appendTo(o.container),o.iframe.one("load",function(){a=!0,r?i.resolveWith(o):setTimeout(function(){i.rejectWith(o,["ready timeout"])},o.sensitivity)}),o.targetWindow(o.iframe[0].contentWindow),o.targetWindow().document.open(),o.targetWindow().document.write(e),o.targetWindow().document.close()):i.rejectWith(o,["cheatin"]):o.login(i)})},login:function(n){var i=this,o=function(){n.rejectWith(i,["logged out"])};if(this.triedLogin)return o();f.get(m.settings.url.ajax,{action:"logged-in"}).fail(o).done(function(e){var t;"1"!==e&&o(),(t=f("<iframe />",{src:i.previewUrl(),title:m.l10n.previewIframeTitle}).hide()).appendTo(i.container),t.on("load",function(){i.triedLogin=!0,t.remove(),i.run(n)})})},destroy:function(){m.Messenger.prototype.destroy.call(this),this.request.abort(),this.iframe&&this.iframe.remove(),delete this.request,delete this.iframe,delete this.targetWindow}}),t=0,m.PreviewFrame.uuid=function(){return"preview-"+t++},m.setDocumentTitle=function(e){e=m.settings.documentTitleTmpl.replace("%s",e);document.title=e,m.trigger("title",e)},m.Previewer=m.Messenger.extend({refreshBuffer:250,initialize:function(e,t){var n,i,o,a=this,r=/^https?/;function s(){i=null,o.call(n)}f.extend(this,t||{}),this.deferred={active:f.Deferred()},this.refresh=(o=(n=this).refresh,function(){if("number"!=typeof i){if(!n.loading)return s();n.abort()}clearTimeout(i),i=setTimeout(s,n.refreshBuffer)}),this.container=m.ensure(e.container),this.allowedUrls=e.allowedUrls,this.signature=e.signature,e.url=window.location.href,m.Messenger.prototype.initialize.call(this,e),this.add("scheme",this.origin()).link(this.origin).setter(function(e){e=e.match(r);return e?e[0]:""}),this.add("previewUrl",e.previewUrl).setter(function(e){var o;return/\/wp-admin(\/|$)/.test(e.replace(/[#?].*$/,""))?null:(f.each([e.replace(r,a.scheme()),e],function(e,i){if(f.each(a.allowedUrls,function(e,t){var n;if(t=t.replace(/\/+$/,""),n=i.replace(t,""),0===i.indexOf(t)&&/^([/#?]|$)/.test(n))return o=i,!1}),o)return!1}),o||null)}),this.previewUrl.bind(this.refresh),this.scroll=0,this.bind("scroll",function(e){this.scroll=e}),this.bind("url",this.previewUrl),this.bind("documentTitle",function(e){m.setDocumentTitle(e)})},query:function(){},abort:function(){this.loading&&(this.loading.destroy(),delete this.loading)},refresh:function(){var n=this;this.send("loading-initiated"),this.abort(),this.loading=new m.PreviewFrame({url:this.url(),previewUrl:this.previewUrl(),query:this.query()||{},container:this.container,signature:this.signature}),this.loading.done(function(){this.bind("synced",function(){n.preview&&n.preview.destroy(),n.preview=this,delete n.loading,n.targetWindow(this.targetWindow()),n.channel(this.channel()),n.deferred.active.resolve(),n.send("active")}),this.send("sync",{scroll:n.scroll,settings:m.get()})}),this.loading.fail(function(e,t){n.send("loading-failed"),"redirect"===e&&t&&n.previewUrl(t),"logged out"===e&&(n.preview&&(n.preview.destroy(),delete n.preview),n.login().done(n.refresh)),"cheatin"===e&&n.cheatin()})},login:function(){var t,n,i,o=this;return this._login||(t=f.Deferred(),this._login=t.promise(),n=new m.Messenger({channel:"login",url:m.settings.url.login}),i=f("<iframe />",{src:m.settings.url.login,title:m.l10n.loginIframeTitle}).appendTo(this.container),n.targetWindow(i[0].contentWindow),n.bind("login",function(){var e=o.refreshNonces();e.always(function(){i.remove(),n.destroy(),delete o._login}),e.done(function(){t.resolve()}),e.fail(function(){o.cheatin(),t.reject()})}),this._login)},cheatin:function(){f(document.body).empty().addClass("cheatin").append("<h1>"+m.l10n.cheatin+"</h1><p>"+m.l10n.notAllowed+"</p>")},refreshNonces:function(){var e,t=f.Deferred();return t.promise(),(e=wp.ajax.post("customize_refresh_nonces",{wp_customize:"on",theme:m.settings.theme.stylesheet})).done(function(e){m.trigger("nonce-refresh",e),t.resolve()}),e.fail(function(){t.reject()}),t}}),m.settingConstructor={},m.controlConstructor={color:m.ColorControl,media:m.MediaControl,upload:m.UploadControl,image:m.ImageControl,cropped_image:m.CroppedImageControl,site_icon:m.SiteIconControl,header:m.HeaderControl,background:m.BackgroundControl,theme:m.ThemeControl},m.panelConstructor={},m.sectionConstructor={themes:m.ThemesSection},m._handleSettingValidities=function(e){var a=[],n=!1;_.each(e.settingValidities,function(t,e){var o=m(e);o&&(_.isObject(t)&&_.each(t,function(e,t){var n=new m.Notification(t,e),i=!1,e=o.notifications(n.code);(i=e?n.type!==e.type||!_.isEqual(n.data,e.data):i)&&o.notifications.remove(t),o.notifications.has(n.code)||o.notifications.add(t,n),a.push(o.id)}),o.notifications.each(function(e){"error"!==e.type||!0!==t&&t[e.code]||o.notifications.remove(e.code)}))}),e.focusInvalidControl&&(e=m.findControlsForSettings(a),_(_.values(e)).find(function(e){return _(e).find(function(e){var t=e.section()&&m.section.has(e.section())&&m.section(e.section()).expanded();return(t=t&&e.expanded?e.expanded():t)&&(e.focus(),n=!0),n})}),n||_.isEmpty(e)||_.values(e)[0][0].focus())},m.findControlsForSettings=function(e){var n,i={};return _.each(_.unique(e),function(e){var t=m(e);t&&(n=t.findControls())&&0<n.length&&(i[e]=n)}),i},m.reflowPaneContents=_.bind(function(){var i,e,t,o=[],a=!1;document.activeElement&&(e=f(document.activeElement)),m.panel.each(function(e){var t=e.sections(),n=_.pluck(t,"container");o.push(e),i=e.container.find("ul:first"),m.utils.areElementListsEqual(n,i.children("[id]"))||(_(t).each(function(e){i.append(e.container)}),a=!0)}),m.section.each(function(e){var t=e.controls(),n=_.pluck(t,"container");e.panel()||o.push(e),i=e.container.find("ul:first"),m.utils.areElementListsEqual(n,i.children("[id]"))||(_(t).each(function(e){i.append(e.container)}),a=!0)}),o.sort(m.utils.prioritySort),t=_.pluck(o,"container"),i=f("#customize-theme-controls").children("ul"),m.utils.areElementListsEqual(t,i.children())||(_(o).each(function(e){i.append(e.container)}),a=!0),m.panel.each(function(e){var t=e.active();e.active.callbacks.fireWith(e.active,[t,t])}),m.section.each(function(e){var t=e.active();e.active.callbacks.fireWith(e.active,[t,t])}),a&&e&&e.focus(),m.trigger("pane-contents-reflowed")},m),f(function(){var n,e,c,t,i,o,l,a,r,s,d,u;m.settings=window._wpCustomizeSettings,m.l10n=window._wpCustomizeControlsL10n,m.settings&&(!f.support.postMessage||!f.support.cors&&m.settings.isCrossDomain||(c=f(document.body),t=c.children(".wp-full-overlay"),i=f("#customize-info .panel-title.site-title"),o=f(".customize-controls-close"),l=f("#save"),a=f("#customize-footer-actions"),f("#customize-controls").on("keydown",function(e){var t=13===e.which,n=f(e.target);t&&(n.is("input:not([type=button])")||n.is("select"))&&e.preventDefault()}),f(".customize-info").find("> .accordion-section-title .customize-help-toggle").on("click",function(){var e=f(this).closest(".accordion-section"),t=e.find(".customize-panel-description:first");e.hasClass("cannot-expand")||(e.hasClass("open")?(e.toggleClass("open"),t.slideUp(m.Panel.prototype.defaultExpandedArguments.duration),f(this).attr("aria-expanded",!1)):(t.slideDown(m.Panel.prototype.defaultExpandedArguments.duration),e.toggleClass("open"),f(this).attr("aria-expanded",!0)))}),m.previewer=new m.Previewer({container:"#customize-preview",form:"#customize-controls",previewUrl:m.settings.url.preview,allowedUrls:m.settings.url.allowed,signature:"WP_CUSTOMIZER_SIGNATURE"},{nonce:m.settings.nonce,query:function(){var n={};return m.each(function(e,t){e._dirty&&(n[t]=e())}),{wp_customize:"on",theme:m.settings.theme.stylesheet,customized:JSON.stringify(n),nonce:this.nonce.preview}},save:function(){var e,t,n,i=this,o=m.state("processing"),a={},r=[];function s(e){a[e.id]=!0}c.addClass("saving"),m.bind("change",s),t=function(){var e;if(m.each(function(t){t.notifications.each(function(e){"error"!==e.type||e.data&&e.data.from_server||r.push(t.id)})}),n=m.findControlsForSettings(r),!_.isEmpty(n))return _.values(n)[0][0].focus(),c.removeClass("saving"),void m.unbind("change",s);e=f.extend(i.query(),{nonce:i.nonce.save}),e=wp.ajax.post("customize_save",e),l.prop("disabled",!0),m.trigger("save",e),e.always(function(){c.removeClass("saving"),l.prop("disabled",!1),m.unbind("change",s)}),e.fail(function(e){"0"===e?e="not_logged_in":"-1"===e&&(e="invalid_nonce"),"invalid_nonce"===e?i.cheatin():"not_logged_in"===e&&(i.preview.iframe.hide(),i.login().done(function(){i.save(),i.preview.iframe.show()})),e.setting_validities&&m._handleSettingValidities({settingValidities:e.setting_validities,focusInvalidControl:!0}),m.trigger("error",e)}),e.done(function(e){m.each(function(e){a[e.id]||(e._dirty=!1)}),m.previewer.send("saved",e),e.setting_validities&&m._handleSettingValidities({settingValidities:e.setting_validities,focusInvalidControl:!0}),m.trigger("saved",e),_.isEmpty(a)||m.state("saved").set(!1)})},0===o()?t():(e=function(){0===o()&&(m.state.unbind("change",e),t())},m.state.bind("change",e))}}),f.ajaxPrefilter(function(e){/wp_customize=on/.test(e.data)&&(e.data+="&"+f.param({customize_preview_nonce:m.settings.nonce.preview}))}),m.previewer.bind("nonce",function(e){f.extend(this.nonce,e)}),m.bind("nonce-refresh",function(e){f.extend(m.settings.nonce,e),f.extend(m.previewer.nonce,e),m.previewer.send("nonce-refresh",e)}),f.each(m.settings.settings,function(e,t){t=new(m.settingConstructor[t.type]||m.Setting)(e,t.value,{transport:t.transport,previewer:m.previewer,dirty:!!t.dirty});m.add(e,t)}),f.each(m.settings.panels,function(e,t){t=new(m.panelConstructor[t.type]||m.Panel)(e,{params:t});m.panel.add(e,t)}),f.each(m.settings.sections,function(e,t){t=new(m.sectionConstructor[t.type]||m.Section)(e,{params:t});m.section.add(e,t)}),f.each(m.settings.controls,function(e,t){t=new(m.controlConstructor[t.type]||m.Control)(e,{params:t,previewer:m.previewer});m.control.add(e,t)}),_.each(["panel","section","control"],function(e){var t=m.settings.autofocus[e];t&&m[e](t,function(e){e.deferred.embedded.done(function(){m.previewer.deferred.active.done(function(){e.focus()})})})}),m.bind("ready",m.reflowPaneContents),f([m.panel,m.section,m.control]).each(function(e,t){var n=_.debounce(m.reflowPaneContents,100);t.bind("add",n),t.bind("change",n),t.bind("remove",n)}),m.previewer.previewUrl()?m.previewer.refresh():m.previewer.previewUrl(m.settings.url.home),r=new m.Values,s=r.create("saved"),d=r.create("activated"),u=r.create("processing"),r.bind("change",function(){d()?s()?(l.val(m.l10n.saved).prop("disabled",!0),o.find(".screen-reader-text").text(m.l10n.close)):(l.val(m.l10n.save).prop("disabled",!1),o.find(".screen-reader-text").text(m.l10n.cancel)):(l.val(m.l10n.activate).prop("disabled",!1),o.find(".screen-reader-text").text(m.l10n.cancel))}),s(!0),d(m.settings.theme.active),u(0),m.bind("change",function(){r("saved").set(!1)}),m.bind("saved",function(){r("saved").set(!0),r("activated").set(!0)}),d.bind(function(e){e&&m.trigger("activated")}),m.state=r,l.click(function(e){m.previewer.save(),e.preventDefault()}).keydown(function(e){9!==e.which&&(13===e.which&&m.previewer.save(),e.preventDefault())}),o.keydown(function(e){9!==e.which&&(13===e.which&&this.click(),e.preventDefault())}),f(".collapse-sidebar").on("click",function(){"true"===f(this).attr("aria-expanded")?f(this).attr({"aria-expanded":"false","aria-label":m.l10n.expandSidebar}):f(this).attr({"aria-expanded":"true","aria-label":m.l10n.collapseSidebar}),t.toggleClass("collapsed").toggleClass("expanded")}),f("body").on("keydown",function(e){var t,n=[],i=[],o=[];27===e.which&&(m.control.each(function(e){e.expanded&&e.expanded()&&_.isFunction(e.collapse)&&n.push(e)}),m.section.each(function(e){e.expanded()&&i.push(e)}),m.panel.each(function(e){e.expanded()&&o.push(e)}),0<n.length&&0===i.length&&(n.length=0),(t=n[0]||i[0]||o[0])&&(t.collapse(),e.preventDefault()))}),f(".customize-controls-preview-toggle").on("click",function(){t.toggleClass("preview-only")}),m.previewedDevice=new m.Value,m.bind("ready",function(){_.find(m.settings.previewableDevices,function(e,t){if(!0===e["default"])return m.previewedDevice.set(t),!0})}),a.find(".devices button").on("click",function(e){m.previewedDevice.set(f(e.currentTarget).data("device"))}),m.previewedDevice.bind(function(e){var t=f(".wp-full-overlay"),n="";a.find(".devices button").removeClass("active").attr("aria-pressed",!1),a.find(".devices .preview-"+e).addClass("active").attr("aria-pressed",!0),f.each(m.settings.previewableDevices,function(e){n+=" preview-"+e}),t.removeClass(n).addClass("preview-"+e)}),i.length&&m("blogname",function(e){function t(){i.text(f.trim(e())||m.l10n.untitledBlogName)}e.bind(t),t()}),(n=new m.Messenger({url:m.settings.url.parent,channel:"loader"})).bind("back",function(){o.on("click.customize-controls-close",function(e){e.preventDefault(),n.send("close")})}),f(window).on("beforeunload",function(){if(!m.state("saved")())return setTimeout(function(){t.removeClass("customize-loading")},1),m.l10n.saveAlert}),f.each(["saved","change"],function(e,t){m.bind(t,function(){n.send(t)})}),m.bind("title",function(e){n.send("title",e)}),n.send("ready"),f.each({background_image:{controls:["background_repeat","background_position_x","background_attachment"],callback:function(e){return!!e}},show_on_front:{controls:["page_on_front","page_for_posts"],callback:function(e){return"page"===e}},header_textcolor:{controls:["header_textcolor"],callback:function(e){return"blank"!==e}}},function(e,i){m(e,function(n){f.each(i.controls,function(e,t){m.control(t,function(t){function e(e){t.container.toggle(i.callback(e))}e(n.get()),n.bind(e)})})})}),m.control("display_header_text",function(t){var n="";t.elements[0].unsync(m("header_textcolor")),t.element=new m.Element(t.container.find("input")),t.element.set("blank"!==t.setting()),t.element.bind(function(e){e||(n=m("header_textcolor").get()),t.setting.set(e?n:"blank")}),t.setting.bind(function(e){t.element.set("blank"!==e)})}),m("show_on_front","page_on_front",function(e,t){function n(){"page"===e()&&0<parseInt(t(),10)&&m.previewer.previewUrl.set(m.settings.url.home)}e.bind(n),t.bind(n)}),m("page_for_posts",function(e){e.bind(function(e){0<(e=parseInt(e,10))&&m.previewer.previewUrl.set(m.settings.url.home+"?page_id="+e)})}),m.previewer.bind("selective-refresh-setting-validities",function(e){m._handleSettingValidities({settingValidities:e,focusInvalidControl:!1})}),m.previewer.bind("focus-control-for-setting",function(n){var i;m.control.each(function(e){var t=_.pluck(e.settings,"id");-1!==_.indexOf(t,n)&&(i=e)}),i&&i.focus()}),m.previewer.bind("refresh",function(){m.previewer.refresh()}),m.trigger("ready"),(e=o).focus(),setTimeout(function(){e.focus()},200)))})}((wp,jQuery));
Save Changes
Rename File
Rename