Skip to content

Instantly share code, notes, and snippets.

@nylen
Created October 9, 2018 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nylen/9541cece04fef0129d3d66dd7711114b to your computer and use it in GitHub Desktop.
Save nylen/9541cece04fef0129d3d66dd7711114b to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
diff -ur build-unminified/wp-admin/js/accordion.min.js build-branch-unminified/wp-admin/js/accordion.min.js
--- build-unminified/wp-admin/js/accordion.min.js 2018-10-08 22:57:58.537502636 -0500
+++ build-branch-unminified/wp-admin/js/accordion.min.js 2018-10-08 22:55:09.208159868 -0500
@@ -1,18 +1,19 @@
-! function(a) {
- function b(a) {
- var b = a.closest(".accordion-section"),
- c = b.find("[aria-expanded]").first(),
- d = b.closest(".accordion-container"),
- e = d.find(".open"),
- f = e.find("[aria-expanded]").first(),
- g = b.find(".accordion-section-content");
- b.hasClass("cannot-expand") || (d.addClass("opening"), b.hasClass("open") ? (b.toggleClass("open"), g.toggle(!0).slideToggle(150)) : (f.attr("aria-expanded", "false"), e.removeClass("open"), e.find(".accordion-section-content").show().slideUp(150), g.toggle(!1).slideToggle(150), b.toggleClass("open")), setTimeout(function() {
- d.removeClass("opening")
- }, 150), c && c.attr("aria-expanded", String("false" === c.attr("aria-expanded"))))
- }
- a(document).ready(function() {
- a(".accordion-container").on("click keydown", ".accordion-section-title", function(c) {
- "keydown" === c.type && 13 !== c.which || (c.preventDefault(), b(a(this)))
+! function(e) {
+ e(document).ready(function() {
+ e(".accordion-container").on("click keydown", ".accordion-section-title", function(n) {
+ "keydown" === n.type && 13 !== n.which || (n.preventDefault(), function(n) {
+ var e = n.closest(".accordion-section"),
+ o = e.find("[aria-expanded]").first(),
+ a = e.closest(".accordion-container"),
+ i = a.find(".open"),
+ t = i.find("[aria-expanded]").first(),
+ s = e.find(".accordion-section-content");
+ if (e.hasClass("cannot-expand")) return;
+ a.addClass("opening"), e.hasClass("open") ? (e.toggleClass("open"), s.toggle(!0).slideToggle(150)) : (t.attr("aria-expanded", "false"), i.removeClass("open"), i.find(".accordion-section-content").show().slideUp(150), s.toggle(!1).slideToggle(150), e.toggleClass("open"));
+ setTimeout(function() {
+ a.removeClass("opening")
+ }, 150), o && o.attr("aria-expanded", String("false" === o.attr("aria-expanded")))
+ }(e(this)))
})
})
}(jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/code-editor.min.js build-branch-unminified/wp-admin/js/code-editor.min.js
--- build-unminified/wp-admin/js/code-editor.min.js 2018-10-08 22:57:54.653471875 -0500
+++ build-branch-unminified/wp-admin/js/code-editor.min.js 2018-10-08 22:55:06.164135697 -0500
@@ -1,49 +1,7 @@
-"undefined" == typeof window.wp && (window.wp = {}), "undefined" == typeof window.wp.codeEditor && (window.wp.codeEditor = {}),
- function(a, b) {
+void 0 === window.wp && (window.wp = {}), void 0 === window.wp.codeEditor && (window.wp.codeEditor = {}),
+ function(l, c) {
"use strict";
-
- function c(b, c) {
- function d() {
- c.onUpdateErrorNotice && !_.isEqual(f, g) && (c.onUpdateErrorNotice(f, b), g = f)
- }
-
- function e() {
- var e = b.getOption("lint");
- return !!e && (!0 === e ? e = {} : _.isObject(e) && (e = a.extend({}, e)), e.options || (e.options = {}), "javascript" === c.codemirror.mode && c.jshint && a.extend(e.options, c.jshint), "css" === c.codemirror.mode && c.csslint && a.extend(e.options, c.csslint), "htmlmixed" === c.codemirror.mode && c.htmlhint && (e.options.rules = a.extend({}, c.htmlhint), c.jshint && (e.options.rules.jshint = c.jshint), c.csslint && (e.options.rules.csslint = c.csslint)), e.onUpdateLinting = function(a) {
- return function(e, h, i) {
- var j = _.filter(e, function(a) {
- return "error" === a.severity
- });
- a && a.apply(e, h, i), _.isEqual(j, f) || (f = j, c.onChangeLintingErrors && c.onChangeLintingErrors(j, e, h, i), (!b.state.focused || 0 === f.length || g.length > 0) && d())
- }
- }(e.onUpdateLinting), e)
- }
- var f = [],
- g = [];
- b.setOption("lint", e()), b.on("optionChange", function(a, c) {
- var g, h, i = "CodeMirror-lint-markers";
- "lint" === c && (h = b.getOption("gutters") || [], g = b.getOption("lint"), !0 === g ? (_.contains(h, i) || b.setOption("gutters", [i].concat(h)), b.setOption("lint", e())) : g || b.setOption("gutters", _.without(h, i)), b.getOption("lint") ? b.performLint() : (f = [], d()))
- }), b.on("blur", d), b.on("startCompletion", function() {
- b.off("blur", d)
- }), b.on("endCompletion", function() {
- b.on("blur", d), _.delay(function() {
- b.state.focused || d()
- }, 500)
- }), a(document.body).on("mousedown", function(c) {
- !b.state.focused || a.contains(b.display.wrapper, c.target) || a(c.target).hasClass("CodeMirror-hint") || d()
- })
- }
-
- function d(b, c) {
- var d = a(b.getTextArea());
- b.on("blur", function() {
- d.data("next-tab-blurs", !1)
- }), b.on("keydown", function(a, e) {
- if (27 === e.keyCode) return void d.data("next-tab-blurs", !0);
- 9 === e.keyCode && d.data("next-tab-blurs") && (e.shiftKey ? c.onTabPrevious(b, e) : c.onTabNext(b, e), d.data("next-tab-blurs", !1), e.preventDefault())
- })
- }
- b.codeEditor.defaultSettings = {
+ c.codeEditor.defaultSettings = {
codemirror: {},
csslint: {},
htmlhint: {},
@@ -52,16 +10,50 @@
onTabPrevious: function() {},
onChangeLintingErrors: function() {},
onUpdateErrorNotice: function() {}
- }, b.codeEditor.initialize = function(e, f) {
- var g, h, i, j;
- return g = a("string" == typeof e ? "#" + e : e), i = a.extend({}, b.codeEditor.defaultSettings, f), i.codemirror = a.extend({}, i.codemirror), h = b.CodeMirror.fromTextArea(g[0], i.codemirror), c(h, i), j = {
- settings: i,
- codemirror: h
- }, h.showHint && h.on("keyup", function(a, c) {
- var d, e, f, g, i = /^[a-zA-Z]$/.test(c.key);
- h.state.completionActive && i || (g = h.getTokenAt(h.getCursor()), "string" !== g.type && "comment" !== g.type && (f = b.CodeMirror.innerMode(h.getMode(), g.state).mode.name, e = h.doc.getLine(h.doc.getCursor().line).substr(0, h.doc.getCursor().ch), "html" === f || "xml" === f ? d = "<" === c.key || "/" === c.key && "tag" === g.type || i && "tag" === g.type || i && "attribute" === g.type || "=" === g.string && g.state.htmlState && g.state.htmlState.tagName : "css" === f ? d = i || ":" === c.key || " " === c.key && /:\s+$/.test(e) : "javascript" === f ? d = i || "." === c.key : "clike" === f && "application/x-httpd-php" === h.options.mode && (d = "keyword" === g.type || "variable" === g.type), d && h.showHint({
- completeSingle: !1
- })))
- }), d(h, f), j
+ }, c.codeEditor.initialize = function(t, n) {
+ var e, a, o, i, r, s, d;
+ return e = l("string" == typeof t ? "#" + t : t), (o = l.extend({}, c.codeEditor.defaultSettings, n)).codemirror = l.extend({}, o.codemirror),
+ function(r, s) {
+ var a = [],
+ d = [];
+
+ function c() {
+ s.onUpdateErrorNotice && !_.isEqual(a, d) && (s.onUpdateErrorNotice(a, r), d = a)
+ }
+
+ function u() {
+ var i, t = r.getOption("lint");
+ return !!t && (!0 === t ? t = {} : _.isObject(t) && (t = l.extend({}, t)), t.options || (t.options = {}), "javascript" === s.codemirror.mode && s.jshint && l.extend(t.options, s.jshint), "css" === s.codemirror.mode && s.csslint && l.extend(t.options, s.csslint), "htmlmixed" === s.codemirror.mode && s.htmlhint && (t.options.rules = l.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, n, e) {
+ var o = _.filter(t, function(t) {
+ return "error" === t.severity
+ });
+ i && i.apply(t, n, e), _.isEqual(o, a) || (a = o, s.onChangeLintingErrors && s.onChangeLintingErrors(o, t, n, e), (!r.state.focused || 0 === a.length || 0 < d.length) && c())
+ }), t)
+ }
+ r.setOption("lint", u()), r.on("optionChange", function(t, n) {
+ var e, o, i = "CodeMirror-lint-markers";
+ "lint" === n && (o = r.getOption("gutters") || [], !0 === (e = r.getOption("lint")) ? (_.contains(o, i) || r.setOption("gutters", [i].concat(o)), r.setOption("lint", u())) : e || r.setOption("gutters", _.without(o, i)), r.getOption("lint") ? r.performLint() : (a = [], c()))
+ }), r.on("blur", c), r.on("startCompletion", function() {
+ r.off("blur", c)
+ }), r.on("endCompletion", function() {
+ r.on("blur", c), _.delay(function() {
+ r.state.focused || c()
+ }, 500)
+ }), l(document.body).on("mousedown", function(t) {
+ !r.state.focused || l.contains(r.display.wrapper, t.target) || l(t.target).hasClass("CodeMirror-hint") || c()
+ })
+ }(a = c.CodeMirror.fromTextArea(e[0], o.codemirror), o), i = {
+ settings: o,
+ codemirror: a
+ }, a.showHint && a.on("keyup", function(t, n) {
+ var e, o, i, r, s = /^[a-zA-Z]$/.test(n.key);
+ a.state.completionActive && s || "string" !== (r = a.getTokenAt(a.getCursor())).type && "comment" !== r.type && (i = c.CodeMirror.innerMode(a.getMode(), r.state).mode.name, o = a.doc.getLine(a.doc.getCursor().line).substr(0, a.doc.getCursor().ch), "html" === i || "xml" === i ? e = "<" === n.key || "/" === n.key && "tag" === r.type || s && "tag" === r.type || s && "attribute" === r.type || "=" === r.string && r.state.htmlState && r.state.htmlState.tagName : "css" === i ? e = s || ":" === n.key || " " === n.key && /:\s+$/.test(o) : "javascript" === i ? e = s || "." === n.key : "clike" === i && "application/x-httpd-php" === a.options.mode && (e = "keyword" === r.type || "variable" === r.type), e && a.showHint({
+ completeSingle: !1
+ }))
+ }), s = n, d = l((r = a).getTextArea()), r.on("blur", function() {
+ d.data("next-tab-blurs", !1)
+ }), r.on("keydown", function(t, n) {
+ 27 !== n.keyCode ? 9 === n.keyCode && d.data("next-tab-blurs") && (n.shiftKey ? s.onTabPrevious(r, n) : s.onTabNext(r, n), d.data("next-tab-blurs", !1), n.preventDefault()) : d.data("next-tab-blurs", !0)
+ }), i
}
}(window.jQuery, window.wp);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/color-picker.min.js build-branch-unminified/wp-admin/js/color-picker.min.js
--- build-unminified/wp-admin/js/color-picker.min.js 2018-10-08 22:57:56.241484452 -0500
+++ build-branch-unminified/wp-admin/js/color-picker.min.js 2018-10-08 22:55:07.624147290 -0500
@@ -1,6 +1,6 @@
-! function(a, b) {
- var c;
- c = {
+! function(i, t) {
+ var e;
+ e = {
options: {
defaultColor: !1,
change: !1,
@@ -13,69 +13,68 @@
slider: "horizontal"
},
_createHueOnly: function() {
- var b, c = this,
- d = c.element;
- d.hide(), b = "hsl(" + d.val() + ", 100, 50)", d.iris({
+ var e, o = this,
+ t = o.element;
+ t.hide(), e = "hsl(" + t.val() + ", 100, 50)", t.iris({
mode: "hsl",
type: "hue",
hide: !1,
- color: b,
- change: function(b, d) {
- a.isFunction(c.options.change) && c.options.change.call(this, b, d)
+ color: e,
+ change: function(e, t) {
+ i.isFunction(o.options.change) && o.options.change.call(this, e, t)
},
- width: c.options.width,
- slider: c.options.slider
+ width: o.options.width,
+ slider: o.options.slider
})
},
_create: function() {
- if (a.support.iris) {
- var b = this,
- c = b.element;
- if (a.extend(b.options, c.data()), "hue" === b.options.type) return b._createHueOnly();
- b.close = a.proxy(b.close, b), b.initialValue = c.val(), c.addClass("wp-color-picker"), c.parent("label").length || (c.wrap("<label></label>"), b.wrappingLabelText = a('<span class="screen-reader-text"></span>').insertBefore(c).text(wpColorPickerL10n.defaultLabel)), b.wrappingLabel = c.parent(), b.wrappingLabel.wrap('<div class="wp-picker-container" />'), b.wrap = b.wrappingLabel.parent(), b.toggler = a('<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>').insertBefore(b.wrappingLabel).css({
- backgroundColor: b.initialValue
- }), b.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick), b.pickerContainer = a('<div class="wp-picker-holder" />').insertAfter(b.wrappingLabel), b.button = a('<input type="button" class="button button-small" />'), b.options.defaultColor ? b.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString).attr("aria-label", wpColorPickerL10n.defaultAriaLabel) : b.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear).attr("aria-label", wpColorPickerL10n.clearAriaLabel), b.wrappingLabel.wrap('<span class="wp-picker-input-wrap hidden" />').after(b.button), b.inputWrapper = c.closest(".wp-picker-input-wrap"), c.iris({
- target: b.pickerContainer,
- hide: b.options.hide,
- width: b.options.width,
- mode: b.options.mode,
- palettes: b.options.palettes,
- change: function(c, d) {
- b.toggler.css({
- backgroundColor: d.color.toString()
- }), a.isFunction(b.options.change) && b.options.change.call(this, c, d)
+ if (i.support.iris) {
+ var o = this,
+ e = o.element;
+ if (i.extend(o.options, e.data()), "hue" === o.options.type) return o._createHueOnly();
+ o.close = i.proxy(o.close, o), o.initialValue = e.val(), e.addClass("wp-color-picker"), e.parent("label").length || (e.wrap("<label></label>"), o.wrappingLabelText = i('<span class="screen-reader-text"></span>').insertBefore(e).text(wpColorPickerL10n.defaultLabel)), o.wrappingLabel = e.parent(), o.wrappingLabel.wrap('<div class="wp-picker-container" />'), o.wrap = o.wrappingLabel.parent(), o.toggler = i('<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>').insertBefore(o.wrappingLabel).css({
+ backgroundColor: o.initialValue
+ }), o.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick), o.pickerContainer = i('<div class="wp-picker-holder" />').insertAfter(o.wrappingLabel), o.button = i('<input type="button" class="button button-small" />'), o.options.defaultColor ? o.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString).attr("aria-label", wpColorPickerL10n.defaultAriaLabel) : o.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear).attr("aria-label", wpColorPickerL10n.clearAriaLabel), o.wrappingLabel.wrap('<span class="wp-picker-input-wrap hidden" />').after(o.button), o.inputWrapper = e.closest(".wp-picker-input-wrap"), e.iris({
+ target: o.pickerContainer,
+ hide: o.options.hide,
+ width: o.options.width,
+ mode: o.options.mode,
+ palettes: o.options.palettes,
+ change: function(e, t) {
+ o.toggler.css({
+ backgroundColor: t.color.toString()
+ }), i.isFunction(o.options.change) && o.options.change.call(this, e, t)
}
- }), c.val(b.initialValue), b._addListeners(), b.options.hide || b.toggler.click()
+ }), e.val(o.initialValue), o._addListeners(), o.options.hide || o.toggler.click()
}
},
_addListeners: function() {
- var b = this;
- b.wrap.on("click.wpcolorpicker", function(a) {
- a.stopPropagation()
- }), b.toggler.click(function() {
- b.toggler.hasClass("wp-picker-open") ? b.close() : b.open()
- }), b.element.change(function(c) {
- var d = a(this),
- e = d.val();
- "" !== e && "#" !== e || (b.toggler.css("backgroundColor", ""), a.isFunction(b.options.clear) && b.options.clear.call(this, c))
- }), b.button.click(function(c) {
- var d = a(this);
- d.hasClass("wp-picker-clear") ? (b.element.val(""), b.toggler.css("backgroundColor", ""), a.isFunction(b.options.clear) && b.options.clear.call(this, c)) : d.hasClass("wp-picker-default") && b.element.val(b.options.defaultColor).change()
+ var o = this;
+ o.wrap.on("click.wpcolorpicker", function(e) {
+ e.stopPropagation()
+ }), o.toggler.click(function() {
+ o.toggler.hasClass("wp-picker-open") ? o.close() : o.open()
+ }), o.element.change(function(e) {
+ var t = i(this).val();
+ "" !== t && "#" !== t || (o.toggler.css("backgroundColor", ""), i.isFunction(o.options.clear) && o.options.clear.call(this, e))
+ }), o.button.click(function(e) {
+ var t = i(this);
+ t.hasClass("wp-picker-clear") ? (o.element.val(""), o.toggler.css("backgroundColor", ""), i.isFunction(o.options.clear) && o.options.clear.call(this, e)) : t.hasClass("wp-picker-default") && o.element.val(o.options.defaultColor).change()
})
},
open: function() {
- this.element.iris("toggle"), this.inputWrapper.removeClass("hidden"), this.wrap.addClass("wp-picker-active"), this.toggler.addClass("wp-picker-open").attr("aria-expanded", "true"), a("body").trigger("click.wpcolorpicker").on("click.wpcolorpicker", this.close)
+ this.element.iris("toggle"), this.inputWrapper.removeClass("hidden"), this.wrap.addClass("wp-picker-active"), this.toggler.addClass("wp-picker-open").attr("aria-expanded", "true"), i("body").trigger("click.wpcolorpicker").on("click.wpcolorpicker", this.close)
},
close: function() {
- this.element.iris("toggle"), this.inputWrapper.addClass("hidden"), this.wrap.removeClass("wp-picker-active"), this.toggler.removeClass("wp-picker-open").attr("aria-expanded", "false"), a("body").off("click.wpcolorpicker", this.close)
+ this.element.iris("toggle"), this.inputWrapper.addClass("hidden"), this.wrap.removeClass("wp-picker-active"), this.toggler.removeClass("wp-picker-open").attr("aria-expanded", "false"), i("body").off("click.wpcolorpicker", this.close)
},
- color: function(a) {
- if (void 0 === a) return this.element.iris("option", "color");
- this.element.iris("option", "color", a)
- },
- defaultColor: function(a) {
- if (void 0 === a) return this.options.defaultColor;
- this.options.defaultColor = a
+ color: function(e) {
+ if (e === t) return this.element.iris("option", "color");
+ this.element.iris("option", "color", e)
+ },
+ defaultColor: function(e) {
+ if (e === t) return this.options.defaultColor;
+ this.options.defaultColor = e
}
- }, a.widget("wp.wpColorPicker", c)
+ }, i.widget("wp.wpColorPicker", e)
}(jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/comment.min.js build-branch-unminified/wp-admin/js/comment.min.js
--- build-unminified/wp-admin/js/comment.min.js 2018-10-08 22:57:54.153467916 -0500
+++ build-branch-unminified/wp-admin/js/comment.min.js 2018-10-08 22:55:05.820132965 -0500
@@ -1,24 +1,23 @@
-jQuery(document).ready(function(a) {
+jQuery(document).ready(function(m) {
postboxes.add_postbox_toggles("comment");
- var b = a("#timestampdiv"),
- c = a("#timestamp"),
- d = c.html(),
- e = b.find(".timestamp-wrap"),
- f = b.siblings("a.edit-timestamp");
- f.click(function(c) {
- b.is(":hidden") && (b.slideDown("fast", function() {
- a("input, select", e).first().focus()
- }), a(this).hide()), c.preventDefault()
- }), b.find(".cancel-timestamp").click(function(e) {
- f.show().focus(), b.slideUp("fast"), a("#mm").val(a("#hidden_mm").val()), a("#jj").val(a("#hidden_jj").val()), a("#aa").val(a("#hidden_aa").val()), a("#hh").val(a("#hidden_hh").val()), a("#mn").val(a("#hidden_mn").val()), c.html(d), e.preventDefault()
- }), b.find(".save-timestamp").click(function(d) {
- var g = a("#aa").val(),
- h = a("#mm").val(),
- i = a("#jj").val(),
- j = a("#hh").val(),
- k = a("#mn").val(),
- l = new Date(g, h - 1, i, j, k);
- if (d.preventDefault(), l.getFullYear() != g || 1 + l.getMonth() != h || l.getDate() != i || l.getMinutes() != k) return void e.addClass("form-invalid");
- e.removeClass("form-invalid"), c.html(commentL10n.submittedOn + " <b>" + commentL10n.dateFormat.replace("%1$s", a('option[value="' + h + '"]', "#mm").attr("data-text")).replace("%2$s", parseInt(i, 10)).replace("%3$s", g).replace("%4$s", ("00" + j).slice(-2)).replace("%5$s", ("00" + k).slice(-2)) + "</b> "), f.show().focus(), b.slideUp("fast")
+ var d = m("#timestampdiv"),
+ c = m("#timestamp"),
+ a = c.html(),
+ o = d.find(".timestamp-wrap"),
+ v = d.siblings("a.edit-timestamp");
+ v.click(function(e) {
+ d.is(":hidden") && (d.slideDown("fast", function() {
+ m("input, select", o).first().focus()
+ }), m(this).hide()), e.preventDefault()
+ }), d.find(".cancel-timestamp").click(function(e) {
+ v.show().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()), c.html(a), e.preventDefault()
+ }), d.find(".save-timestamp").click(function(e) {
+ var a = m("#aa").val(),
+ t = m("#mm").val(),
+ l = m("#jj").val(),
+ i = m("#hh").val(),
+ n = m("#mn").val(),
+ s = new Date(a, t - 1, l, i, n);
+ e.preventDefault(), s.getFullYear() == a && 1 + s.getMonth() == t && s.getDate() == l && s.getMinutes() == n ? (o.removeClass("form-invalid"), c.html(commentL10n.submittedOn + " <b>" + commentL10n.dateFormat.replace("%1$s", m('option[value="' + t + '"]', "#mm").attr("data-text")).replace("%2$s", parseInt(l, 10)).replace("%3$s", a).replace("%4$s", ("00" + i).slice(-2)).replace("%5$s", ("00" + n).slice(-2)) + "</b> "), v.show().focus(), d.slideUp("fast")) : o.addClass("form-invalid")
})
});
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/common.min.js build-branch-unminified/wp-admin/js/common.min.js
--- build-unminified/wp-admin/js/common.min.js 2018-10-08 22:57:52.185452328 -0500
+++ build-branch-unminified/wp-admin/js/common.min.js 2018-10-08 22:55:03.324113144 -0500
@@ -1,11 +1,8 @@
var showNotice, adminMenu, columns, validateForm, screenMeta;
-! function(a, b, c) {
- function d(a) {
- -1 !== i.val().indexOf(a.text().trim()) ? (a.attr("data-label", a.attr("aria-label")), a.attr("aria-label", a.attr("data-used")), a.attr("aria-pressed", !0), a.addClass("active")) : a.attr("data-label") && (a.attr("aria-label", a.attr("data-label")), a.attr("aria-pressed", !1), a.removeClass("active"))
- }
- var e = a(document),
- f = a(b),
- g = a(document.body);
+! function(W, L, e) {
+ var F = W(document),
+ V = W(L),
+ q = W(document.body);
adminMenu = {
init: function() {},
fold: function() {},
@@ -14,412 +11,414 @@
favorites: function() {}
}, columns = {
init: function() {
- var b = this;
- a(".hide-column-tog", "#adv-settings").click(function() {
- var c = a(this),
- d = c.val();
- c.prop("checked") ? b.checked(d) : b.unchecked(d), columns.saveManageColumnsState()
+ var n = this;
+ W(".hide-column-tog", "#adv-settings").click(function() {
+ var e = W(this),
+ t = e.val();
+ e.prop("checked") ? n.checked(t) : n.unchecked(t), columns.saveManageColumnsState()
})
},
saveManageColumnsState: function() {
- var b = this.hidden();
- a.post(ajaxurl, {
+ var e = this.hidden();
+ W.post(ajaxurl, {
action: "hidden-columns",
- hidden: b,
- screenoptionnonce: a("#screenoptionnonce").val(),
+ hidden: e,
+ screenoptionnonce: W("#screenoptionnonce").val(),
page: pagenow
})
},
- checked: function(b) {
- a(".column-" + b).removeClass("hidden"), this.colSpanChange(1)
+ checked: function(e) {
+ W(".column-" + e).removeClass("hidden"), this.colSpanChange(1)
},
- unchecked: function(b) {
- a(".column-" + b).addClass("hidden"), this.colSpanChange(-1)
+ unchecked: function(e) {
+ W(".column-" + e).addClass("hidden"), this.colSpanChange(-1)
},
hidden: function() {
- return a(".manage-column[id]").filter(":hidden").map(function() {
+ return W(".manage-column[id]").filter(":hidden").map(function() {
return this.id
}).get().join(",")
},
useCheckboxesForHidden: function() {
this.hidden = function() {
- return a(".hide-column-tog").not(":checked").map(function() {
- var a = this.id;
- return a.substring(a, a.length - 5)
+ return W(".hide-column-tog").not(":checked").map(function() {
+ var e = this.id;
+ return e.substring(e, e.length - 5)
}).get().join(",")
}
},
- colSpanChange: function(b) {
- var c, d = a("table").find(".colspanchange");
- d.length && (c = parseInt(d.attr("colspan"), 10) + b, d.attr("colspan", c.toString()))
+ colSpanChange: function(e) {
+ var t, n = W("table").find(".colspanchange");
+ n.length && (t = parseInt(n.attr("colspan"), 10) + e, n.attr("colspan", t.toString()))
}
- }, e.ready(function() {
+ }, F.ready(function() {
columns.init()
- }), validateForm = function(b) {
- return !a(b).find(".form-required").filter(function() {
- return "" === a(":input:visible", this).val()
+ }), validateForm = function(e) {
+ return !W(e).find(".form-required").filter(function() {
+ return "" === W(":input:visible", this).val()
}).addClass("form-invalid").find(":input:visible").change(function() {
- a(this).closest(".form-invalid").removeClass("form-invalid")
+ W(this).closest(".form-invalid").removeClass("form-invalid")
}).length
}, showNotice = {
warn: function() {
- var a = commonL10n.warnDelete || "";
- return !!confirm(a)
+ var e = commonL10n.warnDelete || "";
+ return !!confirm(e)
},
- note: function(a) {
- alert(a)
+ note: function(e) {
+ alert(e)
}
}, screenMeta = {
element: null,
toggles: null,
page: null,
init: function() {
- this.element = a("#screen-meta"), this.toggles = a("#screen-meta-links").find(".show-settings"), this.page = a("#wpcontent"), this.toggles.click(this.toggleEvent)
+ this.element = W("#screen-meta"), this.toggles = W("#screen-meta-links").find(".show-settings"), this.page = W("#wpcontent"), this.toggles.click(this.toggleEvent)
},
toggleEvent: function() {
- var b = a("#" + a(this).attr("aria-controls"));
- b.length && (b.is(":visible") ? screenMeta.close(b, a(this)) : screenMeta.open(b, a(this)))
+ var e = W("#" + W(this).attr("aria-controls"));
+ e.length && (e.is(":visible") ? screenMeta.close(e, W(this)) : screenMeta.open(e, W(this)))
},
- open: function(b, c) {
- a("#screen-meta-links").find(".screen-meta-toggle").not(c.parent()).css("visibility", "hidden"), b.parent().show(), b.slideDown("fast", function() {
- b.focus(), c.addClass("screen-meta-active").attr("aria-expanded", !0)
- }), e.trigger("screen:options:open")
+ open: function(e, t) {
+ W("#screen-meta-links").find(".screen-meta-toggle").not(t.parent()).css("visibility", "hidden"), e.parent().show(), e.slideDown("fast", function() {
+ e.focus(), t.addClass("screen-meta-active").attr("aria-expanded", !0)
+ }), F.trigger("screen:options:open")
},
- close: function(b, c) {
- b.slideUp("fast", function() {
- c.removeClass("screen-meta-active").attr("aria-expanded", !1), a(".screen-meta-toggle").css("visibility", ""), b.parent().hide()
- }), e.trigger("screen:options:close")
+ close: function(e, t) {
+ e.slideUp("fast", function() {
+ t.removeClass("screen-meta-active").attr("aria-expanded", !1), W(".screen-meta-toggle").css("visibility", ""), e.parent().hide()
+ }), F.trigger("screen:options:close")
}
- }, a(".contextual-help-tabs").delegate("a", "click", function(b) {
- var c, d = a(this);
- if (b.preventDefault(), d.is(".active a")) return !1;
- a(".contextual-help-tabs .active").removeClass("active"), d.parent("li").addClass("active"), c = a(d.attr("href")), a(".help-tab-content").not(c).removeClass("active").hide(), c.addClass("active").show()
+ }, W(".contextual-help-tabs").delegate("a", "click", function(e) {
+ var t, n = W(this);
+ if (e.preventDefault(), n.is(".active a")) return !1;
+ W(".contextual-help-tabs .active").removeClass("active"), n.parent("li").addClass("active"), t = W(n.attr("href")), W(".help-tab-content").not(t).removeClass("active").hide(), t.addClass("active").show()
});
- var h = !1,
- i = a("#permalink_structure"),
- j = a(".permalink-structure input:radio"),
- k = a("#custom_selection"),
- l = a(".form-table.permalink-structure .available-structure-tags button");
- j.on("change", function() {
- "custom" !== this.value && (i.val(this.value), l.each(function() {
- d(a(this))
+ var a = !1,
+ r = W("#permalink_structure"),
+ t = W(".permalink-structure input:radio"),
+ c = W("#custom_selection"),
+ n = W(".form-table.permalink-structure .available-structure-tags button");
+
+ function l(e) {
+ -1 !== r.val().indexOf(e.text().trim()) ? (e.attr("data-label", e.attr("aria-label")), e.attr("aria-label", e.attr("data-used")), e.attr("aria-pressed", !0), e.addClass("active")) : e.attr("data-label") && (e.attr("aria-label", e.attr("data-label")), e.attr("aria-pressed", !1), e.removeClass("active"))
+ }
+ t.on("change", function() {
+ "custom" !== this.value && (r.val(this.value), n.each(function() {
+ l(W(this))
}))
- }), i.on("click input", function() {
- k.prop("checked", !0)
- }), i.on("focus", function(b) {
- h = !0, a(this).off(b)
- }), l.each(function() {
- d(a(this))
- }), i.on("change", function() {
- l.each(function() {
- d(a(this))
+ }), r.on("click input", function() {
+ c.prop("checked", !0)
+ }), r.on("focus", function(e) {
+ a = !0, W(this).off(e)
+ }), n.each(function() {
+ l(W(this))
+ }), r.on("change", function() {
+ n.each(function() {
+ l(W(this))
})
- }), l.on("click", function() {
- var b, c = i.val(),
- e = i[0].selectionStart,
- f = i[0].selectionEnd,
- g = a(this).text().trim(),
- j = a(this).attr("data-added");
- if (-1 !== c.indexOf(g)) return c = c.replace(g + "/", ""), i.val("/" === c ? "" : c), a("#custom_selection_updated").text(j), void d(a(this));
- h || 0 !== e || 0 !== f || (e = f = c.length), k.prop("checked", !0), "/" !== c.substr(0, e).substr(-1) && (g = "/" + g), "/" !== c.substr(f, 1) && (g += "/"), i.val(c.substr(0, e) + g + c.substr(f)), a("#custom_selection_updated").text(j), d(a(this)), h && i[0].setSelectionRange && (b = (c.substr(0, e) + g).length, i[0].setSelectionRange(b, b), i.focus())
- }), e.ready(function() {
- function c() {
- var b = a("a.wp-has-current-submenu");
- "folded" === x ? b.attr("aria-haspopup", "true") : b.attr("aria-haspopup", "false")
- }
-
- function d(a) {
- var b, c, d, e, g, h, i, j = a.find(".wp-submenu");
- g = a.offset().top, h = f.scrollTop(), i = g - h - 30, b = g + j.height() + 1, c = F.height(), d = 60 + b - c, e = f.height() + h - 50, e < b - d && (d = b - e), d > i && (d = i), d > 1 ? j.css("margin-top", "-" + d + "px") : j.css("margin-top", "")
- }
-
- function h() {
- a(".notice.is-dismissible").each(function() {
- var b = a(this),
- c = a('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),
- d = commonL10n.dismiss || "";
- c.find(".screen-reader-text").text(d), c.on("click.wp-dismiss-notice", function(a) {
- a.preventDefault(), b.fadeTo(100, 0, function() {
- b.slideUp(100, function() {
- b.remove()
+ }), n.on("click", function() {
+ var e, t = r.val(),
+ n = r[0].selectionStart,
+ i = r[0].selectionEnd,
+ o = W(this).text().trim(),
+ s = W(this).attr("data-added");
+ if (-1 !== t.indexOf(o)) return t = t.replace(o + "/", ""), r.val("/" === t ? "" : t), W("#custom_selection_updated").text(s), void l(W(this));
+ a || 0 !== n || 0 !== i || (n = i = t.length), c.prop("checked", !0), "/" !== t.substr(0, n).substr(-1) && (o = "/" + o), "/" !== t.substr(i, 1) && (o += "/"), r.val(t.substr(0, n) + o + t.substr(i)), W("#custom_selection_updated").text(s), l(W(this)), a && r[0].setSelectionRange && (e = (t.substr(0, n) + o).length, r[0].setSelectionRange(e, e), r.focus())
+ }), F.ready(function() {
+ var n, i, o, s, e, t, a, r, c = !1,
+ l = W("input.current-page"),
+ u = l.val(),
+ d = /iPhone|iPad|iPod/.test(navigator.userAgent),
+ p = -1 !== navigator.userAgent.indexOf("Android"),
+ f = W(document.documentElement).hasClass("ie8"),
+ h = W("#adminmenuwrap"),
+ m = W("#wpwrap"),
+ v = W("#adminmenu"),
+ b = W("#wp-responsive-overlay"),
+ g = W("#wp-toolbar"),
+ w = g.find('a[aria-haspopup="true"]'),
+ k = W(".meta-box-sortables"),
+ C = !1,
+ x = W("#wpadminbar"),
+ y = 0,
+ S = !1,
+ M = !1,
+ E = 0,
+ T = !1,
+ D = {
+ window: V.height(),
+ wpwrap: m.height(),
+ adminbar: x.height(),
+ menu: h.height()
+ },
+ A = W(".wp-header-end");
+
+ function j() {
+ var e = W("a.wp-has-current-submenu");
+ "folded" === r ? e.attr("aria-haspopup", "true") : e.attr("aria-haspopup", "false")
+ }
+
+ function _(e) {
+ var t, n, i, o, s, a, r = e.find(".wp-submenu");
+ a = (o = e.offset().top) - (s = V.scrollTop()) - 30, n = 60 + (t = o + r.height() + 1) - m.height(), (i = V.height() + s - 50) < t - n && (n = t - i), a < n && (n = a), 1 < n ? r.css("margin-top", "-" + n + "px") : r.css("margin-top", "")
+ }
+
+ function I() {
+ W(".notice.is-dismissible").each(function() {
+ var t = W(this),
+ e = W('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),
+ n = commonL10n.dismiss || "";
+ e.find(".screen-reader-text").text(n), e.on("click.wp-dismiss-notice", function(e) {
+ e.preventDefault(), t.fadeTo(100, 0, function() {
+ t.slideUp(100, function() {
+ t.remove()
})
})
- }), b.append(c)
+ }), t.append(e)
})
}
- function i(a) {
- var b = f.scrollTop(),
- c = !a || "scroll" !== a.type;
- if (!(B || D || G.data("wp-responsive"))) {
- if (S.menu + S.adminbar < S.window || S.menu + S.adminbar + 20 > S.wpwrap) return void k();
- if (R = !0, S.menu + S.adminbar > S.window) {
- if (b < 0) return void(O || (O = !0, P = !1, E.css({
- position: "fixed",
- top: "",
- bottom: ""
- })));
- if (b + S.window > e.height() - 1) return void(P || (P = !0, O = !1, E.css({
- position: "fixed",
- top: "",
- bottom: 0
- })));
- b > N ? O ? (O = !1, Q = E.offset().top - S.adminbar - (b - N), Q + S.menu + S.adminbar < b + S.window && (Q = b + S.window - S.menu - S.adminbar), E.css({
- position: "absolute",
- top: Q,
- bottom: ""
- })) : !P && E.offset().top + S.menu < b + S.window && (P = !0, E.css({
- position: "fixed",
- top: "",
- bottom: 0
- })) : b < N ? P ? (P = !1, Q = E.offset().top - S.adminbar + (N - b), Q + S.menu > b + S.window && (Q = b), E.css({
- position: "absolute",
- top: Q,
- bottom: ""
- })) : !O && E.offset().top >= b + S.adminbar && (O = !0, E.css({
- position: "fixed",
- top: "",
- bottom: ""
- })) : c && (O = P = !1, Q = b + S.window - S.menu - S.adminbar - 1, Q > 0 ? E.css({
- position: "absolute",
- top: Q,
- bottom: ""
- }) : k())
+ function O(e) {
+ var t = V.scrollTop(),
+ n = !e || "scroll" !== e.type;
+ if (!(d || f || v.data("wp-responsive")))
+ if (D.menu + D.adminbar < D.window || D.menu + D.adminbar + 20 > D.wpwrap) K();
+ else {
+ if (T = !0, D.menu + D.adminbar > D.window) {
+ if (t < 0) return void(S || (M = !(S = !0), h.css({
+ position: "fixed",
+ top: "",
+ bottom: ""
+ })));
+ if (t + D.window > F.height() - 1) return void(M || (S = !(M = !0), h.css({
+ position: "fixed",
+ top: "",
+ bottom: 0
+ })));
+ y < t ? S ? (S = !1, (E = h.offset().top - D.adminbar - (t - y)) + D.menu + D.adminbar < t + D.window && (E = t + D.window - D.menu - D.adminbar), h.css({
+ position: "absolute",
+ top: E,
+ bottom: ""
+ })) : !M && h.offset().top + D.menu < t + D.window && (M = !0, h.css({
+ position: "fixed",
+ top: "",
+ bottom: 0
+ })) : t < y ? M ? (M = !1, (E = h.offset().top - D.adminbar + (y - t)) + D.menu > t + D.window && (E = t), h.css({
+ position: "absolute",
+ top: E,
+ bottom: ""
+ })) : !S && h.offset().top >= t + D.adminbar && (S = !0, h.css({
+ position: "fixed",
+ top: "",
+ bottom: ""
+ })) : n && (S = M = !1, 0 < (E = t + D.window - D.menu - D.adminbar - 1) ? h.css({
+ position: "absolute",
+ top: E,
+ bottom: ""
+ }) : K())
+ }
+ y = t
}
- N = b
- }
}
- function j() {
- S = {
- window: f.height(),
- wpwrap: F.height(),
- adminbar: M.height(),
- menu: E.height()
+ function U() {
+ D = {
+ window: V.height(),
+ wpwrap: m.height(),
+ adminbar: x.height(),
+ menu: h.height()
}
}
- function k() {
- !B && R && (O = P = R = !1, E.css({
+ function K() {
+ !d && T && (S = M = T = !1, h.css({
position: "",
top: "",
bottom: ""
}))
}
- function l() {
- j(), G.data("wp-responsive") ? (g.removeClass("sticky-menu"), k()) : S.menu + S.adminbar > S.window ? (i(), g.removeClass("sticky-menu")) : (g.addClass("sticky-menu"), k())
+ function z() {
+ U(), v.data("wp-responsive") ? (q.removeClass("sticky-menu"), K()) : D.menu + D.adminbar > D.window ? (O(), q.removeClass("sticky-menu")) : (q.addClass("sticky-menu"), K())
}
- function m() {
- a(".aria-button-if-js").attr("role", "button")
+ function N() {
+ W(".aria-button-if-js").attr("role", "button")
}
- function n() {
- var a = !1;
- return b.innerWidth && (a = Math.max(b.innerWidth, document.documentElement.clientWidth)), a
+ function P() {
+ var e = !1;
+ return L.innerWidth && (e = Math.max(L.innerWidth, document.documentElement.clientWidth)), e
}
- function o() {
- var a = n() || 961;
- x = a <= 782 ? "responsive" : g.hasClass("folded") || g.hasClass("auto-fold") && a <= 960 && a > 782 ? "folded" : "open", e.trigger("wp-menu-state-set", {
- state: x
+ function R() {
+ var e = P() || 961;
+ r = e <= 782 ? "responsive" : q.hasClass("folded") || q.hasClass("auto-fold") && e <= 960 && 782 < e ? "folded" : "open", F.trigger("wp-menu-state-set", {
+ state: r
})
}
- var p, q, r, s, t, u, v, w, x, y = !1,
- z = a("input.current-page"),
- A = z.val(),
- B = /iPhone|iPad|iPod/.test(navigator.userAgent),
- C = -1 !== navigator.userAgent.indexOf("Android"),
- D = a(document.documentElement).hasClass("ie8"),
- E = a("#adminmenuwrap"),
- F = a("#wpwrap"),
- G = a("#adminmenu"),
- H = a("#wp-responsive-overlay"),
- I = a("#wp-toolbar"),
- J = I.find('a[aria-haspopup="true"]'),
- K = a(".meta-box-sortables"),
- L = !1,
- M = a("#wpadminbar"),
- N = 0,
- O = !1,
- P = !1,
- Q = 0,
- R = !1,
- S = {
- window: f.height(),
- wpwrap: F.height(),
- adminbar: M.height(),
- menu: E.height()
- },
- T = a(".wp-header-end");
- G.on("click.wp-submenu-head", ".wp-submenu-head", function(b) {
- a(b.target).parent().siblings("a").get(0).click()
- }), a("#collapse-button").on("click.collapse-menu", function() {
- var b = n() || 961;
- a("#adminmenu div.wp-submenu").css("margin-top", ""), b < 960 ? g.hasClass("auto-fold") ? (g.removeClass("auto-fold").removeClass("folded"), setUserSetting("unfold", 1), setUserSetting("mfold", "o"), x = "open") : (g.addClass("auto-fold"), setUserSetting("unfold", 0), x = "folded") : g.hasClass("folded") ? (g.removeClass("folded"), setUserSetting("mfold", "o"), x = "open") : (g.addClass("folded"), setUserSetting("mfold", "f"), x = "folded"), e.trigger("wp-collapse-menu", {
- state: x
+ v.on("click.wp-submenu-head", ".wp-submenu-head", function(e) {
+ W(e.target).parent().siblings("a").get(0).click()
+ }), W("#collapse-button").on("click.collapse-menu", function() {
+ var e = P() || 961;
+ W("#adminmenu div.wp-submenu").css("margin-top", ""), r = e < 960 ? q.hasClass("auto-fold") ? (q.removeClass("auto-fold").removeClass("folded"), setUserSetting("unfold", 1), setUserSetting("mfold", "o"), "open") : (q.addClass("auto-fold"), setUserSetting("unfold", 0), "folded") : q.hasClass("folded") ? (q.removeClass("folded"), setUserSetting("mfold", "o"), "open") : (q.addClass("folded"), setUserSetting("mfold", "f"), "folded"), F.trigger("wp-collapse-menu", {
+ state: r
})
- }), e.on("wp-menu-state-set wp-collapse-menu wp-responsive-activate wp-responsive-deactivate", c), ("ontouchstart" in b || /IEMobile\/[1-9]/.test(navigator.userAgent)) && (u = B ? "touchstart" : "click", g.on(u + ".wp-mobile-hover", function(b) {
- G.data("wp-responsive") || a(b.target).closest("#adminmenu").length || G.find("li.opensub").removeClass("opensub")
- }), G.find("a.wp-has-submenu").on(u + ".wp-mobile-hover", function(b) {
- var c = a(this).parent();
- G.data("wp-responsive") || c.hasClass("opensub") || c.hasClass("wp-menu-open") && !(c.width() < 40) || (b.preventDefault(), d(c), G.find("li.opensub").removeClass("opensub"), c.addClass("opensub"))
- })), B || C || (G.find("li.wp-has-submenu").hoverIntent({
+ }), F.on("wp-menu-state-set wp-collapse-menu wp-responsive-activate wp-responsive-deactivate", j), ("ontouchstart" in L || /IEMobile\/[1-9]/.test(navigator.userAgent)) && (e = d ? "touchstart" : "click", q.on(e + ".wp-mobile-hover", function(e) {
+ v.data("wp-responsive") || W(e.target).closest("#adminmenu").length || v.find("li.opensub").removeClass("opensub")
+ }), v.find("a.wp-has-submenu").on(e + ".wp-mobile-hover", function(e) {
+ var t = W(this).parent();
+ v.data("wp-responsive") || t.hasClass("opensub") || t.hasClass("wp-menu-open") && !(t.width() < 40) || (e.preventDefault(), _(t), v.find("li.opensub").removeClass("opensub"), t.addClass("opensub"))
+ })), d || p || (v.find("li.wp-has-submenu").hoverIntent({
over: function() {
- var b = a(this),
- c = b.find(".wp-submenu"),
- e = parseInt(c.css("top"), 10);
- isNaN(e) || e > -5 || G.data("wp-responsive") || (d(b), G.find("li.opensub").removeClass("opensub"), b.addClass("opensub"))
+ var e = W(this),
+ t = e.find(".wp-submenu"),
+ n = parseInt(t.css("top"), 10);
+ isNaN(n) || -5 < n || v.data("wp-responsive") || (_(e), v.find("li.opensub").removeClass("opensub"), e.addClass("opensub"))
},
out: function() {
- G.data("wp-responsive") || a(this).removeClass("opensub").find(".wp-submenu").css("margin-top", "")
+ v.data("wp-responsive") || W(this).removeClass("opensub").find(".wp-submenu").css("margin-top", "")
},
timeout: 200,
sensitivity: 7,
interval: 90
- }), G.on("focus.adminmenu", ".wp-submenu a", function(b) {
- G.data("wp-responsive") || a(b.target).closest("li.menu-top").addClass("opensub")
- }).on("blur.adminmenu", ".wp-submenu a", function(b) {
- G.data("wp-responsive") || a(b.target).closest("li.menu-top").removeClass("opensub")
+ }), v.on("focus.adminmenu", ".wp-submenu a", function(e) {
+ v.data("wp-responsive") || W(e.target).closest("li.menu-top").addClass("opensub")
+ }).on("blur.adminmenu", ".wp-submenu a", function(e) {
+ v.data("wp-responsive") || W(e.target).closest("li.menu-top").removeClass("opensub")
}).find("li.wp-has-submenu.wp-not-current-submenu").on("focusin.adminmenu", function() {
- d(a(this))
- })), T.length || (T = a(".wrap h1, .wrap h2").first()), a("div.updated, div.error, div.notice").not(".inline, .below-h2").insertAfter(T), e.on("wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error", h), screenMeta.init(), g.on("click", "tbody > tr > .check-column :checkbox", function(b) {
- if ("undefined" == b.shiftKey) return !0;
- if (b.shiftKey) {
- if (!y) return !0;
- p = a(y).closest("form").find(":checkbox").filter(":visible:enabled"), q = p.index(y), r = p.index(this), s = a(this).prop("checked"), 0 < q && 0 < r && q != r && (t = r > q ? p.slice(q, r) : p.slice(r, q), t.prop("checked", function() {
- return !!a(this).closest("tr").is(":visible") && s
- }))
+ _(W(this))
+ })), A.length || (A = W(".wrap h1, .wrap h2").first()), W("div.updated, div.error, div.notice").not(".inline, .below-h2").insertAfter(A), F.on("wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error", I), screenMeta.init(), q.on("click", "tbody > tr > .check-column :checkbox", function(e) {
+ if ("undefined" == e.shiftKey) return !0;
+ if (e.shiftKey) {
+ if (!c) return !0;
+ n = W(c).closest("form").find(":checkbox").filter(":visible:enabled"), i = n.index(c), o = n.index(this), s = W(this).prop("checked"), 0 < i && 0 < o && i != o && (i < o ? n.slice(i, o) : n.slice(o, i)).prop("checked", function() {
+ return !!W(this).closest("tr").is(":visible") && s
+ })
}
- y = this;
- var c = a(this).closest("tbody").find(":checkbox").filter(":visible:enabled").not(":checked");
- return a(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked", function() {
- return 0 === c.length
+ var t = W(c = this).closest("tbody").find(":checkbox").filter(":visible:enabled").not(":checked");
+ return W(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked", function() {
+ return 0 === t.length
}), !0
- }), g.on("click.wp-toggle-checkboxes", "thead .check-column :checkbox, tfoot .check-column :checkbox", function(b) {
- var c = a(this),
- d = c.closest("table"),
- e = c.prop("checked"),
- f = b.shiftKey || c.data("wp-toggle");
- d.children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked", function() {
- return !a(this).is(":hidden,:disabled") && (f ? !a(this).prop("checked") : !!e)
- }), d.children("thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked", function() {
- return !f && !!e
+ }), q.on("click.wp-toggle-checkboxes", "thead .check-column :checkbox, tfoot .check-column :checkbox", function(e) {
+ var t = W(this),
+ n = t.closest("table"),
+ i = t.prop("checked"),
+ o = e.shiftKey || t.data("wp-toggle");
+ n.children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked", function() {
+ return !W(this).is(":hidden,:disabled") && (o ? !W(this).prop("checked") : !!i)
+ }), n.children("thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked", function() {
+ return !o && !!i
})
- }), a("#wpbody-content").on({
+ }), W("#wpbody-content").on({
focusin: function() {
- clearTimeout(v), w = a(this).find(".row-actions"), a(".row-actions").not(this).removeClass("visible"), w.addClass("visible")
+ clearTimeout(t), a = W(this).find(".row-actions"), W(".row-actions").not(this).removeClass("visible"), a.addClass("visible")
},
focusout: function() {
- v = setTimeout(function() {
- w.removeClass("visible")
+ t = setTimeout(function() {
+ a.removeClass("visible")
}, 30)
}
- }, ".has-row-actions"), a("tbody").on("click", ".toggle-row", function() {
- a(this).closest("tr").toggleClass("is-expanded")
- }), a("#default-password-nag-no").click(function() {
- return setUserSetting("default_password_nag", "hide"), a("div.default-password-nag").hide(), !1
- }), a("#newcontent").bind("keydown.wpevent_InsertTab", function(b) {
- var c, d, e, f, g, h = b.target;
- if (27 == b.keyCode) return b.preventDefault(), void a(h).data("tab-out", !0);
- if (!(9 != b.keyCode || b.ctrlKey || b.altKey || b.shiftKey)) {
- if (a(h).data("tab-out")) return void a(h).data("tab-out", !1);
- c = h.selectionStart, d = h.selectionEnd, e = h.value, document.selection ? (h.focus(), g = document.selection.createRange(), g.text = "\t") : c >= 0 && (f = this.scrollTop, h.value = e.substring(0, c).concat("\t", e.substring(d)), h.selectionStart = h.selectionEnd = c + 1, this.scrollTop = f), b.stopPropagation && b.stopPropagation(), b.preventDefault && b.preventDefault()
- }
- }), z.length && z.closest("form").submit(function() {
- -1 == a('select[name="action"]').val() && -1 == a('select[name="action2"]').val() && z.val() == A && z.val("1")
- }), a('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function() {
- a('select[name^="action"]').val("-1")
- }), a("#contextual-help-link, #show-settings-link").on("focus.scroll-into-view", function(a) {
- a.target.scrollIntoView && a.target.scrollIntoView(!1)
+ }, ".has-row-actions"), W("tbody").on("click", ".toggle-row", function() {
+ W(this).closest("tr").toggleClass("is-expanded")
+ }), W("#default-password-nag-no").click(function() {
+ return setUserSetting("default_password_nag", "hide"), W("div.default-password-nag").hide(), !1
+ }), W("#newcontent").bind("keydown.wpevent_InsertTab", function(e) {
+ var t, n, i, o, s = e.target;
+ if (27 == e.keyCode) return e.preventDefault(), void W(s).data("tab-out", !0);
+ 9 != e.keyCode || e.ctrlKey || e.altKey || e.shiftKey || (W(s).data("tab-out") ? W(s).data("tab-out", !1) : (t = s.selectionStart, n = s.selectionEnd, i = s.value, document.selection ? (s.focus(), document.selection.createRange().text = "\t") : 0 <= t && (o = this.scrollTop, s.value = i.substring(0, t).concat("\t", i.substring(n)), s.selectionStart = s.selectionEnd = t + 1, this.scrollTop = o), e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault()))
+ }), l.length && l.closest("form").submit(function() {
+ -1 == W('select[name="action"]').val() && -1 == W('select[name="action2"]').val() && l.val() == u && l.val("1")
+ }), W('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function() {
+ W('select[name^="action"]').val("-1")
+ }), W("#contextual-help-link, #show-settings-link").on("focus.scroll-into-view", function(e) {
+ e.target.scrollIntoView && e.target.scrollIntoView(!1)
}),
function() {
- function b() {
- c.prop("disabled", "" === d.map(function() {
- return a(this).val()
+ var e, t, n = W("form.wp-upload-form");
+
+ function i() {
+ e.prop("disabled", "" === t.map(function() {
+ return W(this).val()
}).get().join(""))
}
- var c, d, e = a("form.wp-upload-form");
- e.length && (c = e.find('input[type="submit"]'), d = e.find('input[type="file"]'), b(), d.on("change", b))
- }(), B || (f.on("scroll.pin-menu", i), e.on("tinymce-editor-init.pin-menu", function(a, b) {
- b.on("wp-autoresize", j)
- })), b.wpResponsive = {
+ n.length && (e = n.find('input[type="submit"]'), t = n.find('input[type="file"]'), i(), t.on("change", i))
+ }(), d || (V.on("scroll.pin-menu", O), F.on("tinymce-editor-init.pin-menu", function(e, t) {
+ t.on("wp-autoresize", U)
+ })), L.wpResponsive = {
init: function() {
- var c = this;
- e.on("wp-responsive-activate.wp-responsive", function() {
- c.activate()
+ var e = this;
+ F.on("wp-responsive-activate.wp-responsive", function() {
+ e.activate()
}).on("wp-responsive-deactivate.wp-responsive", function() {
- c.deactivate()
- }), a("#wp-admin-bar-menu-toggle a").attr("aria-expanded", "false"), a("#wp-admin-bar-menu-toggle").on("click.wp-responsive", function(b) {
- b.preventDefault(), M.find(".hover").removeClass("hover"), F.toggleClass("wp-responsive-open"), F.hasClass("wp-responsive-open") ? (a(this).find("a").attr("aria-expanded", "true"), a("#adminmenu a:first").focus()) : a(this).find("a").attr("aria-expanded", "false")
- }), G.on("click.wp-responsive", "li.wp-has-submenu > a", function(b) {
- G.data("wp-responsive") && (a(this).parent("li").toggleClass("selected"), b.preventDefault())
- }), c.trigger(), e.on("wp-window-resized.wp-responsive", a.proxy(this.trigger, this)), f.on("load.wp-responsive", function() {
- (navigator.userAgent.indexOf("AppleWebKit/") > -1 ? f.width() : b.innerWidth) <= 782 && c.disableSortables()
+ e.deactivate()
+ }), W("#wp-admin-bar-menu-toggle a").attr("aria-expanded", "false"), W("#wp-admin-bar-menu-toggle").on("click.wp-responsive", function(e) {
+ e.preventDefault(), x.find(".hover").removeClass("hover"), m.toggleClass("wp-responsive-open"), m.hasClass("wp-responsive-open") ? (W(this).find("a").attr("aria-expanded", "true"), W("#adminmenu a:first").focus()) : W(this).find("a").attr("aria-expanded", "false")
+ }), v.on("click.wp-responsive", "li.wp-has-submenu > a", function(e) {
+ v.data("wp-responsive") && (W(this).parent("li").toggleClass("selected"), e.preventDefault())
+ }), e.trigger(), F.on("wp-window-resized.wp-responsive", W.proxy(this.trigger, this)), V.on("load.wp-responsive", function() {
+ (-1 < navigator.userAgent.indexOf("AppleWebKit/") ? V.width() : L.innerWidth) <= 782 && e.disableSortables()
})
},
activate: function() {
- l(), g.hasClass("auto-fold") || g.addClass("auto-fold"), G.data("wp-responsive", 1), this.disableSortables()
+ z(), q.hasClass("auto-fold") || q.addClass("auto-fold"), v.data("wp-responsive", 1), this.disableSortables()
},
deactivate: function() {
- l(), G.removeData("wp-responsive"), this.enableSortables()
+ z(), v.removeData("wp-responsive"), this.enableSortables()
},
trigger: function() {
- var a = n();
- a && (a <= 782 ? L || (e.trigger("wp-responsive-activate"), L = !0) : L && (e.trigger("wp-responsive-deactivate"), L = !1), a <= 480 ? this.enableOverlay() : this.disableOverlay())
+ var e = P();
+ e && (e <= 782 ? C || (F.trigger("wp-responsive-activate"), C = !0) : C && (F.trigger("wp-responsive-deactivate"), C = !1), e <= 480 ? this.enableOverlay() : this.disableOverlay())
},
enableOverlay: function() {
- 0 === H.length && (H = a('<div id="wp-responsive-overlay"></div>').insertAfter("#wpcontent").hide().on("click.wp-responsive", function() {
- I.find(".menupop.hover").removeClass("hover"), a(this).hide()
- })), J.on("click.wp-responsive", function() {
- H.show()
+ 0 === b.length && (b = W('<div id="wp-responsive-overlay"></div>').insertAfter("#wpcontent").hide().on("click.wp-responsive", function() {
+ g.find(".menupop.hover").removeClass("hover"), W(this).hide()
+ })), w.on("click.wp-responsive", function() {
+ b.show()
})
},
disableOverlay: function() {
- J.off("click.wp-responsive"), H.hide()
+ w.off("click.wp-responsive"), b.hide()
},
disableSortables: function() {
- if (K.length) try {
- K.sortable("disable")
- } catch (a) {}
+ if (k.length) try {
+ k.sortable("disable")
+ } catch (e) {}
},
enableSortables: function() {
- if (K.length) try {
- K.sortable("enable")
- } catch (a) {}
+ if (k.length) try {
+ k.sortable("enable")
+ } catch (e) {}
}
- }, a(document).ajaxComplete(function() {
- m()
- }), e.on("wp-window-resized.set-menu-state", o), e.on("wp-menu-state-set wp-collapse-menu", function(b, c) {
- var d = a("#collapse-button"),
- e = "true",
- f = commonL10n.collapseMenu;
- "folded" === c.state && (e = "false", f = commonL10n.expandMenu), d.attr({
- "aria-expanded": e,
- "aria-label": f
+ }, W(document).ajaxComplete(function() {
+ N()
+ }), F.on("wp-window-resized.set-menu-state", R), F.on("wp-menu-state-set wp-collapse-menu", function(e, t) {
+ var n = W("#collapse-button"),
+ i = "true",
+ o = commonL10n.collapseMenu;
+ "folded" === t.state && (i = "false", o = commonL10n.expandMenu), n.attr({
+ "aria-expanded": i,
+ "aria-label": o
})
- }), b.wpResponsive.init(), l(), o(), c(), h(), m(), e.on("wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu", l), a(".wp-initial-focus").focus(), g.on("click", ".js-update-details-toggle", function() {
- var b = a(this).closest(".js-update-details"),
- c = a("#" + b.data("update-details"));
- c.hasClass("update-details-moved") || c.insertAfter(b).addClass("update-details-moved"), c.toggle(), a(this).attr("aria-expanded", c.is(":visible"))
+ }), L.wpResponsive.init(), z(), R(), j(), I(), N(), F.on("wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu", z), W(".wp-initial-focus").focus(), q.on("click", ".js-update-details-toggle", function() {
+ var e = W(this).closest(".js-update-details"),
+ t = W("#" + e.data("update-details"));
+ t.hasClass("update-details-moved") || t.insertAfter(e).addClass("update-details-moved"), t.toggle(), W(this).attr("aria-expanded", t.is(":visible"))
})
}),
function() {
- function a() {
- e.trigger("wp-window-resized")
- }
+ var e;
- function c() {
- b.clearTimeout(d), d = b.setTimeout(a, 200)
+ function t() {
+ F.trigger("wp-window-resized")
}
- var d;
- f.on("resize.wp-fire-once", c)
+ V.on("resize.wp-fire-once", function() {
+ L.clearTimeout(e), e = L.setTimeout(t, 200)
+ })
}(),
function() {
if ("-ms-user-select" in document.documentElement.style && navigator.userAgent.match(/IEMobile\/10\.0/)) {
- var a = document.createElement("style");
- a.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")), document.getElementsByTagName("head")[0].appendChild(a)
+ var e = document.createElement("style");
+ e.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")), document.getElementsByTagName("head")[0].appendChild(e)
}
}()
}(jQuery, window);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/custom-background.min.js build-branch-unminified/wp-admin/js/custom-background.min.js
--- build-unminified/wp-admin/js/custom-background.min.js 2018-10-08 22:57:56.125483534 -0500
+++ build-branch-unminified/wp-admin/js/custom-background.min.js 2018-10-08 22:55:07.504146337 -0500
@@ -1,43 +1,42 @@
-! function(a) {
- a(document).ready(function() {
- var b, c = a("#custom-background-image");
- a("#background-color").wpColorPicker({
- change: function(a, b) {
- c.css("background-color", b.color.toString())
+! function(e) {
+ e(document).ready(function() {
+ var o, t = e("#custom-background-image");
+ e("#background-color").wpColorPicker({
+ change: function(n, c) {
+ t.css("background-color", c.color.toString())
},
clear: function() {
- c.css("background-color", "")
+ t.css("background-color", "")
}
- }), a('select[name="background-size"]').change(function() {
- c.css("background-size", a(this).val())
- }), a('input[name="background-position"]').change(function() {
- c.css("background-position", a(this).val())
- }), a('input[name="background-repeat"]').change(function() {
- c.css("background-repeat", a(this).is(":checked") ? "repeat" : "no-repeat")
- }), a('input[name="background-attachment"]').change(function() {
- c.css("background-attachment", a(this).is(":checked") ? "scroll" : "fixed")
- }), a("#choose-from-library-link").click(function(c) {
- var d = a(this);
- if (c.preventDefault(), b) return void b.open();
- b = wp.media.frames.customBackground = wp.media({
- title: d.data("choose"),
+ }), e('select[name="background-size"]').change(function() {
+ t.css("background-size", e(this).val())
+ }), e('input[name="background-position"]').change(function() {
+ t.css("background-position", e(this).val())
+ }), e('input[name="background-repeat"]').change(function() {
+ t.css("background-repeat", e(this).is(":checked") ? "repeat" : "no-repeat")
+ }), e('input[name="background-attachment"]').change(function() {
+ t.css("background-attachment", e(this).is(":checked") ? "scroll" : "fixed")
+ }), e("#choose-from-library-link").click(function(n) {
+ var c = e(this);
+ n.preventDefault(), o || (o = wp.media.frames.customBackground = wp.media({
+ title: c.data("choose"),
library: {
type: "image"
},
button: {
- text: d.data("update"),
+ text: c.data("update"),
close: !1
}
- }), b.on("select", function() {
- var c = b.state().get("selection").first();
- a.post(ajaxurl, {
+ })).on("select", function() {
+ var n = o.state().get("selection").first();
+ e.post(ajaxurl, {
action: "set-background-image",
- attachment_id: c.id,
+ attachment_id: n.id,
size: "full"
}).done(function() {
window.location.reload()
})
- }), b.open()
+ }), o.open()
})
})
}(jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/customize-controls.min.js build-branch-unminified/wp-admin/js/customize-controls.min.js
--- build-unminified/wp-admin/js/customize-controls.min.js 2018-10-08 22:57:56.625487494 -0500
+++ build-branch-unminified/wp-admin/js/customize-controls.min.js 2018-10-08 22:55:07.864149196 -0500
@@ -1,2658 +1,2599 @@
-! function(a, b) {
- var c, d, e, f = wp.customize;
- f.OverlayNotification = f.Notification.extend({
- loading: !1,
- initialize: function(a, b) {
- var c = this;
- f.Notification.prototype.initialize.call(c, a, b), c.containerClasses += " notification-overlay", c.loading && (c.containerClasses += " notification-loading")
- },
- render: function() {
- var a = f.Notification.prototype.render.call(this);
- return a.on("keydown", _.bind(this.handleEscape, this)), a
- },
- handleEscape: function(a) {
- var b = this;
- 27 === a.which && (a.stopPropagation(), b.dismissible && b.parent && b.parent.remove(b.code))
- }
- }), f.Notifications = f.Values.extend({
- alt: !1,
- defaultConstructor: f.Notification,
- initialize: function(a) {
- var b = this;
- f.Values.prototype.initialize.call(b, a), _.bindAll(b, "constrainFocus"), b._addedIncrement = 0, b._addedOrder = {}, b.bind("add", function(a) {
- b.trigger("change", a)
- }), b.bind("removed", function(a) {
- b.trigger("change", a)
- })
- },
- count: function() {
- return _.size(this._value)
- },
- add: function(a, b) {
- var c, d, e = this;
- return "string" == typeof a ? (c = a, d = b) : (c = a.code, d = a), e.has(c) || (e._addedIncrement += 1, e._addedOrder[c] = e._addedIncrement), f.Values.prototype.add.call(e, c, d)
- },
- remove: function(a) {
- return delete this._addedOrder[a], f.Values.prototype.remove.call(this, a)
- },
- get: function(a) {
- var b, c, d, e = this;
- return b = _.values(e._value), d = _.extend({
- sort: !1
- }, a), d.sort && (c = {
- error: 4,
- warning: 3,
- success: 2,
- info: 1
- }, b.sort(function(a, b) {
- var d = 0,
- f = 0;
- return _.isUndefined(c[a.type]) || (d = c[a.type]), _.isUndefined(c[b.type]) || (f = c[b.type]), d !== f ? f - d : e._addedOrder[b.code] - e._addedOrder[a.code]
- })), b
- },
- render: function() {
- var a, c, d, e, g = this,
- h = !1,
- i = [],
- j = {};
- g.container && g.container.length && (a = g.get({
- sort: !0
- }), g.container.toggle(0 !== a.length), g.container.is(g.previousContainer) && _.isEqual(a, g.previousNotifications) || (d = g.container.children("ul").first(), d.length || (d = b("<ul></ul>"), g.container.append(d)), d.find("> [data-code]").remove(), _.each(g.previousNotifications, function(a) {
- j[a.code] = a
- }), _.each(a, function(a) {
- var c;
- !wp.a11y || j[a.code] && _.isEqual(a.message, j[a.code].message) || wp.a11y.speak(a.message, "assertive"), c = b(a.render()), a.container = c, d.append(c), a.extended(f.OverlayNotification) && i.push(a)
- }), c = Boolean(i.length), g.previousNotifications && (h = Boolean(_.find(g.previousNotifications, function(a) {
- return a.extended(f.OverlayNotification)
- }))), c !== h && (b(document.body).toggleClass("customize-loading", c), g.container.toggleClass("has-overlay-notifications", c), c ? (g.previousActiveElement = document.activeElement, b(document).on("keydown", g.constrainFocus)) : b(document).off("keydown", g.constrainFocus)), c ? (g.focusContainer = i[i.length - 1].container, g.focusContainer.prop("tabIndex", -1), e = g.focusContainer.find(":focusable"), e.length ? e.first().focus() : g.focusContainer.focus()) : g.previousActiveElement && (b(g.previousActiveElement).focus(), g.previousActiveElement = null), g.previousNotifications = a, g.previousContainer = g.container, g.trigger("rendered")))
- },
- constrainFocus: function(a) {
- var c, d = this;
- a.stopPropagation(), 9 === a.which && (c = d.focusContainer.find(":focusable"), 0 === c.length && (c = d.focusContainer), b.contains(d.focusContainer[0], a.target) && b.contains(d.focusContainer[0], document.activeElement) ? c.last().is(a.target) && !a.shiftKey ? (a.preventDefault(), c.first().focus()) : c.first().is(a.target) && a.shiftKey && (a.preventDefault(), c.last().focus()) : (a.preventDefault(), c.first().focus()))
- }
- }), f.Setting = f.Value.extend({
- defaults: {
- transport: "refresh",
- dirty: !1
- },
- initialize: function(a, b, c) {
- var d, e = this;
- d = _.extend({
- previewer: f.previewer
- }, e.defaults, c || {}), f.Value.prototype.initialize.call(e, b, d), e.id = a, e._dirty = d.dirty, e.notifications = new f.Notifications, e.bind(e.preview)
- },
- preview: function() {
- var a, b = this;
- a = b.transport, "postMessage" !== a || f.state("previewerAlive").get() || (a = "refresh"), "postMessage" === a ? b.previewer.send("setting", [b.id, b()]) : "refresh" === a && b.previewer.refresh()
- },
- findControls: function() {
- var a = this,
- b = [];
- return f.control.each(function(c) {
- _.each(c.settings, function(d) {
- d.id === a.id && b.push(c)
+! function(e, H) {
+ var a, t, s, n, i, o, r, L = wp.customize;
+ L.OverlayNotification = L.Notification.extend({
+ loading: !1,
+ initialize: function(e, t) {
+ var n = this;
+ L.Notification.prototype.initialize.call(n, e, t), n.containerClasses += " notification-overlay", n.loading && (n.containerClasses += " notification-loading")
+ },
+ render: function() {
+ var e = L.Notification.prototype.render.call(this);
+ return e.on("keydown", _.bind(this.handleEscape, this)), e
+ },
+ handleEscape: function(e) {
+ var t = this;
+ 27 === e.which && (e.stopPropagation(), t.dismissible && t.parent && t.parent.remove(t.code))
+ }
+ }), L.Notifications = L.Values.extend({
+ alt: !1,
+ defaultConstructor: L.Notification,
+ initialize: function(e) {
+ var t = this;
+ L.Values.prototype.initialize.call(t, e), _.bindAll(t, "constrainFocus"), t._addedIncrement = 0, t._addedOrder = {}, t.bind("add", function(e) {
+ t.trigger("change", e)
+ }), t.bind("removed", function(e) {
+ t.trigger("change", e)
+ })
+ },
+ count: function() {
+ return _.size(this._value)
+ },
+ add: function(e, t) {
+ var n, i, a = this;
+ return i = "string" == typeof e ? (n = e, t) : (n = e.code, e), a.has(n) || (a._addedIncrement += 1, a._addedOrder[n] = a._addedIncrement), L.Values.prototype.add.call(a, n, i)
+ },
+ remove: function(e) {
+ return delete this._addedOrder[e], L.Values.prototype.remove.call(this, e)
+ },
+ get: function(e) {
+ var t, a, o = this;
+ return t = _.values(o._value), _.extend({
+ sort: !1
+ }, e).sort && (a = {
+ error: 4,
+ warning: 3,
+ success: 2,
+ info: 1
+ }, t.sort(function(e, t) {
+ var n = 0,
+ i = 0;
+ return _.isUndefined(a[e.type]) || (n = a[e.type]), _.isUndefined(a[t.type]) || (i = a[t.type]), n !== i ? i - n : o._addedOrder[t.code] - o._addedOrder[e.code]
+ })), t
+ },
+ render: function() {
+ var e, t, n, i, a = this,
+ o = !1,
+ s = [],
+ r = {};
+ a.container && a.container.length && (e = a.get({
+ sort: !0
+ }), a.container.toggle(0 !== e.length), a.container.is(a.previousContainer) && _.isEqual(e, a.previousNotifications) || ((n = a.container.children("ul").first()).length || (n = H("<ul></ul>"), a.container.append(n)), n.find("> [data-code]").remove(), _.each(a.previousNotifications, function(e) {
+ r[e.code] = e
+ }), _.each(e, function(e) {
+ var t;
+ !wp.a11y || r[e.code] && _.isEqual(e.message, r[e.code].message) || wp.a11y.speak(e.message, "assertive"), t = H(e.render()), e.container = t, n.append(t), e.extended(L.OverlayNotification) && s.push(e)
+ }), t = Boolean(s.length), a.previousNotifications && (o = Boolean(_.find(a.previousNotifications, function(e) {
+ return e.extended(L.OverlayNotification)
+ }))), t !== o && (H(document.body).toggleClass("customize-loading", t), a.container.toggleClass("has-overlay-notifications", t), t ? (a.previousActiveElement = document.activeElement, H(document).on("keydown", a.constrainFocus)) : H(document).off("keydown", a.constrainFocus)), t ? (a.focusContainer = s[s.length - 1].container, a.focusContainer.prop("tabIndex", -1), (i = a.focusContainer.find(":focusable")).length ? i.first().focus() : a.focusContainer.focus()) : a.previousActiveElement && (H(a.previousActiveElement).focus(), a.previousActiveElement = null), a.previousNotifications = e, a.previousContainer = a.container, a.trigger("rendered")))
+ },
+ constrainFocus: function(e) {
+ var t, n = this;
+ e.stopPropagation(), 9 === e.which && (0 === (t = n.focusContainer.find(":focusable")).length && (t = n.focusContainer), H.contains(n.focusContainer[0], e.target) && H.contains(n.focusContainer[0], document.activeElement) ? t.last().is(e.target) && !e.shiftKey ? (e.preventDefault(), t.first().focus()) : t.first().is(e.target) && e.shiftKey && (e.preventDefault(), t.last().focus()) : (e.preventDefault(), t.first().focus()))
+ }
+ }), L.Setting = L.Value.extend({
+ defaults: {
+ transport: "refresh",
+ dirty: !1
+ },
+ initialize: function(e, t, n) {
+ var i, a = this;
+ i = _.extend({
+ previewer: L.previewer
+ }, a.defaults, n || {}), L.Value.prototype.initialize.call(a, t, i), a.id = e, a._dirty = i.dirty, a.notifications = new L.Notifications, a.bind(a.preview)
+ },
+ preview: function() {
+ var e, t = this;
+ "postMessage" !== (e = t.transport) || L.state("previewerAlive").get() || (e = "refresh"), "postMessage" === e ? t.previewer.send("setting", [t.id, t()]) : "refresh" === e && t.previewer.refresh()
+ },
+ findControls: function() {
+ var n = this,
+ i = [];
+ return L.control.each(function(t) {
+ _.each(t.settings, function(e) {
+ e.id === n.id && i.push(t)
+ })
+ }), i
+ }
+ }), L._latestRevision = 0, L._lastSavedRevision = 0, L._latestSettingRevisions = {}, L.bind("change", function(e) {
+ L._latestRevision += 1, L._latestSettingRevisions[e.id] = L._latestRevision
+ }), L.bind("ready", function() {
+ L.bind("add", function(e) {
+ e._dirty && (L._latestRevision += 1, L._latestSettingRevisions[e.id] = L._latestRevision)
+ })
+ }), L.dirtyValues = function(n) {
+ var i = {};
+ return L.each(function(e) {
+ var t;
+ e._dirty && (t = L._latestSettingRevisions[e.id], L.state("changesetStatus").get() && n && n.unsaved && (_.isUndefined(t) || t <= L._lastSavedRevision) || (i[e.id] = e.get()))
+ }), i
+ }, L.requestChangesetUpdate = function(n, e) {
+ var t, i, a, o, s = {};
+ return t = new H.Deferred, 0 !== L.state("processing").get() ? (t.reject("already_processing"), t.promise()) : (o = _.extend({
+ title: null,
+ date: null,
+ autosave: !1,
+ force: !1
+ }, e), n && _.extend(s, n), _.each(L.dirtyValues({
+ unsaved: !0
+ }), function(e, t) {
+ n && null === n[t] || (s[t] = _.extend({}, s[t] || {}, {
+ value: e
+ }))
+ }), L.trigger("changeset-save", s, o), !o.force && _.isEmpty(s) && null === o.title && null === o.date ? (t.resolve({}), t.promise()) : o.status ? t.reject({
+ code: "illegal_status_in_changeset_update"
+ }).promise() : o.date && o.autosave ? t.reject({
+ code: "illegal_autosave_with_date_gmt"
+ }).promise() : (L.state("processing").set(L.state("processing").get() + 1), t.always(function() {
+ L.state("processing").set(L.state("processing").get() - 1)
+ }), delete(a = L.previewer.query({
+ excludeCustomizedSaved: !0
+ })).customized, _.extend(a, {
+ nonce: L.settings.nonce.save,
+ customize_theme: L.settings.theme.stylesheet,
+ customize_changeset_data: JSON.stringify(s)
+ }), null !== o.title && (a.customize_changeset_title = o.title), null !== o.date && (a.customize_changeset_date = o.date), !1 !== o.autosave && (a.customize_changeset_autosave = "true"), L.trigger("save-request-params", a), (i = wp.ajax.post("customize_save", a)).done(function(e) {
+ var n = {};
+ L._lastSavedRevision = Math.max(L._latestRevision, L._lastSavedRevision), L.state("changesetStatus").set(e.changeset_status), e.changeset_date && L.state("changesetDate").set(e.changeset_date), t.resolve(e), L.trigger("changeset-saved", e), e.setting_validities && _.each(e.setting_validities, function(e, t) {
+ !0 === e && _.isObject(s[t]) && !_.isUndefined(s[t].value) && (n[t] = s[t].value)
+ }), L.previewer.send("changeset-saved", _.extend({}, e, {
+ saved_changeset_values: n
+ }))
+ }), i.fail(function(e) {
+ t.reject(e), L.trigger("changeset-error", e)
+ }), i.always(function(e) {
+ e.setting_validities && L._handleSettingValidities({
+ settingValidities: e.setting_validities
+ })
+ }), t.promise()))
+ }, L.utils.bubbleChildValueChanges = function(n, e) {
+ H.each(e, function(e, t) {
+ n[t].bind(function(e, t) {
+ n.parent && e !== t && n.parent.trigger("change", n)
+ })
+ })
+ }, t = function(e) {
+ var t, n, i, a;
+ t = this, i = function() {
+ var e;
+ e = (t.extended(L.Panel) || t.extended(L.Section)) && t.expanded && t.expanded() ? t.contentContainer : t.container, 0 === (a = e.find(".control-focus:first")).length && (a = e.find("input, select, textarea, button, object, a[href], [tabindex]").filter(":visible").first()), a.focus()
+ }, (e = e || {}).completeCallback ? (n = e.completeCallback, e.completeCallback = function() {
+ i(), n()
+ }) : e.completeCallback = i, L.state("paneVisible").set(!0), t.expand ? t.expand(e) : e.completeCallback()
+ }, L.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()
+ }, L.utils.isKeydownButNotEnterEvent = function(e) {
+ return "keydown" === e.type && 13 !== e.which
+ }, L.utils.areElementListsEqual = function(e, t) {
+ return e.length === t.length && -1 === _.indexOf(_.map(_.zip(e, t), function(e) {
+ return H(e[0]).is(e[1])
+ }), !1)
+ }, L.utils.highlightButton = function(e, t) {
+ var n, i = "button-see-me",
+ a = !1;
+
+ function o() {
+ a = !0
+ }
+ return (n = _.extend({
+ delay: 0,
+ focusTarget: e
+ }, t)).focusTarget.on("focusin", o), setTimeout(function() {
+ n.focusTarget.off("focusin", o), a || (e.addClass(i), e.one("animationend", function() {
+ e.removeClass(i)
+ }))
+ }, n.delay), o
+ }, L.utils.getCurrentTimestamp = function() {
+ var e, t, n;
+ return t = _.now(), e = new Date(L.settings.initialServerDate.replace(/-/g, "/")), n = t - L.settings.initialClientTimestamp, n += L.settings.initialClientTimestamp - L.settings.initialServerTimestamp, e.setTime(e.getTime() + n), e.getTime()
+ }, L.utils.getRemainingTime = function(e) {
+ var t;
+ return t = (e instanceof Date ? e.getTime() : "string" == typeof e ? new Date(e.replace(/-/g, "/")).getTime() : e) - L.utils.getCurrentTimestamp(), t = Math.ceil(t / 1e3)
+ }, n = document.createElement("div"), i = {
+ transition: "transitionend",
+ OTransition: "oTransitionEnd",
+ MozTransition: "transitionend",
+ WebkitTransition: "webkitTransitionEnd"
+ }, s = (o = _.find(_.keys(i), function(e) {
+ return !_.isUndefined(n.style[e])
+ })) ? i[o] : null, a = L.Class.extend({
+ defaultActiveArguments: {
+ duration: "fast",
+ completeCallback: H.noop
+ },
+ defaultExpandedArguments: {
+ duration: "fast",
+ completeCallback: H.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, a.instanceCounter || (a.instanceCounter = 0), a.instanceCounter++, H.extend(n, {
+ params: _.defaults(t.params || t, n.defaults)
+ }), n.params.instanceNumber || (n.params.instanceNumber = a.instanceCounter), n.notifications = new L.Notifications, n.templateSelector = n.params.templateId || "customize-" + n.containerType + "-" + n.params.type, n.container = H(n.params.content), 0 === n.container.length && (n.container = H(n.getContainer())), n.headContainer = n.container, n.contentContainer = n.getContent(), n.container = n.container.add(n.contentContainer), n.deferred = {
+ embedded: new H.Deferred
+ }, n.priority = new L.Value, n.active = new L.Value, n.activeArgumentsQueue = [], n.expanded = new L.Value, n.expandedArgumentsQueue = [], n.active.bind(function(e) {
+ var t = n.activeArgumentsQueue.shift();
+ t = H.extend({}, n.defaultActiveArguments, t), e = e && n.isContextuallyActive(), n.onChangeActive(e, t)
+ }), n.expanded.bind(function(e) {
+ var t = n.expandedArgumentsQueue.shift();
+ t = H.extend({}, n.defaultExpandedArguments, t), n.onChangeExpanded(e, t)
+ }), n.deferred.embedded.done(function() {
+ n.setupNotifications(), n.attachEvents()
+ }), L.utils.bubbleChildValueChanges(n, ["priority", "active"]), n.priority.set(n.params.priority), n.active.set(n.params.active), n.expanded.set(!1)
+ },
+ getNotificationsContainerElement: function() {
+ return this.contentContainer.find(".customize-control-notifications-container:first")
+ },
+ setupNotifications: function() {
+ var e, t = this;
+ t.notifications.container = t.getNotificationsContainerElement(), e = function() {
+ t.expanded.get() && t.notifications.render()
+ }, t.expanded.bind(e), e(), t.notifications.bind("change", _.debounce(e))
+ },
+ ready: function() {},
+ _children: function(t, e) {
+ var n = this,
+ i = [];
+ return L[e].each(function(e) {
+ e[t].get() === n.id && i.push(e)
+ }), i.sort(L.utils.prioritySort), i
+ },
+ isContextuallyActive: function() {
+ throw new Error("Container.isContextuallyActive() must be overridden in a subclass.")
+ },
+ onChangeActive: function(e, t) {
+ var n, i = this,
+ a = i.headContainer;
+ t.unchanged ? t.completeCallback && t.completeCallback() : (n = "resolved" === L.previewer.deferred.active.state() ? t.duration : 0, i.extended(L.Panel) && (L.panel.each(function(e) {
+ e !== i && e.expanded() && (e, n = 0)
+ }), e || _.each(i.sections(), function(e) {
+ e.collapse({
+ duration: 0
+ })
+ })), H.contains(document, a.get(0)) ? e ? a.slideDown(n, t.completeCallback) : i.expanded() ? i.collapse({
+ duration: n,
+ completeCallback: function() {
+ a.slideUp(n, t.completeCallback)
+ }
+ }) : a.slideUp(n, t.completeCallback) : (a.toggle(e), t.completeCallback && t.completeCallback()))
+ },
+ _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()) && (L.state("paneVisible").set(!0), 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)
+ },
+ _animateChangeExpanded: function(t) {
+ if (s) {
+ var n, i, a = this,
+ o = a.contentContainer,
+ e = o.closest(".wp-full-overlay");
+ n = e.add(o), (!a.panel || "" === a.panel() || !!L.panel(a.panel()).contentContainer.hasClass("skip-transition")) && (n = n.add("#customize-info, .customize-pane-parent")), i = function(e) {
+ 2 === e.eventPhase && H(e.target).is(o) && (o.off(s, i), n.removeClass("busy"), t && t())
+ }, o.on(s, i), n.addClass("busy"), _.defer(function() {
+ var e = o.closest(".wp-full-overlay-sidebar-content"),
+ t = e.scrollTop(),
+ n = o.data("previous-scrollTop") || 0,
+ i = a.expanded();
+ i && 0 < t ? (o.css("top", t + "px"), o.data("previous-scrollTop", t)) : !i && 0 < t + n && (o.css("top", n - t + "px"), e.scrollTop(n))
+ })
+ } else t && t()
+ },
+ focus: t,
+ getContainer: function() {
+ var e, t = this;
+ return (e = 0 !== H("#tmpl-" + t.templateSelector).length ? wp.template(t.templateSelector) : wp.template("customize-" + t.containerType + "-default")) && t.container ? H.trim(e(_.extend({
+ id: t.id
+ }, t.params))) : "<li></li>"
+ },
+ getContent: function() {
+ var e = this.container,
+ t = e.find(".accordion-section-content, .control-panel-content").first(),
+ n = "sub-" + e.attr("id"),
+ i = n,
+ a = e.attr("aria-owns");
+ return a && (i = i + " " + a), e.attr("aria-owns", i), t.detach().attr({
+ id: n,
+ class: "customize-pane-child " + t.attr("class") + " " + e.attr("class")
+ })
+ }
+ }), L.Section = a.extend({
+ containerType: "section",
+ containerParent: "#customize-theme-controls",
+ containerPaneParent: ".customize-pane-parent",
+ defaults: {
+ title: "",
+ description: "",
+ priority: 100,
+ type: "default",
+ content: null,
+ active: !0,
+ instanceNumber: null,
+ panel: null,
+ customizeAction: ""
+ },
+ initialize: function(e, t) {
+ var n, i = this;
+ (n = t.params || t).type || _.find(L.sectionConstructor, function(e, t) {
+ return e === i.constructor && (n.type = t, !0)
+ }), a.prototype.initialize.call(i, e, n), i.id = e, i.panel = new L.Value, i.panel.bind(function(e) {
+ H(i.headContainer).toggleClass("control-subsection", !!e)
+ }), i.panel.set(i.params.panel || ""), L.utils.bubbleChildValueChanges(i, ["panel"]), i.embed(), i.deferred.embedded.done(function() {
+ i.ready()
+ })
+ },
+ embed: function() {
+ var e, n = this;
+ n.containerParent = L.ensure(n.containerParent), e = function(e) {
+ var t;
+ e ? L.panel(e, function(e) {
+ e.deferred.embedded.done(function() {
+ t = e.contentContainer, n.headContainer.parent().is(t) || t.append(n.headContainer), n.contentContainer.parent().is(n.headContainer) || n.containerParent.append(n.contentContainer), n.deferred.embedded.resolve()
})
- }), b
- }
- }), f._latestRevision = 0, f._lastSavedRevision = 0, f._latestSettingRevisions = {}, f.bind("change", function(a) {
- f._latestRevision += 1, f._latestSettingRevisions[a.id] = f._latestRevision
- }), f.bind("ready", function() {
- f.bind("add", function(a) {
- a._dirty && (f._latestRevision += 1, f._latestSettingRevisions[a.id] = f._latestRevision)
- })
- }), f.dirtyValues = function(a) {
- var b = {};
- return f.each(function(c) {
- var d;
- c._dirty && (d = f._latestSettingRevisions[c.id], f.state("changesetStatus").get() && a && a.unsaved && (_.isUndefined(d) || d <= f._lastSavedRevision) || (b[c.id] = c.get()))
- }), b
- }, f.requestChangesetUpdate = function(a, c) {
- var d, e, g, h, i = {};
- return d = new b.Deferred, 0 !== f.state("processing").get() ? (d.reject("already_processing"), d.promise()) : (h = _.extend({
- title: null,
- date: null,
- autosave: !1,
- force: !1
- }, c), a && _.extend(i, a), _.each(f.dirtyValues({
- unsaved: !0
- }), function(b, c) {
- a && null === a[c] || (i[c] = _.extend({}, i[c] || {}, {
- value: b
- }))
- }), f.trigger("changeset-save", i, h), !h.force && _.isEmpty(i) && null === h.title && null === h.date ? (d.resolve({}), d.promise()) : h.status ? d.reject({
- code: "illegal_status_in_changeset_update"
- }).promise() : h.date && h.autosave ? d.reject({
- code: "illegal_autosave_with_date_gmt"
- }).promise() : (f.state("processing").set(f.state("processing").get() + 1), d.always(function() {
- f.state("processing").set(f.state("processing").get() - 1)
- }), g = f.previewer.query({
- excludeCustomizedSaved: !0
- }), delete g.customized, _.extend(g, {
- nonce: f.settings.nonce.save,
- customize_theme: f.settings.theme.stylesheet,
- customize_changeset_data: JSON.stringify(i)
- }), null !== h.title && (g.customize_changeset_title = h.title), null !== h.date && (g.customize_changeset_date = h.date), !1 !== h.autosave && (g.customize_changeset_autosave = "true"), f.trigger("save-request-params", g), e = wp.ajax.post("customize_save", g), e.done(function(a) {
- var b = {};
- f._lastSavedRevision = Math.max(f._latestRevision, f._lastSavedRevision), f.state("changesetStatus").set(a.changeset_status), a.changeset_date && f.state("changesetDate").set(a.changeset_date), d.resolve(a), f.trigger("changeset-saved", a), a.setting_validities && _.each(a.setting_validities, function(a, c) {
- !0 === a && _.isObject(i[c]) && !_.isUndefined(i[c].value) && (b[c] = i[c].value)
- }), f.previewer.send("changeset-saved", _.extend({}, a, {
- saved_changeset_values: b
+ }) : (t = L.ensure(n.containerPaneParent), n.headContainer.parent().is(t) || t.append(n.headContainer), n.contentContainer.parent().is(n.headContainer) || n.containerParent.append(n.contentContainer), n.deferred.embedded.resolve())
+ }, n.panel.bind(e), e(n.panel.get())
+ },
+ attachEvents: function() {
+ var e, t, n = this;
+ n.container.hasClass("cannot-expand") || (n.container.find(".accordion-section-title, .customize-section-back").on("click keydown", function(e) {
+ L.utils.isKeydownButNotEnterEvent(e) || (e.preventDefault(), n.expanded() ? n.collapse() : n.expand())
+ }), n.container.find(".customize-section-title .customize-help-toggle").on("click", function() {
+ (e = n.container.find(".section-meta")).hasClass("cannot-expand") || ((t = e.find(".customize-section-description:first")).toggleClass("open"), t.slideToggle(n.defaultExpandedArguments.duration, function() {
+ t.trigger("toggled")
+ }), H(this).attr("aria-expanded", function(e, t) {
+ return "true" === t ? "false" : "true"
}))
- }), e.fail(function(a) {
- d.reject(a), f.trigger("changeset-error", a)
- }), e.always(function(a) {
- a.setting_validities && f._handleSettingValidities({
- settingValidities: a.setting_validities
- })
- }), d.promise()))
- }, f.utils.bubbleChildValueChanges = function(a, c) {
- b.each(c, function(b, c) {
- a[c].bind(function(b, c) {
- a.parent && b !== c && a.parent.trigger("change", a)
+ }))
+ },
+ 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, a = this,
+ o = a.headContainer.closest(".wp-full-overlay-sidebar-content"),
+ s = a.contentContainer,
+ r = a.headContainer.closest(".wp-full-overlay"),
+ c = s.find(".customize-section-back"),
+ l = a.headContainer.find(".accordion-section-title").first();
+ e && !s.hasClass("open") ? (n = t.unchanged ? t.completeCallback : H.proxy(function() {
+ a._animateChangeExpanded(function() {
+ l.attr("tabindex", "-1"), c.attr("tabindex", "0"), c.focus(), s.css("top", ""), o.scrollTop(0), t.completeCallback && t.completeCallback()
+ }), s.addClass("open"), r.addClass("section-open"), L.state("expandedSection").set(a)
+ }, this), t.allowMultiple || L.section.each(function(e) {
+ e !== a && e.collapse({
+ duration: t.duration
+ })
+ }), a.panel() ? L.panel(a.panel()).expand({
+ duration: t.duration,
+ completeCallback: n
+ }) : (t.allowMultiple || L.panel.each(function(e) {
+ e.collapse()
+ }), n())) : !e && s.hasClass("open") ? (a.panel() && (i = L.panel(a.panel())).contentContainer.hasClass("skip-transition") && i.collapse(), a._animateChangeExpanded(function() {
+ c.attr("tabindex", "-1"), l.attr("tabindex", "0"), l.focus(), s.css("top", ""), t.completeCallback && t.completeCallback()
+ }), s.removeClass("open"), r.removeClass("section-open"), a === L.state("expandedSection").get() && L.state("expandedSection").set(!1)) : t.completeCallback && t.completeCallback()
+ }
+ }), L.ThemesSection = L.Section.extend({
+ currentTheme: "",
+ overlay: "",
+ template: "",
+ screenshotQueue: null,
+ $window: null,
+ $body: null,
+ loaded: 0,
+ loading: !1,
+ fullyLoaded: !1,
+ term: "",
+ tags: "",
+ nextTerm: "",
+ nextTags: "",
+ filtersHeight: 0,
+ headerContainer: null,
+ updateCountDebounced: null,
+ initialize: function(e, t) {
+ var n = this;
+ n.headerContainer = H(), n.$window = H(window), n.$body = H(document.body), L.Section.prototype.initialize.call(n, e, t), n.updateCountDebounced = _.debounce(n.updateCount, 500)
+ },
+ embed: function() {
+ var e, n = this;
+ e = function(e) {
+ var t;
+ L.panel(e, function(e) {
+ e.deferred.embedded.done(function() {
+ t = e.contentContainer, n.headContainer.parent().is(t) || t.find(".customize-themes-full-container-container").before(n.headContainer), n.contentContainer.parent().is(n.headContainer) || n.containerParent.append(n.contentContainer), n.deferred.embedded.resolve()
+ })
})
+ }, n.panel.bind(e), e(n.panel.get())
+ },
+ ready: function() {
+ var t = this;
+ t.overlay = t.container.find(".theme-overlay"), t.template = wp.template("customize-themes-details-view"), t.container.on("keydown", function(e) {
+ t.overlay.find(".theme-wrap").is(":visible") && (39 === e.keyCode && t.nextTheme(), 37 === e.keyCode && t.previousTheme(), 27 === e.keyCode && (t.$body.hasClass("modal-open") ? t.closeDetails() : t.headerContainer.find(".customize-themes-section-title").focus(), e.stopPropagation()))
+ }), t.renderScreenshots = _.throttle(t.renderScreenshots, 100), _.bindAll(t, "renderScreenshots", "loadMore", "checkTerm", "filtersChecked")
+ },
+ isContextuallyActive: function() {
+ return this.active()
+ },
+ attachEvents: function() {
+ var e, a = this;
+
+ function t() {
+ var e = a.headerContainer.find(".customize-themes-section-title");
+ e.toggleClass("selected", a.expanded()), e.attr("aria-expanded", a.expanded() ? "true" : "false"), a.expanded() || e.removeClass("details-open")
+ }
+ a.container.find(".customize-section-back").on("click keydown", function(e) {
+ L.utils.isKeydownButNotEnterEvent(e) || (e.preventDefault(), a.collapse())
+ }), a.headerContainer = H("#accordion-section-" + a.id), a.headerContainer.on("click", ".customize-themes-section-title", function() {
+ a.headerContainer.find(".filter-details").length && (a.headerContainer.find(".customize-themes-section-title").toggleClass("details-open").attr("aria-expanded", function(e, t) {
+ return "true" === t ? "false" : "true"
+ }), a.headerContainer.find(".filter-details").slideToggle(180)), a.expanded() || a.expand()
+ }), a.container.on("click", ".theme-actions .preview-theme", function() {
+ L.panel("themes").loadThemePreview(H(this).data("slug"))
+ }), a.container.on("click", ".left", function() {
+ a.previousTheme()
+ }), a.container.on("click", ".right", function() {
+ a.nextTheme()
+ }), a.container.on("click", ".theme-backdrop, .close", function() {
+ a.closeDetails()
+ }), "local" === a.params.filter_type ? a.container.on("input", ".wp-filter-search-themes", function(e) {
+ a.filterSearch(e.currentTarget.value)
+ }) : "remote" === a.params.filter_type && (e = _.debounce(a.checkTerm, 500), a.contentContainer.on("input", ".wp-filter-search", function() {
+ L.panel("themes").expanded() && (e(a), a.expanded() || a.expand())
+ }), a.contentContainer.on("click", ".filter-group input", function() {
+ a.filtersChecked(), a.checkTerm(a)
+ })), a.contentContainer.on("click", ".feature-filter-toggle", function(e) {
+ var t = H(".customize-themes-full-container"),
+ n = H(e.currentTarget);
+ if (a.filtersHeight = n.parent().next(".filter-drawer").height(), !(0 < t.scrollTop() && (t.animate({
+ scrollTop: 0
+ }, 400), n.hasClass("open"))))
+ if (n.toggleClass("open").attr("aria-expanded", function(e, t) {
+ return "true" === t ? "false" : "true"
+ }).parent().next(".filter-drawer").slideToggle(180, "linear"), n.hasClass("open")) {
+ var i = 1018 < window.innerWidth ? 50 : 76;
+ a.contentContainer.find(".themes").css("margin-top", a.filtersHeight + i)
+ } else a.contentContainer.find(".themes").css("margin-top", 0)
+ }), a.contentContainer.on("click", ".no-themes-local .search-dotorg-themes", function() {
+ L.section("wporg_themes").focus()
+ }), a.expanded.bind(t), t(), L.bind("ready", function() {
+ a.contentContainer = a.container.find(".customize-themes-section"), a.contentContainer.appendTo(H(".customize-themes-full-container")), a.container.add(a.headerContainer)
+ })
+ },
+ onChangeExpanded: function(e, n) {
+ var i = this,
+ t = i.contentContainer.closest(".customize-themes-full-container");
+
+ function a() {
+ 0 === i.loaded && i.loadThemes(), L.section.each(function(e) {
+ var t;
+ e !== i && "themes" === e.params.type && (t = e.contentContainer.find(".wp-filter-search").val(), i.contentContainer.find(".wp-filter-search").val(t), "" === t && "" !== i.term && "local" !== i.params.filter_type ? (i.term = "", i.initializeNewQuery(i.term, i.tags)) : "remote" === i.params.filter_type ? i.checkTerm(i) : "local" === i.params.filter_type && i.filterSearch(t), e.collapse({
+ duration: n.duration
+ }))
+ }), i.contentContainer.addClass("current-section"), t.scrollTop(), t.on("scroll", _.throttle(i.renderScreenshots, 300)), t.on("scroll", _.throttle(i.loadMore, 300)), n.completeCallback && n.completeCallback(), i.updateCount()
+ }
+ n.unchanged ? n.completeCallback && n.completeCallback() : e ? i.panel() && L.panel.has(i.panel()) ? L.panel(i.panel()).expand({
+ duration: n.duration,
+ completeCallback: a
+ }) : a() : (i.contentContainer.removeClass("current-section"), i.headerContainer.find(".filter-details").slideUp(180), t.off("scroll"), n.completeCallback && n.completeCallback())
+ },
+ getContent: function() {
+ return this.container.find(".control-section-content")
+ },
+ loadThemes: function() {
+ var e, n, t, i = this;
+ i.loading || (n = Math.ceil(i.loaded / 100) + 1, e = {
+ nonce: L.settings.nonce.switch_themes,
+ wp_customize: "on",
+ theme_action: i.params.action,
+ customized_theme: L.settings.theme.stylesheet,
+ page: n
+ }, "remote" === i.params.filter_type && (e.search = i.term, e.tags = i.tags), i.headContainer.closest(".wp-full-overlay").addClass("loading"), i.loading = !0, i.container.find(".no-themes").hide(), (t = wp.ajax.post("customize_load_themes", e)).done(function(e) {
+ var t = e.themes;
+ if ("" !== i.nextTerm || "" !== i.nextTags) return i.nextTerm && (i.term = i.nextTerm), i.nextTags && (i.tags = i.nextTags), i.nextTerm = "", i.nextTags = "", i.loading = !1, void i.loadThemes();
+ 0 !== t.length ? (i.loadControls(t, n), 1 === n && (_.each(i.controls().slice(0, 3), function(e) {
+ var t = e.params.theme.screenshot[0];
+ t && ((new Image).src = t)
+ }), "local" !== i.params.filter_type && wp.a11y.speak(L.settings.l10n.themeSearchResults.replace("%d", e.info.results))), _.delay(i.renderScreenshots, 100), ("local" === i.params.filter_type || t.length < 100) && (i.fullyLoaded = !0)) : 0 === i.loaded ? (i.container.find(".no-themes").show(), wp.a11y.speak(i.container.find(".no-themes").text())) : i.fullyLoaded = !0, "local" === i.params.filter_type ? i.updateCount() : i.updateCount(e.info.results), i.container.find(".unexpected-error").hide(), i.headContainer.closest(".wp-full-overlay").removeClass("loading"), i.loading = !1
+ }), t.fail(function(e) {
+ void 0 === e ? (i.container.find(".unexpected-error").show(), wp.a11y.speak(i.container.find(".unexpected-error").text())) : "undefined" != typeof console && console.error && console.error(e), i.headContainer.closest(".wp-full-overlay").removeClass("loading"), i.loading = !1
+ }))
+ },
+ loadControls: function(e, t) {
+ var n = [],
+ i = this;
+ _.each(e, function(e) {
+ var t = new L.controlConstructor.theme(i.params.action + "_theme_" + e.id, {
+ type: "theme",
+ section: i.params.id,
+ theme: e,
+ priority: i.loaded + 1
+ });
+ L.control.add(t), n.push(t), i.loaded = i.loaded + 1
+ }), 1 !== t && Array.prototype.push.apply(i.screenshotQueue, n)
+ },
+ loadMore: function() {
+ var e, t;
+ this.fullyLoaded || this.loading || (t = (e = this.container.closest(".customize-themes-full-container")).scrollTop() + e.height(), e.prop("scrollHeight") - 3e3 < t && this.loadThemes())
+ },
+ filterSearch: function(e) {
+ var t, n = 0,
+ i = this,
+ a = L.section.has("wporg_themes") && "remote" !== i.params.filter_type ? ".no-themes-local" : ".no-themes",
+ o = i.controls();
+ i.loading || (t = e.toLowerCase().trim().replace(/-/g, " ").split(" "), _.each(o, function(e) {
+ e.filter(t) && (n += 1)
+ }), 0 === n ? (i.container.find(a).show(), wp.a11y.speak(i.container.find(a).text())) : i.container.find(a).hide(), i.renderScreenshots(), L.reflowPaneContents(), i.updateCountDebounced(n))
+ },
+ checkTerm: function(e) {
+ var t;
+ "remote" === e.params.filter_type && (t = e.contentContainer.find(".wp-filter-search").val(), e.term !== t.trim() && e.initializeNewQuery(t, e.tags))
+ },
+ filtersChecked: function() {
+ var e = this,
+ t = e.container.find(".filter-group").find(":checkbox"),
+ n = [];
+ _.each(t.filter(":checked"), function(e) {
+ n.push(H(e).prop("value"))
+ }), 0 === n.length ? (n = "", e.contentContainer.find(".feature-filter-toggle .filter-count-0").show(), e.contentContainer.find(".feature-filter-toggle .filter-count-filters").hide()) : (e.contentContainer.find(".feature-filter-toggle .theme-filter-count").text(n.length), e.contentContainer.find(".feature-filter-toggle .filter-count-0").hide(), e.contentContainer.find(".feature-filter-toggle .filter-count-filters").show()), _.isEqual(e.tags, n) || (e.loading ? e.nextTags = n : "remote" === e.params.filter_type ? e.initializeNewQuery(e.term, n) : "local" === e.params.filter_type && e.filterSearch(n.join(" ")))
+ },
+ initializeNewQuery: function(e, t) {
+ var n = this;
+ _.each(n.controls(), function(e) {
+ e.container.remove(), L.control.remove(e.id)
+ }), n.loaded = 0, n.fullyLoaded = !1, n.screenshotQueue = null, n.loading ? (n.nextTerm = e, n.nextTags = t) : (n.term = e, n.tags = t, n.loadThemes()), n.expanded() || n.expand()
+ },
+ renderScreenshots: function() {
+ var l = this;
+ null !== l.screenshotQueue && 0 !== l.screenshotQueue.length || (l.screenshotQueue = _.filter(l.controls(), function(e) {
+ return !e.screenshotRendered
+ })), l.screenshotQueue.length && (l.screenshotQueue = _.filter(l.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 = l.$window.scrollTop(),
+ a = i + l.$window.height(),
+ o = n.offset().top,
+ s = t.height(),
+ r = 3 * s,
+ c = i - r <= o + s && o <= a + r;
+ return c && e.container.trigger("render-screenshot"), !c
+ }))
+ },
+ getVisibleCount: function() {
+ return this.contentContainer.find("li.customize-control:visible").length
+ },
+ updateCount: function(e) {
+ var t, n;
+ e || 0 === e || (e = this.getVisibleCount()), n = this.contentContainer.find(".themes-displayed"), t = this.contentContainer.find(".theme-count"), 0 === e ? t.text("0") : (n.fadeOut(180, function() {
+ t.text(e), n.fadeIn(180)
+ }), wp.a11y.speak(L.settings.l10n.announceThemeCount.replace("%d", e)))
+ },
+ nextTheme: function() {
+ var e = this;
+ e.getNextTheme() && e.showDetails(e.getNextTheme(), function() {
+ e.overlay.find(".right").focus()
})
- }, d = function(a) {
- var b, c, d, e;
- b = this, a = a || {}, d = function() {
- var a;
- a = (b.extended(f.Panel) || b.extended(f.Section)) && b.expanded && b.expanded() ? b.contentContainer : b.container, e = a.find(".control-focus:first"), 0 === e.length && (e = a.find("input, select, textarea, button, object, a[href], [tabindex]").filter(":visible").first()), e.focus()
- }, a.completeCallback ? (c = a.completeCallback, a.completeCallback = function() {
- d(), c()
- }) : a.completeCallback = d, f.state("paneVisible").set(!0), b.expand ? b.expand(a) : a.completeCallback()
- }, f.utils.prioritySort = function(a, b) {
- return a.priority() === b.priority() && "number" == typeof a.params.instanceNumber && "number" == typeof b.params.instanceNumber ? a.params.instanceNumber - b.params.instanceNumber : a.priority() - b.priority()
- }, f.utils.isKeydownButNotEnterEvent = function(a) {
- return "keydown" === a.type && 13 !== a.which
- }, f.utils.areElementListsEqual = function(a, c) {
- return a.length === c.length && -1 === _.indexOf(_.map(_.zip(a, c), function(a) {
- return b(a[0]).is(a[1])
- }), !1)
- }, f.utils.highlightButton = function(a, b) {
- function c() {
- e = !0
+ },
+ getNextTheme: function() {
+ var e, t, n, i;
+ return e = L.control(this.params.action + "_theme_" + this.currentTheme), n = this.controls(), -1 !== (i = _.indexOf(n, e)) && (!!(t = n[i + 1]) && t.params.theme)
+ },
+ previousTheme: function() {
+ var e = this;
+ e.getPreviousTheme() && e.showDetails(e.getPreviousTheme(), function() {
+ e.overlay.find(".left").focus()
+ })
+ },
+ getPreviousTheme: function() {
+ var e, t, n, i;
+ return e = L.control(this.params.action + "_theme_" + this.currentTheme), n = this.controls(), -1 !== (i = _.indexOf(n, e)) && (!!(t = n[i - 1]) && t.params.theme)
+ },
+ updateLimits: function() {
+ this.getNextTheme() || this.overlay.find(".right").addClass("disabled"), this.getPreviousTheme() || this.overlay.find(".left").addClass("disabled")
+ },
+ loadThemePreview: function(e) {
+ return L.ThemesPanel.prototype.loadThemePreview.call(this, e)
+ },
+ showDetails: function(e, t) {
+ var n = this,
+ i = L.panel("themes");
+
+ function a() {
+ return !i.canSwitchTheme(e.id)
}
- var d, e = !1;
- return d = _.extend({
- delay: 0,
- focusTarget: a
- }, b), d.focusTarget.on("focusin", c), setTimeout(function() {
- d.focusTarget.off("focusin", c), e || (a.addClass("button-see-me"), a.one("animationend", function() {
- a.removeClass("button-see-me")
- }))
- }, d.delay), c
- }, f.utils.getCurrentTimestamp = function() {
- var a, b, c;
- return b = _.now(), a = new Date(f.settings.initialServerDate.replace(/-/g, "/")), c = b - f.settings.initialClientTimestamp, c += f.settings.initialClientTimestamp - f.settings.initialServerTimestamp, a.setTime(a.getTime() + c), a.getTime()
- }, f.utils.getRemainingTime = function(a) {
- var b, c;
- return c = a instanceof Date ? a.getTime() : "string" == typeof a ? new Date(a.replace(/-/g, "/")).getTime() : a, b = c - f.utils.getCurrentTimestamp(), b = Math.ceil(b / 1e3)
- }, e = function() {
- var a, b, c;
- return a = document.createElement("div"), b = {
- transition: "transitionend",
- OTransition: "oTransitionEnd",
- MozTransition: "transitionend",
- WebkitTransition: "webkitTransitionEnd"
- }, c = _.find(_.keys(b), function(b) {
- return !_.isUndefined(a.style[b])
- }), c ? b[c] : null
- }(), c = f.Class.extend({
- defaultActiveArguments: {
- duration: "fast",
- completeCallback: b.noop
- },
- defaultExpandedArguments: {
- duration: "fast",
- completeCallback: b.noop
- },
- containerType: "container",
- defaults: {
- title: "",
- description: "",
- priority: 100,
- type: "default",
- content: null,
- active: !0,
- instanceNumber: null
- },
- initialize: function(a, d) {
- var e = this;
- e.id = a, c.instanceCounter || (c.instanceCounter = 0), c.instanceCounter++, b.extend(e, {
- params: _.defaults(d.params || d, e.defaults)
- }), e.params.instanceNumber || (e.params.instanceNumber = c.instanceCounter), e.notifications = new f.Notifications, e.templateSelector = e.params.templateId || "customize-" + e.containerType + "-" + e.params.type, e.container = b(e.params.content), 0 === e.container.length && (e.container = b(e.getContainer())), e.headContainer = e.container, e.contentContainer = e.getContent(), e.container = e.container.add(e.contentContainer), e.deferred = {
- embedded: new b.Deferred
- }, e.priority = new f.Value, e.active = new f.Value, e.activeArgumentsQueue = [], e.expanded = new f.Value, e.expandedArgumentsQueue = [], e.active.bind(function(a) {
- var c = e.activeArgumentsQueue.shift();
- c = b.extend({}, e.defaultActiveArguments, c), a = a && e.isContextuallyActive(), e.onChangeActive(a, c)
- }), e.expanded.bind(function(a) {
- var c = e.expandedArgumentsQueue.shift();
- c = b.extend({}, e.defaultExpandedArguments, c), e.onChangeExpanded(a, c)
- }), e.deferred.embedded.done(function() {
- e.setupNotifications(), e.attachEvents()
- }), f.utils.bubbleChildValueChanges(e, ["priority", "active"]), e.priority.set(e.params.priority), e.active.set(e.params.active), e.expanded.set(!1)
- },
- getNotificationsContainerElement: function() {
- return this.contentContainer.find(".customize-control-notifications-container:first")
- },
- setupNotifications: function() {
- var a, b = this;
- b.notifications.container = b.getNotificationsContainerElement(), a = function() {
- b.expanded.get() && b.notifications.render()
- }, b.expanded.bind(a), a(), b.notifications.bind("change", _.debounce(a))
- },
- ready: function() {},
- _children: function(a, b) {
- var c = this,
- d = [];
- return f[b].each(function(b) {
- b[a].get() === c.id && d.push(b)
- }), d.sort(f.utils.prioritySort), d
- },
- isContextuallyActive: function() {
- throw new Error("Container.isContextuallyActive() must be overridden in a subclass.")
- },
- onChangeActive: function(a, c) {
- var d, e, g = this,
- h = g.headContainer;
- if (c.unchanged) return void(c.completeCallback && c.completeCallback());
- d = "resolved" === f.previewer.deferred.active.state() ? c.duration : 0, g.extended(f.Panel) && (f.panel.each(function(a) {
- a !== g && a.expanded() && (e = a, d = 0)
- }), a || _.each(g.sections(), function(a) {
- a.collapse({
+ n.currentTheme = e.id, n.overlay.html(n.template(e)).fadeIn("fast").focus(), n.overlay.find("button.preview, button.preview-theme").toggleClass("disabled", a()), n.overlay.find("button.theme-install").toggleClass("disabled", a() || !1 === L.settings.theme._canInstall || !0 === L.settings.theme._filesystemCredentialsNeeded), n.$body.addClass("modal-open"), n.containFocus(n.overlay), n.updateLimits(), wp.a11y.speak(L.settings.l10n.announceThemeDetails.replace("%s", e.name)), t && t()
+ },
+ closeDetails: function() {
+ this.$body.removeClass("modal-open"), this.overlay.fadeOut("fast"), L.control(this.params.action + "_theme_" + this.currentTheme).container.find(".theme").focus()
+ },
+ containFocus: function(t) {
+ var n;
+ t.on("keydown", function(e) {
+ if (9 === e.keyCode) return (n = H(":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)
+ })
+ }
+ }), L.OuterSection = L.Section.extend({
+ initialize: function() {
+ this.containerParent = "#customize-outer-theme-controls", this.containerPaneParent = ".customize-outer-pane-parent", L.Section.prototype.initialize.apply(this, arguments)
+ },
+ onChangeExpanded: function(e, t) {
+ var n, i, a = this,
+ o = a.headContainer.closest(".wp-full-overlay-sidebar-content"),
+ s = a.contentContainer,
+ r = s.find(".customize-section-back"),
+ c = a.headContainer.find(".accordion-section-title").first();
+ H(document.body).toggleClass("outer-section-open", e), a.container.toggleClass("open", e), a.container.removeClass("busy"), L.section.each(function(e) {
+ "outer" === e.params.type && e.id !== a.id && e.container.removeClass("open")
+ }), e && !s.hasClass("open") ? (n = t.unchanged ? t.completeCallback : H.proxy(function() {
+ a._animateChangeExpanded(function() {
+ c.attr("tabindex", "-1"), r.attr("tabindex", "0"), r.focus(), s.css("top", ""), o.scrollTop(0), t.completeCallback && t.completeCallback()
+ }), s.addClass("open")
+ }, this), a.panel() ? L.panel(a.panel()).expand({
+ duration: t.duration,
+ completeCallback: n
+ }) : n()) : !e && s.hasClass("open") ? (a.panel() && (i = L.panel(a.panel())).contentContainer.hasClass("skip-transition") && i.collapse(), a._animateChangeExpanded(function() {
+ r.attr("tabindex", "-1"), c.attr("tabindex", "0"), c.focus(), s.css("top", ""), t.completeCallback && t.completeCallback()
+ }), s.removeClass("open")) : t.completeCallback && t.completeCallback()
+ }
+ }), L.Panel = a.extend({
+ containerType: "panel",
+ initialize: function(e, t) {
+ var n, i = this;
+ (n = t.params || t).type || _.find(L.panelConstructor, function(e, t) {
+ return e === i.constructor && (n.type = t, !0)
+ }), a.prototype.initialize.call(i, e, n), i.embed(), i.deferred.embedded.done(function() {
+ i.ready()
+ })
+ },
+ embed: function() {
+ var e = this,
+ t = H("#customize-theme-controls"),
+ n = H(".customize-pane-parent");
+ e.headContainer.parent().is(n) || n.append(e.headContainer), e.contentContainer.parent().is(e.headContainer) || t.append(e.contentContainer), e.renderContent(), e.deferred.embedded.resolve()
+ },
+ attachEvents: function() {
+ var t, n = this;
+ n.headContainer.find(".accordion-section-title").on("click keydown", function(e) {
+ L.utils.isKeydownButNotEnterEvent(e) || (e.preventDefault(), n.expanded() || n.expand())
+ }), n.container.find(".customize-panel-back").on("click keydown", function(e) {
+ L.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", function() {
+ if (!t.hasClass("cannot-expand")) {
+ var e = t.find(".customize-panel-description:first");
+ t.hasClass("open") ? (t.toggleClass("open"), e.slideUp(n.defaultExpandedArguments.duration, function() {
+ e.trigger("toggled")
+ }), H(this).attr("aria-expanded", !1)) : (e.slideDown(n.defaultExpandedArguments.duration, function() {
+ e.trigger("toggled")
+ }), t.toggleClass("open"), H(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) {
+ if (t.unchanged) t.completeCallback && t.completeCallback();
+ else {
+ var n = this,
+ i = n.contentContainer,
+ a = i.closest(".wp-full-overlay"),
+ o = i.closest(".wp-full-overlay-sidebar-content"),
+ s = n.headContainer.find(".accordion-section-title"),
+ r = i.find(".customize-panel-back"),
+ c = n.sections();
+ e && !i.hasClass("current-panel") ? (L.section.each(function(e) {
+ n.id !== e.panel() && e.collapse({
duration: 0
})
- })), b.contains(document, h.get(0)) ? a ? h.slideDown(d, c.completeCallback) : g.expanded() ? g.collapse({
- duration: d,
- completeCallback: function() {
- h.slideUp(d, c.completeCallback)
- }
- }) : h.slideUp(d, c.completeCallback) : (h.toggle(a), c.completeCallback && c.completeCallback())
- },
- _toggleActive: function(a, b) {
- var c = this;
- return b = b || {}, a && this.active.get() || !a && !this.active.get() ? (b.unchanged = !0, c.onChangeActive(c.active.get(), b), !1) : (b.unchanged = !1, this.activeArgumentsQueue.push(b), this.active.set(a), !0)
- },
- activate: function(a) {
- return this._toggleActive(!0, a)
- },
- deactivate: function(a) {
- return this._toggleActive(!1, a)
- },
- onChangeExpanded: function() {
- throw new Error("Must override with subclass.")
- },
- _toggleExpanded: function(a, b) {
- var c, d = this;
- return b = b || {}, c = b.completeCallback, !(a && !d.active()) && (f.state("paneVisible").set(!0), b.completeCallback = function() {
- c && c.apply(d, arguments), a ? d.container.trigger("expanded") : d.container.trigger("collapsed")
- }, a && d.expanded.get() || !a && !d.expanded.get() ? (b.unchanged = !0, d.onChangeExpanded(d.expanded.get(), b), !1) : (b.unchanged = !1, d.expandedArgumentsQueue.push(b), d.expanded.set(a), !0))
- },
- expand: function(a) {
- return this._toggleExpanded(!0, a)
- },
- collapse: function(a) {
- return this._toggleExpanded(!1, a)
- },
- _animateChangeExpanded: function(a) {
- if (!e) return void(a && a());
- var c, d, g, h = this,
- i = h.contentContainer,
- j = i.closest(".wp-full-overlay");
- c = j.add(i), g = !h.panel || "" === h.panel() || !!f.panel(h.panel()).contentContainer.hasClass("skip-transition"), g && (c = c.add("#customize-info, .customize-pane-parent")), d = function(f) {
- 2 === f.eventPhase && b(f.target).is(i) && (i.off(e, d), c.removeClass("busy"), a && a())
- }, i.on(e, d), c.addClass("busy"), _.defer(function() {
- var a = i.closest(".wp-full-overlay-sidebar-content"),
- b = a.scrollTop(),
- c = i.data("previous-scrollTop") || 0,
- d = h.expanded();
- d && 0 < b ? (i.css("top", b + "px"), i.data("previous-scrollTop", b)) : !d && 0 < b + c && (i.css("top", c - b + "px"), a.scrollTop(c))
- })
- },
- focus: d,
- getContainer: function() {
- var a, c = this;
- return a = 0 !== b("#tmpl-" + c.templateSelector).length ? wp.template(c.templateSelector) : wp.template("customize-" + c.containerType + "-default"), a && c.container ? b.trim(a(_.extend({
- id: c.id
- }, c.params))) : "<li></li>"
- },
- getContent: function() {
- var a = this,
- b = a.container,
- c = b.find(".accordion-section-content, .control-panel-content").first(),
- d = "sub-" + b.attr("id"),
- e = d,
- f = b.attr("aria-owns");
- return f && (e = e + " " + f), b.attr("aria-owns", e), c.detach().attr({
- id: d,
- "class": "customize-pane-child " + c.attr("class") + " " + b.attr("class")
- })
- }
- }), f.Section = c.extend({
- containerType: "section",
- containerParent: "#customize-theme-controls",
- containerPaneParent: ".customize-pane-parent",
- defaults: {
- title: "",
- description: "",
- priority: 100,
- type: "default",
- content: null,
- active: !0,
- instanceNumber: null,
- panel: null,
- customizeAction: ""
- },
- initialize: function(a, d) {
- var e, g = this;
- e = d.params || d, e.type || _.find(f.sectionConstructor, function(a, b) {
- return a === g.constructor && (e.type = b, !0)
- }), c.prototype.initialize.call(g, a, e), g.id = a, g.panel = new f.Value, g.panel.bind(function(a) {
- b(g.headContainer).toggleClass("control-subsection", !!a)
- }), g.panel.set(g.params.panel || ""), f.utils.bubbleChildValueChanges(g, ["panel"]), g.embed(), g.deferred.embedded.done(function() {
- g.ready()
- })
- },
- embed: function() {
- var a, b = this;
- b.containerParent = f.ensure(b.containerParent), a = function(a) {
- var c;
- a ? f.panel(a, function(a) {
- a.deferred.embedded.done(function() {
- c = a.contentContainer, b.headContainer.parent().is(c) || c.append(b.headContainer), b.contentContainer.parent().is(b.headContainer) || b.containerParent.append(b.contentContainer), b.deferred.embedded.resolve()
- })
- }) : (c = f.ensure(b.containerPaneParent), b.headContainer.parent().is(c) || c.append(b.headContainer), b.contentContainer.parent().is(b.headContainer) || b.containerParent.append(b.contentContainer), b.deferred.embedded.resolve())
- }, b.panel.bind(a), a(b.panel.get())
- },
- attachEvents: function() {
- var a, c, d = this;
- d.container.hasClass("cannot-expand") || (d.container.find(".accordion-section-title, .customize-section-back").on("click keydown", function(a) {
- f.utils.isKeydownButNotEnterEvent(a) || (a.preventDefault(), d.expanded() ? d.collapse() : d.expand())
- }), d.container.find(".customize-section-title .customize-help-toggle").on("click", function() {
- a = d.container.find(".section-meta"), a.hasClass("cannot-expand") || (c = a.find(".customize-section-description:first"), c.toggleClass("open"), c.slideToggle(d.defaultExpandedArguments.duration, function() {
- c.trigger("toggled")
- }), b(this).attr("aria-expanded", function(a, b) {
- return "true" === b ? "false" : "true"
- }))
+ }), L.panel.each(function(e) {
+ n !== e && e.collapse({
+ duration: 0
+ })
+ }), n.params.autoExpandSoleSection && 1 === c.length && c[0].active.get() ? (i.addClass("current-panel skip-transition"), a.addClass("in-sub-panel"), c[0].expand({
+ completeCallback: t.completeCallback
+ })) : (n._animateChangeExpanded(function() {
+ s.attr("tabindex", "-1"), r.attr("tabindex", "0"), r.focus(), i.css("top", ""), o.scrollTop(0), t.completeCallback && t.completeCallback()
+ }), i.addClass("current-panel"), a.addClass("in-sub-panel")), L.state("expandedPanel").set(n)) : !e && i.hasClass("current-panel") && (i.hasClass("skip-transition") ? i.removeClass("skip-transition") : n._animateChangeExpanded(function() {
+ s.attr("tabindex", "0"), r.attr("tabindex", "-1"), s.focus(), i.css("top", ""), t.completeCallback && t.completeCallback()
+ }), a.removeClass("in-sub-panel"), i.removeClass("current-panel"), n === L.state("expandedPanel").get() && L.state("expandedPanel").set(!1))
+ }
+ },
+ renderContent: function() {
+ var e, t = this;
+ (e = 0 !== H("#tmpl-" + t.templateSelector + "-content").length ? wp.template(t.templateSelector + "-content") : wp.template("customize-panel-default-content")) && t.headContainer && t.contentContainer.html(e(_.extend({
+ id: t.id
+ }, t.params)))
+ }
+ }), L.ThemesPanel = L.Panel.extend({
+ initialize: function(e, t) {
+ this.installingThemes = [], L.Panel.prototype.initialize.call(this, e, t)
+ },
+ canSwitchTheme: function(e) {
+ return !(!e || e !== L.settings.theme.stylesheet) || "publish" === L.state("selectedChangesetStatus").get() && ("" === L.state("changesetStatus").get() || "auto-draft" === L.state("changesetStatus").get())
+ },
+ attachEvents: function() {
+ var t = this;
+
+ function e() {
+ t.canSwitchTheme() ? t.notifications.remove("theme_switch_unavailable") : t.notifications.add(new L.Notification("theme_switch_unavailable", {
+ message: L.l10n.themePreviewUnavailable,
+ type: "warning"
}))
- },
- isContextuallyActive: function() {
- var a = this,
- b = a.controls(),
- c = 0;
- return _(b).each(function(a) {
- a.active() && (c += 1)
- }), 0 !== c
- },
- controls: function() {
- return this._children("section", "control")
- },
- onChangeExpanded: function(a, c) {
- var d, e, g = this,
- h = g.headContainer.closest(".wp-full-overlay-sidebar-content"),
- i = g.contentContainer,
- j = g.headContainer.closest(".wp-full-overlay"),
- k = i.find(".customize-section-back"),
- l = g.headContainer.find(".accordion-section-title").first();
- a && !i.hasClass("open") ? (d = c.unchanged ? c.completeCallback : b.proxy(function() {
- g._animateChangeExpanded(function() {
- l.attr("tabindex", "-1"), k.attr("tabindex", "0"), k.focus(), i.css("top", ""), h.scrollTop(0), c.completeCallback && c.completeCallback()
- }), i.addClass("open"), j.addClass("section-open"), f.state("expandedSection").set(g)
- }, this), c.allowMultiple || f.section.each(function(a) {
- a !== g && a.collapse({
- duration: c.duration
- })
- }), g.panel() ? f.panel(g.panel()).expand({
- duration: c.duration,
- completeCallback: d
- }) : (c.allowMultiple || f.panel.each(function(a) {
- a.collapse()
- }), d())) : !a && i.hasClass("open") ? (g.panel() && (e = f.panel(g.panel()), e.contentContainer.hasClass("skip-transition") && e.collapse()), g._animateChangeExpanded(function() {
- k.attr("tabindex", "-1"), l.attr("tabindex", "0"), l.focus(), i.css("top", ""), c.completeCallback && c.completeCallback()
- }), i.removeClass("open"), j.removeClass("section-open"), g === f.state("expandedSection").get() && f.state("expandedSection").set(!1)) : c.completeCallback && c.completeCallback()
}
- }), f.ThemesSection = f.Section.extend({
- currentTheme: "",
- overlay: "",
- template: "",
- screenshotQueue: null,
- $window: null,
- $body: null,
- loaded: 0,
- loading: !1,
- fullyLoaded: !1,
- term: "",
- tags: "",
- nextTerm: "",
- nextTags: "",
- filtersHeight: 0,
- headerContainer: null,
- updateCountDebounced: null,
- initialize: function(a, c) {
- var d = this;
- d.headerContainer = b(), d.$window = b(window), d.$body = b(document.body), f.Section.prototype.initialize.call(d, a, c), d.updateCountDebounced = _.debounce(d.updateCount, 500)
- },
- embed: function() {
- var a, b = this;
- a = function(a) {
- var c;
- f.panel(a, function(a) {
- a.deferred.embedded.done(function() {
- c = a.contentContainer, b.headContainer.parent().is(c) || c.find(".customize-themes-full-container-container").before(b.headContainer), b.contentContainer.parent().is(b.headContainer) || b.containerParent.append(b.contentContainer), b.deferred.embedded.resolve()
- })
+ L.Panel.prototype.attachEvents.apply(t), L.settings.theme._canInstall && L.settings.theme._filesystemCredentialsNeeded && t.notifications.add(new L.Notification("theme_install_unavailable", {
+ message: L.l10n.themeInstallUnavailable,
+ type: "info",
+ dismissible: !0
+ })), e(), L.state("selectedChangesetStatus").bind(e), L.state("changesetStatus").bind(e), t.contentContainer.on("click", ".customize-theme", function() {
+ t.collapse()
+ }), t.contentContainer.on("click", ".customize-themes-section-title, .customize-themes-mobile-back", function() {
+ H(".wp-full-overlay").toggleClass("showing-themes")
+ }), t.contentContainer.on("click", ".theme-install", function(e) {
+ t.installTheme(e)
+ }), t.contentContainer.on("click", ".update-theme, #update-theme", function(e) {
+ e.preventDefault(), e.stopPropagation(), t.updateTheme(e)
+ }), t.contentContainer.on("click", ".delete-theme", function(e) {
+ t.deleteTheme(e)
+ }), _.bindAll(t, "installTheme", "updateTheme")
+ },
+ onChangeExpanded: function(e, t) {
+ var n, i, a = !1;
+ L.Panel.prototype.onChangeExpanded.apply(this, [e, t]), t.unchanged ? t.completeCallback && t.completeCallback() : (n = this.headContainer.closest(".wp-full-overlay"), e ? (n.addClass("in-themes-panel").delay(200).find(".customize-themes-full-container").addClass("animate"), _.delay(function() {
+ n.addClass("themes-panel-expanded")
+ }, 200), 600 < window.innerWidth && (i = this.sections(), _.each(i, function(e) {
+ e.expanded() && (a = !0)
+ }), !a && 0 < i.length && i[0].expand())) : n.removeClass("in-themes-panel themes-panel-expanded").find(".customize-themes-full-container").removeClass("animate"))
+ },
+ installTheme: function(e) {
+ var i, t, n, a = this,
+ o = H(e.target).data("slug"),
+ s = H.Deferred();
+ return i = H(e.target).hasClass("preview"), L.settings.theme._filesystemCredentialsNeeded ? s.reject({
+ errorCode: "theme_install_unavailable"
+ }) : a.canSwitchTheme(o) ? _.contains(a.installingThemes, o) ? s.reject({
+ errorCode: "theme_already_installing"
+ }) : (wp.updates.maybeRequestFilesystemCredentials(e), t = function(t) {
+ var e, n = !1;
+ if (i) L.notifications.remove("theme_installing"), a.loadThemePreview(o);
+ else {
+ if (L.control.each(function(e) {
+ "theme" === e.params.type && e.params.theme.id === t.slug && (n = e.params.theme, e.rerenderAsInstalled(!0))
+ }), !n || L.control.has("installed_theme_" + n.id)) return void s.resolve(t);
+ n.type = "installed", e = new L.controlConstructor.theme("installed_theme_" + n.id, {
+ type: "theme",
+ section: "installed_themes",
+ theme: n,
+ priority: 0
+ }), L.control.add(e), L.control(e.id).container.trigger("render-screenshot"), L.section.each(function(e) {
+ "themes" === e.params.type && n.id === e.currentTheme && e.closeDetails()
})
- }, b.panel.bind(a), a(b.panel.get())
- },
- ready: function() {
- var a = this;
- a.overlay = a.container.find(".theme-overlay"), a.template = wp.template("customize-themes-details-view"), a.container.on("keydown", function(b) {
- a.overlay.find(".theme-wrap").is(":visible") && (39 === b.keyCode && a.nextTheme(), 37 === b.keyCode && a.previousTheme(), 27 === b.keyCode && (a.$body.hasClass("modal-open") ? a.closeDetails() : a.headerContainer.find(".customize-themes-section-title").focus(), b.stopPropagation()))
- }), a.renderScreenshots = _.throttle(a.renderScreenshots, 100), _.bindAll(a, "renderScreenshots", "loadMore", "checkTerm", "filtersChecked")
- },
- isContextuallyActive: function() {
- return this.active()
- },
- attachEvents: function() {
- function a() {
- var a = d.headerContainer.find(".customize-themes-section-title");
- a.toggleClass("selected", d.expanded()), a.attr("aria-expanded", d.expanded() ? "true" : "false"), d.expanded() || a.removeClass("details-open")
- }
- var c, d = this;
- d.container.find(".customize-section-back").on("click keydown", function(a) {
- f.utils.isKeydownButNotEnterEvent(a) || (a.preventDefault(), d.collapse())
- }), d.headerContainer = b("#accordion-section-" + d.id), d.headerContainer.on("click", ".customize-themes-section-title", function() {
- d.headerContainer.find(".filter-details").length && (d.headerContainer.find(".customize-themes-section-title").toggleClass("details-open").attr("aria-expanded", function(a, b) {
- return "true" === b ? "false" : "true"
- }), d.headerContainer.find(".filter-details").slideToggle(180)), d.expanded() || d.expand()
- }), d.container.on("click", ".theme-actions .preview-theme", function() {
- f.panel("themes").loadThemePreview(b(this).data("slug"))
- }), d.container.on("click", ".left", function() {
- d.previousTheme()
- }), d.container.on("click", ".right", function() {
- d.nextTheme()
- }), d.container.on("click", ".theme-backdrop, .close", function() {
- d.closeDetails()
- }), "local" === d.params.filter_type ? d.container.on("input", ".wp-filter-search-themes", function(a) {
- d.filterSearch(a.currentTarget.value)
- }) : "remote" === d.params.filter_type && (c = _.debounce(d.checkTerm, 500), d.contentContainer.on("input", ".wp-filter-search", function() {
- f.panel("themes").expanded() && (c(d), d.expanded() || d.expand())
- }), d.contentContainer.on("click", ".filter-group input", function() {
- d.filtersChecked(), d.checkTerm(d)
- })), d.contentContainer.on("click", ".feature-filter-toggle", function(a) {
- var c = b(".customize-themes-full-container"),
- e = b(a.currentTarget);
- if (d.filtersHeight = e.parent().next(".filter-drawer").height(), !(0 < c.scrollTop() && (c.animate({
- scrollTop: 0
- }, 400), e.hasClass("open"))))
- if (e.toggleClass("open").attr("aria-expanded", function(a, b) {
- return "true" === b ? "false" : "true"
- }).parent().next(".filter-drawer").slideToggle(180, "linear"), e.hasClass("open")) {
- var f = 1018 < window.innerWidth ? 50 : 76;
- d.contentContainer.find(".themes").css("margin-top", d.filtersHeight + f)
- } else d.contentContainer.find(".themes").css("margin-top", 0)
- }), d.contentContainer.on("click", ".no-themes-local .search-dotorg-themes", function() {
- f.section("wporg_themes").focus()
- }), d.expanded.bind(a), a(), f.bind("ready", function() {
- d.contentContainer = d.container.find(".customize-themes-section"), d.contentContainer.appendTo(b(".customize-themes-full-container")), d.container.add(d.headerContainer)
- })
- },
- onChangeExpanded: function(a, b) {
- function c() {
- 0 === d.loaded && d.loadThemes(), f.section.each(function(a) {
- var c;
- a !== d && "themes" === a.params.type && (c = a.contentContainer.find(".wp-filter-search").val(), d.contentContainer.find(".wp-filter-search").val(c), "" === c && "" !== d.term && "local" !== d.params.filter_type ? (d.term = "", d.initializeNewQuery(d.term, d.tags)) : "remote" === d.params.filter_type ? d.checkTerm(d) : "local" === d.params.filter_type && d.filterSearch(c), a.collapse({
- duration: b.duration
- }))
- }), d.contentContainer.addClass("current-section"), e.scrollTop(), e.on("scroll", _.throttle(d.renderScreenshots, 300)), e.on("scroll", _.throttle(d.loadMore, 300)), b.completeCallback && b.completeCallback(), d.updateCount()
}
- var d = this,
- e = d.contentContainer.closest(".customize-themes-full-container");
- if (b.unchanged) return void(b.completeCallback && b.completeCallback());
- a ? d.panel() && f.panel.has(d.panel()) ? f.panel(d.panel()).expand({
- duration: b.duration,
- completeCallback: c
- }) : c() : (d.contentContainer.removeClass("current-section"), d.headerContainer.find(".filter-details").slideUp(180), e.off("scroll"), b.completeCallback && b.completeCallback())
- },
- getContent: function() {
- return this.container.find(".control-section-content")
- },
- loadThemes: function() {
- var a, b, c, d = this;
- d.loading || (b = Math.ceil(d.loaded / 100) + 1, a = {
- nonce: f.settings.nonce.switch_themes,
- wp_customize: "on",
- theme_action: d.params.action,
- customized_theme: f.settings.theme.stylesheet,
- page: b
- }, "remote" === d.params.filter_type && (a.search = d.term, a.tags = d.tags), d.headContainer.closest(".wp-full-overlay").addClass("loading"), d.loading = !0, d.container.find(".no-themes").hide(), c = wp.ajax.post("customize_load_themes", a), c.done(function(a) {
- var c = a.themes;
- if ("" !== d.nextTerm || "" !== d.nextTags) return d.nextTerm && (d.term = d.nextTerm), d.nextTags && (d.tags = d.nextTags), d.nextTerm = "", d.nextTags = "", d.loading = !1, void d.loadThemes();
- 0 !== c.length ? (d.loadControls(c, b), 1 === b && (_.each(d.controls().slice(0, 3), function(a) {
- var b, c = a.params.theme.screenshot[0];
- c && (b = new Image, b.src = c)
- }), "local" !== d.params.filter_type && wp.a11y.speak(f.settings.l10n.themeSearchResults.replace("%d", a.info.results))), _.delay(d.renderScreenshots, 100), ("local" === d.params.filter_type || 100 > c.length) && (d.fullyLoaded = !0)) : 0 === d.loaded ? (d.container.find(".no-themes").show(), wp.a11y.speak(d.container.find(".no-themes").text())) : d.fullyLoaded = !0, "local" === d.params.filter_type ? d.updateCount() : d.updateCount(a.info.results), d.container.find(".unexpected-error").hide(), d.headContainer.closest(".wp-full-overlay").removeClass("loading"), d.loading = !1
- }), c.fail(function(a) {
- void 0 === a ? (d.container.find(".unexpected-error").show(), wp.a11y.speak(d.container.find(".unexpected-error").text())) : "undefined" != typeof console && console.error && console.error(a), d.headContainer.closest(".wp-full-overlay").removeClass("loading"), d.loading = !1
+ s.resolve(t)
+ }, a.installingThemes.push(o), n = wp.updates.installTheme({
+ slug: o
+ }), i && L.notifications.add(new L.OverlayNotification("theme_installing", {
+ message: L.l10n.themeDownloading,
+ type: "info",
+ loading: !0
+ })), n.done(t), n.fail(function() {
+ L.notifications.remove("theme_installing")
+ })) : s.reject({
+ errorCode: "theme_switch_unavailable"
+ }), s.promise()
+ },
+ loadThemePreview: function(e) {
+ var t, n, i, a = H.Deferred();
+ return this.canSwitchTheme(e) ? ((n = document.createElement("a")).href = location.href, i = _.extend(L.utils.parseQueryString(n.search.substr(1)), {
+ theme: e,
+ changeset_uuid: L.settings.changeset.uuid,
+ return: L.settings.url.return
+ }), L.state("saved").get() || (i.customize_autosaved = "on"), n.search = H.param(i), L.notifications.add(new L.OverlayNotification("theme_previewing", {
+ message: L.l10n.themePreviewWait,
+ type: "info",
+ loading: !0
+ })), t = function() {
+ var e;
+ 0 < L.state("processing").get() || (L.state("processing").unbind(t), (e = L.requestChangesetUpdate({}, {
+ autosave: !0
+ })).done(function() {
+ a.resolve(), H(window).off("beforeunload.customize-confirm"), location.replace(n.href)
+ }), e.fail(function() {
+ L.notifications.remove("theme_previewing"), a.reject()
}))
- },
- loadControls: function(a, b) {
- var c = [],
- d = this;
- _.each(a, function(a) {
- var b = new f.controlConstructor.theme(d.params.action + "_theme_" + a.id, {
- type: "theme",
- section: d.params.id,
- theme: a,
- priority: d.loaded + 1
- });
- f.control.add(b), c.push(b), d.loaded = d.loaded + 1
- }), 1 !== b && Array.prototype.push.apply(d.screenshotQueue, c)
- },
- loadMore: function() {
- var a, b, c, d = this;
- d.fullyLoaded || d.loading || (a = d.container.closest(".customize-themes-full-container"), b = a.scrollTop() + a.height(), c = a.prop("scrollHeight") - 3e3, b > c && d.loadThemes())
- },
- filterSearch: function(a) {
- var b, c = 0,
- d = !1,
- e = this,
- g = f.section.has("wporg_themes") && "remote" !== e.params.filter_type ? ".no-themes-local" : ".no-themes",
- h = e.controls();
- e.loading || (b = a.toLowerCase().trim().replace(/-/g, " ").split(" "), _.each(h, function(a) {
- (d = a.filter(b)) && (c += 1)
- }), 0 === c ? (e.container.find(g).show(), wp.a11y.speak(e.container.find(g).text())) : e.container.find(g).hide(), e.renderScreenshots(), f.reflowPaneContents(), e.updateCountDebounced(c))
- },
- checkTerm: function(a) {
- var b;
- "remote" === a.params.filter_type && (b = a.contentContainer.find(".wp-filter-search").val(), a.term !== b.trim() && a.initializeNewQuery(b, a.tags))
- },
- filtersChecked: function() {
- var a = this,
- c = a.container.find(".filter-group").find(":checkbox"),
- d = [];
- _.each(c.filter(":checked"), function(a) {
- d.push(b(a).prop("value"))
- }), 0 === d.length ? (d = "", a.contentContainer.find(".feature-filter-toggle .filter-count-0").show(), a.contentContainer.find(".feature-filter-toggle .filter-count-filters").hide()) : (a.contentContainer.find(".feature-filter-toggle .theme-filter-count").text(d.length), a.contentContainer.find(".feature-filter-toggle .filter-count-0").hide(), a.contentContainer.find(".feature-filter-toggle .filter-count-filters").show()), _.isEqual(a.tags, d) || (a.loading ? a.nextTags = d : "remote" === a.params.filter_type ? a.initializeNewQuery(a.term, d) : "local" === a.params.filter_type && a.filterSearch(d.join(" ")))
- },
- initializeNewQuery: function(a, b) {
- var c = this;
- _.each(c.controls(), function(a) {
- a.container.remove(), f.control.remove(a.id)
- }), c.loaded = 0, c.fullyLoaded = !1, c.screenshotQueue = null, c.loading ? (c.nextTerm = a, c.nextTags = b) : (c.term = a, c.tags = b, c.loadThemes()), c.expanded() || c.expand()
- },
- renderScreenshots: function() {
- var a = this;
- null !== a.screenshotQueue && 0 !== a.screenshotQueue.length || (a.screenshotQueue = _.filter(a.controls(), function(a) {
- return !a.screenshotRendered
- })), a.screenshotQueue.length && (a.screenshotQueue = _.filter(a.screenshotQueue, function(b) {
- var c = b.container.find(".theme-screenshot"),
- d = c.find("img");
- if (!d.length) return !1;
- if (d.is(":hidden")) return !0;
- var e = a.$window.scrollTop(),
- f = e + a.$window.height(),
- g = d.offset().top,
- h = c.height(),
- i = g + h,
- j = 3 * h,
- k = i >= e - j && g <= f + j;
- return k && b.container.trigger("render-screenshot"), !k
- }))
- },
- getVisibleCount: function() {
- return this.contentContainer.find("li.customize-control:visible").length
- },
- updateCount: function(a) {
- var b, c, d = this;
- a || 0 === a || (a = d.getVisibleCount()), c = d.contentContainer.find(".themes-displayed"), b = d.contentContainer.find(".theme-count"), 0 === a ? b.text("0") : (c.fadeOut(180, function() {
- b.text(a), c.fadeIn(180)
- }), wp.a11y.speak(f.settings.l10n.announceThemeCount.replace("%d", a)))
- },
- nextTheme: function() {
- var a = this;
- a.getNextTheme() && a.showDetails(a.getNextTheme(), function() {
- a.overlay.find(".right").focus()
- })
- },
- getNextTheme: function() {
- var a, b, c, d, e = this;
- return a = f.control(e.params.action + "_theme_" + e.currentTheme), c = e.controls(), -1 !== (d = _.indexOf(c, a)) && (!!(b = c[d + 1]) && b.params.theme)
- },
- previousTheme: function() {
- var a = this;
- a.getPreviousTheme() && a.showDetails(a.getPreviousTheme(), function() {
- a.overlay.find(".left").focus()
+ }, 0 === L.state("processing").get() ? t() : L.state("processing").bind(t)) : a.reject({
+ errorCode: "theme_switch_unavailable"
+ }), a.promise()
+ },
+ updateTheme: function(e) {
+ wp.updates.maybeRequestFilesystemCredentials(e), H(document).one("wp-theme-update-success", function(e, t) {
+ L.control.each(function(e) {
+ "theme" === e.params.type && e.params.theme.id === t.slug && (e.params.theme.hasUpdate = !1, e.params.theme.version = t.newVersion, setTimeout(function() {
+ e.rerenderAsInstalled(!0)
+ }, 2e3))
})
- },
- getPreviousTheme: function() {
- var a, b, c, d, e = this;
- return a = f.control(e.params.action + "_theme_" + e.currentTheme), c = e.controls(), -1 !== (d = _.indexOf(c, a)) && (!!(b = c[d - 1]) && b.params.theme)
- },
- updateLimits: function() {
- this.getNextTheme() || this.overlay.find(".right").addClass("disabled"), this.getPreviousTheme() || this.overlay.find(".left").addClass("disabled")
- },
- loadThemePreview: function(a) {
- return f.ThemesPanel.prototype.loadThemePreview.call(this, a)
- },
- showDetails: function(a, b) {
- function c() {
- return !e.canSwitchTheme(a.id)
- }
- var d = this,
- e = f.panel("themes");
- d.currentTheme = a.id, d.overlay.html(d.template(a)).fadeIn("fast").focus(), d.overlay.find("button.preview, button.preview-theme").toggleClass("disabled", c()), d.overlay.find("button.theme-install").toggleClass("disabled", function() {
- return c() || !1 === f.settings.theme._canInstall || !0 === f.settings.theme._filesystemCredentialsNeeded
- }()), d.$body.addClass("modal-open"), d.containFocus(d.overlay), d.updateLimits(), wp.a11y.speak(f.settings.l10n.announceThemeDetails.replace("%s", a.name)), b && b()
- },
- closeDetails: function() {
- var a = this;
- a.$body.removeClass("modal-open"), a.overlay.fadeOut("fast"), f.control(a.params.action + "_theme_" + a.currentTheme).container.find(".theme").focus()
- },
- containFocus: function(a) {
- var c;
- a.on("keydown", function(d) {
- if (9 === d.keyCode) return c = b(":tabbable", a), c.last()[0] !== d.target || d.shiftKey ? c.first()[0] === d.target && d.shiftKey ? (c.last().focus(), !1) : void 0 : (c.first().focus(), !1)
- })
- }
- }), f.OuterSection = f.Section.extend({
- initialize: function() {
- var a = this;
- a.containerParent = "#customize-outer-theme-controls", a.containerPaneParent = ".customize-outer-pane-parent", f.Section.prototype.initialize.apply(a, arguments)
- },
- onChangeExpanded: function(a, c) {
- var d, e, g = this,
- h = g.headContainer.closest(".wp-full-overlay-sidebar-content"),
- i = g.contentContainer,
- j = i.find(".customize-section-back"),
- k = g.headContainer.find(".accordion-section-title").first(),
- l = b(document.body);
- l.toggleClass("outer-section-open", a), g.container.toggleClass("open", a), g.container.removeClass("busy"), f.section.each(function(a) {
- "outer" === a.params.type && a.id !== g.id && a.container.removeClass("open")
- }), a && !i.hasClass("open") ? (d = c.unchanged ? c.completeCallback : b.proxy(function() {
- g._animateChangeExpanded(function() {
- k.attr("tabindex", "-1"), j.attr("tabindex", "0"), j.focus(), i.css("top", ""), h.scrollTop(0), c.completeCallback && c.completeCallback()
- }), i.addClass("open")
- }, this), g.panel() ? f.panel(g.panel()).expand({
- duration: c.duration,
- completeCallback: d
- }) : d()) : !a && i.hasClass("open") ? (g.panel() && (e = f.panel(g.panel()), e.contentContainer.hasClass("skip-transition") && e.collapse()), g._animateChangeExpanded(function() {
- j.attr("tabindex", "-1"), k.attr("tabindex", "0"), k.focus(), i.css("top", ""), c.completeCallback && c.completeCallback()
- }), i.removeClass("open")) : c.completeCallback && c.completeCallback()
- }
- }), f.Panel = c.extend({
- containerType: "panel",
- initialize: function(a, b) {
- var d, e = this;
- d = b.params || b, d.type || _.find(f.panelConstructor, function(a, b) {
- return a === e.constructor && (d.type = b, !0)
- }), c.prototype.initialize.call(e, a, d), e.embed(), e.deferred.embedded.done(function() {
- e.ready()
- })
- },
- embed: function() {
- var a = this,
- c = b("#customize-theme-controls"),
- d = b(".customize-pane-parent");
- a.headContainer.parent().is(d) || d.append(a.headContainer), a.contentContainer.parent().is(a.headContainer) || c.append(a.contentContainer), a.renderContent(), a.deferred.embedded.resolve()
- },
- attachEvents: function() {
- var a, c = this;
- c.headContainer.find(".accordion-section-title").on("click keydown", function(a) {
- f.utils.isKeydownButNotEnterEvent(a) || (a.preventDefault(), c.expanded() || c.expand())
- }), c.container.find(".customize-panel-back").on("click keydown", function(a) {
- f.utils.isKeydownButNotEnterEvent(a) || (a.preventDefault(), c.expanded() && c.collapse())
- }), a = c.container.find(".panel-meta:first"), a.find("> .accordion-section-title .customize-help-toggle").on("click", function() {
- if (!a.hasClass("cannot-expand")) {
- var d = a.find(".customize-panel-description:first");
- a.hasClass("open") ? (a.toggleClass("open"), d.slideUp(c.defaultExpandedArguments.duration, function() {
- d.trigger("toggled")
- }), b(this).attr("aria-expanded", !1)) : (d.slideDown(c.defaultExpandedArguments.duration, function() {
- d.trigger("toggled")
- }), a.toggleClass("open"), b(this).attr("aria-expanded", !0))
+ }), wp.updates.updateTheme({
+ slug: H(e.target).closest(".notice").data("slug")
+ })
+ },
+ deleteTheme: function(e) {
+ var t, n;
+ t = H(e.target).data("slug"), n = L.section("installed_themes"), e.preventDefault(), L.settings.theme._filesystemCredentialsNeeded || window.confirm(L.settings.l10n.confirmDeleteTheme) && (wp.updates.maybeRequestFilesystemCredentials(e), H(document).one("wp-theme-delete-success", function() {
+ var e = L.control("installed_theme_" + t);
+ e.container.remove(), L.control.remove(e.id), n.loaded = n.loaded - 1, n.updateCount(), L.control.each(function(e) {
+ "theme" === e.params.type && e.params.theme.id === t && e.rerenderAsInstalled(!1)
+ })
+ }), wp.updates.deleteTheme({
+ slug: t
+ }), n.closeDetails(), n.focus())
+ }
+ }), L.Control = L.Class.extend({
+ defaultActiveArguments: {
+ duration: "fast",
+ completeCallback: H.noop
+ },
+ defaults: {
+ label: "",
+ description: "",
+ active: !0,
+ priority: 10
+ },
+ initialize: function(e, t) {
+ var n, i, a = this,
+ o = [];
+ a.params = _.extend({}, a.defaults, a.params || {}, t.params || t || {}), L.Control.instanceCounter || (L.Control.instanceCounter = 0), L.Control.instanceCounter++, a.params.instanceNumber || (a.params.instanceNumber = L.Control.instanceCounter), a.params.type || _.find(L.controlConstructor, function(e, t) {
+ return e === a.constructor && (a.params.type = t, !0)
+ }), a.params.content || (a.params.content = H("<li></li>", {
+ id: "customize-control-" + e.replace(/]/g, "").replace(/\[/g, "-"),
+ class: "customize-control customize-control-" + a.params.type
+ })), a.id = e, a.selector = "#customize-control-" + e.replace(/\]/g, "").replace(/\[/g, "-"), a.params.content ? a.container = H(a.params.content) : a.container = H(a.selector), a.params.templateId ? a.templateSelector = a.params.templateId : a.templateSelector = "customize-control-" + a.params.type + "-content", a.deferred = _.extend(a.deferred || {}, {
+ embedded: new H.Deferred
+ }), a.section = new L.Value, a.priority = new L.Value, a.active = new L.Value, a.activeArgumentsQueue = [], a.notifications = new L.Notifications({
+ alt: a.altNotice
+ }), a.elements = [], a.active.bind(function(e) {
+ var t = a.activeArgumentsQueue.shift();
+ t = H.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), L.utils.bubbleChildValueChanges(a, ["section", "priority", "active"]), a.settings = {}, n = {}, a.params.setting && (n.default = a.params.setting), _.extend(n, a.params.settings), _.each(n, function(e, t) {
+ var n;
+ _.isObject(e) && _.isFunction(e.extended) && e.extended(L.Value) ? a.settings[t] = e : _.isString(e) && ((n = L(e)) ? a.settings[t] = n : o.push(e))
+ }), i = function() {
+ _.each(n, function(e, t) {
+ !a.settings[t] && _.isString(e) && (a.settings[t] = L(e))
+ }), a.settings[0] && !a.settings.default && (a.settings.default = a.settings[0]), a.setting = a.settings.default || null, a.linkElements(), a.embed()
+ }, 0 === o.length ? i() : L.apply(L, o.concat(i)), a.deferred.embedded.done(function() {
+ a.linkElements(), a.setupNotifications(), a.ready()
+ })
+ },
+ linkElements: function() {
+ var i, a, o, s = this;
+ i = s.container.find("[data-customize-setting-link], [data-customize-setting-key-link]"), a = {}, i.each(function() {
+ var e, t, n = H(this);
+ if (!n.data("customizeSettingLinked")) {
+ if (n.data("customizeSettingLinked", !0), n.is(":radio")) {
+ if (e = n.prop("name"), a[e]) return;
+ a[e] = !0, n = i.filter('[name="' + e + '"]')
}
- })
- },
- sections: function() {
- return this._children("panel", "section")
- },
- isContextuallyActive: function() {
- var a = this,
- b = a.sections(),
- c = 0;
- return _(b).each(function(a) {
- a.active() && a.isContextuallyActive() && (c += 1)
- }), 0 !== c
- },
- onChangeExpanded: function(a, b) {
- if (b.unchanged) return void(b.completeCallback && b.completeCallback());
- var c, d = this,
- e = d.contentContainer,
- g = e.closest(".wp-full-overlay"),
- h = e.closest(".wp-full-overlay-sidebar-content"),
- i = d.headContainer.find(".accordion-section-title"),
- j = e.find(".customize-panel-back"),
- k = d.sections();
- a && !e.hasClass("current-panel") ? (f.section.each(function(a) {
- d.id !== a.panel() && a.collapse({
- duration: 0
- })
- }), f.panel.each(function(a) {
- d !== a && a.collapse({
- duration: 0
- })
- }),
- d.params.autoExpandSoleSection && 1 === k.length && k[0].active.get() ? (e.addClass("current-panel skip-transition"), g.addClass("in-sub-panel"), k[0].expand({
- completeCallback: b.completeCallback
- })) : (d._animateChangeExpanded(function() {
- i.attr("tabindex", "-1"), j.attr("tabindex", "0"), j.focus(), e.css("top", ""), h.scrollTop(0), b.completeCallback && b.completeCallback()
- }), e.addClass("current-panel"), g.addClass("in-sub-panel")), f.state("expandedPanel").set(d)) : !a && e.hasClass("current-panel") && (c = e.hasClass("skip-transition"), c ? e.removeClass("skip-transition") : d._animateChangeExpanded(function() {
- i.attr("tabindex", "0"), j.attr("tabindex", "-1"), i.focus(), e.css("top", ""), b.completeCallback && b.completeCallback()
- }), g.removeClass("in-sub-panel"), e.removeClass("current-panel"), d === f.state("expandedPanel").get() && f.state("expandedPanel").set(!1))
- },
- renderContent: function() {
- var a, c = this;
- (a = 0 !== b("#tmpl-" + c.templateSelector + "-content").length ? wp.template(c.templateSelector + "-content") : wp.template("customize-panel-default-content")) && c.headContainer && c.contentContainer.html(a(_.extend({
- id: c.id
- }, c.params)))
- }
- }), f.ThemesPanel = f.Panel.extend({
- initialize: function(a, b) {
- var c = this;
- c.installingThemes = [], f.Panel.prototype.initialize.call(c, a, b)
- },
- canSwitchTheme: function(a) {
- return !(!a || a !== f.settings.theme.stylesheet) || "publish" === f.state("selectedChangesetStatus").get() && ("" === f.state("changesetStatus").get() || "auto-draft" === f.state("changesetStatus").get())
- },
- attachEvents: function() {
- function a() {
- c.canSwitchTheme() ? c.notifications.remove("theme_switch_unavailable") : c.notifications.add(new f.Notification("theme_switch_unavailable", {
- message: f.l10n.themePreviewUnavailable,
- type: "warning"
- }))
+ n.data("customizeSettingLink") ? t = L(n.data("customizeSettingLink")) : n.data("customizeSettingKeyLink") && (t = s.settings[n.data("customizeSettingKeyLink")]), t && (o = new L.Element(n), s.elements.push(o), o.sync(t), o.set(t()))
}
- var c = this;
- f.Panel.prototype.attachEvents.apply(c), f.settings.theme._canInstall && f.settings.theme._filesystemCredentialsNeeded && c.notifications.add(new f.Notification("theme_install_unavailable", {
- message: f.l10n.themeInstallUnavailable,
- type: "info",
- dismissible: !0
- })), a(), f.state("selectedChangesetStatus").bind(a), f.state("changesetStatus").bind(a), c.contentContainer.on("click", ".customize-theme", function() {
- c.collapse()
- }), c.contentContainer.on("click", ".customize-themes-section-title, .customize-themes-mobile-back", function() {
- b(".wp-full-overlay").toggleClass("showing-themes")
- }), c.contentContainer.on("click", ".theme-install", function(a) {
- c.installTheme(a)
- }), c.contentContainer.on("click", ".update-theme, #update-theme", function(a) {
- a.preventDefault(), a.stopPropagation(), c.updateTheme(a)
- }), c.contentContainer.on("click", ".delete-theme", function(a) {
- c.deleteTheme(a)
- }), _.bindAll(c, "installTheme", "updateTheme")
- },
- onChangeExpanded: function(a, b) {
- var c, d, e = this,
- g = !1;
- if (f.Panel.prototype.onChangeExpanded.apply(this, [a, b]), b.unchanged) return void(b.completeCallback && b.completeCallback());
- c = e.headContainer.closest(".wp-full-overlay"), a ? (c.addClass("in-themes-panel").delay(200).find(".customize-themes-full-container").addClass("animate"), _.delay(function() {
- c.addClass("themes-panel-expanded")
- }, 200), 600 < window.innerWidth && (d = e.sections(), _.each(d, function(a) {
- a.expanded() && (g = !0)
- }), !g && d.length > 0 && d[0].expand())) : c.removeClass("in-themes-panel themes-panel-expanded").find(".customize-themes-full-container").removeClass("animate")
- },
- installTheme: function(a) {
- var c, d, e, g = this,
- h = b(a.target).data("slug"),
- i = b.Deferred();
- return c = b(a.target).hasClass("preview"), f.settings.theme._filesystemCredentialsNeeded ? (i.reject({
- errorCode: "theme_install_unavailable"
- }), i.promise()) : g.canSwitchTheme(h) ? _.contains(g.installingThemes, h) ? (i.reject({
- errorCode: "theme_already_installing"
- }), i.promise()) : (wp.updates.maybeRequestFilesystemCredentials(a), d = function(a) {
- var b, d = !1;
- if (c) f.notifications.remove("theme_installing"), g.loadThemePreview(h);
- else {
- if (f.control.each(function(b) {
- "theme" === b.params.type && b.params.theme.id === a.slug && (d = b.params.theme, b.rerenderAsInstalled(!0))
- }), !d || f.control.has("installed_theme_" + d.id)) return void i.resolve(a);
- d.type = "installed", b = new f.controlConstructor.theme("installed_theme_" + d.id, {
- type: "theme",
- section: "installed_themes",
- theme: d,
- priority: 0
- }), f.control.add(b), f.control(b.id).container.trigger("render-screenshot"), f.section.each(function(a) {
- "themes" === a.params.type && d.id === a.currentTheme && a.closeDetails()
- })
- }
- i.resolve(a)
- }, g.installingThemes.push(h), e = wp.updates.installTheme({
- slug: h
- }), c && f.notifications.add(new f.OverlayNotification("theme_installing", {
- message: f.l10n.themeDownloading,
- type: "info",
- loading: !0
- })), e.done(d), e.fail(function() {
- f.notifications.remove("theme_installing")
- }), i.promise()) : (i.reject({
- errorCode: "theme_switch_unavailable"
- }), i.promise())
- },
- loadThemePreview: function(a) {
- var c, d, e, g = this,
- h = b.Deferred();
- return g.canSwitchTheme(a) ? (d = document.createElement("a"), d.href = location.href, e = _.extend(f.utils.parseQueryString(d.search.substr(1)), {
- theme: a,
- changeset_uuid: f.settings.changeset.uuid,
- "return": f.settings.url["return"]
- }), f.state("saved").get() || (e.customize_autosaved = "on"), d.search = b.param(e), f.notifications.add(new f.OverlayNotification("theme_previewing", {
- message: f.l10n.themePreviewWait,
- type: "info",
- loading: !0
- })), c = function() {
- var a;
- f.state("processing").get() > 0 || (f.state("processing").unbind(c), a = f.requestChangesetUpdate({}, {
- autosave: !0
- }), a.done(function() {
- h.resolve(), b(window).off("beforeunload.customize-confirm"), location.replace(d.href)
- }), a.fail(function() {
- f.notifications.remove("theme_previewing"), h.reject()
- }))
- }, 0 === f.state("processing").get() ? c() : f.state("processing").bind(c), h.promise()) : (h.reject({
- errorCode: "theme_switch_unavailable"
- }), h.promise())
- },
- updateTheme: function(a) {
- wp.updates.maybeRequestFilesystemCredentials(a), b(document).one("wp-theme-update-success", function(a, b) {
- f.control.each(function(a) {
- "theme" === a.params.type && a.params.theme.id === b.slug && (a.params.theme.hasUpdate = !1, a.params.theme.version = b.newVersion, setTimeout(function() {
- a.rerenderAsInstalled(!0)
- }, 2e3))
+ })
+ },
+ embed: function() {
+ var e, n = this;
+ e = function(e) {
+ var t;
+ e && L.section(e, function(e) {
+ e.deferred.embedded.done(function() {
+ t = e.contentContainer.is("ul") ? e.contentContainer : e.contentContainer.find("ul:first"), n.container.parent().is(t) || (t.append(n.container), n.renderContent()), n.deferred.embedded.resolve()
})
- }), wp.updates.updateTheme({
- slug: b(a.target).closest(".notice").data("slug")
})
- },
- deleteTheme: function(a) {
- var c, d;
- c = b(a.target).data("slug"), d = f.section("installed_themes"), a.preventDefault(), f.settings.theme._filesystemCredentialsNeeded || window.confirm(f.settings.l10n.confirmDeleteTheme) && (wp.updates.maybeRequestFilesystemCredentials(a), b(document).one("wp-theme-delete-success", function() {
- var a = f.control("installed_theme_" + c);
- a.container.remove(), f.control.remove(a.id), d.loaded = d.loaded - 1, d.updateCount(), f.control.each(function(a) {
- "theme" === a.params.type && a.params.theme.id === c && a.rerenderAsInstalled(!1)
- })
- }), wp.updates.deleteTheme({
- slug: c
- }), d.closeDetails(), d.focus())
- }
- }), f.Control = f.Class.extend({
- defaultActiveArguments: {
- duration: "fast",
- completeCallback: b.noop
- },
- defaults: {
- label: "",
- description: "",
- active: !0,
- priority: 10
- },
- initialize: function(a, c) {
- var d, e, g = this,
- h = [];
- g.params = _.extend({}, g.defaults, g.params || {}, c.params || c || {}), f.Control.instanceCounter || (f.Control.instanceCounter = 0), f.Control.instanceCounter++, g.params.instanceNumber || (g.params.instanceNumber = f.Control.instanceCounter), g.params.type || _.find(f.controlConstructor, function(a, b) {
- return a === g.constructor && (g.params.type = b, !0)
- }), g.params.content || (g.params.content = b("<li></li>", {
- id: "customize-control-" + a.replace(/]/g, "").replace(/\[/g, "-"),
- "class": "customize-control customize-control-" + g.params.type
- })), g.id = a, g.selector = "#customize-control-" + a.replace(/\]/g, "").replace(/\[/g, "-"), g.params.content ? g.container = b(g.params.content) : g.container = b(g.selector), g.params.templateId ? g.templateSelector = g.params.templateId : g.templateSelector = "customize-control-" + g.params.type + "-content", g.deferred = _.extend(g.deferred || {}, {
- embedded: new b.Deferred
- }), g.section = new f.Value, g.priority = new f.Value, g.active = new f.Value, g.activeArgumentsQueue = [], g.notifications = new f.Notifications({
- alt: g.altNotice
- }), g.elements = [], g.active.bind(function(a) {
- var c = g.activeArgumentsQueue.shift();
- c = b.extend({}, g.defaultActiveArguments, c), g.onChangeActive(a, c)
- }), g.section.set(g.params.section), g.priority.set(isNaN(g.params.priority) ? 10 : g.params.priority), g.active.set(g.params.active), f.utils.bubbleChildValueChanges(g, ["section", "priority", "active"]), g.settings = {}, d = {}, g.params.setting && (d["default"] = g.params.setting), _.extend(d, g.params.settings), _.each(d, function(a, b) {
- var c;
- _.isObject(a) && _.isFunction(a.extended) && a.extended(f.Value) ? g.settings[b] = a : _.isString(a) && (c = f(a), c ? g.settings[b] = c : h.push(a))
- }), e = function() {
- _.each(d, function(a, b) {
- !g.settings[b] && _.isString(a) && (g.settings[b] = f(a))
- }), g.settings[0] && !g.settings["default"] && (g.settings["default"] = g.settings[0]), g.setting = g.settings["default"] || null, g.linkElements(), g.embed()
- }, 0 === h.length ? e() : f.apply(f, h.concat(e)), g.deferred.embedded.done(function() {
- g.linkElements(), g.setupNotifications(), g.ready()
- })
- },
- linkElements: function() {
- var a, c, d, e = this;
- a = e.container.find("[data-customize-setting-link], [data-customize-setting-key-link]"), c = {}, a.each(function() {
- var g, h, i = b(this);
- if (!i.data("customizeSettingLinked")) {
- if (i.data("customizeSettingLinked", !0), i.is(":radio")) {
- if (g = i.prop("name"), c[g]) return;
- c[g] = !0, i = a.filter('[name="' + g + '"]')
- }
- i.data("customizeSettingLink") ? h = f(i.data("customizeSettingLink")) : i.data("customizeSettingKeyLink") && (h = e.settings[i.data("customizeSettingKeyLink")]), h && (d = new f.Element(i), e.elements.push(d), d.sync(h), d.set(h()))
- }
- })
- },
- embed: function() {
- var a, b = this;
- a = function(a) {
- var c;
- a && f.section(a, function(a) {
- a.deferred.embedded.done(function() {
- c = a.contentContainer.is("ul") ? a.contentContainer : a.contentContainer.find("ul:first"), b.container.parent().is(c) || (c.append(b.container), b.renderContent()), b.deferred.embedded.resolve()
- })
- })
- }, b.section.bind(a), a(b.section.get())
- },
- ready: function() {
- var a, c = this;
- "dropdown-pages" === c.params.type && c.params.allow_addition && (a = c.container.find(".new-content-item"), a.hide(), c.container.on("click", ".add-new-toggle", function(c) {
- b(c.currentTarget).slideUp(180), a.slideDown(180), a.find(".create-item-input").focus()
- }), c.container.on("click", ".add-content", function() {
- c.addNewPage()
- }), c.container.on("keydown", ".create-item-input", function(a) {
- 13 === a.which && c.addNewPage()
+ }, n.section.bind(e), e(n.section.get())
+ },
+ ready: function() {
+ var t, n = this;
+ "dropdown-pages" === n.params.type && n.params.allow_addition && ((t = n.container.find(".new-content-item")).hide(), n.container.on("click", ".add-new-toggle", function(e) {
+ H(e.currentTarget).slideUp(180), t.slideDown(180), t.find(".create-item-input").focus()
+ }), n.container.on("click", ".add-content", function() {
+ n.addNewPage()
+ }), n.container.on("keydown", ".create-item-input", function(e) {
+ 13 === e.which && n.addNewPage()
+ }))
+ },
+ getNotificationsContainerElement: function() {
+ var e, t, n = this;
+ return (t = n.container.find(".customize-control-notifications-container:first")).length || (t = H('<div class="customize-control-notifications-container"></div>'), n.container.hasClass("customize-control-nav_menu_item") ? n.container.find(".menu-item-settings:first").prepend(t) : n.container.hasClass("customize-control-widget_form") ? n.container.find(".widget-inside:first").prepend(t) : (e = n.container.find(".customize-control-title")).length ? e.after(t) : n.container.prepend(t)), t
+ },
+ setupNotifications: function() {
+ var n, e, i = this;
+ _.each(i.settings, function(n) {
+ n.notifications && (n.notifications.bind("add", function(e) {
+ var t = _.extend({}, e, {
+ setting: n.id
+ });
+ i.notifications.add(new L.Notification(n.id + ":" + e.code, t))
+ }), n.notifications.bind("remove", function(e) {
+ i.notifications.remove(n.id + ":" + e.code)
}))
- },
- getNotificationsContainerElement: function() {
- var a, c, d = this;
- return c = d.container.find(".customize-control-notifications-container:first"), c.length ? c : (c = b('<div class="customize-control-notifications-container"></div>'), d.container.hasClass("customize-control-nav_menu_item") ? d.container.find(".menu-item-settings:first").prepend(c) : d.container.hasClass("customize-control-widget_form") ? d.container.find(".widget-inside:first").prepend(c) : (a = d.container.find(".customize-control-title"), a.length ? a.after(c) : d.container.prepend(c)), c)
- },
- setupNotifications: function() {
- var a, b, c = this;
- _.each(c.settings, function(a) {
- a.notifications && (a.notifications.bind("add", function(b) {
- var d = _.extend({}, b, {
- setting: a.id
- });
- c.notifications.add(new f.Notification(a.id + ":" + b.code, d))
- }), a.notifications.bind("remove", function(b) {
- c.notifications.remove(a.id + ":" + b.code)
- }))
- }), a = function() {
- var a = c.section();
- (!a || f.section.has(a) && f.section(a).expanded()) && c.notifications.render()
- }, c.notifications.bind("rendered", function() {
- var a = c.notifications.get();
- c.container.toggleClass("has-notifications", 0 !== a.length), c.container.toggleClass("has-error", 0 !== _.where(a, {
- type: "error"
- }).length)
- }), b = function(b, c) {
- c && f.section.has(c) && f.section(c).expanded.unbind(a), b && f.section(b, function(b) {
- b.expanded.bind(a), a()
- })
- }, c.section.bind(b), b(c.section.get()), c.notifications.bind("change", _.debounce(a))
- },
- renderNotifications: function() {
- var a, c, d = this,
- e = !1;
- "undefined" != typeof console && console.warn && console.warn("[DEPRECATED] wp.customize.Control.prototype.renderNotifications() is deprecated in favor of instantating a wp.customize.Notifications and calling its render() method."), (a = d.getNotificationsContainerElement()) && a.length && (c = [], d.notifications.each(function(a) {
- c.push(a), "error" === a.type && (e = !0)
- }), 0 === c.length ? a.stop().slideUp("fast") : a.stop().slideDown("fast", null, function() {
- b(this).css("height", "auto")
- }), d.notificationsTemplate || (d.notificationsTemplate = wp.template("customize-control-notifications")), d.container.toggleClass("has-notifications", 0 !== c.length), d.container.toggleClass("has-error", e), a.empty().append(b.trim(d.notificationsTemplate({
- notifications: c,
- altNotice: Boolean(d.altNotice)
- }))))
- },
- expand: function(a) {
- f.section(this.section()).expand(a)
- },
- focus: d,
- onChangeActive: function(a, c) {
- if (c.unchanged) return void(c.completeCallback && c.completeCallback());
- b.contains(document, this.container[0]) ? a ? this.container.slideDown(c.duration, c.completeCallback) : this.container.slideUp(c.duration, c.completeCallback) : (this.container.toggle(a), c.completeCallback && c.completeCallback())
- },
- toggle: function(a) {
- return this.onChangeActive(a, this.defaultActiveArguments)
- },
- activate: c.prototype.activate,
- deactivate: c.prototype.deactivate,
- _toggleActive: c.prototype._toggleActive,
- dropdownInit: function() {
- var a = this,
- b = this.container.find(".dropdown-status"),
- c = this.params,
- d = !1,
- e = function(a) {
- "string" == typeof a && c.statuses && c.statuses[a] ? b.html(c.statuses[a]).show() : b.hide()
- };
- this.container.on("click keydown", ".dropdown", function(b) {
- f.utils.isKeydownButNotEnterEvent(b) || (b.preventDefault(), d || a.container.toggleClass("open"), a.container.hasClass("open") && a.container.parent().parent().find("li.library-selected").focus(), d = !0, setTimeout(function() {
- d = !1
- }, 400))
- }), this.setting.bind(e), e(this.setting())
- },
- renderContent: function() {
- var a, b, c, d, e = this;
- b = ["button", "checkbox", "date", "datetime-local", "email", "month", "number", "password", "radio", "range", "search", "select", "tel", "time", "text", "textarea", "week", "url"], c = e.templateSelector, c === "customize-control-" + e.params.type + "-content" && _.contains(b, e.params.type) && !document.getElementById("tmpl-" + c) && 0 === e.container.children().length && (c = "customize-control-default-content"), document.getElementById("tmpl-" + c) && (a = wp.template(c)) && e.container && e.container.html(a(e.params)), e.notifications.container = e.getNotificationsContainerElement(), (!(d = e.section()) || f.section.has(d) && f.section(d).expanded()) && e.notifications.render()
- },
- addNewPage: function() {
- var a, c, d, e, g, h, i = this;
- if ("dropdown-pages" === i.params.type && i.params.allow_addition && f.Menus) {
- if (c = i.container.find(".add-new-toggle"), d = i.container.find(".new-content-item"), e = i.container.find(".create-item-input"), g = e.val(), h = i.container.find("select"), !g) return void e.addClass("invalid");
- e.removeClass("invalid"), e.attr("disabled", "disabled"), a = f.Menus.insertAutoDraftPost({
- post_title: g,
- post_type: "page"
- }), a.done(function(a) {
- var e, j, k;
- e = new f.Menus.AvailableItemModel({
- id: "post-" + a.post_id,
- title: g,
- type: "post_type",
- type_label: f.Menus.data.l10n.page_label,
- object: "page",
- object_id: a.post_id,
- url: a.url
- }), f.Menus.availableMenuItemsPanel.collection.add(e), j = b("#available-menu-items-post_type-page").find(".available-menu-items-list"), k = wp.template("available-menu-item"), j.prepend(k(e.attributes)), h.focus(), i.setting.set(String(a.post_id)), d.slideUp(180), c.slideDown(180)
- }), a.always(function() {
- e.val("").removeAttr("disabled")
- })
+ }), n = function() {
+ var e = i.section();
+ (!e || L.section.has(e) && L.section(e).expanded()) && i.notifications.render()
+ }, i.notifications.bind("rendered", function() {
+ var e = i.notifications.get();
+ i.container.toggleClass("has-notifications", 0 !== e.length), i.container.toggleClass("has-error", 0 !== _.where(e, {
+ type: "error"
+ }).length)
+ }), e = function(e, t) {
+ t && L.section.has(t) && L.section(t).expanded.unbind(n), e && L.section(e, function(e) {
+ e.expanded.bind(n), n()
+ })
+ }, i.section.bind(e), e(i.section.get()), i.notifications.bind("change", _.debounce(n))
+ },
+ renderNotifications: function() {
+ var e, t, n = this,
+ i = !1;
+ "undefined" != typeof console && console.warn && console.warn("[DEPRECATED] wp.customize.Control.prototype.renderNotifications() is deprecated in favor of instantating a wp.customize.Notifications and calling its render() method."), (e = n.getNotificationsContainerElement()) && e.length && (t = [], n.notifications.each(function(e) {
+ t.push(e), "error" === e.type && (i = !0)
+ }), 0 === t.length ? e.stop().slideUp("fast") : e.stop().slideDown("fast", null, function() {
+ H(this).css("height", "auto")
+ }), n.notificationsTemplate || (n.notificationsTemplate = wp.template("customize-control-notifications")), n.container.toggleClass("has-notifications", 0 !== t.length), n.container.toggleClass("has-error", i), e.empty().append(H.trim(n.notificationsTemplate({
+ notifications: t,
+ altNotice: Boolean(n.altNotice)
+ }))))
+ },
+ expand: function(e) {
+ L.section(this.section()).expand(e)
+ },
+ focus: t,
+ onChangeActive: function(e, t) {
+ t.unchanged ? t.completeCallback && t.completeCallback() : H.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: a.prototype.activate,
+ deactivate: a.prototype.deactivate,
+ _toggleActive: a.prototype._toggleActive,
+ dropdownInit: function() {
+ var t = this,
+ n = this.container.find(".dropdown-status"),
+ i = this.params,
+ a = !1,
+ e = function(e) {
+ "string" == typeof e && i.statuses && i.statuses[e] ? n.html(i.statuses[e]).show() : n.hide()
+ };
+ this.container.on("click keydown", ".dropdown", function(e) {
+ L.utils.isKeydownButNotEnterEvent(e) || (e.preventDefault(), a || t.container.toggleClass("open"), t.container.hasClass("open") && t.container.parent().parent().find("li.library-selected").focus(), a = !0, setTimeout(function() {
+ a = !1
+ }, 400))
+ }), this.setting.bind(e), e(this.setting())
+ },
+ renderContent: function() {
+ var e, t, n, i, a = this;
+ t = ["button", "checkbox", "date", "datetime-local", "email", "month", "number", "password", "radio", "range", "search", "select", "tel", "time", "text", "textarea", "week", "url"], (n = a.templateSelector) === "customize-control-" + a.params.type + "-content" && _.contains(t, a.params.type) && !document.getElementById("tmpl-" + n) && 0 === a.container.children().length && (n = "customize-control-default-content"), document.getElementById("tmpl-" + n) && (e = wp.template(n)) && a.container && a.container.html(e(a.params)), a.notifications.container = a.getNotificationsContainerElement(), (!(i = a.section()) || L.section.has(i) && L.section(i).expanded()) && a.notifications.render()
+ },
+ addNewPage: function() {
+ var e, a, o, t, s, r, c = this;
+ "dropdown-pages" === c.params.type && c.params.allow_addition && L.Menus && (a = c.container.find(".add-new-toggle"), o = c.container.find(".new-content-item"), t = c.container.find(".create-item-input"), s = t.val(), r = c.container.find("select"), s ? (t.removeClass("invalid"), t.attr("disabled", "disabled"), (e = L.Menus.insertAutoDraftPost({
+ post_title: s,
+ post_type: "page"
+ })).done(function(e) {
+ var t, n, i;
+ t = new L.Menus.AvailableItemModel({
+ id: "post-" + e.post_id,
+ title: s,
+ type: "post_type",
+ type_label: L.Menus.data.l10n.page_label,
+ object: "page",
+ object_id: e.post_id,
+ url: e.url
+ }), L.Menus.availableMenuItemsPanel.collection.add(t), n = H("#available-menu-items-post_type-page").find(".available-menu-items-list"), i = wp.template("available-menu-item"), n.prepend(i(t.attributes)), r.focus(), c.setting.set(String(e.post_id)), o.slideUp(180), a.slideDown(180)
+ }), e.always(function() {
+ t.val("").removeAttr("disabled")
+ })) : t.addClass("invalid"))
+ }
+ }), L.ColorControl = L.Control.extend({
+ ready: function() {
+ var t, n = this,
+ e = "hue" === this.params.mode,
+ i = !1;
+ e ? (t = this.container.find(".color-picker-hue")).val(n.setting()).wpColorPicker({
+ change: function(e, t) {
+ i = !0, n.setting(t.color.h()), i = !1
}
- }
- }), f.ColorControl = f.Control.extend({
- ready: function() {
- var a, b = this,
- c = "hue" === this.params.mode,
- d = !1;
- c ? (a = this.container.find(".color-picker-hue"), a.val(b.setting()).wpColorPicker({
- change: function(a, c) {
- d = !0, b.setting(c.color.h()), d = !1
- }
- })) : (a = this.container.find(".color-picker-hex"), a.val(b.setting()).wpColorPicker({
- change: function() {
- d = !0, b.setting.set(a.wpColorPicker("color")), d = !1
- },
- clear: function() {
- d = !0, b.setting.set(""), d = !1
- }
- })), b.setting.bind(function(b) {
- d || (a.val(b), a.wpColorPicker("color", b))
- }), b.container.on("keydown", function(c) {
- var d;
- 27 === c.which && (d = b.container.find(".wp-picker-container"), d.hasClass("wp-picker-active") && (a.wpColorPicker("close"), b.container.find(".wp-color-result").focus(), c.stopPropagation()))
- })
- }
- }), f.MediaControl = f.Control.extend({
- ready: function() {
- function a(a) {
- var d = b.Deferred();
- c.extended(f.UploadControl) ? d.resolve() : (a = parseInt(a, 10), _.isNaN(a) || a <= 0 ? (delete c.params.attachment, d.resolve()) : c.params.attachment && c.params.attachment.id === a && d.resolve()), "pending" === d.state() && wp.media.attachment(a).fetch().done(function() {
- c.params.attachment = this.attributes, d.resolve(), wp.customize.previewer.send(c.setting.id + "-attachment-data", this.attributes)
- }), d.done(function() {
- c.renderContent()
- })
+ }) : (t = this.container.find(".color-picker-hex")).val(n.setting()).wpColorPicker({
+ change: function() {
+ i = !0, n.setting.set(t.wpColorPicker("color")), i = !1
+ },
+ clear: function() {
+ i = !0, n.setting.set(""), i = !1
}
- var c = this;
- _.bindAll(c, "restoreDefault", "removeFile", "openFrame", "select", "pausePlayer"), c.container.on("click keydown", ".upload-button", c.openFrame), c.container.on("click keydown", ".upload-button", c.pausePlayer), c.container.on("click keydown", ".thumbnail-image img", c.openFrame), c.container.on("click keydown", ".default-button", c.restoreDefault), c.container.on("click keydown", ".remove-button", c.pausePlayer), c.container.on("click keydown", ".remove-button", c.removeFile), c.container.on("click keydown", ".remove-button", c.cleanupPlayer), f.section(c.section()).container.on("expanded", function() {
- c.player && c.player.setControlsSize()
- }).on("collapsed", function() {
- c.pausePlayer()
- }), a(c.setting()), c.setting.bind(a)
- },
- pausePlayer: function() {
- this.player && this.player.pause()
- },
- cleanupPlayer: function() {
- this.player && wp.media.mixin.removePlayer(this.player)
- },
- openFrame: function(a) {
- f.utils.isKeydownButNotEnterEvent(a) || (a.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 a, b = this.frame.state().get("selection").first().toJSON(),
- c = window._wpmejsSettings || {};
- this.params.attachment = b, this.setting(b.id), a = this.container.find("audio, video").get(0), a ? this.player = new MediaElementPlayer(a, c) : this.cleanupPlayer()
- },
- restoreDefault: function(a) {
- f.utils.isKeydownButNotEnterEvent(a) || (a.preventDefault(), this.params.attachment = this.params.defaultAttachment, this.setting(this.params.defaultAttachment.url))
- },
- removeFile: function(a) {
- f.utils.isKeydownButNotEnterEvent(a) || (a.preventDefault(), this.params.attachment = {}, this.setting(""), this.renderContent())
- }
- }), f.UploadControl = f.MediaControl.extend({
- select: function() {
- var a, b = this.frame.state().get("selection").first().toJSON(),
- c = window._wpmejsSettings || {};
- this.params.attachment = b, this.setting(b.url), a = this.container.find("audio, video").get(0), a ? this.player = new MediaElementPlayer(a, c) : this.cleanupPlayer()
- },
- success: function() {},
- removerVisibility: function() {}
- }), f.ImageControl = f.UploadControl.extend({
- thumbnailSrc: function() {}
- }), f.BackgroundControl = f.UploadControl.extend({
- ready: function() {
- f.UploadControl.prototype.ready.apply(this, arguments)
- },
- select: function() {
- f.UploadControl.prototype.select.apply(this, arguments), wp.ajax.post("custom-background-add", {
- nonce: _wpCustomizeBackground.nonces.add,
- wp_customize: "on",
- customize_theme: f.settings.theme.stylesheet,
- attachment_id: this.params.attachment.id
- })
- }
- }), f.BackgroundPositionControl = f.Control.extend({
- ready: function() {
- var a, c = this;
- c.container.on("change", 'input[name="background-position"]', function() {
- var a = b(this).val().split(" ");
- c.settings.x(a[0]), c.settings.y(a[1])
- }), a = _.debounce(function() {
- var a, b, d, e;
- a = c.settings.x.get(), b = c.settings.y.get(), e = String(a) + " " + String(b), d = c.container.find('input[name="background-position"][value="' + e + '"]'), d.click()
- }), c.settings.x.bind(a), c.settings.y.bind(a), a()
- }
- }), f.CroppedImageControl = f.MediaControl.extend({
- openFrame: function(a) {
- f.utils.isKeydownButNotEnterEvent(a) || (this.initFrame(), this.frame.setState("library").open())
- },
- initFrame: function() {
- var a = _wpMediaViewsL10n;
- this.frame = wp.media({
- button: {
- text: a.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 a = this.frame.state().get("selection").first().toJSON();
- this.params.width !== a.width || this.params.height !== a.height || this.params.flex_width || this.params.flex_height ? this.frame.setState("cropper") : (this.setImageFromAttachment(a), this.frame.close())
- },
- onCropped: function(a) {
- this.setImageFromAttachment(a)
- },
- calculateImageSelectOptions: function(a, b) {
- var c, d, e, f = b.get("control"),
- g = !!parseInt(f.params.flex_width, 10),
- h = !!parseInt(f.params.flex_height, 10),
- i = a.get("width"),
- j = a.get("height"),
- k = parseInt(f.params.width, 10),
- l = parseInt(f.params.height, 10),
- m = k / l,
- n = k,
- o = l;
- return b.set("canSkipCrop", !f.mustBeCropped(g, h, k, l, i, j)), i / j > m ? (l = j, k = l * m) : (k = i, l = k / m), c = (i - k) / 2, d = (j - l) / 2, e = {
- handles: !0,
- keys: !0,
- instance: !0,
- persistent: !0,
- imageWidth: i,
- imageHeight: j,
- minWidth: n > k ? k : n,
- minHeight: o > l ? l : o,
- x1: c,
- y1: d,
- x2: k + c,
- y2: l + d
- }, !1 === h && !1 === g && (e.aspectRatio = k + ":" + l), !0 === h && (delete e.minHeight, e.maxWidth = i), !0 === g && (delete e.minWidth, e.maxHeight = j), e
- },
- mustBeCropped: function(a, b, c, d, e, f) {
- return (!0 !== a || !0 !== b) && ((!0 !== a || d !== f) && ((!0 !== b || c !== e) && ((c !== e || d !== f) && !(e <= c))))
- },
- onSkippedCrop: function() {
- var a = this.frame.state().get("selection").first().toJSON();
- this.setImageFromAttachment(a)
- },
- setImageFromAttachment: function(a) {
- this.params.attachment = a, this.setting(a.id)
- }
- }), f.SiteIconControl = f.CroppedImageControl.extend({
- initFrame: function() {
- var a = _wpMediaViewsL10n;
- this.frame = wp.media({
- button: {
- text: a.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 a = this.frame.state().get("selection").first().toJSON(),
- b = this;
- this.params.width !== a.width || this.params.height !== a.height || this.params.flex_width || this.params.flex_height ? this.frame.setState("cropper") : wp.ajax.post("crop-image", {
- nonce: a.nonces.edit,
- id: a.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(a) {
- b.setImageFromAttachment(a), b.frame.close()
- }).fail(function() {
- b.frame.trigger("content:error:crop")
- })
- },
- setImageFromAttachment: function(a) {
- var c, d, e = ["site_icon-32", "thumbnail", "full"];
- _.each(e, function(b) {
- d || _.isUndefined(a.sizes[b]) || (d = a.sizes[b])
- }), this.params.attachment = a, this.setting(a.id), d && (c = b('link[rel="icon"][sizes="32x32"]'), c.attr("href", d.url))
- },
- removeFile: function(a) {
- f.utils.isKeydownButNotEnterEvent(a) || (a.preventDefault(), this.params.attachment = {}, this.setting(""), this.renderContent(), b('link[rel="icon"][sizes="32x32"]').attr("href", "/favicon.ico"))
- }
- }), f.HeaderControl = f.Control.extend({
- ready: function() {
- this.btnRemove = b("#customize-control-header_image .actions .remove"), this.btnNew = b("#customize-control-header_image .actions .new"), _.bindAll(this, "openMedia", "removeImage"), this.btnNew.on("click", this.openMedia), this.btnRemove.on("click", this.removeImage), f.HeaderTool.currentHeader = this.getInitialHeaderImage(), new f.HeaderTool.CurrentView({
- model: f.HeaderTool.currentHeader,
- el: "#customize-control-header_image .current .container"
- }), new f.HeaderTool.ChoiceListView({
- collection: f.HeaderTool.UploadsList = new f.HeaderTool.ChoiceList,
- el: "#customize-control-header_image .choices .uploaded .list"
- }), new f.HeaderTool.ChoiceListView({
- collection: f.HeaderTool.DefaultsList = new f.HeaderTool.DefaultsList,
- el: "#customize-control-header_image .choices .default .list"
- }), f.HeaderTool.combinedList = f.HeaderTool.CombinedList = new f.HeaderTool.CombinedList([f.HeaderTool.UploadsList, f.HeaderTool.DefaultsList]), wp.media.controller.Cropper.prototype.defaults.doCropArgs.wp_customize = "on", wp.media.controller.Cropper.prototype.defaults.doCropArgs.customize_theme = f.settings.theme.stylesheet
- },
- getInitialHeaderImage: function() {
- if (!f.get().header_image || !f.get().header_image_data || _.contains(["remove-header", "random-default-image", "random-uploaded-image"], f.get().header_image)) return new f.HeaderTool.ImageModel;
- var a = _.find(_wpCustomizeHeader.uploads, function(a) {
- return a.attachment_id === f.get().header_image_data.attachment_id
- });
- return a || (a = {
- url: f.get().header_image,
- thumbnail_url: f.get().header_image,
- attachment_id: f.get().header_image_data.attachment_id
- }), new f.HeaderTool.ImageModel({
- header: a,
- choice: a.url.split("/").pop()
- })
- },
- calculateImageSelectOptions: function(a, b) {
- var c, d, e, g, h, i, j = parseInt(_wpCustomizeHeader.data.width, 10),
- k = parseInt(_wpCustomizeHeader.data.height, 10),
- l = !!parseInt(_wpCustomizeHeader.data["flex-width"], 10),
- m = !!parseInt(_wpCustomizeHeader.data["flex-height"], 10);
- return h = a.get("width"), g = a.get("height"), this.headerImage = new f.HeaderTool.ImageModel, this.headerImage.set({
- themeWidth: j,
- themeHeight: k,
- themeFlexWidth: l,
- themeFlexHeight: m,
- imageWidth: h,
- imageHeight: g
- }), b.set("canSkipCrop", !this.headerImage.shouldBeCropped()), c = j / k, d = h, e = g, d / e > c ? (k = e, j = k * c) : (j = d, k = j / c), i = {
- handles: !0,
- keys: !0,
- instance: !0,
- persistent: !0,
- imageWidth: h,
- imageHeight: g,
+ }), n.setting.bind(function(e) {
+ i || (t.val(e), t.wpColorPicker("color", e))
+ }), n.container.on("keydown", function(e) {
+ 27 === e.which && n.container.find(".wp-picker-container").hasClass("wp-picker-active") && (t.wpColorPicker("close"), n.container.find(".wp-color-result").focus(), e.stopPropagation())
+ })
+ }
+ }), L.MediaControl = L.Control.extend({
+ ready: function() {
+ var n = this;
+
+ function e(e) {
+ var t = H.Deferred();
+ n.extended(L.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), L.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) {
+ L.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, t = this.frame.state().get("selection").first().toJSON(),
+ n = window._wpmejsSettings || {};
+ this.params.attachment = t, this.setting(t.id), (e = this.container.find("audio, video").get(0)) ? this.player = new MediaElementPlayer(e, n) : this.cleanupPlayer()
+ },
+ restoreDefault: function(e) {
+ L.utils.isKeydownButNotEnterEvent(e) || (e.preventDefault(), this.params.attachment = this.params.defaultAttachment, this.setting(this.params.defaultAttachment.url))
+ },
+ removeFile: function(e) {
+ L.utils.isKeydownButNotEnterEvent(e) || (e.preventDefault(), this.params.attachment = {}, this.setting(""), this.renderContent())
+ }
+ }), L.UploadControl = L.MediaControl.extend({
+ select: function() {
+ var e, t = this.frame.state().get("selection").first().toJSON(),
+ n = window._wpmejsSettings || {};
+ this.params.attachment = t, this.setting(t.url), (e = this.container.find("audio, video").get(0)) ? this.player = new MediaElementPlayer(e, n) : this.cleanupPlayer()
+ },
+ success: function() {},
+ removerVisibility: function() {}
+ }), L.ImageControl = L.UploadControl.extend({
+ thumbnailSrc: function() {}
+ }), L.BackgroundControl = L.UploadControl.extend({
+ ready: function() {
+ L.UploadControl.prototype.ready.apply(this, arguments)
+ },
+ select: function() {
+ L.UploadControl.prototype.select.apply(this, arguments), wp.ajax.post("custom-background-add", {
+ nonce: _wpCustomizeBackground.nonces.add,
+ wp_customize: "on",
+ customize_theme: L.settings.theme.stylesheet,
+ attachment_id: this.params.attachment.id
+ })
+ }
+ }), L.BackgroundPositionControl = L.Control.extend({
+ ready: function() {
+ var e, i = this;
+ i.container.on("change", 'input[name="background-position"]', function() {
+ var e = H(this).val().split(" ");
+ i.settings.x(e[0]), i.settings.y(e[1])
+ }), e = _.debounce(function() {
+ var e, t, n;
+ e = i.settings.x.get(), t = i.settings.y.get(), n = String(e) + " " + String(t), i.container.find('input[name="background-position"][value="' + n + '"]').click()
+ }), i.settings.x.bind(e), i.settings.y.bind(e), e()
+ }
+ }), L.CroppedImageControl = L.MediaControl.extend({
+ openFrame: function(e) {
+ L.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, i, a, o = t.get("control"),
+ s = !!parseInt(o.params.flex_width, 10),
+ r = !!parseInt(o.params.flex_height, 10),
+ c = e.get("width"),
+ l = e.get("height"),
+ d = parseInt(o.params.width, 10),
+ u = parseInt(o.params.height, 10),
+ p = d / u,
+ h = d,
+ f = u;
+ return t.set("canSkipCrop", !o.mustBeCropped(s, r, d, u, c, l)), p < c / l ? d = (u = l) * p : u = (d = c) / p, !(a = {
+ handles: !0,
+ keys: !0,
+ instance: !0,
+ persistent: !0,
+ imageWidth: c,
+ imageHeight: l,
+ minWidth: d < h ? d : h,
+ minHeight: u < f ? u : f,
+ x1: n = (c - d) / 2,
+ y1: i = (l - u) / 2,
+ x2: d + n,
+ y2: u + i
+ }) === r && !1 === s && (a.aspectRatio = d + ":" + u), !0 === r && (delete a.minHeight, a.maxWidth = c), !0 === s && (delete a.minWidth, a.maxHeight = l), a
+ },
+ mustBeCropped: function(e, t, n, i, a, o) {
+ return (!0 !== e || !0 !== t) && ((!0 !== e || i !== o) && ((!0 !== t || n !== a) && ((n !== a || i !== o) && !(a <= 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)
+ }
+ }), L.SiteIconControl = L.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,
- x2: j,
- y2: k
- }, !1 === m && !1 === l && (i.aspectRatio = j + ":" + k), !1 === m && (i.maxHeight = k), !1 === l && (i.maxWidth = j), i
- },
- openMedia: function(a) {
- var b = _wpMediaViewsL10n;
- a.preventDefault(), this.frame = wp.media({
- button: {
- text: b.selectAndCrop,
- close: !1
- },
- states: [new wp.media.controller.Library({
- title: b.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(a) {
- var b = a.url,
- c = a.attachment_id,
- d = a.width,
- e = a.height;
- this.setImageFromURL(b, c, d, e)
- },
- onSkippedCrop: function(a) {
- var b = a.get("url"),
- c = a.get("width"),
- d = a.get("height");
- this.setImageFromURL(b, a.id, c, d)
- },
- setImageFromURL: function(a, b, c, d) {
- var e, g = {};
- g.url = a, g.thumbnail_url = a, g.timestamp = _.now(), b && (g.attachment_id = b), c && (g.width = c), d && (g.height = d), e = new f.HeaderTool.ImageModel({
- header: g,
- choice: a.split("/").pop()
- }), f.HeaderTool.UploadsList.add(e), f.HeaderTool.currentHeader.set(e.toJSON()), e.save(), e.importImage()
- },
- removeImage: function() {
- f.HeaderTool.currentHeader.trigger("hide"), f.HeaderTool.CombinedList.trigger("control:removeImage")
- }
- }), f.ThemeControl = f.Control.extend({
- touchDrag: !1,
- screenshotRendered: !1,
- ready: function() {
- function a() {
- return !g.canSwitchTheme(e.params.theme.id)
+ 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), n && H('link[rel="icon"][sizes="32x32"]').attr("href", n.url)
+ },
+ removeFile: function(e) {
+ L.utils.isKeydownButNotEnterEvent(e) || (e.preventDefault(), this.params.attachment = {}, this.setting(""), this.renderContent(), H('link[rel="icon"][sizes="32x32"]').attr("href", "/favicon.ico"))
+ }
+ }), L.HeaderControl = L.Control.extend({
+ ready: function() {
+ this.btnRemove = H("#customize-control-header_image .actions .remove"), this.btnNew = H("#customize-control-header_image .actions .new"), _.bindAll(this, "openMedia", "removeImage"), this.btnNew.on("click", this.openMedia), this.btnRemove.on("click", this.removeImage), L.HeaderTool.currentHeader = this.getInitialHeaderImage(), new L.HeaderTool.CurrentView({
+ model: L.HeaderTool.currentHeader,
+ el: "#customize-control-header_image .current .container"
+ }), new L.HeaderTool.ChoiceListView({
+ collection: L.HeaderTool.UploadsList = new L.HeaderTool.ChoiceList,
+ el: "#customize-control-header_image .choices .uploaded .list"
+ }), new L.HeaderTool.ChoiceListView({
+ collection: L.HeaderTool.DefaultsList = new L.HeaderTool.DefaultsList,
+ el: "#customize-control-header_image .choices .default .list"
+ }), L.HeaderTool.combinedList = L.HeaderTool.CombinedList = new L.HeaderTool.CombinedList([L.HeaderTool.UploadsList, L.HeaderTool.DefaultsList]), wp.media.controller.Cropper.prototype.defaults.doCropArgs.wp_customize = "on", wp.media.controller.Cropper.prototype.defaults.doCropArgs.customize_theme = L.settings.theme.stylesheet
+ },
+ getInitialHeaderImage: function() {
+ if (!L.get().header_image || !L.get().header_image_data || _.contains(["remove-header", "random-default-image", "random-uploaded-image"], L.get().header_image)) return new L.HeaderTool.ImageModel;
+ var e = _.find(_wpCustomizeHeader.uploads, function(e) {
+ return e.attachment_id === L.get().header_image_data.attachment_id
+ });
+ return e || (e = {
+ url: L.get().header_image,
+ thumbnail_url: L.get().header_image,
+ attachment_id: L.get().header_image_data.attachment_id
+ }), new L.HeaderTool.ImageModel({
+ header: e,
+ choice: e.url.split("/").pop()
+ })
+ },
+ calculateImageSelectOptions: function(e, t) {
+ var n, i, a, o, s, r, c = parseInt(_wpCustomizeHeader.data.width, 10),
+ l = parseInt(_wpCustomizeHeader.data.height, 10),
+ d = !!parseInt(_wpCustomizeHeader.data["flex-width"], 10),
+ u = !!parseInt(_wpCustomizeHeader.data["flex-height"], 10);
+ return s = e.get("width"), o = e.get("height"), this.headerImage = new L.HeaderTool.ImageModel, this.headerImage.set({
+ themeWidth: c,
+ themeHeight: l,
+ themeFlexWidth: d,
+ themeFlexHeight: u,
+ imageWidth: s,
+ imageHeight: o
+ }), t.set("canSkipCrop", !this.headerImage.shouldBeCropped()), (n = c / l) < (i = s) / (a = o) ? c = (l = a) * n : l = (c = i) / n, !(r = {
+ handles: !0,
+ keys: !0,
+ instance: !0,
+ persistent: !0,
+ imageWidth: s,
+ imageHeight: o,
+ x1: 0,
+ y1: 0,
+ x2: c,
+ y2: l
+ }) === u && !1 === d && (r.aspectRatio = c + ":" + l), !1 === u && (r.maxHeight = l), !1 === d && (r.maxWidth = c), r
+ },
+ 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,
+ a = e.height;
+ this.setImageFromURL(t, n, i, a)
+ },
+ 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 a, o = {};
+ o.url = e, o.thumbnail_url = e, o.timestamp = _.now(), t && (o.attachment_id = t), n && (o.width = n), i && (o.height = i), a = new L.HeaderTool.ImageModel({
+ header: o,
+ choice: e.split("/").pop()
+ }), L.HeaderTool.UploadsList.add(a), L.HeaderTool.currentHeader.set(a.toJSON()), a.save(), a.importImage()
+ },
+ removeImage: function() {
+ L.HeaderTool.currentHeader.trigger("hide"), L.HeaderTool.CombinedList.trigger("control:removeImage")
+ }
+ }), L.ThemeControl = L.Control.extend({
+ touchDrag: !1,
+ screenshotRendered: !1,
+ ready: function() {
+ var n = this,
+ e = L.panel("themes");
- function c() {
- return a() || !1 === f.settings.theme._canInstall || !0 === f.settings.theme._filesystemCredentialsNeeded
- }
+ function t() {
+ return !e.canSwitchTheme(n.params.theme.id)
+ }
- function d() {
- e.container.find("button.preview, button.preview-theme").toggleClass("disabled", a()), e.container.find("button.theme-install").toggleClass("disabled", c())
- }
- var e = this,
- g = f.panel("themes");
- f.state("selectedChangesetStatus").bind(d), f.state("changesetStatus").bind(d), d(), e.container.on("touchmove", ".theme", function() {
- e.touchDrag = !0
- }), e.container.on("click keydown touchend", ".theme", function(a) {
- var c;
- if (!f.utils.isKeydownButNotEnterEvent(a)) return !0 === e.touchDrag ? e.touchDrag = !1 : void(b(a.target).is(".theme-actions .button, .update-theme") || (a.preventDefault(), c = f.section(e.section()), c.showDetails(e.params.theme, function() {
- f.settings.theme._filesystemCredentialsNeeded && c.overlay.find(".theme-actions .delete-theme").remove()
- })))
- }), e.container.on("render-screenshot", function() {
- var a = b(this).find("img"),
- c = a.data("src");
- c && a.attr("src", c), e.screenshotRendered = !0
- })
- },
- filter: function(a) {
- var b = this,
- c = 0,
- d = b.params.theme.name + " " + b.params.theme.description + " " + b.params.theme.tags + " " + b.params.theme.author + " ";
- return d = d.toLowerCase().replace("-", " "), _.isArray(a) || (a = [a]), b.params.theme.name.toLowerCase() === a.join(" ") ? c = 100 : (c += 10 * (d.split(a.join(" ")).length - 1), _.each(a, function(a) {
- c += 2 * (d.split(a + " ").length - 1), c = c + d.split(a).length - 1
- }), c > 99 && (c = 99)), 0 !== c ? (b.activate(), b.params.priority = 101 - c, !0) : (b.deactivate(), b.params.priority = 101, !1)
- },
- rerenderAsInstalled: function(a) {
- var b, c = this;
- a ? c.params.theme.type = "installed" : (b = f.section(c.params.section), c.params.theme.type = b.params.action), c.renderContent(), c.container.trigger("render-screenshot")
+ function i() {
+ n.container.find("button.preview, button.preview-theme").toggleClass("disabled", t()), n.container.find("button.theme-install").toggleClass("disabled", t() || !1 === L.settings.theme._canInstall || !0 === L.settings.theme._filesystemCredentialsNeeded)
}
- }), f.CodeEditorControl = f.Control.extend({
- initialize: function(a, c) {
- var d = this;
- d.deferred = _.extend(d.deferred || {}, {
- codemirror: b.Deferred()
- }), f.Control.prototype.initialize.call(d, a, c), d.notifications.bind("add", function(a) {
- a.code === d.setting.id + ":csslint_error" && (a.templateId = "customize-code-editor-lint-error-notification", a.render = function(a) {
- return function() {
- var b = a.call(this);
- return b.find("input[type=checkbox]").on("click", function() {
- d.setting.notifications.remove("csslint_error")
- }), b
- }
- }(a.render))
- })
- },
- ready: function() {
- var a = this;
- if (!a.section()) return void a.initEditor();
- f.section(a.section(), function(b) {
- b.deferred.embedded.done(function() {
- var c;
- b.expanded() ? a.initEditor() : (c = function(d) {
- d && (a.initEditor(), b.expanded.unbind(c))
- }, b.expanded.bind(c))
- })
- })
- },
- initEditor: function() {
- var a, b = this,
- c = !1;
- wp.codeEditor && (_.isUndefined(b.params.editor_settings) || !1 !== b.params.editor_settings) && (c = wp.codeEditor.defaultSettings ? _.clone(wp.codeEditor.defaultSettings) : {}, c.codemirror = _.extend({}, c.codemirror, {
- indentUnit: 2,
- tabSize: 2
- }), _.isObject(b.params.editor_settings) && _.each(b.params.editor_settings, function(a, b) {
- _.isObject(a) && (c[b] = _.extend({}, c[b], a))
- })), a = new f.Element(b.container.find("textarea")), b.elements.push(a), a.sync(b.setting), a.set(b.setting()), c ? b.initSyntaxHighlightingEditor(c) : b.initPlainTextareaEditor()
- },
- focus: function(a) {
- var b, c = this,
- d = _.extend({}, a);
- b = d.completeCallback, d.completeCallback = function() {
- b && b(), c.editor && c.editor.codemirror.focus()
- }, f.Control.prototype.focus.call(c, d)
- },
- initSyntaxHighlightingEditor: function(a) {
- var c, d = this,
- e = d.container.find("textarea"),
- f = !1;
- c = _.extend({}, a, {
- onTabNext: _.bind(d.onTabNext, d),
- onTabPrevious: _.bind(d.onTabPrevious, d),
- onUpdateErrorNotice: _.bind(d.onUpdateErrorNotice, d)
- }), d.editor = wp.codeEditor.initialize(e, c), b(d.editor.codemirror.display.lineDiv).attr({
- role: "textbox",
- "aria-multiline": "true",
- "aria-label": d.params.label,
- "aria-describedby": "editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"
- }), d.container.find("label").on("click", function() {
- d.editor.codemirror.focus()
- }), d.editor.codemirror.on("change", function(a) {
- f = !0, e.val(a.getValue()).trigger("change"), f = !1
- }), d.setting.bind(function(a) {
- f || d.editor.codemirror.setValue(a)
- }), d.editor.codemirror.on("keydown", function(a, b) {
- 27 === b.keyCode && b.stopPropagation()
- }), d.deferred.codemirror.resolveWith(d, [d.editor.codemirror])
- },
- onTabNext: function() {
- var a, c, d, e = this;
- d = f.section(e.section()), a = d.controls(), c = a.indexOf(e), a.length === c + 1 ? b("#customize-footer-actions .collapse-sidebar").focus() : a[c + 1].container.find(":focusable:first").focus()
- },
- onTabPrevious: function() {
- var a, b, c, d = this;
- c = f.section(d.section()), a = c.controls(), b = a.indexOf(d), 0 === b ? c.contentContainer.find(".customize-section-title .customize-help-toggle, .customize-section-title .customize-section-description.open .section-description-close").last().focus() : a[b - 1].contentContainer.find(":focusable:first").focus()
- },
- onUpdateErrorNotice: function(a) {
- var b, c = this;
- c.setting.notifications.remove("csslint_error"), 0 !== a.length && (b = 1 === a.length ? f.l10n.customCssError.singular.replace("%d", "1") : f.l10n.customCssError.plural.replace("%d", String(a.length)), c.setting.notifications.add(new f.Notification("csslint_error", {
- message: b,
- type: "error"
+ L.state("selectedChangesetStatus").bind(i), L.state("changesetStatus").bind(i), i(), n.container.on("touchmove", ".theme", function() {
+ n.touchDrag = !0
+ }), n.container.on("click keydown touchend", ".theme", function(e) {
+ var t;
+ if (!L.utils.isKeydownButNotEnterEvent(e)) return !0 === n.touchDrag ? n.touchDrag = !1 : void(H(e.target).is(".theme-actions .button, .update-theme") || (e.preventDefault(), (t = L.section(n.section())).showDetails(n.params.theme, function() {
+ L.settings.theme._filesystemCredentialsNeeded && t.overlay.find(".theme-actions .delete-theme").remove()
})))
- },
- initPlainTextareaEditor: function() {
- var a = this,
- b = a.container.find("textarea"),
- c = b[0];
- b.on("blur", function() {
- b.data("next-tab-blurs", !1)
- }), b.on("keydown", function(a) {
- var d, e, f;
- if (27 === a.keyCode) return void(b.data("next-tab-blurs") || (b.data("next-tab-blurs", !0), a.stopPropagation()));
- 9 !== a.keyCode || a.ctrlKey || a.altKey || a.shiftKey || b.data("next-tab-blurs") || (d = c.selectionStart, e = c.selectionEnd, f = c.value, d >= 0 && (c.value = f.substring(0, d).concat("\t", f.substring(e)), b.selectionStart = c.selectionEnd = d + 1), a.stopPropagation(), a.preventDefault())
- }), a.deferred.codemirror.rejectWith(a)
- }
- }), f.DateTimeControl = f.Control.extend({
- ready: function() {
- var a = this;
- if (a.inputElements = {}, a.invalidDate = !1, _.bindAll(a, "populateSetting", "updateDaysForMonth", "populateDateInputs"), !a.setting) throw new Error("Missing setting");
- a.container.find(".date-input").each(function() {
- var c, d, e = b(this);
- c = e.data("component"), d = new f.Element(e), a.inputElements[c] = d, a.elements.push(d), e.on("change", function() {
- a.invalidDate && a.notifications.add(new f.Notification("invalid_date", {
- message: f.l10n.invalidDate
- }))
- }), e.on("input", _.debounce(function() {
- a.invalidDate || a.notifications.remove("invalid_date")
- })), e.on("blur", _.debounce(function() {
- a.invalidDate || a.populateDateInputs()
- }))
- }), a.inputElements.month.bind(a.updateDaysForMonth), a.inputElements.year.bind(a.updateDaysForMonth), a.populateDateInputs(), a.setting.bind(a.populateDateInputs), _.each(a.inputElements, function(b) {
- b.bind(a.populateSetting)
- })
- },
- parseDateTime: function(a) {
- var b, c, d = this;
- return a && (b = a.match(/^(\d\d\d\d)-(\d\d)-(\d\d)(?: (\d\d):(\d\d)(?::(\d\d))?)?$/)), b ? (b.shift(), c = {
- year: b.shift(),
- month: b.shift(),
- day: b.shift(),
- hour: b.shift() || "00",
- minute: b.shift() || "00",
- second: b.shift() || "00"
- }, d.params.includeTime && d.params.twelveHourFormat && (c.hour = parseInt(c.hour, 10), c.meridian = c.hour >= 12 ? "pm" : "am", c.hour = c.hour % 12 ? String(c.hour % 12) : String(12), delete c.second), c) : null
- },
- validateInputs: function() {
- var a, b, c = this;
- return c.invalidDate = !1, a = ["year", "day"], c.params.includeTime && a.push("hour", "minute"), _.find(a, function(a) {
- var d, e, f, g;
- return d = c.inputElements[a], b = d.element.get(0), e = parseInt(d.element.attr("max"), 10), f = parseInt(d.element.attr("min"), 10), g = parseInt(d(), 10), c.invalidDate = isNaN(g) || g > e || g < f, c.invalidDate || b.setCustomValidity(""), c.invalidDate
- }), c.inputElements.meridian && !c.invalidDate && (b = c.inputElements.meridian.element.get(0), "am" !== c.inputElements.meridian.get() && "pm" !== c.inputElements.meridian.get() ? c.invalidDate = !0 : b.setCustomValidity("")), c.invalidDate ? b.setCustomValidity(f.l10n.invalidValue) : b.setCustomValidity(""), (!c.section() || f.section.has(c.section()) && f.section(c.section()).expanded()) && _.result(b, "reportValidity"), c.invalidDate
- },
- updateDaysForMonth: function() {
- var a, b, c, d, e = this;
- c = parseInt(e.inputElements.month(), 10), b = parseInt(e.inputElements.year(), 10), d = parseInt(e.inputElements.day(), 10), c && b && (a = new Date(b, c, 0).getDate(), e.inputElements.day.element.attr("max", a), d > a && e.inputElements.day(String(a)))
- },
- populateSetting: function() {
- var a, b = this;
- return !(b.validateInputs() || !b.params.allowPastDate && !b.isFutureDate()) && (a = b.convertInputDateToString(), b.setting.set(a), !0)
- },
- convertInputDateToString: function() {
- var a, b, c, d, e = this,
- f = "";
- return d = function(a, b) {
- var c;
- return String(a).length < b && (c = b - String(a).length, a = Math.pow(10, c).toString().substr(1) + String(a)), a
- }, c = function(a) {
- var b = parseInt(e.inputElements[a].get(), 10);
- return _.contains(["month", "day", "hour", "minute"], a) ? b = d(b, 2) : "year" === a && (b = d(b, 4)), b
- }, a = ["year", "-", "month", "-", "day"], e.params.includeTime && (b = e.inputElements.meridian ? e.convertHourToTwentyFourHourFormat(e.inputElements.hour(), e.inputElements.meridian()) : e.inputElements.hour(), a = a.concat([" ", d(b, 2), ":", "minute", ":", "00"])), _.each(a, function(a) {
- f += e.inputElements[a] ? c(a) : a
- }), f
- },
- isFutureDate: function() {
- var a = this;
- return 0 < f.utils.getRemainingTime(a.convertInputDateToString())
- },
- convertHourToTwentyFourHourFormat: function(a, b) {
- var c, d;
- return d = parseInt(a, 10), isNaN(d) ? "" : (c = "pm" === b && d < 12 ? d + 12 : "am" === b && 12 === d ? d - 12 : d, String(c))
- },
- populateDateInputs: function() {
- var a, b = this;
- return !!(a = b.parseDateTime(b.setting.get())) && (_.each(b.inputElements, function(b, c) {
- var d = a[c];
- "month" === c || "meridian" === c ? (d = d.replace(/^0/, ""), b.set(d)) : (d = parseInt(d, 10), b.element.is(document.activeElement) ? d !== parseInt(b(), 10) && b.set(String(d)) : b.set(a[c]))
- }), !0)
- },
- toggleFutureDateNotification: function(a) {
- var b, c, d = this;
- return b = "not_future_date", a ? (c = new f.Notification(b, {
- type: "error",
- message: f.l10n.futureDateError
- }), d.notifications.add(c)) : d.notifications.remove(b), d
- }
- }), f.PreviewLinkControl = f.Control.extend({
- defaults: _.extend({}, f.Control.prototype.defaults, {
- templateId: "customize-preview-link-control"
- }),
- ready: function() {
- var a, c, d, e, g, h, i = this;
- _.bindAll(i, "updatePreviewLink"), i.setting || (i.setting = new f.Value), i.previewElements = {}, i.container.find(".preview-control-element").each(function() {
- d = b(this), c = d.data("component"), a = new f.Element(d), i.previewElements[c] = a, i.elements.push(a)
- }), e = i.previewElements.url, g = i.previewElements.input, h = i.previewElements.button, g.link(i.setting), e.link(i.setting), e.bind(function(a) {
- e.element.parent().attr({
- href: a,
- target: f.settings.changeset.uuid
- })
- }), f.bind("ready", i.updatePreviewLink), f.state("saved").bind(i.updatePreviewLink), f.state("changesetStatus").bind(i.updatePreviewLink), f.state("activated").bind(i.updatePreviewLink), f.previewer.previewUrl.bind(i.updatePreviewLink), h.element.on("click", function(a) {
- a.preventDefault(), i.setting() && (g.element.select(), document.execCommand("copy"), h(h.element.data("copied-text")))
- }), e.element.parent().on("click", function(a) {
- b(this).hasClass("disabled") && a.preventDefault()
- }), h.element.on("mouseenter", function() {
- i.setting() && h(h.element.data("copy-text"))
- })
- },
- updatePreviewLink: function() {
- var a, b = this;
- a = !f.state("saved").get() || "" === f.state("changesetStatus").get() || "auto-draft" === f.state("changesetStatus").get(), b.toggleSaveNotification(a), b.previewElements.url.element.parent().toggleClass("disabled", a), b.previewElements.button.element.prop("disabled", a), b.setting.set(f.previewer.getFrontendPreviewUrl())
- },
- toggleSaveNotification: function(a) {
- var b, c, d = this;
- b = "changes_not_saved", a ? (c = new f.Notification(b, {
- type: "info",
- message: f.l10n.saveBeforeShare
- }), d.notifications.add(c)) : d.notifications.remove(b)
- }
- }), f.defaultConstructor = f.Setting, f.control = new f.Values({
- defaultConstructor: f.Control
- }), f.section = new f.Values({
- defaultConstructor: f.Section
- }), f.panel = new f.Values({
- defaultConstructor: f.Panel
- }), f.notifications = new f.Notifications, f.PreviewFrame = f.Messenger.extend({
- sensitivity: null,
- initialize: function(a, c) {
- var d = b.Deferred();
- d.promise(this), this.container = a.container, b.extend(a, {
- channel: f.PreviewFrame.uuid()
- }), f.Messenger.prototype.initialize.call(this, a, c), this.add("previewUrl", a.previewUrl), this.query = b.extend(a.query || {}, {
- customize_messenger_channel: this.channel()
- }), this.run(d)
- },
- run: function(a) {
- var c, d, e, g = this,
- h = !1,
- i = !1,
- j = null,
- k = "{}" !== g.query.customized;
- g._ready && g.unbind("ready", g._ready), g._ready = function(b) {
- i = !0, j = b, g.container.addClass("iframe-ready"), b && h && a.resolveWith(g, [b])
- }, g.bind("ready", g._ready), c = document.createElement("a"), c.href = g.previewUrl(), d = _.extend(f.utils.parseQueryString(c.search.substr(1)), {
- customize_changeset_uuid: g.query.customize_changeset_uuid,
- customize_theme: g.query.customize_theme,
- customize_messenger_channel: g.query.customize_messenger_channel
- }), !f.settings.changeset.autosaved && f.state("saved").get() || (d.customize_autosaved = "on"), c.search = b.param(d), g.iframe = b("<iframe />", {
- title: f.l10n.previewIframeTitle,
- name: "customize-" + g.channel()
- }), g.iframe.attr("onmousewheel", ""), k ? g.iframe.attr("data-src", c.href) : g.iframe.attr("src", c.href), g.iframe.appendTo(g.container), g.targetWindow(g.iframe[0].contentWindow), k && (e = b("<form>", {
- action: c.href,
- target: g.iframe.attr("name"),
- method: "post",
- hidden: "hidden"
- }), e.append(b("<input>", {
- type: "hidden",
- name: "_method",
- value: "GET"
- })), _.each(g.query, function(a, c) {
- e.append(b("<input>", {
- type: "hidden",
- name: c,
- value: a
+ }), n.container.on("render-screenshot", function() {
+ var e = H(this).find("img"),
+ t = e.data("src");
+ t && e.attr("src", t), n.screenshotRendered = !0
+ })
+ },
+ filter: function(e) {
+ var t = this,
+ n = 0,
+ i = t.params.theme.name + " " + t.params.theme.description + " " + t.params.theme.tags + " " + t.params.theme.author + " ";
+ return i = i.toLowerCase().replace("-", " "), _.isArray(e) || (e = [e]), t.params.theme.name.toLowerCase() === e.join(" ") ? n = 100 : (n += 10 * (i.split(e.join(" ")).length - 1), _.each(e, function(e) {
+ n = (n += 2 * (i.split(e + " ").length - 1)) + i.split(e).length - 1
+ }), 99 < n && (n = 99)), 0 !== n ? (t.activate(), t.params.priority = 101 - n, !0) : (t.deactivate(), !(t.params.priority = 101))
+ },
+ rerenderAsInstalled: function(e) {
+ var t = this;
+ t.params.theme.type = e ? "installed" : L.section(t.params.section).params.action, t.renderContent(), t.container.trigger("render-screenshot")
+ }
+ }), L.CodeEditorControl = L.Control.extend({
+ initialize: function(e, t) {
+ var n = this;
+ n.deferred = _.extend(n.deferred || {}, {
+ codemirror: H.Deferred()
+ }), L.Control.prototype.initialize.call(n, e, t), n.notifications.bind("add", function(e) {
+ var t;
+ e.code === n.setting.id + ":csslint_error" && (e.templateId = "customize-code-editor-lint-error-notification", e.render = (t = e.render, function() {
+ var e = t.call(this);
+ return e.find("input[type=checkbox]").on("click", function() {
+ n.setting.notifications.remove("csslint_error")
+ }), e
+ }))
+ })
+ },
+ ready: function() {
+ var i = this;
+ i.section() ? L.section(i.section(), function(n) {
+ n.deferred.embedded.done(function() {
+ var t;
+ n.expanded() ? i.initEditor() : (t = function(e) {
+ e && (i.initEditor(), n.expanded.unbind(t))
+ }, n.expanded.bind(t))
+ })
+ }) : i.initEditor()
+ },
+ initEditor: function() {
+ var e, t = this,
+ n = !1;
+ wp.codeEditor && (_.isUndefined(t.params.editor_settings) || !1 !== t.params.editor_settings) && ((n = wp.codeEditor.defaultSettings ? _.clone(wp.codeEditor.defaultSettings) : {}).codemirror = _.extend({}, n.codemirror, {
+ indentUnit: 2,
+ tabSize: 2
+ }), _.isObject(t.params.editor_settings) && _.each(t.params.editor_settings, function(e, t) {
+ _.isObject(e) && (n[t] = _.extend({}, n[t], e))
+ })), e = new L.Element(t.container.find("textarea")), t.elements.push(e), e.sync(t.setting), e.set(t.setting()), n ? t.initSyntaxHighlightingEditor(n) : t.initPlainTextareaEditor()
+ },
+ focus: function(e) {
+ var t, n = this,
+ i = _.extend({}, e);
+ t = i.completeCallback, i.completeCallback = function() {
+ t && t(), n.editor && n.editor.codemirror.focus()
+ }, L.Control.prototype.focus.call(n, i)
+ },
+ initSyntaxHighlightingEditor: function(e) {
+ var t, n = this,
+ i = n.container.find("textarea"),
+ a = !1;
+ t = _.extend({}, e, {
+ onTabNext: _.bind(n.onTabNext, n),
+ onTabPrevious: _.bind(n.onTabPrevious, n),
+ onUpdateErrorNotice: _.bind(n.onUpdateErrorNotice, n)
+ }), n.editor = wp.codeEditor.initialize(i, t), H(n.editor.codemirror.display.lineDiv).attr({
+ role: "textbox",
+ "aria-multiline": "true",
+ "aria-label": n.params.label,
+ "aria-describedby": "editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"
+ }), n.container.find("label").on("click", function() {
+ n.editor.codemirror.focus()
+ }), n.editor.codemirror.on("change", function(e) {
+ a = !0, i.val(e.getValue()).trigger("change"), a = !1
+ }), n.setting.bind(function(e) {
+ a || n.editor.codemirror.setValue(e)
+ }), n.editor.codemirror.on("keydown", function(e, t) {
+ 27 === t.keyCode && t.stopPropagation()
+ }), n.deferred.codemirror.resolveWith(n, [n.editor.codemirror])
+ },
+ onTabNext: function() {
+ var e, t;
+ t = (e = L.section(this.section()).controls()).indexOf(this), e.length === t + 1 ? H("#customize-footer-actions .collapse-sidebar").focus() : e[t + 1].container.find(":focusable:first").focus()
+ },
+ onTabPrevious: function() {
+ var e, t, n;
+ 0 === (t = (e = (n = L.section(this.section())).controls()).indexOf(this)) ? n.contentContainer.find(".customize-section-title .customize-help-toggle, .customize-section-title .customize-section-description.open .section-description-close").last().focus() : e[t - 1].contentContainer.find(":focusable:first").focus()
+ },
+ onUpdateErrorNotice: function(e) {
+ var t;
+ this.setting.notifications.remove("csslint_error"), 0 !== e.length && (t = 1 === e.length ? L.l10n.customCssError.singular.replace("%d", "1") : L.l10n.customCssError.plural.replace("%d", String(e.length)), this.setting.notifications.add(new L.Notification("csslint_error", {
+ message: t,
+ type: "error"
+ })))
+ },
+ initPlainTextareaEditor: function() {
+ var a = this.container.find("textarea"),
+ o = a[0];
+ a.on("blur", function() {
+ a.data("next-tab-blurs", !1)
+ }), a.on("keydown", function(e) {
+ var t, n, i;
+ 27 !== e.keyCode ? 9 !== e.keyCode || e.ctrlKey || e.altKey || e.shiftKey || a.data("next-tab-blurs") || (t = o.selectionStart, n = o.selectionEnd, i = o.value, 0 <= t && (o.value = i.substring(0, t).concat("\t", i.substring(n)), a.selectionStart = o.selectionEnd = t + 1), e.stopPropagation(), e.preventDefault()) : a.data("next-tab-blurs") || (a.data("next-tab-blurs", !0), e.stopPropagation())
+ }), this.deferred.codemirror.rejectWith(this)
+ }
+ }), L.DateTimeControl = L.Control.extend({
+ ready: function() {
+ var i = this;
+ if (i.inputElements = {}, i.invalidDate = !1, _.bindAll(i, "populateSetting", "updateDaysForMonth", "populateDateInputs"), !i.setting) throw new Error("Missing setting");
+ i.container.find(".date-input").each(function() {
+ var e, t, n = H(this);
+ e = n.data("component"), t = new L.Element(n), i.inputElements[e] = t, i.elements.push(t), n.on("change", function() {
+ i.invalidDate && i.notifications.add(new L.Notification("invalid_date", {
+ message: L.l10n.invalidDate
}))
- }), g.container.append(e), e.submit(), e.remove()), g.bind("iframe-loading-error", function(b) {
- return g.iframe.remove(), 0 === b ? void g.login(a) : -1 === b ? void a.rejectWith(g, ["cheatin"]) : void a.rejectWith(g, ["request failure"])
- }), g.iframe.one("load", function() {
- h = !0, i ? a.resolveWith(g, [j]) : setTimeout(function() {
- a.rejectWith(g, ["ready timeout"])
- }, g.sensitivity)
- })
- },
- login: function(a) {
- var c, d = this;
- if (c = function() {
- a.rejectWith(d, ["logged out"])
- }, this.triedLogin) return c();
- b.get(f.settings.url.ajax, {
- action: "logged-in"
- }).fail(c).done(function(e) {
- var g;
- "1" !== e && c(), g = b("<iframe />", {
- src: d.previewUrl(),
- title: f.l10n.previewIframeTitle
- }).hide(), g.appendTo(d.container), g.on("load", function() {
- d.triedLogin = !0, g.remove(), d.run(a)
- })
- })
- },
- destroy: function() {
- f.Messenger.prototype.destroy.call(this), this.iframe && this.iframe.remove(), delete this.iframe, delete this.targetWindow
- }
+ }), n.on("input", _.debounce(function() {
+ i.invalidDate || i.notifications.remove("invalid_date")
+ })), n.on("blur", _.debounce(function() {
+ i.invalidDate || i.populateDateInputs()
+ }))
+ }), i.inputElements.month.bind(i.updateDaysForMonth), i.inputElements.year.bind(i.updateDaysForMonth), i.populateDateInputs(), i.setting.bind(i.populateDateInputs), _.each(i.inputElements, function(e) {
+ e.bind(i.populateSetting)
+ })
+ },
+ parseDateTime: function(e) {
+ var t, n;
+ return e && (t = e.match(/^(\d\d\d\d)-(\d\d)-(\d\d)(?: (\d\d):(\d\d)(?::(\d\d))?)?$/)), t ? (t.shift(), n = {
+ year: t.shift(),
+ month: t.shift(),
+ day: t.shift(),
+ hour: t.shift() || "00",
+ minute: t.shift() || "00",
+ second: t.shift() || "00"
+ }, this.params.includeTime && this.params.twelveHourFormat && (n.hour = parseInt(n.hour, 10), n.meridian = 12 <= n.hour ? "pm" : "am", n.hour = n.hour % 12 ? String(n.hour % 12) : String(12), delete n.second), n) : null
+ },
+ validateInputs: function() {
+ var e, o, s = this;
+ return s.invalidDate = !1, e = ["year", "day"], s.params.includeTime && e.push("hour", "minute"), _.find(e, function(e) {
+ var t, n, i, a;
+ return t = s.inputElements[e], o = t.element.get(0), n = parseInt(t.element.attr("max"), 10), i = parseInt(t.element.attr("min"), 10), a = parseInt(t(), 10), s.invalidDate = isNaN(a) || n < a || a < i, s.invalidDate || o.setCustomValidity(""), s.invalidDate
+ }), s.inputElements.meridian && !s.invalidDate && (o = s.inputElements.meridian.element.get(0), "am" !== s.inputElements.meridian.get() && "pm" !== s.inputElements.meridian.get() ? s.invalidDate = !0 : o.setCustomValidity("")), s.invalidDate ? o.setCustomValidity(L.l10n.invalidValue) : o.setCustomValidity(""), (!s.section() || L.section.has(s.section()) && L.section(s.section()).expanded()) && _.result(o, "reportValidity"), s.invalidDate
+ },
+ updateDaysForMonth: function() {
+ var e, t, n, i, a = this;
+ n = parseInt(a.inputElements.month(), 10), t = parseInt(a.inputElements.year(), 10), i = parseInt(a.inputElements.day(), 10), n && t && (e = new Date(t, n, 0).getDate(), a.inputElements.day.element.attr("max", e), e < i && a.inputElements.day(String(e)))
+ },
+ populateSetting: function() {
+ var e, t = this;
+ return !(t.validateInputs() || !t.params.allowPastDate && !t.isFutureDate()) && (e = t.convertInputDateToString(), t.setting.set(e), !0)
+ },
+ convertInputDateToString: function() {
+ var e, t, n, i, a = this,
+ o = "";
+ return i = function(e, t) {
+ var n;
+ return String(e).length < t && (n = t - String(e).length, e = Math.pow(10, n).toString().substr(1) + String(e)), e
+ }, n = function(e) {
+ var t = parseInt(a.inputElements[e].get(), 10);
+ return _.contains(["month", "day", "hour", "minute"], e) ? t = i(t, 2) : "year" === e && (t = i(t, 4)), t
+ }, e = ["year", "-", "month", "-", "day"], a.params.includeTime && (t = a.inputElements.meridian ? a.convertHourToTwentyFourHourFormat(a.inputElements.hour(), a.inputElements.meridian()) : a.inputElements.hour(), e = e.concat([" ", i(t, 2), ":", "minute", ":", "00"])), _.each(e, function(e) {
+ o += a.inputElements[e] ? n(e) : e
+ }), o
+ },
+ isFutureDate: function() {
+ return 0 < L.utils.getRemainingTime(this.convertInputDateToString())
+ },
+ convertHourToTwentyFourHourFormat: function(e, t) {
+ var n, i;
+ return i = parseInt(e, 10), isNaN(i) ? "" : (n = "pm" === t && i < 12 ? i + 12 : "am" === t && 12 === i ? i - 12 : i, String(n))
+ },
+ populateDateInputs: function() {
+ var i;
+ return !!(i = this.parseDateTime(this.setting.get())) && (_.each(this.inputElements, function(e, t) {
+ var n = i[t];
+ "month" === t || "meridian" === t ? (n = n.replace(/^0/, ""), e.set(n)) : (n = parseInt(n, 10), e.element.is(document.activeElement) ? n !== parseInt(e(), 10) && e.set(String(n)) : e.set(i[t]))
+ }), !0)
+ },
+ toggleFutureDateNotification: function(e) {
+ var t, n;
+ return t = "not_future_date", e ? (n = new L.Notification(t, {
+ type: "error",
+ message: L.l10n.futureDateError
+ }), this.notifications.add(n)) : this.notifications.remove(t), this
+ }
+ }), L.PreviewLinkControl = L.Control.extend({
+ defaults: _.extend({}, L.Control.prototype.defaults, {
+ templateId: "customize-preview-link-control"
}),
- function() {
- var a = 0;
- f.PreviewFrame.uuid = function() {
- return "preview-" + String(a++)
- }
- }(), f.setDocumentTitle = function(a) {
- var b, c;
- b = f.settings.documentTitleTmpl, c = b.replace("%s", a), document.title = c, f.trigger("title", c)
- }, f.Previewer = f.Messenger.extend({
- refreshBuffer: null,
- initialize: function(a, c) {
- var d = this,
- e = document.createElement("a");
- b.extend(d, c || {}), d.deferred = {
- active: b.Deferred()
- }, d.refresh = _.debounce(function(a) {
- return function() {
- var b, c;
- b = function() {
- return 0 === f.state("processing").get()
- }, b() ? a.call(d) : (c = function() {
- b() && (a.call(d), f.state("processing").unbind(c))
- }, f.state("processing").bind(c))
- }
- }(d.refresh), d.refreshBuffer), d.container = f.ensure(a.container), d.allowedUrls = a.allowedUrls, a.url = window.location.href, f.Messenger.prototype.initialize.call(d, a), e.href = d.origin(), d.add("scheme", e.protocol.replace(/:$/, "")), d.add("previewUrl", a.previewUrl).setter(function(a) {
- var c, e, g, h = null,
- i = [];
- return c = document.createElement("a"), c.href = a, /\/wp-(admin|includes|content)(\/|$)/.test(c.pathname) ? null : (c.search.length > 1 && (e = f.utils.parseQueryString(c.search.substr(1)), delete e.customize_changeset_uuid, delete e.customize_theme, delete e.customize_messenger_channel, delete e.customize_autosaved, _.isEmpty(e) ? c.search = "" : c.search = b.param(e)), i.push(c), d.scheme.get() + ":" !== c.protocol && (c = document.createElement("a"), c.href = i[0].href, c.protocol = d.scheme.get() + ":", i.unshift(c)), g = document.createElement("a"), _.find(i, function(a) {
- return !_.isUndefined(_.find(d.allowedUrls, function(b) {
- if (g.href = b, c.protocol === g.protocol && c.host === g.host && 0 === c.pathname.indexOf(g.pathname.replace(/\/$/, ""))) return h = a.href, !0
- }))
- }), h)
- }), d.bind("ready", d.ready), d.deferred.active.done(_.bind(d.keepPreviewAlive, d)), d.bind("synced", function() {
- d.send("active")
- }), d.previewUrl.bind(d.refresh), d.scroll = 0, d.bind("scroll", function(a) {
- d.scroll = a
- }), d.bind("url", function(a) {
- var b, c = !1;
- d.scroll = 0, b = function() {
- c = !0
- }, d.previewUrl.bind(b), d.previewUrl.set(a), d.previewUrl.unbind(b), c || d.refresh()
- }), d.bind("documentTitle", function(a) {
- f.setDocumentTitle(a)
- })
- },
- ready: function(a) {
- var b, c = this,
- d = {};
- d.settings = f.get(), d["settings-modified-while-loading"] = c.settingsModifiedWhileLoading, ("resolved" !== c.deferred.active.state() || c.loading) && (d.scroll = c.scroll), d["edit-shortcut-visibility"] = f.state("editShortcutVisibility").get(), c.send("sync", d), a.currentUrl && (c.previewUrl.unbind(c.refresh), c.previewUrl.set(a.currentUrl), c.previewUrl.bind(c.refresh)), b = {
- panel: a.activePanels,
- section: a.activeSections,
- control: a.activeControls
- }, _(b).each(function(a, b) {
- f[b].each(function(c, d) {
- _.isUndefined(f.settings[b + "s"][d]) && _.isUndefined(a[d]) || (a[d] ? c.activate() : c.deactivate())
- })
- }), a.settingValidities && f._handleSettingValidities({
- settingValidities: a.settingValidities,
- focusInvalidControl: !1
- })
- },
- keepPreviewAlive: function() {
- var a, b, c, d, e = this;
- d = function() {
- b = setTimeout(c, f.settings.timeouts.keepAliveCheck)
- }, a = function() {
- f.state("previewerAlive").set(!0), clearTimeout(b), d()
- }, c = function() {
- f.state("previewerAlive").set(!1)
- }, d(), e.bind("ready", a), e.bind("keep-alive", a)
- },
- query: function() {},
- abort: function() {
- this.loading && (this.loading.destroy(), delete this.loading)
- },
- refresh: function() {
- var a, b = this;
- b.send("loading-initiated"), b.abort(), b.loading = new f.PreviewFrame({
- url: b.url(),
- previewUrl: b.previewUrl(),
- query: b.query({
- excludeCustomizedSaved: !0
- }) || {},
- container: b.container
- }), b.settingsModifiedWhileLoading = {}, a = function(a) {
- b.settingsModifiedWhileLoading[a.id] = !0
- }, f.bind("change", a), b.loading.always(function() {
- f.unbind("change", a)
- }), b.loading.done(function(a) {
- var c, d = this;
- b.preview = d, b.targetWindow(d.targetWindow()), b.channel(d.channel()), c = function() {
- d.unbind("synced", c), b._previousPreview && b._previousPreview.destroy(), b._previousPreview = b.preview, b.deferred.active.resolve(), delete b.loading
- }, d.bind("synced", c), b.trigger("ready", a)
- }), b.loading.fail(function(a) {
- b.send("loading-failed"), "logged out" === a && (b.preview && (b.preview.destroy(), delete b.preview), b.login().done(b.refresh)), "cheatin" === a && b.cheatin()
- })
- },
- login: function() {
- var a, c, d, e = this;
- return this._login ? this._login : (a = b.Deferred(), this._login = a.promise(), c = new f.Messenger({
- channel: "login",
- url: f.settings.url.login
- }), d = b("<iframe />", {
- src: f.settings.url.login,
- title: f.l10n.loginIframeTitle
- }).appendTo(this.container), c.targetWindow(d[0].contentWindow), c.bind("login", function() {
- var b = e.refreshNonces();
- b.always(function() {
- d.remove(), c.destroy(), delete e._login
- }), b.done(function() {
- a.resolve()
- }), b.fail(function() {
- e.cheatin(), a.reject()
- })
- }), this._login)
- },
- cheatin: function() {
- b(document.body).empty().addClass("cheatin").append("<h1>" + f.l10n.notAllowedHeading + "</h1><p>" + f.l10n.notAllowed + "</p>")
- },
- refreshNonces: function() {
- var a, c = b.Deferred();
- return c.promise(), a = wp.ajax.post("customize_refresh_nonces", {
- wp_customize: "on",
- customize_theme: f.settings.theme.stylesheet
- }), a.done(function(a) {
- f.trigger("nonce-refresh", a), c.resolve()
- }), a.fail(function() {
- c.reject()
- }), c
- }
- }), f.settingConstructor = {}, f.controlConstructor = {
- color: f.ColorControl,
- media: f.MediaControl,
- upload: f.UploadControl,
- image: f.ImageControl,
- cropped_image: f.CroppedImageControl,
- site_icon: f.SiteIconControl,
- header: f.HeaderControl,
- background: f.BackgroundControl,
- background_position: f.BackgroundPositionControl,
- theme: f.ThemeControl,
- date_time: f.DateTimeControl,
- code_editor: f.CodeEditorControl
- }, f.panelConstructor = {
- themes: f.ThemesPanel
- }, f.sectionConstructor = {
- themes: f.ThemesSection,
- outer: f.OuterSection
- }, f._handleSettingValidities = function(a) {
- var b, c = [],
- d = !1;
- _.each(a.settingValidities, function(a, b) {
- var d = f(b);
- d && (_.isObject(a) && _.each(a, function(a, b) {
- var e, g, h = !1;
- e = new f.Notification(b, _.extend({
- fromServer: !0
- }, a)), g = d.notifications(e.code), g && (h = e.type !== g.type || e.message !== g.message || !_.isEqual(e.data, g.data)), h && d.notifications.remove(b), d.notifications.has(e.code) || d.notifications.add(e), c.push(d.id)
- }), d.notifications.each(function(b) {
- !b.fromServer || "error" !== b.type || !0 !== a && a[b.code] || d.notifications.remove(b.code)
+ ready: function() {
+ var e, t, n, i, a, o, s = this;
+ _.bindAll(s, "updatePreviewLink"), s.setting || (s.setting = new L.Value), s.previewElements = {}, s.container.find(".preview-control-element").each(function() {
+ n = H(this), t = n.data("component"), e = new L.Element(n), s.previewElements[t] = e, s.elements.push(e)
+ }), i = s.previewElements.url, a = s.previewElements.input, o = s.previewElements.button, a.link(s.setting), i.link(s.setting), i.bind(function(e) {
+ i.element.parent().attr({
+ href: e,
+ target: L.settings.changeset.uuid
+ })
+ }), L.bind("ready", s.updatePreviewLink), L.state("saved").bind(s.updatePreviewLink), L.state("changesetStatus").bind(s.updatePreviewLink), L.state("activated").bind(s.updatePreviewLink), L.previewer.previewUrl.bind(s.updatePreviewLink), o.element.on("click", function(e) {
+ e.preventDefault(), s.setting() && (a.element.select(), document.execCommand("copy"), o(o.element.data("copied-text")))
+ }), i.element.parent().on("click", function(e) {
+ H(this).hasClass("disabled") && e.preventDefault()
+ }), o.element.on("mouseenter", function() {
+ s.setting() && o(o.element.data("copy-text"))
+ })
+ },
+ updatePreviewLink: function() {
+ var e;
+ e = !L.state("saved").get() || "" === L.state("changesetStatus").get() || "auto-draft" === L.state("changesetStatus").get(), this.toggleSaveNotification(e), this.previewElements.url.element.parent().toggleClass("disabled", e), this.previewElements.button.element.prop("disabled", e), this.setting.set(L.previewer.getFrontendPreviewUrl())
+ },
+ toggleSaveNotification: function(e) {
+ var t, n;
+ t = "changes_not_saved", e ? (n = new L.Notification(t, {
+ type: "info",
+ message: L.l10n.saveBeforeShare
+ }), this.notifications.add(n)) : this.notifications.remove(t)
+ }
+ }), L.defaultConstructor = L.Setting, L.control = new L.Values({
+ defaultConstructor: L.Control
+ }), L.section = new L.Values({
+ defaultConstructor: L.Section
+ }), L.panel = new L.Values({
+ defaultConstructor: L.Panel
+ }), L.notifications = new L.Notifications, L.PreviewFrame = L.Messenger.extend({
+ sensitivity: null,
+ initialize: function(e, t) {
+ var n = H.Deferred();
+ n.promise(this), this.container = e.container, H.extend(e, {
+ channel: L.PreviewFrame.uuid()
+ }), L.Messenger.prototype.initialize.call(this, e, t), this.add("previewUrl", e.previewUrl), this.query = H.extend(e.query || {}, {
+ customize_messenger_channel: this.channel()
+ }), this.run(n)
+ },
+ run: function(t) {
+ var e, n, i, a = this,
+ o = !1,
+ s = !1,
+ r = null,
+ c = "{}" !== a.query.customized;
+ a._ready && a.unbind("ready", a._ready), a._ready = function(e) {
+ s = !0, r = e, a.container.addClass("iframe-ready"), e && o && t.resolveWith(a, [e])
+ }, a.bind("ready", a._ready), (e = document.createElement("a")).href = a.previewUrl(), n = _.extend(L.utils.parseQueryString(e.search.substr(1)), {
+ customize_changeset_uuid: a.query.customize_changeset_uuid,
+ customize_theme: a.query.customize_theme,
+ customize_messenger_channel: a.query.customize_messenger_channel
+ }), !L.settings.changeset.autosaved && L.state("saved").get() || (n.customize_autosaved = "on"), e.search = H.param(n), a.iframe = H("<iframe />", {
+ title: L.l10n.previewIframeTitle,
+ name: "customize-" + a.channel()
+ }), a.iframe.attr("onmousewheel", ""), c ? a.iframe.attr("data-src", e.href) : a.iframe.attr("src", e.href), a.iframe.appendTo(a.container), a.targetWindow(a.iframe[0].contentWindow), c && ((i = H("<form>", {
+ action: e.href,
+ target: a.iframe.attr("name"),
+ method: "post",
+ hidden: "hidden"
+ })).append(H("<input>", {
+ type: "hidden",
+ name: "_method",
+ value: "GET"
+ })), _.each(a.query, function(e, t) {
+ i.append(H("<input>", {
+ type: "hidden",
+ name: t,
+ value: e
}))
- }), a.focusInvalidControl && (b = f.findControlsForSettings(c), _(_.values(b)).find(function(a) {
- return _(a).find(function(a) {
- var b = a.section() && f.section.has(a.section()) && f.section(a.section()).expanded();
- return b && a.expanded && (b = a.expanded()), b && (a.focus(), d = !0), d
- })
- }), d || _.isEmpty(b) || _.values(b)[0][0].focus())
- }, f.findControlsForSettings = function(a) {
- var b, c = {};
- return _.each(_.unique(a), function(a) {
- var d = f(a);
- d && (b = d.findControls()) && b.length > 0 && (c[a] = b)
- }), c
- }, f.reflowPaneContents = _.bind(function() {
- var a, c, d, e = [],
- g = !1;
- document.activeElement && (c = b(document.activeElement)), f.panel.each(function(b) {
- if ("themes" !== b.id) {
- var c = b.sections(),
- d = _.pluck(c, "headContainer");
- e.push(b), a = b.contentContainer.is("ul") ? b.contentContainer : b.contentContainer.find("ul:first"), f.utils.areElementListsEqual(d, a.children("[id]")) || (_(c).each(function(b) {
- a.append(b.headContainer)
- }), g = !0)
- }
- }), f.section.each(function(b) {
- var c = b.controls(),
- d = _.pluck(c, "container");
- b.panel() || e.push(b), a = b.contentContainer.is("ul") ? b.contentContainer : b.contentContainer.find("ul:first"), f.utils.areElementListsEqual(d, a.children("[id]")) || (_(c).each(function(b) {
- a.append(b.container)
- }), g = !0)
- }), e.sort(f.utils.prioritySort), d = _.pluck(e, "headContainer"), a = b("#customize-theme-controls .customize-pane-parent"), f.utils.areElementListsEqual(d, a.children()) || (_(e).each(function(b) {
- a.append(b.headContainer)
- }), g = !0), f.panel.each(function(a) {
- var b = a.active();
- a.active.callbacks.fireWith(a.active, [b, b])
- }), f.section.each(function(a) {
- var b = a.active();
- a.active.callbacks.fireWith(a.active, [b, b])
- }), g && c && c.focus(), f.trigger("pane-contents-reflowed")
- }, f), f.state = new f.Values, _.each(["saved", "saving", "trashing", "activated", "processing", "paneVisible", "expandedPanel", "expandedSection", "changesetDate", "selectedChangesetDate", "changesetStatus", "selectedChangesetStatus", "remainingTimeToPublish", "previewerAlive", "editShortcutVisibility", "changesetLocked", "previewedDevice"], function(a) {
- f.state.create(a)
- }), b(function() {
- function a() {
- function c(a) {
- a || f.settings.changeset.autosaved || (f.settings.changeset.autosaved = !0, f.previewer.send("autosaving"))
- }
- var d, e, g, h = !1;
- f.unbind("change", a), f.state("saved").bind(c), c(f.state("saved").get()), e = function() {
- h || (h = !0, f.requestChangesetUpdate({}, {
- autosave: !0
- }).always(function() {
- h = !1
- })), g()
- }, g = function() {
- clearTimeout(d), d = setTimeout(function() {
- e()
- }, f.settings.timeouts.changesetAutoSave)
- }, g(), b(document).on("visibilitychange.wp-customize-changeset-update", function() {
- document.hidden && e()
- }), b(window).on("beforeunload.wp-customize-changeset-update", function() {
- e()
+ }), a.container.append(i), i.submit(), i.remove()), a.bind("iframe-loading-error", function(e) {
+ a.iframe.remove(), 0 !== e ? -1 !== e ? t.rejectWith(a, ["request failure"]) : t.rejectWith(a, ["cheatin"]) : a.login(t)
+ }), a.iframe.one("load", function() {
+ o = !0, s ? t.resolveWith(a, [r]) : setTimeout(function() {
+ t.rejectWith(a, ["ready timeout"])
+ }, a.sensitivity)
+ })
+ },
+ login: function(n) {
+ var i, a = this;
+ if (i = function() {
+ n.rejectWith(a, ["logged out"])
+ }, this.triedLogin) return i();
+ H.get(L.settings.url.ajax, {
+ action: "logged-in"
+ }).fail(i).done(function(e) {
+ var t;
+ "1" !== e && i(), (t = H("<iframe />", {
+ src: a.previewUrl(),
+ title: L.l10n.previewIframeTitle
+ }).hide()).appendTo(a.container), t.on("load", function() {
+ a.triedLogin = !0, t.remove(), a.run(n)
})
- }
- if (f.settings = window._wpCustomizeSettings, f.l10n = window._wpCustomizeControlsL10n, f.settings && b.support.postMessage && (b.support.cors || !f.settings.isCrossDomain)) {
- null === f.PreviewFrame.prototype.sensitivity && (f.PreviewFrame.prototype.sensitivity = f.settings.timeouts.previewFrameSensitivity), null === f.Previewer.prototype.refreshBuffer && (f.Previewer.prototype.refreshBuffer = f.settings.timeouts.windowRefresh);
- var c, d = b(document.body),
- e = d.children(".wp-full-overlay"),
- g = b("#customize-info .panel-title.site-title"),
- h = b(".customize-controls-close"),
- i = b("#save"),
- j = b("#customize-save-button-wrapper"),
- k = b("#publish-settings"),
- l = b("#customize-footer-actions");
- f.bind("ready", function() {
- f.section.add(new f.OuterSection("publish_settings", {
- title: f.l10n.publishSettings,
- priority: 0,
- active: f.settings.theme.active
+ })
+ },
+ destroy: function() {
+ L.Messenger.prototype.destroy.call(this), this.iframe && this.iframe.remove(), delete this.iframe, delete this.targetWindow
+ }
+ }), r = 0, L.PreviewFrame.uuid = function() {
+ return "preview-" + String(r++)
+ }, L.setDocumentTitle = function(e) {
+ var t;
+ t = L.settings.documentTitleTmpl.replace("%s", e), document.title = t, L.trigger("title", t)
+ }, L.Previewer = L.Messenger.extend({
+ refreshBuffer: null,
+ initialize: function(e, t) {
+ var n, s = this,
+ i = document.createElement("a");
+ H.extend(s, t || {}), s.deferred = {
+ active: H.Deferred()
+ }, s.refresh = _.debounce((n = s.refresh, function() {
+ var e, t;
+ (e = function() {
+ return 0 === L.state("processing").get()
+ })() ? n.call(s): (t = function() {
+ e() && (n.call(s), L.state("processing").unbind(t))
+ }, L.state("processing").bind(t))
+ }), s.refreshBuffer), s.container = L.ensure(e.container), s.allowedUrls = e.allowedUrls, e.url = window.location.href, L.Messenger.prototype.initialize.call(s, e), i.href = s.origin(), s.add("scheme", i.protocol.replace(/:$/, "")), s.add("previewUrl", e.previewUrl).setter(function(e) {
+ var n, t, i, a = null,
+ o = [];
+ return (n = document.createElement("a")).href = e, /\/wp-(admin|includes|content)(\/|$)/.test(n.pathname) ? null : (1 < n.search.length && (delete(t = L.utils.parseQueryString(n.search.substr(1))).customize_changeset_uuid, delete t.customize_theme, delete t.customize_messenger_channel, delete t.customize_autosaved, _.isEmpty(t) ? n.search = "" : n.search = H.param(t)), o.push(n), s.scheme.get() + ":" !== n.protocol && ((n = document.createElement("a")).href = o[0].href, n.protocol = s.scheme.get() + ":", o.unshift(n)), i = document.createElement("a"), _.find(o, function(t) {
+ return !_.isUndefined(_.find(s.allowedUrls, function(e) {
+ if (i.href = e, n.protocol === i.protocol && n.host === i.host && 0 === n.pathname.indexOf(i.pathname.replace(/\/$/, ""))) return a = t.href, !0
+ }))
+ }), a)
+ }), s.bind("ready", s.ready), s.deferred.active.done(_.bind(s.keepPreviewAlive, s)), s.bind("synced", function() {
+ s.send("active")
+ }), s.previewUrl.bind(s.refresh), s.scroll = 0, s.bind("scroll", function(e) {
+ s.scroll = e
+ }), s.bind("url", function(e) {
+ var t, n = !1;
+ s.scroll = 0, t = function() {
+ n = !0
+ }, s.previewUrl.bind(t), s.previewUrl.set(e), s.previewUrl.unbind(t), n || s.refresh()
+ }), s.bind("documentTitle", function(e) {
+ L.setDocumentTitle(e)
+ })
+ },
+ ready: function(e) {
+ var t, n = this,
+ i = {};
+ i.settings = L.get(), i["settings-modified-while-loading"] = n.settingsModifiedWhileLoading, ("resolved" !== n.deferred.active.state() || n.loading) && (i.scroll = n.scroll), i["edit-shortcut-visibility"] = L.state("editShortcutVisibility").get(), n.send("sync", i), e.currentUrl && (n.previewUrl.unbind(n.refresh), n.previewUrl.set(e.currentUrl), n.previewUrl.bind(n.refresh)), t = {
+ panel: e.activePanels,
+ section: e.activeSections,
+ control: e.activeControls
+ }, _(t).each(function(n, i) {
+ L[i].each(function(e, t) {
+ _.isUndefined(L.settings[i + "s"][t]) && _.isUndefined(n[t]) || (n[t] ? e.activate() : e.deactivate())
+ })
+ }), e.settingValidities && L._handleSettingValidities({
+ settingValidities: e.settingValidities,
+ focusInvalidControl: !1
+ })
+ },
+ keepPreviewAlive: function() {
+ var e, t, n, i;
+ i = function() {
+ t = setTimeout(n, L.settings.timeouts.keepAliveCheck)
+ }, e = function() {
+ L.state("previewerAlive").set(!0), clearTimeout(t), i()
+ }, n = function() {
+ L.state("previewerAlive").set(!1)
+ }, i(), this.bind("ready", e), this.bind("keep-alive", e)
+ },
+ query: function() {},
+ abort: function() {
+ this.loading && (this.loading.destroy(), delete this.loading)
+ },
+ refresh: function() {
+ var e, i = this;
+ i.send("loading-initiated"), i.abort(), i.loading = new L.PreviewFrame({
+ url: i.url(),
+ previewUrl: i.previewUrl(),
+ query: i.query({
+ excludeCustomizedSaved: !0
+ }) || {},
+ container: i.container
+ }), i.settingsModifiedWhileLoading = {}, e = function(e) {
+ i.settingsModifiedWhileLoading[e.id] = !0
+ }, L.bind("change", e), i.loading.always(function() {
+ L.unbind("change", e)
+ }), i.loading.done(function(e) {
+ var t, n = this;
+ i.preview = n, i.targetWindow(n.targetWindow()), i.channel(n.channel()), t = function() {
+ n.unbind("synced", t), i._previousPreview && i._previousPreview.destroy(), i._previousPreview = i.preview, i.deferred.active.resolve(), delete i.loading
+ }, n.bind("synced", t), i.trigger("ready", e)
+ }), i.loading.fail(function(e) {
+ i.send("loading-failed"), "logged out" === e && (i.preview && (i.preview.destroy(), delete i.preview), i.login().done(i.refresh)), "cheatin" === e && i.cheatin()
+ })
+ },
+ login: function() {
+ var t, n, i, a = this;
+ return this._login || (t = H.Deferred(), this._login = t.promise(), n = new L.Messenger({
+ channel: "login",
+ url: L.settings.url.login
+ }), i = H("<iframe />", {
+ src: L.settings.url.login,
+ title: L.l10n.loginIframeTitle
+ }).appendTo(this.container), n.targetWindow(i[0].contentWindow), n.bind("login", function() {
+ var e = a.refreshNonces();
+ e.always(function() {
+ i.remove(), n.destroy(), delete a._login
+ }), e.done(function() {
+ t.resolve()
+ }), e.fail(function() {
+ a.cheatin(), t.reject()
+ })
+ })), this._login
+ },
+ cheatin: function() {
+ H(document.body).empty().addClass("cheatin").append("<h1>" + L.l10n.notAllowedHeading + "</h1><p>" + L.l10n.notAllowed + "</p>")
+ },
+ refreshNonces: function() {
+ var e, t = H.Deferred();
+ return t.promise(), (e = wp.ajax.post("customize_refresh_nonces", {
+ wp_customize: "on",
+ customize_theme: L.settings.theme.stylesheet
+ })).done(function(e) {
+ L.trigger("nonce-refresh", e), t.resolve()
+ }), e.fail(function() {
+ t.reject()
+ }), t
+ }
+ }), L.settingConstructor = {}, L.controlConstructor = {
+ color: L.ColorControl,
+ media: L.MediaControl,
+ upload: L.UploadControl,
+ image: L.ImageControl,
+ cropped_image: L.CroppedImageControl,
+ site_icon: L.SiteIconControl,
+ header: L.HeaderControl,
+ background: L.BackgroundControl,
+ background_position: L.BackgroundPositionControl,
+ theme: L.ThemeControl,
+ date_time: L.DateTimeControl,
+ code_editor: L.CodeEditorControl
+ }, L.panelConstructor = {
+ themes: L.ThemesPanel
+ }, L.sectionConstructor = {
+ themes: L.ThemesSection,
+ outer: L.OuterSection
+ }, L._handleSettingValidities = function(e) {
+ var t, s = [],
+ n = !1;
+ _.each(e.settingValidities, function(t, e) {
+ var o = L(e);
+ o && (_.isObject(t) && _.each(t, function(e, t) {
+ var n, i, a = !1;
+ n = new L.Notification(t, _.extend({
+ fromServer: !0
+ }, e)), (i = o.notifications(n.code)) && (a = n.type !== i.type || n.message !== i.message || !_.isEqual(n.data, i.data)), a && o.notifications.remove(t), o.notifications.has(n.code) || o.notifications.add(n), s.push(o.id)
+ }), o.notifications.each(function(e) {
+ !e.fromServer || "error" !== e.type || !0 !== t && t[e.code] || o.notifications.remove(e.code)
+ }))
+ }), e.focusInvalidControl && (t = L.findControlsForSettings(s), _(_.values(t)).find(function(e) {
+ return _(e).find(function(e) {
+ var t = e.section() && L.section.has(e.section()) && L.section(e.section()).expanded();
+ return t && e.expanded && (t = e.expanded()), t && (e.focus(), n = !0), n
+ })
+ }), n || _.isEmpty(t) || _.values(t)[0][0].focus())
+ }, L.findControlsForSettings = function(e) {
+ var n, i = {};
+ return _.each(_.unique(e), function(e) {
+ var t = L(e);
+ t && (n = t.findControls()) && 0 < n.length && (i[e] = n)
+ }), i
+ }, L.reflowPaneContents = _.bind(function() {
+ var i, e, t, a = [],
+ o = !1;
+ document.activeElement && (e = H(document.activeElement)), L.panel.each(function(e) {
+ if ("themes" !== e.id) {
+ var t = e.sections(),
+ n = _.pluck(t, "headContainer");
+ a.push(e), i = e.contentContainer.is("ul") ? e.contentContainer : e.contentContainer.find("ul:first"), L.utils.areElementListsEqual(n, i.children("[id]")) || (_(t).each(function(e) {
+ i.append(e.headContainer)
+ }), o = !0)
+ }
+ }), L.section.each(function(e) {
+ var t = e.controls(),
+ n = _.pluck(t, "container");
+ e.panel() || a.push(e), i = e.contentContainer.is("ul") ? e.contentContainer : e.contentContainer.find("ul:first"), L.utils.areElementListsEqual(n, i.children("[id]")) || (_(t).each(function(e) {
+ i.append(e.container)
+ }), o = !0)
+ }), a.sort(L.utils.prioritySort), t = _.pluck(a, "headContainer"), i = H("#customize-theme-controls .customize-pane-parent"), L.utils.areElementListsEqual(t, i.children()) || (_(a).each(function(e) {
+ i.append(e.headContainer)
+ }), o = !0), L.panel.each(function(e) {
+ var t = e.active();
+ e.active.callbacks.fireWith(e.active, [t, t])
+ }), L.section.each(function(e) {
+ var t = e.active();
+ e.active.callbacks.fireWith(e.active, [t, t])
+ }), o && e && e.focus(), L.trigger("pane-contents-reflowed")
+ }, L), L.state = new L.Values, _.each(["saved", "saving", "trashing", "activated", "processing", "paneVisible", "expandedPanel", "expandedSection", "changesetDate", "selectedChangesetDate", "changesetStatus", "selectedChangesetStatus", "remainingTimeToPublish", "previewerAlive", "editShortcutVisibility", "changesetLocked", "previewedDevice"], function(e) {
+ L.state.create(e)
+ }), H(function() {
+ if (L.settings = window._wpCustomizeSettings, L.l10n = window._wpCustomizeControlsL10n, L.settings && H.support.postMessage && (H.support.cors || !L.settings.isCrossDomain)) {
+ null === L.PreviewFrame.prototype.sensitivity && (L.PreviewFrame.prototype.sensitivity = L.settings.timeouts.previewFrameSensitivity), null === L.Previewer.prototype.refreshBuffer && (L.Previewer.prototype.refreshBuffer = L.settings.timeouts.windowRefresh);
+ var m, t, n, e, i, a, o, s, r, c, l, d, u, p, h, f, g, v, w, b, C, y, x, k, z, S, T, E, D = H(document.body),
+ P = D.children(".wp-full-overlay"),
+ N = H("#customize-info .panel-title.site-title"),
+ I = H(".customize-controls-close"),
+ U = H("#save"),
+ A = H("#customize-save-button-wrapper"),
+ F = H("#publish-settings"),
+ V = H("#customize-footer-actions");
+ L.bind("ready", function() {
+ L.section.add(new L.OuterSection("publish_settings", {
+ title: L.l10n.publishSettings,
+ priority: 0,
+ active: L.settings.theme.active
+ }))
+ }), L.section("publish_settings", function(t) {
+ var e, n, i, a, o, s, r, c, l, d, u;
+
+ function p() {
+ u || (u = L.utils.highlightButton(A, {
+ delay: 1e3,
+ focusTarget: U
}))
- }), f.section("publish_settings", function(a) {
- function b() {
- r || (r = f.utils.highlightButton(j, {
- delay: 1e3,
- focusTarget: i
- }))
+ }
+
+ function h() {
+ u && (u(), u = null)
+ }
+ n = new L.Control("trash_changeset", {
+ type: "button",
+ section: t.id,
+ priority: 30,
+ input_attrs: {
+ class: "button-link button-link-delete",
+ value: L.l10n.discardChanges
}
+ }), L.control.add(n), n.deferred.embedded.done(function() {
+ n.container.find(".button-link").on("click", function() {
+ confirm(L.l10n.trashConfirm) && wp.customize.previewer.trash()
+ })
+ }), L.control.add(new L.PreviewLinkControl("changeset_preview_link", {
+ section: t.id,
+ priority: 100
+ })), a = function() {
+ return !!L.state("activated").get() && (!L.state("trashing").get() && "trash" !== L.state("changesetStatus").get() && ("" !== L.state("changesetStatus").get() || !L.state("saved").get()))
+ }, t.active.validate = a, i = function() {
+ t.active.set(a())
+ }, L.state("activated").bind(i), L.state("trashing").bind(i), L.state("saved").bind(i), L.state("changesetStatus").bind(i), i(), (e = function() {
+ F.toggle(t.active.get()), U.toggleClass("has-next-sibling", t.active.get())
+ })(), t.active.bind(e), L.state("selectedChangesetStatus").bind(h), t.contentContainer.find(".customize-action").text(L.l10n.updating), t.contentContainer.find(".customize-section-back").removeAttr("tabindex"), F.prop("disabled", !1), F.on("click", function(e) {
+ e.preventDefault(), t.expanded.set(!t.expanded.get())
+ }), t.expanded.bind(function(e) {
+ var t;
+ F.attr("aria-expanded", String(e)), F.toggleClass("active", e), e ? h() : ("" !== (t = L.state("changesetStatus").get()) && "auto-draft" !== t || (t = "publish"), L.state("selectedChangesetStatus").get() !== t ? p() : "future" === L.state("selectedChangesetStatus").get() && L.state("selectedChangesetDate").get() !== L.state("changesetDate").get() && p())
+ }), o = new L.Control("changeset_status", {
+ priority: 10,
+ type: "radio",
+ section: "publish_settings",
+ setting: L.state("selectedChangesetStatus"),
+ templateId: "customize-selected-changeset-status-control",
+ label: L.l10n.action,
+ choices: L.settings.changeset.statusChoices
+ }), L.control.add(o), (s = new L.DateTimeControl("changeset_scheduled_date", {
+ priority: 20,
+ section: "publish_settings",
+ setting: L.state("selectedChangesetDate"),
+ minYear: (new Date).getFullYear(),
+ allowPastDate: !1,
+ includeTime: !0,
+ twelveHourFormat: /a/i.test(L.settings.timeFormat),
+ description: L.l10n.scheduleDescription
+ })).notifications.alt = !0, L.control.add(s), c = function() {
+ L.state("selectedChangesetStatus").set("publish"), L.previewer.save()
+ }, d = function() {
+ var e = "future" === L.state("changesetStatus").get() && "future" === L.state("selectedChangesetStatus").get() && L.state("changesetDate").get() && L.state("selectedChangesetDate").get() === L.state("changesetDate").get() && 0 <= L.utils.getRemainingTime(L.state("changesetDate").get());
+ e && !l ? l = setInterval(function() {
+ var e = L.utils.getRemainingTime(L.state("changesetDate").get());
+ L.state("remainingTimeToPublish").set(e), e <= 0 && (clearInterval(l), l = 0, c())
+ }, 1e3) : !e && l && (clearInterval(l), l = 0)
+ }, L.state("changesetDate").bind(d), L.state("selectedChangesetDate").bind(d), L.state("changesetStatus").bind(d), L.state("selectedChangesetStatus").bind(d), d(), s.active.validate = function() {
+ return "future" === L.state("selectedChangesetStatus").get()
+ }, (r = function(e) {
+ s.active.set("future" === e)
+ })(L.state("selectedChangesetStatus").get()), L.state("selectedChangesetStatus").bind(r), L.state("saving").bind(function(e) {
+ e && "future" === L.state("selectedChangesetStatus").get() && s.toggleFutureDateNotification(!s.isFutureDate())
+ })
+ }), H("#customize-controls").on("keydown", function(e) {
+ var t = 13 === e.which,
+ n = H(e.target);
+ t && (n.is("input:not([type=button])") || n.is("select")) && e.preventDefault()
+ }), H(".customize-info").find("> .accordion-section-title .customize-help-toggle").on("click", function() {
+ var e = H(this).closest(".accordion-section"),
+ t = e.find(".customize-panel-description:first");
+ e.hasClass("cannot-expand") || (e.hasClass("open") ? (e.toggleClass("open"), t.slideUp(L.Panel.prototype.defaultExpandedArguments.duration, function() {
+ t.trigger("toggled")
+ }), H(this).attr("aria-expanded", !1)) : (t.slideDown(L.Panel.prototype.defaultExpandedArguments.duration, function() {
+ t.trigger("toggled")
+ }), e.toggleClass("open"), H(this).attr("aria-expanded", !0)))
+ }), L.previewer = new L.Previewer({
+ container: "#customize-preview",
+ form: "#customize-controls",
+ previewUrl: L.settings.url.preview,
+ allowedUrls: L.settings.url.allowed
+ }, {
+ nonce: L.settings.nonce,
+ query: function(e) {
+ var t = {
+ wp_customize: "on",
+ customize_theme: L.settings.theme.stylesheet,
+ nonce: this.nonce.preview,
+ customize_changeset_uuid: L.settings.changeset.uuid
+ };
+ return !L.settings.changeset.autosaved && L.state("saved").get() || (t.customize_autosaved = "on"), t.customized = JSON.stringify(L.dirtyValues({
+ unsaved: e && e.excludeCustomizedSaved
+ })), t
+ },
+ save: function(o) {
+ var e, t, s = this,
+ r = H.Deferred(),
+ c = L.state("selectedChangesetStatus").get(),
+ l = L.state("selectedChangesetDate").get(),
+ n = L.state("processing"),
+ d = {},
+ u = [],
+ p = [],
+ h = [];
- function c() {
- r && (r(), r = null)
+ function f(e) {
+ d[e.id] = !0
}
- var d, e, g, h, l, m, n, o, p, q, r;
- e = new f.Control("trash_changeset", {
- type: "button",
- section: a.id,
- priority: 30,
- input_attrs: {
- "class": "button-link button-link-delete",
- value: f.l10n.discardChanges
- }
- }), f.control.add(e), e.deferred.embedded.done(function() {
- e.container.find(".button-link").on("click", function() {
- confirm(f.l10n.trashConfirm) && wp.customize.previewer.trash()
- })
- }), f.control.add(new f.PreviewLinkControl("changeset_preview_link", {
- section: a.id,
- priority: 100
- })), h = function() {
- return !!f.state("activated").get() && (!f.state("trashing").get() && "trash" !== f.state("changesetStatus").get() && ("" !== f.state("changesetStatus").get() || !f.state("saved").get()))
- }, a.active.validate = h, g = function() {
- a.active.set(h())
- }, f.state("activated").bind(g), f.state("trashing").bind(g), f.state("saved").bind(g), f.state("changesetStatus").bind(g), g(), d = function() {
- k.toggle(a.active.get()), i.toggleClass("has-next-sibling", a.active.get())
- }, d(), a.active.bind(d), f.state("selectedChangesetStatus").bind(c), a.contentContainer.find(".customize-action").text(f.l10n.updating), a.contentContainer.find(".customize-section-back").removeAttr("tabindex"), k.prop("disabled", !1), k.on("click", function(b) {
- b.preventDefault(), a.expanded.set(!a.expanded.get())
- }), a.expanded.bind(function(a) {
- var d;
- if (k.attr("aria-expanded", String(a)), k.toggleClass("active", a), a) return void c();
- d = f.state("changesetStatus").get(), "" !== d && "auto-draft" !== d || (d = "publish"), f.state("selectedChangesetStatus").get() !== d ? b() : "future" === f.state("selectedChangesetStatus").get() && f.state("selectedChangesetDate").get() !== f.state("changesetDate").get() && b()
- }), l = new f.Control("changeset_status", {
- priority: 10,
- type: "radio",
- section: "publish_settings",
- setting: f.state("selectedChangesetStatus"),
- templateId: "customize-selected-changeset-status-control",
- label: f.l10n.action,
- choices: f.settings.changeset.statusChoices
- }), f.control.add(l), m = new f.DateTimeControl("changeset_scheduled_date", {
- priority: 20,
- section: "publish_settings",
- setting: f.state("selectedChangesetDate"),
- minYear: (new Date).getFullYear(),
- allowPastDate: !1,
- includeTime: !0,
- twelveHourFormat: /a/i.test(f.settings.timeFormat),
- description: f.l10n.scheduleDescription
- }), m.notifications.alt = !0, f.control.add(m), o = function() {
- f.state("selectedChangesetStatus").set("publish"), f.previewer.save()
- }, q = function() {
- var a = "future" === f.state("changesetStatus").get() && "future" === f.state("selectedChangesetStatus").get() && f.state("changesetDate").get() && f.state("selectedChangesetDate").get() === f.state("changesetDate").get() && f.utils.getRemainingTime(f.state("changesetDate").get()) >= 0;
- a && !p ? p = setInterval(function() {
- var a = f.utils.getRemainingTime(f.state("changesetDate").get());
- f.state("remainingTimeToPublish").set(a), a <= 0 && (clearInterval(p), p = 0, o())
- }, 1e3) : !a && p && (clearInterval(p), p = 0)
- }, f.state("changesetDate").bind(q), f.state("selectedChangesetDate").bind(q), f.state("changesetStatus").bind(q), f.state("selectedChangesetStatus").bind(q), q(), m.active.validate = function() {
- return "future" === f.state("selectedChangesetStatus").get()
- }, n = function(a) {
- m.active.set("future" === a)
- }, n(f.state("selectedChangesetStatus").get()), f.state("selectedChangesetStatus").bind(n), f.state("saving").bind(function(a) {
- a && "future" === f.state("selectedChangesetStatus").get() && m.toggleFutureDateNotification(!m.isFutureDate())
- })
- }), b("#customize-controls").on("keydown", function(a) {
- var c = 13 === a.which,
- d = b(a.target);
- c && (d.is("input:not([type=button])") || d.is("select")) && a.preventDefault()
- }), b(".customize-info").find("> .accordion-section-title .customize-help-toggle").on("click", function() {
- var a = b(this).closest(".accordion-section"),
- c = a.find(".customize-panel-description:first");
- a.hasClass("cannot-expand") || (a.hasClass("open") ? (a.toggleClass("open"), c.slideUp(f.Panel.prototype.defaultExpandedArguments.duration, function() {
- c.trigger("toggled")
- }), b(this).attr("aria-expanded", !1)) : (c.slideDown(f.Panel.prototype.defaultExpandedArguments.duration, function() {
- c.trigger("toggled")
- }), a.toggleClass("open"), b(this).attr("aria-expanded", !0)))
- }), f.previewer = new f.Previewer({
- container: "#customize-preview",
- form: "#customize-controls",
- previewUrl: f.settings.url.preview,
- allowedUrls: f.settings.url.allowed
- }, {
- nonce: f.settings.nonce,
- query: function(a) {
- var b = {
- wp_customize: "on",
- customize_theme: f.settings.theme.stylesheet,
- nonce: this.nonce.preview,
- customize_changeset_uuid: f.settings.changeset.uuid
- };
- return !f.settings.changeset.autosaved && f.state("saved").get() || (b.customize_autosaved = "on"), b.customized = JSON.stringify(f.dirtyValues({
- unsaved: a && a.excludeCustomizedSaved
- })), b
- },
- save: function(a) {
- function d(a) {
- m[a.id] = !0
- }
- var e, g, h = this,
- i = b.Deferred(),
- j = f.state("selectedChangesetStatus").get(),
- k = f.state("selectedChangesetDate").get(),
- l = f.state("processing"),
- m = {},
- n = [],
- o = [],
- p = [];
- return a && a.status && (j = a.status), f.state("saving").get() && (i.reject("already_saving"), i.promise()), f.state("saving").set(!0), g = function() {
- var e, g, l = {},
- q = f._latestRevision;
- if (f.bind("change", d), f.notifications.remove("client_side_error"), f.each(function(a) {
- a.notifications.each(function(b) {
- "error" !== b.type || b.fromServer || (n.push(a.id), l[a.id] || (l[a.id] = {}), l[a.id][b.code] = b)
- })
- }), f.control.each(function(a) {
- (!a.setting || !a.setting.id && a.active.get()) && a.notifications.each(function(b) {
- "error" === b.type && p.push([a])
- })
- }), o = _.union(p, _.values(f.findControlsForSettings(n))), !_.isEmpty(o)) return o[0][0].focus(), f.unbind("change", d), n.length && f.notifications.add(new f.Notification("client_side_error", {
- message: (1 === n.length ? f.l10n.saveBlockedError.singular : f.l10n.saveBlockedError.plural).replace(/%s/g, String(n.length)),
+ return o && o.status && (c = o.status), L.state("saving").get() && (r.reject("already_saving"), r.promise()), L.state("saving").set(!0), t = function() {
+ var e, t, n = {},
+ i = L._latestRevision,
+ a = "client_side_error";
+ if (L.bind("change", f), L.notifications.remove(a), L.each(function(t) {
+ t.notifications.each(function(e) {
+ "error" !== e.type || e.fromServer || (u.push(t.id), n[t.id] || (n[t.id] = {}), n[t.id][e.code] = e)
+ })
+ }), L.control.each(function(t) {
+ (!t.setting || !t.setting.id && t.active.get()) && t.notifications.each(function(e) {
+ "error" === e.type && h.push([t])
+ })
+ }), p = _.union(h, _.values(L.findControlsForSettings(u))), !_.isEmpty(p)) return p[0][0].focus(), L.unbind("change", f), u.length && L.notifications.add(new L.Notification(a, {
+ message: (1 === u.length ? L.l10n.saveBlockedError.singular : L.l10n.saveBlockedError.plural).replace(/%s/g, String(u.length)),
+ type: "error",
+ dismissible: !0,
+ saveFailure: !0
+ })), r.rejectWith(s, [{
+ setting_invalidities: n
+ }]), L.state("saving").set(!1), r.promise();
+ t = H.extend(s.query({
+ excludeCustomizedSaved: !1
+ }), {
+ nonce: s.nonce.save,
+ customize_changeset_status: c
+ }), o && o.date ? t.customize_changeset_date = o.date : "future" === c && l && (t.customize_changeset_date = l), o && o.title && (t.customize_changeset_title = o.title), L.trigger("save-request-params", t), e = wp.ajax.post("customize_save", t), L.state("processing").set(L.state("processing").get() + 1), L.trigger("save", e), e.always(function() {
+ L.state("processing").set(L.state("processing").get() - 1), L.state("saving").set(!1), L.unbind("change", f)
+ }), L.notifications.each(function(e) {
+ e.saveFailure && L.notifications.remove(e.code)
+ }), e.fail(function(e) {
+ var t, n;
+ n = {
type: "error",
dismissible: !0,
+ fromServer: !0,
saveFailure: !0
- })), i.rejectWith(h, [{
- setting_invalidities: l
- }]), f.state("saving").set(!1), i.promise();
- g = b.extend(h.query({
- excludeCustomizedSaved: !1
- }), {
- nonce: h.nonce.save,
- customize_changeset_status: j
- }), a && a.date ? g.customize_changeset_date = a.date : "future" === j && k && (g.customize_changeset_date = k), a && a.title && (g.customize_changeset_title = a.title), f.trigger("save-request-params", g), e = wp.ajax.post("customize_save", g), f.state("processing").set(f.state("processing").get() + 1), f.trigger("save", e), e.always(function() {
- f.state("processing").set(f.state("processing").get() - 1), f.state("saving").set(!1), f.unbind("change", d)
- }), f.notifications.each(function(a) {
- a.saveFailure && f.notifications.remove(a.code)
- }), e.fail(function(a) {
- var b, d;
- d = {
- type: "error",
- dismissible: !0,
- fromServer: !0,
- saveFailure: !0
- }, "0" === a ? a = "not_logged_in" : "-1" === a && (a = "invalid_nonce"), "invalid_nonce" === a ? h.cheatin() : "not_logged_in" === a ? (h.preview.iframe.hide(), h.login().done(function() {
- h.save(), h.preview.iframe.show()
- })) : a.code ? "not_future_date" === a.code && f.section.has("publish_settings") && f.section("publish_settings").active.get() && f.control.has("changeset_scheduled_date") ? f.control("changeset_scheduled_date").toggleFutureDateNotification(!0).focus() : "changeset_locked" !== a.code && (b = new f.Notification(a.code, _.extend(d, {
- message: a.message
- }))) : b = new f.Notification("unknown_error", _.extend(d, {
- message: f.l10n.unknownRequestFail
- })), b && f.notifications.add(b), a.setting_validities && f._handleSettingValidities({
- settingValidities: a.setting_validities,
- focusInvalidControl: !0
- }), i.rejectWith(h, [a]), f.trigger("error", a), "changeset_already_published" === a.code && a.next_changeset_uuid && (f.settings.changeset.uuid = a.next_changeset_uuid, f.state("changesetStatus").set(""), f.settings.changeset.branching && c.send("changeset-uuid", f.settings.changeset.uuid), f.previewer.send("changeset-uuid", f.settings.changeset.uuid))
- }), e.done(function(a) {
- h.send("saved", a), f.state("changesetStatus").set(a.changeset_status), a.changeset_date && f.state("changesetDate").set(a.changeset_date), "publish" === a.changeset_status && (f.each(function(a) {
- a._dirty && (_.isUndefined(f._latestSettingRevisions[a.id]) || f._latestSettingRevisions[a.id] <= q) && (a._dirty = !1)
- }), f.state("changesetStatus").set(""), f.settings.changeset.uuid = a.next_changeset_uuid, f.settings.changeset.branching && c.send("changeset-uuid", f.settings.changeset.uuid)), f._lastSavedRevision = Math.max(q, f._lastSavedRevision), a.setting_validities && f._handleSettingValidities({
- settingValidities: a.setting_validities,
- focusInvalidControl: !0
- }), i.resolveWith(h, [a]), f.trigger("saved", a), _.isEmpty(m) || f.state("saved").set(!1)
- })
- }, 0 === l() ? g() : (e = function() {
- 0 === l() && (f.state.unbind("change", e), g())
- }, f.state.bind("change", e)), i.promise()
- },
- trash: function() {
- var a, c, d;
- f.state("trashing").set(!0), f.state("processing").set(f.state("processing").get() + 1), a = wp.ajax.post("customize_trash", {
- customize_changeset_uuid: f.settings.changeset.uuid,
- nonce: f.settings.nonce.trash
- }), f.notifications.add(new f.OverlayNotification("changeset_trashing", {
- type: "info",
- message: f.l10n.revertingChanges,
- loading: !0
- })), c = function() {
- var a, c = document.createElement("a");
- f.state("changesetStatus").set("trash"), f.each(function(a) {
- a._dirty = !1
- }), f.state("saved").set(!0), c.href = location.href, a = f.utils.parseQueryString(c.search.substr(1)), delete a.changeset_uuid, a["return"] = f.settings.url["return"], c.search = b.param(a), location.replace(c.href)
- }, d = function(a, b) {
- var c = a || "unknown_error";
- f.state("processing").set(f.state("processing").get() - 1), f.state("trashing").set(!1), f.notifications.remove("changeset_trashing"), f.notifications.add(new f.Notification(c, {
- message: b || f.l10n.unknownError,
- dismissible: !0,
- type: "error"
- }))
- }, a.done(function(a) {
- c(a.message)
- }), a.fail(function(a) {
- var b = a.code || "trashing_failed";
- a.success || "non_existent_changeset" === b || "changeset_already_trashed" === b ? c(a.message) : d(b, a.message)
+ }, "0" === e ? e = "not_logged_in" : "-1" === e && (e = "invalid_nonce"), "invalid_nonce" === e ? s.cheatin() : "not_logged_in" === e ? (s.preview.iframe.hide(), s.login().done(function() {
+ s.save(), s.preview.iframe.show()
+ })) : e.code ? "not_future_date" === e.code && L.section.has("publish_settings") && L.section("publish_settings").active.get() && L.control.has("changeset_scheduled_date") ? L.control("changeset_scheduled_date").toggleFutureDateNotification(!0).focus() : "changeset_locked" !== e.code && (t = new L.Notification(e.code, _.extend(n, {
+ message: e.message
+ }))) : t = new L.Notification("unknown_error", _.extend(n, {
+ message: L.l10n.unknownRequestFail
+ })), t && L.notifications.add(t), e.setting_validities && L._handleSettingValidities({
+ settingValidities: e.setting_validities,
+ focusInvalidControl: !0
+ }), r.rejectWith(s, [e]), L.trigger("error", e), "changeset_already_published" === e.code && e.next_changeset_uuid && (L.settings.changeset.uuid = e.next_changeset_uuid, L.state("changesetStatus").set(""), L.settings.changeset.branching && m.send("changeset-uuid", L.settings.changeset.uuid), L.previewer.send("changeset-uuid", L.settings.changeset.uuid))
+ }), e.done(function(e) {
+ s.send("saved", e), L.state("changesetStatus").set(e.changeset_status), e.changeset_date && L.state("changesetDate").set(e.changeset_date), "publish" === e.changeset_status && (L.each(function(e) {
+ e._dirty && (_.isUndefined(L._latestSettingRevisions[e.id]) || L._latestSettingRevisions[e.id] <= i) && (e._dirty = !1)
+ }), L.state("changesetStatus").set(""), L.settings.changeset.uuid = e.next_changeset_uuid, L.settings.changeset.branching && m.send("changeset-uuid", L.settings.changeset.uuid)), L._lastSavedRevision = Math.max(i, L._lastSavedRevision), e.setting_validities && L._handleSettingValidities({
+ settingValidities: e.setting_validities,
+ focusInvalidControl: !0
+ }), r.resolveWith(s, [e]), L.trigger("saved", e), _.isEmpty(d) || L.state("saved").set(!1)
+ })
+ }, 0 === n() ? t() : (e = function() {
+ 0 === n() && (L.state.unbind("change", e), t())
+ }, L.state.bind("change", e)), r.promise()
+ },
+ trash: function() {
+ var e, n, i;
+ L.state("trashing").set(!0), L.state("processing").set(L.state("processing").get() + 1), e = wp.ajax.post("customize_trash", {
+ customize_changeset_uuid: L.settings.changeset.uuid,
+ nonce: L.settings.nonce.trash
+ }), L.notifications.add(new L.OverlayNotification("changeset_trashing", {
+ type: "info",
+ message: L.l10n.revertingChanges,
+ loading: !0
+ })), n = function() {
+ var e, t = document.createElement("a");
+ L.state("changesetStatus").set("trash"), L.each(function(e) {
+ e._dirty = !1
+ }), L.state("saved").set(!0), t.href = location.href, delete(e = L.utils.parseQueryString(t.search.substr(1))).changeset_uuid, e.return = L.settings.url.return, t.search = H.param(e), location.replace(t.href)
+ }, i = function(e, t) {
+ var n = e || "unknown_error";
+ L.state("processing").set(L.state("processing").get() - 1), L.state("trashing").set(!1), L.notifications.remove("changeset_trashing"), L.notifications.add(new L.Notification(n, {
+ message: t || L.l10n.unknownError,
+ dismissible: !0,
+ type: "error"
+ }))
+ }, e.done(function(e) {
+ n(e.message)
+ }), e.fail(function(e) {
+ var t = e.code || "trashing_failed";
+ e.success || "non_existent_changeset" === t || "changeset_already_trashed" === t ? n(e.message) : i(t, e.message)
+ })
+ },
+ getFrontendPreviewUrl: function() {
+ var e, t;
+ return (t = document.createElement("a")).href = this.previewUrl.get(), e = L.utils.parseQueryString(t.search.substr(1)), L.state("changesetStatus").get() && "publish" !== L.state("changesetStatus").get() && (e.customize_changeset_uuid = L.settings.changeset.uuid), L.state("activated").get() || (e.customize_theme = L.settings.theme.stylesheet), t.search = H.param(e), t.href
+ }
+ }), H.ajaxPrefilter(function(e) {
+ /wp_customize=on/.test(e.data) && (e.data += "&" + H.param({
+ customize_preview_nonce: L.settings.nonce.preview
+ }))
+ }), L.previewer.bind("nonce", function(e) {
+ H.extend(this.nonce, e)
+ }), L.bind("nonce-refresh", function(e) {
+ H.extend(L.settings.nonce, e), H.extend(L.previewer.nonce, e), L.previewer.send("nonce-refresh", e)
+ }), H.each(L.settings.settings, function(e, t) {
+ var n = L.settingConstructor[t.type] || L.Setting;
+ L.add(new n(e, t.value, {
+ transport: t.transport,
+ previewer: L.previewer,
+ dirty: !!t.dirty
+ }))
+ }), H.each(L.settings.panels, function(e, t) {
+ var n, i = L.panelConstructor[t.type] || L.Panel;
+ n = _.extend({
+ params: t
+ }, t), L.panel.add(new i(e, n))
+ }), H.each(L.settings.sections, function(e, t) {
+ var n, i = L.sectionConstructor[t.type] || L.Section;
+ n = _.extend({
+ params: t
+ }, t), L.section.add(new i(e, n))
+ }), H.each(L.settings.controls, function(e, t) {
+ var n, i = L.controlConstructor[t.type] || L.Control;
+ n = _.extend({
+ params: t
+ }, t), L.control.add(new i(e, n))
+ }), _.each(["panel", "section", "control"], function(e) {
+ var t = L.settings.autofocus[e];
+ t && L[e](t, function(e) {
+ e.deferred.embedded.done(function() {
+ L.previewer.deferred.active.done(function() {
+ e.focus()
})
+ })
+ })
+ }), L.bind("ready", L.reflowPaneContents), H([L.panel, L.section, L.control]).each(function(e, t) {
+ var n = _.debounce(L.reflowPaneContents, L.settings.timeouts.reflowPaneContents);
+ t.bind("add", n), t.bind("change", n), t.bind("remove", n)
+ }), L.bind("ready", function() {
+ var e, t, n;
+ L.notifications.container = H("#customize-notifications-area"), L.notifications.bind("change", _.debounce(function() {
+ L.notifications.render()
+ })), e = H(".wp-full-overlay-sidebar-content"), L.notifications.bind("rendered", function() {
+ e.css("top", ""), 0 !== L.notifications.count() && (t = L.notifications.container.outerHeight() + 1, n = parseInt(e.css("top"), 10), e.css("top", n + t + "px")), L.notifications.trigger("sidebarTopUpdated")
+ }), L.notifications.render()
+ }), t = L.state, i = t.instance("saved"), a = t.instance("saving"), o = t.instance("trashing"), s = t.instance("activated"), r = t.instance("processing"), c = t.instance("paneVisible"), l = t.instance("expandedPanel"), d = t.instance("expandedSection"), u = t.instance("changesetStatus"), p = t.instance("selectedChangesetStatus"), h = t.instance("changesetDate"), f = t.instance("selectedChangesetDate"), g = t.instance("previewerAlive"), v = t.instance("editShortcutVisibility"), w = t.instance("changesetLocked"), t.bind("change", function() {
+ var e;
+ s() ? "" === u.get() && i() ? (L.settings.changeset.currentUserCanPublish ? U.val(L.l10n.published) : U.val(L.l10n.saved), I.find(".screen-reader-text").text(L.l10n.close)) : ("draft" === p() ? i() && p() === u() ? U.val(L.l10n.draftSaved) : U.val(L.l10n.saveDraft) : "future" === p() ? i() && p() === u() ? h.get() !== f.get() ? U.val(L.l10n.schedule) : U.val(L.l10n.scheduled) : U.val(L.l10n.schedule) : L.settings.changeset.currentUserCanPublish && U.val(L.l10n.publish), I.find(".screen-reader-text").text(L.l10n.cancel)) : (U.val(L.l10n.activate), I.find(".screen-reader-text").text(L.l10n.cancel)), e = !a() && !o() && !w() && (!s() || !i() || u() !== p() && "" !== u() || "future" === p() && h.get() !== f.get()), U.prop("disabled", !e)
+ }), p.validate = function(e) {
+ return "" === e || "auto-draft" === e ? null : e
+ }, e = L.settings.changeset.currentUserCanPublish ? "publish" : "draft", u(L.settings.changeset.status), w(Boolean(L.settings.changeset.lockUser)), h(L.settings.changeset.publishDate), f(L.settings.changeset.publishDate), p("" === L.settings.changeset.status || "auto-draft" === L.settings.changeset.status ? e : L.settings.changeset.status), p.link(u), i(!0), "" === u() && L.each(function(e) {
+ e._dirty && i(!1)
+ }), a(!1), s(L.settings.theme.active), r(0), c(!0), l(!1), d(!1), g(!0), v("visible"), L.bind("change", function() {
+ t("saved").get() && t("saved").set(!1)
+ }), L.settings.changeset.branching && i.bind(function(e) {
+ e || n(!0)
+ }), a.bind(function(e) {
+ D.toggleClass("saving", e)
+ }), o.bind(function(e) {
+ D.toggleClass("trashing", e)
+ }), L.bind("saved", function(e) {
+ t("saved").set(!0), "publish" === e.changeset_status && t("activated").set(!0)
+ }), s.bind(function(e) {
+ e && L.trigger("activated")
+ }), n = function(e) {
+ var t, n;
+ if (history.replaceState) {
+ if ((t = document.createElement("a")).href = location.href, n = L.utils.parseQueryString(t.search.substr(1)), e) {
+ if (n.changeset_uuid === L.settings.changeset.uuid) return;
+ n.changeset_uuid = L.settings.changeset.uuid
+ } else {
+ if (!n.changeset_uuid) return;
+ delete n.changeset_uuid
+ }
+ t.search = H.param(n), history.replaceState({}, document.title, t.href)
+ }
+ }, L.settings.changeset.branching && u.bind(function(e) {
+ n("" !== e && "publish" !== e && "trash" !== e)
+ }),
+ function() {
+ var t = L.OverlayNotification.extend({
+ templateId: "customize-changeset-locked-notification",
+ lockUser: null,
+ initialize: function(e, t) {
+ var n, i;
+ n = e || "changeset_locked", (i = _.extend({
+ type: "warning",
+ containerClasses: "",
+ lockUser: {}
+ }, t)).containerClasses += " notification-changeset-locked", L.OverlayNotification.prototype.initialize.call(this, n, i)
},
- getFrontendPreviewUrl: function() {
- var a, c, d = this;
- return c = document.createElement("a"), c.href = d.previewUrl.get(), a = f.utils.parseQueryString(c.search.substr(1)), f.state("changesetStatus").get() && "publish" !== f.state("changesetStatus").get() && (a.customize_changeset_uuid = f.settings.changeset.uuid), f.state("activated").get() || (a.customize_theme = f.settings.theme.stylesheet), c.search = b.param(a), c.href
+ render: function() {
+ var n, e, i, a, t = this;
+ return e = _.extend({
+ allowOverride: !1,
+ returnUrl: L.settings.url.return,
+ previewUrl: L.previewer.previewUrl.get(),
+ frontendPreviewUrl: L.previewer.getFrontendPreviewUrl()
+ }, this), n = L.OverlayNotification.prototype.render.call(e), L.requestChangesetUpdate({}, {
+ autosave: !0
+ }).fail(function(e) {
+ e.autosaved || n.find(".notice-error").prop("hidden", !1).text(e.message || L.l10n.unknownRequestFail)
+ }), (i = n.find(".customize-notice-take-over-button")).on("click", function(e) {
+ e.preventDefault(), a || (i.addClass("disabled"), (a = wp.ajax.post("customize_override_changeset_lock", {
+ wp_customize: "on",
+ customize_theme: L.settings.theme.stylesheet,
+ customize_changeset_uuid: L.settings.changeset.uuid,
+ nonce: L.settings.nonce.override_lock
+ })).done(function() {
+ L.notifications.remove(t.code), L.state("changesetLocked").set(!1)
+ }), a.fail(function(e) {
+ var t = e.message || L.l10n.unknownRequestFail;
+ n.find(".notice-error").prop("hidden", !1).text(t), a.always(function() {
+ i.removeClass("disabled")
+ })
+ }), a.always(function() {
+ a = null
+ }))
+ }), n
}
- }), b.ajaxPrefilter(function(a) {
- /wp_customize=on/.test(a.data) && (a.data += "&" + b.param({
- customize_preview_nonce: f.settings.nonce.preview
+ });
+
+ function a(e) {
+ e && e.lockUser && (L.settings.changeset.lockUser = e.lockUser), L.state("changesetLocked").set(!0), L.notifications.add(new t("changeset_locked", {
+ lockUser: L.settings.changeset.lockUser,
+ allowOverride: Boolean(e && e.allowOverride)
}))
- }), f.previewer.bind("nonce", function(a) {
- b.extend(this.nonce, a)
- }), f.bind("nonce-refresh", function(a) {
- b.extend(f.settings.nonce, a), b.extend(f.previewer.nonce, a), f.previewer.send("nonce-refresh", a)
- }), b.each(f.settings.settings, function(a, b) {
- var c = f.settingConstructor[b.type] || f.Setting;
- f.add(new c(a, b.value, {
- transport: b.transport,
- previewer: f.previewer,
- dirty: !!b.dirty
+ }
+ L.settings.changeset.lockUser && a({
+ allowOverride: !0
+ }), H(document).on("heartbeat-send.update_lock_notice", function(e, t) {
+ t.check_changeset_lock = !0, t.changeset_uuid = L.settings.changeset.uuid
+ }), H(document).on("heartbeat-tick.update_lock_notice", function(e, t) {
+ var n, i = "changeset_locked";
+ t.customize_changeset_lock_user && ((n = L.notifications(i)) && n.lockUser.id !== L.settings.changeset.lockUser.id && L.notifications.remove(i), a({
+ lockUser: t.customize_changeset_lock_user
}))
- }), b.each(f.settings.panels, function(a, b) {
- var c, d = f.panelConstructor[b.type] || f.Panel;
- c = _.extend({
- params: b
- }, b), f.panel.add(new d(a, c))
- }), b.each(f.settings.sections, function(a, b) {
- var c, d = f.sectionConstructor[b.type] || f.Section;
- c = _.extend({
- params: b
- }, b), f.section.add(new d(a, c))
- }), b.each(f.settings.controls, function(a, b) {
- var c, d = f.controlConstructor[b.type] || f.Control;
- c = _.extend({
- params: b
- }, b), f.control.add(new d(a, c))
- }), _.each(["panel", "section", "control"], function(a) {
- var b = f.settings.autofocus[a];
- b && f[a](b, function(a) {
- a.deferred.embedded.done(function() {
- f.previewer.deferred.active.done(function() {
- a.focus()
- })
- })
+ }), L.bind("error", function(e) {
+ "changeset_locked" === e.code && e.lock_user && a({
+ lockUser: e.lock_user
})
- }), f.bind("ready", f.reflowPaneContents), b([f.panel, f.section, f.control]).each(function(a, b) {
- var c = _.debounce(f.reflowPaneContents, f.settings.timeouts.reflowPaneContents);
- b.bind("add", c), b.bind("change", c), b.bind("remove", c)
- }), f.bind("ready", function() {
- var a, c, d;
- f.notifications.container = b("#customize-notifications-area"), f.notifications.bind("change", _.debounce(function() {
- f.notifications.render()
- })), a = b(".wp-full-overlay-sidebar-content"), f.notifications.bind("rendered", function() {
- a.css("top", ""), 0 !== f.notifications.count() && (c = f.notifications.container.outerHeight() + 1, d = parseInt(a.css("top"), 10), a.css("top", d + c + "px")), f.notifications.trigger("sidebarTopUpdated")
- }), f.notifications.render()
- }),
- function(a) {
- var c, e, g = a.instance("saved"),
- j = a.instance("saving"),
- k = a.instance("trashing"),
- l = a.instance("activated"),
- m = a.instance("processing"),
- n = a.instance("paneVisible"),
- o = a.instance("expandedPanel"),
- p = a.instance("expandedSection"),
- q = a.instance("changesetStatus"),
- r = a.instance("selectedChangesetStatus"),
- s = a.instance("changesetDate"),
- t = a.instance("selectedChangesetDate"),
- u = a.instance("previewerAlive"),
- v = a.instance("editShortcutVisibility"),
- w = a.instance("changesetLocked");
- a.bind("change", function() {
- var a;
- l() ? "" === q.get() && g() ? (f.settings.changeset.currentUserCanPublish ? i.val(f.l10n.published) : i.val(f.l10n.saved), h.find(".screen-reader-text").text(f.l10n.close)) : ("draft" === r() ? g() && r() === q() ? i.val(f.l10n.draftSaved) : i.val(f.l10n.saveDraft) : "future" === r() ? g() && r() === q() ? s.get() !== t.get() ? i.val(f.l10n.schedule) : i.val(f.l10n.scheduled) : i.val(f.l10n.schedule) : f.settings.changeset.currentUserCanPublish && i.val(f.l10n.publish), h.find(".screen-reader-text").text(f.l10n.cancel)) : (i.val(f.l10n.activate), h.find(".screen-reader-text").text(f.l10n.cancel)), a = !j() && !k() && !w() && (!l() || !g() || q() !== r() && "" !== q() || "future" === r() && s.get() !== t.get()), i.prop("disabled", !a)
- }), r.validate = function(a) {
- return "" === a || "auto-draft" === a ? null : a
- }, e = f.settings.changeset.currentUserCanPublish ? "publish" : "draft", q(f.settings.changeset.status), w(Boolean(f.settings.changeset.lockUser)), s(f.settings.changeset.publishDate), t(f.settings.changeset.publishDate), r("" === f.settings.changeset.status || "auto-draft" === f.settings.changeset.status ? e : f.settings.changeset.status), r.link(q), g(!0), "" === q() && f.each(function(a) {
- a._dirty && g(!1)
- }), j(!1), l(f.settings.theme.active), m(0), n(!0), o(!1), p(!1), u(!0), v("visible"), f.bind("change", function() {
- a("saved").get() && a("saved").set(!1)
- }), f.settings.changeset.branching && g.bind(function(a) {
- a || c(!0)
- }), j.bind(function(a) {
- d.toggleClass("saving", a)
- }), k.bind(function(a) {
- d.toggleClass("trashing", a)
- }), f.bind("saved", function(b) {
- a("saved").set(!0), "publish" === b.changeset_status && a("activated").set(!0)
- }), l.bind(function(a) {
- a && f.trigger("activated")
- }), c = function(a) {
- var c, d;
- if (history.replaceState) {
- if (c = document.createElement("a"), c.href = location.href, d = f.utils.parseQueryString(c.search.substr(1)), a) {
- if (d.changeset_uuid === f.settings.changeset.uuid) return;
- d.changeset_uuid = f.settings.changeset.uuid
- } else {
- if (!d.changeset_uuid) return;
- delete d.changeset_uuid
- }
- c.search = b.param(d),
- history.replaceState({}, document.title, c.href)
- }
- }, f.settings.changeset.branching && q.bind(function(a) {
- c("" !== a && "publish" !== a && "trash" !== a)
- })
- }(f.state),
- function() {
- function a(a) {
- a && a.lockUser && (f.settings.changeset.lockUser = a.lockUser), f.state("changesetLocked").set(!0), f.notifications.add(new c("changeset_locked", {
- lockUser: f.settings.changeset.lockUser,
- allowOverride: Boolean(a && a.allowOverride)
- }))
+ })
+ }(),
+ function() {
+ var e, t, n, i, a, o, s = [],
+ r = !1;
+
+ function c() {
+ var e, t;
+ return (e = document.createElement("a")).href = location.href, t = L.utils.parseQueryString(e.search.substr(1)), L.settings.changeset.latestAutoDraftUuid ? t.changeset_uuid = L.settings.changeset.latestAutoDraftUuid : t.customize_autosaved = "on", t.return = L.settings.url.return, e.search = H.param(t), e.href
+ }
+
+ function l() {
+ r || (wp.ajax.post("customize_dismiss_autosave_or_lock", {
+ wp_customize: "on",
+ customize_theme: L.settings.theme.stylesheet,
+ customize_changeset_uuid: L.settings.changeset.uuid,
+ nonce: L.settings.nonce.dismiss_autosave_or_lock,
+ dismiss_autosave: !0
+ }), r = !0)
+ }
+ L.settings.changeset.autosaved && (L.state("saved").set(!1), s.push("customize_autosaved")), L.settings.changeset.branching || L.settings.changeset.status && "auto-draft" !== L.settings.changeset.status || s.push("changeset_uuid"), 0 < s.length && (e = s, n = document.createElement("a"), i = 0, n.href = location.href, t = L.utils.parseQueryString(n.search.substr(1)), _.each(e, function(e) {
+ void 0 !== t[e] && (i += 1, delete t[e])
+ }), 0 !== i && (n.search = H.param(t), history.replaceState({}, document.title, n.href))), (L.settings.changeset.latestAutoDraftUuid || L.settings.changeset.hasAutosaveRevision) && (o = "autosave_available", L.notifications.add(new L.Notification(o, {
+ message: L.l10n.autosaveNotice,
+ type: "warning",
+ dismissible: !0,
+ render: function() {
+ var e, t = L.Notification.prototype.render.call(this);
+ return (e = t.find("a")).prop("href", c()), e.on("click", function(e) {
+ e.preventDefault(), location.replace(c())
+ }), t.find(".notice-dismiss").on("click", l), t
}
- var c = f.OverlayNotification.extend({
- templateId: "customize-changeset-locked-notification",
- lockUser: null,
- initialize: function(a, b) {
- var c, d, e = this;
- c = a || "changeset_locked", d = _.extend({
- type: "warning",
- containerClasses: "",
- lockUser: {}
- }, b), d.containerClasses += " notification-changeset-locked", f.OverlayNotification.prototype.initialize.call(e, c, d)
- },
- render: function() {
- var a, b, c, d, e = this;
- return b = _.extend({
- allowOverride: !1,
- returnUrl: f.settings.url["return"],
- previewUrl: f.previewer.previewUrl.get(),
- frontendPreviewUrl: f.previewer.getFrontendPreviewUrl()
- }, this), a = f.OverlayNotification.prototype.render.call(b), f.requestChangesetUpdate({}, {
- autosave: !0
- }).fail(function(b) {
- b.autosaved || a.find(".notice-error").prop("hidden", !1).text(b.message || f.l10n.unknownRequestFail)
- }), c = a.find(".customize-notice-take-over-button"), c.on("click", function(b) {
- b.preventDefault(), d || (c.addClass("disabled"), d = wp.ajax.post("customize_override_changeset_lock", {
- wp_customize: "on",
- customize_theme: f.settings.theme.stylesheet,
- customize_changeset_uuid: f.settings.changeset.uuid,
- nonce: f.settings.nonce.override_lock
- }), d.done(function() {
- f.notifications.remove(e.code), f.state("changesetLocked").set(!1)
- }), d.fail(function(b) {
- var e = b.message || f.l10n.unknownRequestFail;
- a.find(".notice-error").prop("hidden", !1).text(e), d.always(function() {
- c.removeClass("disabled")
- })
- }), d.always(function() {
- d = null
- }))
- }), a
- }
- });
- f.settings.changeset.lockUser && a({
- allowOverride: !0
- }), b(document).on("heartbeat-send.update_lock_notice", function(a, b) {
- b.check_changeset_lock = !0, b.changeset_uuid = f.settings.changeset.uuid
- }), b(document).on("heartbeat-tick.update_lock_notice", function(b, c) {
- var d, e = "changeset_locked";
- c.customize_changeset_lock_user && (d = f.notifications(e), d && d.lockUser.id !== f.settings.changeset.lockUser.id && f.notifications.remove(e), a({
- lockUser: c.customize_changeset_lock_user
- }))
- }), f.bind("error", function(b) {
- "changeset_locked" === b.code && b.lock_user && a({
- lockUser: b.lock_user
- })
+ })), a = function() {
+ l(), L.notifications.remove(o), L.unbind("change", a), L.state("changesetStatus").unbind(a)
+ }, L.bind("change", a), L.state("changesetStatus").bind(a))
+ }(), L.previewer.previewUrl() ? L.previewer.refresh() : L.previewer.previewUrl(L.settings.url.home), U.click(function(e) {
+ L.previewer.save(), e.preventDefault()
+ }).keydown(function(e) {
+ 9 !== e.which && (13 === e.which && L.previewer.save(), e.preventDefault())
+ }), I.keydown(function(e) {
+ 9 !== e.which && (13 === e.which && this.click(), e.preventDefault())
+ }), H(".collapse-sidebar").on("click", function() {
+ L.state("paneVisible").set(!L.state("paneVisible").get())
+ }), L.state("paneVisible").bind(function(e) {
+ P.toggleClass("preview-only", !e), P.toggleClass("expanded", e), P.toggleClass("collapsed", !e), e ? H(".collapse-sidebar").attr({
+ "aria-expanded": "true",
+ "aria-label": L.l10n.collapseSidebar
+ }) : H(".collapse-sidebar").attr({
+ "aria-expanded": "false",
+ "aria-label": L.l10n.expandSidebar
+ })
+ }), D.on("keydown", function(e) {
+ var t, n = [],
+ i = [],
+ a = [];
+ if (27 === e.which && (H(e.target).is("body") || H.contains(H("#customize-controls")[0], e.target)) && (L.control.each(function(e) {
+ e.expanded && e.expanded() && _.isFunction(e.collapse) && n.push(e)
+ }), L.section.each(function(e) {
+ e.expanded() && i.push(e)
+ }), L.panel.each(function(e) {
+ e.expanded() && a.push(e)
+ }), 0 < n.length && 0 === i.length && (n.length = 0), t = n[0] || i[0] || a[0])) {
+ if ("themes" === t.params.type) return void(D.hasClass("modal-open") ? t.closeDetails() : L.panel.has("themes") && L.panel("themes").collapse());
+ t.collapse(), e.preventDefault()
+ }
+ }), H(".customize-controls-preview-toggle").on("click", function() {
+ L.state("paneVisible").set(!L.state("paneVisible").get())
+ }), T = H(".wp-full-overlay-sidebar-content"), b = function(e) {
+ var t, n = e,
+ i = L.state("expandedSection").get(),
+ a = L.state("expandedPanel").get();
+ if (z && z.element && (y(z.element), z.element.find(".description").off("toggled", C)), !n)
+ if (!i && a && a.contentContainer) n = a;
+ else {
+ if (a || !i || !i.contentContainer) return void(z = !1);
+ n = i
+ }(t = n.contentContainer.find(".customize-section-title, .panel-meta").first()). length ? ((z = {
+ instance: n,
+ element: t,
+ parent: t.closest(".customize-pane-child"),
+ height: t.outerHeight()
+ }).element.find(".description").on("toggled", C), i && x(z.element, z.parent)) : z = !1
+ }, L.state("expandedSection").bind(b), L.state("expandedPanel").bind(b), T.on("scroll", _.throttle(function() {
+ if (z) {
+ var e, t = T.scrollTop();
+ e = S ? t === S ? 0 : S < t ? 1 : -1 : 1, S = t, 0 !== e && k(z, t, e)
+ }
+ }, 8)), L.notifications.bind("sidebarTopUpdated", function() {
+ z && z.element.hasClass("is-sticky") && z.element.css("top", T.css("top"))
+ }), y = function(e) {
+ e.hasClass("is-sticky") && e.removeClass("is-sticky").addClass("maybe-sticky is-in-view").css("top", T.scrollTop() + "px")
+ }, x = function(e, t) {
+ e.hasClass("is-in-view") && (e.removeClass("maybe-sticky is-in-view").css({
+ width: "",
+ top: ""
+ }), t.css("padding-top", ""))
+ }, C = function() {
+ z.height = z.element.outerHeight()
+ }, k = function(e, t, n) {
+ var i = e.element,
+ a = e.parent,
+ o = e.height,
+ s = parseInt(i.css("top"), 10),
+ r = i.hasClass("maybe-sticky"),
+ c = i.hasClass("is-sticky"),
+ l = i.hasClass("is-in-view");
+ if (-1 !== n) return c && (s = t, i.removeClass("is-sticky").css({
+ top: s + "px",
+ width: ""
+ })), void(l && s + o < t && (i.removeClass("is-in-view"), a.css("padding-top", "")));
+ if (!r && o <= t) r = !0, i.addClass("maybe-sticky");
+ else if (0 === t) return i.removeClass("maybe-sticky is-in-view is-sticky").css({
+ top: "",
+ width: ""
+ }), void a.css("padding-top", "");
+ l && !c ? t <= s && i.addClass("is-sticky").css({
+ top: T.css("top"),
+ width: a.outerWidth() + "px"
+ }) : r && !l && (i.addClass("is-in-view").css("top", t - o + "px"), a.css("padding-top", o + "px"))
+ }, L.previewedDevice = L.state("previewedDevice"), L.bind("ready", function() {
+ _.find(L.settings.previewableDevices, function(e, t) {
+ if (!0 === e.default) return L.previewedDevice.set(t), !0
+ })
+ }), V.find(".devices button").on("click", function(e) {
+ L.previewedDevice.set(H(e.currentTarget).data("device"))
+ }), L.previewedDevice.bind(function(e) {
+ var t = H(".wp-full-overlay"),
+ n = "";
+ V.find(".devices button").removeClass("active").attr("aria-pressed", !1), V.find(".devices .preview-" + e).addClass("active").attr("aria-pressed", !0), H.each(L.settings.previewableDevices, function(e) {
+ n += " preview-" + e
+ }), t.removeClass(n).addClass("preview-" + e)
+ }), N.length && L("blogname", function(e) {
+ var t = function() {
+ N.text(H.trim(e()) || L.l10n.untitledBlogName)
+ };
+ e.bind(t), t()
+ }), m = new L.Messenger({
+ url: L.settings.url.parent,
+ channel: "loader"
+ }),
+ function() {
+ var t = !1;
+
+ function i() {
+ var e;
+ return L.state("activated").get() ? ("" !== (e = L.state("changesetStatus").get()) && "auto-draft" !== e || (e = "publish"), L.state("selectedChangesetStatus").get() === e && (("future" !== L.state("selectedChangesetStatus").get() || L.state("selectedChangesetDate").get() === L.state("changesetDate").get()) && (L.state("saved").get() && "auto-draft" !== L.state("changesetStatus").get()))) : 0 === L._latestRevision
+ }
+
+ function e() {
+ L.unbind("change", e), L.state("selectedChangesetStatus").unbind(e), L.state("selectedChangesetDate").unbind(e), H(window).on("beforeunload.customize-confirm", function() {
+ if (!i() && !L.state("changesetLocked").get()) return setTimeout(function() {
+ P.removeClass("customize-loading")
+ }, 1), L.l10n.saveAlert
})
- }(),
- function() {
- function a() {
- var a, c;
- return a = document.createElement("a"), a.href = location.href, c = f.utils.parseQueryString(a.search.substr(1)), f.settings.changeset.latestAutoDraftUuid ? c.changeset_uuid = f.settings.changeset.latestAutoDraftUuid : c.customize_autosaved = "on", c["return"] = f.settings.url["return"], a.search = b.param(c), a.href
- }
+ }
- function c() {
- e || (wp.ajax.post("customize_dismiss_autosave_or_lock", {
+ function n() {
+ var e = H.Deferred(),
+ t = !1,
+ n = !1;
+ return i() ? n = !0 : confirm(L.l10n.saveAlert) ? (n = !0, L.each(function(e) {
+ e._dirty = !1
+ }), H(document).off("visibilitychange.wp-customize-changeset-update"), H(window).off("beforeunload.wp-customize-changeset-update"), I.css("cursor", "progress"), "" !== L.state("changesetStatus").get() && (t = !0)) : e.reject(), (n || t) && wp.ajax.send("customize_dismiss_autosave_or_lock", {
+ timeout: 500,
+ data: {
wp_customize: "on",
- customize_theme: f.settings.theme.stylesheet,
- customize_changeset_uuid: f.settings.changeset.uuid,
- nonce: f.settings.nonce.dismiss_autosave_or_lock,
- dismiss_autosave: !0
- }), e = !0)
- }
- var d = [],
- e = !1;
- f.settings.changeset.autosaved && (f.state("saved").set(!1), d.push("customize_autosaved")), f.settings.changeset.branching || f.settings.changeset.status && "auto-draft" !== f.settings.changeset.status || d.push("changeset_uuid"), d.length > 0 && function(a) {
- var c, d = document.createElement("a"),
- e = 0;
- d.href = location.href, c = f.utils.parseQueryString(d.search.substr(1)), _.each(a, function(a) {
- "undefined" != typeof c[a] && (e += 1, delete c[a])
- }), 0 !== e && (d.search = b.param(c), history.replaceState({}, document.title, d.href))
- }(d), (f.settings.changeset.latestAutoDraftUuid || f.settings.changeset.hasAutosaveRevision) && function() {
- var b, d = "autosave_available";
- f.notifications.add(new f.Notification(d, {
- message: f.l10n.autosaveNotice,
- type: "warning",
- dismissible: !0,
- render: function() {
- var b, d = f.Notification.prototype.render.call(this);
- return b = d.find("a"), b.prop("href", a()), b.on("click", function(b) {
- b.preventDefault(), location.replace(a())
- }), d.find(".notice-dismiss").on("click", c), d
- }
- })), b = function() {
- c(), f.notifications.remove(d), f.unbind("change", b), f.state("changesetStatus").unbind(b)
- }, f.bind("change", b), f.state("changesetStatus").bind(b)
- }()
- }(), f.previewer.previewUrl() ? f.previewer.refresh() : f.previewer.previewUrl(f.settings.url.home), i.click(function(a) {
- f.previewer.save(), a.preventDefault()
- }).keydown(function(a) {
- 9 !== a.which && (13 === a.which && f.previewer.save(), a.preventDefault())
- }), h.keydown(function(a) {
- 9 !== a.which && (13 === a.which && this.click(), a.preventDefault())
- }), b(".collapse-sidebar").on("click", function() {
- f.state("paneVisible").set(!f.state("paneVisible").get())
- }), f.state("paneVisible").bind(function(a) {
- e.toggleClass("preview-only", !a), e.toggleClass("expanded", a), e.toggleClass("collapsed", !a), a ? b(".collapse-sidebar").attr({
- "aria-expanded": "true",
- "aria-label": f.l10n.collapseSidebar
- }) : b(".collapse-sidebar").attr({
- "aria-expanded": "false",
- "aria-label": f.l10n.expandSidebar
- })
- }), d.on("keydown", function(a) {
- var c, e = [],
- g = [],
- h = [];
- if (27 === a.which && (b(a.target).is("body") || b.contains(b("#customize-controls")[0], a.target)) && (f.control.each(function(a) {
- a.expanded && a.expanded() && _.isFunction(a.collapse) && e.push(a)
- }), f.section.each(function(a) {
- a.expanded() && g.push(a)
- }), f.panel.each(function(a) {
- a.expanded() && h.push(a)
- }), e.length > 0 && 0 === g.length && (e.length = 0), c = e[0] || g[0] || h[0])) {
- if ("themes" === c.params.type) return void(d.hasClass("modal-open") ? c.closeDetails() : f.panel.has("themes") && f.panel("themes").collapse());
- c.collapse(), a.preventDefault()
- }
- }), b(".customize-controls-preview-toggle").on("click", function() {
- f.state("paneVisible").set(!f.state("paneVisible").get())
- }),
- function() {
- var a, c, d, e, g, h, i, j = b(".wp-full-overlay-sidebar-content");
- a = function(a) {
- var b, g = a,
- i = f.state("expandedSection").get(),
- j = f.state("expandedPanel").get();
- if (h && h.element && (d(h.element), h.element.find(".description").off("toggled", c)), !g)
- if (!i && j && j.contentContainer) g = j;
- else {
- if (j || !i || !i.contentContainer) return void(h = !1);
- g = i
- } b = g.contentContainer.find(".customize-section-title, .panel-meta").first(), b.length ? (h = {
- instance: g,
- element: b,
- parent: b.closest(".customize-pane-child"),
- height: b.outerHeight()
- }, h.element.find(".description").on("toggled", c), i && e(h.element, h.parent)) : h = !1
- }, f.state("expandedSection").bind(a), f.state("expandedPanel").bind(a), j.on("scroll", _.throttle(function() {
- if (h) {
- var a, b = j.scrollTop();
- a = i ? b === i ? 0 : b > i ? 1 : -1 : 1, i = b, 0 !== a && g(h, b, a)
+ customize_theme: L.settings.theme.stylesheet,
+ customize_changeset_uuid: L.settings.changeset.uuid,
+ nonce: L.settings.nonce.dismiss_autosave_or_lock,
+ dismiss_autosave: t,
+ dismiss_lock: n
}
- }, 8)), f.notifications.bind("sidebarTopUpdated", function() {
- h && h.element.hasClass("is-sticky") && h.element.css("top", j.css("top"))
- }), d = function(a) {
- a.hasClass("is-sticky") && a.removeClass("is-sticky").addClass("maybe-sticky is-in-view").css("top", j.scrollTop() + "px")
- }, e = function(a, b) {
- a.hasClass("is-in-view") && (a.removeClass("maybe-sticky is-in-view").css({
- width: "",
- top: ""
- }), b.css("padding-top", ""))
- }, c = function() {
- h.height = h.element.outerHeight()
- }, g = function(a, b, c) {
- var d = a.element,
- e = a.parent,
- f = a.height,
- g = parseInt(d.css("top"), 10),
- h = d.hasClass("maybe-sticky"),
- i = d.hasClass("is-sticky"),
- k = d.hasClass("is-in-view");
- if (-1 !== c) return i && (g = b, d.removeClass("is-sticky").css({
- top: g + "px",
- width: ""
- })), void(k && b > g + f && (d.removeClass("is-in-view"), e.css("padding-top", "")));
- if (!h && b >= f) h = !0, d.addClass("maybe-sticky");
- else if (0 === b) return d.removeClass("maybe-sticky is-in-view is-sticky").css({
- top: "",
- width: ""
- }), void e.css("padding-top", "");
- k && !i ? g >= b && d.addClass("is-sticky").css({
- top: j.css("top"),
- width: e.outerWidth() + "px"
- }) : h && !k && (d.addClass("is-in-view").css("top", b - f + "px"), e.css("padding-top", f + "px"))
- }
- }(), f.previewedDevice = f.state("previewedDevice"), f.bind("ready", function() {
- _.find(f.settings.previewableDevices, function(a, b) {
- if (!0 === a["default"]) return f.previewedDevice.set(b), !0
+ }).always(function() {
+ e.resolve()
+ }), e.promise()
+ }
+ m.bind("back", function() {
+ t = !0
+ }), L.bind("change", e), L.state("selectedChangesetStatus").bind(e), L.state("selectedChangesetDate").bind(e), m.bind("confirm-close", function() {
+ n().done(function() {
+ m.send("confirmed-close", !0)
+ }).fail(function() {
+ m.send("confirmed-close", !1)
+ })
+ }), I.on("click.customize-controls-close", function(e) {
+ e.preventDefault(), t ? m.send("close") : n().done(function() {
+ H(window).off("beforeunload.customize-confirm"), window.location.href = I.prop("href")
})
- }), l.find(".devices button").on("click", function(a) {
- f.previewedDevice.set(b(a.currentTarget).data("device"))
- }), f.previewedDevice.bind(function(a) {
- var c = b(".wp-full-overlay"),
- d = "";
- l.find(".devices button").removeClass("active").attr("aria-pressed", !1), l.find(".devices .preview-" + a).addClass("active").attr("aria-pressed", !0), b.each(f.settings.previewableDevices, function(a) {
- d += " preview-" + a
- }), c.removeClass(d).addClass("preview-" + a)
- }), g.length && f("blogname", function(a) {
- var c = function() {
- g.text(b.trim(a()) || f.l10n.untitledBlogName)
- };
- a.bind(c), c()
- }), c = new f.Messenger({
- url: f.settings.url.parent,
- channel: "loader"
- }),
- function() {
- function a() {
- var a;
- return f.state("activated").get() ? (a = f.state("changesetStatus").get(), "" !== a && "auto-draft" !== a || (a = "publish"), f.state("selectedChangesetStatus").get() === a && (("future" !== f.state("selectedChangesetStatus").get() || f.state("selectedChangesetDate").get() === f.state("changesetDate").get()) && (f.state("saved").get() && "auto-draft" !== f.state("changesetStatus").get()))) : 0 === f._latestRevision
- }
-
- function d() {
- f.unbind("change", d), f.state("selectedChangesetStatus").unbind(d), f.state("selectedChangesetDate").unbind(d), b(window).on("beforeunload.customize-confirm", function() {
- if (!a() && !f.state("changesetLocked").get()) return setTimeout(function() {
- e.removeClass("customize-loading")
- }, 1), f.l10n.saveAlert
- })
+ })
+ }(), H.each(["saved", "change"], function(e, t) {
+ L.bind(t, function() {
+ m.send(t)
+ })
+ }), L.bind("title", function(e) {
+ m.send("title", e)
+ }), L.settings.changeset.branching && m.send("changeset-uuid", L.settings.changeset.uuid), m.send("ready"), H.each({
+ background_image: {
+ controls: ["background_preset", "background_position", "background_size", "background_repeat", "background_attachment"],
+ callback: function(e) {
+ return !!e
}
-
- function g() {
- var c = b.Deferred(),
- d = !1,
- e = !1;
- return a() ? e = !0 : confirm(f.l10n.saveAlert) ? (e = !0, f.each(function(a) {
- a._dirty = !1
- }), b(document).off("visibilitychange.wp-customize-changeset-update"), b(window).off("beforeunload.wp-customize-changeset-update"), h.css("cursor", "progress"), "" !== f.state("changesetStatus").get() && (d = !0)) : c.reject(), (e || d) && wp.ajax.send("customize_dismiss_autosave_or_lock", {
- timeout: 500,
- data: {
- wp_customize: "on",
- customize_theme: f.settings.theme.stylesheet,
- customize_changeset_uuid: f.settings.changeset.uuid,
- nonce: f.settings.nonce.dismiss_autosave_or_lock,
- dismiss_autosave: d,
- dismiss_lock: e
- }
- }).always(function() {
- c.resolve()
- }), c.promise()
+ },
+ show_on_front: {
+ controls: ["page_on_front", "page_for_posts"],
+ callback: function(e) {
+ return "page" === e
}
- var i = !1;
- c.bind("back", function() {
- i = !0
- }), f.bind("change", d), f.state("selectedChangesetStatus").bind(d), f.state("selectedChangesetDate").bind(d), c.bind("confirm-close", function() {
- g().done(function() {
- c.send("confirmed-close", !0)
- }).fail(function() {
- c.send("confirmed-close", !1)
- })
- }), h.on("click.customize-controls-close", function(a) {
- a.preventDefault(), i ? c.send("close") : g().done(function() {
- b(window).off("beforeunload.customize-confirm"), window.location.href = h.prop("href")
- })
- })
- }(), b.each(["saved", "change"], function(a, b) {
- f.bind(b, function() {
- c.send(b)
- })
- }), f.bind("title", function(a) {
- c.send("title", a)
- }), f.settings.changeset.branching && c.send("changeset-uuid", f.settings.changeset.uuid), c.send("ready"), b.each({
- background_image: {
- controls: ["background_preset", "background_position", "background_size", "background_repeat", "background_attachment"],
- callback: function(a) {
- return !!a
- }
- },
- show_on_front: {
- controls: ["page_on_front", "page_for_posts"],
- callback: function(a) {
- return "page" === a
- }
- },
- header_textcolor: {
- controls: ["header_textcolor"],
- callback: function(a) {
- return "blank" !== a
- }
+ },
+ header_textcolor: {
+ controls: ["header_textcolor"],
+ callback: function(e) {
+ return "blank" !== e
}
- }, function(a, c) {
- f(a, function(a) {
- b.each(c.controls, function(b, d) {
- f.control(d, function(b) {
- var d = function(a) {
- b.container.toggle(c.callback(a))
- };
- d(a.get()), a.bind(d)
- })
- })
- })
- }), f.control("background_preset", function(a) {
- var b, c, d, e, g, h;
- b = {
- "default": [!1, !1, !1, !1],
- fill: [!0, !1, !1, !1],
- fit: [!0, !1, !0, !1],
- repeat: [!0, !1, !1, !0],
- custom: [!0, !0, !0, !0]
- }, c = [_wpCustomizeBackground.defaults["default-position-x"], _wpCustomizeBackground.defaults["default-position-y"], _wpCustomizeBackground.defaults["default-size"], _wpCustomizeBackground.defaults["default-repeat"], _wpCustomizeBackground.defaults["default-attachment"]], d = {
- "default": c,
- fill: ["left", "top", "cover", "no-repeat", "fixed"],
- fit: ["left", "top", "contain", "no-repeat", "fixed"],
- repeat: ["left", "top", "auto", "repeat", "scroll"]
- }, e = function(a) {
- _.each(["background_position", "background_size", "background_repeat", "background_attachment"], function(c, d) {
- var e = f.control(c);
- e && e.container.toggle(b[a][d])
- })
- }, g = function(a) {
- _.each(["background_position_x", "background_position_y", "background_size", "background_repeat", "background_attachment"], function(b, c) {
- var e = f(b);
- e && e.set(d[a][c])
+ }
+ }, function(e, i) {
+ L(e, function(n) {
+ H.each(i.controls, function(e, t) {
+ L.control(t, function(t) {
+ var e = function(e) {
+ t.container.toggle(i.callback(e))
+ };
+ e(n.get()), n.bind(e)
})
- }, h = a.setting.get(), e(h), a.setting.bind("change", function(a) {
- e(a), "custom" !== a && g(a)
})
- }), f.control("background_repeat", function(a) {
- a.elements[0].unsync(f("background_repeat")), a.element = new f.Element(a.container.find("input")), a.element.set("no-repeat" !== a.setting()), a.element.bind(function(b) {
- a.setting.set(b ? "repeat" : "no-repeat")
- }), a.setting.bind(function(b) {
- a.element.set("no-repeat" !== b)
+ })
+ }), L.control("background_preset", function(e) {
+ var a, t, o, n, i, s;
+ a = {
+ default: [!1, !1, !1, !1],
+ fill: [!0, !1, !1, !1],
+ fit: [!0, !1, !0, !1],
+ repeat: [!0, !1, !1, !0],
+ custom: [!0, !0, !0, !0]
+ }, t = [_wpCustomizeBackground.defaults["default-position-x"], _wpCustomizeBackground.defaults["default-position-y"], _wpCustomizeBackground.defaults["default-size"], _wpCustomizeBackground.defaults["default-repeat"], _wpCustomizeBackground.defaults["default-attachment"]], o = {
+ default: t,
+ fill: ["left", "top", "cover", "no-repeat", "fixed"],
+ fit: ["left", "top", "contain", "no-repeat", "fixed"],
+ repeat: ["left", "top", "auto", "repeat", "scroll"]
+ }, n = function(i) {
+ _.each(["background_position", "background_size", "background_repeat", "background_attachment"], function(e, t) {
+ var n = L.control(e);
+ n && n.container.toggle(a[i][t])
+ })
+ }, i = function(i) {
+ _.each(["background_position_x", "background_position_y", "background_size", "background_repeat", "background_attachment"], function(e, t) {
+ var n = L(e);
+ n && n.set(o[i][t])
})
- }), f.control("background_attachment", function(a) {
- a.elements[0].unsync(f("background_attachment")), a.element = new f.Element(a.container.find("input")), a.element.set("fixed" !== a.setting()), a.element.bind(function(b) {
- a.setting.set(b ? "scroll" : "fixed")
- }), a.setting.bind(function(b) {
- a.element.set("fixed" !== b)
+ }, s = e.setting.get(), n(s), e.setting.bind("change", function(e) {
+ n(e), "custom" !== e && i(e)
+ })
+ }), L.control("background_repeat", function(t) {
+ t.elements[0].unsync(L("background_repeat")), t.element = new L.Element(t.container.find("input")), t.element.set("no-repeat" !== t.setting()), t.element.bind(function(e) {
+ t.setting.set(e ? "repeat" : "no-repeat")
+ }), t.setting.bind(function(e) {
+ t.element.set("no-repeat" !== e)
+ })
+ }), L.control("background_attachment", function(t) {
+ t.elements[0].unsync(L("background_attachment")), t.element = new L.Element(t.container.find("input")), t.element.set("fixed" !== t.setting()), t.element.bind(function(e) {
+ t.setting.set(e ? "scroll" : "fixed")
+ }), t.setting.bind(function(e) {
+ t.element.set("fixed" !== e)
+ })
+ }), L.control("display_header_text", function(t) {
+ var n = "";
+ t.elements[0].unsync(L("header_textcolor")), t.element = new L.Element(t.container.find("input")), t.element.set("blank" !== t.setting()), t.element.bind(function(e) {
+ e || (n = L("header_textcolor").get()), t.setting.set(e ? n : "blank")
+ }), t.setting.bind(function(e) {
+ t.element.set("blank" !== e)
+ })
+ }), L("show_on_front", "page_on_front", "page_for_posts", function(i, a, o) {
+ var e = function() {
+ var e, t, n = "show_on_front_page_collision";
+ e = parseInt(a(), 10), t = parseInt(o(), 10), "page" === i() && (this === a && 0 < e && L.previewer.previewUrl.set(L.settings.url.home), this === o && 0 < t && L.previewer.previewUrl.set(L.settings.url.home + "?page_id=" + t)), "page" === i() && e && t && e === t ? i.notifications.add(new L.Notification(n, {
+ type: "error",
+ message: L.l10n.pageOnFrontError
+ })) : i.notifications.remove(n)
+ };
+ i.bind(e), a.bind(e), o.bind(e), e.call(i, i()), L.control("show_on_front", function(e) {
+ e.deferred.embedded.done(function() {
+ e.container.append(e.getNotificationsContainerElement())
})
- }), f.control("display_header_text", function(a) {
- var b = "";
- a.elements[0].unsync(f("header_textcolor")), a.element = new f.Element(a.container.find("input")), a.element.set("blank" !== a.setting()), a.element.bind(function(c) {
- c || (b = f("header_textcolor").get()), a.setting.set(c ? b : "blank")
- }), a.setting.bind(function(b) {
- a.element.set("blank" !== b)
+ })
+ }), E = H.Deferred(), L.section("custom_css", function(t) {
+ t.deferred.embedded.done(function() {
+ t.expanded() ? E.resolve(t) : t.expanded.bind(function(e) {
+ e && E.resolve(t)
})
- }), f("show_on_front", "page_on_front", "page_for_posts", function(a, b, c) {
- var d = function() {
- var d, e, g = this,
- h = "show_on_front_page_collision";
- d = parseInt(b(), 10), e = parseInt(c(), 10), "page" === a() && (g === b && d > 0 && f.previewer.previewUrl.set(f.settings.url.home), g === c && e > 0 && f.previewer.previewUrl.set(f.settings.url.home + "?page_id=" + e)), "page" === a() && d && e && d === e ? a.notifications.add(new f.Notification(h, {
- type: "error",
- message: f.l10n.pageOnFrontError
- })) : a.notifications.remove(h)
+ })
+ }), E.done(function(e) {
+ var t = L.control("custom_css");
+ t.container.find(".customize-control-title:first").addClass("screen-reader-text"), e.container.find(".section-description-buttons .section-description-close").on("click", function() {
+ e.container.find(".section-meta .customize-section-description:first").removeClass("open").slideUp(), e.container.find(".customize-help-toggle").attr("aria-expanded", "false").focus()
+ }), t && !t.setting.get() && (e.container.find(".section-meta .customize-section-description:first").addClass("open").show().trigger("toggled"), e.container.find(".customize-help-toggle").attr("aria-expanded", "true"))
+ }), L.control("header_video", function(n) {
+ n.deferred.embedded.done(function() {
+ var e = function() {
+ var e = L.section(n.section()),
+ t = "video_header_not_available";
+ e && (n.active.get() ? e.notifications.remove(t) : e.notifications.add(new L.Notification(t, {
+ type: "info",
+ message: L.l10n.videoHeaderNotice
+ })))
};
- a.bind(d), b.bind(d), c.bind(d), d.call(a, a()), f.control("show_on_front", function(a) {
- a.deferred.embedded.done(function() {
- a.container.append(a.getNotificationsContainerElement())
- })
- })
- }),
- function() {
- var a = b.Deferred();
- f.section("custom_css", function(b) {
- b.deferred.embedded.done(function() {
- b.expanded() ? a.resolve(b) : b.expanded.bind(function(c) {
- c && a.resolve(b)
- })
- })
- }), a.done(function(a) {
- var b = f.control("custom_css");
- b.container.find(".customize-control-title:first").addClass("screen-reader-text"), a.container.find(".section-description-buttons .section-description-close").on("click", function() {
- a.container.find(".section-meta .customize-section-description:first").removeClass("open").slideUp(), a.container.find(".customize-help-toggle").attr("aria-expanded", "false").focus()
- }), b && !b.setting.get() && (a.container.find(".section-meta .customize-section-description:first").addClass("open").show().trigger("toggled"), a.container.find(".customize-help-toggle").attr("aria-expanded", "true"))
- })
- }(), f.control("header_video", function(a) {
- a.deferred.embedded.done(function() {
- var b = function() {
- var b = f.section(a.section());
- b && (a.active.get() ? b.notifications.remove("video_header_not_available") : b.notifications.add(new f.Notification("video_header_not_available", {
- type: "info",
- message: f.l10n.videoHeaderNotice
- })))
- };
- b(), a.active.bind(b)
- })
- }), f.previewer.bind("selective-refresh-setting-validities", function(a) {
- f._handleSettingValidities({
- settingValidities: a,
- focusInvalidControl: !1
- })
- }), f.previewer.bind("focus-control-for-setting", function(a) {
- var b = [];
- f.control.each(function(c) {
- var d = _.pluck(c.settings, "id"); - 1 !== _.indexOf(d, a) && b.push(c)
- }), b.length && (b.sort(function(a, b) {
- return a.priority() - b.priority()
- }), b[0].focus())
- }), f.previewer.bind("refresh", function() {
- f.previewer.refresh()
- }), f.state("paneVisible").bind(function(a) {
- var c;
- c = window.matchMedia ? window.matchMedia("screen and ( max-width: 640px )").matches : b(window).width() <= 640, f.state("editShortcutVisibility").set(a || c ? "visible" : "hidden")
- }), window.matchMedia && window.matchMedia("screen and ( max-width: 640px )").addListener(function() {
- var a = f.state("paneVisible");
- a.callbacks.fireWith(a, [a.get(), a.get()])
- }), f.previewer.bind("edit-shortcut-visibility", function(a) {
- f.state("editShortcutVisibility").set(a)
- }), f.state("editShortcutVisibility").bind(function(a) {
- f.previewer.send("edit-shortcut-visibility", a)
- }), f.bind("change", a), b(document).one("tinymce-editor-setup", function() {
- window.tinymce.ui.FloatPanel && (!window.tinymce.ui.FloatPanel.zIndex || window.tinymce.ui.FloatPanel.zIndex < 500001) && (window.tinymce.ui.FloatPanel.zIndex = 500001)
- }), d.addClass("ready"), f.trigger("ready")
- }
- })
+ e(), n.active.bind(e)
+ })
+ }), L.previewer.bind("selective-refresh-setting-validities", function(e) {
+ L._handleSettingValidities({
+ settingValidities: e,
+ focusInvalidControl: !1
+ })
+ }), L.previewer.bind("focus-control-for-setting", function(n) {
+ var i = [];
+ L.control.each(function(e) {
+ var t = _.pluck(e.settings, "id"); - 1 !== _.indexOf(t, n) && i.push(e)
+ }), i.length && (i.sort(function(e, t) {
+ return e.priority() - t.priority()
+ }), i[0].focus())
+ }), L.previewer.bind("refresh", function() {
+ L.previewer.refresh()
+ }), L.state("paneVisible").bind(function(e) {
+ var t;
+ t = window.matchMedia ? window.matchMedia("screen and ( max-width: 640px )").matches : H(window).width() <= 640, L.state("editShortcutVisibility").set(e || t ? "visible" : "hidden")
+ }), window.matchMedia && window.matchMedia("screen and ( max-width: 640px )").addListener(function() {
+ var e = L.state("paneVisible");
+ e.callbacks.fireWith(e, [e.get(), e.get()])
+ }), L.previewer.bind("edit-shortcut-visibility", function(e) {
+ L.state("editShortcutVisibility").set(e)
+ }), L.state("editShortcutVisibility").bind(function(e) {
+ L.previewer.send("edit-shortcut-visibility", e)
+ }), L.bind("change", function e() {
+ var t, n, i, a = !1;
+
+ function o(e) {
+ e || L.settings.changeset.autosaved || (L.settings.changeset.autosaved = !0, L.previewer.send("autosaving"))
+ }
+ L.unbind("change", e), L.state("saved").bind(o), o(L.state("saved").get()), n = function() {
+ a || (a = !0, L.requestChangesetUpdate({}, {
+ autosave: !0
+ }).always(function() {
+ a = !1
+ })), i()
+ }, (i = function() {
+ clearTimeout(t), t = setTimeout(function() {
+ n()
+ }, L.settings.timeouts.changesetAutoSave)
+ })(), H(document).on("visibilitychange.wp-customize-changeset-update", function() {
+ document.hidden && n()
+ }), H(window).on("beforeunload.wp-customize-changeset-update", function() {
+ n()
+ })
+ }), H(document).one("tinymce-editor-setup", function() {
+ window.tinymce.ui.FloatPanel && (!window.tinymce.ui.FloatPanel.zIndex || window.tinymce.ui.FloatPanel.zIndex < 500001) && (window.tinymce.ui.FloatPanel.zIndex = 500001)
+ }), D.addClass("ready"), L.trigger("ready")
+ }
+ })
}(wp, jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/customize-nav-menus.min.js build-branch-unminified/wp-admin/js/customize-nav-menus.min.js
--- build-unminified/wp-admin/js/customize-nav-menus.min.js 2018-10-08 22:57:56.013482647 -0500
+++ build-branch-unminified/wp-admin/js/customize-nav-menus.min.js 2018-10-08 22:55:07.384145384 -0500
@@ -1,16 +1,12 @@
-! function(a, b, c) {
+! function(v, h, g) {
"use strict";
- function d(a) {
- return "nav_menu_item[" + a + "]"
- }
-
- function e(b) {
- return b = b || "", b = c("<div>").text(b).html(), (b = c.trim(b)) || a.Menus.data.l10n.unnamed
+ function d(e) {
+ return e = e || "", e = g("<div>").text(e).html(), (e = g.trim(e)) || v.Menus.data.l10n.unnamed
}
wpNavMenu.originalInit = wpNavMenu.init, wpNavMenu.options.menuItemDepthPerLevel = 20, wpNavMenu.options.sortableItems = "> .customize-control-nav_menu_item", wpNavMenu.options.targetTolerance = 10, wpNavMenu.init = function() {
this.jQueryExtensions()
- }, a.Menus = a.Menus || {}, a.Menus.data = {
+ }, v.Menus = v.Menus || {}, v.Menus.data = {
itemTypes: [],
l10n: {},
settingTransport: "refresh",
@@ -20,36 +16,35 @@
nav_menu_item: {}
},
locationSlugMappedToName: {}
- }, "undefined" != typeof _wpCustomizeNavMenusSettings && c.extend(a.Menus.data, _wpCustomizeNavMenusSettings), a.Menus.generatePlaceholderAutoIncrementId = function() {
- return -Math.ceil(a.Menus.data.phpIntMax * Math.random())
- }, a.Menus.AvailableItemModel = Backbone.Model.extend(c.extend({
+ }, "undefined" != typeof _wpCustomizeNavMenusSettings && g.extend(v.Menus.data, _wpCustomizeNavMenusSettings), v.Menus.generatePlaceholderAutoIncrementId = function() {
+ return -Math.ceil(v.Menus.data.phpIntMax * Math.random())
+ }, v.Menus.AvailableItemModel = Backbone.Model.extend(g.extend({
id: null
- }, a.Menus.data.defaultSettingValues.nav_menu_item)), a.Menus.AvailableItemCollection = Backbone.Collection.extend({
- model: a.Menus.AvailableItemModel,
+ }, v.Menus.data.defaultSettingValues.nav_menu_item)), v.Menus.AvailableItemCollection = Backbone.Collection.extend({
+ model: v.Menus.AvailableItemModel,
sort_key: "order",
- comparator: function(a) {
- return -a.get(this.sort_key)
+ comparator: function(e) {
+ return -e.get(this.sort_key)
},
- sortByField: function(a) {
- this.sort_key = a, this.sort()
+ sortByField: function(e) {
+ this.sort_key = e, this.sort()
}
- }), a.Menus.availableMenuItems = new a.Menus.AvailableItemCollection(a.Menus.data.availableMenuItems), a.Menus.insertAutoDraftPost = function(d) {
- var e, f = c.Deferred();
- return e = b.ajax.post("customize-nav-menus-insert-auto-draft", {
- "customize-menus-nonce": a.settings.nonce["customize-menus"],
+ }), v.Menus.availableMenuItems = new v.Menus.AvailableItemCollection(v.Menus.data.availableMenuItems), v.Menus.insertAutoDraftPost = function(n) {
+ var e, i = g.Deferred();
+ return (e = h.ajax.post("customize-nav-menus-insert-auto-draft", {
+ "customize-menus-nonce": v.settings.nonce["customize-menus"],
wp_customize: "on",
- customize_changeset_uuid: a.settings.changeset.uuid,
- params: d
- }), e.done(function(b) {
- b.post_id && (a("nav_menus_created_posts").set(a("nav_menus_created_posts").get().concat([b.post_id])), "page" === d.post_type && (a.section.has("static_front_page") && a.section("static_front_page").activate(), a.control.each(function(a) {
- var c;
- "dropdown-pages" === a.params.type && (c = a.container.find('select[name^="_customize-dropdown-pages-"]'), c.append(new Option(d.post_title, b.post_id)))
- })), f.resolve(b))
- }), e.fail(function(a) {
- var b = a || "";
- "undefined" != typeof a.message && (b = a.message), console.error(b), f.rejectWith(b)
- }), f.promise()
- }, a.Menus.AvailableMenuItemsPanelView = b.Backbone.View.extend({
+ customize_changeset_uuid: v.settings.changeset.uuid,
+ params: n
+ })).done(function(t) {
+ t.post_id && (v("nav_menus_created_posts").set(v("nav_menus_created_posts").get().concat([t.post_id])), "page" === n.post_type && (v.section.has("static_front_page") && v.section("static_front_page").activate(), v.control.each(function(e) {
+ "dropdown-pages" === e.params.type && e.container.find('select[name^="_customize-dropdown-pages-"]').append(new Option(n.post_title, t.post_id))
+ })), i.resolve(t))
+ }), e.fail(function(e) {
+ var t = e || "";
+ void 0 !== e.message && (t = e.message), console.error(t), i.rejectWith(t)
+ }), i.promise()
+ }, v.Menus.AvailableMenuItemsPanelView = h.Backbone.View.extend({
el: "#available-menu-items",
events: {
"input #menu-items-search": "debounceSearch",
@@ -74,1034 +69,1002 @@
loading: !1,
addingNew: !1,
initialize: function() {
- var b = this;
- a.panel.has("nav_menus") && (this.$search = c("#menu-items-search"), this.$clearResults = this.$el.find(".clear-results"), this.sectionContent = this.$el.find(".available-menu-items-list"), this.debounceSearch = _.debounce(b.search, 500), _.bindAll(this, "close"), c("#customize-controls, .customize-section-back").on("click keydown", function(a) {
- var d = c(a.target).is(".item-delete, .item-delete *"),
- e = c(a.target).is(".add-new-menu-item, .add-new-menu-item *");
- !c("body").hasClass("adding-menu-items") || d || e || b.close()
+ var a = this;
+ v.panel.has("nav_menus") && (this.$search = g("#menu-items-search"), this.$clearResults = this.$el.find(".clear-results"), this.sectionContent = this.$el.find(".available-menu-items-list"), this.debounceSearch = _.debounce(a.search, 500), _.bindAll(this, "close"), g("#customize-controls, .customize-section-back").on("click keydown", function(e) {
+ var t = g(e.target).is(".item-delete, .item-delete *"),
+ n = g(e.target).is(".add-new-menu-item, .add-new-menu-item *");
+ !g("body").hasClass("adding-menu-items") || t || n || a.close()
}), this.$clearResults.on("click", function() {
- b.$search.val("").focus().trigger("keyup")
+ a.$search.val("").focus().trigger("keyup")
}), this.$el.on("input", "#custom-menu-item-name.invalid, #custom-menu-item-url.invalid", function() {
- c(this).removeClass("invalid")
- }), a.panel("nav_menus").container.bind("expanded", function() {
- b.rendered || (b.initList(), b.rendered = !0)
+ g(this).removeClass("invalid")
+ }), v.panel("nav_menus").container.bind("expanded", function() {
+ a.rendered || (a.initList(), a.rendered = !0)
}), this.sectionContent.scroll(function() {
- var a = b.$el.find(".accordion-section.open .available-menu-items-list").prop("scrollHeight"),
- d = b.$el.find(".accordion-section.open").height();
- if (!b.loading && c(this).scrollTop() > .75 * a - d) {
- var e = c(this).data("type"),
- f = c(this).data("object");
- "search" === e ? b.searchTerm && b.doSearch(b.pages.search) : b.loadItems([{
- type: e,
- object: f
+ var e = a.$el.find(".accordion-section.open .available-menu-items-list").prop("scrollHeight"),
+ t = a.$el.find(".accordion-section.open").height();
+ if (!a.loading && g(this).scrollTop() > .75 * e - t) {
+ var n = g(this).data("type"),
+ i = g(this).data("object");
+ "search" === n ? a.searchTerm && a.doSearch(a.pages.search) : a.loadItems([{
+ type: n,
+ object: i
}])
}
- }), a.previewer.bind("url", this.close), b.delegateEvents())
+ }), v.previewer.bind("url", this.close), a.delegateEvents())
},
- search: function(a) {
- var b = c("#available-menu-items-search"),
- d = c("#available-menu-items .accordion-section").not(b);
- a && this.searchTerm !== a.target.value && ("" === a.target.value || b.hasClass("open") ? "" === a.target.value && (b.removeClass("open"), d.show(), this.$clearResults.removeClass("is-visible")) : (d.fadeOut(100), b.find(".accordion-section-content").slideDown("fast"), b.addClass("open"), this.$clearResults.addClass("is-visible")), this.searchTerm = a.target.value, this.pages.search = 1, this.doSearch(1))
- },
- doSearch: function(d) {
- var e, f = this,
- g = c("#available-menu-items-search"),
- h = g.find(".accordion-section-content"),
- i = b.template("available-menu-item");
- if (f.currentRequest && f.currentRequest.abort(), !(d < 0)) {
- if (d > 1) g.addClass("loading-more"), h.attr("aria-busy", "true"), b.a11y.speak(a.Menus.data.l10n.itemsLoadingMore);
- else if ("" === f.searchTerm) return h.html(""), void b.a11y.speak("");
- g.addClass("loading"), f.loading = !0, e = a.previewer.query({
+ search: function(e) {
+ var t = g("#available-menu-items-search"),
+ n = g("#available-menu-items .accordion-section").not(t);
+ e && this.searchTerm !== e.target.value && ("" === e.target.value || t.hasClass("open") ? "" === e.target.value && (t.removeClass("open"), n.show(), this.$clearResults.removeClass("is-visible")) : (n.fadeOut(100), t.find(".accordion-section-content").slideDown("fast"), t.addClass("open"), this.$clearResults.addClass("is-visible")), this.searchTerm = e.target.value, this.pages.search = 1, this.doSearch(1))
+ },
+ doSearch: function(n) {
+ var e, i = this,
+ a = g("#available-menu-items-search"),
+ o = a.find(".accordion-section-content"),
+ s = h.template("available-menu-item");
+ if (i.currentRequest && i.currentRequest.abort(), !(n < 0)) {
+ if (1 < n) a.addClass("loading-more"), o.attr("aria-busy", "true"), h.a11y.speak(v.Menus.data.l10n.itemsLoadingMore);
+ else if ("" === i.searchTerm) return o.html(""), void h.a11y.speak("");
+ a.addClass("loading"), i.loading = !0, e = v.previewer.query({
excludeCustomizedSaved: !0
}), _.extend(e, {
- "customize-menus-nonce": a.settings.nonce["customize-menus"],
+ "customize-menus-nonce": v.settings.nonce["customize-menus"],
wp_customize: "on",
- search: f.searchTerm,
- page: d
- }), f.currentRequest = b.ajax.post("search-available-menu-items-customizer", e), f.currentRequest.done(function(c) {
- var e;
- 1 === d && h.empty(), g.removeClass("loading loading-more"), h.attr("aria-busy", "false"), g.addClass("open"), f.loading = !1, e = new a.Menus.AvailableItemCollection(c.items), f.collection.add(e.models), e.each(function(a) {
- h.append(i(a.attributes))
- }), 20 > e.length ? f.pages.search = -1 : f.pages.search = f.pages.search + 1, e && d > 1 ? b.a11y.speak(a.Menus.data.l10n.itemsFoundMore.replace("%d", e.length)) : e && 1 === d && b.a11y.speak(a.Menus.data.l10n.itemsFound.replace("%d", e.length))
- }), f.currentRequest.fail(function(a) {
- a.message && (h.empty().append(c('<li class="nothing-found"></li>').text(a.message)), b.a11y.speak(a.message)), f.pages.search = -1
- }), f.currentRequest.always(function() {
- g.removeClass("loading loading-more"), h.attr("aria-busy", "false"), f.loading = !1, f.currentRequest = null
+ search: i.searchTerm,
+ page: n
+ }), i.currentRequest = h.ajax.post("search-available-menu-items-customizer", e), i.currentRequest.done(function(e) {
+ var t;
+ 1 === n && o.empty(), a.removeClass("loading loading-more"), o.attr("aria-busy", "false"), a.addClass("open"), i.loading = !1, t = new v.Menus.AvailableItemCollection(e.items), i.collection.add(t.models), t.each(function(e) {
+ o.append(s(e.attributes))
+ }), t.length < 20 ? i.pages.search = -1 : i.pages.search = i.pages.search + 1, t && 1 < n ? h.a11y.speak(v.Menus.data.l10n.itemsFoundMore.replace("%d", t.length)) : t && 1 === n && h.a11y.speak(v.Menus.data.l10n.itemsFound.replace("%d", t.length))
+ }), i.currentRequest.fail(function(e) {
+ e.message && (o.empty().append(g('<li class="nothing-found"></li>').text(e.message)), h.a11y.speak(e.message)), i.pages.search = -1
+ }), i.currentRequest.always(function() {
+ a.removeClass("loading loading-more"), o.attr("aria-busy", "false"), i.loading = !1, i.currentRequest = null
})
}
},
initList: function() {
- var b = this;
- _.each(a.Menus.data.itemTypes, function(a) {
- b.pages[a.type + ":" + a.object] = 0
- }), b.loadItems(a.Menus.data.itemTypes)
- },
- loadItems: function(d, e) {
- var f, g, h, i, j = this,
- k = [],
- l = {};
- i = b.template("available-menu-item"), f = _.isString(d) && _.isString(e) ? [{
- type: d,
- object: e
- }] : d, _.each(f, function(a) {
- var b, d = a.type + ":" + a.object; - 1 !== j.pages[d] && (b = c("#available-menu-items-" + a.type + "-" + a.object), b.find(".accordion-section-title").addClass("loading"), l[d] = b, k.push({
- object: a.object,
- type: a.type,
- page: j.pages[d]
+ var t = this;
+ _.each(v.Menus.data.itemTypes, function(e) {
+ t.pages[e.type + ":" + e.object] = 0
+ }), t.loadItems(v.Menus.data.itemTypes)
+ },
+ loadItems: function(e, t) {
+ var n, i, a, o, s = this,
+ r = [],
+ u = {};
+ o = h.template("available-menu-item"), n = _.isString(e) && _.isString(t) ? [{
+ type: e,
+ object: t
+ }] : e, _.each(n, function(e) {
+ var t, n = e.type + ":" + e.object; - 1 !== s.pages[n] && ((t = g("#available-menu-items-" + e.type + "-" + e.object)).find(".accordion-section-title").addClass("loading"), u[n] = t, r.push({
+ object: e.object,
+ type: e.type,
+ page: s.pages[n]
}))
- }), 0 !== k.length && (j.loading = !0, g = a.previewer.query({
+ }), 0 !== r.length && (s.loading = !0, i = v.previewer.query({
excludeCustomizedSaved: !0
- }), _.extend(g, {
- "customize-menus-nonce": a.settings.nonce["customize-menus"],
+ }), _.extend(i, {
+ "customize-menus-nonce": v.settings.nonce["customize-menus"],
wp_customize: "on",
- item_types: k
- }), h = b.ajax.post("load-available-menu-items-customizer", g), h.done(function(b) {
- var c;
- _.each(b.items, function(b, d) {
- if (0 === b.length) return 0 === j.pages[d] && l[d].find(".accordion-section-title").addClass("cannot-expand").removeClass("loading").find(".accordion-section-title > button").prop("tabIndex", -1), void(j.pages[d] = -1);
- "post_type:page" !== d || l[d].hasClass("open") || l[d].find(".accordion-section-title > button").click(), b = new a.Menus.AvailableItemCollection(b), j.collection.add(b.models), c = l[d].find(".available-menu-items-list"), b.each(function(a) {
- c.append(i(a.attributes))
- }), j.pages[d] += 1
+ item_types: r
+ }), (a = h.ajax.post("load-available-menu-items-customizer", i)).done(function(e) {
+ var n;
+ _.each(e.items, function(e, t) {
+ if (0 === e.length) return 0 === s.pages[t] && u[t].find(".accordion-section-title").addClass("cannot-expand").removeClass("loading").find(".accordion-section-title > button").prop("tabIndex", -1), void(s.pages[t] = -1);
+ "post_type:page" !== t || u[t].hasClass("open") || u[t].find(".accordion-section-title > button").click(), e = new v.Menus.AvailableItemCollection(e), s.collection.add(e.models), n = u[t].find(".available-menu-items-list"), e.each(function(e) {
+ n.append(o(e.attributes))
+ }), s.pages[t] += 1
})
- }), h.fail(function(a) {
- "undefined" != typeof console && console.error && console.error(a)
- }), h.always(function() {
- _.each(l, function(a) {
- a.find(".accordion-section-title").removeClass("loading")
- }), j.loading = !1
+ }), a.fail(function(e) {
+ "undefined" != typeof console && console.error && console.error(e)
+ }), a.always(function() {
+ _.each(u, function(e) {
+ e.find(".accordion-section-title").removeClass("loading")
+ }), s.loading = !1
}))
},
itemSectionHeight: function() {
- var a, b, c, d, e;
- c = window.innerHeight, a = this.$el.find(".accordion-section:not( #available-menu-items-search ) .accordion-section-content"), b = this.$el.find('.accordion-section:not( #available-menu-items-search ) .available-menu-items-list:not(":only-child")'), d = 46 * (1 + a.length) + 14, 120 < (e = c - d) && 290 > e && (a.css("max-height", e), b.css("max-height", e - 60))
+ var e, t, n, i;
+ n = window.innerHeight, e = this.$el.find(".accordion-section:not( #available-menu-items-search ) .accordion-section-content"), t = this.$el.find('.accordion-section:not( #available-menu-items-search ) .available-menu-items-list:not(":only-child")'), 120 < (i = n - (46 * (1 + e.length) + 14)) && i < 290 && (e.css("max-height", i), t.css("max-height", i - 60))
},
- select: function(a) {
- this.selected = c(a), this.selected.siblings(".menu-item-tpl").removeClass("selected"), this.selected.addClass("selected")
+ select: function(e) {
+ this.selected = g(e), this.selected.siblings(".menu-item-tpl").removeClass("selected"), this.selected.addClass("selected")
},
- focus: function(a) {
- this.select(c(a.currentTarget))
+ focus: function(e) {
+ this.select(g(e.currentTarget))
},
- _submit: function(a) {
- "keypress" === a.type && 13 !== a.which && 32 !== a.which || this.submit(c(a.currentTarget))
- },
- submit: function(a) {
- var b, d;
- a || (a = this.selected), a && this.currentMenuControl && (this.select(a), b = c(this.selected).data("menu-item-id"), (d = this.collection.findWhere({
- id: b
- })) && (this.currentMenuControl.addItemToMenu(d.attributes), c(a).find(".menu-item-handle").addClass("item-added")))
+ _submit: function(e) {
+ "keypress" === e.type && 13 !== e.which && 32 !== e.which || this.submit(g(e.currentTarget))
+ },
+ submit: function(e) {
+ var t, n;
+ e || (e = this.selected), e && this.currentMenuControl && (this.select(e), t = g(this.selected).data("menu-item-id"), (n = this.collection.findWhere({
+ id: t
+ })) && (this.currentMenuControl.addItemToMenu(n.attributes), g(e).find(".menu-item-handle").addClass("item-added")))
},
- _submitLink: function(a) {
- "keypress" === a.type && 13 !== a.which || this.submitLink()
+ _submitLink: function(e) {
+ "keypress" === e.type && 13 !== e.which || this.submitLink()
},
submitLink: function() {
- var b, d, e = c("#custom-menu-item-name"),
- f = c("#custom-menu-item-url");
- if (this.currentMenuControl) {
- if (d = /^((\w+:)?\/\/\w.*|\w+:(?!\/\/$)|\/|\?|#)/, "" === e.val()) return void e.addClass("invalid");
- if (!d.test(f.val())) return void f.addClass("invalid");
- b = {
- title: e.val(),
- url: f.val(),
- type: "custom",
- type_label: a.Menus.data.l10n.custom_label,
- object: "custom"
- }, this.currentMenuControl.addItemToMenu(b), f.val("http://"), e.val("")
- }
- },
- _submitNew: function(a) {
- var b;
- "keypress" === a.type && 13 !== a.which || this.addingNew || (b = c(a.target).closest(".accordion-section"), this.submitNew(b))
- },
- submitNew: function(d) {
- var e, f = this,
- g = d.find(".create-item-input"),
- h = g.val(),
- i = d.find(".available-menu-items-list"),
- j = i.data("type"),
- k = i.data("object"),
- l = i.data("type_label");
- if (this.currentMenuControl && "post_type" === j) {
- if ("" === c.trim(g.val())) return g.addClass("invalid"), void g.focus();
- g.removeClass("invalid"), d.find(".accordion-section-title").addClass("loading"), f.addingNew = !0, g.attr("disabled", "disabled"), e = a.Menus.insertAutoDraftPost({
- post_title: h,
- post_type: k
- }), e.done(function(e) {
- var h, i, m;
- h = new a.Menus.AvailableItemModel({
+ var e, t, n = g("#custom-menu-item-name"),
+ i = g("#custom-menu-item-url");
+ this.currentMenuControl && (t = /^((\w+:)?\/\/\w.*|\w+:(?!\/\/$)|\/|\?|#)/, "" !== n.val() ? t.test(i.val()) ? (e = {
+ title: n.val(),
+ url: i.val(),
+ type: "custom",
+ type_label: v.Menus.data.l10n.custom_label,
+ object: "custom"
+ }, this.currentMenuControl.addItemToMenu(e), i.val("http://"), n.val("")) : i.addClass("invalid") : n.addClass("invalid"))
+ },
+ _submitNew: function(e) {
+ var t;
+ "keypress" === e.type && 13 !== e.which || this.addingNew || (t = g(e.target).closest(".accordion-section"), this.submitNew(t))
+ },
+ submitNew: function(a) {
+ var o = this,
+ s = a.find(".create-item-input"),
+ e = s.val(),
+ t = a.find(".available-menu-items-list"),
+ r = t.data("type"),
+ u = t.data("object"),
+ d = t.data("type_label");
+ if (this.currentMenuControl && "post_type" === r) {
+ if ("" === g.trim(s.val())) return s.addClass("invalid"), void s.focus();
+ s.removeClass("invalid"), a.find(".accordion-section-title").addClass("loading"), o.addingNew = !0, s.attr("disabled", "disabled"), v.Menus.insertAutoDraftPost({
+ post_title: e,
+ post_type: u
+ }).done(function(e) {
+ var t, n, i;
+ t = new v.Menus.AvailableItemModel({
id: "post-" + e.post_id,
- title: g.val(),
- type: j,
- type_label: l,
- object: k,
+ title: s.val(),
+ type: r,
+ type_label: d,
+ object: u,
object_id: e.post_id,
url: e.url
- }), f.currentMenuControl.addItemToMenu(h.attributes), a.Menus.availableMenuItemsPanel.collection.add(h), i = d.find(".available-menu-items-list"), m = c(b.template("available-menu-item")(h.attributes)), m.find(".menu-item-handle:first").addClass("item-added"), i.prepend(m), i.scrollTop(), g.val("").removeAttr("disabled"), f.addingNew = !1, d.find(".accordion-section-title").removeClass("loading")
+ }), o.currentMenuControl.addItemToMenu(t.attributes), v.Menus.availableMenuItemsPanel.collection.add(t), n = a.find(".available-menu-items-list"), (i = g(h.template("available-menu-item")(t.attributes))).find(".menu-item-handle:first").addClass("item-added"), n.prepend(i), n.scrollTop(), s.val("").removeAttr("disabled"), o.addingNew = !1, a.find(".accordion-section-title").removeClass("loading")
})
}
},
- open: function(b) {
- var d, e = this;
- this.currentMenuControl = b, this.itemSectionHeight(), a.section.has("publish_settings") && a.section("publish_settings").collapse(), c("body").addClass("adding-menu-items"), d = function() {
- e.close(), c(this).off("click", d)
- }, c("#customize-preview").on("click", d), _(this.currentMenuControl.getMenuItemControls()).each(function(a) {
- a.collapseForm()
+ open: function(e) {
+ var t, n = this;
+ this.currentMenuControl = e, this.itemSectionHeight(), v.section.has("publish_settings") && v.section("publish_settings").collapse(), g("body").addClass("adding-menu-items"), t = function() {
+ n.close(), g(this).off("click", t)
+ }, g("#customize-preview").on("click", t), _(this.currentMenuControl.getMenuItemControls()).each(function(e) {
+ e.collapseForm()
}), this.$el.find(".selected").removeClass("selected"), this.$search.focus()
},
- close: function(a) {
- a = a || {}, a.returnFocus && this.currentMenuControl && this.currentMenuControl.container.find(".add-new-menu-item").focus(), this.currentMenuControl = null, this.selected = null, c("body").removeClass("adding-menu-items"), c("#available-menu-items .menu-item-handle.item-added").removeClass("item-added"), this.$search.val("").trigger("keyup")
+ close: function(e) {
+ (e = e || {}).returnFocus && this.currentMenuControl && this.currentMenuControl.container.find(".add-new-menu-item").focus(), this.currentMenuControl = null, this.selected = null, g("body").removeClass("adding-menu-items"), g("#available-menu-items .menu-item-handle.item-added").removeClass("item-added"), this.$search.val("").trigger("keyup")
},
- keyboardAccessible: function(a) {
- var b = 13 === a.which,
- d = 27 === a.which,
- e = 9 === a.which && a.shiftKey,
- f = c(a.target).is(this.$search);
- b && !this.$search.val() || (f && e ? (this.currentMenuControl.container.find(".add-new-menu-item").focus(), a.preventDefault()) : d && this.close({
+ keyboardAccessible: function(e) {
+ var t = 13 === e.which,
+ n = 27 === e.which,
+ i = 9 === e.which && e.shiftKey,
+ a = g(e.target).is(this.$search);
+ t && !this.$search.val() || (a && i ? (this.currentMenuControl.container.find(".add-new-menu-item").focus(), e.preventDefault()) : n && this.close({
returnFocus: !0
}))
}
- }), a.Menus.MenusPanel = a.Panel.extend({
+ }), v.Menus.MenusPanel = v.Panel.extend({
attachEvents: function() {
- a.Panel.prototype.attachEvents.call(this);
- var b = this,
- d = b.container.find(".panel-meta"),
- e = d.find(".customize-help-toggle"),
- f = d.find(".customize-panel-description"),
- g = c("#screen-options-wrap"),
- h = d.find(".customize-screen-options-toggle");
- h.on("click keydown", function(b) {
- if (!a.utils.isKeydownButNotEnterEvent(b)) return b.preventDefault(), f.not(":hidden") && (f.slideUp("fast"), e.attr("aria-expanded", "false")), "true" === h.attr("aria-expanded") ? (h.attr("aria-expanded", "false"), d.removeClass("open"), d.removeClass("active-menu-screen-options"), g.slideUp("fast")) : (h.attr("aria-expanded", "true"), d.addClass("open"), d.addClass("active-menu-screen-options"), g.slideDown("fast")), !1
- }), e.on("click keydown", function(b) {
- a.utils.isKeydownButNotEnterEvent(b) || (b.preventDefault(), "true" === h.attr("aria-expanded") && (h.attr("aria-expanded", "false"), e.attr("aria-expanded", "true"), d.addClass("open"), d.removeClass("active-menu-screen-options"), g.slideUp("fast"), f.slideDown("fast")))
+ v.Panel.prototype.attachEvents.call(this);
+ var t = this.container.find(".panel-meta"),
+ n = t.find(".customize-help-toggle"),
+ i = t.find(".customize-panel-description"),
+ a = g("#screen-options-wrap"),
+ o = t.find(".customize-screen-options-toggle");
+ o.on("click keydown", function(e) {
+ if (!v.utils.isKeydownButNotEnterEvent(e)) return e.preventDefault(), i.not(":hidden") && (i.slideUp("fast"), n.attr("aria-expanded", "false")), "true" === o.attr("aria-expanded") ? (o.attr("aria-expanded", "false"), t.removeClass("open"), t.removeClass("active-menu-screen-options"), a.slideUp("fast")) : (o.attr("aria-expanded", "true"), t.addClass("open"), t.addClass("active-menu-screen-options"), a.slideDown("fast")), !1
+ }), n.on("click keydown", function(e) {
+ v.utils.isKeydownButNotEnterEvent(e) || (e.preventDefault(), "true" === o.attr("aria-expanded") && (o.attr("aria-expanded", "false"), n.attr("aria-expanded", "true"), t.addClass("open"), t.removeClass("active-menu-screen-options"), a.slideUp("fast"), i.slideDown("fast")))
})
},
ready: function() {
- var c = this;
- c.container.find(".hide-column-tog").click(function() {
- c.saveManageColumnsState()
- }), a.section("menu_locations", function(c) {
- c.headContainer.prepend(b.template("nav-menu-locations-header")(a.Menus.data))
+ var e = this;
+ e.container.find(".hide-column-tog").click(function() {
+ e.saveManageColumnsState()
+ }), v.section("menu_locations", function(e) {
+ e.headContainer.prepend(h.template("nav-menu-locations-header")(v.Menus.data))
})
},
saveManageColumnsState: _.debounce(function() {
- var a = this;
- a._updateHiddenColumnsRequest && a._updateHiddenColumnsRequest.abort(), a._updateHiddenColumnsRequest = b.ajax.post("hidden-columns", {
- hidden: a.hidden(),
- screenoptionnonce: c("#screenoptionnonce").val(),
+ var e = this;
+ e._updateHiddenColumnsRequest && e._updateHiddenColumnsRequest.abort(), e._updateHiddenColumnsRequest = h.ajax.post("hidden-columns", {
+ hidden: e.hidden(),
+ screenoptionnonce: g("#screenoptionnonce").val(),
page: "nav-menus"
- }), a._updateHiddenColumnsRequest.always(function() {
- a._updateHiddenColumnsRequest = null
+ }), e._updateHiddenColumnsRequest.always(function() {
+ e._updateHiddenColumnsRequest = null
})
}, 2e3),
checked: function() {},
unchecked: function() {},
hidden: function() {
- return c(".hide-column-tog").not(":checked").map(function() {
- var a = this.id;
- return a.substring(0, a.length - 5)
+ return g(".hide-column-tog").not(":checked").map(function() {
+ var e = this.id;
+ return e.substring(0, e.length - 5)
}).get().join(",")
}
- }), a.Menus.MenuSection = a.Section.extend({
- initialize: function(b, d) {
- var e = this;
- a.Section.prototype.initialize.call(e, b, d), e.deferred.initSortables = c.Deferred()
+ }), v.Menus.MenuSection = v.Section.extend({
+ initialize: function(e, t) {
+ v.Section.prototype.initialize.call(this, e, t), this.deferred.initSortables = g.Deferred()
},
ready: function() {
- var b, d, e = this;
- if ("undefined" == typeof e.params.menu_id) throw new Error("params.menu_id was not defined");
- e.active.validate = function() {
- return !!a.has(e.id) && !!a(e.id).get()
- }, e.populateControls(), e.navMenuLocationSettings = {}, e.assignedLocations = new a.Value([]), a.each(function(a, b) {
- var c = b.match(/^nav_menu_locations\[(.+?)]/);
- c && (e.navMenuLocationSettings[c[1]] = a, a.bind(function() {
- e.refreshAssignedLocations()
- }))
- }), e.assignedLocations.bind(function(a) {
- e.updateAssignedLocationsInSectionTitle(a)
- }), e.refreshAssignedLocations(), a.bind("pane-contents-reflowed", function() {
- e.contentContainer.parent().length && (e.container.find(".menu-item .menu-item-reorder-nav button").attr({
+ var e, t, i = this;
+ if (void 0 === i.params.menu_id) throw new Error("params.menu_id was not defined");
+ i.active.validate = function() {
+ return !!v.has(i.id) && !!v(i.id).get()
+ }, i.populateControls(), i.navMenuLocationSettings = {}, i.assignedLocations = new v.Value([]), v.each(function(e, t) {
+ var n = t.match(/^nav_menu_locations\[(.+?)]/);
+ n && (i.navMenuLocationSettings[n[1]] = e).bind(function() {
+ i.refreshAssignedLocations()
+ })
+ }), i.assignedLocations.bind(function(e) {
+ i.updateAssignedLocationsInSectionTitle(e)
+ }), i.refreshAssignedLocations(), v.bind("pane-contents-reflowed", function() {
+ i.contentContainer.parent().length && (i.container.find(".menu-item .menu-item-reorder-nav button").attr({
tabindex: "0",
"aria-hidden": "false"
- }), e.container.find(".menu-item.move-up-disabled .menus-move-up").attr({
+ }), i.container.find(".menu-item.move-up-disabled .menus-move-up").attr({
tabindex: "-1",
"aria-hidden": "true"
- }), e.container.find(".menu-item.move-down-disabled .menus-move-down").attr({
+ }), i.container.find(".menu-item.move-down-disabled .menus-move-down").attr({
tabindex: "-1",
"aria-hidden": "true"
- }), e.container.find(".menu-item.move-left-disabled .menus-move-left").attr({
+ }), i.container.find(".menu-item.move-left-disabled .menus-move-left").attr({
tabindex: "-1",
"aria-hidden": "true"
- }), e.container.find(".menu-item.move-right-disabled .menus-move-right").attr({
+ }), i.container.find(".menu-item.move-right-disabled .menus-move-right").attr({
tabindex: "-1",
"aria-hidden": "true"
}))
- }), d = function() {
- var a = "field-" + c(this).val() + "-active";
- e.contentContainer.toggleClass(a, c(this).prop("checked"))
- }, b = a.panel("nav_menus").contentContainer.find(".metabox-prefs:first").find(".hide-column-tog"), b.each(d), b.on("click", d)
+ }), t = function() {
+ var e = "field-" + g(this).val() + "-active";
+ i.contentContainer.toggleClass(e, g(this).prop("checked"))
+ }, (e = v.panel("nav_menus").contentContainer.find(".metabox-prefs:first").find(".hide-column-tog")).each(t), e.on("click", t)
},
populateControls: function() {
- var b, c, d, e, f, g, h, i, j, k = this;
- b = k.id + "[name]", g = a.control(b), g || (g = new a.controlConstructor.nav_menu_name(b, {
+ var e, t, n, i, a, o, s, r, u, d = this;
+ e = d.id + "[name]", (o = v.control(e)) || (o = new v.controlConstructor.nav_menu_name(e, {
type: "nav_menu_name",
- label: a.Menus.data.l10n.menuNameLabel,
- section: k.id,
+ label: v.Menus.data.l10n.menuNameLabel,
+ section: d.id,
priority: 0,
settings: {
- "default": k.id
+ default: d.id
}
- }), a.control.add(g), g.active.set(!0)), f = a.control(k.id), f || (f = new a.controlConstructor.nav_menu(k.id, {
+ }), v.control.add(o), o.active.set(!0)), (a = v.control(d.id)) || (a = new v.controlConstructor.nav_menu(d.id, {
type: "nav_menu",
- section: k.id,
+ section: d.id,
priority: 998,
settings: {
- "default": k.id
+ default: d.id
},
- menu_id: k.params.menu_id
- }), a.control.add(f), f.active.set(!0)), c = k.id + "[locations]", h = a.control(c), h || (h = new a.controlConstructor.nav_menu_locations(c, {
- section: k.id,
+ menu_id: d.params.menu_id
+ }), v.control.add(a), a.active.set(!0)), t = d.id + "[locations]", (s = v.control(t)) || (s = new v.controlConstructor.nav_menu_locations(t, {
+ section: d.id,
priority: 999,
settings: {
- "default": k.id
+ default: d.id
},
- menu_id: k.params.menu_id
- }), a.control.add(h.id, h), f.active.set(!0)), d = k.id + "[auto_add]", i = a.control(d), i || (i = new a.controlConstructor.nav_menu_auto_add(d, {
+ menu_id: d.params.menu_id
+ }), v.control.add(s.id, s), a.active.set(!0)), n = d.id + "[auto_add]", (r = v.control(n)) || (r = new v.controlConstructor.nav_menu_auto_add(n, {
type: "nav_menu_auto_add",
label: "",
- section: k.id,
+ section: d.id,
priority: 1e3,
settings: {
- "default": k.id
+ default: d.id
}
- }), a.control.add(i), i.active.set(!0)), e = k.id + "[delete]", (j = a.control(e)) || (j = new a.Control(e, {
- section: k.id,
+ }), v.control.add(r), r.active.set(!0)), i = d.id + "[delete]", (u = v.control(i)) || (u = new v.Control(i, {
+ section: d.id,
priority: 1001,
templateId: "nav-menu-delete-button"
- }), a.control.add(j.id, j), j.active.set(!0), j.deferred.embedded.done(function() {
- j.container.find("button").on("click", function() {
- var b = k.params.menu_id;
- a.Menus.getMenuControl(b).setting.set(!1)
+ }), v.control.add(u.id, u), u.active.set(!0), u.deferred.embedded.done(function() {
+ u.container.find("button").on("click", function() {
+ var e = d.params.menu_id;
+ v.Menus.getMenuControl(e).setting.set(!1)
})
}))
},
refreshAssignedLocations: function() {
- var a = this,
- b = a.params.menu_id,
- c = [];
- _.each(a.navMenuLocationSettings, function(a, d) {
- a() === b && c.push(d)
- }), a.assignedLocations.set(c)
- },
- updateAssignedLocationsInSectionTitle: function(b) {
- var d, e = this;
- d = e.container.find(".accordion-section-title:first"), d.find(".menu-in-location").remove(), _.each(b, function(b) {
- var e, f;
- e = c('<span class="menu-in-location"></span>'), f = a.Menus.data.locationSlugMappedToName[b], e.text(a.Menus.data.l10n.menuLocation.replace("%s", f)), d.append(e)
- }), e.container.toggleClass("assigned-to-menu-location", 0 !== b.length)
- },
- onChangeExpanded: function(b, d) {
- var e, f = this;
- b && (wpNavMenu.menuList = f.contentContainer, wpNavMenu.targetList = wpNavMenu.menuList, c("#menu-to-edit").removeAttr("id"), wpNavMenu.menuList.attr("id", "menu-to-edit").addClass("menu"), _.each(a.section(f.id).controls(), function(a) {
- "nav_menu_item" === a.params.type && a.actuallyEmbed()
- }), d.completeCallback && (e = d.completeCallback), d.completeCallback = function() {
- "resolved" !== f.deferred.initSortables.state() && (wpNavMenu.initSortables(), f.deferred.initSortables.resolve(wpNavMenu.menuList), a.control("nav_menu[" + String(f.params.menu_id) + "]").reflowMenuItems()), _.isFunction(e) && e()
- }), a.Section.prototype.onChangeExpanded.call(f, b, d)
+ var n = this.params.menu_id,
+ i = [];
+ _.each(this.navMenuLocationSettings, function(e, t) {
+ e() === n && i.push(t)
+ }), this.assignedLocations.set(i)
+ },
+ updateAssignedLocationsInSectionTitle: function(e) {
+ var i;
+ (i = this.container.find(".accordion-section-title:first")).find(".menu-in-location").remove(), _.each(e, function(e) {
+ var t, n;
+ t = g('<span class="menu-in-location"></span>'), n = v.Menus.data.locationSlugMappedToName[e], t.text(v.Menus.data.l10n.menuLocation.replace("%s", n)), i.append(t)
+ }), this.container.toggleClass("assigned-to-menu-location", 0 !== e.length)
+ },
+ onChangeExpanded: function(e, t) {
+ var n, i = this;
+ e && (wpNavMenu.menuList = i.contentContainer, wpNavMenu.targetList = wpNavMenu.menuList, g("#menu-to-edit").removeAttr("id"), wpNavMenu.menuList.attr("id", "menu-to-edit").addClass("menu"), _.each(v.section(i.id).controls(), function(e) {
+ "nav_menu_item" === e.params.type && e.actuallyEmbed()
+ }), t.completeCallback && (n = t.completeCallback), t.completeCallback = function() {
+ "resolved" !== i.deferred.initSortables.state() && (wpNavMenu.initSortables(), i.deferred.initSortables.resolve(wpNavMenu.menuList), v.control("nav_menu[" + String(i.params.menu_id) + "]").reflowMenuItems()), _.isFunction(n) && n()
+ }), v.Section.prototype.onChangeExpanded.call(i, e, t)
},
highlightNewItemButton: function() {
- a.utils.highlightButton(this.contentContainer.find(".add-new-menu-item"), {
+ v.utils.highlightButton(this.contentContainer.find(".add-new-menu-item"), {
delay: 2e3
})
}
- }), a.Menus.createNavMenu = function(b) {
- var d, f, g;
- return f = a.Menus.generatePlaceholderAutoIncrementId(), d = "nav_menu[" + String(f) + "]", g = a.create(d, d, {}, {
+ }), v.Menus.createNavMenu = function(e) {
+ var t, n;
+ return n = v.Menus.generatePlaceholderAutoIncrementId(), t = "nav_menu[" + String(n) + "]", v.create(t, t, {}, {
type: "nav_menu",
- transport: a.Menus.data.settingTransport,
- previewer: a.previewer
- }), g.set(c.extend({}, a.Menus.data.defaultSettingValues.nav_menu, {
- name: b || ""
- })), a.section.add(new a.Menus.MenuSection(d, {
+ transport: v.Menus.data.settingTransport,
+ previewer: v.previewer
+ }).set(g.extend({}, v.Menus.data.defaultSettingValues.nav_menu, {
+ name: e || ""
+ })), v.section.add(new v.Menus.MenuSection(t, {
panel: "nav_menus",
- title: e(b),
- customizeAction: a.Menus.data.l10n.customizingMenus,
+ title: d(e),
+ customizeAction: v.Menus.data.l10n.customizingMenus,
priority: 10,
- menu_id: f
+ menu_id: n
}))
- }, a.Menus.NewMenuSection = a.Section.extend({
+ }, v.Menus.NewMenuSection = v.Section.extend({
attachEvents: function() {
- function c() {
- var b = 0;
- return a.each(function(a) {
- j.test(a.id) && !1 !== a.get() && (b += 1)
- }), b
- }
-
- function d() {
- h.find(".add-new-menu-notice").prop("hidden", c() > 0)
- }
+ var t = this,
+ e = t.container,
+ n = t.contentContainer,
+ i = /^nav_menu\[/;
- function e(a) {
- j.test(a.id) && (a.bind(d), d())
+ function a() {
+ var t;
+ e.find(".add-new-menu-notice").prop("hidden", (t = 0, v.each(function(e) {
+ i.test(e.id) && !1 !== e.get() && (t += 1)
+ }), 0 < t))
}
- function f(a) {
- j.test(a.id) && (a.unbind(d), d())
+ function o(e) {
+ i.test(e.id) && (e.bind(a), a())
}
- var g = this,
- h = g.container,
- i = g.contentContainer,
- j = /^nav_menu\[/;
- g.headContainer.find(".accordion-section-title").replaceWith(b.template("nav-menu-create-menu-section-title")), h.on("click", ".customize-add-menu-button", function() {
- g.expand()
- }), i.on("keydown", ".menu-name-field", function(a) {
- 13 === a.which && g.submit()
- }), i.on("click", "#customize-new-menu-submit", function(a) {
- g.submit(), a.stopPropagation(), a.preventDefault()
- }), a.each(e), a.bind("add", e), a.bind("removed", f), d(), a.Section.prototype.attachEvents.apply(g, arguments)
+ t.headContainer.find(".accordion-section-title").replaceWith(h.template("nav-menu-create-menu-section-title")), e.on("click", ".customize-add-menu-button", function() {
+ t.expand()
+ }), n.on("keydown", ".menu-name-field", function(e) {
+ 13 === e.which && t.submit()
+ }), n.on("click", "#customize-new-menu-submit", function(e) {
+ t.submit(), e.stopPropagation(), e.preventDefault()
+ }), v.each(o), v.bind("add", o), v.bind("removed", function(e) {
+ i.test(e.id) && (e.unbind(a), a())
+ }), a(), v.Section.prototype.attachEvents.apply(t, arguments)
},
ready: function() {
this.populateControls()
},
populateControls: function() {
- var b, c, d, e, f, g, h = this;
- b = h.id + "[name]", e = a.control(b), e || (e = new a.controlConstructor.nav_menu_name(b, {
- label: a.Menus.data.l10n.menuNameLabel,
- description: a.Menus.data.l10n.newMenuNameDescription,
- section: h.id,
+ var e, t, n, i, a, o, s = this;
+ e = s.id + "[name]", (i = v.control(e)) || (i = new v.controlConstructor.nav_menu_name(e, {
+ label: v.Menus.data.l10n.menuNameLabel,
+ description: v.Menus.data.l10n.newMenuNameDescription,
+ section: s.id,
priority: 0
- }), a.control.add(e.id, e), e.active.set(!0)), c = h.id + "[locations]", f = a.control(c), f || (f = new a.controlConstructor.nav_menu_locations(c, {
- section: h.id,
+ }), v.control.add(i.id, i), i.active.set(!0)), t = s.id + "[locations]", (a = v.control(t)) || (a = new v.controlConstructor.nav_menu_locations(t, {
+ section: s.id,
priority: 1,
menu_id: "",
isCreating: !0
- }), a.control.add(c, f), f.active.set(!0)), d = h.id + "[submit]", (g = a.control(d)) || (g = new a.Control(d, {
- section: h.id,
+ }), v.control.add(t, a), a.active.set(!0)), n = s.id + "[submit]", (o = v.control(n)) || (o = new v.Control(n, {
+ section: s.id,
priority: 1,
templateId: "nav-menu-submit-new-button"
- }), a.control.add(d, g), g.active.set(!0))
+ }), v.control.add(n, o), o.active.set(!0))
},
submit: function() {
- var d, e = this,
- f = e.contentContainer,
- g = f.find(".menu-name-field").first(),
- h = g.val();
- if (!h) return g.addClass("invalid"), void g.focus();
- d = a.Menus.createNavMenu(h), g.val(""), g.removeClass("invalid"), f.find(".assigned-menu-location input[type=checkbox]").each(function() {
- var b, e = c(this);
- e.prop("checked") && (b = a("nav_menu_locations[" + e.data("location-id") + "]"), b.set(d.params.menu_id), e.prop("checked", !1))
- }), b.a11y.speak(a.Menus.data.l10n.menuAdded), d.focus({
+ var t, e = this.contentContainer,
+ n = e.find(".menu-name-field").first(),
+ i = n.val();
+ if (!i) return n.addClass("invalid"), void n.focus();
+ t = v.Menus.createNavMenu(i), n.val(""), n.removeClass("invalid"), e.find(".assigned-menu-location input[type=checkbox]").each(function() {
+ var e = g(this);
+ e.prop("checked") && (v("nav_menu_locations[" + e.data("location-id") + "]").set(t.params.menu_id), e.prop("checked", !1))
+ }), h.a11y.speak(v.Menus.data.l10n.menuAdded), t.focus({
completeCallback: function() {
- d.highlightNewItemButton()
+ t.highlightNewItemButton()
}
})
},
- selectDefaultLocation: function(b) {
- var c = a.control(this.id + "[locations]"),
- d = {};
- null !== b && (d[b] = !0), c.setSelections(d)
+ selectDefaultLocation: function(e) {
+ var t = v.control(this.id + "[locations]"),
+ n = {};
+ null !== e && (n[e] = !0), t.setSelections(n)
}
- }), a.Menus.MenuLocationControl = a.Control.extend({
- initialize: function(b, c) {
- var d = this,
- e = b.match(/^nav_menu_locations\[(.+?)]/);
- d.themeLocation = e[1], a.Control.prototype.initialize.call(d, b, c)
+ }), v.Menus.MenuLocationControl = v.Control.extend({
+ initialize: function(e, t) {
+ var n = e.match(/^nav_menu_locations\[(.+?)]/);
+ this.themeLocation = n[1], v.Control.prototype.initialize.call(this, e, t)
},
ready: function() {
- var b = this,
- c = /^nav_menu\[(-?\d+)]/;
- b.setting.validate = function(a) {
- return "" === a ? 0 : parseInt(a, 10)
- }, b.container.find(".create-menu").on("click", function() {
- var b = a.section("add_menu");
- b.selectDefaultLocation(this.dataset.locationId), b.focus()
- }), b.container.find(".edit-menu").on("click", function() {
- var c = b.setting();
- a.section("nav_menu[" + c + "]").focus()
- }), b.setting.bind("change", function() {
- var a = 0 !== b.setting();
- b.container.find(".create-menu").toggleClass("hidden", a), b.container.find(".edit-menu").toggleClass("hidden", !a)
- }), a.bind("add", function(a) {
- var d, f, g = a.id.match(c);
- g && !1 !== a() && (f = g[1], d = new Option(e(a().name), f), b.container.find("select").append(d))
- }), a.bind("remove", function(a) {
- var d, e = a.id.match(c);
- e && (d = parseInt(e[1], 10), b.setting() === d && b.setting.set(""), b.container.find("option[value=" + d + "]").remove())
- }), a.bind("change", function(a) {
- var d, f = a.id.match(c);
- f && (d = parseInt(f[1], 10), !1 === a() ? (b.setting() === d && b.setting.set(""), b.container.find("option[value=" + d + "]").remove()) : b.container.find("option[value=" + d + "]").text(e(a().name)))
+ var a = this,
+ o = /^nav_menu\[(-?\d+)]/;
+ a.setting.validate = function(e) {
+ return "" === e ? 0 : parseInt(e, 10)
+ }, a.container.find(".create-menu").on("click", function() {
+ var e = v.section("add_menu");
+ e.selectDefaultLocation(this.dataset.locationId), e.focus()
+ }), a.container.find(".edit-menu").on("click", function() {
+ var e = a.setting();
+ v.section("nav_menu[" + e + "]").focus()
+ }), a.setting.bind("change", function() {
+ var e = 0 !== a.setting();
+ a.container.find(".create-menu").toggleClass("hidden", e), a.container.find(".edit-menu").toggleClass("hidden", !e)
+ }), v.bind("add", function(e) {
+ var t, n, i = e.id.match(o);
+ i && !1 !== e() && (n = i[1], t = new Option(d(e().name), n), a.container.find("select").append(t))
+ }), v.bind("remove", function(e) {
+ var t, n = e.id.match(o);
+ n && (t = parseInt(n[1], 10), a.setting() === t && a.setting.set(""), a.container.find("option[value=" + t + "]").remove())
+ }), v.bind("change", function(e) {
+ var t, n = e.id.match(o);
+ n && (t = parseInt(n[1], 10), !1 === e() ? (a.setting() === t && a.setting.set(""), a.container.find("option[value=" + t + "]").remove()) : a.container.find("option[value=" + t + "]").text(d(e().name)))
})
}
- }), a.Menus.MenuItemControl = a.Control.extend({
- initialize: function(b, d) {
- var e = this;
- e.expanded = new a.Value(!1), e.expandedArgumentsQueue = [], e.expanded.bind(function(a) {
- var b = e.expandedArgumentsQueue.shift();
- b = c.extend({}, e.defaultExpandedArguments, b), e.onChangeExpanded(a, b)
- }), a.Control.prototype.initialize.call(e, b, d), e.active.validate = function() {
- var b = a.section(e.section());
- return !!b && b.active()
+ }), v.Menus.MenuItemControl = v.Control.extend({
+ initialize: function(e, t) {
+ var n = this;
+ n.expanded = new v.Value(!1), n.expandedArgumentsQueue = [], n.expanded.bind(function(e) {
+ var t = n.expandedArgumentsQueue.shift();
+ t = g.extend({}, n.defaultExpandedArguments, t), n.onChangeExpanded(e, t)
+ }), v.Control.prototype.initialize.call(n, e, t), n.active.validate = function() {
+ var e = v.section(n.section());
+ return !!e && e.active()
}
},
embed: function() {
- var b, c = this,
- d = c.section();
- d && ((b = a.section(d)) && b.expanded() || a.settings.autofocus.control === c.id) && c.actuallyEmbed()
+ var e, t = this.section();
+ t && ((e = v.section(t)) && e.expanded() || v.settings.autofocus.control === this.id) && this.actuallyEmbed()
},
actuallyEmbed: function() {
- var a = this;
- "resolved" !== a.deferred.embedded.state() && (a.renderContent(), a.deferred.embedded.resolve())
+ "resolved" !== this.deferred.embedded.state() && (this.renderContent(), this.deferred.embedded.resolve())
},
ready: function() {
- if ("undefined" == typeof this.params.menu_item_id) throw new Error("params.menu_item_id was not defined");
+ if (void 0 === this.params.menu_item_id) throw new Error("params.menu_item_id was not defined");
this._setupControlToggle(), this._setupReorderUI(), this._setupUpdateUI(), this._setupRemoveUI(), this._setupLinksUI(), this._setupTitleUI()
},
_setupControlToggle: function() {
- var b = this;
- this.container.find(".menu-item-handle").on("click", function(d) {
- d.preventDefault(), d.stopPropagation();
- var e = b.getMenuControl(),
- f = c(d.target).is(".item-delete, .item-delete *"),
- g = c(d.target).is(".add-new-menu-item, .add-new-menu-item *");
- !c("body").hasClass("adding-menu-items") || f || g || a.Menus.availableMenuItemsPanel.close(), e.isReordering || e.isSorting || b.toggleForm()
+ var a = this;
+ this.container.find(".menu-item-handle").on("click", function(e) {
+ e.preventDefault(), e.stopPropagation();
+ var t = a.getMenuControl(),
+ n = g(e.target).is(".item-delete, .item-delete *"),
+ i = g(e.target).is(".add-new-menu-item, .add-new-menu-item *");
+ !g("body").hasClass("adding-menu-items") || n || i || v.Menus.availableMenuItemsPanel.close(), t.isReordering || t.isSorting || a.toggleForm()
})
},
_setupReorderUI: function() {
- var a, d, e = this;
- a = b.template("menu-item-reorder-nav"), e.container.find(".item-controls").after(a), d = e.container.find(".menu-item-reorder-nav"), d.find(".menus-move-up, .menus-move-down, .menus-move-left, .menus-move-right").on("click", function() {
- var a = c(this);
- a.focus();
- var b = a.is(".menus-move-up"),
- d = a.is(".menus-move-down"),
- f = a.is(".menus-move-left"),
- g = a.is(".menus-move-right");
- b ? e.moveUp() : d ? e.moveDown() : f ? e.moveLeft() : g && e.moveRight(), a.focus()
+ var e, o = this;
+ e = h.template("menu-item-reorder-nav"), o.container.find(".item-controls").after(e), o.container.find(".menu-item-reorder-nav").find(".menus-move-up, .menus-move-down, .menus-move-left, .menus-move-right").on("click", function() {
+ var e = g(this);
+ e.focus();
+ var t = e.is(".menus-move-up"),
+ n = e.is(".menus-move-down"),
+ i = e.is(".menus-move-left"),
+ a = e.is(".menus-move-right");
+ t ? o.moveUp() : n ? o.moveDown() : i ? o.moveLeft() : a && o.moveRight(), e.focus()
})
},
_setupUpdateUI: function() {
- var b, c = this,
- d = c.setting();
- c.elements = {}, c.elements.url = new a.Element(c.container.find(".edit-menu-item-url")), c.elements.title = new a.Element(c.container.find(".edit-menu-item-title")), c.elements.attr_title = new a.Element(c.container.find(".edit-menu-item-attr-title")), c.elements.target = new a.Element(c.container.find(".edit-menu-item-target")), c.elements.classes = new a.Element(c.container.find(".edit-menu-item-classes")), c.elements.xfn = new a.Element(c.container.find(".edit-menu-item-xfn")), c.elements.description = new a.Element(c.container.find(".edit-menu-item-description")), _.each(c.elements, function(a, b) {
- a.bind(function(d) {
- a.element.is("input[type=checkbox]") && (d = d ? a.element.val() : "");
- var e = c.setting();
- e && e[b] !== d && (e = _.clone(e), e[b] = d, c.setting.set(e))
- }), d && ("classes" !== b && "xfn" !== b || !_.isArray(d[b]) ? a.set(d[b]) : a.set(d[b].join(" ")))
- }), c.setting.bind(function(b, d) {
- var e, f = c.params.menu_item_id,
- g = [],
- h = [];
- !1 === b ? (e = a.control("nav_menu[" + String(d.nav_menu_term_id) + "]"), c.container.remove(), _.each(e.getMenuItemControls(), function(a) {
- d.menu_item_parent === a.setting().menu_item_parent && a.setting().position > d.position ? g.push(a) : a.setting().menu_item_parent === f && h.push(a)
- }), _.each(g, function(a) {
- var b = _.clone(a.setting());
- b.position += h.length, a.setting.set(b)
- }), _.each(h, function(a, b) {
- var c = _.clone(a.setting());
- c.position = d.position + b, c.menu_item_parent = d.menu_item_parent, a.setting.set(c)
- }), e.debouncedReflowMenuItems()) : (_.each(b, function(a, d) {
- c.elements[d] && c.elements[d].set(b[d])
- }), c.container.find(".menu-item-data-parent-id").val(b.menu_item_parent), b.position === d.position && b.menu_item_parent === d.menu_item_parent || c.getMenuControl().debouncedReflowMenuItems())
- }), b = function() {
- c.elements.url.element.toggleClass("invalid", c.setting.notifications.has("invalid_url"))
- }, c.setting.notifications.bind("add", b), c.setting.notifications.bind("removed", b)
+ var e, s = this,
+ t = s.setting();
+ s.elements = {}, s.elements.url = new v.Element(s.container.find(".edit-menu-item-url")), s.elements.title = new v.Element(s.container.find(".edit-menu-item-title")), s.elements.attr_title = new v.Element(s.container.find(".edit-menu-item-attr-title")), s.elements.target = new v.Element(s.container.find(".edit-menu-item-target")), s.elements.classes = new v.Element(s.container.find(".edit-menu-item-classes")), s.elements.xfn = new v.Element(s.container.find(".edit-menu-item-xfn")), s.elements.description = new v.Element(s.container.find(".edit-menu-item-description")), _.each(s.elements, function(n, i) {
+ n.bind(function(e) {
+ n.element.is("input[type=checkbox]") && (e = e ? n.element.val() : "");
+ var t = s.setting();
+ t && t[i] !== e && ((t = _.clone(t))[i] = e, s.setting.set(t))
+ }), t && ("classes" !== i && "xfn" !== i || !_.isArray(t[i]) ? n.set(t[i]) : n.set(t[i].join(" ")))
+ }), s.setting.bind(function(n, i) {
+ var e, t = s.params.menu_item_id,
+ a = [],
+ o = [];
+ !1 === n ? (e = v.control("nav_menu[" + String(i.nav_menu_term_id) + "]"), s.container.remove(), _.each(e.getMenuItemControls(), function(e) {
+ i.menu_item_parent === e.setting().menu_item_parent && e.setting().position > i.position ? a.push(e) : e.setting().menu_item_parent === t && o.push(e)
+ }), _.each(a, function(e) {
+ var t = _.clone(e.setting());
+ t.position += o.length, e.setting.set(t)
+ }), _.each(o, function(e, t) {
+ var n = _.clone(e.setting());
+ n.position = i.position + t, n.menu_item_parent = i.menu_item_parent, e.setting.set(n)
+ }), e.debouncedReflowMenuItems()) : (_.each(n, function(e, t) {
+ s.elements[t] && s.elements[t].set(n[t])
+ }), s.container.find(".menu-item-data-parent-id").val(n.menu_item_parent), n.position === i.position && n.menu_item_parent === i.menu_item_parent || s.getMenuControl().debouncedReflowMenuItems())
+ }), e = function() {
+ s.elements.url.element.toggleClass("invalid", s.setting.notifications.has("invalid_url"))
+ }, s.setting.notifications.bind("add", e), s.setting.notifications.bind("removed", e)
},
_setupRemoveUI: function() {
- var d, e = this;
- d = e.container.find(".item-delete"), d.on("click", function() {
- var d, f, g, h = !0;
- c("body").hasClass("adding-menu-items") || (h = !1), f = e.container.nextAll(".customize-control-nav_menu_item:visible").first(), g = e.container.prevAll(".customize-control-nav_menu_item:visible").first(), d = f.length ? f.find(!1 === h ? ".item-edit" : ".item-delete").first() : g.length ? g.find(!1 === h ? ".item-edit" : ".item-delete").first() : e.container.nextAll(".customize-control-nav_menu").find(".add-new-menu-item").first(), e.container.slideUp(function() {
- e.setting.set(!1), b.a11y.speak(a.Menus.data.l10n.itemDeleted), d.focus()
- }), e.setting.set(!1)
+ var a = this;
+ a.container.find(".item-delete").on("click", function() {
+ var e, t, n, i = !0;
+ g("body").hasClass("adding-menu-items") || (i = !1), t = a.container.nextAll(".customize-control-nav_menu_item:visible").first(), n = a.container.prevAll(".customize-control-nav_menu_item:visible").first(), e = t.length ? t.find(!1 === i ? ".item-edit" : ".item-delete").first() : n.length ? n.find(!1 === i ? ".item-edit" : ".item-delete").first() : a.container.nextAll(".customize-control-nav_menu").find(".add-new-menu-item").first(), a.container.slideUp(function() {
+ a.setting.set(!1), h.a11y.speak(v.Menus.data.l10n.itemDeleted), e.focus()
+ }), a.setting.set(!1)
})
},
_setupLinksUI: function() {
- var b;
- b = this.container.find("a.original-link"), b.on("click", function(b) {
- b.preventDefault(), a.previewer.previewUrl(b.target.toString())
+ this.container.find("a.original-link").on("click", function(e) {
+ e.preventDefault(), v.previewer.previewUrl(e.target.toString())
})
},
_setupTitleUI: function() {
- var b, d = this;
- d.container.find(".edit-menu-item-title").on("blur", function() {
- c(this).val(c.trim(c(this).val()))
- }), b = d.container.find(".menu-item-title"), d.setting.bind(function(d) {
- var e, f;
- d && (e = c.trim(d.title), f = e || d.original_title || a.Menus.data.l10n.untitled, d._invalid && (f = a.Menus.data.l10n.invalidTitleTpl.replace("%s", f)), e || d.original_title ? b.text(f).removeClass("no-title") : b.text(f).addClass("no-title"))
+ var i;
+ this.container.find(".edit-menu-item-title").on("blur", function() {
+ g(this).val(g.trim(g(this).val()))
+ }), i = this.container.find(".menu-item-title"), this.setting.bind(function(e) {
+ var t, n;
+ e && (n = (t = g.trim(e.title)) || e.original_title || v.Menus.data.l10n.untitled, e._invalid && (n = v.Menus.data.l10n.invalidTitleTpl.replace("%s", n)), t || e.original_title ? i.text(n).removeClass("no-title") : i.text(n).addClass("no-title"))
})
},
getDepth: function() {
- var b = this,
- c = b.setting(),
- d = 0;
- if (!c) return 0;
- for (; c && c.menu_item_parent && (d += 1, b = a.control("nav_menu_item[" + c.menu_item_parent + "]"));) c = b.setting();
- return d
+ var e = this,
+ t = e.setting(),
+ n = 0;
+ if (!t) return 0;
+ for (; t && t.menu_item_parent && (n += 1, e = v.control("nav_menu_item[" + t.menu_item_parent + "]"));) t = e.setting();
+ return n
},
renderContent: function() {
- var b, c = this,
- d = c.setting();
- c.params.title = d.title || "", c.params.depth = c.getDepth(), c.container.data("item-depth", c.params.depth), b = ["menu-item", "menu-item-depth-" + String(c.params.depth), "menu-item-" + d.object, "menu-item-edit-inactive"], d._invalid ? (b.push("menu-item-invalid"), c.params.title = a.Menus.data.l10n.invalidTitleTpl.replace("%s", c.params.title)) : "draft" === d.status && (b.push("pending"), c.params.title = a.Menus.data.pendingTitleTpl.replace("%s", c.params.title)), c.params.el_classes = b.join(" "), c.params.item_type_label = d.type_label, c.params.item_type = d.type, c.params.url = d.url, c.params.target = d.target, c.params.attr_title = d.attr_title, c.params.classes = _.isArray(d.classes) ? d.classes.join(" ") : d.classes, c.params.attr_title = d.attr_title, c.params.xfn = d.xfn, c.params.description = d.description, c.params.parent = d.menu_item_parent, c.params.original_title = d.original_title || "", c.container.addClass(c.params.el_classes), a.Control.prototype.renderContent.call(c)
+ var e, t = this,
+ n = t.setting();
+ t.params.title = n.title || "", t.params.depth = t.getDepth(), t.container.data("item-depth", t.params.depth), e = ["menu-item", "menu-item-depth-" + String(t.params.depth), "menu-item-" + n.object, "menu-item-edit-inactive"], n._invalid ? (e.push("menu-item-invalid"), t.params.title = v.Menus.data.l10n.invalidTitleTpl.replace("%s", t.params.title)) : "draft" === n.status && (e.push("pending"), t.params.title = v.Menus.data.pendingTitleTpl.replace("%s", t.params.title)), t.params.el_classes = e.join(" "), t.params.item_type_label = n.type_label, t.params.item_type = n.type, t.params.url = n.url, t.params.target = n.target, t.params.attr_title = n.attr_title, t.params.classes = _.isArray(n.classes) ? n.classes.join(" ") : n.classes, t.params.attr_title = n.attr_title, t.params.xfn = n.xfn, t.params.description = n.description, t.params.parent = n.menu_item_parent, t.params.original_title = n.original_title || "", t.container.addClass(t.params.el_classes), v.Control.prototype.renderContent.call(t)
},
getMenuControl: function() {
- var b = this,
- c = b.setting();
- return c && c.nav_menu_term_id ? a.control("nav_menu[" + c.nav_menu_term_id + "]") : null
+ var e = this.setting();
+ return e && e.nav_menu_term_id ? v.control("nav_menu[" + e.nav_menu_term_id + "]") : null
},
expandControlSection: function() {
- var a = this.container.closest(".accordion-section");
- a.hasClass("open") || a.find(".accordion-section-title:first").trigger("click")
+ var e = this.container.closest(".accordion-section");
+ e.hasClass("open") || e.find(".accordion-section-title:first").trigger("click")
},
- _toggleExpanded: a.Section.prototype._toggleExpanded,
- expand: a.Section.prototype.expand,
- expandForm: function(a) {
- this.expand(a)
- },
- collapse: a.Section.prototype.collapse,
- collapseForm: function(a) {
- this.collapse(a)
- },
- toggleForm: function(a, b) {
- void 0 === a && (a = !this.expanded()), a ? this.expand(b) : this.collapse(b)
- },
- onChangeExpanded: function(b, c) {
- var d, e, f, g = this;
- if (d = this.container, e = d.find(".menu-item-settings:first"), void 0 === b && (b = !e.is(":visible")), e.is(":visible") === b) return void(c && c.completeCallback && c.completeCallback());
- b ? (a.control.each(function(a) {
- g.params.type === a.params.type && g !== a && a.collapseForm()
- }), f = function() {
- d.removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active"), g.container.trigger("expanded"), c && c.completeCallback && c.completeCallback()
- }, d.find(".item-edit").attr("aria-expanded", "true"), e.slideDown("fast", f), g.container.trigger("expand")) : (f = function() {
- d.addClass("menu-item-edit-inactive").removeClass("menu-item-edit-active"), g.container.trigger("collapsed"), c && c.completeCallback && c.completeCallback()
- }, g.container.trigger("collapse"), d.find(".item-edit").attr("aria-expanded", "false"), e.slideUp("fast", f))
- },
- focus: function(b) {
- b = b || {};
- var c, d = this,
- e = b.completeCallback;
- c = function() {
- d.expandControlSection(), b.completeCallback = function() {
- var a;
- a = d.container.find(".menu-item-settings").find("input, select, textarea, button, object, a[href], [tabindex]").filter(":visible"), a.first().focus(), e && e()
- }, d.expandForm(b)
- }, a.section.has(d.section()) ? a.section(d.section()).expand({
- completeCallback: c
- }) : c()
+ _toggleExpanded: v.Section.prototype._toggleExpanded,
+ expand: v.Section.prototype.expand,
+ expandForm: function(e) {
+ this.expand(e)
+ },
+ collapse: v.Section.prototype.collapse,
+ collapseForm: function(e) {
+ this.collapse(e)
+ },
+ toggleForm: function(e, t) {
+ void 0 === e && (e = !this.expanded()), e ? this.expand(t) : this.collapse(t)
+ },
+ onChangeExpanded: function(e, t) {
+ var n, i, a, o = this;
+ i = (n = this.container).find(".menu-item-settings:first"), void 0 === e && (e = !i.is(":visible")), i.is(":visible") !== e ? e ? (v.control.each(function(e) {
+ o.params.type === e.params.type && o !== e && e.collapseForm()
+ }), a = function() {
+ n.removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active"), o.container.trigger("expanded"), t && t.completeCallback && t.completeCallback()
+ }, n.find(".item-edit").attr("aria-expanded", "true"), i.slideDown("fast", a), o.container.trigger("expand")) : (a = function() {
+ n.addClass("menu-item-edit-inactive").removeClass("menu-item-edit-active"), o.container.trigger("collapsed"), t && t.completeCallback && t.completeCallback()
+ }, o.container.trigger("collapse"), n.find(".item-edit").attr("aria-expanded", "false"), i.slideUp("fast", a)) : t && t.completeCallback && t.completeCallback()
+ },
+ focus: function(e) {
+ var t, n = this,
+ i = (e = e || {}).completeCallback;
+ t = function() {
+ n.expandControlSection(), e.completeCallback = function() {
+ n.container.find(".menu-item-settings").find("input, select, textarea, button, object, a[href], [tabindex]").filter(":visible").first().focus(), i && i()
+ }, n.expandForm(e)
+ }, v.section.has(n.section()) ? v.section(n.section()).expand({
+ completeCallback: t
+ }) : t()
},
moveUp: function() {
- this._changePosition(-1), b.a11y.speak(a.Menus.data.l10n.movedUp)
+ this._changePosition(-1), h.a11y.speak(v.Menus.data.l10n.movedUp)
},
moveDown: function() {
- this._changePosition(1), b.a11y.speak(a.Menus.data.l10n.movedDown)
+ this._changePosition(1), h.a11y.speak(v.Menus.data.l10n.movedDown)
},
moveLeft: function() {
- this._changeDepth(-1), b.a11y.speak(a.Menus.data.l10n.movedLeft)
+ this._changeDepth(-1), h.a11y.speak(v.Menus.data.l10n.movedLeft)
},
moveRight: function() {
- this._changeDepth(1), b.a11y.speak(a.Menus.data.l10n.movedRight)
+ this._changeDepth(1), h.a11y.speak(v.Menus.data.l10n.movedRight)
},
- _changePosition: function(a) {
- var b, d, e = this,
- f = _.clone(e.setting()),
- g = [];
- if (1 !== a && -1 !== a) throw new Error("Offset changes by 1 are only supported.");
- if (e.setting()) {
- if (_(e.getMenuControl().getMenuItemControls()).each(function(a) {
- a.setting().menu_item_parent === f.menu_item_parent && g.push(a.setting)
- }), g.sort(function(a, b) {
- return a().position - b().position
- }), -1 === (d = _.indexOf(g, e.setting))) throw new Error("Expected setting to be among siblings.");
- 0 === d && a < 0 || d === g.length - 1 && a > 0 || (b = g[d + a], b && b.set(c.extend(_.clone(b()), {
- position: f.position
- })), f.position += a, e.setting.set(f))
+ _changePosition: function(e) {
+ var t, n, i = this,
+ a = _.clone(i.setting()),
+ o = [];
+ if (1 !== e && -1 !== e) throw new Error("Offset changes by 1 are only supported.");
+ if (i.setting()) {
+ if (_(i.getMenuControl().getMenuItemControls()).each(function(e) {
+ e.setting().menu_item_parent === a.menu_item_parent && o.push(e.setting)
+ }), o.sort(function(e, t) {
+ return e().position - t().position
+ }), -1 === (n = _.indexOf(o, i.setting))) throw new Error("Expected setting to be among siblings.");
+ 0 === n && e < 0 || n === o.length - 1 && 0 < e || ((t = o[n + e]) && t.set(g.extend(_.clone(t()), {
+ position: a.position
+ })), a.position += e, i.setting.set(a))
}
},
- _changeDepth: function(b) {
- if (1 !== b && -1 !== b) throw new Error("Offset changes by 1 are only supported.");
- var d, e, f, g = this,
- h = _.clone(g.setting()),
- i = [];
- if (_(g.getMenuControl().getMenuItemControls()).each(function(a) {
- a.setting().menu_item_parent === h.menu_item_parent && i.push(a)
- }), i.sort(function(a, b) {
- return a.setting().position - b.setting().position
- }), -1 === (d = _.indexOf(i, g))) throw new Error("Expected control to be among siblings.");
- if (-1 === b) {
- if (!h.menu_item_parent) return;
- f = a.control("nav_menu_item[" + h.menu_item_parent + "]"), _(i).chain().slice(d).each(function(a, b) {
- a.setting.set(c.extend({}, a.setting(), {
- menu_item_parent: g.params.menu_item_id,
- position: b
+ _changeDepth: function(e) {
+ if (1 !== e && -1 !== e) throw new Error("Offset changes by 1 are only supported.");
+ var t, n, i, a = this,
+ o = _.clone(a.setting()),
+ s = [];
+ if (_(a.getMenuControl().getMenuItemControls()).each(function(e) {
+ e.setting().menu_item_parent === o.menu_item_parent && s.push(e)
+ }), s.sort(function(e, t) {
+ return e.setting().position - t.setting().position
+ }), -1 === (t = _.indexOf(s, a))) throw new Error("Expected control to be among siblings.");
+ if (-1 === e) {
+ if (!o.menu_item_parent) return;
+ i = v.control("nav_menu_item[" + o.menu_item_parent + "]"), _(s).chain().slice(t).each(function(e, t) {
+ e.setting.set(g.extend({}, e.setting(), {
+ menu_item_parent: a.params.menu_item_id,
+ position: t
}))
- }), _(g.getMenuControl().getMenuItemControls()).each(function(a) {
- var b, d;
- (d = a.setting().menu_item_parent === f.setting().menu_item_parent && a.setting().position > f.setting().position) && (b = _.clone(a.setting()), a.setting.set(c.extend(b, {
- position: b.position + 1
+ }), _(a.getMenuControl().getMenuItemControls()).each(function(e) {
+ var t;
+ e.setting().menu_item_parent === i.setting().menu_item_parent && e.setting().position > i.setting().position && (t = _.clone(e.setting()), e.setting.set(g.extend(t, {
+ position: t.position + 1
})))
- }), h.position = f.setting().position + 1, h.menu_item_parent = f.setting().menu_item_parent, g.setting.set(h)
- } else if (1 === b) {
- if (0 === d) return;
- e = i[d - 1], h.menu_item_parent = e.params.menu_item_id, h.position = 0, _(g.getMenuControl().getMenuItemControls()).each(function(a) {
- a.setting().menu_item_parent === h.menu_item_parent && (h.position = Math.max(h.position, a.setting().position))
- }), h.position += 1, g.setting.set(h)
+ }), o.position = i.setting().position + 1, o.menu_item_parent = i.setting().menu_item_parent, a.setting.set(o)
+ } else if (1 === e) {
+ if (0 === t) return;
+ n = s[t - 1], o.menu_item_parent = n.params.menu_item_id, o.position = 0, _(a.getMenuControl().getMenuItemControls()).each(function(e) {
+ e.setting().menu_item_parent === o.menu_item_parent && (o.position = Math.max(o.position, e.setting().position))
+ }), o.position += 1, a.setting.set(o)
}
}
- }), a.Menus.MenuNameControl = a.Control.extend({
+ }), v.Menus.MenuNameControl = v.Control.extend({
ready: function() {
- var b = this;
- if (b.setting) {
- var c = b.setting();
- b.nameElement = new a.Element(b.container.find(".menu-name-field")), b.nameElement.bind(function(a) {
- var c = b.setting();
- c && c.name !== a && (c = _.clone(c), c.name = a, b.setting.set(c))
- }), c && b.nameElement.set(c.name), b.setting.bind(function(a) {
- a && b.nameElement.set(a.name)
+ var n = this;
+ if (n.setting) {
+ var e = n.setting();
+ n.nameElement = new v.Element(n.container.find(".menu-name-field")), n.nameElement.bind(function(e) {
+ var t = n.setting();
+ t && t.name !== e && ((t = _.clone(t)).name = e, n.setting.set(t))
+ }), e && n.nameElement.set(e.name), n.setting.bind(function(e) {
+ e && n.nameElement.set(e.name)
})
}
}
- }), a.Menus.MenuLocationsControl = a.Control.extend({
+ }), v.Menus.MenuLocationsControl = v.Control.extend({
ready: function() {
- var b = this;
- b.container.find(".assigned-menu-location").each(function() {
- var d = c(this),
- f = d.find("input[type=checkbox]"),
- g = new a.Element(f),
- h = a("nav_menu_locations[" + f.data("location-id") + "]"),
- i = "" === b.params.menu_id,
- j = i ? _.noop : function(a) {
- g.set(a)
+ var u = this;
+ u.container.find(".assigned-menu-location").each(function() {
+ var n = g(this),
+ e = n.find("input[type=checkbox]"),
+ t = new v.Element(e),
+ i = v("nav_menu_locations[" + e.data("location-id") + "]"),
+ a = "" === u.params.menu_id,
+ o = a ? _.noop : function(e) {
+ t.set(e)
},
- k = i ? _.noop : function(a) {
- h.set(a ? b.params.menu_id : 0)
+ s = a ? _.noop : function(e) {
+ i.set(e ? u.params.menu_id : 0)
},
- l = function(b) {
- var c = a("nav_menu[" + String(b) + "]");
- b && c && c() ? d.find(".theme-location-set").show().find("span").text(e(c().name)) : d.find(".theme-location-set").hide()
+ r = function(e) {
+ var t = v("nav_menu[" + String(e) + "]");
+ e && t && t() ? n.find(".theme-location-set").show().find("span").text(d(t().name)) : n.find(".theme-location-set").hide()
};
- j(h.get() === b.params.menu_id), f.on("change", function() {
- k(this.checked)
- }),
- h.bind(function(a) {
- j(a === b.params.menu_id), l(a)
- }), l(h.get())
+ o(i.get() === u.params.menu_id), e.on("change", function() {
+ s(this.checked)
+ }), i.bind(function(e) {
+ o(e === u.params.menu_id), r(e)
+ }), r(i.get())
})
},
- setSelections: function(a) {
- this.container.find(".menu-location").each(function(b, c) {
- var d = c.dataset.locationId;
- c.checked = d in a && a[d]
+ setSelections: function(i) {
+ this.container.find(".menu-location").each(function(e, t) {
+ var n = t.dataset.locationId;
+ t.checked = n in i && i[n]
})
}
- }), a.Menus.MenuAutoAddControl = a.Control.extend({
+ }), v.Menus.MenuAutoAddControl = v.Control.extend({
ready: function() {
- var b = this,
- c = b.setting();
- b.active.validate = function() {
- var c = a.section(b.section());
- return !!c && c.active()
- }, b.autoAddElement = new a.Element(b.container.find("input[type=checkbox].auto_add")), b.autoAddElement.bind(function(a) {
- var c = b.setting();
- c && c.name !== a && (c = _.clone(c), c.auto_add = a, b.setting.set(c))
- }), c && b.autoAddElement.set(c.auto_add), b.setting.bind(function(a) {
- a && b.autoAddElement.set(a.auto_add)
+ var n = this,
+ e = n.setting();
+ n.active.validate = function() {
+ var e = v.section(n.section());
+ return !!e && e.active()
+ }, n.autoAddElement = new v.Element(n.container.find("input[type=checkbox].auto_add")), n.autoAddElement.bind(function(e) {
+ var t = n.setting();
+ t && t.name !== e && ((t = _.clone(t)).auto_add = e, n.setting.set(t))
+ }), e && n.autoAddElement.set(e.auto_add), n.setting.bind(function(e) {
+ e && n.autoAddElement.set(e.auto_add)
})
}
- }), a.Menus.MenuControl = a.Control.extend({
+ }), v.Menus.MenuControl = v.Control.extend({
ready: function() {
- var b, d, f, g = this,
- h = a.section(g.section()),
- i = g.params.menu_id,
- j = g.setting();
- if ("undefined" == typeof this.params.menu_id) throw new Error("params.menu_id was not defined");
- g.active.validate = function() {
- return !!h && h.active()
- }, g.$controlSection = h.headContainer, g.$sectionContent = g.container.closest(".accordion-section-content"), this._setupModel(), a.section(g.section(), function(a) {
- a.deferred.initSortables.done(function(a) {
- g._setupSortable(a)
+ var t, e, n, i = this,
+ a = v.section(i.section()),
+ o = i.params.menu_id,
+ s = i.setting();
+ if (void 0 === this.params.menu_id) throw new Error("params.menu_id was not defined");
+ i.active.validate = function() {
+ return !!a && a.active()
+ }, i.$controlSection = a.headContainer, i.$sectionContent = i.container.closest(".accordion-section-content"), this._setupModel(), v.section(i.section(), function(e) {
+ e.deferred.initSortables.done(function(e) {
+ i._setupSortable(e)
})
- }), this._setupAddition(), this._setupTitle(), j && (b = e(j.name), a.control.each(function(c) {
- c.extended(a.controlConstructor.widget_form) && "nav_menu" === c.params.widget_id_base && (c.container.find(".nav-menu-widget-form-controls:first").show(), c.container.find(".nav-menu-widget-no-menus-message:first").hide(), f = c.container.find("select"), 0 === f.find("option[value=" + String(i) + "]").length && f.append(new Option(b, i)))
- }), d = c("#available-widgets-list .widget-tpl:has( input.id_base[ value=nav_menu ] )"), d.find(".nav-menu-widget-form-controls:first").show(), d.find(".nav-menu-widget-no-menus-message:first").hide(), f = d.find(".widget-inside select:first"), 0 === f.find("option[value=" + String(i) + "]").length && f.append(new Option(b, i))), _.defer(function() {
- g.updateInvitationVisibility()
+ }), this._setupAddition(), this._setupTitle(), s && (t = d(s.name), v.control.each(function(e) {
+ e.extended(v.controlConstructor.widget_form) && "nav_menu" === e.params.widget_id_base && (e.container.find(".nav-menu-widget-form-controls:first").show(), e.container.find(".nav-menu-widget-no-menus-message:first").hide(), 0 === (n = e.container.find("select")).find("option[value=" + String(o) + "]").length && n.append(new Option(t, o)))
+ }), (e = g("#available-widgets-list .widget-tpl:has( input.id_base[ value=nav_menu ] )")).find(".nav-menu-widget-form-controls:first").show(), e.find(".nav-menu-widget-no-menus-message:first").hide(), 0 === (n = e.find(".widget-inside select:first")).find("option[value=" + String(o) + "]").length && n.append(new Option(t, o))), _.defer(function() {
+ i.updateInvitationVisibility()
})
},
_setupModel: function() {
- var b = this,
- c = b.params.menu_id;
- b.setting.bind(function(d) {
- var f;
- !1 === d ? b._handleDeletion() : (f = e(d.name), a.control.each(function(b) {
- if (b.extended(a.controlConstructor.widget_form) && "nav_menu" === b.params.widget_id_base) {
- b.container.find("select").find("option[value=" + String(c) + "]").text(f)
- }
+ var n = this,
+ i = n.params.menu_id;
+ n.setting.bind(function(e) {
+ var t;
+ !1 === e ? n._handleDeletion() : (t = d(e.name), v.control.each(function(e) {
+ e.extended(v.controlConstructor.widget_form) && "nav_menu" === e.params.widget_id_base && e.container.find("select").find("option[value=" + String(i) + "]").text(t)
}))
})
},
- _setupSortable: function(b) {
- var c = this;
- if (!b.is(c.$sectionContent)) throw new Error("Unexpected menuList.");
- b.on("sortstart", function() {
- c.isSorting = !0
- }), b.on("sortstop", function() {
+ _setupSortable: function(e) {
+ var t = this;
+ if (!e.is(t.$sectionContent)) throw new Error("Unexpected menuList.");
+ e.on("sortstart", function() {
+ t.isSorting = !0
+ }), e.on("sortstop", function() {
setTimeout(function() {
- var b = c.$sectionContent.sortable("toArray"),
- d = [],
- e = 0,
- f = 10;
- c.isSorting = !1, c.$sectionContent.scrollLeft(0), _.each(b, function(b) {
- var c, e, f;
- (f = b.match(/^customize-control-nav_menu_item-(-?\d+)$/, "")) && (c = parseInt(f[1], 10), (e = a.control("nav_menu_item[" + String(c) + "]")) && d.push(e))
- }), _.each(d, function(a) {
- if (!1 !== a.setting()) {
- var b = _.clone(a.setting());
- e += 1, f += 1, b.position = e, a.priority(f), b.menu_item_parent = parseInt(a.container.find(".menu-item-data-parent-id").val(), 10), b.menu_item_parent || (b.menu_item_parent = 0), a.setting.set(b)
+ var e = t.$sectionContent.sortable("toArray"),
+ a = [],
+ n = 0,
+ i = 10;
+ t.isSorting = !1, t.$sectionContent.scrollLeft(0), _.each(e, function(e) {
+ var t, n, i;
+ (i = e.match(/^customize-control-nav_menu_item-(-?\d+)$/, "")) && (t = parseInt(i[1], 10), (n = v.control("nav_menu_item[" + String(t) + "]")) && a.push(n))
+ }), _.each(a, function(e) {
+ if (!1 !== e.setting()) {
+ var t = _.clone(e.setting());
+ n += 1, i += 1, t.position = n, e.priority(i), t.menu_item_parent = parseInt(e.container.find(".menu-item-data-parent-id").val(), 10), t.menu_item_parent || (t.menu_item_parent = 0), e.setting.set(t)
}
})
})
- }), c.isReordering = !1, this.container.find(".reorder-toggle").on("click", function() {
- c.toggleReordering(!c.isReordering)
+ }), t.isReordering = !1, this.container.find(".reorder-toggle").on("click", function() {
+ t.toggleReordering(!t.isReordering)
})
},
_setupAddition: function() {
- var b = this;
- this.container.find(".add-new-menu-item").on("click", function(d) {
- b.$sectionContent.hasClass("reordering") || (c("body").hasClass("adding-menu-items") ? (c(this).attr("aria-expanded", "false"), a.Menus.availableMenuItemsPanel.close(), d.stopPropagation()) : (c(this).attr("aria-expanded", "true"), a.Menus.availableMenuItemsPanel.open(b)))
+ var t = this;
+ this.container.find(".add-new-menu-item").on("click", function(e) {
+ t.$sectionContent.hasClass("reordering") || (g("body").hasClass("adding-menu-items") ? (g(this).attr("aria-expanded", "false"), v.Menus.availableMenuItemsPanel.close(), e.stopPropagation()) : (g(this).attr("aria-expanded", "true"), v.Menus.availableMenuItemsPanel.open(t)))
})
},
_handleDeletion: function() {
- var d, e, f, g = this,
- h = g.params.menu_id,
- i = 0;
- d = a.section(g.section()), e = function() {
- d.container.remove(), a.section.remove(d.id)
- }, d && d.expanded() ? d.collapse({
+ var e, t, n, i = this.params.menu_id,
+ a = 0;
+ e = v.section(this.section()), t = function() {
+ e.container.remove(), v.section.remove(e.id)
+ }, e && e.expanded() ? e.collapse({
completeCallback: function() {
- e(), b.a11y.speak(a.Menus.data.l10n.menuDeleted), a.panel("nav_menus").focus()
+ t(), h.a11y.speak(v.Menus.data.l10n.menuDeleted), v.panel("nav_menus").focus()
}
- }) : e(), a.each(function(a) {
- /^nav_menu\[/.test(a.id) && !1 !== a() && (i += 1)
- }), a.control.each(function(b) {
- if (b.extended(a.controlConstructor.widget_form) && "nav_menu" === b.params.widget_id_base) {
- var c = b.container.find("select");
- c.val() === String(h) && c.prop("selectedIndex", 0).trigger("change"), b.container.find(".nav-menu-widget-form-controls:first").toggle(0 !== i), b.container.find(".nav-menu-widget-no-menus-message:first").toggle(0 === i), b.container.find("option[value=" + String(h) + "]").remove()
+ }) : t(), v.each(function(e) {
+ /^nav_menu\[/.test(e.id) && !1 !== e() && (a += 1)
+ }), v.control.each(function(e) {
+ if (e.extended(v.controlConstructor.widget_form) && "nav_menu" === e.params.widget_id_base) {
+ var t = e.container.find("select");
+ t.val() === String(i) && t.prop("selectedIndex", 0).trigger("change"), e.container.find(".nav-menu-widget-form-controls:first").toggle(0 !== a), e.container.find(".nav-menu-widget-no-menus-message:first").toggle(0 === a), e.container.find("option[value=" + String(i) + "]").remove()
}
- }), f = c("#available-widgets-list .widget-tpl:has( input.id_base[ value=nav_menu ] )"), f.find(".nav-menu-widget-form-controls:first").toggle(0 !== i), f.find(".nav-menu-widget-no-menus-message:first").toggle(0 === i), f.find("option[value=" + String(h) + "]").remove()
+ }), (n = g("#available-widgets-list .widget-tpl:has( input.id_base[ value=nav_menu ] )")).find(".nav-menu-widget-form-controls:first").toggle(0 !== a), n.find(".nav-menu-widget-no-menus-message:first").toggle(0 === a), n.find("option[value=" + String(i) + "]").remove()
},
_setupTitle: function() {
- var b = this;
- b.setting.bind(function(d) {
- if (d) {
- var f = a.section(b.section()),
- g = b.params.menu_id,
- h = f.headContainer.find(".accordion-section-title"),
- i = f.contentContainer.find(".customize-section-title h3"),
- j = f.headContainer.find(".menu-in-location"),
- k = i.find(".customize-action"),
- l = e(d.name);
- h.text(l), j.length && j.appendTo(h), i.text(l), k.length && k.prependTo(i), a.control.each(function(a) {
- /^nav_menu_locations\[/.test(a.id) && a.container.find("option[value=" + g + "]").text(l)
- }), f.contentContainer.find(".customize-control-checkbox input").each(function() {
- c(this).prop("checked") && c(".current-menu-location-name-" + c(this).data("location-id")).text(l)
+ var u = this;
+ u.setting.bind(function(e) {
+ if (e) {
+ var t = v.section(u.section()),
+ n = u.params.menu_id,
+ i = t.headContainer.find(".accordion-section-title"),
+ a = t.contentContainer.find(".customize-section-title h3"),
+ o = t.headContainer.find(".menu-in-location"),
+ s = a.find(".customize-action"),
+ r = d(e.name);
+ i.text(r), o.length && o.appendTo(i), a.text(r), s.length && s.prependTo(a), v.control.each(function(e) {
+ /^nav_menu_locations\[/.test(e.id) && e.container.find("option[value=" + n + "]").text(r)
+ }), t.contentContainer.find(".customize-control-checkbox input").each(function() {
+ g(this).prop("checked") && g(".current-menu-location-name-" + g(this).data("location-id")).text(r)
})
}
})
},
- toggleReordering: function(c) {
- var d = this.container.find(".add-new-menu-item"),
- e = this.container.find(".reorder-toggle"),
- f = this.$sectionContent.find(".item-title");
- (c = Boolean(c)) !== this.$sectionContent.hasClass("reordering") && (this.isReordering = c, this.$sectionContent.toggleClass("reordering", c), this.$sectionContent.sortable(this.isReordering ? "disable" : "enable"), this.isReordering ? (d.attr({
+ toggleReordering: function(e) {
+ var t = this.container.find(".add-new-menu-item"),
+ n = this.container.find(".reorder-toggle"),
+ i = this.$sectionContent.find(".item-title");
+ (e = Boolean(e)) !== this.$sectionContent.hasClass("reordering") && (this.isReordering = e, this.$sectionContent.toggleClass("reordering", e), this.$sectionContent.sortable(this.isReordering ? "disable" : "enable"), this.isReordering ? (t.attr({
tabindex: "-1",
"aria-hidden": "true"
- }), e.attr("aria-label", a.Menus.data.l10n.reorderLabelOff), b.a11y.speak(a.Menus.data.l10n.reorderModeOn), f.attr("aria-hidden", "false")) : (d.removeAttr("tabindex aria-hidden"), e.attr("aria-label", a.Menus.data.l10n.reorderLabelOn), b.a11y.speak(a.Menus.data.l10n.reorderModeOff), f.attr("aria-hidden", "true")), c && _(this.getMenuItemControls()).each(function(a) {
- a.collapseForm()
+ }), n.attr("aria-label", v.Menus.data.l10n.reorderLabelOff), h.a11y.speak(v.Menus.data.l10n.reorderModeOn), i.attr("aria-hidden", "false")) : (t.removeAttr("tabindex aria-hidden"), n.attr("aria-label", v.Menus.data.l10n.reorderLabelOn), h.a11y.speak(v.Menus.data.l10n.reorderModeOff), i.attr("aria-hidden", "true")), e && _(this.getMenuItemControls()).each(function(e) {
+ e.collapseForm()
}))
},
getMenuItemControls: function() {
- var b = this,
- c = [],
- d = b.params.menu_id;
- return a.control.each(function(a) {
- "nav_menu_item" === a.params.type && a.setting() && d === a.setting().nav_menu_term_id && c.push(a)
- }), c
+ var t = [],
+ n = this.params.menu_id;
+ return v.control.each(function(e) {
+ "nav_menu_item" === e.params.type && e.setting() && n === e.setting().nav_menu_term_id && t.push(e)
+ }), t
},
reflowMenuItems: function() {
- var a, b = this,
- c = b.getMenuItemControls();
- a = function(b) {
- var c = [],
- d = b.currentParent;
- _.each(b.menuItemControls, function(a) {
- d === a.setting().menu_item_parent && c.push(a)
- }), c.sort(function(a, b) {
- return a.setting().position - b.setting().position
- }), _.each(c, function(c) {
- b.currentAbsolutePosition += 1, c.priority.set(b.currentAbsolutePosition), c.container.hasClass("menu-item-depth-" + String(b.currentDepth)) || (_.each(c.container.prop("className").match(/menu-item-depth-\d+/g), function(a) {
- c.container.removeClass(a)
- }), c.container.addClass("menu-item-depth-" + String(b.currentDepth))), c.container.data("item-depth", b.currentDepth), b.currentDepth += 1, b.currentParent = c.params.menu_item_id, a(b), b.currentDepth -= 1, b.currentParent = d
- }), c.length && (_(c).each(function(a) {
- a.container.removeClass("move-up-disabled move-down-disabled move-left-disabled move-right-disabled"), 0 === b.currentDepth ? a.container.addClass("move-left-disabled") : 10 === b.currentDepth && a.container.addClass("move-right-disabled")
- }), c[0].container.addClass("move-up-disabled").addClass("move-right-disabled").toggleClass("move-down-disabled", 1 === c.length), c[c.length - 1].container.addClass("move-down-disabled").toggleClass("move-up-disabled", 1 === c.length))
- }, a({
- menuItemControls: c,
+ var e, t = this.getMenuItemControls();
+ (e = function(n) {
+ var t = [],
+ i = n.currentParent;
+ _.each(n.menuItemControls, function(e) {
+ i === e.setting().menu_item_parent && t.push(e)
+ }), t.sort(function(e, t) {
+ return e.setting().position - t.setting().position
+ }), _.each(t, function(t) {
+ n.currentAbsolutePosition += 1, t.priority.set(n.currentAbsolutePosition), t.container.hasClass("menu-item-depth-" + String(n.currentDepth)) || (_.each(t.container.prop("className").match(/menu-item-depth-\d+/g), function(e) {
+ t.container.removeClass(e)
+ }), t.container.addClass("menu-item-depth-" + String(n.currentDepth))), t.container.data("item-depth", n.currentDepth), n.currentDepth += 1, n.currentParent = t.params.menu_item_id, e(n), n.currentDepth -= 1, n.currentParent = i
+ }), t.length && (_(t).each(function(e) {
+ e.container.removeClass("move-up-disabled move-down-disabled move-left-disabled move-right-disabled"), 0 === n.currentDepth ? e.container.addClass("move-left-disabled") : 10 === n.currentDepth && e.container.addClass("move-right-disabled")
+ }), t[0].container.addClass("move-up-disabled").addClass("move-right-disabled").toggleClass("move-down-disabled", 1 === t.length), t[t.length - 1].container.addClass("move-down-disabled").toggleClass("move-up-disabled", 1 === t.length))
+ })({
+ menuItemControls: t,
currentParent: 0,
currentDepth: 0,
currentAbsolutePosition: 0
- }), b.updateInvitationVisibility(c), b.container.find(".reorder-toggle").toggle(c.length > 1)
+ }), this.updateInvitationVisibility(t), this.container.find(".reorder-toggle").toggle(1 < t.length)
},
debouncedReflowMenuItems: _.debounce(function() {
this.reflowMenuItems.apply(this, arguments)
}, 0),
- addItemToMenu: function(d) {
- var e, f, g, h, i, j = this,
- k = 0,
- l = 10;
- return _.each(j.getMenuItemControls(), function(a) {
- !1 !== a.setting() && (l = Math.max(l, a.priority()), 0 === a.setting().menu_item_parent && (k = Math.max(k, a.setting().position)))
- }), k += 1, l += 1, d = c.extend({}, a.Menus.data.defaultSettingValues.nav_menu_item, d, {
- nav_menu_term_id: j.params.menu_id,
- original_title: d.title,
- position: k
- }), delete d.id, i = a.Menus.generatePlaceholderAutoIncrementId(), e = "nav_menu_item[" + String(i) + "]", f = {
+ addItemToMenu: function(e) {
+ var t, n, i, a, o, s = 0,
+ r = 10;
+ return _.each(this.getMenuItemControls(), function(e) {
+ !1 !== e.setting() && (r = Math.max(r, e.priority()), 0 === e.setting().menu_item_parent && (s = Math.max(s, e.setting().position)))
+ }), s += 1, r += 1, delete(e = g.extend({}, v.Menus.data.defaultSettingValues.nav_menu_item, e, {
+ nav_menu_term_id: this.params.menu_id,
+ original_title: e.title,
+ position: s
+ })).id, o = v.Menus.generatePlaceholderAutoIncrementId(), t = "nav_menu_item[" + String(o) + "]", n = {
type: "nav_menu_item",
- transport: a.Menus.data.settingTransport,
- previewer: a.previewer
- }, g = a.create(e, e, {}, f), g.set(d), h = new a.controlConstructor.nav_menu_item(e, {
+ transport: v.Menus.data.settingTransport,
+ previewer: v.previewer
+ }, (i = v.create(t, t, {}, n)).set(e), a = new v.controlConstructor.nav_menu_item(t, {
type: "nav_menu_item",
- section: j.id,
- priority: l,
+ section: this.id,
+ priority: r,
settings: {
- "default": e
+ default: t
},
- menu_item_id: i
- }), a.control.add(h), g.preview(), j.debouncedReflowMenuItems(), b.a11y.speak(a.Menus.data.l10n.itemAdded), h
+ menu_item_id: o
+ }), v.control.add(a), i.preview(), this.debouncedReflowMenuItems(), h.a11y.speak(v.Menus.data.l10n.itemAdded), a
},
- updateInvitationVisibility: function(a) {
- var b = a || this.getMenuItemControls();
- this.container.find(".new-menu-item-invitation").toggle(0 === b.length)
+ updateInvitationVisibility: function(e) {
+ var t = e || this.getMenuItemControls();
+ this.container.find(".new-menu-item-invitation").toggle(0 === t.length)
}
- }), a.Menus.NewMenuControl = a.Control.extend({
+ }), v.Menus.NewMenuControl = v.Control.extend({
initialize: function() {
- "undefined" != typeof console && console.warn && console.warn("[DEPRECATED] wp.customize.NewMenuControl will be removed. Please use wp.customize.Menus.createNavMenu() instead."), a.Control.prototype.initialize.apply(this, arguments)
+ "undefined" != typeof console && console.warn && console.warn("[DEPRECATED] wp.customize.NewMenuControl will be removed. Please use wp.customize.Menus.createNavMenu() instead."), v.Control.prototype.initialize.apply(this, arguments)
},
ready: function() {
this._bindHandlers()
},
_bindHandlers: function() {
- var a = this,
- b = c("#customize-control-new_menu_name input"),
- d = c("#create-new-menu-submit");
- b.on("keydown", function(b) {
- 13 === b.which && a.submit()
- }), d.on("click", function(b) {
- a.submit(), b.stopPropagation(), b.preventDefault()
+ var t = this,
+ e = g("#customize-control-new_menu_name input"),
+ n = g("#create-new-menu-submit");
+ e.on("keydown", function(e) {
+ 13 === e.which && t.submit()
+ }), n.on("click", function(e) {
+ t.submit(), e.stopPropagation(), e.preventDefault()
})
},
submit: function() {
- var c, d = this,
- e = d.container.closest(".accordion-section-new-menu"),
- f = e.find(".menu-name-field").first(),
- g = f.val();
- if (!g) return f.addClass("invalid"), void f.focus();
- c = a.Menus.createNavMenu(g), f.val(""), f.removeClass("invalid"), b.a11y.speak(a.Menus.data.l10n.menuAdded), c.focus()
+ var e, t = this.container.closest(".accordion-section-new-menu").find(".menu-name-field").first(),
+ n = t.val();
+ if (!n) return t.addClass("invalid"), void t.focus();
+ e = v.Menus.createNavMenu(n), t.val(""), t.removeClass("invalid"), h.a11y.speak(v.Menus.data.l10n.menuAdded), e.focus()
}
- }), c.extend(a.controlConstructor, {
- nav_menu_location: a.Menus.MenuLocationControl,
- nav_menu_item: a.Menus.MenuItemControl,
- nav_menu: a.Menus.MenuControl,
- nav_menu_name: a.Menus.MenuNameControl,
- new_menu: a.Menus.NewMenuControl,
- nav_menu_locations: a.Menus.MenuLocationsControl,
- nav_menu_auto_add: a.Menus.MenuAutoAddControl
- }), c.extend(a.panelConstructor, {
- nav_menus: a.Menus.MenusPanel
- }), c.extend(a.sectionConstructor, {
- nav_menu: a.Menus.MenuSection,
- new_menu: a.Menus.NewMenuSection
- }), a.bind("ready", function() {
- a.Menus.availableMenuItemsPanel = new a.Menus.AvailableMenuItemsPanelView({
- collection: a.Menus.availableMenuItems
- }), a.bind("saved", function(b) {
- (b.nav_menu_updates || b.nav_menu_item_updates) && a.Menus.applySavedData(b)
- }), a.state("changesetStatus").bind(function(b) {
- "publish" === b && (a("nav_menus_created_posts")._value = [])
- }), a.previewer.bind("focus-nav-menu-item-control", a.Menus.focusMenuItemControl)
- }), a.Menus.applySavedData = function(d) {
- var e = {},
- f = {};
- _(d.nav_menu_updates).each(function(d) {
- var f, g, h, i, j, k, l, m, n, o, p, q, r;
- if ("inserted" === d.status) {
- if (!d.previous_term_id) throw new Error("Expected previous_term_id");
- if (!d.term_id) throw new Error("Expected term_id");
- if (f = "nav_menu[" + String(d.previous_term_id) + "]", !a.has(f)) throw new Error("Expected setting to exist: " + f);
- if (i = a(f), !a.section.has(f)) throw new Error("Expected control to exist: " + f);
- if (m = a.section(f), !(l = i.get())) throw new Error("Did not expect setting to be empty (deleted).");
- l = c.extend(_.clone(l), d.saved_value), e[d.previous_term_id] = d.term_id, g = "nav_menu[" + String(d.term_id) + "]", j = a.create(g, g, l, {
+ }), g.extend(v.controlConstructor, {
+ nav_menu_location: v.Menus.MenuLocationControl,
+ nav_menu_item: v.Menus.MenuItemControl,
+ nav_menu: v.Menus.MenuControl,
+ nav_menu_name: v.Menus.MenuNameControl,
+ new_menu: v.Menus.NewMenuControl,
+ nav_menu_locations: v.Menus.MenuLocationsControl,
+ nav_menu_auto_add: v.Menus.MenuAutoAddControl
+ }), g.extend(v.panelConstructor, {
+ nav_menus: v.Menus.MenusPanel
+ }), g.extend(v.sectionConstructor, {
+ nav_menu: v.Menus.MenuSection,
+ new_menu: v.Menus.NewMenuSection
+ }), v.bind("ready", function() {
+ v.Menus.availableMenuItemsPanel = new v.Menus.AvailableMenuItemsPanelView({
+ collection: v.Menus.availableMenuItems
+ }), v.bind("saved", function(e) {
+ (e.nav_menu_updates || e.nav_menu_item_updates) && v.Menus.applySavedData(e)
+ }), v.state("changesetStatus").bind(function(e) {
+ "publish" === e && (v("nav_menus_created_posts")._value = [])
+ }), v.previewer.bind("focus-nav-menu-item-control", v.Menus.focusMenuItemControl)
+ }), v.Menus.applySavedData = function(e) {
+ var f = {},
+ u = {};
+ _(e.nav_menu_updates).each(function(i) {
+ var e, t, n, a, o, s, r, u, d, c, l, m, p;
+ if ("inserted" === i.status) {
+ if (!i.previous_term_id) throw new Error("Expected previous_term_id");
+ if (!i.term_id) throw new Error("Expected term_id");
+ if (e = "nav_menu[" + String(i.previous_term_id) + "]", !v.has(e)) throw new Error("Expected setting to exist: " + e);
+ if (a = v(e), !v.section.has(e)) throw new Error("Expected control to exist: " + e);
+ if (u = v.section(e), !(r = a.get())) throw new Error("Did not expect setting to be empty (deleted).");
+ r = g.extend(_.clone(r), i.saved_value), f[i.previous_term_id] = i.term_id, t = "nav_menu[" + String(i.term_id) + "]", o = v.create(t, t, r, {
type: "nav_menu",
- transport: a.Menus.data.settingTransport,
- previewer: a.previewer
- }), r = m.expanded(), r && m.collapse(), n = new a.Menus.MenuSection(g, {
+ transport: v.Menus.data.settingTransport,
+ previewer: v.previewer
+ }), (p = u.expanded()) && u.collapse(), d = new v.Menus.MenuSection(t, {
panel: "nav_menus",
- title: l.name,
- customizeAction: a.Menus.data.l10n.customizingMenus,
+ title: r.name,
+ customizeAction: v.Menus.data.l10n.customizingMenus,
type: "nav_menu",
- priority: m.priority.get(),
- menu_id: d.term_id
- }), a.section.add(n), a.control.each(function(b) {
- if (b.extended(a.controlConstructor.widget_form) && "nav_menu" === b.params.widget_id_base) {
- var c, e, f;
- c = b.container.find("select"), e = c.find("option[value=" + String(d.previous_term_id) + "]"), f = c.find("option[value=" + String(d.term_id) + "]"), f.prop("selected", e.prop("selected")), e.remove()
- }
- }), i.callbacks.disable(), i.set(!1), i.preview(), j.preview(), i._dirty = !1, m.container.remove(), a.section.remove(f), q = 0, a.each(function(a) {
- /^nav_menu\[/.test(a.id) && !1 !== a() && (q += 1)
- }), p = c("#available-widgets-list .widget-tpl:has( input.id_base[ value=nav_menu ] )"), p.find(".nav-menu-widget-form-controls:first").toggle(0 !== q), p.find(".nav-menu-widget-no-menus-message:first").toggle(0 === q), p.find("option[value=" + String(d.previous_term_id) + "]").remove(), b.customize.control.each(function(a) {
- /^nav_menu_locations\[/.test(a.id) && a.container.find("option[value=" + String(d.previous_term_id) + "]").remove()
- }), a.each(function(b) {
- var c = a.state("saved").get();
- /^nav_menu_locations\[/.test(b.id) && b.get() === d.previous_term_id && (b.set(d.term_id), b._dirty = !1, a.state("saved").set(c), b.preview())
- }), r && n.expand()
- } else if ("updated" === d.status) {
- if (h = "nav_menu[" + String(d.term_id) + "]", !a.has(h)) throw new Error("Expected setting to exist: " + h);
- k = a(h), _.isEqual(d.saved_value, k.get()) || (o = a.state("saved").get(), k.set(d.saved_value), k._dirty = !1, a.state("saved").set(o))
+ priority: u.priority.get(),
+ menu_id: i.term_id
+ }), v.section.add(d), v.control.each(function(e) {
+ var t, n;
+ e.extended(v.controlConstructor.widget_form) && "nav_menu" === e.params.widget_id_base && (n = (t = e.container.find("select")).find("option[value=" + String(i.previous_term_id) + "]"), t.find("option[value=" + String(i.term_id) + "]").prop("selected", n.prop("selected")), n.remove())
+ }), a.callbacks.disable(), a.set(!1), a.preview(), o.preview(), a._dirty = !1, u.container.remove(), v.section.remove(e), m = 0, v.each(function(e) {
+ /^nav_menu\[/.test(e.id) && !1 !== e() && (m += 1)
+ }), (l = g("#available-widgets-list .widget-tpl:has( input.id_base[ value=nav_menu ] )")).find(".nav-menu-widget-form-controls:first").toggle(0 !== m), l.find(".nav-menu-widget-no-menus-message:first").toggle(0 === m), l.find("option[value=" + String(i.previous_term_id) + "]").remove(), h.customize.control.each(function(e) {
+ /^nav_menu_locations\[/.test(e.id) && e.container.find("option[value=" + String(i.previous_term_id) + "]").remove()
+ }), v.each(function(e) {
+ var t = v.state("saved").get();
+ /^nav_menu_locations\[/.test(e.id) && e.get() === i.previous_term_id && (e.set(i.term_id), e._dirty = !1, v.state("saved").set(t), e.preview())
+ }), p && d.expand()
+ } else if ("updated" === i.status) {
+ if (n = "nav_menu[" + String(i.term_id) + "]", !v.has(n)) throw new Error("Expected setting to exist: " + n);
+ s = v(n), _.isEqual(i.saved_value, s.get()) || (c = v.state("saved").get(), s.set(i.saved_value), s._dirty = !1, v.state("saved").set(c))
}
- }), _(d.nav_menu_item_updates).each(function(a) {
- a.previous_post_id && (f[a.previous_post_id] = a.post_id)
- }), _(d.nav_menu_item_updates).each(function(b) {
- var c, d, g, h, i, j, k;
- if ("inserted" === b.status) {
- if (!b.previous_post_id) throw new Error("Expected previous_post_id");
- if (!b.post_id) throw new Error("Expected post_id");
- if (c = "nav_menu_item[" + String(b.previous_post_id) + "]", !a.has(c)) throw new Error("Expected setting to exist: " + c);
- if (g = a(c), !a.control.has(c)) throw new Error("Expected control to exist: " + c);
- if (j = a.control(c), !(i = g.get())) throw new Error("Did not expect setting to be empty (deleted).");
- if (i = _.clone(i), i.menu_item_parent < 0) {
- if (!f[i.menu_item_parent]) throw new Error("inserted ID for menu_item_parent not available");
- i.menu_item_parent = f[i.menu_item_parent]
+ }), _(e.nav_menu_item_updates).each(function(e) {
+ e.previous_post_id && (u[e.previous_post_id] = e.post_id)
+ }), _(e.nav_menu_item_updates).each(function(e) {
+ var t, n, i, a, o, s, r;
+ if ("inserted" === e.status) {
+ if (!e.previous_post_id) throw new Error("Expected previous_post_id");
+ if (!e.post_id) throw new Error("Expected post_id");
+ if (t = "nav_menu_item[" + String(e.previous_post_id) + "]", !v.has(t)) throw new Error("Expected setting to exist: " + t);
+ if (i = v(t), !v.control.has(t)) throw new Error("Expected control to exist: " + t);
+ if (s = v.control(t), !(o = i.get())) throw new Error("Did not expect setting to be empty (deleted).");
+ if ((o = _.clone(o)).menu_item_parent < 0) {
+ if (!u[o.menu_item_parent]) throw new Error("inserted ID for menu_item_parent not available");
+ o.menu_item_parent = u[o.menu_item_parent]
}
- e[i.nav_menu_term_id] && (i.nav_menu_term_id = e[i.nav_menu_term_id]), d = "nav_menu_item[" + String(b.post_id) + "]", h = a.create(d, d, i, {
+ f[o.nav_menu_term_id] && (o.nav_menu_term_id = f[o.nav_menu_term_id]), n = "nav_menu_item[" + String(e.post_id) + "]", a = v.create(n, n, o, {
type: "nav_menu_item",
- transport: a.Menus.data.settingTransport,
- previewer: a.previewer
- }), k = new a.controlConstructor.nav_menu_item(d, {
+ transport: v.Menus.data.settingTransport,
+ previewer: v.previewer
+ }), r = new v.controlConstructor.nav_menu_item(n, {
type: "nav_menu_item",
- menu_id: b.post_id,
- section: "nav_menu[" + String(i.nav_menu_term_id) + "]",
- priority: j.priority.get(),
+ menu_id: e.post_id,
+ section: "nav_menu[" + String(o.nav_menu_term_id) + "]",
+ priority: s.priority.get(),
settings: {
- "default": d
+ default: n
},
- menu_item_id: b.post_id
- }), j.container.remove(), a.control.remove(c), a.control.add(k), g.callbacks.disable(), g.set(!1), g.preview(), h.preview(), g._dirty = !1, k.container.toggleClass("menu-item-edit-inactive", j.container.hasClass("menu-item-edit-inactive"))
+ menu_item_id: e.post_id
+ }), s.container.remove(), v.control.remove(t), v.control.add(r), i.callbacks.disable(), i.set(!1), i.preview(), a.preview(), i._dirty = !1, r.container.toggleClass("menu-item-edit-inactive", s.container.hasClass("menu-item-edit-inactive"))
}
- }), _.each(d.widget_nav_menu_updates, function(b, c) {
- var d = a(c);
- d && (d._value = b, d.preview())
+ }), _.each(e.widget_nav_menu_updates, function(e, t) {
+ var n = v(t);
+ n && (n._value = e, n.preview())
})
- }, a.Menus.focusMenuItemControl = function(b) {
- var c = a.Menus.getMenuItemControl(b);
- c && c.focus()
- }, a.Menus.getMenuControl = function(b) {
- return a.control("nav_menu[" + b + "]")
- }, a.Menus.getMenuItemControl = function(b) {
- return a.control(d(b))
+ }, v.Menus.focusMenuItemControl = function(e) {
+ var t = v.Menus.getMenuItemControl(e);
+ t && t.focus()
+ }, v.Menus.getMenuControl = function(e) {
+ return v.control("nav_menu[" + e + "]")
+ }, v.Menus.getMenuItemControl = function(e) {
+ return v.control("nav_menu_item[" + e + "]")
}
}(wp.customize, wp, jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/customize-widgets.min.js build-branch-unminified/wp-admin/js/customize-widgets.min.js
--- build-unminified/wp-admin/js/customize-widgets.min.js 2018-10-08 22:57:58.989506216 -0500
+++ build-branch-unminified/wp-admin/js/customize-widgets.min.js 2018-10-08 22:55:09.660163457 -0500
@@ -1,26 +1,7 @@
-! function(a, b) {
- function c(a, b) {
- function c(d) {
- d || (a.expanded.unbind(c), b.focus())
- }
- a.focus(), a.expanded.bind(c)
- }
-
- function d(a) {
- var b, c = {
- number: null,
- id_base: null
- };
- return b = a.match(/^(.+)-(\d+)$/), b ? (c.id_base = b[1], c.number = parseInt(b[2], 10)) : c.id_base = a, c
- }
-
- function e(a) {
- var b, c = d(a);
- return b = "widget_" + c.id_base, c.number && (b += "[" + c.number + "]"), b
- }
- if (a && a.customize) {
- var f, g = a.customize;
- g.Widgets = g.Widgets || {}, g.Widgets.savedWidgetIds = {}, g.Widgets.data = _wpCustomizeWidgetsSettings || {}, f = g.Widgets.data.l10n, g.Widgets.WidgetModel = Backbone.Model.extend({
+! function(p, m) {
+ if (p && p.customize) {
+ var f, v = p.customize;
+ v.Widgets = v.Widgets || {}, v.Widgets.savedWidgetIds = {}, v.Widgets.data = _wpCustomizeWidgetsSettings || {}, f = v.Widgets.data.l10n, v.Widgets.WidgetModel = Backbone.Model.extend({
id: null,
temp_id: null,
classname: null,
@@ -36,32 +17,32 @@
width: null,
height: null,
search_matched: !0
- }), g.Widgets.WidgetCollection = Backbone.Collection.extend({
- model: g.Widgets.WidgetModel,
- doSearch: function(a) {
- this.terms !== a && (this.terms = a, this.terms.length > 0 && this.search(this.terms), "" === this.terms && this.each(function(a) {
- a.set("search_matched", !0)
+ }), v.Widgets.WidgetCollection = Backbone.Collection.extend({
+ model: v.Widgets.WidgetModel,
+ doSearch: function(e) {
+ this.terms !== e && (this.terms = e, 0 < this.terms.length && this.search(this.terms), "" === this.terms && this.each(function(e) {
+ e.set("search_matched", !0)
}))
},
- search: function(a) {
- var b, c;
- a = a.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), a = a.replace(/ /g, ")(?=.*"), b = new RegExp("^(?=.*" + a + ").+", "i"), this.each(function(a) {
- c = [a.get("name"), a.get("id"), a.get("description")].join(" "), a.set("search_matched", b.test(c))
+ search: function(e) {
+ var t, i;
+ e = (e = e.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")).replace(/ /g, ")(?=.*"), t = new RegExp("^(?=.*" + e + ").+", "i"), this.each(function(e) {
+ i = [e.get("name"), e.get("id"), e.get("description")].join(" "), e.set("search_matched", t.test(i))
})
}
- }), g.Widgets.availableWidgets = new g.Widgets.WidgetCollection(g.Widgets.data.availableWidgets), g.Widgets.SidebarModel = Backbone.Model.extend({
+ }), v.Widgets.availableWidgets = new v.Widgets.WidgetCollection(v.Widgets.data.availableWidgets), v.Widgets.SidebarModel = Backbone.Model.extend({
after_title: null,
after_widget: null,
before_title: null,
before_widget: null,
- "class": null,
+ class: null,
description: null,
id: null,
name: null,
is_rendered: !1
- }), g.Widgets.SidebarCollection = Backbone.Collection.extend({
- model: g.Widgets.SidebarModel
- }), g.Widgets.registeredSidebars = new g.Widgets.SidebarCollection(g.Widgets.data.registeredSidebars), g.Widgets.AvailableWidgetsPanelView = a.Backbone.View.extend({
+ }), v.Widgets.SidebarCollection = Backbone.Collection.extend({
+ model: v.Widgets.SidebarModel
+ }), v.Widgets.registeredSidebars = new v.Widgets.SidebarCollection(v.Widgets.data.registeredSidebars), v.Widgets.AvailableWidgetsPanelView = p.Backbone.View.extend({
el: "#available-widgets",
events: {
"input #widgets-search": "search",
@@ -77,17 +58,17 @@
$clearResults: null,
searchMatchesCount: null,
initialize: function() {
- var a = this;
- this.$search = b("#widgets-search"), this.$clearResults = this.$el.find(".clear-results"), _.bindAll(this, "close"), this.listenTo(this.collection, "change", this.updateList), this.updateList(), this.searchMatchesCount = this.collection.length, b("#customize-controls, #available-widgets .customize-section-title").on("click keydown", function(c) {
- var d = b(c.target).is(".add-new-widget, .add-new-widget *");
- b("body").hasClass("adding-widget") && !d && a.close()
+ var i = this;
+ this.$search = m("#widgets-search"), this.$clearResults = this.$el.find(".clear-results"), _.bindAll(this, "close"), this.listenTo(this.collection, "change", this.updateList), this.updateList(), this.searchMatchesCount = this.collection.length, m("#customize-controls, #available-widgets .customize-section-title").on("click keydown", function(e) {
+ var t = m(e.target).is(".add-new-widget, .add-new-widget *");
+ m("body").hasClass("adding-widget") && !t && i.close()
}), this.$clearResults.on("click", function() {
- a.$search.val("").focus().trigger("keyup")
- }), g.previewer.bind("url", this.close)
+ i.$search.val("").focus().trigger("keyup")
+ }), v.previewer.bind("url", this.close)
},
- search: function(a) {
- var b;
- this.collection.doSearch(a.target.value), this.updateSearchMatchesCount(), this.announceSearchMatches(), this.selected && !this.selected.is(":visible") && (this.selected.removeClass("selected"), this.selected = null), this.selected && !a.target.value && (this.selected.removeClass("selected"), this.selected = null), !this.selected && a.target.value && (b = this.$el.find("> .widget-tpl:visible:first"), b.length && this.select(b)), "" !== a.target.value ? this.$clearResults.addClass("is-visible") : "" === a.target.value && this.$clearResults.removeClass("is-visible"), this.searchMatchesCount ? this.$el.removeClass("no-widgets-found") : this.$el.addClass("no-widgets-found")
+ search: function(e) {
+ var t;
+ this.collection.doSearch(e.target.value), this.updateSearchMatchesCount(), this.announceSearchMatches(), this.selected && !this.selected.is(":visible") && (this.selected.removeClass("selected"), this.selected = null), this.selected && !e.target.value && (this.selected.removeClass("selected"), this.selected = null), !this.selected && e.target.value && (t = this.$el.find("> .widget-tpl:visible:first")).length && this.select(t), "" !== e.target.value ? this.$clearResults.addClass("is-visible") : "" === e.target.value && this.$clearResults.removeClass("is-visible"), this.searchMatchesCount ? this.$el.removeClass("no-widgets-found") : this.$el.addClass("no-widgets-found")
},
updateSearchMatchesCount: function() {
this.searchMatchesCount = this.collection.where({
@@ -95,319 +76,321 @@
}).length
},
announceSearchMatches: _.debounce(function() {
- var b = f.widgetsFound.replace("%d", this.searchMatchesCount);
- this.searchMatchesCount || (b = f.noWidgetsFound), a.a11y.speak(b)
+ var e = f.widgetsFound.replace("%d", this.searchMatchesCount);
+ this.searchMatchesCount || (e = f.noWidgetsFound), p.a11y.speak(e)
}, 500),
updateList: function() {
- this.collection.each(function(a) {
- var c = b("#widget-tpl-" + a.id);
- c.toggle(a.get("search_matched") && !a.get("is_disabled")), a.get("is_disabled") && c.is(this.selected) && (this.selected = null)
- })
- },
- select: function(a) {
- this.selected = b(a), this.selected.siblings(".widget-tpl").removeClass("selected"), this.selected.addClass("selected")
- },
- focus: function(a) {
- this.select(b(a.currentTarget))
- },
- _submit: function(a) {
- "keypress" === a.type && 13 !== a.which && 32 !== a.which || this.submit(b(a.currentTarget))
- },
- submit: function(a) {
- var c, d, e;
- a || (a = this.selected), a && this.currentSidebarControl && (this.select(a), c = b(this.selected).data("widget-id"), (d = this.collection.findWhere({
- id: c
- })) && (e = this.currentSidebarControl.addWidget(d.get("id_base")), e && e.focus(), this.close()))
- },
- open: function(a) {
- this.currentSidebarControl = a, _(this.currentSidebarControl.getWidgetFormControls()).each(function(a) {
- a.params.is_wide && a.collapseForm()
- }), g.section.has("publish_settings") && g.section("publish_settings").collapse(), b("body").addClass("adding-widget"), this.$el.find(".selected").removeClass("selected"), this.collection.doSearch(""), g.settings.browser.mobile || this.$search.focus()
- },
- close: function(a) {
- a = a || {}, a.returnFocus && this.currentSidebarControl && this.currentSidebarControl.container.find(".add-new-widget").focus(), this.currentSidebarControl = null, this.selected = null, b("body").removeClass("adding-widget"), this.$search.val("")
- },
- keyboardAccessible: function(a) {
- var c = 13 === a.which,
- d = 27 === a.which,
- e = 40 === a.which,
- f = 38 === a.which,
- g = 9 === a.which,
- h = a.shiftKey,
- i = null,
- j = this.$el.find("> .widget-tpl:visible:first"),
- k = this.$el.find("> .widget-tpl:visible:last"),
- l = b(a.target).is(this.$search),
- m = b(a.target).is(".widget-tpl:visible:last");
- if (e || f) return e ? l ? i = j : this.selected && 0 !== this.selected.nextAll(".widget-tpl:visible").length && (i = this.selected.nextAll(".widget-tpl:visible:first")) : f && (l ? i = k : this.selected && 0 !== this.selected.prevAll(".widget-tpl:visible").length && (i = this.selected.prevAll(".widget-tpl:visible:first"))), this.select(i), void(i ? i.focus() : this.$search.focus());
- c && !this.$search.val() || (c ? this.submit() : d && this.close({
+ this.collection.each(function(e) {
+ var t = m("#widget-tpl-" + e.id);
+ t.toggle(e.get("search_matched") && !e.get("is_disabled")), e.get("is_disabled") && t.is(this.selected) && (this.selected = null)
+ })
+ },
+ select: function(e) {
+ this.selected = m(e), this.selected.siblings(".widget-tpl").removeClass("selected"), this.selected.addClass("selected")
+ },
+ focus: function(e) {
+ this.select(m(e.currentTarget))
+ },
+ _submit: function(e) {
+ "keypress" === e.type && 13 !== e.which && 32 !== e.which || this.submit(m(e.currentTarget))
+ },
+ submit: function(e) {
+ var t, i, n;
+ e || (e = this.selected), e && this.currentSidebarControl && (this.select(e), t = m(this.selected).data("widget-id"), (i = this.collection.findWhere({
+ id: t
+ })) && ((n = this.currentSidebarControl.addWidget(i.get("id_base"))) && n.focus(), this.close()))
+ },
+ open: function(e) {
+ this.currentSidebarControl = e, _(this.currentSidebarControl.getWidgetFormControls()).each(function(e) {
+ e.params.is_wide && e.collapseForm()
+ }), v.section.has("publish_settings") && v.section("publish_settings").collapse(), m("body").addClass("adding-widget"), this.$el.find(".selected").removeClass("selected"), this.collection.doSearch(""), v.settings.browser.mobile || this.$search.focus()
+ },
+ close: function(e) {
+ (e = e || {}).returnFocus && this.currentSidebarControl && this.currentSidebarControl.container.find(".add-new-widget").focus(), this.currentSidebarControl = null, this.selected = null, m("body").removeClass("adding-widget"), this.$search.val("")
+ },
+ keyboardAccessible: function(e) {
+ var t = 13 === e.which,
+ i = 27 === e.which,
+ n = 40 === e.which,
+ s = 38 === e.which,
+ d = 9 === e.which,
+ a = e.shiftKey,
+ o = null,
+ r = this.$el.find("> .widget-tpl:visible:first"),
+ l = this.$el.find("> .widget-tpl:visible:last"),
+ c = m(e.target).is(this.$search),
+ g = m(e.target).is(".widget-tpl:visible:last");
+ if (n || s) return n ? c ? o = r : this.selected && 0 !== this.selected.nextAll(".widget-tpl:visible").length && (o = this.selected.nextAll(".widget-tpl:visible:first")) : s && (c ? o = l : this.selected && 0 !== this.selected.prevAll(".widget-tpl:visible").length && (o = this.selected.prevAll(".widget-tpl:visible:first"))), this.select(o), void(o ? o.focus() : this.$search.focus());
+ t && !this.$search.val() || (t ? this.submit() : i && this.close({
returnFocus: !0
- }), this.currentSidebarControl && g && (h && l || !h && m) && (this.currentSidebarControl.container.find(".add-new-widget").focus(), a.preventDefault()))
+ }), this.currentSidebarControl && d && (a && c || !a && g) && (this.currentSidebarControl.container.find(".add-new-widget").focus(), e.preventDefault()))
}
- }), g.Widgets.formSyncHandlers = {
- rss: function(a, c, d) {
- var e = c.find(".widget-error:first"),
- f = b("<div>" + d + "</div>").find(".widget-error:first");
- e.length && f.length ? e.replaceWith(f) : e.length ? e.remove() : f.length && c.find(".widget-content:first").prepend(f)
+ }), v.Widgets.formSyncHandlers = {
+ rss: function(e, t, i) {
+ var n = t.find(".widget-error:first"),
+ s = m("<div>" + i + "</div>").find(".widget-error:first");
+ n.length && s.length ? n.replaceWith(s) : n.length ? n.remove() : s.length && t.find(".widget-content:first").prepend(s)
}
- }, g.Widgets.WidgetControl = g.Control.extend({
+ }, v.Widgets.WidgetControl = v.Control.extend({
defaultExpandedArguments: {
duration: "fast",
- completeCallback: b.noop
+ completeCallback: m.noop
},
- initialize: function(a, c) {
- var d = this;
- d.widgetControlEmbedded = !1, d.widgetContentEmbedded = !1, d.expanded = new g.Value(!1), d.expandedArgumentsQueue = [], d.expanded.bind(function(a) {
- var c = d.expandedArgumentsQueue.shift();
- c = b.extend({}, d.defaultExpandedArguments, c), d.onChangeExpanded(a, c)
- }), d.altNotice = !0, g.Control.prototype.initialize.call(d, a, c)
+ initialize: function(e, t) {
+ var i = this;
+ i.widgetControlEmbedded = !1, i.widgetContentEmbedded = !1, i.expanded = new v.Value(!1), i.expandedArgumentsQueue = [], i.expanded.bind(function(e) {
+ var t = i.expandedArgumentsQueue.shift();
+ t = m.extend({}, i.defaultExpandedArguments, t), i.onChangeExpanded(e, t)
+ }), i.altNotice = !0, v.Control.prototype.initialize.call(i, e, t)
},
ready: function() {
- var a = this;
- a.section() ? g.section(a.section(), function(b) {
- var c = function(d) {
- d && (a.embedWidgetControl(), b.expanded.unbind(c))
+ var n = this;
+ n.section() ? v.section(n.section(), function(t) {
+ var i = function(e) {
+ e && (n.embedWidgetControl(), t.expanded.unbind(i))
};
- b.expanded() ? c(!0) : b.expanded.bind(c)
- }) : a.embedWidgetControl()
+ t.expanded() ? i(!0) : t.expanded.bind(i)
+ }) : n.embedWidgetControl()
},
embedWidgetControl: function() {
- var a, c = this;
- c.widgetControlEmbedded || (c.widgetControlEmbedded = !0, a = b(c.params.widget_control), c.container.append(a), c._setupModel(), c._setupWideWidget(), c._setupControlToggle(), c._setupWidgetTitle(), c._setupReorderUI(), c._setupHighlightEffects(), c._setupUpdateUI(), c._setupRemoveUI())
+ var e, t = this;
+ t.widgetControlEmbedded || (t.widgetControlEmbedded = !0, e = m(t.params.widget_control), t.container.append(e), t._setupModel(), t._setupWideWidget(), t._setupControlToggle(), t._setupWidgetTitle(), t._setupReorderUI(), t._setupHighlightEffects(), t._setupUpdateUI(), t._setupRemoveUI())
},
embedWidgetContent: function() {
- var a, c = this;
- c.embedWidgetControl(), c.widgetContentEmbedded || (c.widgetContentEmbedded = !0, c.notifications.container = c.getNotificationsContainerElement(), c.notifications.render(), a = b(c.params.widget_content), c.container.find(".widget-content:first").append(a), b(document).trigger("widget-added", [c.container.find(".widget:first")]))
+ var e, t = this;
+ t.embedWidgetControl(), t.widgetContentEmbedded || (t.widgetContentEmbedded = !0, t.notifications.container = t.getNotificationsContainerElement(), t.notifications.render(), e = m(t.params.widget_content), t.container.find(".widget-content:first").append(e), m(document).trigger("widget-added", [t.container.find(".widget:first")]))
},
_setupModel: function() {
- var a, b = this;
- a = function() {
- g.Widgets.savedWidgetIds[b.params.widget_id] = !0
- }, g.bind("ready", a), g.bind("saved", a), this._updateCount = 0, this.isWidgetUpdating = !1, this.liveUpdateMode = !0, this.setting.bind(function(a, c) {
- _(c).isEqual(a) || b.isWidgetUpdating || b.updateWidget({
- instance: a
+ var e, i = this;
+ e = function() {
+ v.Widgets.savedWidgetIds[i.params.widget_id] = !0
+ }, v.bind("ready", e), v.bind("saved", e), this._updateCount = 0, this.isWidgetUpdating = !1, this.liveUpdateMode = !0, this.setting.bind(function(e, t) {
+ _(t).isEqual(e) || i.isWidgetUpdating || i.updateWidget({
+ instance: e
})
})
},
_setupWideWidget: function() {
- var a, c, d, e, f, h = this;
- !this.params.is_wide || b(window).width() <= 640 || (a = this.container.find(".widget-inside"), c = a.find("> .form"), d = b(".wp-full-overlay-sidebar-content:first"), this.container.addClass("wide-widget-control"), this.container.find(".form:first").css({
+ var s, d, e, t, i, a = this;
+ !this.params.is_wide || m(window).width() <= 640 || (s = this.container.find(".widget-inside"), d = s.find("> .form"), e = m(".wp-full-overlay-sidebar-content:first"), this.container.addClass("wide-widget-control"), this.container.find(".form:first").css({
"max-width": this.params.width,
"min-height": this.params.height
- }), f = function() {
- var d, e = h.container.offset().top,
- f = b(window).height(),
- g = c.outerHeight();
- a.css("max-height", f), d = Math.max(0, Math.min(Math.max(e, 0), f - g)), a.css("top", d)
- }, e = b("#customize-theme-controls"), this.container.on("expand", function() {
- f(), d.on("scroll", f), b(window).on("resize", f), e.on("expanded collapsed", f)
+ }), i = function() {
+ var e, t = a.container.offset().top,
+ i = m(window).height(),
+ n = d.outerHeight();
+ s.css("max-height", i), e = Math.max(0, Math.min(Math.max(t, 0), i - n)), s.css("top", e)
+ }, t = m("#customize-theme-controls"), this.container.on("expand", function() {
+ i(), e.on("scroll", i), m(window).on("resize", i), t.on("expanded collapsed", i)
}), this.container.on("collapsed", function() {
- d.off("scroll", f), b(window).off("resize", f), e.off("expanded collapsed", f)
- }), g.each(function(a) {
- 0 === a.id.indexOf("sidebars_widgets[") && a.bind(function() {
- h.container.hasClass("expanded") && f()
+ e.off("scroll", i), m(window).off("resize", i), t.off("expanded collapsed", i)
+ }), v.each(function(e) {
+ 0 === e.id.indexOf("sidebars_widgets[") && e.bind(function() {
+ a.container.hasClass("expanded") && i()
})
}))
},
_setupControlToggle: function() {
- var a, b = this;
- this.container.find(".widget-top").on("click", function(a) {
- a.preventDefault(), b.getSidebarWidgetsControl().isReordering || b.expanded(!b.expanded())
- }), a = this.container.find(".widget-control-close"), a.on("click", function(a) {
- a.preventDefault(), b.collapse(), b.container.find(".widget-top .widget-action:first").focus()
+ var t = this;
+ this.container.find(".widget-top").on("click", function(e) {
+ e.preventDefault(), t.getSidebarWidgetsControl().isReordering || t.expanded(!t.expanded())
+ }), this.container.find(".widget-control-close").on("click", function(e) {
+ e.preventDefault(), t.collapse(), t.container.find(".widget-top .widget-action:first").focus()
})
},
_setupWidgetTitle: function() {
- var a, b = this;
- a = function() {
- var a = b.setting().title,
- c = b.container.find(".in-widget-title");
- a ? c.text(": " + a) : c.text("")
- }, this.setting.bind(a), a()
+ var e, i = this;
+ e = function() {
+ var e = i.setting().title,
+ t = i.container.find(".in-widget-title");
+ e ? t.text(": " + e) : t.text("")
+ }, this.setting.bind(e), e()
},
_setupReorderUI: function() {
- var c, d, e, h, i, j = this;
- c = function(a) {
- a.siblings(".selected").removeClass("selected"), a.addClass("selected");
- var b = a.data("id") === j.params.sidebar_id;
- j.container.find(".move-widget-btn").prop("disabled", b)
- }, this.container.find(".widget-title-action").after(b(g.Widgets.data.tpl.widgetReorderNav)), i = _.template(g.Widgets.data.tpl.moveWidgetArea), d = b(i({
- sidebars: _(g.Widgets.registeredSidebars.toArray()).pluck("attributes")
- })), this.container.find(".widget-top").after(d), h = function() {
- var a, e = d.find("li"),
- f = 0;
- a = e.filter(function() {
- return b(this).data("id") === j.params.sidebar_id
+ var d, t, e, i, o = this;
+ d = function(e) {
+ e.siblings(".selected").removeClass("selected"), e.addClass("selected");
+ var t = e.data("id") === o.params.sidebar_id;
+ o.container.find(".move-widget-btn").prop("disabled", t)
+ }, this.container.find(".widget-title-action").after(m(v.Widgets.data.tpl.widgetReorderNav)), i = _.template(v.Widgets.data.tpl.moveWidgetArea), t = m(i({
+ sidebars: _(v.Widgets.registeredSidebars.toArray()).pluck("attributes")
+ })), this.container.find(".widget-top").after(t), (e = function() {
+ var n, e = t.find("li"),
+ s = 0;
+ n = e.filter(function() {
+ return m(this).data("id") === o.params.sidebar_id
}), e.each(function() {
- var d, e, h, i = b(this);
- d = i.data("id"), e = g.Widgets.registeredSidebars.get(d), h = e.get("is_rendered"), i.toggle(h), h && (f += 1), i.hasClass("selected") && !h && c(a)
- }), f > 1 ? j.container.find(".move-widget").show() : j.container.find(".move-widget").hide()
- }, h(), g.Widgets.registeredSidebars.on("change:is_rendered", h), e = this.container.find(".widget-reorder-nav"), e.find(".move-widget, .move-widget-down, .move-widget-up").each(function() {
- b(this).prepend(j.container.find(".widget-title").text() + ": ")
- }).on("click keypress", function(c) {
- if ("keypress" !== c.type || 13 === c.which || 32 === c.which)
- if (b(this).focus(), b(this).is(".move-widget")) j.toggleWidgetMoveArea();
+ var e, t, i = m(this);
+ e = i.data("id"), t = v.Widgets.registeredSidebars.get(e).get("is_rendered"), i.toggle(t), t && (s += 1), i.hasClass("selected") && !t && d(n)
+ }), 1 < s ? o.container.find(".move-widget").show() : o.container.find(".move-widget").hide()
+ })(), v.Widgets.registeredSidebars.on("change:is_rendered", e), this.container.find(".widget-reorder-nav").find(".move-widget, .move-widget-down, .move-widget-up").each(function() {
+ m(this).prepend(o.container.find(".widget-title").text() + ": ")
+ }).on("click keypress", function(e) {
+ if ("keypress" !== e.type || 13 === e.which || 32 === e.which)
+ if (m(this).focus(), m(this).is(".move-widget")) o.toggleWidgetMoveArea();
else {
- var d = b(this).is(".move-widget-down"),
- e = b(this).is(".move-widget-up"),
- g = j.getWidgetSidebarPosition();
- if (e && 0 === g || d && g === j.getSidebarWidgetsControl().setting().length - 1) return;
- e ? (j.moveUp(), a.a11y.speak(f.widgetMovedUp)) : (j.moveDown(), a.a11y.speak(f.widgetMovedDown)), b(this).focus()
+ var t = m(this).is(".move-widget-down"),
+ i = m(this).is(".move-widget-up"),
+ n = o.getWidgetSidebarPosition();
+ if (i && 0 === n || t && n === o.getSidebarWidgetsControl().setting().length - 1) return;
+ i ? (o.moveUp(), p.a11y.speak(f.widgetMovedUp)) : (o.moveDown(), p.a11y.speak(f.widgetMovedDown)), m(this).focus()
}
- }), this.container.find(".widget-area-select").on("click keypress", "li", function(a) {
- "keypress" === a.type && 13 !== a.which && 32 !== a.which || (a.preventDefault(), c(b(this)))
+ }), this.container.find(".widget-area-select").on("click keypress", "li", function(e) {
+ "keypress" === e.type && 13 !== e.which && 32 !== e.which || (e.preventDefault(), d(m(this)))
}), this.container.find(".move-widget-btn").click(function() {
- j.getSidebarWidgetsControl().toggleReordering(!1);
- var a, b, c, d, e, f = j.params.sidebar_id,
- h = j.container.find(".widget-area-select li.selected").data("id");
- a = g("sidebars_widgets[" + f + "]"), b = g("sidebars_widgets[" + h + "]"), c = Array.prototype.slice.call(a()), d = Array.prototype.slice.call(b()), e = j.getWidgetSidebarPosition(), c.splice(e, 1), d.push(j.params.widget_id), a(c), b(d), j.focus()
+ o.getSidebarWidgetsControl().toggleReordering(!1);
+ var e, t, i, n, s, d = o.params.sidebar_id,
+ a = o.container.find(".widget-area-select li.selected").data("id");
+ e = v("sidebars_widgets[" + d + "]"), t = v("sidebars_widgets[" + a + "]"), i = Array.prototype.slice.call(e()), n = Array.prototype.slice.call(t()), s = o.getWidgetSidebarPosition(), i.splice(s, 1), n.push(o.params.widget_id), e(i), t(n), o.focus()
})
},
_setupHighlightEffects: function() {
- var a = this;
+ var e = this;
this.container.on("mouseenter click", function() {
- a.setting.previewer.send("highlight-widget", a.params.widget_id)
+ e.setting.previewer.send("highlight-widget", e.params.widget_id)
}), this.setting.bind(function() {
- a.setting.previewer.send("highlight-widget", a.params.widget_id)
+ e.setting.previewer.send("highlight-widget", e.params.widget_id)
})
},
_setupUpdateUI: function() {
- var a, c, d, e, h, i = this;
- a = this.container.find(".widget:first"), c = a.find(".widget-content:first"), d = this.container.find(".widget-control-save"), d.val(f.saveBtnLabel), d.attr("title", f.saveBtnTooltip), d.removeClass("button-primary"), d.on("click", function(a) {
- a.preventDefault(), i.updateWidget({
+ var i, e, t, n, s, d = this;
+ e = (i = this.container.find(".widget:first")).find(".widget-content:first"), (t = this.container.find(".widget-control-save")).val(f.saveBtnLabel), t.attr("title", f.saveBtnTooltip), t.removeClass("button-primary"), t.on("click", function(e) {
+ e.preventDefault(), d.updateWidget({
disable_form: !0
})
- }), e = _.debounce(function() {
- i.updateWidget()
- }, 250), c.on("keydown", "input", function(a) {
- 13 === a.which && (a.preventDefault(), i.updateWidget({
+ }), n = _.debounce(function() {
+ d.updateWidget()
+ }, 250), e.on("keydown", "input", function(e) {
+ 13 === e.which && (e.preventDefault(), d.updateWidget({
ignoreActiveElement: !0
}))
- }), c.on("change input propertychange", ":input", function(a) {
- i.liveUpdateMode && ("change" === a.type || this.checkValidity && this.checkValidity()) && e()
+ }), e.on("change input propertychange", ":input", function(e) {
+ d.liveUpdateMode && ("change" === e.type || this.checkValidity && this.checkValidity()) && n()
}), this.setting.previewer.channel.bind("synced", function() {
- i.container.removeClass("previewer-loading")
- }), g.previewer.bind("widget-updated", function(a) {
- a === i.params.widget_id && i.container.removeClass("previewer-loading")
- }), (h = g.Widgets.formSyncHandlers[this.params.widget_id_base]) && b(document).on("widget-synced", function(b, c) {
- a.is(c) && h.apply(document, arguments)
+ d.container.removeClass("previewer-loading")
+ }), v.previewer.bind("widget-updated", function(e) {
+ e === d.params.widget_id && d.container.removeClass("previewer-loading")
+ }), (s = v.Widgets.formSyncHandlers[this.params.widget_id_base]) && m(document).on("widget-synced", function(e, t) {
+ i.is(t) && s.apply(document, arguments)
})
},
- onChangeActive: function(a, b) {
- this.container.toggleClass("widget-rendered", a), b.completeCallback && b.completeCallback()
+ onChangeActive: function(e, t) {
+ this.container.toggleClass("widget-rendered", e), t.completeCallback && t.completeCallback()
},
_setupRemoveUI: function() {
- var a, b, c = this;
- a = this.container.find(".widget-control-remove"), a.on("click", function(a) {
- a.preventDefault();
- var b;
- b = c.container.next().is(".customize-control-widget_form") ? c.container.next().find(".widget-action:first") : c.container.prev().is(".customize-control-widget_form") ? c.container.prev().find(".widget-action:first") : c.container.next(".customize-control-sidebar_widgets").find(".add-new-widget:first"), c.container.slideUp(function() {
- var a, d, e = g.Widgets.getSidebarWidgetControlContainingWidget(c.params.widget_id);
- e && (a = e.setting().slice(), -1 !== (d = _.indexOf(a, c.params.widget_id)) && (a.splice(d, 1), e.setting(a), b.focus()))
+ var e, t, s = this;
+ (e = this.container.find(".widget-control-remove")).on("click", function(e) {
+ var n;
+ e.preventDefault(), n = s.container.next().is(".customize-control-widget_form") ? s.container.next().find(".widget-action:first") : s.container.prev().is(".customize-control-widget_form") ? s.container.prev().find(".widget-action:first") : s.container.next(".customize-control-sidebar_widgets").find(".add-new-widget:first"), s.container.slideUp(function() {
+ var e, t, i = v.Widgets.getSidebarWidgetControlContainingWidget(s.params.widget_id);
+ i && (e = i.setting().slice(), -1 !== (t = _.indexOf(e, s.params.widget_id)) && (e.splice(t, 1), i.setting(e), n.focus()))
})
- }), b = function() {
- a.text(f.removeBtnLabel), a.attr("title", f.removeBtnTooltip)
- }, this.params.is_new ? g.bind("saved", b) : b()
- },
- _getInputs: function(a) {
- return b(a).find(":input[name]")
- },
- _getInputsSignature: function(a) {
- return _(a).map(function(a) {
- var c, d = b(a);
- return c = d.is(":checkbox, :radio") ? [d.attr("id"), d.attr("name"), d.prop("value")] : [d.attr("id"), d.attr("name")], c.join(",")
+ }), t = function() {
+ e.text(f.removeBtnLabel), e.attr("title", f.removeBtnTooltip)
+ }, this.params.is_new ? v.bind("saved", t) : t()
+ },
+ _getInputs: function(e) {
+ return m(e).find(":input[name]")
+ },
+ _getInputsSignature: function(e) {
+ return _(e).map(function(e) {
+ var t = m(e);
+ return (t.is(":checkbox, :radio") ? [t.attr("id"), t.attr("name"), t.prop("value")] : [t.attr("id"), t.attr("name")]).join(",")
}).join(";")
},
- _getInputState: function(a) {
- return a = b(a), a.is(":radio, :checkbox") ? a.prop("checked") : a.is("select[multiple]") ? a.find("option:selected").map(function() {
- return b(this).val()
- }).get() : a.val()
- },
- _setInputState: function(a, c) {
- a = b(a), a.is(":radio, :checkbox") ? a.prop("checked", c) : a.is("select[multiple]") ? (c = b.isArray(c) ? _.map(c, function(a) {
- return String(a)
- }) : [], a.find("option").each(function() {
- b(this).prop("selected", -1 !== _.indexOf(c, String(this.value)))
- })) : a.val(c)
+ _getInputState: function(e) {
+ return (e = m(e)).is(":radio, :checkbox") ? e.prop("checked") : e.is("select[multiple]") ? e.find("option:selected").map(function() {
+ return m(this).val()
+ }).get() : e.val()
+ },
+ _setInputState: function(e, t) {
+ (e = m(e)).is(":radio, :checkbox") ? e.prop("checked", t) : e.is("select[multiple]") ? (t = m.isArray(t) ? _.map(t, function(e) {
+ return String(e)
+ }) : [], e.find("option").each(function() {
+ m(this).prop("selected", -1 !== _.indexOf(t, String(this.value)))
+ })) : e.val(t)
},
getSidebarWidgetsControl: function() {
- var a, b;
- if (a = "sidebars_widgets[" + this.params.sidebar_id + "]", b = g.control(a)) return b
+ var e, t;
+ if (e = "sidebars_widgets[" + this.params.sidebar_id + "]", t = v.control(e)) return t
},
- updateWidget: function(c) {
- var d, e, h, i, j, k, l, m, n, o, p, q = this;
- q.embedWidgetContent(), c = b.extend({
+ updateWidget: function(a) {
+ var e, o, r, l, c, t, i, g, n, s, u, h = this;
+ h.embedWidgetContent(), e = (a = m.extend({
instance: null,
complete: null,
ignoreActiveElement: !1
- }, c), d = c.instance, e = c.complete, this._updateCount += 1, j = this._updateCount, h = this.container.find(".widget:first"), i = h.find(".widget-content:first"), i.find(".widget-error").remove(), this.container.addClass("widget-form-loading"), this.container.addClass("previewer-loading"), n = g.state("processing"), n(n() + 1), this.liveUpdateMode || this.container.addClass("widget-form-disabled"), k = {}, k.action = "update-widget", k.wp_customize = "on", k.nonce = g.settings.nonce["update-widget"], k.customize_theme = g.settings.theme.stylesheet, k.customized = a.customize.previewer.query().customized, l = b.param(k), m = this._getInputs(i), m.each(function() {
- b(this).data("state" + j, q._getInputState(this))
- }), l += d ? "&" + b.param({
- sanitized_widget_setting: JSON.stringify(d)
- }) : "&" + m.serialize(), l += "&" + i.find("~ :input").serialize(), this._previousUpdateRequest && this._previousUpdateRequest.abort(), o = b.post(a.ajax.settings.url, l), this._previousUpdateRequest = o, o.done(function(a) {
- var d, k, l, n, o = !1;
- return "0" === a ? (g.previewer.preview.iframe.hide(), void g.previewer.login().done(function() {
- q.updateWidget(c), g.previewer.preview.iframe.show()
- })) : "-1" === a ? void g.previewer.cheatin() : void(a.success ? (k = b("<div>" + a.data.form + "</div>"), l = q._getInputs(k), n = q._getInputsSignature(m) === q._getInputsSignature(l), n && !q.liveUpdateMode && (q.liveUpdateMode = !0, q.container.removeClass("widget-form-disabled"), q.container.find('input[name="savewidget"]').hide()), n && q.liveUpdateMode ? (m.each(function(a) {
- var d, e, f, g = b(this),
- h = b(l[a]);
- d = g.data("state" + j), e = q._getInputState(h), g.data("sanitized", e), (f = !_.isEqual(d, e) && (c.ignoreActiveElement || !g.is(document.activeElement))) && q._setInputState(g, e)
- }), b(document).trigger("widget-synced", [h, a.data.form])) : q.liveUpdateMode ? (q.liveUpdateMode = !1, q.container.find('input[name="savewidget"]').show(), o = !0) : (i.html(a.data.form), q.container.removeClass("widget-form-disabled"), b(document).trigger("widget-updated", [h])), p = !o && !_(q.setting()).isEqual(a.data.instance), p ? (q.isWidgetUpdating = !0, q.setting(a.data.instance), q.isWidgetUpdating = !1) : q.container.removeClass("previewer-loading"), e && e.call(q, null, {
- noChange: !p,
+ }, a)).instance, o = a.complete, this._updateCount += 1, c = this._updateCount, r = this.container.find(".widget:first"), (l = r.find(".widget-content:first")).find(".widget-error").remove(), this.container.addClass("widget-form-loading"), this.container.addClass("previewer-loading"), (n = v.state("processing"))(n() + 1), this.liveUpdateMode || this.container.addClass("widget-form-disabled"), (t = {
+ action: "update-widget",
+ wp_customize: "on"
+ }).nonce = v.settings.nonce["update-widget"], t.customize_theme = v.settings.theme.stylesheet, t.customized = p.customize.previewer.query().customized, i = m.param(t), (g = this._getInputs(l)).each(function() {
+ m(this).data("state" + c, h._getInputState(this))
+ }), i += e ? "&" + m.param({
+ sanitized_widget_setting: JSON.stringify(e)
+ }) : "&" + g.serialize(), i += "&" + l.find("~ :input").serialize(), this._previousUpdateRequest && this._previousUpdateRequest.abort(), s = m.post(p.ajax.settings.url, i), (this._previousUpdateRequest = s).done(function(e) {
+ var t, i, d, n, s = !1;
+ if ("0" === e) return v.previewer.preview.iframe.hide(), void v.previewer.login().done(function() {
+ h.updateWidget(a), v.previewer.preview.iframe.show()
+ });
+ "-1" !== e ? e.success ? (i = m("<div>" + e.data.form + "</div>"), d = h._getInputs(i), (n = h._getInputsSignature(g) === h._getInputsSignature(d)) && !h.liveUpdateMode && (h.liveUpdateMode = !0, h.container.removeClass("widget-form-disabled"), h.container.find('input[name="savewidget"]').hide()), n && h.liveUpdateMode ? (g.each(function(e) {
+ var t, i, n = m(this),
+ s = m(d[e]);
+ t = n.data("state" + c), i = h._getInputState(s), n.data("sanitized", i), !_.isEqual(t, i) && (a.ignoreActiveElement || !n.is(document.activeElement)) && h._setInputState(n, i)
+ }), m(document).trigger("widget-synced", [r, e.data.form])) : h.liveUpdateMode ? (h.liveUpdateMode = !1, h.container.find('input[name="savewidget"]').show(), s = !0) : (l.html(e.data.form), h.container.removeClass("widget-form-disabled"), m(document).trigger("widget-updated", [r])), (u = !s && !_(h.setting()).isEqual(e.data.instance)) ? (h.isWidgetUpdating = !0, h.setting(e.data.instance), h.isWidgetUpdating = !1) : h.container.removeClass("previewer-loading"), o && o.call(h, null, {
+ noChange: !u,
ajaxFinished: !0
- })) : (d = f.error, a.data && a.data.message && (d = a.data.message), e ? e.call(q, d) : i.prepend('<p class="widget-error"><strong>' + d + "</strong></p>")))
- }), o.fail(function(a, b) {
- e && e.call(q, b)
- }), o.always(function() {
- q.container.removeClass("widget-form-loading"), m.each(function() {
- b(this).removeData("state" + j)
+ })) : (t = f.error, e.data && e.data.message && (t = e.data.message), o ? o.call(h, t) : l.prepend('<p class="widget-error"><strong>' + t + "</strong></p>")) : v.previewer.cheatin()
+ }), s.fail(function(e, t) {
+ o && o.call(h, t)
+ }), s.always(function() {
+ h.container.removeClass("widget-form-loading"), g.each(function() {
+ m(this).removeData("state" + c)
}), n(n() - 1)
})
},
expandControlSection: function() {
- g.Control.prototype.expand.call(this)
+ v.Control.prototype.expand.call(this)
},
- _toggleExpanded: g.Section.prototype._toggleExpanded,
- expand: g.Section.prototype.expand,
+ _toggleExpanded: v.Section.prototype._toggleExpanded,
+ expand: v.Section.prototype.expand,
expandForm: function() {
this.expand()
},
- collapse: g.Section.prototype.collapse,
+ collapse: v.Section.prototype.collapse,
collapseForm: function() {
this.collapse()
},
- toggleForm: function(a) {
- void 0 === a && (a = !this.expanded()), this.expanded(a)
+ toggleForm: function(e) {
+ void 0 === e && (e = !this.expanded()), this.expanded(e)
},
- onChangeExpanded: function(a, b) {
- var c, d, e, f, h, i, j = this;
- if (j.embedWidgetControl(), a && j.embedWidgetContent(), b.unchanged) return void(a && g.Control.prototype.expand.call(j, {
- completeCallback: b.completeCallback
- }));
- c = this.container.find("div.widget:first"), d = c.find(".widget-inside:first"), i = this.container.find(".widget-top button.widget-action"), h = function() {
- g.control.each(function(a) {
- j.params.type === a.params.type && j !== a && a.collapse()
- }), e = function() {
- j.container.removeClass("expanding"), j.container.addClass("expanded"), c.addClass("open"), i.attr("aria-expanded", "true"), j.container.trigger("expanded")
- }, b.completeCallback && (f = e, e = function() {
- f(), b.completeCallback()
- }), j.params.is_wide ? d.fadeIn(b.duration, e) : d.slideDown(b.duration, e), j.container.trigger("expand"), j.container.addClass("expanding")
- }, a ? g.section.has(j.section()) ? g.section(j.section()).expand({
- completeCallback: h
- }) : h() : (e = function() {
- j.container.removeClass("collapsing"), j.container.removeClass("expanded"), c.removeClass("open"), i.attr("aria-expanded", "false"), j.container.trigger("collapsed")
- }, b.completeCallback && (f = e, e = function() {
- f(), b.completeCallback()
- }), j.container.trigger("collapse"), j.container.addClass("collapsing"), j.params.is_wide ? d.fadeOut(b.duration, e) : d.slideUp(b.duration, function() {
- c.css({
+ onChangeExpanded: function(e, t) {
+ var i, n, s, d, a, o, r = this;
+ r.embedWidgetControl(), e && r.embedWidgetContent(), t.unchanged ? e && v.Control.prototype.expand.call(r, {
+ completeCallback: t.completeCallback
+ }) : (i = this.container.find("div.widget:first"), n = i.find(".widget-inside:first"), o = this.container.find(".widget-top button.widget-action"), a = function() {
+ v.control.each(function(e) {
+ r.params.type === e.params.type && r !== e && e.collapse()
+ }), s = function() {
+ r.container.removeClass("expanding"), r.container.addClass("expanded"), i.addClass("open"), o.attr("aria-expanded", "true"), r.container.trigger("expanded")
+ }, t.completeCallback && (d = s, s = function() {
+ d(), t.completeCallback()
+ }), r.params.is_wide ? n.fadeIn(t.duration, s) : n.slideDown(t.duration, s), r.container.trigger("expand"), r.container.addClass("expanding")
+ }, e ? v.section.has(r.section()) ? v.section(r.section()).expand({
+ completeCallback: a
+ }) : a() : (s = function() {
+ r.container.removeClass("collapsing"), r.container.removeClass("expanded"), i.removeClass("open"), o.attr("aria-expanded", "false"), r.container.trigger("collapsed")
+ }, t.completeCallback && (d = s, s = function() {
+ d(), t.completeCallback()
+ }), r.container.trigger("collapse"), r.container.addClass("collapsing"), r.params.is_wide ? n.fadeOut(t.duration, s) : n.slideUp(t.duration, function() {
+ i.css({
width: "",
margin: ""
- }), e()
- }))
+ }), s()
+ })))
},
getWidgetSidebarPosition: function() {
- var a, b;
- if (a = this.getSidebarWidgetsControl().setting(), -1 !== (b = _.indexOf(a, this.params.widget_id))) return b
+ var e, t;
+ if (e = this.getSidebarWidgetsControl().setting(), -1 !== (t = _.indexOf(e, this.params.widget_id))) return t
},
moveUp: function() {
this._moveWidgetByOne(-1)
@@ -415,100 +398,99 @@
moveDown: function() {
this._moveWidgetByOne(1)
},
- _moveWidgetByOne: function(a) {
- var b, c, d, e;
- b = this.getWidgetSidebarPosition(), c = this.getSidebarWidgetsControl().setting, d = Array.prototype.slice.call(c()), e = d[b + a], d[b + a] = this.params.widget_id, d[b] = e, c(d)
- },
- toggleWidgetMoveArea: function(a) {
- var c, d = this;
- c = this.container.find(".move-widget-area"), void 0 === a && (a = !c.hasClass("active")), a && (c.find(".selected").removeClass("selected"), c.find("li").filter(function() {
- return b(this).data("id") === d.params.sidebar_id
- }).addClass("selected"), this.container.find(".move-widget-btn").prop("disabled", !0)), c.toggleClass("active", a)
+ _moveWidgetByOne: function(e) {
+ var t, i, n, s;
+ t = this.getWidgetSidebarPosition(), i = this.getSidebarWidgetsControl().setting, s = (n = Array.prototype.slice.call(i()))[t + e], n[t + e] = this.params.widget_id, n[t] = s, i(n)
+ },
+ toggleWidgetMoveArea: function(e) {
+ var t, i = this;
+ t = this.container.find(".move-widget-area"), void 0 === e && (e = !t.hasClass("active")), e && (t.find(".selected").removeClass("selected"), t.find("li").filter(function() {
+ return m(this).data("id") === i.params.sidebar_id
+ }).addClass("selected"), this.container.find(".move-widget-btn").prop("disabled", !0)), t.toggleClass("active", e)
},
highlightSectionAndControl: function() {
- var a;
- a = this.container.is(":hidden") ? this.container.closest(".control-section") : this.container, b(".highlighted").removeClass("highlighted"), a.addClass("highlighted"), setTimeout(function() {
- a.removeClass("highlighted")
+ var e;
+ e = this.container.is(":hidden") ? this.container.closest(".control-section") : this.container, m(".highlighted").removeClass("highlighted"), e.addClass("highlighted"), setTimeout(function() {
+ e.removeClass("highlighted")
}, 500)
}
- }), g.Widgets.WidgetsPanel = g.Panel.extend({
+ }), v.Widgets.WidgetsPanel = v.Panel.extend({
ready: function() {
- var a = this;
- g.Panel.prototype.ready.call(a), a.deferred.embedded.done(function() {
- var c, d, e, h, i;
- c = a.container.find(".panel-meta"), d = b("<div></div>", {
- "class": "no-widget-areas-rendered-notice"
- }), c.append(d), h = function() {
- return _.filter(a.sections(), function(a) {
- return a.active()
+ var n = this;
+ v.Panel.prototype.ready.call(n), n.deferred.embedded.done(function() {
+ var e, s, t, d, i;
+ e = n.container.find(".panel-meta"), s = m("<div></div>", {
+ class: "no-widget-areas-rendered-notice"
+ }), e.append(s), d = function() {
+ return _.filter(n.sections(), function(e) {
+ return e.active()
}).length
}, i = function() {
- var a = h();
- return 0 === a || a !== g.Widgets.data.registeredSidebars.length
- }, e = function() {
- var a, c, e, i = h();
- d.empty(), e = g.Widgets.data.registeredSidebars.length, i !== e && (0 !== i ? (c = e - i, a = f.someAreasShown[c]) : a = f.noAreasShown, a && d.append(b("<p></p>", {
- text: a
- })), d.append(b("<p></p>", {
+ var e = d();
+ return 0 === e || e !== v.Widgets.data.registeredSidebars.length
+ }, (t = function() {
+ var e, t, i, n = d();
+ s.empty(), n !== (i = v.Widgets.data.registeredSidebars.length) && ((e = 0 !== n ? (t = i - n, f.someAreasShown[t]) : f.noAreasShown) && s.append(m("<p></p>", {
+ text: e
+ })), s.append(m("<p></p>", {
text: f.navigatePreview
})))
- }, e(), d.toggle(i()), g.previewer.deferred.active.done(function() {
- d.toggle(i())
- }), g.bind("pane-contents-reflowed", function() {
- var a = "resolved" === g.previewer.deferred.active.state() ? "fast" : 0;
- e(), i() ? d.slideDown(a) : d.slideUp(a)
+ })(), s.toggle(i()), v.previewer.deferred.active.done(function() {
+ s.toggle(i())
+ }), v.bind("pane-contents-reflowed", function() {
+ var e = "resolved" === v.previewer.deferred.active.state() ? "fast" : 0;
+ t(), i() ? s.slideDown(e) : s.slideUp(e)
})
})
},
isContextuallyActive: function() {
return this.active()
}
- }), g.Widgets.SidebarSection = g.Section.extend({
+ }), v.Widgets.SidebarSection = v.Section.extend({
ready: function() {
- var a, b = this;
- g.Section.prototype.ready.call(this), a = g.Widgets.registeredSidebars.get(b.params.sidebarId), b.active.bind(function(b) {
- a.set("is_rendered", b)
- }), a.set("is_rendered", b.active())
+ var t;
+ v.Section.prototype.ready.call(this), t = v.Widgets.registeredSidebars.get(this.params.sidebarId), this.active.bind(function(e) {
+ t.set("is_rendered", e)
+ }), t.set("is_rendered", this.active())
}
- }), g.Widgets.SidebarControl = g.Control.extend({
+ }), v.Widgets.SidebarControl = v.Control.extend({
ready: function() {
this.$controlSection = this.container.closest(".control-section"), this.$sectionContent = this.container.closest(".accordion-section-content"), this._setupModel(), this._setupSortable(), this._setupAddition(), this._applyCardinalOrderClassNames()
},
_setupModel: function() {
- var a = this;
- this.setting.bind(function(c, e) {
- var f, h, i;
- h = _(e).difference(c), c = _(c).filter(function(a) {
- var b = d(a);
- return !!g.Widgets.availableWidgets.findWhere({
- id_base: b.id_base
+ var o = this;
+ this.setting.bind(function(i, e) {
+ var t, n, s;
+ n = _(e).difference(i), i = _(i).filter(function(e) {
+ var t = w(e);
+ return !!v.Widgets.availableWidgets.findWhere({
+ id_base: t.id_base
})
- }), f = _(c).map(function(b) {
- var c = g.Widgets.getWidgetFormControlForWidget(b);
- return c || (c = a.addWidget(b)), c
- }), f.sort(function(a, b) {
- return _.indexOf(c, a.params.widget_id) - _.indexOf(c, b.params.widget_id)
- }), i = 0, _(f).each(function(b) {
- b.priority(i), b.section(a.section()), i += 1
- }), a.priority(i), a._applyCardinalOrderClassNames(), _(f).each(function(b) {
- b.params.sidebar_id = a.params.sidebar_id
- }), _(h).each(function(c) {
+ }), (t = _(i).map(function(e) {
+ var t = v.Widgets.getWidgetFormControlForWidget(e);
+ return t || (t = o.addWidget(e)), t
+ })).sort(function(e, t) {
+ return _.indexOf(i, e.params.widget_id) - _.indexOf(i, t.params.widget_id)
+ }), s = 0, _(t).each(function(e) {
+ e.priority(s), e.section(o.section()), s += 1
+ }), o.priority(s), o._applyCardinalOrderClassNames(), _(t).each(function(e) {
+ e.params.sidebar_id = o.params.sidebar_id
+ }), _(n).each(function(a) {
setTimeout(function() {
- var e, f, h, i, j, k = !1;
- g.each(function(b) {
- if (b.id !== a.setting.id && 0 === b.id.indexOf("sidebars_widgets[") && "sidebars_widgets[wp_inactive_widgets]" !== b.id) {
- var d, e = b();
- d = _.indexOf(e, c), -1 !== d && (k = !0)
+ var e, t, i, n, s, d = !1;
+ v.each(function(e) {
+ if (e.id !== o.setting.id && 0 === e.id.indexOf("sidebars_widgets[") && "sidebars_widgets[wp_inactive_widgets]" !== e.id) {
+ var t = e(); - 1 !== _.indexOf(t, a) && (d = !0)
}
- }), k || (e = g.Widgets.getWidgetFormControlForWidget(c), f = e && b.contains(document, e.container[0]) && !b.contains(a.$sectionContent[0], e.container[0]), e && !f && (g.control.remove(e.id), e.container.remove()), g.Widgets.savedWidgetIds[c] && (h = g.value("sidebars_widgets[wp_inactive_widgets]")().slice(), h.push(c), g.value("sidebars_widgets[wp_inactive_widgets]")(_(h).unique())), i = d(c).id_base, (j = g.Widgets.availableWidgets.findWhere({
- id_base: i
- })) && !j.get("is_multi") && j.set("is_disabled", !1))
+ }), d || (t = (e = v.Widgets.getWidgetFormControlForWidget(a)) && m.contains(document, e.container[0]) && !m.contains(o.$sectionContent[0], e.container[0]), e && !t && (v.control.remove(e.id), e.container.remove()), v.Widgets.savedWidgetIds[a] && ((i = v.value("sidebars_widgets[wp_inactive_widgets]")().slice()).push(a), v.value("sidebars_widgets[wp_inactive_widgets]")(_(i).unique())), n = w(a).id_base, (s = v.Widgets.availableWidgets.findWhere({
+ id_base: n
+ })) && !s.get("is_multi") && s.set("is_disabled", !1))
})
})
})
},
_setupSortable: function() {
- var a = this;
+ var i = this;
this.isReordering = !1, this.$sectionContent.sortable({
items: "> .customize-control-widget_form",
handle: ".widget-top",
@@ -516,135 +498,149 @@
tolerance: "pointer",
connectWith: ".accordion-section-content:has(.customize-control-sidebar_widgets)",
update: function() {
- var c, d = a.$sectionContent.sortable("toArray");
- c = b.map(d, function(a) {
- return b("#" + a).find(":input[name=widget-id]").val()
- }), a.setting(c)
+ var e, t = i.$sectionContent.sortable("toArray");
+ e = m.map(t, function(e) {
+ return m("#" + e).find(":input[name=widget-id]").val()
+ }), i.setting(e)
}
}), this.$controlSection.find(".accordion-section-title").droppable({
accept: ".customize-control-widget_form",
over: function() {
- g.section(a.section.get()).expand({
+ v.section(i.section.get()).expand({
allowMultiple: !0,
completeCallback: function() {
- g.section.each(function(a) {
- a.container.find(".customize-control-sidebar_widgets").length && a.container.find(".accordion-section-content:first").sortable("refreshPositions")
+ v.section.each(function(e) {
+ e.container.find(".customize-control-sidebar_widgets").length && e.container.find(".accordion-section-content:first").sortable("refreshPositions")
})
}
})
}
}), this.container.find(".reorder-toggle").on("click", function() {
- a.toggleReordering(!a.isReordering)
+ i.toggleReordering(!i.isReordering)
})
},
_setupAddition: function() {
- var a = this;
+ var t = this;
this.container.find(".add-new-widget").on("click", function() {
- var c = b(this);
- a.$sectionContent.hasClass("reordering") || (b("body").hasClass("adding-widget") ? (c.attr("aria-expanded", "false"), g.Widgets.availableWidgetsPanel.close()) : (c.attr("aria-expanded", "true"), g.Widgets.availableWidgetsPanel.open(a)))
+ var e = m(this);
+ t.$sectionContent.hasClass("reordering") || (m("body").hasClass("adding-widget") ? (e.attr("aria-expanded", "false"), v.Widgets.availableWidgetsPanel.close()) : (e.attr("aria-expanded", "true"), v.Widgets.availableWidgetsPanel.open(t)))
})
},
_applyCardinalOrderClassNames: function() {
- var a = [];
- if (_.each(this.setting(), function(b) {
- var c = g.Widgets.getWidgetFormControlForWidget(b);
- c && a.push(c)
- }), 0 === a.length || 1 === g.Widgets.registeredSidebars.length && a.length <= 1) return void this.container.find(".reorder-toggle").hide();
- this.container.find(".reorder-toggle").show(), b(a).each(function() {
- b(this.container).removeClass("first-widget").removeClass("last-widget").find(".move-widget-down, .move-widget-up").prop("tabIndex", 0)
- }), _.first(a).container.addClass("first-widget").find(".move-widget-up").prop("tabIndex", -1), _.last(a).container.addClass("last-widget").find(".move-widget-down").prop("tabIndex", -1)
- },
- toggleReordering: function(b) {
- var c = this.$sectionContent.find(".add-new-widget"),
- d = this.container.find(".reorder-toggle"),
- e = this.$sectionContent.find(".widget-title");
- (b = Boolean(b)) !== this.$sectionContent.hasClass("reordering") && (this.isReordering = b, this.$sectionContent.toggleClass("reordering", b), b ? (_(this.getWidgetFormControls()).each(function(a) {
- a.collapse()
- }), c.attr({
+ var i = [];
+ _.each(this.setting(), function(e) {
+ var t = v.Widgets.getWidgetFormControlForWidget(e);
+ t && i.push(t)
+ }), 0 === i.length || 1 === v.Widgets.registeredSidebars.length && i.length <= 1 ? this.container.find(".reorder-toggle").hide() : (this.container.find(".reorder-toggle").show(), m(i).each(function() {
+ m(this.container).removeClass("first-widget").removeClass("last-widget").find(".move-widget-down, .move-widget-up").prop("tabIndex", 0)
+ }), _.first(i).container.addClass("first-widget").find(".move-widget-up").prop("tabIndex", -1), _.last(i).container.addClass("last-widget").find(".move-widget-down").prop("tabIndex", -1))
+ },
+ toggleReordering: function(e) {
+ var t = this.$sectionContent.find(".add-new-widget"),
+ i = this.container.find(".reorder-toggle"),
+ n = this.$sectionContent.find(".widget-title");
+ (e = Boolean(e)) !== this.$sectionContent.hasClass("reordering") && (this.isReordering = e, this.$sectionContent.toggleClass("reordering", e), e ? (_(this.getWidgetFormControls()).each(function(e) {
+ e.collapse()
+ }), t.attr({
tabindex: "-1",
"aria-hidden": "true"
- }), d.attr("aria-label", f.reorderLabelOff), a.a11y.speak(f.reorderModeOn), e.attr("aria-hidden", "true")) : (c.removeAttr("tabindex aria-hidden"), d.attr("aria-label", f.reorderLabelOn), a.a11y.speak(f.reorderModeOff), e.attr("aria-hidden", "false")))
+ }), i.attr("aria-label", f.reorderLabelOff), p.a11y.speak(f.reorderModeOn), n.attr("aria-hidden", "true")) : (t.removeAttr("tabindex aria-hidden"), i.attr("aria-label", f.reorderLabelOn), p.a11y.speak(f.reorderModeOff), n.attr("aria-hidden", "false")))
},
getWidgetFormControls: function() {
- var a = [];
- return _(this.setting()).each(function(b) {
- var c = e(b),
- d = g.control(c);
- d && a.push(d)
- }), a
- },
- addWidget: function(a) {
- var c, e, f, h, i, j, k, l, m, n, o = this,
- p = d(a),
- q = p.number,
- r = p.id_base,
- s = g.Widgets.availableWidgets.findWhere({
- id_base: r
+ var n = [];
+ return _(this.setting()).each(function(e) {
+ var t = function(e) {
+ var t, i = w(e);
+ t = "widget_" + i.id_base, i.number && (t += "[" + i.number + "]");
+ return t
+ }(e),
+ i = v.control(t);
+ i && n.push(i)
+ }), n
+ },
+ addWidget: function(n) {
+ var e, t, i, s, d, a, o, r, l, c = this,
+ g = "widget_form",
+ u = w(n),
+ h = u.number,
+ p = u.id_base,
+ f = v.Widgets.availableWidgets.findWhere({
+ id_base: p
});
- return !!s && (!(q && !s.get("is_multi")) && (s.get("is_multi") && !q && (s.set("multi_number", s.get("multi_number") + 1), q = s.get("multi_number")), c = b.trim(b("#widget-tpl-" + s.get("id")).html()), s.get("is_multi") ? c = c.replace(/<[^<>]+>/g, function(a) {
- return a.replace(/__i__|%i%/g, q)
- }) : s.set("is_disabled", !0), e = b(c), f = b("<li/>").addClass("customize-control").addClass("customize-control-widget_form").append(e), f.find("> .widget-icon").remove(), s.get("is_multi") && (f.find('input[name="widget_number"]').val(q), f.find('input[name="multi_number"]').val(q)), a = f.find('[name="widget-id"]').val(), f.hide(), i = "widget_" + s.get("id_base"), s.get("is_multi") && (i += "[" + q + "]"), f.attr("id", "customize-control-" + i.replace(/\]/g, "").replace(/\[/g, "-")), j = g.has(i), j || (m = {
- transport: g.Widgets.data.selectiveRefreshableWidgets[s.get("id_base")] ? "postMessage" : "refresh",
+ return !!f && (!(h && !f.get("is_multi")) && (f.get("is_multi") && !h && (f.set("multi_number", f.get("multi_number") + 1), h = f.get("multi_number")), e = m.trim(m("#widget-tpl-" + f.get("id")).html()), f.get("is_multi") ? e = e.replace(/<[^<>]+>/g, function(e) {
+ return e.replace(/__i__|%i%/g, h)
+ }) : f.set("is_disabled", !0), t = m(e), (i = m("<li/>").addClass("customize-control").addClass("customize-control-" + g).append(t)).find("> .widget-icon").remove(), f.get("is_multi") && (i.find('input[name="widget_number"]').val(h), i.find('input[name="multi_number"]').val(h)), n = i.find('[name="widget-id"]').val(), i.hide(), d = "widget_" + f.get("id_base"), f.get("is_multi") && (d += "[" + h + "]"), i.attr("id", "customize-control-" + d.replace(/\]/g, "").replace(/\[/g, "-")), (a = v.has(d)) || (l = {
+ transport: v.Widgets.data.selectiveRefreshableWidgets[f.get("id_base")] ? "postMessage" : "refresh",
previewer: this.setting.previewer
- }, n = g.create(i, i, "", m), n.set({})), h = g.controlConstructor.widget_form, k = new h(i, {
+ }, v.create(d, d, "", l).set({})), s = v.controlConstructor[g], o = new s(d, {
settings: {
- "default": i
+ default: d
},
- content: f,
- sidebar_id: o.params.sidebar_id,
- widget_id: a,
- widget_id_base: s.get("id_base"),
- type: "widget_form",
- is_new: !j,
- width: s.get("width"),
- height: s.get("height"),
- is_wide: s.get("is_wide")
- }), g.control.add(k), g.each(function(b) {
- if (b.id !== o.setting.id && 0 === b.id.indexOf("sidebars_widgets[")) {
- var c = b().slice(),
- d = _.indexOf(c, a); - 1 !== d && (c.splice(d), b(c))
+ content: i,
+ sidebar_id: c.params.sidebar_id,
+ widget_id: n,
+ widget_id_base: f.get("id_base"),
+ type: g,
+ is_new: !a,
+ width: f.get("width"),
+ height: f.get("height"),
+ is_wide: f.get("is_wide")
+ }), v.control.add(o), v.each(function(e) {
+ if (e.id !== c.setting.id && 0 === e.id.indexOf("sidebars_widgets[")) {
+ var t = e().slice(),
+ i = _.indexOf(t, n); - 1 !== i && (t.splice(i), e(t))
}
- }), l = this.setting().slice(), -1 === _.indexOf(l, a) && (l.push(a), this.setting(l)), f.slideDown(function() {
- j && k.updateWidget({
- instance: k.setting()
+ }), r = this.setting().slice(), -1 === _.indexOf(r, n) && (r.push(n), this.setting(r)), i.slideDown(function() {
+ a && o.updateWidget({
+ instance: o.setting()
})
- }), k))
+ }), o))
}
- }), b.extend(g.panelConstructor, {
- widgets: g.Widgets.WidgetsPanel
- }), b.extend(g.sectionConstructor, {
- sidebar: g.Widgets.SidebarSection
- }), b.extend(g.controlConstructor, {
- widget_form: g.Widgets.WidgetControl,
- sidebar_widgets: g.Widgets.SidebarControl
- }), g.bind("ready", function() {
- g.Widgets.availableWidgetsPanel = new g.Widgets.AvailableWidgetsPanelView({
- collection: g.Widgets.availableWidgets
- }), g.previewer.bind("highlight-widget-control", g.Widgets.highlightWidgetFormControl), g.previewer.bind("focus-widget-control", g.Widgets.focusWidgetFormControl)
- }), g.Widgets.highlightWidgetFormControl = function(a) {
- var b = g.Widgets.getWidgetFormControlForWidget(a);
- b && b.highlightSectionAndControl()
- }, g.Widgets.focusWidgetFormControl = function(a) {
- var b = g.Widgets.getWidgetFormControlForWidget(a);
- b && b.focus()
- }, g.Widgets.getSidebarWidgetControlContainingWidget = function(a) {
- var b = null;
- return g.control.each(function(c) {
- "sidebar_widgets" === c.params.type && -1 !== _.indexOf(c.setting(), a) && (b = c)
- }), b
- }, g.Widgets.getWidgetFormControlForWidget = function(a) {
- var b = null;
- return g.control.each(function(c) {
- "widget_form" === c.params.type && c.params.widget_id === a && (b = c)
- }), b
- }, b(document).on("widget-added", function(a, b) {
- var e, f, h, i;
- e = d(b.find("> .widget-inside > .form > .widget-id").val()), "nav_menu" === e.id_base && (f = g.control("widget_nav_menu[" + String(e.number) + "]")) && (h = b.find('select[name*="nav_menu"]'), i = b.find(".edit-selected-nav-menu > button"), 0 !== h.length && 0 !== i.length && (h.on("change", function() {
- g.section.has("nav_menu[" + h.val() + "]") ? i.parent().show() : i.parent().hide()
- }), i.on("click", function() {
- var a = g.section("nav_menu[" + h.val() + "]");
- a && c(a, f)
+ }), m.extend(v.panelConstructor, {
+ widgets: v.Widgets.WidgetsPanel
+ }), m.extend(v.sectionConstructor, {
+ sidebar: v.Widgets.SidebarSection
+ }), m.extend(v.controlConstructor, {
+ widget_form: v.Widgets.WidgetControl,
+ sidebar_widgets: v.Widgets.SidebarControl
+ }), v.bind("ready", function() {
+ v.Widgets.availableWidgetsPanel = new v.Widgets.AvailableWidgetsPanelView({
+ collection: v.Widgets.availableWidgets
+ }), v.previewer.bind("highlight-widget-control", v.Widgets.highlightWidgetFormControl), v.previewer.bind("focus-widget-control", v.Widgets.focusWidgetFormControl)
+ }), v.Widgets.highlightWidgetFormControl = function(e) {
+ var t = v.Widgets.getWidgetFormControlForWidget(e);
+ t && t.highlightSectionAndControl()
+ }, v.Widgets.focusWidgetFormControl = function(e) {
+ var t = v.Widgets.getWidgetFormControlForWidget(e);
+ t && t.focus()
+ }, v.Widgets.getSidebarWidgetControlContainingWidget = function(t) {
+ var i = null;
+ return v.control.each(function(e) {
+ "sidebar_widgets" === e.params.type && -1 !== _.indexOf(e.setting(), t) && (i = e)
+ }), i
+ }, v.Widgets.getWidgetFormControlForWidget = function(t) {
+ var i = null;
+ return v.control.each(function(e) {
+ "widget_form" === e.params.type && e.params.widget_id === t && (i = e)
+ }), i
+ }, m(document).on("widget-added", function(e, t) {
+ var i, s, d, n;
+ "nav_menu" === (i = w(t.find("> .widget-inside > .form > .widget-id").val())).id_base && (s = v.control("widget_nav_menu[" + String(i.number) + "]")) && (d = t.find('select[name*="nav_menu"]'), n = t.find(".edit-selected-nav-menu > button"), 0 !== d.length && 0 !== n.length && (d.on("change", function() {
+ v.section.has("nav_menu[" + d.val() + "]") ? n.parent().show() : n.parent().hide()
+ }), n.on("click", function() {
+ var i, n, e = v.section("nav_menu[" + d.val() + "]");
+ e && (n = s, (i = e).focus(), i.expanded.bind(function e(t) {
+ t || (i.expanded.unbind(e), n.focus())
+ }))
})))
})
}
+
+ function w(e) {
+ var t, i = {
+ number: null,
+ id_base: null
+ };
+ return (t = e.match(/^(.+)-(\d+)$/)) ? (i.id_base = t[1], i.number = parseInt(t[2], 10)) : i.id_base = e, i
+ }
}(window.wp, jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/dashboard.min.js build-branch-unminified/wp-admin/js/dashboard.min.js
--- build-unminified/wp-admin/js/dashboard.min.js 2018-10-08 22:57:52.753456827 -0500
+++ build-branch-unminified/wp-admin/js/dashboard.min.js 2018-10-08 22:55:04.056118957 -0500
@@ -1,129 +1,125 @@
var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;
-window.wp = window.wp || {}, jQuery(document).ready(function(a) {
- function b() {
- if (!(document.documentMode && document.documentMode < 9)) {
- a("body").append('<div class="quick-draft-textarea-clone" style="display: none;"></div>');
- var b = a(".quick-draft-textarea-clone"),
- c = a("#content"),
- d = c.height(),
- e = a(window).height() - 100;
- b.css({
- "font-family": c.css("font-family"),
- "font-size": c.css("font-size"),
- "line-height": c.css("line-height"),
- "padding-bottom": c.css("paddingBottom"),
- "padding-left": c.css("paddingLeft"),
- "padding-right": c.css("paddingRight"),
- "padding-top": c.css("paddingTop"),
- "white-space": "pre-wrap",
- "word-wrap": "break-word",
- display: "none"
- }), c.on("focus input propertychange", function() {
- var f = a(this),
- g = f.val() + "&nbsp;",
- h = b.css("width", f.css("width")).text(g).outerHeight() + 2;
- c.css("overflow-y", "auto"), h === d || h >= e && d >= e || (d = h > e ? e : h, c.css("overflow", "hidden"), f.css("height", d + "px"))
- })
- }
- }
- var c, d = a("#welcome-panel"),
- e = a("#wp_welcome_panel-hide");
- c = function(b) {
- a.post(ajaxurl, {
+window.wp = window.wp || {}, jQuery(document).ready(function(c) {
+ var t, n = c("#welcome-panel"),
+ e = c("#wp_welcome_panel-hide");
+ t = function(e) {
+ c.post(ajaxurl, {
action: "update-welcome-panel",
- visible: b,
- welcomepanelnonce: a("#welcomepanelnonce").val()
+ visible: e,
+ welcomepanelnonce: c("#welcomepanelnonce").val()
})
- }, d.hasClass("hidden") && e.prop("checked") && d.removeClass("hidden"), a(".welcome-panel-close, .welcome-panel-dismiss a", d).click(function(b) {
- b.preventDefault(), d.addClass("hidden"), c(0), a("#wp_welcome_panel-hide").prop("checked", !1)
+ }, n.hasClass("hidden") && e.prop("checked") && n.removeClass("hidden"), c(".welcome-panel-close, .welcome-panel-dismiss a", n).click(function(e) {
+ e.preventDefault(), n.addClass("hidden"), t(0), c("#wp_welcome_panel-hide").prop("checked", !1)
}), e.click(function() {
- d.toggleClass("hidden", !this.checked), c(this.checked ? 1 : 0)
- }), ajaxWidgets = ["dashboard_primary"], ajaxPopulateWidgets = function(b) {
- function c(b, c) {
- var d, e = a("#" + c + " div.inside:visible").find(".widget-loading");
- e.length && (d = e.parent(), setTimeout(function() {
- d.load(ajaxurl + "?action=dashboard-widgets&widget=" + c + "&pagenow=" + pagenow, "", function() {
- d.hide().slideDown("normal", function() {
- a(this).css("display", "")
+ n.toggleClass("hidden", !this.checked), t(this.checked ? 1 : 0)
+ }), ajaxWidgets = ["dashboard_primary"], (ajaxPopulateWidgets = function(e) {
+ function t(e, t) {
+ var n, o = c("#" + t + " div.inside:visible").find(".widget-loading");
+ o.length && (n = o.parent(), setTimeout(function() {
+ n.load(ajaxurl + "?action=dashboard-widgets&widget=" + t + "&pagenow=" + pagenow, "", function() {
+ n.hide().slideDown("normal", function() {
+ c(this).css("display", "")
})
})
- }, 500 * b))
+ }, 500 * e))
}
- b ? (b = b.toString(), -1 !== a.inArray(b, ajaxWidgets) && c(0, b)) : a.each(ajaxWidgets, c)
- }, ajaxPopulateWidgets(), postboxes.add_postbox_toggles(pagenow, {
+ e ? (e = e.toString(), -1 !== c.inArray(e, ajaxWidgets) && t(0, e)) : c.each(ajaxWidgets, t)
+ })(), postboxes.add_postbox_toggles(pagenow, {
pbshow: ajaxPopulateWidgets
- }), quickPressLoad = function() {
- var c, d = a("#quickpost-action");
- a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled", !1), c = a("#quick-press").submit(function(b) {
- function d() {
- var b = a(".drafts ul li").first();
- b.css("background", "#fffbe5"), setTimeout(function() {
- b.css("background", "none")
- }, 1e3)
- }
- b.preventDefault(), a("#dashboard_quick_press #publishing-action .spinner").show(), a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled", !0), a.post(c.attr("action"), c.serializeArray(), function(b) {
- a("#dashboard_quick_press .inside").html(b), a("#quick-press").removeClass("initial-form"), quickPressLoad(), d(), a("#title").focus()
- })
- }), a("#publish").click(function() {
- d.val("post-quickpress-publish")
- }), a("#title, #tags-input, #content").each(function() {
- var b = a(this),
- c = a("#" + this.id + "-prompt-text");
- "" === this.value && c.removeClass("screen-reader-text"), c.click(function() {
- a(this).addClass("screen-reader-text"), b.focus()
- }), b.blur(function() {
- "" === this.value && c.removeClass("screen-reader-text")
- }), b.focus(function() {
- c.addClass("screen-reader-text")
- })
- }), a("#quick-press").on("click focusin", function() {
- wpActiveEditor = "content"
- }), b()
- }, quickPressLoad(), a(".meta-box-sortables").sortable("option", "containment", "#wpwrap")
-}), jQuery(function(a) {
+ }), (quickPressLoad = function() {
+ var t, e = c("#quickpost-action");
+ c('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled", !1), t = c("#quick-press").submit(function(e) {
+ e.preventDefault(), c("#dashboard_quick_press #publishing-action .spinner").show(), c('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled", !0), c.post(t.attr("action"), t.serializeArray(), function(e) {
+ var t;
+ c("#dashboard_quick_press .inside").html(e), c("#quick-press").removeClass("initial-form"), quickPressLoad(), (t = c(".drafts ul li").first()).css("background", "#fffbe5"), setTimeout(function() {
+ t.css("background", "none")
+ }, 1e3), c("#title").focus()
+ })
+ }), c("#publish").click(function() {
+ e.val("post-quickpress-publish")
+ }), c("#title, #tags-input, #content").each(function() {
+ var e = c(this),
+ t = c("#" + this.id + "-prompt-text");
+ "" === this.value && t.removeClass("screen-reader-text"), t.click(function() {
+ c(this).addClass("screen-reader-text"), e.focus()
+ }), e.blur(function() {
+ "" === this.value && t.removeClass("screen-reader-text")
+ }), e.focus(function() {
+ t.addClass("screen-reader-text")
+ })
+ }), c("#quick-press").on("click focusin", function() {
+ wpActiveEditor = "content"
+ }),
+ function() {
+ if (document.documentMode && document.documentMode < 9) return;
+ c("body").append('<div class="quick-draft-textarea-clone" style="display: none;"></div>');
+ var o = c(".quick-draft-textarea-clone"),
+ i = c("#content"),
+ a = i.height(),
+ s = c(window).height() - 100;
+ o.css({
+ "font-family": i.css("font-family"),
+ "font-size": i.css("font-size"),
+ "line-height": i.css("line-height"),
+ "padding-bottom": i.css("paddingBottom"),
+ "padding-left": i.css("paddingLeft"),
+ "padding-right": i.css("paddingRight"),
+ "padding-top": i.css("paddingTop"),
+ "white-space": "pre-wrap",
+ "word-wrap": "break-word",
+ display: "none"
+ }), i.on("focus input propertychange", function() {
+ var e = c(this),
+ t = e.val() + "&nbsp;",
+ n = o.css("width", e.css("width")).text(t).outerHeight() + 2;
+ i.css("overflow-y", "auto"), n === a || s <= n && s <= a || (a = s < n ? s : n, i.css("overflow", "hidden"), e.css("height", a + "px"))
+ })
+ }()
+ })(), c(".meta-box-sortables").sortable("option", "containment", "#wpwrap")
+}), jQuery(function(r) {
"use strict";
- var b, c = window.communityEventsData || {};
- b = window.wp.communityEvents = {
+ var l, u = window.communityEventsData || {};
+ l = window.wp.communityEvents = {
initialized: !1,
model: null,
init: function() {
- if (!b.initialized) {
- var d = a("#community-events");
- a(".community-events-errors").attr("aria-hidden", "true").removeClass("hide-if-js"), d.on("click", ".community-events-toggle-location, .community-events-cancel", b.toggleLocationForm), d.on("submit", ".community-events-form", function(c) {
- var d = a.trim(a("#community-events-location").val());
- c.preventDefault(), d && b.getEvents({
- location: d
+ if (!l.initialized) {
+ var e = r("#community-events");
+ r(".community-events-errors").attr("aria-hidden", "true").removeClass("hide-if-js"), e.on("click", ".community-events-toggle-location, .community-events-cancel", l.toggleLocationForm), e.on("submit", ".community-events-form", function(e) {
+ var t = r.trim(r("#community-events-location").val());
+ e.preventDefault(), t && l.getEvents({
+ location: t
})
- }), c && c.cache && c.cache.location && c.cache.events ? b.renderEventsTemplate(c.cache, "app") : b.getEvents(), b.initialized = !0
+ }), u && u.cache && u.cache.location && u.cache.events ? l.renderEventsTemplate(u.cache, "app") : l.getEvents(), l.initialized = !0
}
},
- toggleLocationForm: function(b) {
- var c = a(".community-events-toggle-location"),
- d = a(".community-events-cancel"),
- e = a(".community-events-form"),
- f = a();
- "object" == typeof b && (f = a(b.target), b = "true" == c.attr("aria-expanded") ? "hide" : "show"), "hide" === b ? (c.attr("aria-expanded", "false"), d.attr("aria-expanded", "false"), e.attr("aria-hidden", "true"), f.hasClass("community-events-cancel") && c.focus()) : (c.attr("aria-expanded", "true"), d.attr("aria-expanded", "true"), e.attr("aria-hidden", "false"))
+ toggleLocationForm: function(e) {
+ var t = r(".community-events-toggle-location"),
+ n = r(".community-events-cancel"),
+ o = r(".community-events-form"),
+ i = r();
+ "object" == typeof e && (i = r(e.target), e = "true" == t.attr("aria-expanded") ? "hide" : "show"), "hide" === e ? (t.attr("aria-expanded", "false"), n.attr("aria-expanded", "false"), o.attr("aria-hidden", "true"), i.hasClass("community-events-cancel") && t.focus()) : (t.attr("aria-expanded", "true"), n.attr("aria-expanded", "true"), o.attr("aria-hidden", "false"))
},
- getEvents: function(b) {
- var d, e = this,
- f = a(".community-events-form").children(".spinner");
- b = b || {}, b._wpnonce = c.nonce, b.timezone = window.Intl ? window.Intl.DateTimeFormat().resolvedOptions().timeZone : "", d = b.location ? "user" : "app", f.addClass("is-active"), wp.ajax.post("get-community-events", b).always(function() {
- f.removeClass("is-active")
- }).done(function(a) {
- "no_location_available" === a.error && (b.location ? a.unknownCity = b.location : delete a.error), e.renderEventsTemplate(a, d)
+ getEvents: function(t) {
+ var n, o = this,
+ e = r(".community-events-form").children(".spinner");
+ (t = t || {})._wpnonce = u.nonce, t.timezone = window.Intl ? window.Intl.DateTimeFormat().resolvedOptions().timeZone : "", n = t.location ? "user" : "app", e.addClass("is-active"), wp.ajax.post("get-community-events", t).always(function() {
+ e.removeClass("is-active")
+ }).done(function(e) {
+ "no_location_available" === e.error && (t.location ? e.unknownCity = t.location : delete e.error), o.renderEventsTemplate(e, n)
}).fail(function() {
- e.renderEventsTemplate({
+ o.renderEventsTemplate({
location: !1,
error: !0
- }, d)
+ }, n)
})
},
- renderEventsTemplate: function(d, e) {
- var f, g, h = /%(?:\d\$)?s/g,
- i = a(".community-events-toggle-location"),
- j = a("#community-events-location-message"),
- k = a(".community-events-results");
- g = {
+ renderEventsTemplate: function(e, t) {
+ var n, o, i = /%(?:\d\$)?s/g,
+ a = r(".community-events-toggle-location"),
+ s = r("#community-events-location-message"),
+ c = r(".community-events-results");
+ o = {
".community-events": !0,
".community-events-loading": !1,
".community-events-errors": !1,
@@ -132,12 +128,12 @@
"#community-events-location-message": !1,
".community-events-toggle-location": !1,
".community-events-results": !1
- }, d.location.ip ? (j.text(c.l10n.attend_event_near_generic), d.events.length ? (f = wp.template("community-events-event-list"), k.html(f(d))) : (f = wp.template("community-events-no-upcoming-events"), k.html(f(d))), g["#community-events-location-message"] = !0, g[".community-events-toggle-location"] = !0, g[".community-events-results"] = !0) : d.location.description ? (f = wp.template("community-events-attend-event-near"), j.html(f(d)), d.events.length ? (f = wp.template("community-events-event-list"), k.html(f(d))) : (f = wp.template("community-events-no-upcoming-events"), k.html(f(d))), "user" === e && wp.a11y.speak(c.l10n.city_updated.replace(h, d.location.description), "assertive"), g["#community-events-location-message"] = !0, g[".community-events-toggle-location"] = !0, g[".community-events-results"] = !0) : d.unknownCity ? (f = wp.template("community-events-could-not-locate"), a(".community-events-could-not-locate").html(f(d)), wp.a11y.speak(c.l10n.could_not_locate_city.replace(h, d.unknownCity)), g[".community-events-errors"] = !0, g[".community-events-could-not-locate"] = !0) : d.error && "user" === e ? (wp.a11y.speak(c.l10n.error_occurred_please_try_again), g[".community-events-errors"] = !0, g[".community-events-error-occurred"] = !0) : (j.text(c.l10n.enter_closest_city), g["#community-events-location-message"] = !0, g[".community-events-toggle-location"] = !0), _.each(g, function(b, c) {
- a(c).attr("aria-hidden", !b)
- }), i.attr("aria-expanded", g[".community-events-toggle-location"]), d.location && (d.location.ip || d.location.latitude) ? (b.toggleLocationForm("hide"), "user" === e && i.focus()) : b.toggleLocationForm("show")
+ }, e.location.ip ? (s.text(u.l10n.attend_event_near_generic), n = e.events.length ? wp.template("community-events-event-list") : wp.template("community-events-no-upcoming-events"), c.html(n(e)), o["#community-events-location-message"] = !0, o[".community-events-toggle-location"] = !0, o[".community-events-results"] = !0) : e.location.description ? (n = wp.template("community-events-attend-event-near"), s.html(n(e)), n = e.events.length ? wp.template("community-events-event-list") : wp.template("community-events-no-upcoming-events"), c.html(n(e)), "user" === t && wp.a11y.speak(u.l10n.city_updated.replace(i, e.location.description), "assertive"), o["#community-events-location-message"] = !0, o[".community-events-toggle-location"] = !0, o[".community-events-results"] = !0) : e.unknownCity ? (n = wp.template("community-events-could-not-locate"), r(".community-events-could-not-locate").html(n(e)), wp.a11y.speak(u.l10n.could_not_locate_city.replace(i, e.unknownCity)), o[".community-events-errors"] = !0, o[".community-events-could-not-locate"] = !0) : e.error && "user" === t ? (wp.a11y.speak(u.l10n.error_occurred_please_try_again), o[".community-events-errors"] = !0, o[".community-events-error-occurred"] = !0) : (s.text(u.l10n.enter_closest_city), o["#community-events-location-message"] = !0, o[".community-events-toggle-location"] = !0), _.each(o, function(e, t) {
+ r(t).attr("aria-hidden", !e)
+ }), a.attr("aria-expanded", o[".community-events-toggle-location"]), e.location && (e.location.ip || e.location.latitude) ? (l.toggleLocationForm("hide"), "user" === t && a.focus()) : l.toggleLocationForm("show")
}
- }, a("#dashboard_primary").is(":visible") ? b.init() : a(document).on("postbox-toggled", function(c, d) {
- var e = a(d);
- "dashboard_primary" === e.attr("id") && e.is(":visible") && b.init()
+ }, r("#dashboard_primary").is(":visible") ? l.init() : r(document).on("postbox-toggled", function(e, t) {
+ var n = r(t);
+ "dashboard_primary" === n.attr("id") && n.is(":visible") && l.init()
})
});
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/edit-comments.min.js build-branch-unminified/wp-admin/js/edit-comments.min.js
--- build-unminified/wp-admin/js/edit-comments.min.js 2018-10-08 22:57:56.801488888 -0500
+++ build-branch-unminified/wp-admin/js/edit-comments.min.js 2018-10-08 22:55:08.016150403 -0500
@@ -1,127 +1,127 @@
var setCommentsList, theList, theExtraList, commentReply;
-! function(a) {
- var b, c, d, e, f, g, h, i, j, k = document.title,
- l = a("#dashboard_right_now").length;
- b = function(a) {
- var b = parseInt(a.html().replace(/[^0-9]+/g, ""), 10);
- return isNaN(b) ? 0 : b
- }, c = function(a, b) {
- var c = "";
- if (!isNaN(b)) {
- if (b = b < 1 ? "0" : b.toString(), b.length > 3) {
- for (; b.length > 3;) c = thousandsSeparator + b.substr(b.length - 3) + c, b = b.substr(0, b.length - 3);
- b += c
+! function(L) {
+ var E, l, I, R, T, m, j, o, i, r = document.title,
+ D = L("#dashboard_right_now").length;
+ E = function(t) {
+ var e = parseInt(t.html().replace(/[^0-9]+/g, ""), 10);
+ return isNaN(e) ? 0 : e
+ }, l = function(t, e) {
+ var n = "";
+ if (!isNaN(e)) {
+ if (3 < (e = e < 1 ? "0" : e.toString()).length) {
+ for (; 3 < e.length;) n = thousandsSeparator + e.substr(e.length - 3) + n, e = e.substr(0, e.length - 3);
+ e += n
}
- a.html(b)
+ t.html(e)
}
- }, f = function(e, f) {
- var g, h, i = ".post-com-count-" + f,
- j = "comment-count-no-comments",
- k = "comment-count-approved";
- d("span.approved-count", e), f && (g = a("span." + k, i), h = a("span." + j, i), g.each(function() {
- var d = a(this),
- f = b(d) + e;
- f < 1 && (f = 0), 0 === f ? d.removeClass(k).addClass(j) : d.addClass(k).removeClass(j), c(d, f)
- }), h.each(function() {
- var b = a(this);
- e > 0 ? b.removeClass(j).addClass(k) : b.addClass(j).removeClass(k), c(b, e)
+ }, T = function(n, t) {
+ var e, a, s = ".post-com-count-" + t,
+ o = "comment-count-no-comments",
+ i = "comment-count-approved";
+ I("span.approved-count", n), t && (e = L("span." + i, s), a = L("span." + o, s), e.each(function() {
+ var t = L(this),
+ e = E(t) + n;
+ e < 1 && (e = 0), 0 === e ? t.removeClass(i).addClass(o) : t.addClass(i).removeClass(o), l(t, e)
+ }), a.each(function() {
+ var t = L(this);
+ 0 < n ? t.removeClass(o).addClass(i) : t.addClass(o).removeClass(i), l(t, n)
}))
- }, d = function(d, e) {
- a(d).each(function() {
- var d = a(this),
- f = b(d) + e;
- f < 1 && (f = 0), c(d, f)
+ }, I = function(t, n) {
+ L(t).each(function() {
+ var t = L(this),
+ e = E(t) + n;
+ e < 1 && (e = 0), l(t, e)
})
- }, h = function(b) {
- if (l && b && b.i18n_comments_text) {
- var c = a("#dashboard_right_now");
- a(".comment-count a", c).text(b.i18n_comments_text), a(".comment-mod-count a", c).text(b.i18n_moderation_text).parent()[b.in_moderation > 0 ? "removeClass" : "addClass"]("hidden")
+ }, j = function(t) {
+ if (D && t && t.i18n_comments_text) {
+ var e = L("#dashboard_right_now");
+ L(".comment-count a", e).text(t.i18n_comments_text), L(".comment-mod-count a", e).text(t.i18n_moderation_text).parent()[0 < t.in_moderation ? "removeClass" : "addClass"]("hidden")
}
- }, g = function(d) {
- var e, f, g, h;
- j = j || new RegExp(adminCommentsL10n.docTitleCommentsCount.replace("%s", "\\([0-9" + thousandsSeparator + "]+\\)") + "?"), i = i || a("<div />"), e = k, h = j.exec(document.title), h ? (h = h[0], i.html(h), g = b(i) + d) : (i.html(0), g = d), g >= 1 ? (c(i, g), (f = j.exec(document.title)) && (e = document.title.replace(f[0], adminCommentsL10n.docTitleCommentsCount.replace("%s", i.text()) + " "))) : (f = j.exec(e)) && (e = e.replace(f[0], adminCommentsL10n.docTitleComments)), document.title = e
- }, e = function(d, e) {
- var f, h, i = ".post-com-count-" + e,
- j = "comment-count-no-pending",
- k = "post-com-count-no-pending",
- m = "comment-count-pending";
- l || g(d), a("span.pending-count").each(function() {
- var e = a(this),
- f = b(e) + d;
- f < 1 && (f = 0), e.closest(".awaiting-mod")[0 === f ? "addClass" : "removeClass"]("count-0"), c(e, f)
- }), e && (f = a("span." + m, i), h = a("span." + j, i), f.each(function() {
- var e = a(this),
- f = b(e) + d;
- f < 1 && (f = 0), 0 === f ? (e.parent().addClass(k), e.removeClass(m).addClass(j)) : (e.parent().removeClass(k), e.addClass(m).removeClass(j)), c(e, f)
- }), h.each(function() {
- var b = a(this);
- d > 0 ? (b.parent().removeClass(k), b.removeClass(j).addClass(m)) : (b.parent().addClass(k), b.addClass(j).removeClass(m)), c(b, d)
+ }, m = function(t) {
+ var e, n, a, s;
+ i = i || new RegExp(adminCommentsL10n.docTitleCommentsCount.replace("%s", "\\([0-9" + thousandsSeparator + "]+\\)") + "?"), o = o || L("<div />"), e = r, 1 <= (a = (s = i.exec(document.title)) ? (s = s[0], o.html(s), E(o) + t) : (o.html(0), t)) ? (l(o, a), (n = i.exec(document.title)) && (e = document.title.replace(n[0], adminCommentsL10n.docTitleCommentsCount.replace("%s", o.text()) + " "))) : (n = i.exec(e)) && (e = e.replace(n[0], adminCommentsL10n.docTitleComments)), document.title = e
+ }, R = function(n, t) {
+ var e, a, s = ".post-com-count-" + t,
+ o = "comment-count-no-pending",
+ i = "post-com-count-no-pending",
+ r = "comment-count-pending";
+ D || m(n), L("span.pending-count").each(function() {
+ var t = L(this),
+ e = E(t) + n;
+ e < 1 && (e = 0), t.closest(".awaiting-mod")[0 === e ? "addClass" : "removeClass"]("count-0"), l(t, e)
+ }), t && (e = L("span." + r, s), a = L("span." + o, s), e.each(function() {
+ var t = L(this),
+ e = E(t) + n;
+ e < 1 && (e = 0), 0 === e ? (t.parent().addClass(i), t.removeClass(r).addClass(o)) : (t.parent().removeClass(i), t.addClass(r).removeClass(o)), l(t, e)
+ }), a.each(function() {
+ var t = L(this);
+ 0 < n ? (t.parent().removeClass(i), t.removeClass(o).addClass(r)) : (t.parent().addClass(i), t.addClass(o).removeClass(r)), l(t, n)
}))
}, setCommentsList = function() {
- var c, g, i, j, k, m, n, o, p, q = 0;
- c = a('input[name="_total"]', "#comments-form"), g = a('input[name="_per_page"]', "#comments-form"), i = a('input[name="_page"]', "#comments-form"), m = function(a, b, d) {
- b < q || (d && (q = b), c.val(a.toString()))
- }, j = function(b, c) {
- var d, g, i, j, k = a("#" + c.element);
- !0 !== c.parsed && (j = c.parsed.responses[0]), d = a("#replyrow"), g = a("#comment_ID", d).val(), i = a("#replybtn", d), k.is(".unapproved") ? (c.data.id == g && i.text(adminCommentsL10n.replyApprove), k.find(".row-actions span.view").addClass("hidden").end().find("div.comment_status").html("0")) : (c.data.id == g && i.text(adminCommentsL10n.reply), k.find(".row-actions span.view").removeClass("hidden").end().find("div.comment_status").html("1")), p = a("#" + c.element).is("." + c.dimClass) ? 1 : -1, j ? (h(j.supplemental), e(p, j.supplemental.postId), f(-1 * p, j.supplemental.postId)) : (e(p), f(-1 * p))
- }, k = function(b, d) {
- var e, f, h, j, k, l, m, n = !1,
- o = a(b.target).attr("data-wp-lists");
- return b.data._total = c.val() || 0, b.data._per_page = g.val() || 0, b.data._page = i.val() || 0, b.data._url = document.location.href, b.data.comment_status = a('input[name="comment_status"]', "#comments-form").val(), -1 != o.indexOf(":trash=1") ? n = "trash" : -1 != o.indexOf(":spam=1") && (n = "spam"), n && (f = o.replace(/.*?comment-([0-9]+).*/, "$1"), h = a("#comment-" + f), e = a("#" + n + "-undo-holder").html(), h.find(".check-column :checkbox").prop("checked", !1), h.siblings("#replyrow").length && commentReply.cid == f && commentReply.close(), h.is("tr") ? (j = h.children(":visible").length, m = a(".author strong", h).text(), k = a('<tr id="undo-' + f + '" class="undo un' + n + '" style="display:none;"><td colspan="' + j + '">' + e + "</td></tr>")) : (m = a(".comment-author", h).text(), k = a('<div id="undo-' + f + '" style="display:none;" class="undo un' + n + '">' + e + "</div>")), h.before(k), a("strong", "#undo-" + f).text(m), l = a(".undo a", "#undo-" + f), l.attr("href", "comment.php?action=un" + n + "comment&c=" + f + "&_wpnonce=" + b.data._ajax_nonce), l.attr("data-wp-lists", "delete:the-comment-list:comment-" + f + "::un" + n + "=1"), l.attr("class", "vim-z vim-destructive"), a(".avatar", h).first().clone().prependTo("#undo-" + f + " ." + n + "-undo-inside"), l.click(function(b) {
- b.preventDefault(), b.stopPropagation(), d.wpList.del(this), a("#undo-" + f).css({
+ var w, c, d, t, e, x, n, b, r, k = 0;
+ w = L('input[name="_total"]', "#comments-form"), c = L('input[name="_per_page"]', "#comments-form"), d = L('input[name="_page"]', "#comments-form"), x = function(t, e, n) {
+ e < k || (n && (k = e), w.val(t.toString()))
+ }, t = function(t, e) {
+ var n, a, s, o, i = L("#" + e.element);
+ !0 !== e.parsed && (o = e.parsed.responses[0]), n = L("#replyrow"), a = L("#comment_ID", n).val(), s = L("#replybtn", n), i.is(".unapproved") ? (e.data.id == a && s.text(adminCommentsL10n.replyApprove), i.find(".row-actions span.view").addClass("hidden").end().find("div.comment_status").html("0")) : (e.data.id == a && s.text(adminCommentsL10n.reply), i.find(".row-actions span.view").removeClass("hidden").end().find("div.comment_status").html("1")), r = L("#" + e.element).is("." + e.dimClass) ? 1 : -1, o ? (j(o.supplemental), R(r, o.supplemental.postId), T(-1 * r, o.supplemental.postId)) : (R(r), T(-1 * r))
+ }, e = function(t, e) {
+ var n, a, s, o, i, r, l, m = !1,
+ p = L(t.target).attr("data-wp-lists");
+ return t.data._total = w.val() || 0, t.data._per_page = c.val() || 0, t.data._page = d.val() || 0, t.data._url = document.location.href, t.data.comment_status = L('input[name="comment_status"]', "#comments-form").val(), -1 != p.indexOf(":trash=1") ? m = "trash" : -1 != p.indexOf(":spam=1") && (m = "spam"), m && (a = p.replace(/.*?comment-([0-9]+).*/, "$1"), s = L("#comment-" + a), n = L("#" + m + "-undo-holder").html(), s.find(".check-column :checkbox").prop("checked", !1), s.siblings("#replyrow").length && commentReply.cid == a && commentReply.close(), i = s.is("tr") ? (o = s.children(":visible").length, l = L(".author strong", s).text(), L('<tr id="undo-' + a + '" class="undo un' + m + '" style="display:none;"><td colspan="' + o + '">' + n + "</td></tr>")) : (l = L(".comment-author", s).text(), L('<div id="undo-' + a + '" style="display:none;" class="undo un' + m + '">' + n + "</div>")), s.before(i), L("strong", "#undo-" + a).text(l), (r = L(".undo a", "#undo-" + a)).attr("href", "comment.php?action=un" + m + "comment&c=" + a + "&_wpnonce=" + t.data._ajax_nonce), r.attr("data-wp-lists", "delete:the-comment-list:comment-" + a + "::un" + m + "=1"), r.attr("class", "vim-z vim-destructive"), L(".avatar", s).first().clone().prependTo("#undo-" + a + " ." + m + "-undo-inside"), r.click(function(t) {
+ t.preventDefault(), t.stopPropagation(), e.wpList.del(this), L("#undo-" + a).css({
backgroundColor: "#ceb"
}).fadeOut(350, function() {
- a(this).remove(), a("#comment-" + f).css("backgroundColor", "").fadeIn(300, function() {
- a(this).show()
+ L(this).remove(), L("#comment-" + a).css("backgroundColor", "").fadeIn(300, function() {
+ L(this).show()
})
})
- })), b
- }, n = function(g, i) {
- var j, k, n, p, r, s, t, u, v = !0 === i.parsed ? {} : i.parsed.responses[0],
- w = !0 === i.parsed ? "" : v.supplemental.status,
- x = !0 === i.parsed ? "" : v.supplemental.postId,
- y = !0 === i.parsed ? "" : v.supplemental,
- z = a(i.target).parent(),
- A = a("#" + i.element),
- B = A.hasClass("approved"),
- C = A.hasClass("unapproved"),
- D = A.hasClass("spam"),
- E = A.hasClass("trash"),
- F = !1;
- h(y), z.is("span.undo") ? (z.hasClass("unspam") ? (r = -1, "trash" === w ? s = 1 : "1" === w ? u = 1 : "0" === w && (t = 1)) : z.hasClass("untrash") && (s = -1, "spam" === w ? r = 1 : "1" === w ? u = 1 : "0" === w && (t = 1)), F = !0) : z.is("span.spam") ? (B ? u = -1 : C ? t = -1 : E && (s = -1), r = 1) : z.is("span.unspam") ? (B ? t = 1 : C ? u = 1 : E ? z.hasClass("approve") ? u = 1 : z.hasClass("unapprove") && (t = 1) : D && (z.hasClass("approve") ? u = 1 : z.hasClass("unapprove") && (t = 1)), r = -1) : z.is("span.trash") ? (B ? u = -1 : C ? t = -1 : D && (r = -1), s = 1) : z.is("span.untrash") ? (B ? t = 1 : C ? u = 1 : E && (z.hasClass("approve") ? u = 1 : z.hasClass("unapprove") && (t = 1)), s = -1) : z.is("span.approve:not(.unspam):not(.untrash)") ? (u = 1, t = -1) : z.is("span.unapprove:not(.unspam):not(.untrash)") ? (u = -1, t = 1) : z.is("span.delete") && (D ? r = -1 : E && (s = -1)), t && (e(t, x), d("span.all-count", t)), u && (f(u, x), d("span.all-count", u)), r && d("span.spam-count", r), s && d("span.trash-count", s), ("trash" === i.data.comment_status && !b(a("span.trash-count")) || "spam" === i.data.comment_status && !b(a("span.spam-count"))) && a("#delete_all").hide(), l || (k = c.val() ? parseInt(c.val(), 10) : 0, a(i.target).parent().is("span.undo") ? k++ : k--, k < 0 && (k = 0), "object" == typeof g ? v.supplemental.total_items_i18n && q < v.supplemental.time ? (j = v.supplemental.total_items_i18n || "", j && (a(".displaying-num").text(j), a(".total-pages").text(v.supplemental.total_pages_i18n), a(".tablenav-pages").find(".next-page, .last-page").toggleClass("disabled", v.supplemental.total_pages == a(".current-page").val())), m(k, v.supplemental.time, !0)) : v.supplemental.time && m(k, v.supplemental.time, !1) : m(k, g, !1)), theExtraList && 0 !== theExtraList.length && 0 !== theExtraList.children().length && !F && (theList.get(0).wpList.add(theExtraList.children(":eq(0):not(.no-items)").remove().clone()), o(), n = a(":animated", "#the-comment-list"), p = function() {
- a("#the-comment-list tr:visible").length || theList.get(0).wpList.add(theExtraList.find(".no-items").clone())
- }, n.length ? n.promise().done(p) : p())
- }, o = function(b) {
- var c = a.query.get(),
- d = a(".total-pages").text(),
- e = a('input[name="_per_page"]', "#comments-form").val();
- c.paged || (c.paged = 1), c.paged > d || (b ? (theExtraList.empty(), c.number = Math.min(8, e)) : (c.number = 1, c.offset = Math.min(8, e) - 1), c.no_placeholder = !0, c.paged++, !0 === c.comment_type && (c.comment_type = ""), c = a.extend(c, {
+ })), t
+ }, n = function(t, e) {
+ var n, a, s, o, i, r, l, m, p = !0 === e.parsed ? {} : e.parsed.responses[0],
+ c = !0 === e.parsed ? "" : p.supplemental.status,
+ d = !0 === e.parsed ? "" : p.supplemental.postId,
+ u = !0 === e.parsed ? "" : p.supplemental,
+ h = L(e.target).parent(),
+ v = L("#" + e.element),
+ f = v.hasClass("approved"),
+ g = v.hasClass("unapproved"),
+ C = v.hasClass("spam"),
+ _ = v.hasClass("trash"),
+ y = !1;
+ j(u), h.is("span.undo") ? (h.hasClass("unspam") ? (i = -1, "trash" === c ? r = 1 : "1" === c ? m = 1 : "0" === c && (l = 1)) : h.hasClass("untrash") && (r = -1, "spam" === c ? i = 1 : "1" === c ? m = 1 : "0" === c && (l = 1)), y = !0) : h.is("span.spam") ? (f ? m = -1 : g ? l = -1 : _ && (r = -1), i = 1) : h.is("span.unspam") ? (f ? l = 1 : g ? m = 1 : _ ? h.hasClass("approve") ? m = 1 : h.hasClass("unapprove") && (l = 1) : C && (h.hasClass("approve") ? m = 1 : h.hasClass("unapprove") && (l = 1)), i = -1) : h.is("span.trash") ? (f ? m = -1 : g ? l = -1 : C && (i = -1), r = 1) : h.is("span.untrash") ? (f ? l = 1 : g ? m = 1 : _ && (h.hasClass("approve") ? m = 1 : h.hasClass("unapprove") && (l = 1)), r = -1) : h.is("span.approve:not(.unspam):not(.untrash)") ? l = -(m = 1) : h.is("span.unapprove:not(.unspam):not(.untrash)") ? (m = -1, l = 1) : h.is("span.delete") && (C ? i = -1 : _ && (r = -1)), l && (R(l, d), I("span.all-count", l)), m && (T(m, d), I("span.all-count", m)), i && I("span.spam-count", i), r && I("span.trash-count", r), ("trash" === e.data.comment_status && !E(L("span.trash-count")) || "spam" === e.data.comment_status && !E(L("span.spam-count"))) && L("#delete_all").hide(), D || (a = w.val() ? parseInt(w.val(), 10) : 0, L(e.target).parent().is("span.undo") ? a++ : a--, a < 0 && (a = 0), "object" == typeof t ? p.supplemental.total_items_i18n && k < p.supplemental.time ? ((n = p.supplemental.total_items_i18n || "") && (L(".displaying-num").text(n), L(".total-pages").text(p.supplemental.total_pages_i18n), L(".tablenav-pages").find(".next-page, .last-page").toggleClass("disabled", p.supplemental.total_pages == L(".current-page").val())), x(a, p.supplemental.time, !0)) : p.supplemental.time && x(a, p.supplemental.time, !1) : x(a, t, !1)), theExtraList && 0 !== theExtraList.length && 0 !== theExtraList.children().length && !y && (theList.get(0).wpList.add(theExtraList.children(":eq(0):not(.no-items)").remove().clone()), b(), o = function() {
+ L("#the-comment-list tr:visible").length || theList.get(0).wpList.add(theExtraList.find(".no-items").clone())
+ }, (s = L(":animated", "#the-comment-list")).length ? s.promise().done(o) : o())
+ }, b = function(t) {
+ var e = L.query.get(),
+ n = L(".total-pages").text(),
+ a = L('input[name="_per_page"]', "#comments-form").val();
+ e.paged || (e.paged = 1), e.paged > n || (t ? (theExtraList.empty(), e.number = Math.min(8, a)) : (e.number = 1, e.offset = Math.min(8, a) - 1), e.no_placeholder = !0, e.paged++, !0 === e.comment_type && (e.comment_type = ""), e = L.extend(e, {
action: "fetch-list",
list_args: list_args,
- _ajax_fetch_list_nonce: a("#_ajax_fetch_list_nonce").val()
- }), a.ajax({
+ _ajax_fetch_list_nonce: L("#_ajax_fetch_list_nonce").val()
+ }), L.ajax({
url: ajaxurl,
global: !1,
dataType: "json",
- data: c,
- success: function(a) {
- theExtraList.get(0).wpList.add(a.rows)
+ data: e,
+ success: function(t) {
+ theExtraList.get(0).wpList.add(t.rows)
}
}))
- }, theExtraList = a("#the-extra-comment-list").wpList({
+ }, theExtraList = L("#the-extra-comment-list").wpList({
alt: "",
delColor: "none",
addColor: "none"
- }), theList = a("#the-comment-list").wpList({
+ }), theList = L("#the-comment-list").wpList({
alt: "",
- delBefore: k,
- dimAfter: j,
+ delBefore: e,
+ dimAfter: t,
delAfter: n,
addColor: "none"
- }).bind("wpListDelEnd", function(b, c) {
- var d = a(c.target).attr("data-wp-lists"),
- e = c.element.replace(/[^0-9]+/g, ""); - 1 == d.indexOf(":trash=1") && -1 == d.indexOf(":spam=1") || a("#undo-" + e).fadeIn(300, function() {
- a(this).show()
+ }).bind("wpListDelEnd", function(t, e) {
+ var n = L(e.target).attr("data-wp-lists"),
+ a = e.element.replace(/[^0-9]+/g, ""); - 1 == n.indexOf(":trash=1") && -1 == n.indexOf(":spam=1") || L("#undo-" + a).fadeIn(300, function() {
+ L(this).show()
})
})
}, commentReply = {
@@ -129,144 +129,142 @@
act: "",
originalContent: "",
init: function() {
- var b = a("#replyrow");
- a("a.cancel", b).click(function() {
+ var t = L("#replyrow");
+ L("a.cancel", t).click(function() {
return commentReply.revert()
- }), a("a.save", b).click(function() {
+ }), L("a.save", t).click(function() {
return commentReply.send()
- }), a("input#author-name, input#author-email, input#author-url", b).keypress(function(a) {
- if (13 == a.which) return commentReply.send(), a.preventDefault(), !1
- }), a("#the-comment-list .column-comment > p").dblclick(function() {
- commentReply.toggle(a(this).parent())
- }), a("#doaction, #doaction2, #post-query-submit").click(function() {
- a("#the-comment-list #replyrow").length > 0 && commentReply.close()
- }), this.comments_listing = a('#comments-form > input[name="comment_status"]').val() || ""
+ }), L("input#author-name, input#author-email, input#author-url", t).keypress(function(t) {
+ if (13 == t.which) return commentReply.send(), t.preventDefault(), !1
+ }), L("#the-comment-list .column-comment > p").dblclick(function() {
+ commentReply.toggle(L(this).parent())
+ }), L("#doaction, #doaction2, #post-query-submit").click(function() {
+ 0 < L("#the-comment-list #replyrow").length && commentReply.close()
+ }), this.comments_listing = L('#comments-form > input[name="comment_status"]').val() || ""
},
- addEvents: function(b) {
- b.each(function() {
- a(this).find(".column-comment > p").dblclick(function() {
- commentReply.toggle(a(this).parent())
+ addEvents: function(t) {
+ t.each(function() {
+ L(this).find(".column-comment > p").dblclick(function() {
+ commentReply.toggle(L(this).parent())
})
})
},
- toggle: function(b) {
- "none" !== a(b).css("display") && (a("#replyrow").parent().is("#com-reply") || window.confirm(adminCommentsL10n.warnQuickEdit)) && a(b).find("a.vim-q").click()
+ toggle: function(t) {
+ "none" !== L(t).css("display") && (L("#replyrow").parent().is("#com-reply") || window.confirm(adminCommentsL10n.warnQuickEdit)) && L(t).find("a.vim-q").click()
},
revert: function() {
- return !(a("#the-comment-list #replyrow").length < 1) && (a("#replyrow").fadeOut("fast", function() {
+ return L("#the-comment-list #replyrow").length < 1 || L("#replyrow").fadeOut("fast", function() {
commentReply.close()
- }), !1)
+ }), !1
},
close: function() {
- var b, c = a("#replyrow");
- c.parent().is("#com-reply") || (this.cid && "edit-comment" == this.act && (b = a("#comment-" + this.cid), b.fadeIn(300, function() {
- b.show()
- }).css("backgroundColor", "")), "undefined" != typeof QTags && QTags.closeAllTags("replycontent"), a("#add-new-comment").css("display", ""), c.hide(), a("#com-reply").append(c), a("#replycontent").css("height", "").val(""), a("#edithead input").val(""), a(".notice-error", c).addClass("hidden").find(".error").empty(), a(".spinner", c).removeClass("is-active"), this.cid = "", this.originalContent = "")
+ var t, e = L("#replyrow");
+ e.parent().is("#com-reply") || (this.cid && "edit-comment" == this.act && (t = L("#comment-" + this.cid)).fadeIn(300, function() {
+ t.show()
+ }).css("backgroundColor", ""), "undefined" != typeof QTags && QTags.closeAllTags("replycontent"), L("#add-new-comment").css("display", ""), e.hide(), L("#com-reply").append(e), L("#replycontent").css("height", "").val(""), L("#edithead input").val(""), L(".notice-error", e).addClass("hidden").find(".error").empty(), L(".spinner", e).removeClass("is-active"), this.cid = "", this.originalContent = "")
},
- open: function(b, c, d) {
- var e, f, g, h, i, j = this,
- k = a("#comment-" + b),
- l = k.height(),
- m = 0;
- return !!this.discardCommentChanges() && (j.close(), j.cid = b, e = a("#replyrow"), f = a("#inline-" + b), d = d || "replyto", g = "edit" == d ? "edit" : "replyto", g = j.act = g + "-comment", j.originalContent = a("textarea.comment", f).val(), m = a("> th:visible, > td:visible", k).length, e.hasClass("inline-edit-row") && 0 !== m && a("td", e).attr("colspan", m), a("#action", e).val(g), a("#comment_post_ID", e).val(c), a("#comment_ID", e).val(b), "edit" == d ? (a("#author-name", e).val(a("div.author", f).text()), a("#author-email", e).val(a("div.author-email", f).text()), a("#author-url", e).val(a("div.author-url", f).text()), a("#status", e).val(a("div.comment_status", f).text()), a("#replycontent", e).val(a("textarea.comment", f).val()), a("#edithead, #editlegend, #savebtn", e).show(), a("#replyhead, #replybtn, #addhead, #addbtn", e).hide(), l > 120 && (i = l > 500 ? 500 : l, a("#replycontent", e).css("height", i + "px")), k.after(e).fadeOut("fast", function() {
- a("#replyrow").fadeIn(300, function() {
- a(this).show()
+ open: function(t, e, n) {
+ var a, s, o, i, r, l, m = L("#comment-" + t),
+ p = m.height();
+ return this.discardCommentChanges() && (this.close(), this.cid = t, a = L("#replyrow"), s = L("#inline-" + t), o = "edit" == (n = n || "replyto") ? "edit" : "replyto", o = this.act = o + "-comment", this.originalContent = L("textarea.comment", s).val(), l = L("> th:visible, > td:visible", m).length, a.hasClass("inline-edit-row") && 0 !== l && L("td", a).attr("colspan", l), L("#action", a).val(o), L("#comment_post_ID", a).val(e), L("#comment_ID", a).val(t), "edit" == n ? (L("#author-name", a).val(L("div.author", s).text()), L("#author-email", a).val(L("div.author-email", s).text()), L("#author-url", a).val(L("div.author-url", s).text()), L("#status", a).val(L("div.comment_status", s).text()), L("#replycontent", a).val(L("textarea.comment", s).val()), L("#edithead, #editlegend, #savebtn", a).show(), L("#replyhead, #replybtn, #addhead, #addbtn", a).hide(), 120 < p && (r = 500 < p ? 500 : p, L("#replycontent", a).css("height", r + "px")), m.after(a).fadeOut("fast", function() {
+ L("#replyrow").fadeIn(300, function() {
+ L(this).show()
})
- })) : "add" == d ? (a("#addhead, #addbtn", e).show(), a("#replyhead, #replybtn, #edithead, #editlegend, #savebtn", e).hide(), a("#the-comment-list").prepend(e), a("#replyrow").fadeIn(300)) : (h = a("#replybtn", e), a("#edithead, #editlegend, #savebtn, #addhead, #addbtn", e).hide(), a("#replyhead, #replybtn", e).show(), k.after(e), k.hasClass("unapproved") ? h.text(adminCommentsL10n.replyApprove) : h.text(adminCommentsL10n.reply), a("#replyrow").fadeIn(300, function() {
- a(this).show()
+ })) : "add" == n ? (L("#addhead, #addbtn", a).show(), L("#replyhead, #replybtn, #edithead, #editlegend, #savebtn", a).hide(), L("#the-comment-list").prepend(a), L("#replyrow").fadeIn(300)) : (i = L("#replybtn", a), L("#edithead, #editlegend, #savebtn, #addhead, #addbtn", a).hide(), L("#replyhead, #replybtn", a).show(), m.after(a), m.hasClass("unapproved") ? i.text(adminCommentsL10n.replyApprove) : i.text(adminCommentsL10n.reply), L("#replyrow").fadeIn(300, function() {
+ L(this).show()
})), setTimeout(function() {
- var b, c, d, e, f;
- b = a("#replyrow").offset().top, c = b + a("#replyrow").height(), d = window.pageYOffset || document.documentElement.scrollTop, e = document.documentElement.clientHeight || window.innerHeight || 0, f = d + e, f - 20 < c ? window.scroll(0, c - e + 35) : b - 20 < d && window.scroll(0, b - 35), a("#replycontent").focus().keyup(function(a) {
- 27 == a.which && commentReply.revert()
+ var t, e, n, a;
+ e = (t = L("#replyrow").offset().top) + L("#replyrow").height(), (n = window.pageYOffset || document.documentElement.scrollTop) + (a = document.documentElement.clientHeight || window.innerHeight || 0) - 20 < e ? window.scroll(0, e - a + 35) : t - 20 < n && window.scroll(0, t - 35), L("#replycontent").focus().keyup(function(t) {
+ 27 == t.which && commentReply.revert()
})
- }, 600), !1)
+ }, 600)), !1
},
send: function() {
- var b = {};
- return a("#replysubmit .error-notice").addClass("hidden"), a("#replysubmit .spinner").addClass("is-active"), a("#replyrow input").not(":button").each(function() {
- var c = a(this);
- b[c.attr("name")] = c.val()
- }), b.content = a("#replycontent").val(), b.id = b.comment_post_ID, b.comments_listing = this.comments_listing, b.p = a('[name="p"]').val(), a("#comment-" + a("#comment_ID").val()).hasClass("unapproved") && (b.approve_parent = 1), a.ajax({
+ var e = {};
+ return L("#replysubmit .error-notice").addClass("hidden"), L("#replysubmit .spinner").addClass("is-active"), L("#replyrow input").not(":button").each(function() {
+ var t = L(this);
+ e[t.attr("name")] = t.val()
+ }), e.content = L("#replycontent").val(), e.id = e.comment_post_ID, e.comments_listing = this.comments_listing, e.p = L('[name="p"]').val(), L("#comment-" + L("#comment_ID").val()).hasClass("unapproved") && (e.approve_parent = 1), L.ajax({
type: "POST",
url: ajaxurl,
- data: b,
- success: function(a) {
- commentReply.show(a)
+ data: e,
+ success: function(t) {
+ commentReply.show(t)
},
- error: function(a) {
- commentReply.error(a)
+ error: function(t) {
+ commentReply.error(t)
}
}), !1
},
- show: function(b) {
- var c, g, i, j, k, m = this;
- return "string" == typeof b ? (m.error({
- responseText: b
- }), !1) : (c = wpAjax.parseAjaxResponse(b), c.errors ? (m.error({
+ show: function(t) {
+ var e, n, a, s, o, i = this;
+ return "string" == typeof t ? (i.error({
+ responseText: t
+ }), !1) : (e = wpAjax.parseAjaxResponse(t)).errors ? (i.error({
responseText: wpAjax.broken
- }), !1) : (m.revert(), c = c.responses[0], i = "#comment-" + c.id, "edit-comment" == m.act && a(i).remove(), c.supplemental.parent_approved && (k = a("#comment-" + c.supplemental.parent_approved), e(-1, c.supplemental.parent_post_id), "moderated" == this.comments_listing) ? void k.animate({
+ }), !1) : (i.revert(), a = "#comment-" + (e = e.responses[0]).id, "edit-comment" == i.act && L(a).remove(), void(e.supplemental.parent_approved && (o = L("#comment-" + e.supplemental.parent_approved), R(-1, e.supplemental.parent_post_id), "moderated" == this.comments_listing) ? o.animate({
backgroundColor: "#CCEEBB"
}, 400, function() {
- k.fadeOut()
- }) : (c.supplemental.i18n_comments_text && (l ? h(c.supplemental) : (f(1, c.supplemental.parent_post_id), d("span.all-count", 1))), g = a.trim(c.data), a(g).hide(), a("#replyrow").after(g), i = a(i), m.addEvents(i), j = i.hasClass("unapproved") ? "#FFFFE0" : i.closest(".widefat, .postbox").css("backgroundColor"), void i.animate({
+ o.fadeOut()
+ }) : (e.supplemental.i18n_comments_text && (D ? j(e.supplemental) : (T(1, e.supplemental.parent_post_id), I("span.all-count", 1))), n = L.trim(e.data), L(n).hide(), L("#replyrow").after(n), a = L(a), i.addEvents(a), s = a.hasClass("unapproved") ? "#FFFFE0" : a.closest(".widefat, .postbox").css("backgroundColor"), a.animate({
backgroundColor: "#CCEEBB"
}, 300).animate({
- backgroundColor: j
+ backgroundColor: s
}, 300, function() {
- k && k.length && k.animate({
+ o && o.length && o.animate({
backgroundColor: "#CCEEBB"
}, 300).animate({
- backgroundColor: j
+ backgroundColor: s
}, 300).removeClass("unapproved").addClass("approved").find("div.comment_status").html("1")
}))))
},
- error: function(b) {
- var c = b.statusText,
- d = a("#replysubmit .notice-error"),
- e = d.find(".error");
- a("#replysubmit .spinner").removeClass("is-active"), b.responseText && (c = b.responseText.replace(/<.[^<>]*?>/g, "")), c && (d.removeClass("hidden"), e.html(c))
+ error: function(t) {
+ var e = t.statusText,
+ n = L("#replysubmit .notice-error"),
+ a = n.find(".error");
+ L("#replysubmit .spinner").removeClass("is-active"), t.responseText && (e = t.responseText.replace(/<.[^<>]*?>/g, "")), e && (n.removeClass("hidden"), a.html(e))
},
- addcomment: function(b) {
- var c = this;
- a("#add-new-comment").fadeOut(200, function() {
- c.open(0, b, "add"), a("table.comments-box").css("display", ""), a("#no-comments").remove()
+ addcomment: function(t) {
+ var e = this;
+ L("#add-new-comment").fadeOut(200, function() {
+ e.open(0, t, "add"), L("table.comments-box").css("display", ""), L("#no-comments").remove()
})
},
discardCommentChanges: function() {
- var b = a("#replyrow");
- return this.originalContent === a("#replycontent", b).val() || window.confirm(adminCommentsL10n.warnCommentChanges)
+ var t = L("#replyrow");
+ return this.originalContent === L("#replycontent", t).val() || window.confirm(adminCommentsL10n.warnCommentChanges)
}
- }, a(document).ready(function() {
- var b, c, d, e;
- setCommentsList(), commentReply.init(), a(document).on("click", "span.delete a.delete", function(a) {
- a.preventDefault()
- }), "undefined" != typeof a.table_hotkeys && (b = function(b) {
+ }, L(document).ready(function() {
+ var t, e, n, a;
+ setCommentsList(), commentReply.init(), L(document).on("click", "span.delete a.delete", function(t) {
+ t.preventDefault()
+ }), void 0 !== L.table_hotkeys && (t = function(n) {
return function() {
- var c, d;
- c = "next" == b ? "first" : "last", d = a(".tablenav-pages ." + b + "-page:not(.disabled)"), d.length && (window.location = d[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, "") + "&hotkeys_highlight_" + c + "=1")
+ var t, e;
+ t = "next" == n ? "first" : "last", (e = L(".tablenav-pages ." + n + "-page:not(.disabled)")).length && (window.location = e[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, "") + "&hotkeys_highlight_" + t + "=1")
}
- }, c = function(b, c) {
- window.location = a("span.edit a", c).attr("href")
- }, d = function() {
- a("#cb-select-all-1").data("wp-toggle", 1).trigger("click").removeData("wp-toggle")
- }, e = function(b) {
+ }, e = function(t, e) {
+ window.location = L("span.edit a", e).attr("href")
+ }, n = function() {
+ L("#cb-select-all-1").data("wp-toggle", 1).trigger("click").removeData("wp-toggle")
+ }, a = function(e) {
return function() {
- var c = a('select[name="action"]');
- a('option[value="' + b + '"]', c).prop("selected", !0), a("#doaction").click()
+ var t = L('select[name="action"]');
+ L('option[value="' + e + '"]', t).prop("selected", !0), L("#doaction").click()
}
- }, a.table_hotkeys(a("table.widefat"), ["a", "u", "s", "d", "r", "q", "z", ["e", c],
- ["shift+x", d],
- ["shift+a", e("approve")],
- ["shift+s", e("spam")],
- ["shift+d", e("delete")],
- ["shift+t", e("trash")],
- ["shift+z", e("untrash")],
- ["shift+u", e("unapprove")]
+ }, L.table_hotkeys(L("table.widefat"), ["a", "u", "s", "d", "r", "q", "z", ["e", e],
+ ["shift+x", n],
+ ["shift+a", a("approve")],
+ ["shift+s", a("spam")],
+ ["shift+d", a("delete")],
+ ["shift+t", a("trash")],
+ ["shift+z", a("untrash")],
+ ["shift+u", a("unapprove")]
], {
highlight_first: adminCommentsL10n.hotkeys_highlight_first,
highlight_last: adminCommentsL10n.hotkeys_highlight_last,
- prev_page_link_cb: b("prev"),
- next_page_link_cb: b("next"),
+ prev_page_link_cb: t("prev"),
+ next_page_link_cb: t("next"),
hotkeys_opts: {
disableInInput: !0,
type: "keypress",
@@ -274,11 +272,11 @@
},
cycle_expr: "#the-comment-list tr",
start_row_index: 0
- })), a("#the-comment-list").on("click", ".comment-inline", function(b) {
- b.preventDefault();
- var c = a(this),
- d = "replyto";
- void 0 !== c.data("action") && (d = c.data("action")), commentReply.open(c.data("commentId"), c.data("postId"), d)
+ })), L("#the-comment-list").on("click", ".comment-inline", function(t) {
+ t.preventDefault();
+ var e = L(this),
+ n = "replyto";
+ void 0 !== e.data("action") && (n = e.data("action")), commentReply.open(e.data("commentId"), e.data("postId"), n)
})
})
}(jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/editor-expand.min.js build-branch-unminified/wp-admin/js/editor-expand.min.js
--- build-unminified/wp-admin/js/editor-expand.min.js 2018-10-08 22:57:53.865465635 -0500
+++ build-branch-unminified/wp-admin/js/editor-expand.min.js 2018-10-08 22:55:05.564130932 -0500
@@ -1,449 +1,427 @@
-! function(a, b, c) {
+! function(L, M, t) {
"use strict";
- var d = b(a),
- e = b(document),
- f = b("#wpadminbar"),
- g = b("#wpfooter");
- b(function() {
- function c() {
- var a = x.value.length;
- o && !o.isHidden() || (o || "tinymce" !== R) && (a < y ? U() : parseInt(x.style.height, 10) < x.scrollHeight && (x.style.height = Math.ceil(x.scrollHeight) + "px", i()), y = a)
- }
-
- function h() {
- var a = d.width();
- T = {
- windowHeight: d.height(),
- windowWidth: a,
- adminBarHeight: a > 600 ? f.outerHeight() : 0,
- toolsHeight: s.outerHeight() || 0,
- menuBarHeight: A.outerHeight() || 0,
- visualTopHeight: t.outerHeight() || 0,
- textTopHeight: v.outerHeight() || 0,
- bottomHeight: z.outerHeight() || 0,
- statusBarHeight: B.outerHeight() || 0,
- sideSortablesHeight: C.height() || 0
- }, T.menuBarHeight < 3 && (T.menuBarHeight = 0)
- }
-
- function i(b) {
- if (!F || !F.settings.visible) {
- var f, i, j, k, l, m, n, p, q, x = d.scrollTop(),
- y = b && b.type,
- G = "scroll" !== y,
- H = o && !o.isHidden(),
- N = Q,
- R = E.offset().top,
- U = r.width();
- !G && T.windowHeight || h(), H || "resize" !== y || c(), H ? (f = t, i = u, n = T.visualTopHeight) : (f = v, i = w, n = T.textTopHeight), (H || f.length) && (m = f.parent().offset().top, p = i.offset().top, q = i.outerHeight(), l = H ? Q + n : Q + 20, l = q > l + 5, l ? ((!I || G) && x >= m - T.toolsHeight - T.adminBarHeight && x <= m - T.toolsHeight - T.adminBarHeight + q - N ? (I = !0, s.css({
+ var V = M(L),
+ N = M(document),
+ j = M("#wpadminbar"),
+ q = M("#wpfooter");
+ M(function() {
+ var w, e, u = M("#postdivrich"),
+ H = M("#wp-content-wrap"),
+ b = M("#wp-content-editor-tools"),
+ v = M(),
+ x = M(),
+ y = M("#ed_toolbar"),
+ T = M("#content"),
+ i = T[0],
+ o = 0,
+ B = M("#post-status-info"),
+ C = M(),
+ S = M(),
+ O = M("#side-sortables"),
+ z = M("#postbox-container-1"),
+ E = M("#post-body"),
+ k = L.wp.editor && L.wp.editor.fullscreen,
+ r = function() {},
+ l = function() {},
+ A = !1,
+ W = !1,
+ K = !1,
+ R = !1,
+ Y = 0,
+ U = 56,
+ D = 20,
+ P = 300,
+ n = H.hasClass("tmce-active") ? "tinymce" : "html",
+ X = !!parseInt(L.getUserSetting("hidetb"), 10),
+ F = {
+ windowHeight: 0,
+ windowWidth: 0,
+ adminBarHeight: 0,
+ toolsHeight: 0,
+ menuBarHeight: 0,
+ visualTopHeight: 0,
+ textTopHeight: 0,
+ bottomHeight: 0,
+ statusBarHeight: 0,
+ sideSortablesHeight: 0
+ },
+ s = L._.throttle(function() {
+ var t = L.scrollX || document.documentElement.scrollLeft,
+ e = L.scrollY || document.documentElement.scrollTop,
+ o = parseInt(i.style.height, 10);
+ i.style.height = P + "px", i.scrollHeight > P && (i.style.height = i.scrollHeight + "px"), void 0 !== t && L.scrollTo(t, e), i.scrollHeight < o && p()
+ }, 300);
+
+ function I() {
+ var t = i.value.length;
+ w && !w.isHidden() || (w || "tinymce" !== n) && (t < o ? s() : parseInt(i.style.height, 10) < i.scrollHeight && (i.style.height = Math.ceil(i.scrollHeight) + "px", p()), o = t)
+ }
+
+ function p(t) {
+ if (!k || !k.settings.visible) {
+ var e, o, i, n, s, f, a, d, c, u = V.scrollTop(),
+ r = t && t.type,
+ l = "scroll" !== r,
+ p = w && !w.isHidden(),
+ g = P,
+ h = E.offset().top,
+ m = H.width();
+ !l && F.windowHeight || (c = V.width(), (F = {
+ windowHeight: V.height(),
+ windowWidth: c,
+ adminBarHeight: 600 < c ? j.outerHeight() : 0,
+ toolsHeight: b.outerHeight() || 0,
+ menuBarHeight: C.outerHeight() || 0,
+ visualTopHeight: v.outerHeight() || 0,
+ textTopHeight: y.outerHeight() || 0,
+ bottomHeight: B.outerHeight() || 0,
+ statusBarHeight: S.outerHeight() || 0,
+ sideSortablesHeight: O.height() || 0
+ }).menuBarHeight < 3 && (F.menuBarHeight = 0)), p || "resize" !== r || I(), f = p ? (e = v, o = x, F.visualTopHeight) : (e = y, o = T, F.textTopHeight), (p || e.length) && (s = e.parent().offset().top, a = o.offset().top, d = o.outerHeight(), (p ? P + f : P + 20) + 5 < d ? ((!A || l) && u >= s - F.toolsHeight - F.adminBarHeight && u <= s - F.toolsHeight - F.adminBarHeight + d - g ? (A = !0, b.css({
position: "fixed",
- top: T.adminBarHeight,
- width: U
- }), H && A.length && A.css({
+ top: F.adminBarHeight,
+ width: m
+ }), p && C.length && C.css({
position: "fixed",
- top: T.adminBarHeight + T.toolsHeight,
- width: U - 2 - (H ? 0 : f.outerWidth() - f.width())
- }), f.css({
+ top: F.adminBarHeight + F.toolsHeight,
+ width: m - 2 - (p ? 0 : e.outerWidth() - e.width())
+ }), e.css({
position: "fixed",
- top: T.adminBarHeight + T.toolsHeight + T.menuBarHeight,
- width: U - 2 - (H ? 0 : f.outerWidth() - f.width())
- })) : (I || G) && (x <= m - T.toolsHeight - T.adminBarHeight ? (I = !1, s.css({
+ top: F.adminBarHeight + F.toolsHeight + F.menuBarHeight,
+ width: m - 2 - (p ? 0 : e.outerWidth() - e.width())
+ })) : (A || l) && (u <= s - F.toolsHeight - F.adminBarHeight ? (A = !1, b.css({
position: "absolute",
top: 0,
- width: U
- }), H && A.length && A.css({
+ width: m
+ }), p && C.length && C.css({
position: "absolute",
top: 0,
- width: U - 2
- }), f.css({
+ width: m - 2
+ }), e.css({
position: "absolute",
- top: T.menuBarHeight,
- width: U - 2 - (H ? 0 : f.outerWidth() - f.width())
- })) : x >= m - T.toolsHeight - T.adminBarHeight + q - N && (I = !1, s.css({
- position: "absolute",
- top: q - N,
- width: U
- }), H && A.length && A.css({
- position: "absolute",
- top: q - N,
- width: U - 2
- }), f.css({
- position: "absolute",
- top: q - N + T.menuBarHeight,
- width: U - 2 - (H ? 0 : f.outerWidth() - f.width())
- }))), (!J || G && S) && x + T.windowHeight <= p + q + T.bottomHeight + T.statusBarHeight + 1 ? b && b.deltaHeight > 0 && b.deltaHeight < 100 ? a.scrollBy(0, b.deltaHeight) : H && S && (J = !0, B.css({
+ top: F.menuBarHeight,
+ width: m - 2 - (p ? 0 : e.outerWidth() - e.width())
+ })) : u >= s - F.toolsHeight - F.adminBarHeight + d - g && (A = !1, b.css({
+ position: "absolute",
+ top: d - g,
+ width: m
+ }), p && C.length && C.css({
+ position: "absolute",
+ top: d - g,
+ width: m - 2
+ }), e.css({
+ position: "absolute",
+ top: d - g + F.menuBarHeight,
+ width: m - 2 - (p ? 0 : e.outerWidth() - e.width())
+ }))), (!W || l && X) && u + F.windowHeight <= a + d + F.bottomHeight + F.statusBarHeight + 1 ? t && 0 < t.deltaHeight && t.deltaHeight < 100 ? L.scrollBy(0, t.deltaHeight) : p && X && (W = !0, S.css({
position: "fixed",
- bottom: T.bottomHeight,
+ bottom: F.bottomHeight,
visibility: "",
- width: U - 2
- }), z.css({
+ width: m - 2
+ }), B.css({
position: "fixed",
bottom: 0,
- width: U
- })) : (!S && J || (J || G) && x + T.windowHeight > p + q + T.bottomHeight + T.statusBarHeight - 1) && (J = !1, B.attr("style", S ? "" : "visibility: hidden;"), z.attr("style", ""))) : G && (s.css({
+ width: m
+ })) : (!X && W || (W || l) && u + F.windowHeight > a + d + F.bottomHeight + F.statusBarHeight - 1) && (W = !1, S.attr("style", X ? "" : "visibility: hidden;"), B.attr("style", ""))) : l && (b.css({
position: "absolute",
top: 0,
- width: U
- }), H && A.length && A.css({
+ width: m
+ }), p && C.length && C.css({
position: "absolute",
top: 0,
- width: U - 2
- }), f.css({
+ width: m - 2
+ }), e.css({
position: "absolute",
- top: T.menuBarHeight,
- width: U - 2 - (H ? 0 : f.outerWidth() - f.width())
- }), B.attr("style", S ? "" : "visibility: hidden;"), z.attr("style", "")), D.width() < 300 && T.windowWidth > 600 && e.height() > C.height() + R + 120 && T.windowHeight < q ? (T.sideSortablesHeight + O + P > T.windowHeight || K || L ? x + O <= R ? (C.attr("style", ""), K = L = !1) : x > M ? K ? (K = !1, j = C.offset().top - T.adminBarHeight, k = g.offset().top, k < j + T.sideSortablesHeight + P && (j = k - T.sideSortablesHeight - 12), C.css({
+ top: F.menuBarHeight,
+ width: m - 2 - (p ? 0 : e.outerWidth() - e.width())
+ }), S.attr("style", X ? "" : "visibility: hidden;"), B.attr("style", "")), z.width() < 300 && 600 < F.windowWidth && N.height() > O.height() + h + 120 && F.windowHeight < d ? (F.sideSortablesHeight + U + D > F.windowHeight || K || R ? u + U <= h ? (O.attr("style", ""), K = R = !1) : Y < u ? K ? (K = !1, i = O.offset().top - F.adminBarHeight, (n = q.offset().top) < i + F.sideSortablesHeight + D && (i = n - F.sideSortablesHeight - 12), O.css({
position: "absolute",
- top: j,
+ top: i,
bottom: ""
- })) : !L && T.sideSortablesHeight + C.offset().top + P < x + T.windowHeight && (L = !0, C.css({
+ })) : !R && F.sideSortablesHeight + O.offset().top + D < u + F.windowHeight && (R = !0, O.css({
position: "fixed",
top: "auto",
- bottom: P
- })) : x < M && (L ? (L = !1, j = C.offset().top - P, k = g.offset().top, k < j + T.sideSortablesHeight + P && (j = k - T.sideSortablesHeight - 12), C.css({
+ bottom: D
+ })) : u < Y && (R ? (R = !1, i = O.offset().top - D, (n = q.offset().top) < i + F.sideSortablesHeight + D && (i = n - F.sideSortablesHeight - 12), O.css({
position: "absolute",
- top: j,
+ top: i,
bottom: ""
- })) : !K && C.offset().top >= x + O && (K = !0, C.css({
+ })) : !K && O.offset().top >= u + U && (K = !0, O.css({
position: "fixed",
- top: O,
+ top: U,
bottom: ""
- }))) : (x >= R - O ? C.css({
+ }))) : (h - U <= u ? O.css({
position: "fixed",
- top: O
- }) : C.attr("style", ""), K = L = !1), M = x) : (C.attr("style", ""), K = L = !1), G && (r.css({
- paddingTop: T.toolsHeight
- }), H ? u.css({
- paddingTop: T.visualTopHeight + T.menuBarHeight
- }) : w.css({
- marginTop: T.textTopHeight
+ top: U
+ }) : O.attr("style", ""), K = R = !1), Y = u) : (O.attr("style", ""), K = R = !1), l && (H.css({
+ paddingTop: F.toolsHeight
+ }), p ? x.css({
+ paddingTop: F.visualTopHeight + F.menuBarHeight
+ }) : T.css({
+ marginTop: F.textTopHeight
})))
}
}
- function j() {
- c(), i()
+ function f() {
+ I(), p()
}
- function k(a) {
- for (var b = 1; b < 6; b++) setTimeout(a, 500 * b)
+ function g(t) {
+ for (var e = 1; e < 6; e++) setTimeout(t, 500 * e)
}
- function l() {
- clearTimeout(p), p = setTimeout(i, 100)
- }
-
- function m() {
- a.pageYOffset && a.pageYOffset > N && a.scrollTo(a.pageXOffset, 0), q.addClass("wp-editor-expand"), d.on("scroll.editor-expand resize.editor-expand", function(a) {
- i(a.type), l()
- }), e.on("wp-collapse-menu.editor-expand postboxes-columnchange.editor-expand editor-classchange.editor-expand", i).on("postbox-toggled.editor-expand postbox-moved.editor-expand", function() {
- !K && !L && a.pageYOffset > O && (L = !0, a.scrollBy(0, -1), i(), a.scrollBy(0, 1)), i()
+ function t() {
+ L.pageYOffset && 130 < L.pageYOffset && L.scrollTo(L.pageXOffset, 0), u.addClass("wp-editor-expand"), V.on("scroll.editor-expand resize.editor-expand", function(t) {
+ p(t.type), clearTimeout(e), e = setTimeout(p, 100)
+ }), N.on("wp-collapse-menu.editor-expand postboxes-columnchange.editor-expand editor-classchange.editor-expand", p).on("postbox-toggled.editor-expand postbox-moved.editor-expand", function() {
+ !K && !R && L.pageYOffset > U && (R = !0, L.scrollBy(0, -1), p(), L.scrollBy(0, 1)), p()
}).on("wp-window-resized.editor-expand", function() {
- o && !o.isHidden() ? o.execCommand("wpAutoResize") : c()
- }), w.on("focus.editor-expand input.editor-expand propertychange.editor-expand", c), G(), F && F.pubsub.subscribe("hidden", j), o && (o.settings.wp_autoresize_on = !0, o.execCommand("wpAutoResizeOn"), o.isHidden() || o.execCommand("wpAutoResize")), o && !o.isHidden() || c(), i(), e.trigger("editor-expand-on")
+ w && !w.isHidden() ? w.execCommand("wpAutoResize") : I()
+ }), T.on("focus.editor-expand input.editor-expand propertychange.editor-expand", I), r(), k && k.pubsub.subscribe("hidden", f), w && (w.settings.wp_autoresize_on = !0, w.execCommand("wpAutoResizeOn"), w.isHidden() || w.execCommand("wpAutoResize")), w && !w.isHidden() || I(), p(), N.trigger("editor-expand-on")
}
- function n() {
- var c = parseInt(a.getUserSetting("ed_size", 300), 10);
- c < 50 ? c = 50 : c > 5e3 && (c = 5e3), a.pageYOffset && a.pageYOffset > N && a.scrollTo(a.pageXOffset, 0), q.removeClass("wp-editor-expand"), d.off(".editor-expand"), e.off(".editor-expand"), w.off(".editor-expand"), H(), F && F.pubsub.unsubscribe("hidden", j), b.each([t, v, s, A, z, B, r, u, w, C], function(a, b) {
- b && b.attr("style", "")
- }), I = J = K = L = !1, o && (o.settings.wp_autoresize_on = !1, o.execCommand("wpAutoResizeOff"), o.isHidden() || (w.hide(), c && o.theme.resizeTo(null, c))), c && w.height(c), e.trigger("editor-expand-off")
- }
- var o, p, q = b("#postdivrich"),
- r = b("#wp-content-wrap"),
- s = b("#wp-content-editor-tools"),
- t = b(),
- u = b(),
- v = b("#ed_toolbar"),
- w = b("#content"),
- x = w[0],
- y = 0,
- z = b("#post-status-info"),
- A = b(),
- B = b(),
- C = b("#side-sortables"),
- D = b("#postbox-container-1"),
- E = b("#post-body"),
- F = a.wp.editor && a.wp.editor.fullscreen,
- G = function() {},
- H = function() {},
- I = !1,
- J = !1,
- K = !1,
- L = !1,
- M = 0,
- N = 130,
- O = 56,
- P = 20,
- Q = 300,
- R = r.hasClass("tmce-active") ? "tinymce" : "html",
- S = !!parseInt(a.getUserSetting("hidetb"), 10),
- T = {
- windowHeight: 0,
- windowWidth: 0,
- adminBarHeight: 0,
- toolsHeight: 0,
- menuBarHeight: 0,
- visualTopHeight: 0,
- textTopHeight: 0,
- bottomHeight: 0,
- statusBarHeight: 0,
- sideSortablesHeight: 0
- },
- U = a._.throttle(function() {
- var b = a.scrollX || document.documentElement.scrollLeft,
- c = a.scrollY || document.documentElement.scrollTop,
- d = parseInt(x.style.height, 10);
- x.style.height = Q + "px", x.scrollHeight > Q && (x.style.height = x.scrollHeight + "px"), void 0 !== b && a.scrollTo(b, c), x.scrollHeight < d && i()
- }, 300);
- e.on("tinymce-editor-init.editor-expand", function(e, f) {
- function g() {
- var a, b, c, d = f.selection.getNode();
- if (f.wp && f.wp.getView && (b = f.wp.getView(d))) c = b.getBoundingClientRect();
- else {
- a = f.selection.getRng();
- try {
- c = a.getClientRects()[0]
- } catch (e) {}
- c || (c = d.getBoundingClientRect())
- }
- return !!c.height && c
- }
+ function a() {
+ var t = parseInt(L.getUserSetting("ed_size", 300), 10);
+ t < 50 ? t = 50 : 5e3 < t && (t = 5e3), L.pageYOffset && 130 < L.pageYOffset && L.scrollTo(L.pageXOffset, 0), u.removeClass("wp-editor-expand"), V.off(".editor-expand"), N.off(".editor-expand"), T.off(".editor-expand"), l(), k && k.pubsub.unsubscribe("hidden", f), M.each([v, y, b, C, B, S, H, x, T, O], function(t, e) {
+ e && e.attr("style", "")
+ }), A = W = K = R = !1, w && (w.settings.wp_autoresize_on = !1, w.execCommand("wpAutoResizeOff"), w.isHidden() || (T.hide(), t && w.theme.resizeTo(null, t))), t && T.height(t), N.trigger("editor-expand-off")
+ }
+ N.on("tinymce-editor-init.editor-expand", function(t, f) {
+ var a = L.tinymce.util.VK,
+ e = _.debounce(function() {
+ !M(".mce-floatpanel:hover").length && L.tinymce.ui.FloatPanel.hideAll(), M(".mce-tooltip").hide()
+ }, 1e3, !0);
- function h(a) {
- var b = a.keyCode;
- b <= 47 && b !== s.SPACEBAR && b !== s.ENTER && b !== s.DELETE && b !== s.BACKSPACE && b !== s.UP && b !== s.LEFT && b !== s.DOWN && b !== s.UP || b >= 91 && b <= 93 || b >= 112 && b <= 123 || 144 === b || 145 === b || j(b)
+ function o(t) {
+ var e = t.keyCode;
+ e <= 47 && e !== a.SPACEBAR && e !== a.ENTER && e !== a.DELETE && e !== a.BACKSPACE && e !== a.UP && e !== a.LEFT && e !== a.DOWN && e !== a.UP || 91 <= e && e <= 93 || 112 <= e && e <= 123 || 144 === e || 145 === e || i(e)
}
- function j(b) {
- var c, d, e, h, i = g();
- i && (c = i.top + f.iframeElement.getBoundingClientRect().top, d = c + i.height, c -= 50, d += 50, e = T.adminBarHeight + T.toolsHeight + T.menuBarHeight + T.visualTopHeight, (h = T.windowHeight - (S ? T.bottomHeight + T.statusBarHeight : 0)) - e < i.height || (c < e && (b === s.UP || b === s.LEFT || b === s.BACKSPACE) ? a.scrollTo(a.pageXOffset, c + a.pageYOffset - e) : d > h && a.scrollTo(a.pageXOffset, d + a.pageYOffset - h)))
+ function i(t) {
+ var e, o, i, n, s = function() {
+ var t, e, o, i = f.selection.getNode();
+ if (f.wp && f.wp.getView && (e = f.wp.getView(i))) o = e.getBoundingClientRect();
+ else {
+ t = f.selection.getRng();
+ try {
+ o = t.getClientRects()[0]
+ } catch (t) {}
+ o || (o = i.getBoundingClientRect())
+ }
+ return !!o.height && o
+ }();
+ s && (o = (e = s.top + f.iframeElement.getBoundingClientRect().top) + s.height, e -= 50, o += 50, i = F.adminBarHeight + F.toolsHeight + F.menuBarHeight + F.visualTopHeight, (n = F.windowHeight - (X ? F.bottomHeight + F.statusBarHeight : 0)) - i < s.height || (e < i && (t === a.UP || t === a.LEFT || t === a.BACKSPACE) ? L.scrollTo(L.pageXOffset, e + L.pageYOffset - i) : n < o && L.scrollTo(L.pageXOffset, o + L.pageYOffset - n)))
}
- function l(a) {
- a.state || i()
+ function n(t) {
+ t.state || p()
}
- function m() {
- d.on("scroll.mce-float-panels", v), setTimeout(function() {
- f.execCommand("wpAutoResize"), i()
+ function s() {
+ V.on("scroll.mce-float-panels", e), setTimeout(function() {
+ f.execCommand("wpAutoResize"), p()
}, 300)
}
- function n() {
- d.off("scroll.mce-float-panels"), setTimeout(function() {
- var b = r.offset().top;
- a.pageYOffset > b && a.scrollTo(a.pageXOffset, b - T.adminBarHeight), c(), i()
- }, 100), i()
+ function d() {
+ V.off("scroll.mce-float-panels"), setTimeout(function() {
+ var t = H.offset().top;
+ L.pageYOffset > t && L.scrollTo(L.pageXOffset, t - F.adminBarHeight), I(), p()
+ }, 100), p()
}
- function p() {
- S = !S
+ function c() {
+ X = !X
}
- var s = a.tinymce.util.VK,
- v = _.debounce(function() {
- !b(".mce-floatpanel:hover").length && a.tinymce.ui.FloatPanel.hideAll(), b(".mce-tooltip").hide()
- }, 1e3, !0);
- "content" === f.id && (o = f, f.settings.autoresize_min_height = Q, t = r.find(".mce-toolbar-grp"), u = r.find(".mce-edit-area"), B = r.find(".mce-statusbar"), A = r.find(".mce-menubar"), G = function() {
- f.on("keyup", h), f.on("show", m), f.on("hide", n), f.on("wp-toolbar-toggle", p), f.on("setcontent wp-autoresize wp-toolbar-toggle", i), f.on("undo redo", j), f.on("FullscreenStateChanged", l), d.off("scroll.mce-float-panels").on("scroll.mce-float-panels", v)
- }, H = function() {
- f.off("keyup", h), f.off("show", m), f.off("hide", n), f.off("wp-toolbar-toggle", p), f.off("setcontent wp-autoresize wp-toolbar-toggle", i), f.off("undo redo", j), f.off("FullscreenStateChanged", l), d.off("scroll.mce-float-panels")
- }, q.hasClass("wp-editor-expand") && (G(), k(i)))
- }), q.hasClass("wp-editor-expand") && (m(), r.hasClass("html-active") && k(function() {
- i(), c()
- })), b("#adv-settings .editor-expand").show(), b("#editor-expand-toggle").on("change.editor-expand", function() {
- b(this).prop("checked") ? (m(), a.setUserSetting("editor_expand", "on")) : (n(), a.setUserSetting("editor_expand", "off"))
- }), a.editorExpand = {
- on: m,
- off: n
- }
- }), b(function() {
- function c() {
- z = J.offset(), z.right = z.left + J.outerWidth(), z.bottom = z.top + J.outerHeight()
- }
-
- function h() {
- S || (S = !0, e.trigger("dfw-activate"), L.on("keydown.focus-shortcut", v))
- }
+ "content" === f.id && ((w = f).settings.autoresize_min_height = P, v = H.find(".mce-toolbar-grp"), x = H.find(".mce-edit-area"), S = H.find(".mce-statusbar"), C = 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), V.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), V.off("scroll.mce-float-panels")
+ }, u.hasClass("wp-editor-expand") && (r(), g(p)))
+ }), u.hasClass("wp-editor-expand") && (t(), H.hasClass("html-active") && g(function() {
+ p(), I()
+ })), M("#adv-settings .editor-expand").show(), M("#editor-expand-toggle").on("change.editor-expand", function() {
+ M(this).prop("checked") ? (t(), L.setUserSetting("editor_expand", "on")) : (a(), L.setUserSetting("editor_expand", "off"))
+ }), L.editorExpand = {
+ on: t,
+ off: a
+ }
+ }), M(function() {
+ var i, n, t, s, f, a, d, c, u, r, l, p = M(document.body),
+ o = M("#wpcontent"),
+ g = M("#post-body-content"),
+ e = M("#title"),
+ h = M("#content"),
+ m = M(document.createElement("DIV")),
+ w = M("#edit-slug-box"),
+ H = w.find("a").add(w.find("button")).add(w.find("input")),
+ b = M("#adminmenuwrap"),
+ v = (M(), M(), "on" === L.getUserSetting("editor_expand", "on")),
+ x = !!v && "on" === L.getUserSetting("post_dfw"),
+ y = 0,
+ T = 0,
+ B = 20;
- function i() {
- S && (l(), S = !1, e.trigger("dfw-deactivate"), L.off("keydown.focus-shortcut"))
+ function C() {
+ (s = g.offset()).right = s.left + g.outerWidth(), s.bottom = s.top + g.outerHeight()
}
- function j() {
- return S
+ function S() {
+ v || (v = !0, N.trigger("dfw-activate"), h.on("keydown.focus-shortcut", Y))
}
- function k() {
- !T && S && (T = !0, L.on("keydown.focus", o), K.add(L).on("blur.focus", q), o(), a.setUserSetting("post_dfw", "on"), e.trigger("dfw-on"))
+ function O() {
+ v && (E(), v = !1, N.trigger("dfw-deactivate"), h.off("keydown.focus-shortcut"))
}
- function l() {
- T && (T = !1, K.add(L).off(".focus"), p(), J.off(".focus"), a.setUserSetting("post_dfw", "off"), e.trigger("dfw-off"))
+ function z() {
+ !x && v && (x = !0, h.on("keydown.focus", k), e.add(h).on("blur.focus", W), k(), L.setUserSetting("post_dfw", "on"), N.trigger("dfw-on"))
}
- function m() {
- T ? l() : k()
+ function E() {
+ x && (x = !1, e.add(h).off(".focus"), A(), g.off(".focus"), L.setUserSetting("post_dfw", "off"), N.trigger("dfw-off"))
}
- function n() {
- return T
+ function _() {
+ x ? E() : z()
}
- function o(b) {
- var e, f = b && b.keyCode;
- if (a.navigator.platform && (e = a.navigator.platform.indexOf("Mac") > -1), 27 === f || 87 === f && b.altKey && (!e && b.shiftKey || e && b.ctrlKey)) return void p(b);
- b && (b.metaKey || b.ctrlKey && !b.altKey || b.altKey && b.shiftKey || f && (f <= 47 && 8 !== f && 13 !== f && 32 !== f && 46 !== f || f >= 91 && f <= 93 || f >= 112 && f <= 135 || f >= 144 && f <= 150 || f >= 224)) || (w || (w = !0, clearTimeout(F), F = setTimeout(function() {
- M.show()
- }, 600), J.css("z-index", 9998), M.on("mouseenter.focus", function() {
- c(), d.on("scroll.focus", function() {
- var b = a.pageYOffset;
- D && C && D !== b && (C < z.top - W || C > z.bottom + W) && p(), D = b
+ function k(t) {
+ var e, o = t && t.keyCode;
+ L.navigator.platform && (e = -1 < L.navigator.platform.indexOf("Mac")), 27 === o || 87 === o && t.altKey && (!e && t.shiftKey || e && t.ctrlKey) ? A(t) : t && (t.metaKey || t.ctrlKey && !t.altKey || t.altKey && t.shiftKey || o && (o <= 47 && 8 !== o && 13 !== o && 32 !== o && 46 !== o || 91 <= o && o <= 93 || 112 <= o && o <= 135 || 144 <= o && o <= 150 || 224 <= o)) || (i || (i = !0, clearTimeout(r), r = setTimeout(function() {
+ m.show()
+ }, 600), g.css("z-index", 9998), m.on("mouseenter.focus", function() {
+ C(), V.on("scroll.focus", function() {
+ var t = L.pageYOffset;
+ c && d && c !== t && (d < s.top - B || d > s.bottom + B) && A(), c = t
})
}).on("mouseleave.focus", function() {
- A = B = null, U = V = 0, d.off("scroll.focus")
- }).on("mousemove.focus", function(b) {
- var c = b.clientX,
- d = b.clientY,
- e = a.pageYOffset,
- f = a.pageXOffset;
- if (A && B && (c !== A || d !== B))
- if (d <= B && d < z.top - e || d >= B && d > z.bottom - e || c <= A && c < z.left - f || c >= A && c > z.right - f) {
- if (U += Math.abs(A - c), V += Math.abs(B - d), (d <= z.top - W - e || d >= z.bottom + W - e || c <= z.left - W - f || c >= z.right + W - f) && (U > 10 || V > 10)) return p(), A = B = null, void(U = V = 0)
- } else U = V = 0;
- A = c, B = d
- }).on("touchstart.focus", function(a) {
- a.preventDefault(), p()
- }), J.off("mouseenter.focus"), E && (clearTimeout(E), E = null), H.addClass("focus-on").removeClass("focus-off")), r(), t())
- }
-
- function p(a) {
- w && (w = !1, clearTimeout(F), F = setTimeout(function() {
- M.hide()
- }, 200), J.css("z-index", ""), M.off("mouseenter.focus mouseleave.focus mousemove.focus touchstart.focus"), void 0 === a && J.on("mouseenter.focus", function() {
- (b.contains(J.get(0), document.activeElement) || G) && o()
- }), E = setTimeout(function() {
- E = null, J.off("mouseenter.focus")
- }, 1e3), H.addClass("focus-off").removeClass("focus-on")), s(), u()
+ f = a = null, y = T = 0, V.off("scroll.focus")
+ }).on("mousemove.focus", function(t) {
+ var e = t.clientX,
+ o = t.clientY,
+ i = L.pageYOffset,
+ n = L.pageXOffset;
+ if (f && a && (e !== f || o !== a))
+ if (o <= a && o < s.top - i || a <= o && o > s.bottom - i || e <= f && e < s.left - n || f <= e && e > s.right - n) {
+ if (y += Math.abs(f - e), T += Math.abs(a - o), (o <= s.top - B - i || o >= s.bottom + B - i || e <= s.left - B - n || e >= s.right + B - n) && (10 < y || 10 < T)) return A(), f = a = null, void(y = T = 0)
+ } else y = T = 0;
+ f = e, a = o
+ }).on("touchstart.focus", function(t) {
+ t.preventDefault(), A()
+ }), g.off("mouseenter.focus"), u && (clearTimeout(u), u = null), p.addClass("focus-on").removeClass("focus-off")), !n && i && (n = !0, j.on("mouseenter.focus", function() {
+ j.addClass("focus-off")
+ }).on("mouseleave.focus", function() {
+ j.removeClass("focus-off")
+ })), K())
}
- function q() {
+ function A(t) {
+ i && (i = !1, clearTimeout(r), r = setTimeout(function() {
+ m.hide()
+ }, 200), g.css("z-index", ""), m.off("mouseenter.focus mouseleave.focus mousemove.focus touchstart.focus"), void 0 === t && g.on("mouseenter.focus", function() {
+ (M.contains(g.get(0), document.activeElement) || l) && k()
+ }), u = setTimeout(function() {
+ u = null, g.off("mouseenter.focus")
+ }, 1e3), p.addClass("focus-off").removeClass("focus-on")), n && (n = !1, j.off(".focus")), R()
+ }
+
+ function W() {
setTimeout(function() {
- function a(a) {
- return b.contains(a.get(0), document.activeElement)
+ var t = document.activeElement.compareDocumentPosition(g.get(0));
+
+ function e(t) {
+ return M.contains(t.get(0), document.activeElement)
}
- var c = document.activeElement.compareDocumentPosition(J.get(0));
- 2 !== c && 4 !== c || !(a(P) || a(I) || a(g)) || p()
+ 2 !== t && 4 !== t || !(e(b) || e(o) || e(q)) || A()
}, 0)
}
- function r() {
- !x && w && (x = !0, f.on("mouseenter.focus", function() {
- f.addClass("focus-off")
- }).on("mouseleave.focus", function() {
- f.removeClass("focus-off")
- }))
+ function K() {
+ t || !i || w.find(":focus").length || (t = !0, w.stop().fadeTo("fast", .3).on("mouseenter.focus", R).off("mouseleave.focus"), H.on("focus.focus", R).off("blur.focus"))
}
- function s() {
- x && (x = !1, f.off(".focus"))
+ function R() {
+ t && (t = !1, w.stop().fadeTo("fast", 1).on("mouseleave.focus", K).off("mouseenter.focus"), H.on("blur.focus", K).off("focus.focus"))
}
- function t() {
- y || !w || N.find(":focus").length || (y = !0, N.stop().fadeTo("fast", .3).on("mouseenter.focus", u).off("mouseleave.focus"), O.on("focus.focus", u).off("blur.focus"))
+ function Y(t) {
+ t.altKey && t.shiftKey && 87 === t.keyCode && _()
}
-
- function u() {
- y && (y = !1, N.stop().fadeTo("fast", 1).on("mouseleave.focus", t).off("mouseenter.focus"), O.on("blur.focus", t).off("focus.focus"))
- }
-
- function v(a) {
- a.altKey && a.shiftKey && 87 === a.keyCode && m()
- }
- var w, x, y, z, A, B, C, D, E, F, G, H = b(document.body),
- I = b("#wpcontent"),
- J = b("#post-body-content"),
- K = b("#title"),
- L = b("#content"),
- M = b(document.createElement("DIV")),
- N = b("#edit-slug-box"),
- O = N.find("a").add(N.find("button")).add(N.find("input")),
- P = b("#adminmenuwrap"),
- Q = b(),
- R = b(),
- S = "on" === a.getUserSetting("editor_expand", "on"),
- T = !!S && "on" === a.getUserSetting("post_dfw"),
- U = 0,
- V = 0,
- W = 20;
- H.append(M), M.css({
+ p.append(m), m.css({
display: "none",
position: "fixed",
- top: f.height(),
+ top: j.height(),
right: 0,
bottom: 0,
left: 0,
"z-index": 9997
- }), J.css({
+ }), g.css({
position: "relative"
- }), d.on("mousemove.focus", function(a) {
- C = a.pageY
- }), b("#postdivrich").hasClass("wp-editor-expand") && L.on("keydown.focus-shortcut", v), e.on("tinymce-editor-setup.focus", function(a, b) {
- b.addButton("dfw", {
- active: T,
+ }), V.on("mousemove.focus", function(t) {
+ d = t.pageY
+ }), M("#postdivrich").hasClass("wp-editor-expand") && h.on("keydown.focus-shortcut", Y), N.on("tinymce-editor-setup.focus", function(t, e) {
+ e.addButton("dfw", {
+ active: x,
classes: "wp-dfw btn widget",
- disabled: !S,
- onclick: m,
+ disabled: !v,
+ onclick: _,
onPostRender: function() {
- var a = this;
- e.on("dfw-activate.focus", function() {
- a.disabled(!1)
+ var t = this;
+ N.on("dfw-activate.focus", function() {
+ t.disabled(!1)
}).on("dfw-deactivate.focus", function() {
- a.disabled(!0)
+ t.disabled(!0)
}).on("dfw-on.focus", function() {
- a.active(!0)
+ t.active(!0)
}).on("dfw-off.focus", function() {
- a.active(!1)
+ t.active(!1)
})
},
tooltip: "Distraction-free writing mode",
shortcut: "Alt+Shift+W"
- }), b.addCommand("wpToggleDFW", m), b.addShortcut("access+w", "", "wpToggleDFW")
- }), e.on("tinymce-editor-init.focus", function(a, d) {
- function f() {
- G = !0
+ }), e.addCommand("wpToggleDFW", _), e.addShortcut("access+w", "", "wpToggleDFW")
+ }), N.on("tinymce-editor-init.focus", function(t, e) {
+ var o, i;
+
+ function n() {
+ l = !0
}
- function g() {
- G = !1
+ function s() {
+ l = !1
}
- var h, i;
- "content" === d.id && (Q = b(d.getWin()), R = b(d.getContentAreaContainer()).find("iframe"), h = function() {
- d.on("keydown", o), d.on("blur", q), d.on("focus", f), d.on("blur", g), d.on("wp-autoresize", c)
+ "content" === e.id && (M(e.getWin()), M(e.getContentAreaContainer()).find("iframe"), o = function() {
+ e.on("keydown", k), e.on("blur", W), e.on("focus", n), e.on("blur", s), e.on("wp-autoresize", C)
}, i = function() {
- d.off("keydown", o), d.off("blur", q), d.off("focus", f), d.off("blur", g), d.off("wp-autoresize", c)
- }, T && h(), e.on("dfw-on.focus", h).on("dfw-off.focus", i), d.on("click", function(a) {
- a.target === d.getDoc().documentElement && d.focus()
+ e.off("keydown", k), e.off("blur", W), e.off("focus", n), e.off("blur", s), e.off("wp-autoresize", C)
+ }, x && o(), N.on("dfw-on.focus", o).on("dfw-off.focus", i), e.on("click", function(t) {
+ t.target === e.getDoc().documentElement && e.focus()
}))
- }), e.on("quicktags-init", function(a, c) {
- var d;
- c.settings.buttons && -1 !== ("," + c.settings.buttons + ",").indexOf(",dfw,") && (d = b("#" + c.name + "_dfw"), b(document).on("dfw-activate", function() {
- d.prop("disabled", !1)
+ }), N.on("quicktags-init", function(t, e) {
+ var o;
+ e.settings.buttons && -1 !== ("," + e.settings.buttons + ",").indexOf(",dfw,") && (o = M("#" + e.name + "_dfw"), M(document).on("dfw-activate", function() {
+ o.prop("disabled", !1)
}).on("dfw-deactivate", function() {
- d.prop("disabled", !0)
+ o.prop("disabled", !0)
}).on("dfw-on", function() {
- d.addClass("active")
+ o.addClass("active")
}).on("dfw-off", function() {
- d.removeClass("active")
+ o.removeClass("active")
}))
- }), e.on("editor-expand-on.focus", h).on("editor-expand-off.focus", i), T && (L.on("keydown.focus", o), K.add(L).on("blur.focus", q)), a.wp = a.wp || {}, a.wp.editor = a.wp.editor || {}, a.wp.editor.dfw = {
- activate: h,
- deactivate: i,
- isActive: j,
- on: k,
- off: l,
- toggle: m,
- isOn: n
+ }), N.on("editor-expand-on.focus", S).on("editor-expand-off.focus", O), x && (h.on("keydown.focus", k), e.add(h).on("blur.focus", W)), L.wp = L.wp || {}, L.wp.editor = L.wp.editor || {}, L.wp.editor.dfw = {
+ activate: S,
+ deactivate: O,
+ isActive: function() {
+ return v
+ },
+ on: z,
+ off: E,
+ toggle: _,
+ isOn: function() {
+ return x
+ }
}
})
}(window, window.jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/editor.min.js build-branch-unminified/wp-admin/js/editor.min.js
--- build-unminified/wp-admin/js/editor.min.js 2018-10-08 22:57:52.933458253 -0500
+++ build-branch-unminified/wp-admin/js/editor.min.js 2018-10-08 22:55:04.316121022 -0500
@@ -1,342 +1,322 @@
window.wp = window.wp || {},
- function(a, b) {
- function c() {
- function c() {
- !w && window.tinymce && (w = window.tinymce, x = w.$, x(document).on("click", function(a) {
- var b, c, d = x(a.target);
- d.hasClass("wp-switch-editor") && (b = d.attr("data-wp-editor-id"), c = d.hasClass("switch-tmce") ? "tmce" : "html", e(b, c))
+ function(f, m) {
+ m.editor = m.editor || {}, window.switchEditors = new function() {
+ var s, d, n = {};
+
+ function e() {
+ !s && window.tinymce && (s = window.tinymce, (d = s.$)(document).on("click", function(e) {
+ var t = d(e.target);
+ t.hasClass("wp-switch-editor") && r(t.attr("data-wp-editor-id"), t.hasClass("switch-tmce") ? "tmce" : "html")
}))
}
- function d(a) {
- var b = x(".mce-toolbar-grp", a.getContainer())[0],
- c = b && b.clientHeight;
- return c && c > 10 && c < 200 ? parseInt(c, 10) : 30
- }
-
- function e(a, b) {
- a = a || "content", b = b || "toggle";
- var c, e, f, g = w.get(a),
- h = x("#wp-" + a + "-wrap"),
- i = x("#" + a),
- j = i[0];
- if ("toggle" === b && (b = g && !g.isHidden() ? "html" : "tmce"), "tmce" === b || "tinymce" === b) {
- if (g && !g.isHidden()) return !1;
- "undefined" != typeof window.QTags && window.QTags.closeAllTags(a), c = parseInt(j.style.height, 10) || 0;
- var k = !1;
- k = g ? g.getParam("wp_keep_scroll_position") : window.tinyMCEPreInit.mceInit[a] && window.tinyMCEPreInit.mceInit[a].wp_keep_scroll_position, k && l(i), g ? (g.show(), !w.Env.iOS && c && (e = d(g), (c = c - e + 14) > 50 && c < 5e3 && g.theme.resizeTo(null, c)), g.getParam("wp_keep_scroll_position") && m(g)) : w.init(window.tinyMCEPreInit.mceInit[a]), h.removeClass("html-active").addClass("tmce-active"), i.attr("aria-hidden", !0), window.setUserSetting("editor", "tinymce")
- } else if ("html" === b) {
- if (g && g.isHidden()) return !1;
- if (g) {
- w.Env.iOS || (f = g.iframeElement, (c = f ? parseInt(f.style.height, 10) : 0) && (e = d(g), (c = c + e - 14) > 50 && c < 5e3 && (j.style.height = c + "px")));
- var n = null;
- g.getParam("wp_keep_scroll_position") && (n = q(g)), g.hide(), n && r(g, n)
- } else i.css({
+ function u(e) {
+ var t = d(".mce-toolbar-grp", e.getContainer())[0],
+ n = t && t.clientHeight;
+ return n && 10 < n && n < 200 ? parseInt(n, 10) : 30
+ }
+
+ function r(e, t) {
+ e = e || "content", t = t || "toggle";
+ var n, r, i = s.get(e),
+ a = d("#wp-" + e + "-wrap"),
+ o = d("#" + e),
+ c = o[0];
+ if ("toggle" === t && (t = i && !i.isHidden() ? "html" : "tmce"), "tmce" === t || "tinymce" === t) {
+ if (i && !i.isHidden()) return !1;
+ void 0 !== window.QTags && window.QTags.closeAllTags(e), n = parseInt(c.style.height, 10) || 0, (i ? i.getParam("wp_keep_scroll_position") : window.tinyMCEPreInit.mceInit[e] && window.tinyMCEPreInit.mceInit[e].wp_keep_scroll_position) && function(e) {
+ if (e && e.length) {
+ var t = e[0],
+ n = function(e, t) {
+ var n = t.cursorStart,
+ r = t.cursorEnd,
+ i = l(e, n);
+ i && (n = -1 !== ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"].indexOf(i.tagType) ? i.ltPos : i.gtPos);
+ var a = l(e, r);
+ a && (r = a.gtPos);
+ var o = g(e, n);
+ o && !o.showAsPlainText && (n = o.urlAtStartOfContent ? o.endIndex : o.startIndex);
+ var c = g(e, r);
+ return c && !c.showAsPlainText && (r = c.urlAtEndOfContent ? c.startIndex : c.endIndex), {
+ cursorStart: n,
+ cursorEnd: r
+ }
+ }(t.value, {
+ cursorStart: t.selectionStart,
+ cursorEnd: t.selectionEnd
+ }),
+ r = n.cursorStart,
+ i = n.cursorEnd,
+ a = r !== i ? "range" : "single",
+ o = null,
+ c = b(d, "&#65279;").attr("data-mce-type", "bookmark");
+ if ("range" === a) {
+ var p = t.value.slice(r, i),
+ s = c.clone().addClass("mce_SELRES_end");
+ o = [p, s[0].outerHTML].join("")
+ }
+ t.value = [t.value.slice(0, r), c.clone().addClass("mce_SELRES_start")[0].outerHTML, o, t.value.slice(i)].join("")
+ }
+ }(o), i ? (i.show(), !s.Env.iOS && n && 50 < (n = n - u(i) + 14) && n < 5e3 && i.theme.resizeTo(null, n), i.getParam("wp_keep_scroll_position") && w(i)) : s.init(window.tinyMCEPreInit.mceInit[e]), a.removeClass("html-active").addClass("tmce-active"), o.attr("aria-hidden", !0), window.setUserSetting("editor", "tinymce")
+ } else if ("html" === t) {
+ if (i && i.isHidden()) return !1;
+ if (i) {
+ s.Env.iOS || (n = (r = i.iframeElement) ? parseInt(r.style.height, 10) : 0) && 50 < (n = n + u(i) - 14) && n < 5e3 && (c.style.height = n + "px");
+ var p = null;
+ i.getParam("wp_keep_scroll_position") && (p = function(e) {
+ var t = e.getWin().getSelection();
+ if (t && !(t.rangeCount < 1)) {
+ var n = "SELRES_" + Math.random(),
+ r = b(e.$, n),
+ i = r.clone().addClass("mce_SELRES_start"),
+ a = r.clone().addClass("mce_SELRES_end"),
+ o = t.getRangeAt(0),
+ c = o.startContainer,
+ p = o.startOffset,
+ s = o.cloneRange();
+ 0 < e.$(c).parents(".mce-offscreen-selection").length ? (c = e.$("[data-mce-selected]")[0], i.attr("data-mce-object-selection", "true"), a.attr("data-mce-object-selection", "true"), e.$(c).before(i[0]), e.$(c).after(a[0])) : (s.collapse(!1), s.insertNode(a[0]), s.setStart(c, p), s.collapse(!0), s.insertNode(i[0]), o.setStartAfter(i[0]), o.setEndBefore(a[0]), t.removeAllRanges(), t.addRange(o)), e.on("GetContent", x);
+ var d = E(e.getContent());
+ e.off("GetContent", x), i.remove(), a.remove();
+ var l = new RegExp('<span[^>]*\\s*class="mce_SELRES_start"[^>]+>\\s*' + n + "[^<]*<\\/span>(\\s*)"),
+ g = new RegExp('(\\s*)<span[^>]*\\s*class="mce_SELRES_end"[^>]+>\\s*' + n + "[^<]*<\\/span>"),
+ u = d.match(l),
+ w = d.match(g);
+ if (!u) return null;
+ var f = u.index,
+ m = u[0].length,
+ h = null;
+ if (w) {
+ -1 !== u[0].indexOf("data-mce-object-selection") && (m -= u[1].length);
+ var v = w.index; - 1 !== w[0].indexOf("data-mce-object-selection") && (v -= w[1].length), h = v - m
+ }
+ return {
+ start: f,
+ end: h
+ }
+ }
+ }(i)), i.hide(), p && function(e, t) {
+ if (t) {
+ var n = e.getElement(),
+ r = t.start,
+ i = t.end || t.start;
+ n.focus && setTimeout(function() {
+ n.setSelectionRange(r, i), n.blur && n.blur(), n.focus()
+ }, 100)
+ }
+ }(i, p)
+ } else o.css({
display: "",
visibility: ""
});
- h.removeClass("tmce-active").addClass("html-active"), i.attr("aria-hidden", !1), window.setUserSetting("editor", "html")
+ a.removeClass("tmce-active").addClass("html-active"), o.attr("aria-hidden", !1), window.setUserSetting("editor", "html")
}
}
- function f(a, b) {
- var c = a.lastIndexOf("<", b - 1);
- if (c > a.lastIndexOf(">", b) || ">" === a.substr(b, 1)) {
- var d = a.substr(c),
- e = d.match(/<\s*(\/)?(\w+)/);
- if (!e) return null;
- var f = e[2];
+ function l(e, t) {
+ var n = e.lastIndexOf("<", t - 1);
+ if (e.lastIndexOf(">", t) < n || ">" === e.substr(t, 1)) {
+ var r = e.substr(n),
+ i = r.match(/<\s*(\/)?(\w+)/);
+ if (!i) return null;
+ var a = i[2];
return {
- ltPos: c,
- gtPos: c + d.indexOf(">") + 1,
- tagType: f,
- isClosingTag: !!e[1]
+ ltPos: n,
+ gtPos: n + r.indexOf(">") + 1,
+ tagType: a,
+ isClosingTag: !!i[1]
}
}
return null
}
- function g(a, b) {
- for (var c = i(a), d = 0; d < c.length; d++) {
- var e = c[d];
- if (b >= e.startIndex && b <= e.endIndex) return e
+ function g(e, t) {
+ for (var n = function(e) {
+ var t, n = function(e) {
+ var t = e.match(/\[+([\w_-])+/g),
+ n = [];
+ if (t)
+ for (var r = 0; r < t.length; r++) {
+ var i = t[r].replace(/^\[+/g, ""); - 1 === n.indexOf(i) && n.push(i)
+ }
+ return n
+ }(e);
+ if (0 === n.length) return [];
+ for (var r, i = m.shortcode.regexp(n.join("|")), a = []; r = i.exec(e);) {
+ var o = "[" === r[1];
+ t = {
+ shortcodeName: r[2],
+ showAsPlainText: o,
+ startIndex: r.index,
+ endIndex: r.index + r[0].length,
+ length: r[0].length
+ }, a.push(t)
+ }
+ for (var c = new RegExp('(^|[\\n\\r][\\n\\r]|<p>)(https?:\\/\\/[^s"]+?)(<\\/p>s*|[\\n\\r][\\n\\r]|$)', "gi"); r = c.exec(e);) t = {
+ shortcodeName: "url",
+ showAsPlainText: !1,
+ startIndex: r.index,
+ endIndex: r.index + r[0].length,
+ length: r[0].length,
+ urlAtStartOfContent: "" === r[1],
+ urlAtEndOfContent: "" === r[3]
+ }, a.push(t);
+ return a
+ }(e), r = 0; r < n.length; r++) {
+ var i = n[r];
+ if (t >= i.startIndex && t <= i.endIndex) return i
}
}
- function h(a) {
- var b = a.match(/\[+([\w_-])+/g),
- c = [];
- if (b)
- for (var d = 0; d < b.length; d++) {
- var e = b[d].replace(/^\[+/g, ""); - 1 === c.indexOf(e) && c.push(e)
- }
- return c
- }
-
- function i(a) {
- var c, d = h(a);
- if (0 === d.length) return [];
- for (var e, f = b.shortcode.regexp(d.join("|")), g = []; e = f.exec(a);) {
- var i = "[" === e[1];
- c = {
- shortcodeName: e[2],
- showAsPlainText: i,
- startIndex: e.index,
- endIndex: e.index + e[0].length,
- length: e[0].length
- }, g.push(c)
- }
- for (var j = new RegExp('(^|[\\n\\r][\\n\\r]|<p>)(https?:\\/\\/[^s"]+?)(<\\/p>s*|[\\n\\r][\\n\\r]|$)', "gi"); e = j.exec(a);) c = {
- shortcodeName: "url",
- showAsPlainText: !1,
- startIndex: e.index,
- endIndex: e.index + e[0].length,
- length: e[0].length,
- urlAtStartOfContent: "" === e[1],
- urlAtEndOfContent: "" === e[3]
- }, g.push(c);
- return g
- }
-
- function j(a, b) {
- return a("<span>").css({
+ function b(e, t) {
+ return e("<span>").css({
display: "inline-block",
width: 0,
overflow: "hidden",
"line-height": 0
- }).html(b || "")
- }
-
- function k(a, b) {
- var c = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"],
- d = b.cursorStart,
- e = b.cursorEnd,
- h = f(a, d);
- h && (d = -1 !== c.indexOf(h.tagType) ? h.ltPos : h.gtPos);
- var i = f(a, e);
- i && (e = i.gtPos);
- var j = g(a, d);
- j && !j.showAsPlainText && (d = j.urlAtStartOfContent ? j.endIndex : j.startIndex);
- var k = g(a, e);
- return k && !k.showAsPlainText && (e = k.urlAtEndOfContent ? k.startIndex : k.endIndex), {
- cursorStart: d,
- cursorEnd: e
- }
- }
-
- function l(a) {
- if (a && a.length) {
- var b = a[0],
- c = b.value,
- d = k(c, {
- cursorStart: b.selectionStart,
- cursorEnd: b.selectionEnd
- }),
- e = d.cursorStart,
- f = d.cursorEnd,
- g = e !== f ? "range" : "single",
- h = null,
- i = j(x, "&#65279;").attr("data-mce-type", "bookmark");
- if ("range" === g) {
- h = [b.value.slice(e, f), i.clone().addClass("mce_SELRES_end")[0].outerHTML].join("")
- }
- b.value = [b.value.slice(0, e), i.clone().addClass("mce_SELRES_start")[0].outerHTML, h, b.value.slice(f)].join("")
- }
- }
-
- function m(a) {
- var b = a.$(".mce_SELRES_start").attr("data-mce-bogus", 1),
- c = a.$(".mce_SELRES_end").attr("data-mce-bogus", 1);
- if (b.length)
- if (a.focus(), c.length) {
- var d = a.getDoc().createRange();
- d.setStartAfter(b[0]), d.setEndBefore(c[0]), a.selection.setRng(d)
- } else a.selection.select(b[0]);
- a.getParam("wp_keep_scroll_position") && o(a, b), n(b), n(c), a.save()
- }
-
- function n(a) {
- var b = a.parent();
- a.remove(), !b.is("p") || b.children().length || b.text() || b.remove()
- }
-
- function o(b, c) {
- var e, f = b.$(c).offset().top,
- g = b.$(b.getContentAreaContainer()).offset().top,
- h = d(b),
- i = a("#wp-content-editor-tools"),
- j = 0,
- k = 0;
- i.length && (j = i.height(), k = i.offset().top);
- var l = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
- m = g + f,
- n = l - (j + h);
- if (!(m < n)) {
- var o;
- b.settings.wp_autoresize_on ? (e = a("html,body"), o = Math.max(m - n / 2, k - j)) : (e = a(b.contentDocument).find("html,body"), o = f), e.animate({
- scrollTop: parseInt(o, 10)
- }, 100)
- }
- }
-
- function p(a) {
- a.content = a.content.replace(/<p>(?:<br ?\/?>|\u00a0|\uFEFF| )*<\/p>/g, "<p>&nbsp;</p>")
+ }).html(t || "")
}
- function q(a) {
- var b = a.getWin(),
- c = b.getSelection();
- if (c && !(c.rangeCount < 1)) {
- var d = "SELRES_" + Math.random(),
- e = j(a.$, d),
- f = e.clone().addClass("mce_SELRES_start"),
- g = e.clone().addClass("mce_SELRES_end"),
- h = c.getRangeAt(0),
- i = h.startContainer,
- k = h.startOffset,
- l = h.cloneRange();
- a.$(i).parents(".mce-offscreen-selection").length > 0 ? (i = a.$("[data-mce-selected]")[0], f.attr("data-mce-object-selection", "true"), g.attr("data-mce-object-selection", "true"), a.$(i).before(f[0]), a.$(i).after(g[0])) : (l.collapse(!1), l.insertNode(g[0]), l.setStart(i, k), l.collapse(!0), l.insertNode(f[0]), h.setStartAfter(f[0]), h.setEndBefore(g[0]), c.removeAllRanges(), c.addRange(h)), a.on("GetContent", p);
- var m = s(a.getContent());
- a.off("GetContent", p), f.remove(), g.remove();
- var n = new RegExp('<span[^>]*\\s*class="mce_SELRES_start"[^>]+>\\s*' + d + "[^<]*<\\/span>(\\s*)"),
- o = new RegExp('(\\s*)<span[^>]*\\s*class="mce_SELRES_end"[^>]+>\\s*' + d + "[^<]*<\\/span>"),
- q = m.match(n),
- r = m.match(o);
- if (!q) return null;
- var t = q.index,
- u = q[0].length,
- v = null;
- if (r) {
- -1 !== q[0].indexOf("data-mce-object-selection") && (u -= q[1].length);
- var w = r.index; - 1 !== r[0].indexOf("data-mce-object-selection") && (w -= r[1].length), v = w - u
- }
- return {
- start: t,
- end: v
- }
- }
- }
-
- function r(a, b) {
- if (b) {
- var c = a.getElement(),
- d = b.start,
- e = b.end || b.start;
- c.focus && setTimeout(function() {
- c.setSelectionRange(d, e), c.blur && c.blur(), c.focus()
- }, 100)
- }
- }
-
- function s(a) {
- var b = "blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure",
- c = b + "|div|p",
- d = b + "|pre",
- e = !1,
- f = !1,
- g = [];
- return a ? (-1 === a.indexOf("<script") && -1 === a.indexOf("<style") || (a = a.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g, function(a) {
- return g.push(a), "<wp-preserve>"
- })), -1 !== a.indexOf("<pre") && (e = !0, a = a.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g, function(a) {
- return a = a.replace(/<br ?\/?>(\r\n|\n)?/g, "<wp-line-break>"), a = a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, "<wp-line-break>"), a.replace(/\r?\n/g, "<wp-line-break>")
- })), -1 !== a.indexOf("[caption") && (f = !0, a = a.replace(/\[caption[\s\S]+?\[\/caption\]/g, function(a) {
- return a.replace(/<br([^>]*)>/g, "<wp-temp-br$1>").replace(/[\r\n\t]+/, "")
- })), a = a.replace(new RegExp("\\s*</(" + c + ")>\\s*", "g"), "</$1>\n"), a = a.replace(new RegExp("\\s*<((?:" + c + ")(?: [^>]*)?)>", "g"), "\n<$1>"), a = a.replace(/(<p [^>]+>.*?)<\/p>/g, "$1</p#>"), a = a.replace(/<div( [^>]*)?>\s*<p>/gi, "<div$1>\n\n"), a = a.replace(/\s*<p>/gi, ""), a = a.replace(/\s*<\/p>\s*/gi, "\n\n"), a = a.replace(/\n[\s\u00a0]+\n/g, "\n\n"), a = a.replace(/(\s*)<br ?\/?>\s*/gi, function(a, b) {
- return b && -1 !== b.indexOf("\n") ? "\n\n" : "\n"
- }), a = a.replace(/\s*<div/g, "\n<div"), a = a.replace(/<\/div>\s*/g, "</div>\n"), a = a.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi, "\n\n[caption$1[/caption]\n\n"), a = a.replace(/caption\]\n\n+\[caption/g, "caption]\n\n[caption"), a = a.replace(new RegExp("\\s*<((?:" + d + ")(?: [^>]*)?)\\s*>", "g"), "\n<$1>"), a = a.replace(new RegExp("\\s*</(" + d + ")>\\s*", "g"), "</$1>\n"), a = a.replace(/<((li|dt|dd)[^>]*)>/g, " \t<$1>"), -1 !== a.indexOf("<option") && (a = a.replace(/\s*<option/g, "\n<option"), a = a.replace(/\s*<\/select>/g, "\n</select>")), -1 !== a.indexOf("<hr") && (a = a.replace(/\s*<hr( [^>]*)?>\s*/g, "\n\n<hr$1>\n\n")), -1 !== a.indexOf("<object") && (a = a.replace(/<object[\s\S]+?<\/object>/g, function(a) {
- return a.replace(/[\r\n]+/g, "")
- })), a = a.replace(/<\/p#>/g, "</p>\n"), a = a.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g, "\n$1"), a = a.replace(/^\s+/, ""), a = a.replace(/[\s\u00a0]+$/, ""), e && (a = a.replace(/<wp-line-break>/g, "\n")), f && (a = a.replace(/<wp-temp-br([^>]*)>/g, "<br$1>")), g.length && (a = a.replace(/<wp-preserve>/g, function() {
- return g.shift()
- })), a) : ""
- }
-
- function t(a) {
- var b = !1,
- c = !1,
- d = "table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary";
- return a = a.replace(/\r\n|\r/g, "\n"), -1 !== a.indexOf("<object") && (a = a.replace(/<object[\s\S]+?<\/object>/g, function(a) {
- return a.replace(/\n+/g, "")
- })), a = a.replace(/<[^<>]+>/g, function(a) {
- return a.replace(/[\n\t ]+/g, " ")
- }), -1 === a.indexOf("<pre") && -1 === a.indexOf("<script") || (b = !0, a = a.replace(/<(pre|script)[^>]*>[\s\S]*?<\/\1>/g, function(a) {
- return a.replace(/\n/g, "<wp-line-break>")
- })), -1 !== a.indexOf("<figcaption") && (a = a.replace(/\s*(<figcaption[^>]*>)/g, "$1"), a = a.replace(/<\/figcaption>\s*/g, "</figcaption>")), -1 !== a.indexOf("[caption") && (c = !0, a = a.replace(/\[caption[\s\S]+?\[\/caption\]/g, function(a) {
- return a = a.replace(/<br([^>]*)>/g, "<wp-temp-br$1>"), a = a.replace(/<[^<>]+>/g, function(a) {
- return a.replace(/[\n\t ]+/, " ")
- }), a.replace(/\s*\n\s*/g, "<wp-temp-br />")
- })), a += "\n\n", a = a.replace(/<br \/>\s*<br \/>/gi, "\n\n"), a = a.replace(new RegExp("(<(?:" + d + ")(?: [^>]*)?>)", "gi"), "\n\n$1"), a = a.replace(new RegExp("(</(?:" + d + ")>)", "gi"), "$1\n\n"), a = a.replace(/<hr( [^>]*)?>/gi, "<hr$1>\n\n"), a = a.replace(/\s*<option/gi, "<option"), a = a.replace(/<\/option>\s*/gi, "</option>"), a = a.replace(/\n\s*\n+/g, "\n\n"), a = a.replace(/([\s\S]+?)\n\n/g, "<p>$1</p>\n"), a = a.replace(/<p>\s*?<\/p>/gi, ""), a = a.replace(new RegExp("<p>\\s*(</?(?:" + d + ")(?: [^>]*)?>)\\s*</p>", "gi"), "$1"), a = a.replace(/<p>(<li.+?)<\/p>/gi, "$1"), a = a.replace(/<p>\s*<blockquote([^>]*)>/gi, "<blockquote$1><p>"), a = a.replace(/<\/blockquote>\s*<\/p>/gi, "</p></blockquote>"), a = a.replace(new RegExp("<p>\\s*(</?(?:" + d + ")(?: [^>]*)?>)", "gi"), "$1"), a = a.replace(new RegExp("(</?(?:" + d + ")(?: [^>]*)?>)\\s*</p>", "gi"), "$1"), a = a.replace(/(<br[^>]*>)\s*\n/gi, "$1"), a = a.replace(/\s*\n/g, "<br />\n"), a = a.replace(new RegExp("(</?(?:" + d + ")[^>]*>)\\s*<br />", "gi"), "$1"), a = a.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi, "$1"), a = a.replace(/(?:<p>|<br ?\/?>)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|<br ?\/?>)*/gi, "[caption$1[/caption]"), a = a.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g, function(a, b, c) {
- return c.match(/<p( [^>]*)?>/) ? a : b + "<p>" + c + "</p>"
- }), b && (a = a.replace(/<wp-line-break>/g, "\n")), c && (a = a.replace(/<wp-temp-br([^>]*)>/g, "<br$1>")), a
- }
-
- function u(b) {
- var c = {
- o: y,
- data: b,
- unfiltered: b
+ function w(e) {
+ var t = e.$(".mce_SELRES_start").attr("data-mce-bogus", 1),
+ n = e.$(".mce_SELRES_end").attr("data-mce-bogus", 1);
+ if (t.length)
+ if (e.focus(), n.length) {
+ var r = e.getDoc().createRange();
+ r.setStartAfter(t[0]), r.setEndBefore(n[0]), e.selection.setRng(r)
+ } else e.selection.select(t[0]);
+ e.getParam("wp_keep_scroll_position") && function(e, t) {
+ var n, r = e.$(t).offset().top,
+ i = e.$(e.getContentAreaContainer()).offset().top,
+ a = u(e),
+ o = f("#wp-content-editor-tools"),
+ c = 0,
+ p = 0;
+ o.length && (c = o.height(), p = o.offset().top);
+ var s, d = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
+ l = i + r,
+ g = d - (c + a);
+ l < g || (s = e.settings.wp_autoresize_on ? (n = f("html,body"), Math.max(l - g / 2, p - c)) : (n = f(e.contentDocument).find("html,body"), r), n.animate({
+ scrollTop: parseInt(s, 10)
+ }, 100))
+ }(e, t), i(t), i(n), e.save()
+ }
+
+ function i(e) {
+ var t = e.parent();
+ e.remove(), !t.is("p") || t.children().length || t.text() || t.remove()
+ }
+
+ function x(e) {
+ e.content = e.content.replace(/<p>(?:<br ?\/?>|\u00a0|\uFEFF| )*<\/p>/g, "<p>&nbsp;</p>")
+ }
+
+ function E(e) {
+ var t = "blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure",
+ n = t + "|div|p",
+ r = t + "|pre",
+ i = !1,
+ a = !1,
+ o = [];
+ return e ? (-1 === e.indexOf("<script") && -1 === e.indexOf("<style") || (e = e.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g, function(e) {
+ return o.push(e), "<wp-preserve>"
+ })), -1 !== e.indexOf("<pre") && (i = !0, e = e.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g, function(e) {
+ return (e = (e = e.replace(/<br ?\/?>(\r\n|\n)?/g, "<wp-line-break>")).replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, "<wp-line-break>")).replace(/\r?\n/g, "<wp-line-break>")
+ })), -1 !== e.indexOf("[caption") && (a = !0, e = e.replace(/\[caption[\s\S]+?\[\/caption\]/g, function(e) {
+ return e.replace(/<br([^>]*)>/g, "<wp-temp-br$1>").replace(/[\r\n\t]+/, "")
+ })), -1 !== (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = e.replace(new RegExp("\\s*</(" + n + ")>\\s*", "g"), "</$1>\n")).replace(new RegExp("\\s*<((?:" + n + ")(?: [^>]*)?)>", "g"), "\n<$1>")).replace(/(<p [^>]+>.*?)<\/p>/g, "$1</p#>")).replace(/<div( [^>]*)?>\s*<p>/gi, "<div$1>\n\n")).replace(/\s*<p>/gi, "")).replace(/\s*<\/p>\s*/gi, "\n\n")).replace(/\n[\s\u00a0]+\n/g, "\n\n")).replace(/(\s*)<br ?\/?>\s*/gi, function(e, t) {
+ return t && -1 !== t.indexOf("\n") ? "\n\n" : "\n"
+ })).replace(/\s*<div/g, "\n<div")).replace(/<\/div>\s*/g, "</div>\n")).replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi, "\n\n[caption$1[/caption]\n\n")).replace(/caption\]\n\n+\[caption/g, "caption]\n\n[caption")).replace(new RegExp("\\s*<((?:" + r + ")(?: [^>]*)?)\\s*>", "g"), "\n<$1>")).replace(new RegExp("\\s*</(" + r + ")>\\s*", "g"), "</$1>\n")).replace(/<((li|dt|dd)[^>]*)>/g, " \t<$1>")).indexOf("<option") && (e = (e = e.replace(/\s*<option/g, "\n<option")).replace(/\s*<\/select>/g, "\n</select>")), -1 !== e.indexOf("<hr") && (e = e.replace(/\s*<hr( [^>]*)?>\s*/g, "\n\n<hr$1>\n\n")), -1 !== e.indexOf("<object") && (e = e.replace(/<object[\s\S]+?<\/object>/g, function(e) {
+ return e.replace(/[\r\n]+/g, "")
+ })), e = (e = (e = (e = e.replace(/<\/p#>/g, "</p>\n")).replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g, "\n$1")).replace(/^\s+/, "")).replace(/[\s\u00a0]+$/, ""), i && (e = e.replace(/<wp-line-break>/g, "\n")), a && (e = e.replace(/<wp-temp-br([^>]*)>/g, "<br$1>")), o.length && (e = e.replace(/<wp-preserve>/g, function() {
+ return o.shift()
+ })), e) : ""
+ }
+
+ function a(e) {
+ var t = !1,
+ n = !1,
+ r = "table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary";
+ return -1 !== (e = e.replace(/\r\n|\r/g, "\n")).indexOf("<object") && (e = e.replace(/<object[\s\S]+?<\/object>/g, function(e) {
+ return e.replace(/\n+/g, "")
+ })), -1 === (e = e.replace(/<[^<>]+>/g, function(e) {
+ return e.replace(/[\n\t ]+/g, " ")
+ })).indexOf("<pre") && -1 === e.indexOf("<script") || (t = !0, e = e.replace(/<(pre|script)[^>]*>[\s\S]*?<\/\1>/g, function(e) {
+ return e.replace(/\n/g, "<wp-line-break>")
+ })), -1 !== e.indexOf("<figcaption") && (e = (e = e.replace(/\s*(<figcaption[^>]*>)/g, "$1")).replace(/<\/figcaption>\s*/g, "</figcaption>")), -1 !== e.indexOf("[caption") && (n = !0, e = e.replace(/\[caption[\s\S]+?\[\/caption\]/g, function(e) {
+ return (e = (e = e.replace(/<br([^>]*)>/g, "<wp-temp-br$1>")).replace(/<[^<>]+>/g, function(e) {
+ return e.replace(/[\n\t ]+/, " ")
+ })).replace(/\s*\n\s*/g, "<wp-temp-br />")
+ })), e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e = (e += "\n\n").replace(/<br \/>\s*<br \/>/gi, "\n\n")).replace(new RegExp("(<(?:" + r + ")(?: [^>]*)?>)", "gi"), "\n\n$1")).replace(new RegExp("(</(?:" + r + ")>)", "gi"), "$1\n\n")).replace(/<hr( [^>]*)?>/gi, "<hr$1>\n\n")).replace(/\s*<option/gi, "<option")).replace(/<\/option>\s*/gi, "</option>")).replace(/\n\s*\n+/g, "\n\n")).replace(/([\s\S]+?)\n\n/g, "<p>$1</p>\n")).replace(/<p>\s*?<\/p>/gi, "")).replace(new RegExp("<p>\\s*(</?(?:" + r + ")(?: [^>]*)?>)\\s*</p>", "gi"), "$1")).replace(/<p>(<li.+?)<\/p>/gi, "$1")).replace(/<p>\s*<blockquote([^>]*)>/gi, "<blockquote$1><p>")).replace(/<\/blockquote>\s*<\/p>/gi, "</p></blockquote>")).replace(new RegExp("<p>\\s*(</?(?:" + r + ")(?: [^>]*)?>)", "gi"), "$1")).replace(new RegExp("(</?(?:" + r + ")(?: [^>]*)?>)\\s*</p>", "gi"), "$1")).replace(/(<br[^>]*>)\s*\n/gi, "$1")).replace(/\s*\n/g, "<br />\n")).replace(new RegExp("(</?(?:" + r + ")[^>]*>)\\s*<br />", "gi"), "$1")).replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi, "$1")).replace(/(?:<p>|<br ?\/?>)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|<br ?\/?>)*/gi, "[caption$1[/caption]")).replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g, function(e, t, n) {
+ return n.match(/<p( [^>]*)?>/) ? e : t + "<p>" + n + "</p>"
+ }), t && (e = e.replace(/<wp-line-break>/g, "\n")), n && (e = e.replace(/<wp-temp-br([^>]*)>/g, "<br$1>")), e
+ }
+
+ function t(e) {
+ var t = {
+ o: n,
+ data: e,
+ unfiltered: e
};
- return a && a("body").trigger("beforePreWpautop", [c]), c.data = s(c.data), a && a("body").trigger("afterPreWpautop", [c]), c.data
+ return f && f("body").trigger("beforePreWpautop", [t]), t.data = E(t.data), f && f("body").trigger("afterPreWpautop", [t]), t.data
}
- function v(b) {
- var c = {
- o: y,
- data: b,
- unfiltered: b
+ function o(e) {
+ var t = {
+ o: n,
+ data: e,
+ unfiltered: e
};
- return a && a("body").trigger("beforeWpautop", [c]), c.data = t(c.data), a && a("body").trigger("afterWpautop", [c]), c.data
- }
- var w, x, y = {};
- return a(document).on("tinymce-editor-init.keep-scroll-position", function(a, b) {
- b.$(".mce_SELRES_start").length && m(b)
- }), a ? a(document).ready(c) : document.addEventListener ? (document.addEventListener("DOMContentLoaded", c, !1), window.addEventListener("load", c, !1)) : window.attachEvent && (window.attachEvent("onload", c), document.attachEvent("onreadystatechange", function() {
- "complete" === document.readyState && c()
- })), b.editor.autop = v, b.editor.removep = u, y = {
- go: e,
- wpautop: v,
- pre_wpautop: u,
- _wp_Autop: t,
- _wp_Nop: s
+ return f && f("body").trigger("beforeWpautop", [t]), t.data = a(t.data), f && f("body").trigger("afterWpautop", [t]), t.data
}
- }
- b.editor = b.editor || {}, window.switchEditors = new c, b.editor.initialize = function(c, d) {
- var e, f;
- if (a && c && b.editor.getDefaultSettings) {
- if (f = b.editor.getDefaultSettings(), d || (d = {
+ return f(document).on("tinymce-editor-init.keep-scroll-position", function(e, t) {
+ t.$(".mce_SELRES_start").length && w(t)
+ }), f ? f(document).ready(e) : document.addEventListener ? (document.addEventListener("DOMContentLoaded", e, !1), window.addEventListener("load", e, !1)) : window.attachEvent && (window.attachEvent("onload", e), document.attachEvent("onreadystatechange", function() {
+ "complete" === document.readyState && e()
+ })), m.editor.autop = o, m.editor.removep = t, n = {
+ go: r,
+ wpautop: o,
+ pre_wpautop: t,
+ _wp_Autop: a,
+ _wp_Nop: E
+ }
+ }, m.editor.initialize = function(e, t) {
+ var n, r;
+ if (f && e && m.editor.getDefaultSettings) {
+ if (r = m.editor.getDefaultSettings(), t || (t = {
tinymce: !0
- }), d.tinymce && d.quicktags) {
- var g = a("#" + c),
- h = a("<div>").attr({
- "class": "wp-core-ui wp-editor-wrap tmce-active",
- id: "wp-" + c + "-wrap"
+ }), t.tinymce && t.quicktags) {
+ var i = f("#" + e),
+ a = f("<div>").attr({
+ class: "wp-core-ui wp-editor-wrap tmce-active",
+ id: "wp-" + e + "-wrap"
}),
- i = a('<div class="wp-editor-container">'),
- j = a("<button>").attr({
+ o = f('<div class="wp-editor-container">'),
+ c = f("<button>").attr({
type: "button",
- "data-wp-editor-id": c
+ "data-wp-editor-id": e
}),
- k = a('<div class="wp-editor-tools">');
- if (d.mediaButtons) {
- var l = "Add Media";
- window._wpMediaViewsL10n && window._wpMediaViewsL10n.addMedia && (l = window._wpMediaViewsL10n.addMedia);
- var m = a('<button type="button" class="button insert-media add_media">');
- m.append('<span class="wp-media-buttons-icon"></span>'), m.append(document.createTextNode(" " + l)), m.data("editor", c), k.append(a('<div class="wp-media-buttons">').append(m))
+ p = f('<div class="wp-editor-tools">');
+ if (t.mediaButtons) {
+ var s = "Add Media";
+ window._wpMediaViewsL10n && window._wpMediaViewsL10n.addMedia && (s = window._wpMediaViewsL10n.addMedia);
+ var d = f('<button type="button" class="button insert-media add_media">');
+ d.append('<span class="wp-media-buttons-icon"></span>'), d.append(document.createTextNode(" " + s)), d.data("editor", e), p.append(f('<div class="wp-media-buttons">').append(d))
}
- h.append(k.append(a('<div class="wp-editor-tabs">').append(j.clone().attr({
- id: c + "-tmce",
- "class": "wp-switch-editor switch-tmce"
- }).text(window.tinymce.translate("Visual"))).append(j.attr({
- id: c + "-html",
- "class": "wp-switch-editor switch-html"
- }).text(window.tinymce.translate("Text")))).append(i)), g.after(h), i.append(g)
+ a.append(p.append(f('<div class="wp-editor-tabs">').append(c.clone().attr({
+ id: e + "-tmce",
+ class: "wp-switch-editor switch-tmce"
+ }).text(window.tinymce.translate("Visual"))).append(c.attr({
+ id: e + "-html",
+ class: "wp-switch-editor switch-html"
+ }).text(window.tinymce.translate("Text")))).append(o)), i.after(a), o.append(i)
}
- window.tinymce && d.tinymce && ("object" != typeof d.tinymce && (d.tinymce = {}), e = a.extend({}, f.tinymce, d.tinymce), e.selector = "#" + c, a(document).trigger("wp-before-tinymce-init", e), window.tinymce.init(e), window.wpActiveEditor || (window.wpActiveEditor = c)), window.quicktags && d.quicktags && ("object" != typeof d.quicktags && (d.quicktags = {}), e = a.extend({}, f.quicktags, d.quicktags), e.id = c, a(document).trigger("wp-before-quicktags-init", e), window.quicktags(e), window.wpActiveEditor || (window.wpActiveEditor = e.id))
+ window.tinymce && t.tinymce && ("object" != typeof t.tinymce && (t.tinymce = {}), (n = f.extend({}, r.tinymce, t.tinymce)).selector = "#" + e, f(document).trigger("wp-before-tinymce-init", n), window.tinymce.init(n), window.wpActiveEditor || (window.wpActiveEditor = e)), window.quicktags && t.quicktags && ("object" != typeof t.quicktags && (t.quicktags = {}), (n = f.extend({}, r.quicktags, t.quicktags)).id = e, f(document).trigger("wp-before-quicktags-init", n), window.quicktags(n), window.wpActiveEditor || (window.wpActiveEditor = n.id))
}
- }, b.editor.remove = function(b) {
- var c, d, e = a("#wp-" + b + "-wrap");
- window.tinymce && (c = window.tinymce.get(b)) && (c.isHidden() || c.save(), c.remove()), window.quicktags && (d = window.QTags.getInstance(b)) && d.remove(), e.length && (e.after(a("#" + b)), e.remove())
- }, b.editor.getContent = function(b) {
- var c;
- if (a && b) return window.tinymce && (c = window.tinymce.get(b)) && !c.isHidden() && c.save(), a("#" + b).val()
+ }, m.editor.remove = function(e) {
+ var t, n, r = f("#wp-" + e + "-wrap");
+ window.tinymce && (t = window.tinymce.get(e)) && (t.isHidden() || t.save(), t.remove()), window.quicktags && (n = window.QTags.getInstance(e)) && n.remove(), r.length && (r.after(f("#" + e)), r.remove())
+ }, m.editor.getContent = function(e) {
+ var t;
+ if (f && e) return window.tinymce && (t = window.tinymce.get(e)) && !t.isHidden() && t.save(), f("#" + e).val()
}
}(window.jQuery, window.wp);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/gallery.min.js build-branch-unminified/wp-admin/js/gallery.min.js
--- build-unminified/wp-admin/js/gallery.min.js 2018-10-08 22:57:51.325445518 -0500
+++ build-branch-unminified/wp-admin/js/gallery.min.js 2018-10-08 22:55:02.228104441 -0500
@@ -1,89 +1,88 @@
-jQuery(document).ready(function(a) {
- var b, c, d, e, f, g = !1;
- c = function() {
- b = a("#media-items").sortable({
+jQuery(document).ready(function(l) {
+ var e, t, i, n, o = !1;
+ e = function() {
+ l("#media-items").sortable({
items: "div.media-item",
placeholder: "sorthelper",
axis: "y",
distance: 2,
handle: "div.filename",
stop: function() {
- var b = a("#media-items").sortable("toArray"),
- c = b.length;
- a.each(b, function(b, d) {
- var e = g ? c - b : 1 + b;
- a("#" + d + " .menu_order input").val(e)
+ var e = l("#media-items").sortable("toArray"),
+ n = e.length;
+ l.each(e, function(e, t) {
+ var i = o ? n - e : 1 + e;
+ l("#" + t + " .menu_order input").val(i)
})
}
})
- }, d = function() {
- var b = a(".menu_order_input"),
- c = b.length;
- b.each(function(b) {
- var d = g ? c - b : 1 + b;
- a(this).val(d)
+ }, t = function() {
+ var e = l(".menu_order_input"),
+ i = e.length;
+ e.each(function(e) {
+ var t = o ? i - e : 1 + e;
+ l(this).val(t)
})
- }, e = function(b) {
- b = b || 0, a(".menu_order_input").each(function() {
- ("0" === this.value || b) && (this.value = "")
+ }, i = function(e) {
+ e = e || 0, l(".menu_order_input").each(function() {
+ ("0" === this.value || e) && (this.value = "")
})
- }, a("#asc").click(function(a) {
- a.preventDefault(), g = !1, d()
- }), a("#desc").click(function(a) {
- a.preventDefault(), g = !0, d()
- }), a("#clear").click(function(a) {
- a.preventDefault(), e(1)
- }), a("#showall").click(function(b) {
- b.preventDefault(), a("#sort-buttons span a").toggle(), a("a.describe-toggle-on").hide(), a("a.describe-toggle-off, table.slidetoggle").show(), a("img.pinkynail").toggle(!1)
- }), a("#hideall").click(function(b) {
- b.preventDefault(), a("#sort-buttons span a").toggle(), a("a.describe-toggle-on").show(), a("a.describe-toggle-off, table.slidetoggle").hide(), a("img.pinkynail").toggle(!0)
- }), c(), e(), a("#media-items>*").length > 1 && (f = wpgallery.getWin(), a("#save-all, #gallery-settings").show(), "undefined" != typeof f.tinyMCE && f.tinyMCE.activeEditor && !f.tinyMCE.activeEditor.isHidden() ? (wpgallery.mcemode = !0, wpgallery.init()) : a("#insert-gallery").show())
+ }, l("#asc").click(function(e) {
+ e.preventDefault(), o = !1, t()
+ }), l("#desc").click(function(e) {
+ e.preventDefault(), o = !0, t()
+ }), l("#clear").click(function(e) {
+ e.preventDefault(), i(1)
+ }), l("#showall").click(function(e) {
+ e.preventDefault(), l("#sort-buttons span a").toggle(), l("a.describe-toggle-on").hide(), l("a.describe-toggle-off, table.slidetoggle").show(), l("img.pinkynail").toggle(!1)
+ }), l("#hideall").click(function(e) {
+ e.preventDefault(), l("#sort-buttons span a").toggle(), l("a.describe-toggle-on").show(), l("a.describe-toggle-off, table.slidetoggle").hide(), l("img.pinkynail").toggle(!0)
+ }), e(), i(), 1 < l("#media-items>*").length && (n = wpgallery.getWin(), l("#save-all, #gallery-settings").show(), void 0 !== n.tinyMCE && n.tinyMCE.activeEditor && !n.tinyMCE.activeEditor.isHidden() ? (wpgallery.mcemode = !0, wpgallery.init()) : l("#insert-gallery").show())
}), jQuery(window).unload(function() {
tinymce = tinyMCE = wpgallery = null
});
-var tinymce = null,
- tinyMCE, wpgallery;
+var tinyMCE, wpgallery, tinymce = null;
wpgallery = {
mcemode: !1,
editor: {},
dom: {},
is_update: !1,
el: {},
- I: function(a) {
- return document.getElementById(a)
+ I: function(e) {
+ return document.getElementById(e)
},
init: function() {
- var a, b, c, d, e = this,
- f = e.getWin();
- if (e.mcemode) {
- for (a = ("" + document.location.search).replace(/^\?/, "").split("&"), b = {}, c = 0; c < a.length; c++) d = a[c].split("="), b[unescape(d[0])] = unescape(d[1]);
- b.mce_rdomain && (document.domain = b.mce_rdomain), tinymce = f.tinymce, tinyMCE = f.tinyMCE, e.editor = tinymce.EditorManager.activeEditor, e.setup()
+ var e, t, i, n, l = this,
+ o = l.getWin();
+ if (l.mcemode) {
+ for (e = ("" + document.location.search).replace(/^\?/, "").split("&"), t = {}, i = 0; i < e.length; i++) n = e[i].split("="), t[unescape(n[0])] = unescape(n[1]);
+ t.mce_rdomain && (document.domain = t.mce_rdomain), tinymce = o.tinymce, tinyMCE = o.tinyMCE, l.editor = tinymce.EditorManager.activeEditor, l.setup()
}
},
getWin: function() {
return window.dialogArguments || opener || parent || top
},
setup: function() {
- var a, b, c, d, e, f, g = this,
- h = g.editor;
- if (g.mcemode) {
- if (g.el = h.selection.getNode(), "IMG" !== g.el.nodeName || !h.dom.hasClass(g.el, "wpGallery")) {
- if (!(b = h.dom.select("img.wpGallery")) || !b[0]) return "1" === getUserSetting("galfile") && (g.I("linkto-file").checked = "checked"), "1" === getUserSetting("galdesc") && (g.I("order-desc").checked = "checked"), getUserSetting("galcols") && (g.I("columns").value = getUserSetting("galcols")), getUserSetting("galord") && (g.I("orderby").value = getUserSetting("galord")), void jQuery("#insert-gallery").show();
- g.el = b[0]
+ var e, t, i, n, l, o, r = this,
+ a = r.editor;
+ if (r.mcemode) {
+ if (r.el = a.selection.getNode(), "IMG" !== r.el.nodeName || !a.dom.hasClass(r.el, "wpGallery")) {
+ if (!(t = a.dom.select("img.wpGallery")) || !t[0]) return "1" === getUserSetting("galfile") && (r.I("linkto-file").checked = "checked"), "1" === getUserSetting("galdesc") && (r.I("order-desc").checked = "checked"), getUserSetting("galcols") && (r.I("columns").value = getUserSetting("galcols")), getUserSetting("galord") && (r.I("orderby").value = getUserSetting("galord")), void jQuery("#insert-gallery").show();
+ r.el = t[0]
}
- a = h.dom.getAttrib(g.el, "title"), a = h.dom.decode(a), a ? (jQuery("#update-gallery").show(), g.is_update = !0, c = a.match(/columns=['"]([0-9]+)['"]/), d = a.match(/link=['"]([^'"]+)['"]/i), e = a.match(/order=['"]([^'"]+)['"]/i), f = a.match(/orderby=['"]([^'"]+)['"]/i), d && d[1] && (g.I("linkto-file").checked = "checked"), e && e[1] && (g.I("order-desc").checked = "checked"), c && c[1] && (g.I("columns").value = "" + c[1]), f && f[1] && (g.I("orderby").value = f[1])) : jQuery("#insert-gallery").show()
+ e = a.dom.getAttrib(r.el, "title"), (e = a.dom.decode(e)) ? (jQuery("#update-gallery").show(), r.is_update = !0, i = e.match(/columns=['"]([0-9]+)['"]/), n = e.match(/link=['"]([^'"]+)['"]/i), l = e.match(/order=['"]([^'"]+)['"]/i), o = e.match(/orderby=['"]([^'"]+)['"]/i), n && n[1] && (r.I("linkto-file").checked = "checked"), l && l[1] && (r.I("order-desc").checked = "checked"), i && i[1] && (r.I("columns").value = "" + i[1]), o && o[1] && (r.I("orderby").value = o[1])) : jQuery("#insert-gallery").show()
}
},
update: function() {
- var a, b = this,
- c = b.editor,
- d = "";
- if (!b.mcemode || !b.is_update) return a = "[gallery" + b.getSettings() + "]", void b.getWin().send_to_editor(a);
- "IMG" === b.el.nodeName && (d = c.dom.decode(c.dom.getAttrib(b.el, "title")), d = d.replace(/\s*(order|link|columns|orderby)=['"]([^'"]+)['"]/gi, ""), d += b.getSettings(), c.dom.setAttrib(b.el, "title", d), b.getWin().tb_remove())
+ var e, t = this,
+ i = t.editor,
+ n = "";
+ if (!t.mcemode || !t.is_update) return e = "[gallery" + t.getSettings() + "]", void t.getWin().send_to_editor(e);
+ "IMG" === t.el.nodeName && (n = (n = i.dom.decode(i.dom.getAttrib(t.el, "title"))).replace(/\s*(order|link|columns|orderby)=['"]([^'"]+)['"]/gi, ""), n += t.getSettings(), i.dom.setAttrib(t.el, "title", n), t.getWin().tb_remove())
},
getSettings: function() {
- var a = this.I,
- b = "";
- return a("linkto-file").checked && (b += ' link="file"', setUserSetting("galfile", "1")), a("order-desc").checked && (b += ' order="DESC"', setUserSetting("galdesc", "1")), 3 !== a("columns").value && (b += ' columns="' + a("columns").value + '"', setUserSetting("galcols", a("columns").value)), "menu_order" !== a("orderby").value && (b += ' orderby="' + a("orderby").value + '"', setUserSetting("galord", a("orderby").value)), b
+ var e = this.I,
+ t = "";
+ return e("linkto-file").checked && (t += ' link="file"', setUserSetting("galfile", "1")), e("order-desc").checked && (t += ' order="DESC"', setUserSetting("galdesc", "1")), 3 !== e("columns").value && (t += ' columns="' + e("columns").value + '"', setUserSetting("galcols", e("columns").value)), "menu_order" !== e("orderby").value && (t += ' orderby="' + e("orderby").value + '"', setUserSetting("galord", e("orderby").value)), t
}
};
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/image-edit.min.js build-branch-unminified/wp-admin/js/image-edit.min.js
--- build-unminified/wp-admin/js/image-edit.min.js 2018-10-08 22:57:55.825481158 -0500
+++ build-branch-unminified/wp-admin/js/image-edit.min.js 2018-10-08 22:55:07.196143892 -0500
@@ -1,298 +1,296 @@
-! function(a) {
- var b = window.imageEdit = {
+! function(m) {
+ var l = window.imageEdit = {
iasapi: {},
hold: {},
postid: "",
_view: !1,
- intval: function(a) {
- return 0 | a
+ intval: function(i) {
+ return 0 | i
},
- setDisabled: function(a, b) {
- b ? a.removeClass("disabled").prop("disabled", !1) : a.addClass("disabled").prop("disabled", !0)
+ setDisabled: function(i, t) {
+ t ? i.removeClass("disabled").prop("disabled", !1) : i.addClass("disabled").prop("disabled", !0)
},
- init: function(b) {
- var c = this,
- d = a("#image-editor-" + c.postid),
- e = c.intval(a("#imgedit-x-" + b).val()),
- f = c.intval(a("#imgedit-y-" + b).val());
- c.postid !== b && d.length && c.close(c.postid), c.hold.w = c.hold.ow = e, c.hold.h = c.hold.oh = f, c.hold.xy_ratio = e / f, c.hold.sizer = parseFloat(a("#imgedit-sizer-" + b).val()), c.postid = b, a("#imgedit-response-" + b).empty(), a('input[type="text"]', "#imgedit-panel-" + b).keypress(function(b) {
- var c = b.keyCode;
- if (36 < c && c < 41 && a(this).blur(), 13 === c) return b.preventDefault(), b.stopPropagation(), !1
+ init: function(i) {
+ var t = this,
+ e = m("#image-editor-" + t.postid),
+ a = t.intval(m("#imgedit-x-" + i).val()),
+ o = t.intval(m("#imgedit-y-" + i).val());
+ t.postid !== i && e.length && t.close(t.postid), t.hold.w = t.hold.ow = a, t.hold.h = t.hold.oh = o, t.hold.xy_ratio = a / o, t.hold.sizer = parseFloat(m("#imgedit-sizer-" + i).val()), t.postid = i, m("#imgedit-response-" + i).empty(), m('input[type="text"]', "#imgedit-panel-" + i).keypress(function(i) {
+ var t = i.keyCode;
+ if (36 < t && t < 41 && m(this).blur(), 13 === t) return i.preventDefault(), i.stopPropagation(), !1
})
},
- toggleEditor: function(b, c) {
- var d = a("#imgedit-wait-" + b);
- c ? d.fadeIn("fast") : d.fadeOut("fast")
- },
- toggleHelp: function(b) {
- var c = a(b);
- return c.attr("aria-expanded", "false" === c.attr("aria-expanded") ? "true" : "false").parents(".imgedit-group-top").toggleClass("imgedit-help-toggled").find(".imgedit-help").slideToggle("fast"), !1
- },
- getTarget: function(b) {
- return a('input[name="imgedit-target-' + b + '"]:checked', "#imgedit-save-target-" + b).val() || "full"
- },
- scaleChanged: function(b, c, d) {
- var e = a("#imgedit-scale-width-" + b),
- f = a("#imgedit-scale-height-" + b),
- g = a("#imgedit-scale-warn-" + b),
- h = "",
- i = "";
- !1 !== this.validateNumeric(d) && (c ? (i = "" !== e.val() ? Math.round(e.val() / this.hold.xy_ratio) : "", f.val(i)) : (h = "" !== f.val() ? Math.round(f.val() * this.hold.xy_ratio) : "", e.val(h)), i && i > this.hold.oh || h && h > this.hold.ow ? g.css("visibility", "visible") : g.css("visibility", "hidden"))
- },
- getSelRatio: function(b) {
- var c = this.hold.w,
- d = this.hold.h,
- e = this.intval(a("#imgedit-crop-width-" + b).val()),
- f = this.intval(a("#imgedit-crop-height-" + b).val());
- return e && f ? e + ":" + f : c && d ? c + ":" + d : "1:1"
- },
- filterHistory: function(b, c) {
- var d, e, f, g, h = a("#imgedit-history-" + b).val(),
- i = [];
- if ("" !== h) {
- if (h = JSON.parse(h), (d = this.intval(a("#imgedit-undone-" + b).val())) > 0)
- for (; d > 0;) h.pop(), d--;
- if (c) {
- if (!h.length) return this.hold.w = this.hold.ow, this.hold.h = this.hold.oh, "";
- f = h[h.length - 1], f = f.c || f.r || f.f || !1, f && (this.hold.w = f.fw, this.hold.h = f.fh)
- }
- for (e in h) g = h[e], g.hasOwnProperty("c") ? i[e] = {
- c: {
- x: g.c.x,
- y: g.c.y,
- w: g.c.w,
- h: g.c.h
- }
- } : g.hasOwnProperty("r") ? i[e] = {
- r: g.r.r
- } : g.hasOwnProperty("f") && (i[e] = {
- f: g.f.f
- });
- return JSON.stringify(i)
+ toggleEditor: function(i, t) {
+ var e = m("#imgedit-wait-" + i);
+ t ? e.fadeIn("fast") : e.fadeOut("fast")
+ },
+ toggleHelp: function(i) {
+ var t = m(i);
+ return t.attr("aria-expanded", "false" === t.attr("aria-expanded") ? "true" : "false").parents(".imgedit-group-top").toggleClass("imgedit-help-toggled").find(".imgedit-help").slideToggle("fast"), !1
+ },
+ getTarget: function(i) {
+ return m('input[name="imgedit-target-' + i + '"]:checked', "#imgedit-save-target-" + i).val() || "full"
+ },
+ scaleChanged: function(i, t, e) {
+ var a = m("#imgedit-scale-width-" + i),
+ o = m("#imgedit-scale-height-" + i),
+ s = m("#imgedit-scale-warn-" + i),
+ n = "",
+ d = "";
+ !1 !== this.validateNumeric(e) && (t ? (d = "" !== a.val() ? Math.round(a.val() / this.hold.xy_ratio) : "", o.val(d)) : (n = "" !== o.val() ? Math.round(o.val() * this.hold.xy_ratio) : "", a.val(n)), d && d > this.hold.oh || n && n > this.hold.ow ? s.css("visibility", "visible") : s.css("visibility", "hidden"))
+ },
+ getSelRatio: function(i) {
+ var t = this.hold.w,
+ e = this.hold.h,
+ a = this.intval(m("#imgedit-crop-width-" + i).val()),
+ o = this.intval(m("#imgedit-crop-height-" + i).val());
+ return a && o ? a + ":" + o : t && e ? t + ":" + e : "1:1"
+ },
+ filterHistory: function(i, t) {
+ var e, a, o, s, n = m("#imgedit-history-" + i).val(),
+ d = [];
+ if ("" === n) return "";
+ if (n = JSON.parse(n), 0 < (e = this.intval(m("#imgedit-undone-" + i).val())))
+ for (; 0 < e;) n.pop(), e--;
+ if (t) {
+ if (!n.length) return this.hold.w = this.hold.ow, this.hold.h = this.hold.oh, "";
+ (o = (o = n[n.length - 1]).c || o.r || o.f || !1) && (this.hold.w = o.fw, this.hold.h = o.fh)
}
- return ""
- },
- refreshEditor: function(c, d, e) {
- var f, g, h = this;
- h.toggleEditor(c, 1), f = {
+ for (a in n)(s = n[a]).hasOwnProperty("c") ? d[a] = {
+ c: {
+ x: s.c.x,
+ y: s.c.y,
+ w: s.c.w,
+ h: s.c.h
+ }
+ } : s.hasOwnProperty("r") ? d[a] = {
+ r: s.r.r
+ } : s.hasOwnProperty("f") && (d[a] = {
+ f: s.f.f
+ });
+ return JSON.stringify(d)
+ },
+ refreshEditor: function(n, i, d) {
+ var t, r, e = this;
+ e.toggleEditor(n, 1), t = {
action: "imgedit-preview",
- _ajax_nonce: d,
- postid: c,
- history: h.filterHistory(c, 1),
- rand: h.intval(1e6 * Math.random())
- }, g = a('<img id="image-preview-' + c + '" alt="" />').on("load", {
- history: f.history
- }, function(d) {
- var f, h, i, j = a("#imgedit-crop-" + c),
- k = b;
- "" !== d.data.history && (i = JSON.parse(d.data.history), i[i.length - 1].hasOwnProperty("c") && (k.setDisabled(a("#image-undo-" + c), !0), a("#image-undo-" + c).focus())), j.empty().append(g), f = Math.max(k.hold.w, k.hold.h), h = Math.max(a(g).width(), a(g).height()), k.hold.sizer = f > h ? h / f : 1, k.initCrop(c, g, j), k.setCropSelection(c, 0), void 0 !== e && null !== e && e(), a("#imgedit-history-" + c).val() && "0" === a("#imgedit-undone-" + c).val() ? a("input.imgedit-submit-btn", "#imgedit-panel-" + c).removeAttr("disabled") : a("input.imgedit-submit-btn", "#imgedit-panel-" + c).prop("disabled", !0), k.toggleEditor(c, 0)
+ _ajax_nonce: i,
+ postid: n,
+ history: e.filterHistory(n, 1),
+ rand: e.intval(1e6 * Math.random())
+ }, r = m('<img id="image-preview-' + n + '" alt="" />').on("load", {
+ history: t.history
+ }, function(i) {
+ var t, e, a, o = m("#imgedit-crop-" + n),
+ s = l;
+ "" !== i.data.history && (a = JSON.parse(i.data.history))[a.length - 1].hasOwnProperty("c") && (s.setDisabled(m("#image-undo-" + n), !0), m("#image-undo-" + n).focus()), o.empty().append(r), t = Math.max(s.hold.w, s.hold.h), e = Math.max(m(r).width(), m(r).height()), s.hold.sizer = e < t ? e / t : 1, s.initCrop(n, r, o), s.setCropSelection(n, 0), null != d && d(), m("#imgedit-history-" + n).val() && "0" === m("#imgedit-undone-" + n).val() ? m("input.imgedit-submit-btn", "#imgedit-panel-" + n).removeAttr("disabled") : m("input.imgedit-submit-btn", "#imgedit-panel-" + n).prop("disabled", !0), s.toggleEditor(n, 0)
}).on("error", function() {
- a("#imgedit-crop-" + c).empty().append('<div class="error"><p>' + imageEditL10n.error + "</p></div>"), h.toggleEditor(c, 0)
- }).attr("src", ajaxurl + "?" + a.param(f))
+ m("#imgedit-crop-" + n).empty().append('<div class="error"><p>' + imageEditL10n.error + "</p></div>"), e.toggleEditor(n, 0)
+ }).attr("src", ajaxurl + "?" + m.param(t))
},
- action: function(b, c, d) {
- var e, f, g, h, i, j = this;
- if (j.notsaved(b)) return !1;
- if (e = {
+ action: function(t, i, e) {
+ var a, o, s, n, d, r = this;
+ if (r.notsaved(t)) return !1;
+ if (a = {
action: "image-editor",
- _ajax_nonce: c,
- postid: b
- }, "scale" === d) {
- if (f = a("#imgedit-scale-width-" + b), g = a("#imgedit-scale-height-" + b), h = j.intval(f.val()), i = j.intval(g.val()), h < 1) return f.focus(), !1;
- if (i < 1) return g.focus(), !1;
- if (h === j.hold.ow || i === j.hold.oh) return !1;
- e["do"] = "scale", e.fwidth = h, e.fheight = i
+ _ajax_nonce: i,
+ postid: t
+ }, "scale" === e) {
+ if (o = m("#imgedit-scale-width-" + t), s = m("#imgedit-scale-height-" + t), n = r.intval(o.val()), d = r.intval(s.val()), n < 1) return o.focus(), !1;
+ if (d < 1) return s.focus(), !1;
+ if (n === r.hold.ow || d === r.hold.oh) return !1;
+ a.do = "scale", a.fwidth = n, a.fheight = d
} else {
- if ("restore" !== d) return !1;
- e["do"] = "restore"
+ if ("restore" !== e) return !1;
+ a.do = "restore"
}
- j.toggleEditor(b, 1), a.post(ajaxurl, e, function(c) {
- a("#image-editor-" + b).empty().append(c), j.toggleEditor(b, 0), j._view && j._view.refresh()
+ r.toggleEditor(t, 1), m.post(ajaxurl, a, function(i) {
+ m("#image-editor-" + t).empty().append(i), r.toggleEditor(t, 0), r._view && r._view.refresh()
})
},
- save: function(c, d) {
- var e, f = this.getTarget(c),
- g = this.filterHistory(c, 0),
- h = this;
- if ("" === g) return !1;
- this.toggleEditor(c, 1), e = {
+ save: function(e, i) {
+ var t, a = this.getTarget(e),
+ o = this.filterHistory(e, 0),
+ s = this;
+ if ("" === o) return !1;
+ this.toggleEditor(e, 1), t = {
action: "image-editor",
- _ajax_nonce: d,
- postid: c,
- history: g,
- target: f,
- context: a("#image-edit-context").length ? a("#image-edit-context").val() : null,
- "do": "save"
- }, a.post(ajaxurl, e, function(d) {
- var e = JSON.parse(d);
- if (e.error) return a("#imgedit-response-" + c).html('<div class="error"><p>' + e.error + "</p></div>"), void b.close(c);
- e.fw && e.fh && a("#media-dims-" + c).html(e.fw + " &times; " + e.fh), e.thumbnail && a(".thumbnail", "#thumbnail-head-" + c).attr("src", "" + e.thumbnail), e.msg && a("#imgedit-response-" + c).html('<div class="updated"><p>' + e.msg + "</p></div>"), h._view ? h._view.save() : b.close(c)
+ _ajax_nonce: i,
+ postid: e,
+ history: o,
+ target: a,
+ context: m("#image-edit-context").length ? m("#image-edit-context").val() : null,
+ do: "save"
+ }, m.post(ajaxurl, t, function(i) {
+ var t = JSON.parse(i);
+ if (t.error) return m("#imgedit-response-" + e).html('<div class="error"><p>' + t.error + "</p></div>"), void l.close(e);
+ t.fw && t.fh && m("#media-dims-" + e).html(t.fw + " &times; " + t.fh), t.thumbnail && m(".thumbnail", "#thumbnail-head-" + e).attr("src", "" + t.thumbnail), t.msg && m("#imgedit-response-" + e).html('<div class="updated"><p>' + t.msg + "</p></div>"), s._view ? s._view.save() : l.close(e)
})
},
- open: function(c, d, e) {
+ open: function(t, i, e) {
this._view = e;
- var f, g = a("#image-editor-" + c),
- h = a("#media-head-" + c),
- i = a("#imgedit-open-btn-" + c),
- j = i.siblings(".spinner");
- if (!i.hasClass("button-activated")) return j.addClass("is-active"), f = {
+ var a, o = m("#image-editor-" + t),
+ s = m("#media-head-" + t),
+ n = m("#imgedit-open-btn-" + t),
+ d = n.siblings(".spinner");
+ if (!n.hasClass("button-activated")) return d.addClass("is-active"), a = {
action: "image-editor",
- _ajax_nonce: d,
- postid: c,
- "do": "open"
- }, a.ajax({
+ _ajax_nonce: i,
+ postid: t,
+ do: "open"
+ }, m.ajax({
url: ajaxurl,
type: "post",
- data: f,
+ data: a,
beforeSend: function() {
- i.addClass("button-activated")
+ n.addClass("button-activated")
}
- }).done(function(a) {
- g.html(a), h.fadeOut("fast", function() {
- g.fadeIn("fast"), i.removeClass("button-activated"), j.removeClass("is-active")
- }), b.init(c)
+ }).done(function(i) {
+ o.html(i), s.fadeOut("fast", function() {
+ o.fadeIn("fast"), n.removeClass("button-activated"), d.removeClass("is-active")
+ }), l.init(t)
})
},
- imgLoaded: function(b) {
- var c = a("#image-preview-" + b),
- d = a("#imgedit-crop-" + b);
- "undefined" == typeof this.hold.sizer && this.init(b), this.initCrop(b, c, d), this.setCropSelection(b, 0), this.toggleEditor(b, 0), a(".imgedit-wrap .imgedit-help-toggle").eq(0).focus()
- },
- initCrop: function(c, d, e) {
- var f, g = this,
- h = a("#imgedit-sel-width-" + c),
- i = a("#imgedit-sel-height-" + c);
- g.iasapi = a(d).imgAreaSelect({
- parent: e,
+ imgLoaded: function(i) {
+ var t = m("#image-preview-" + i),
+ e = m("#imgedit-crop-" + i);
+ void 0 === this.hold.sizer && this.init(i), this.initCrop(i, t, e), this.setCropSelection(i, 0), this.toggleEditor(i, 0), m(".imgedit-wrap .imgedit-help-toggle").eq(0).focus()
+ },
+ initCrop: function(o, i, t) {
+ var s = this,
+ a = m("#imgedit-sel-width-" + o),
+ n = m("#imgedit-sel-height-" + o);
+ s.iasapi = m(i).imgAreaSelect({
+ parent: t,
instance: !0,
handles: !0,
keys: !0,
minWidth: 3,
minHeight: 3,
- onInit: function(b) {
- f = a(b), f.next().css("position", "absolute").nextAll(".imgareaselect-outer").css("position", "absolute"), e.children().on("mousedown, touchstart", function(a) {
- var b, d, e = !1;
- a.shiftKey && (b = g.iasapi.getSelection(), d = g.getSelRatio(c), e = b && b.width && b.height ? b.width + ":" + b.height : d), g.iasapi.setOptions({
- aspectRatio: e
+ onInit: function(i) {
+ m(i).next().css("position", "absolute").nextAll(".imgareaselect-outer").css("position", "absolute"), t.children().on("mousedown, touchstart", function(i) {
+ var t, e, a = !1;
+ i.shiftKey && (t = s.iasapi.getSelection(), e = s.getSelRatio(o), a = t && t.width && t.height ? t.width + ":" + t.height : e), s.iasapi.setOptions({
+ aspectRatio: a
})
})
},
onSelectStart: function() {
- b.setDisabled(a("#imgedit-crop-sel-" + c), 1)
+ l.setDisabled(m("#imgedit-crop-sel-" + o), 1)
},
- onSelectEnd: function(a, d) {
- b.setCropSelection(c, d)
+ onSelectEnd: function(i, t) {
+ l.setCropSelection(o, t)
},
- onSelectChange: function(a, c) {
- var d = b.hold.sizer;
- h.val(b.round(c.width / d)), i.val(b.round(c.height / d))
+ onSelectChange: function(i, t) {
+ var e = l.hold.sizer;
+ a.val(l.round(t.width / e)), n.val(l.round(t.height / e))
}
})
},
- setCropSelection: function(b, c) {
- var d;
- if (!(c = c || 0) || c.width < 3 && c.height < 3) return this.setDisabled(a(".imgedit-crop", "#imgedit-panel-" + b), 0), this.setDisabled(a("#imgedit-crop-sel-" + b), 0), a("#imgedit-sel-width-" + b).val(""), a("#imgedit-sel-height-" + b).val(""), a("#imgedit-selection-" + b).val(""), !1;
- d = {
- x: c.x1,
- y: c.y1,
- w: c.width,
- h: c.height
- }, this.setDisabled(a(".imgedit-crop", "#imgedit-panel-" + b), 1), a("#imgedit-selection-" + b).val(JSON.stringify(d))
- },
- close: function(b, c) {
- if ((c = c || !1) && this.notsaved(b)) return !1;
- this.iasapi = {}, this.hold = {}, this._view ? this._view.back() : a("#image-editor-" + b).fadeOut("fast", function() {
- a("#media-head-" + b).fadeIn("fast", function() {
- a("#imgedit-open-btn-" + b).focus()
- }), a(this).empty()
+ setCropSelection: function(i, t) {
+ var e;
+ if (!(t = t || 0) || t.width < 3 && t.height < 3) return this.setDisabled(m(".imgedit-crop", "#imgedit-panel-" + i), 0), this.setDisabled(m("#imgedit-crop-sel-" + i), 0), m("#imgedit-sel-width-" + i).val(""), m("#imgedit-sel-height-" + i).val(""), m("#imgedit-selection-" + i).val(""), !1;
+ e = {
+ x: t.x1,
+ y: t.y1,
+ w: t.width,
+ h: t.height
+ }, this.setDisabled(m(".imgedit-crop", "#imgedit-panel-" + i), 1), m("#imgedit-selection-" + i).val(JSON.stringify(e))
+ },
+ close: function(i, t) {
+ if ((t = t || !1) && this.notsaved(i)) return !1;
+ this.iasapi = {}, this.hold = {}, this._view ? this._view.back() : m("#image-editor-" + i).fadeOut("fast", function() {
+ m("#media-head-" + i).fadeIn("fast", function() {
+ m("#imgedit-open-btn-" + i).focus()
+ }), m(this).empty()
})
},
- notsaved: function(b) {
- var c = a("#imgedit-history-" + b).val(),
- d = "" !== c ? JSON.parse(c) : [];
- return this.intval(a("#imgedit-undone-" + b).val()) < d.length && !confirm(a("#imgedit-leaving-" + b).html())
- },
- addStep: function(b, c, d) {
- for (var e = this, f = a("#imgedit-history-" + c), g = "" !== f.val() ? JSON.parse(f.val()) : [], h = a("#imgedit-undone-" + c), i = e.intval(h.val()); i > 0;) g.pop(), i--;
- h.val(0), g.push(b), f.val(JSON.stringify(g)), e.refreshEditor(c, d, function() {
- e.setDisabled(a("#image-undo-" + c), !0), e.setDisabled(a("#image-redo-" + c), !1)
+ notsaved: function(i) {
+ var t = m("#imgedit-history-" + i).val(),
+ e = "" !== t ? JSON.parse(t) : [];
+ return this.intval(m("#imgedit-undone-" + i).val()) < e.length && !confirm(m("#imgedit-leaving-" + i).html())
+ },
+ addStep: function(i, t, e) {
+ for (var a = this, o = m("#imgedit-history-" + t), s = "" !== o.val() ? JSON.parse(o.val()) : [], n = m("#imgedit-undone-" + t), d = a.intval(n.val()); 0 < d;) s.pop(), d--;
+ n.val(0), s.push(i), o.val(JSON.stringify(s)), a.refreshEditor(t, e, function() {
+ a.setDisabled(m("#image-undo-" + t), !0), a.setDisabled(m("#image-redo-" + t), !1)
})
},
- rotate: function(b, c, d, e) {
- if (a(e).hasClass("disabled")) return !1;
+ rotate: function(i, t, e, a) {
+ if (m(a).hasClass("disabled")) return !1;
this.addStep({
r: {
- r: b,
+ r: i,
fw: this.hold.h,
fh: this.hold.w
}
- }, c, d)
+ }, t, e)
},
- flip: function(b, c, d, e) {
- if (a(e).hasClass("disabled")) return !1;
+ flip: function(i, t, e, a) {
+ if (m(a).hasClass("disabled")) return !1;
this.addStep({
f: {
- f: b,
+ f: i,
fw: this.hold.w,
fh: this.hold.h
}
- }, c, d)
+ }, t, e)
},
- crop: function(b, c, d) {
- var e = a("#imgedit-selection-" + b).val(),
- f = this.intval(a("#imgedit-sel-width-" + b).val()),
- g = this.intval(a("#imgedit-sel-height-" + b).val());
- if (a(d).hasClass("disabled") || "" === e) return !1;
- e = JSON.parse(e), e.w > 0 && e.h > 0 && f > 0 && g > 0 && (e.fw = f, e.fh = g, this.addStep({
- c: e
- }, b, c))
- },
- undo: function(b, c) {
- var d = this,
- e = a("#image-undo-" + b),
- f = a("#imgedit-undone-" + b),
- g = d.intval(f.val()) + 1;
- e.hasClass("disabled") || (f.val(g), d.refreshEditor(b, c, function() {
- var c = a("#imgedit-history-" + b),
- f = "" !== c.val() ? JSON.parse(c.val()) : [];
- d.setDisabled(a("#image-redo-" + b), !0), d.setDisabled(e, g < f.length), f.length === g && a("#image-redo-" + b).focus()
+ crop: function(i, t, e) {
+ var a = m("#imgedit-selection-" + i).val(),
+ o = this.intval(m("#imgedit-sel-width-" + i).val()),
+ s = this.intval(m("#imgedit-sel-height-" + i).val());
+ if (m(e).hasClass("disabled") || "" === a) return !1;
+ 0 < (a = JSON.parse(a)).w && 0 < a.h && 0 < o && 0 < s && (a.fw = o, a.fh = s, this.addStep({
+ c: a
+ }, i, t))
+ },
+ undo: function(e, i) {
+ var a = this,
+ o = m("#image-undo-" + e),
+ t = m("#imgedit-undone-" + e),
+ s = a.intval(t.val()) + 1;
+ o.hasClass("disabled") || (t.val(s), a.refreshEditor(e, i, function() {
+ var i = m("#imgedit-history-" + e),
+ t = "" !== i.val() ? JSON.parse(i.val()) : [];
+ a.setDisabled(m("#image-redo-" + e), !0), a.setDisabled(o, s < t.length), t.length === s && m("#image-redo-" + e).focus()
}))
},
- redo: function(b, c) {
- var d = this,
- e = a("#image-redo-" + b),
- f = a("#imgedit-undone-" + b),
- g = d.intval(f.val()) - 1;
- e.hasClass("disabled") || (f.val(g), d.refreshEditor(b, c, function() {
- d.setDisabled(a("#image-undo-" + b), !0), d.setDisabled(e, g > 0), 0 === g && a("#image-undo-" + b).focus()
+ redo: function(i, t) {
+ var e = this,
+ a = m("#image-redo-" + i),
+ o = m("#imgedit-undone-" + i),
+ s = e.intval(o.val()) - 1;
+ a.hasClass("disabled") || (o.val(s), e.refreshEditor(i, t, function() {
+ e.setDisabled(m("#image-undo-" + i), !0), e.setDisabled(a, 0 < s), 0 === s && m("#image-undo-" + i).focus()
}))
},
- setNumSelection: function(b, c) {
- var d, e, f, g, h, i = a("#imgedit-sel-width-" + b),
- j = a("#imgedit-sel-height-" + b),
- k = this.intval(i.val()),
- l = this.intval(j.val()),
- m = a("#image-preview-" + b),
- n = m.height(),
- o = m.width(),
- p = this.hold.sizer,
- q = this.iasapi;
- if (!1 !== this.validateNumeric(c)) return k < 1 ? (i.val(""), !1) : l < 1 ? (j.val(""), !1) : void(k && l && (d = q.getSelection()) && (g = d.x1 + Math.round(k * p), h = d.y1 + Math.round(l * p), e = d.x1, f = d.y1, g > o && (e = 0, g = o, i.val(Math.round(g / p))), h > n && (f = 0, h = n, j.val(Math.round(h / p))), q.setSelection(e, f, g, h), q.update(), this.setCropSelection(b, q.getSelection())))
- },
- round: function(a) {
- var b;
- return a = Math.round(a), this.hold.sizer > .6 ? a : (b = a.toString().slice(-1), "1" === b ? a - 1 : "9" === b ? a + 1 : a)
- },
- setRatioSelection: function(b, c, d) {
- var e, f, g = this.intval(a("#imgedit-crop-width-" + b).val()),
- h = this.intval(a("#imgedit-crop-height-" + b).val()),
- i = a("#image-preview-" + b).height();
- !1 !== this.validateNumeric(d) && g && h && (this.iasapi.setOptions({
- aspectRatio: g + ":" + h
- }), (e = this.iasapi.getSelection(!0)) && (f = Math.ceil(e.y1 + (e.x2 - e.x1) / (g / h)), f > i && (f = i, c ? a("#imgedit-crop-height-" + b).val("") : a("#imgedit-crop-width-" + b).val("")), this.iasapi.setSelection(e.x1, e.y1, e.x2, f), this.iasapi.update()))
+ setNumSelection: function(i, t) {
+ var e, a, o, s, n, d = m("#imgedit-sel-width-" + i),
+ r = m("#imgedit-sel-height-" + i),
+ l = this.intval(d.val()),
+ h = this.intval(r.val()),
+ g = m("#image-preview-" + i),
+ c = g.height(),
+ v = g.width(),
+ u = this.hold.sizer,
+ p = this.iasapi;
+ if (!1 !== this.validateNumeric(t)) return l < 1 ? (d.val(""), !1) : h < 1 ? (r.val(""), !1) : void(l && h && (e = p.getSelection()) && (s = e.x1 + Math.round(l * u), n = e.y1 + Math.round(h * u), a = e.x1, o = e.y1, v < s && (a = 0, s = v, d.val(Math.round(s / u))), c < n && (o = 0, n = c, r.val(Math.round(n / u))), p.setSelection(a, o, s, n), p.update(), this.setCropSelection(i, p.getSelection())))
+ },
+ round: function(i) {
+ var t;
+ return i = Math.round(i), .6 < this.hold.sizer ? i : "1" === (t = i.toString().slice(-1)) ? i - 1 : "9" === t ? i + 1 : i
+ },
+ setRatioSelection: function(i, t, e) {
+ var a, o, s = this.intval(m("#imgedit-crop-width-" + i).val()),
+ n = this.intval(m("#imgedit-crop-height-" + i).val()),
+ d = m("#image-preview-" + i).height();
+ !1 !== this.validateNumeric(e) && s && n && (this.iasapi.setOptions({
+ aspectRatio: s + ":" + n
+ }), (a = this.iasapi.getSelection(!0)) && (d < (o = Math.ceil(a.y1 + (a.x2 - a.x1) / (s / n))) && (o = d, t ? m("#imgedit-crop-height-" + i).val("") : m("#imgedit-crop-width-" + i).val("")), this.iasapi.setSelection(a.x1, a.y1, a.x2, o), this.iasapi.update()))
},
- validateNumeric: function(b) {
- if (!this.intval(a(b).val())) return a(b).val(""), !1
+ validateNumeric: function(i) {
+ if (!this.intval(m(i).val())) return m(i).val(""), !1
}
}
}(jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/inline-edit-post.min.js build-branch-unminified/wp-admin/js/inline-edit-post.min.js
--- build-unminified/wp-admin/js/inline-edit-post.min.js 2018-10-08 22:57:53.201460376 -0500
+++ build-branch-unminified/wp-admin/js/inline-edit-post.min.js 2018-10-08 22:55:04.824125056 -0500
@@ -1,121 +1,120 @@
-window.wp = window.wp || {};
var inlineEditPost;
-! function(a, b) {
- inlineEditPost = {
- init: function() {
- var b = this,
- c = a("#inline-edit"),
- d = a("#bulk-edit");
- b.type = a("table.widefat").hasClass("pages") ? "page" : "post", b.what = "#post-", c.keyup(function(a) {
- if (27 === a.which) return inlineEditPost.revert()
- }), d.keyup(function(a) {
- if (27 === a.which) return inlineEditPost.revert()
- }), a(".cancel", c).click(function() {
- return inlineEditPost.revert()
- }), a(".save", c).click(function() {
- return inlineEditPost.save(this)
- }), a("td", c).keydown(function(b) {
- if (13 === b.which && !a(b.target).hasClass("cancel")) return inlineEditPost.save(this)
- }), a(".cancel", d).click(function() {
- return inlineEditPost.revert()
- }), a('#inline-edit .inline-edit-private input[value="private"]').click(function() {
- var b = a("input.inline-edit-password-input");
- a(this).prop("checked") ? b.val("").prop("disabled", !0) : b.prop("disabled", !1)
- }), a("#the-list").on("click", "a.editinline", function(a) {
- a.preventDefault(), inlineEditPost.edit(this)
- }), a("#bulk-edit").find("fieldset:first").after(a("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(a("#inline-edit label.inline-edit-tags").clone()), a('select[name="_status"] option[value="future"]', d).remove(), a("#doaction, #doaction2").click(function(c) {
- var d;
- b.whichBulkButtonId = a(this).attr("id"), d = b.whichBulkButtonId.substr(2), "edit" === a('select[name="' + d + '"]').val() ? (c.preventDefault(), b.setBulk()) : a("form#posts-filter tr.inline-editor").length > 0 && b.revert()
- })
- },
- toggle: function(b) {
- var c = this;
- "none" === a(c.what + c.getId(b)).css("display") ? c.revert() : c.edit(b)
- },
- setBulk: function() {
- var b = "",
- c = this.type,
- d = !0;
- if (this.revert(), a("#bulk-edit td").attr("colspan", a("th:visible, td:visible", ".widefat:first thead").length), a("table.widefat tbody").prepend(a("#bulk-edit")).prepend('<tr class="hidden"></tr>'), a("#bulk-edit").addClass("inline-editor").show(), a('tbody th.check-column input[type="checkbox"]').each(function() {
- if (a(this).prop("checked")) {
- d = !1;
- var c, e = a(this).val();
- c = a("#inline_" + e + " .post_title").html() || inlineEditL10n.notitle, b += '<div id="ttle' + e + '"><a id="_' + e + '" class="ntdelbutton" title="' + inlineEditL10n.ntdeltitle + '">X</a>' + c + "</div>"
- }
- }), d) return this.revert();
- a("#bulk-titles").html(b), a("#bulk-titles a").click(function() {
- var b = a(this).attr("id").substr(1);
- a('table.widefat input[value="' + b + '"]').prop("checked", !1), a("#ttle" + b).remove()
- }), "post" === c && a("tr.inline-editor textarea[data-wp-taxonomy]").each(function(b, c) {
- a(c).autocomplete("instance") || a(c).wpTagsSuggest()
- }), a("html, body").animate({
- scrollTop: 0
- }, "fast")
- },
- edit: function(b) {
- var c, d, e, f, g, h, i, j, k, l, m, n = this,
- o = !0;
- for (n.revert(), "object" == typeof b && (b = n.getId(b)), c = ["post_title", "post_name", "post_author", "_status", "jj", "mm", "aa", "hh", "mn", "ss", "post_password", "post_format", "menu_order", "page_template"], "page" === n.type && c.push("post_parent"), d = a("#inline-edit").clone(!0), a("td", d).attr("colspan", a("th:visible, td:visible", ".widefat:first thead").length), a(n.what + b).removeClass("is-expanded").hide().after(d).after('<tr class="hidden"></tr>'), e = a("#inline_" + b), a(':input[name="post_author"] option[value="' + a(".post_author", e).text() + '"]', d).val() || a(':input[name="post_author"]', d).prepend('<option value="' + a(".post_author", e).text() + '">' + a("#" + n.type + "-" + b + " .author").text() + "</option>"), 1 === a(':input[name="post_author"] option', d).length && a("label.inline-edit-author", d).hide(), k = 0; k < c.length; k++) l = a("." + c[k], e), l.find("img").replaceWith(function() {
- return this.alt
- }), l = l.text(), a(':input[name="' + c[k] + '"]', d).val(l);
- if ("open" === a(".comment_status", e).text() && a('input[name="comment_status"]', d).prop("checked", !0), "open" === a(".ping_status", e).text() && a('input[name="ping_status"]', d).prop("checked", !0), "sticky" === a(".sticky", e).text() && a('input[name="sticky"]', d).prop("checked", !0), a(".post_category", e).each(function() {
- var c, e = a(this).text();
- e && (c = a(this).attr("id").replace("_" + b, ""), a("ul." + c + "-checklist :checkbox", d).val(e.split(",")))
- }), a(".tags_input", e).each(function() {
- var c = a(this),
- e = a(this).attr("id").replace("_" + b, ""),
- f = a("textarea.tax_input_" + e, d),
- g = inlineEditL10n.comma;
- c.find("img").replaceWith(function() {
- return this.alt
- }), c = c.text(), c && ("," !== g && (c = c.replace(/,/g, g)), f.val(c)), f.wpTagsSuggest()
- }), f = a("._status", e).text(), "future" !== f && a('select[name="_status"] option[value="future"]', d).remove(), m = a(".inline-edit-password-input").prop("disabled", !1), "private" === f && (a('input[name="keep_private"]', d).prop("checked", !0), m.val("").prop("disabled", !0)), g = a('select[name="post_parent"] option[value="' + b + '"]', d), g.length > 0) {
- for (h = g[0].className.split("-")[1], i = g; o && (i = i.next("option"), 0 !== i.length);) j = i[0].className.split("-")[1], j <= h ? o = !1 : (i.remove(), i = g);
- g.remove()
+window.wp = window.wp || {},
+ function(h, a) {
+ inlineEditPost = {
+ init: function() {
+ var i = this,
+ t = h("#inline-edit"),
+ e = h("#bulk-edit");
+ i.type = h("table.widefat").hasClass("pages") ? "page" : "post", i.what = "#post-", t.keyup(function(t) {
+ if (27 === t.which) return inlineEditPost.revert()
+ }), e.keyup(function(t) {
+ if (27 === t.which) return inlineEditPost.revert()
+ }), h(".cancel", t).click(function() {
+ return inlineEditPost.revert()
+ }), h(".save", t).click(function() {
+ return inlineEditPost.save(this)
+ }), h("td", t).keydown(function(t) {
+ if (13 === t.which && !h(t.target).hasClass("cancel")) return inlineEditPost.save(this)
+ }), h(".cancel", e).click(function() {
+ return inlineEditPost.revert()
+ }), h('#inline-edit .inline-edit-private input[value="private"]').click(function() {
+ var t = h("input.inline-edit-password-input");
+ h(this).prop("checked") ? t.val("").prop("disabled", !0) : t.prop("disabled", !1)
+ }), h("#the-list").on("click", "a.editinline", function(t) {
+ t.preventDefault(), inlineEditPost.edit(this)
+ }), h("#bulk-edit").find("fieldset:first").after(h("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(h("#inline-edit label.inline-edit-tags").clone()), h('select[name="_status"] option[value="future"]', e).remove(), h("#doaction, #doaction2").click(function(t) {
+ var e;
+ i.whichBulkButtonId = h(this).attr("id"), e = i.whichBulkButtonId.substr(2), "edit" === h('select[name="' + e + '"]').val() ? (t.preventDefault(), i.setBulk()) : 0 < h("form#posts-filter tr.inline-editor").length && i.revert()
+ })
+ },
+ toggle: function(t) {
+ var e = this;
+ "none" === h(e.what + e.getId(t)).css("display") ? e.revert() : e.edit(t)
+ },
+ setBulk: function() {
+ var i = "",
+ t = this.type,
+ n = !0;
+ if (this.revert(), h("#bulk-edit td").attr("colspan", h("th:visible, td:visible", ".widefat:first thead").length), h("table.widefat tbody").prepend(h("#bulk-edit")).prepend('<tr class="hidden"></tr>'), h("#bulk-edit").addClass("inline-editor").show(), h('tbody th.check-column input[type="checkbox"]').each(function() {
+ if (h(this).prop("checked")) {
+ n = !1;
+ var t, e = h(this).val();
+ t = h("#inline_" + e + " .post_title").html() || inlineEditL10n.notitle, i += '<div id="ttle' + e + '"><a id="_' + e + '" class="ntdelbutton" title="' + inlineEditL10n.ntdeltitle + '">X</a>' + t + "</div>"
+ }
+ }), n) return this.revert();
+ h("#bulk-titles").html(i), h("#bulk-titles a").click(function() {
+ var t = h(this).attr("id").substr(1);
+ h('table.widefat input[value="' + t + '"]').prop("checked", !1), h("#ttle" + t).remove()
+ }), "post" === t && h("tr.inline-editor textarea[data-wp-taxonomy]").each(function(t, e) {
+ h(e).autocomplete("instance") || h(e).wpTagsSuggest()
+ }), h("html, body").animate({
+ scrollTop: 0
+ }, "fast")
+ },
+ edit: function(a) {
+ var t, s, e, i, n, l, o, r, d, c, p = this,
+ u = !0;
+ for (p.revert(), "object" == typeof a && (a = p.getId(a)), t = ["post_title", "post_name", "post_author", "_status", "jj", "mm", "aa", "hh", "mn", "ss", "post_password", "post_format", "menu_order", "page_template"], "page" === p.type && t.push("post_parent"), s = h("#inline-edit").clone(!0), h("td", s).attr("colspan", h("th:visible, td:visible", ".widefat:first thead").length), h(p.what + a).removeClass("is-expanded").hide().after(s).after('<tr class="hidden"></tr>'), e = h("#inline_" + a), h(':input[name="post_author"] option[value="' + h(".post_author", e).text() + '"]', s).val() || h(':input[name="post_author"]', s).prepend('<option value="' + h(".post_author", e).text() + '">' + h("#" + p.type + "-" + a + " .author").text() + "</option>"), 1 === h(':input[name="post_author"] option', s).length && h("label.inline-edit-author", s).hide(), r = 0; r < t.length; r++)(d = h("." + t[r], e)).find("img").replaceWith(function() {
+ return this.alt
+ }), d = d.text(), h(':input[name="' + t[r] + '"]', s).val(d);
+ if ("open" === h(".comment_status", e).text() && h('input[name="comment_status"]', s).prop("checked", !0), "open" === h(".ping_status", e).text() && h('input[name="ping_status"]', s).prop("checked", !0), "sticky" === h(".sticky", e).text() && h('input[name="sticky"]', s).prop("checked", !0), h(".post_category", e).each(function() {
+ var t, e = h(this).text();
+ e && (t = h(this).attr("id").replace("_" + a, ""), h("ul." + t + "-checklist :checkbox", s).val(e.split(",")))
+ }), h(".tags_input", e).each(function() {
+ var t = h(this),
+ e = h(this).attr("id").replace("_" + a, ""),
+ i = h("textarea.tax_input_" + e, s),
+ n = inlineEditL10n.comma;
+ t.find("img").replaceWith(function() {
+ return this.alt
+ }), (t = t.text()) && ("," !== n && (t = t.replace(/,/g, n)), i.val(t)), i.wpTagsSuggest()
+ }), "future" !== (i = h("._status", e).text()) && h('select[name="_status"] option[value="future"]', s).remove(), c = h(".inline-edit-password-input").prop("disabled", !1), "private" === i && (h('input[name="keep_private"]', s).prop("checked", !0), c.val("").prop("disabled", !0)), 0 < (n = h('select[name="post_parent"] option[value="' + a + '"]', s)).length) {
+ for (l = n[0].className.split("-")[1], o = n; u && 0 !== (o = o.next("option")).length;) o[0].className.split("-")[1] <= l ? u = !1 : (o.remove(), o = n);
+ n.remove()
+ }
+ return h(s).attr("id", "edit-" + a).addClass("inline-editor").show(), h(".ptitle", s).focus(), !1
+ },
+ save: function(n) {
+ var t, e = h(".post_status_page").val() || "";
+ return "object" == typeof n && (n = this.getId(n)), h("table.widefat .spinner").addClass("is-active"), t = {
+ action: "inline-save",
+ post_type: typenow,
+ post_ID: n,
+ edit_date: "true",
+ post_status: e
+ }, t = h("#edit-" + n).find(":input").serialize() + "&" + h.param(t), h.post(ajaxurl, t, function(t) {
+ var e = h("#edit-" + n + " .inline-edit-save .notice-error"),
+ i = e.find(".error");
+ h("table.widefat .spinner").removeClass("is-active"), h(".ac_results").hide(), t ? -1 !== t.indexOf("<tr") ? (h(inlineEditPost.what + n).siblings("tr.hidden").addBack().remove(), h("#edit-" + n).before(t).remove(), h(inlineEditPost.what + n).hide().fadeIn(400, function() {
+ h(this).find(".editinline").focus(), a.a11y.speak(inlineEditL10n.saved)
+ })) : (t = t.replace(/<.[^<>]*?>/g, ""), e.removeClass("hidden"), i.html(t), a.a11y.speak(i.text())) : (e.removeClass("hidden"), i.html(inlineEditL10n.error), a.a11y.speak(inlineEditL10n.error))
+ }, "html"), !1
+ },
+ revert: function() {
+ var t = h(".widefat"),
+ e = h(".inline-editor", t).attr("id");
+ return e && (h(".spinner", t).removeClass("is-active"), h(".ac_results").hide(), "bulk-edit" === e ? (h("#bulk-edit", t).removeClass("inline-editor").hide().siblings(".hidden").remove(), h("#bulk-titles").empty(), h("#inlineedit").append(h("#bulk-edit")), h("#" + inlineEditPost.whichBulkButtonId).focus()) : (h("#" + e).siblings("tr.hidden").addBack().remove(), e = e.substr(e.lastIndexOf("-") + 1), h(this.what + e).show().find(".editinline").focus())), !1
+ },
+ getId: function(t) {
+ var e = h(t).closest("tr").attr("id").split("-");
+ return e[e.length - 1]
}
- return a(d).attr("id", "edit-" + b).addClass("inline-editor").show(), a(".ptitle", d).focus(), !1
- },
- save: function(c) {
- var d, e, f = a(".post_status_page").val() || "";
- return "object" == typeof c && (c = this.getId(c)), a("table.widefat .spinner").addClass("is-active"), d = {
- action: "inline-save",
- post_type: typenow,
- post_ID: c,
- edit_date: "true",
- post_status: f
- }, e = a("#edit-" + c).find(":input").serialize(), d = e + "&" + a.param(d), a.post(ajaxurl, d, function(d) {
- var e = a("#edit-" + c + " .inline-edit-save .notice-error"),
- f = e.find(".error");
- a("table.widefat .spinner").removeClass("is-active"), a(".ac_results").hide(), d ? -1 !== d.indexOf("<tr") ? (a(inlineEditPost.what + c).siblings("tr.hidden").addBack().remove(), a("#edit-" + c).before(d).remove(), a(inlineEditPost.what + c).hide().fadeIn(400, function() {
- a(this).find(".editinline").focus(), b.a11y.speak(inlineEditL10n.saved)
- })) : (d = d.replace(/<.[^<>]*?>/g, ""), e.removeClass("hidden"), f.html(d), b.a11y.speak(f.text())) : (e.removeClass("hidden"), f.html(inlineEditL10n.error), b.a11y.speak(inlineEditL10n.error))
- }, "html"), !1
- },
- revert: function() {
- var b = a(".widefat"),
- c = a(".inline-editor", b).attr("id");
- return c && (a(".spinner", b).removeClass("is-active"), a(".ac_results").hide(), "bulk-edit" === c ? (a("#bulk-edit", b).removeClass("inline-editor").hide().siblings(".hidden").remove(), a("#bulk-titles").empty(), a("#inlineedit").append(a("#bulk-edit")), a("#" + inlineEditPost.whichBulkButtonId).focus()) : (a("#" + c).siblings("tr.hidden").addBack().remove(), c = c.substr(c.lastIndexOf("-") + 1), a(this.what + c).show().find(".editinline").focus())), !1
- },
- getId: function(b) {
- var c = a(b).closest("tr").attr("id"),
- d = c.split("-");
- return d[d.length - 1]
- }
- }, a(document).ready(function() {
- inlineEditPost.init()
- }), a(document).on("heartbeat-tick.wp-check-locked-posts", function(b, c) {
- var d = c["wp-check-locked-posts"] || {};
- a("#the-list tr").each(function(b, c) {
- var e, f, g = c.id,
- h = a(c);
- d.hasOwnProperty(g) ? h.hasClass("wp-locked") || (e = d[g], h.find(".column-title .locked-text").text(e.text), h.find(".check-column checkbox").prop("checked", !1), e.avatar_src && (f = a('<img class="avatar avatar-18 photo" width="18" height="18" alt="" />').attr("src", e.avatar_src.replace(/&amp;/g, "&")), h.find(".column-title .locked-avatar").empty().append(f)), h.addClass("wp-locked")) : h.hasClass("wp-locked") && h.removeClass("wp-locked").delay(1e3).find(".locked-info span").empty()
+ }, h(document).ready(function() {
+ inlineEditPost.init()
+ }), h(document).on("heartbeat-tick.wp-check-locked-posts", function(t, e) {
+ var l = e["wp-check-locked-posts"] || {};
+ h("#the-list tr").each(function(t, e) {
+ var i, n, a = e.id,
+ s = h(e);
+ l.hasOwnProperty(a) ? s.hasClass("wp-locked") || (i = l[a], s.find(".column-title .locked-text").text(i.text), s.find(".check-column checkbox").prop("checked", !1), i.avatar_src && (n = h('<img class="avatar avatar-18 photo" width="18" height="18" alt="" />').attr("src", i.avatar_src.replace(/&amp;/g, "&")), s.find(".column-title .locked-avatar").empty().append(n)), s.addClass("wp-locked")) : s.hasClass("wp-locked") && s.removeClass("wp-locked").delay(1e3).find(".locked-info span").empty()
+ })
+ }).on("heartbeat-send.wp-check-locked-posts", function(t, e) {
+ var i = [];
+ h("#the-list tr").each(function(t, e) {
+ e.id && i.push(e.id)
+ }), i.length && (e["wp-check-locked-posts"] = i)
+ }).ready(function() {
+ void 0 !== a && a.heartbeat && a.heartbeat.interval(15)
})
- }).on("heartbeat-send.wp-check-locked-posts", function(b, c) {
- var d = [];
- a("#the-list tr").each(function(a, b) {
- b.id && d.push(b.id)
- }), d.length && (c["wp-check-locked-posts"] = d)
- }).ready(function() {
- void 0 !== b && b.heartbeat && b.heartbeat.interval(15)
- })
-}(jQuery, window.wp);
\ No newline at end of file
+ }(jQuery, window.wp);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/inline-edit-tax.min.js build-branch-unminified/wp-admin/js/inline-edit-tax.min.js
--- build-unminified/wp-admin/js/inline-edit-tax.min.js 2018-10-08 22:57:55.289476913 -0500
+++ build-branch-unminified/wp-admin/js/inline-edit-tax.min.js 2018-10-08 22:55:06.804140779 -0500
@@ -1,61 +1,60 @@
-window.wp = window.wp || {};
var inlineEditTax;
-! function(a, b) {
- inlineEditTax = {
- init: function() {
- var b = this,
- c = a("#inline-edit");
- b.type = a("#the-list").attr("data-wp-lists").substr(5), b.what = "#" + b.type + "-", a("#the-list").on("click", "a.editinline", function() {
- return inlineEditTax.edit(this), !1
- }), c.keyup(function(a) {
- if (27 === a.which) return inlineEditTax.revert()
- }), a(".cancel", c).click(function() {
- return inlineEditTax.revert()
- }), a(".save", c).click(function() {
- return inlineEditTax.save(this)
- }), a("input, select", c).keydown(function(a) {
- if (13 === a.which) return inlineEditTax.save(this)
- }), a('#posts-filter input[type="submit"]').mousedown(function() {
- b.revert()
- })
- },
- toggle: function(b) {
- var c = this;
- "none" === a(c.what + c.getId(b)).css("display") ? c.revert() : c.edit(b)
- },
- edit: function(b) {
- var c, d, e, f = this;
- return f.revert(), "object" == typeof b && (b = f.getId(b)), c = a("#inline-edit").clone(!0), d = a("#inline_" + b), a("td", c).attr("colspan", a("th:visible, td:visible", ".wp-list-table.widefat:first thead").length), a(f.what + b).hide().after(c).after('<tr class="hidden"></tr>'), e = a(".name", d), e.find("img").replaceWith(function() {
- return this.alt
- }), e = e.text(), a(':input[name="name"]', c).val(e), e = a(".slug", d), e.find("img").replaceWith(function() {
- return this.alt
- }), e = e.text(), a(':input[name="slug"]', c).val(e), a(c).attr("id", "edit-" + b).addClass("inline-editor").show(), a(".ptitle", c).eq(0).focus(), !1
- },
- save: function(c) {
- var d, e, f = a('input[name="taxonomy"]').val() || "";
- return "object" == typeof c && (c = this.getId(c)), a("table.widefat .spinner").addClass("is-active"), d = {
- action: "inline-save-tax",
- tax_type: this.type,
- tax_ID: c,
- taxonomy: f
- }, e = a("#edit-" + c).find(":input").serialize(), d = e + "&" + a.param(d), a.post(ajaxurl, d, function(d) {
- var e, f, g, h = a("#edit-" + c + " .inline-edit-save .notice-error"),
- i = h.find(".error");
- a("table.widefat .spinner").removeClass("is-active"), d ? -1 !== d.indexOf("<tr") ? (a(inlineEditTax.what + c).siblings("tr.hidden").addBack().remove(), f = a(d).attr("id"), a("#edit-" + c).before(d).remove(), f ? (g = f.replace(inlineEditTax.type + "-", ""), e = a("#" + f)) : (g = c, e = a(inlineEditTax.what + c)), a("#parent").find("option[value=" + g + "]").text(e.find(".row-title").text()), e.hide().fadeIn(400, function() {
- e.find(".editinline").focus(), b.a11y.speak(inlineEditL10n.saved)
- })) : (h.removeClass("hidden"), i.html(d), b.a11y.speak(i.text())) : (h.removeClass("hidden"), i.html(inlineEditL10n.error), b.a11y.speak(inlineEditL10n.error))
- }), !1
- },
- revert: function() {
- var b = a("table.widefat tr.inline-editor").attr("id");
- b && (a("table.widefat .spinner").removeClass("is-active"), a("#" + b).siblings("tr.hidden").addBack().remove(), b = b.substr(b.lastIndexOf("-") + 1), a(this.what + b).show().find(".editinline").focus())
- },
- getId: function(b) {
- var c = "TR" === b.tagName ? b.id : a(b).parents("tr").attr("id"),
- d = c.split("-");
- return d[d.length - 1]
- }
- }, a(document).ready(function() {
- inlineEditTax.init()
- })
-}(jQuery, window.wp);
\ No newline at end of file
+window.wp = window.wp || {},
+ function(s, l) {
+ inlineEditTax = {
+ init: function() {
+ var t = this,
+ i = s("#inline-edit");
+ t.type = s("#the-list").attr("data-wp-lists").substr(5), t.what = "#" + t.type + "-", s("#the-list").on("click", "a.editinline", function() {
+ return inlineEditTax.edit(this), !1
+ }), i.keyup(function(t) {
+ if (27 === t.which) return inlineEditTax.revert()
+ }), s(".cancel", i).click(function() {
+ return inlineEditTax.revert()
+ }), s(".save", i).click(function() {
+ return inlineEditTax.save(this)
+ }), s("input, select", i).keydown(function(t) {
+ if (13 === t.which) return inlineEditTax.save(this)
+ }), s('#posts-filter input[type="submit"]').mousedown(function() {
+ t.revert()
+ })
+ },
+ toggle: function(t) {
+ var i = this;
+ "none" === s(i.what + i.getId(t)).css("display") ? i.revert() : i.edit(t)
+ },
+ edit: function(t) {
+ var i, e, n, a = this;
+ return a.revert(), "object" == typeof t && (t = a.getId(t)), i = s("#inline-edit").clone(!0), e = s("#inline_" + t), s("td", i).attr("colspan", s("th:visible, td:visible", ".wp-list-table.widefat:first thead").length), s(a.what + t).hide().after(i).after('<tr class="hidden"></tr>'), (n = s(".name", e)).find("img").replaceWith(function() {
+ return this.alt
+ }), n = n.text(), s(':input[name="name"]', i).val(n), (n = s(".slug", e)).find("img").replaceWith(function() {
+ return this.alt
+ }), n = n.text(), s(':input[name="slug"]', i).val(n), s(i).attr("id", "edit-" + t).addClass("inline-editor").show(), s(".ptitle", i).eq(0).focus(), !1
+ },
+ save: function(d) {
+ var t, i = s('input[name="taxonomy"]').val() || "";
+ return "object" == typeof d && (d = this.getId(d)), s("table.widefat .spinner").addClass("is-active"), t = {
+ action: "inline-save-tax",
+ tax_type: this.type,
+ tax_ID: d,
+ taxonomy: i
+ }, t = s("#edit-" + d).find(":input").serialize() + "&" + s.param(t), s.post(ajaxurl, t, function(t) {
+ var i, e, n, a = s("#edit-" + d + " .inline-edit-save .notice-error"),
+ r = a.find(".error");
+ s("table.widefat .spinner").removeClass("is-active"), t ? -1 !== t.indexOf("<tr") ? (s(inlineEditTax.what + d).siblings("tr.hidden").addBack().remove(), e = s(t).attr("id"), s("#edit-" + d).before(t).remove(), i = e ? (n = e.replace(inlineEditTax.type + "-", ""), s("#" + e)) : (n = d, s(inlineEditTax.what + d)), s("#parent").find("option[value=" + n + "]").text(i.find(".row-title").text()), i.hide().fadeIn(400, function() {
+ i.find(".editinline").focus(), l.a11y.speak(inlineEditL10n.saved)
+ })) : (a.removeClass("hidden"), r.html(t), l.a11y.speak(r.text())) : (a.removeClass("hidden"), r.html(inlineEditL10n.error), l.a11y.speak(inlineEditL10n.error))
+ }), !1
+ },
+ revert: function() {
+ var t = s("table.widefat tr.inline-editor").attr("id");
+ t && (s("table.widefat .spinner").removeClass("is-active"), s("#" + t).siblings("tr.hidden").addBack().remove(), t = t.substr(t.lastIndexOf("-") + 1), s(this.what + t).show().find(".editinline").focus())
+ },
+ getId: function(t) {
+ var i = ("TR" === t.tagName ? t.id : s(t).parents("tr").attr("id")).split("-");
+ return i[i.length - 1]
+ }
+ }, s(document).ready(function() {
+ inlineEditTax.init()
+ })
+ }(jQuery, window.wp);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/language-chooser.min.js build-branch-unminified/wp-admin/js/language-chooser.min.js
--- build-unminified/wp-admin/js/language-chooser.min.js 2018-10-08 22:57:52.289453152 -0500
+++ build-branch-unminified/wp-admin/js/language-chooser.min.js 2018-10-08 22:55:03.480114383 -0500
@@ -1,13 +1,13 @@
-jQuery(function(a) {
- var b = a("#language"),
- c = a("#language-continue");
- a("body").hasClass("language-chooser") && (b.focus().on("change", function() {
- var a = b.children("option:selected");
- c.attr({
- value: a.data("continue"),
- lang: a.attr("lang")
+jQuery(function(n) {
+ var a = n("#language"),
+ e = n("#language-continue");
+ n("body").hasClass("language-chooser") && (a.focus().on("change", function() {
+ var n = a.children("option:selected");
+ e.attr({
+ value: n.data("continue"),
+ lang: n.attr("lang")
})
- }), a("form").submit(function() {
- b.children("option:selected").data("installed") || a(this).find(".step .spinner").css("visibility", "visible")
+ }), n("form").submit(function() {
+ a.children("option:selected").data("installed") || n(this).find(".step .spinner").css("visibility", "visible")
}))
});
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/link.min.js build-branch-unminified/wp-admin/js/link.min.js
--- build-unminified/wp-admin/js/link.min.js 2018-10-08 22:57:51.789449193 -0500
+++ build-branch-unminified/wp-admin/js/link.min.js 2018-10-08 22:55:02.856109428 -0500
@@ -1,40 +1,40 @@
-jQuery(document).ready(function(a) {
- var b, c, d, e = !1;
- a("#link_name").focus(), postboxes.add_postbox_toggles("link"), a("#category-tabs a").click(function() {
- var b = a(this).attr("href");
- return a(this).parent().addClass("tabs").siblings("li").removeClass("tabs"), a(".tabs-panel").hide(), a(b).show(), "#categories-all" == b ? deleteUserSetting("cats") : setUserSetting("cats", "pop"), !1
- }), getUserSetting("cats") && a('#category-tabs a[href="#categories-pop"]').click(), b = a("#newcat").one("focus", function() {
- a(this).val("").removeClass("form-input-tip")
- }), a("#link-category-add-submit").click(function() {
- b.focus()
- }), c = function() {
- if (!e) {
- e = !0;
- var b = a(this),
- c = b.is(":checked"),
- d = b.val().toString();
- a("#in-link-category-" + d + ", #in-popular-link_category-" + d).prop("checked", c), e = !1
+jQuery(document).ready(function(i) {
+ var t, s, e, c = !1;
+ i("#link_name").focus(), postboxes.add_postbox_toggles("link"), i("#category-tabs a").click(function() {
+ var t = i(this).attr("href");
+ return i(this).parent().addClass("tabs").siblings("li").removeClass("tabs"), i(".tabs-panel").hide(), i(t).show(), "#categories-all" == t ? deleteUserSetting("cats") : setUserSetting("cats", "pop"), !1
+ }), getUserSetting("cats") && i('#category-tabs a[href="#categories-pop"]').click(), t = i("#newcat").one("focus", function() {
+ i(this).val("").removeClass("form-input-tip")
+ }), i("#link-category-add-submit").click(function() {
+ t.focus()
+ }), s = function() {
+ if (!c) {
+ c = !0;
+ var t = i(this),
+ e = t.is(":checked"),
+ a = t.val().toString();
+ i("#in-link-category-" + a + ", #in-popular-link_category-" + a).prop("checked", e), c = !1
}
- }, d = function(b, d) {
- a(d.what + " response_data", b).each(function() {
- a(a(this).text()).find("label").each(function() {
- var b = a(this),
- d = b.find("input").val(),
- e = b.find("input")[0].id,
- f = a.trim(b.text());
- a("#" + e).change(c), a('<option value="' + parseInt(d, 10) + '"></option>').text(f)
+ }, e = function(t, e) {
+ i(e.what + " response_data", t).each(function() {
+ i(i(this).text()).find("label").each(function() {
+ var t = i(this),
+ e = t.find("input").val(),
+ a = t.find("input")[0].id,
+ c = i.trim(t.text());
+ i("#" + a).change(s), i('<option value="' + parseInt(e, 10) + '"></option>').text(c)
})
})
- }, a("#categorychecklist").wpList({
+ }, i("#categorychecklist").wpList({
alt: "",
what: "link-category",
response: "category-ajax-response",
- addAfter: d
- }), a('a[href="#categories-all"]').click(function() {
+ addAfter: e
+ }), i('a[href="#categories-all"]').click(function() {
deleteUserSetting("cats")
- }), a('a[href="#categories-pop"]').click(function() {
+ }), i('a[href="#categories-pop"]').click(function() {
setUserSetting("cats", "pop")
- }), "pop" == getUserSetting("cats") && a('a[href="#categories-pop"]').click(), a("#category-add-toggle").click(function() {
- return a(this).parents("div:first").toggleClass("wp-hidden-children"), a('#category-tabs a[href="#categories-all"]').click(), a("#newcategory").focus(), !1
- }), a(".categorychecklist :checkbox").change(c).filter(":checked").change()
+ }), "pop" == getUserSetting("cats") && i('a[href="#categories-pop"]').click(), i("#category-add-toggle").click(function() {
+ return i(this).parents("div:first").toggleClass("wp-hidden-children"), i('#category-tabs a[href="#categories-all"]').click(), i("#newcategory").focus(), !1
+ }), i(".categorychecklist :checkbox").change(s).filter(":checked").change()
});
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/media-gallery.min.js build-branch-unminified/wp-admin/js/media-gallery.min.js
--- build-unminified/wp-admin/js/media-gallery.min.js 2018-10-08 22:57:51.569447450 -0500
+++ build-branch-unminified/wp-admin/js/media-gallery.min.js 2018-10-08 22:55:02.532106855 -0500
@@ -1,13 +1,13 @@
-jQuery(function(a) {
- a("body").bind("click.wp-gallery", function(b) {
- var c, d, e = a(b.target);
- e.hasClass("wp-set-header") ? ((window.dialogArguments || opener || parent || top).location.href = e.data("location"), b.preventDefault()) : e.hasClass("wp-set-background") && (c = e.data("attachment-id"), d = a('input[name="attachments[' + c + '][image-size]"]:checked').val(), jQuery.post(ajaxurl, {
+jQuery(function(o) {
+ o("body").bind("click.wp-gallery", function(a) {
+ var e, t, n = o(a.target);
+ n.hasClass("wp-set-header") ? ((window.dialogArguments || opener || parent || top).location.href = n.data("location"), a.preventDefault()) : n.hasClass("wp-set-background") && (e = n.data("attachment-id"), t = o('input[name="attachments[' + e + '][image-size]"]:checked').val(), jQuery.post(ajaxurl, {
action: "set-background-image",
- attachment_id: c,
- size: d
+ attachment_id: e,
+ size: t
}, function() {
var a = window.dialogArguments || opener || parent || top;
a.tb_remove(), a.location.reload()
- }), b.preventDefault())
+ }), a.preventDefault())
})
});
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/media.min.js build-branch-unminified/wp-admin/js/media.min.js
--- build-unminified/wp-admin/js/media.min.js 2018-10-08 22:57:53.329461389 -0500
+++ build-branch-unminified/wp-admin/js/media.min.js 2018-10-08 22:55:04.972126231 -0500
@@ -1,56 +1,56 @@
var findPosts;
-! function(a) {
+! function(s) {
findPosts = {
- open: function(b, c) {
- var d = a(".ui-find-overlay");
- return 0 === d.length && (a("body").append('<div class="ui-find-overlay"></div>'), findPosts.overlay()), d.show(), b && c && a("#affected").attr("name", b).val(c), a("#find-posts").show(), a("#find-posts-input").focus().keyup(function(a) {
- 27 == a.which && findPosts.close()
+ open: function(n, i) {
+ var e = s(".ui-find-overlay");
+ return 0 === e.length && (s("body").append('<div class="ui-find-overlay"></div>'), findPosts.overlay()), e.show(), n && i && s("#affected").attr("name", n).val(i), s("#find-posts").show(), s("#find-posts-input").focus().keyup(function(n) {
+ 27 == n.which && findPosts.close()
}), findPosts.send(), !1
},
close: function() {
- a("#find-posts-response").empty(), a("#find-posts").hide(), a(".ui-find-overlay").hide()
+ s("#find-posts-response").empty(), s("#find-posts").hide(), s(".ui-find-overlay").hide()
},
overlay: function() {
- a(".ui-find-overlay").on("click", function() {
+ s(".ui-find-overlay").on("click", function() {
findPosts.close()
})
},
send: function() {
- var b = {
- ps: a("#find-posts-input").val(),
+ var n = {
+ ps: s("#find-posts-input").val(),
action: "find_posts",
- _ajax_nonce: a("#_ajax_nonce").val()
+ _ajax_nonce: s("#_ajax_nonce").val()
},
- c = a(".find-box-search .spinner");
- c.addClass("is-active"), a.ajax(ajaxurl, {
+ i = s(".find-box-search .spinner");
+ i.addClass("is-active"), s.ajax(ajaxurl, {
type: "POST",
- data: b,
+ data: n,
dataType: "json"
}).always(function() {
- c.removeClass("is-active")
- }).done(function(b) {
- b.success || a("#find-posts-response").text(attachMediaBoxL10n.error), a("#find-posts-response").html(b.data)
+ i.removeClass("is-active")
+ }).done(function(n) {
+ n.success || s("#find-posts-response").text(attachMediaBoxL10n.error), s("#find-posts-response").html(n.data)
}).fail(function() {
- a("#find-posts-response").text(attachMediaBoxL10n.error)
+ s("#find-posts-response").text(attachMediaBoxL10n.error)
})
}
- }, a(document).ready(function() {
- var b, c = a("#wp-media-grid");
- c.length && window.wp && window.wp.media && (b = _wpMediaGridSettings, window.wp.media({
+ }, s(document).ready(function() {
+ var n, i = s("#wp-media-grid");
+ i.length && window.wp && window.wp.media && (n = _wpMediaGridSettings, window.wp.media({
frame: "manage",
- container: c,
- library: b.queryVars
- }).open()), a("#find-posts-submit").click(function(b) {
- a('#find-posts-response input[type="radio"]:checked').length || b.preventDefault()
- }), a("#find-posts .find-box-search :input").keypress(function(a) {
- if (13 == a.which) return findPosts.send(), !1
- }), a("#find-posts-search").click(findPosts.send), a("#find-posts-close").click(findPosts.close), a("#doaction, #doaction2").click(function(b) {
- a('select[name^="action"]').each(function() {
- var c = a(this).val();
- "attach" === c ? (b.preventDefault(), findPosts.open()) : "delete" === c && (showNotice.warn() || b.preventDefault())
+ container: i,
+ library: n.queryVars
+ }).open()), s("#find-posts-submit").click(function(n) {
+ s('#find-posts-response input[type="radio"]:checked').length || n.preventDefault()
+ }), s("#find-posts .find-box-search :input").keypress(function(n) {
+ if (13 == n.which) return findPosts.send(), !1
+ }), s("#find-posts-search").click(findPosts.send), s("#find-posts-close").click(findPosts.close), s("#doaction, #doaction2").click(function(i) {
+ s('select[name^="action"]').each(function() {
+ var n = s(this).val();
+ "attach" === n ? (i.preventDefault(), findPosts.open()) : "delete" === n && (showNotice.warn() || i.preventDefault())
})
- }), a(".find-box-inside").on("click", "tr", function() {
- a(this).find(".found-radio input").prop("checked", !0)
+ }), s(".find-box-inside").on("click", "tr", function() {
+ s(this).find(".found-radio input").prop("checked", !0)
})
})
}(jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/media-upload.min.js build-branch-unminified/wp-admin/js/media-upload.min.js
--- build-unminified/wp-admin/js/media-upload.min.js 2018-10-08 22:57:51.449446500 -0500
+++ build-branch-unminified/wp-admin/js/media-upload.min.js 2018-10-08 22:55:02.392105743 -0500
@@ -1,32 +1,31 @@
-var wpActiveEditor, send_to_editor;
-send_to_editor = function(a) {
- var b, c = "undefined" != typeof tinymce,
- d = "undefined" != typeof QTags;
- if (wpActiveEditor) c && (b = tinymce.get(wpActiveEditor));
- else if (c && tinymce.activeEditor) b = tinymce.activeEditor, wpActiveEditor = b.id;
- else if (!d) return !1;
- if (b && !b.isHidden() ? b.execCommand("mceInsertContent", !1, a) : d ? QTags.insertContent(a) : document.getElementById(wpActiveEditor).value += a, window.tb_remove) try {
- window.tb_remove()
- } catch (e) {}
-};
-var tb_position;
-! function(a) {
- tb_position = function() {
- var b = a("#TB_window"),
- c = a(window).width(),
- d = a(window).height(),
- e = 833 < c ? 833 : c,
- f = 0;
- return a("#wpadminbar").length && (f = parseInt(a("#wpadminbar").css("height"), 10)), b.length && (b.width(e - 50).height(d - 45 - f), a("#TB_iframeContent").width(e - 50).height(d - 75 - f), b.css({
- "margin-left": "-" + parseInt((e - 50) / 2, 10) + "px"
- }), "undefined" != typeof document.body.style.maxWidth && b.css({
- top: 20 + f + "px",
- "margin-top": "0"
- })), a("a.thickbox").each(function() {
- var b = a(this).attr("href");
- b && (b = b.replace(/&width=[0-9]+/g, ""), b = b.replace(/&height=[0-9]+/g, ""), a(this).attr("href", b + "&width=" + (e - 80) + "&height=" + (d - 85 - f)))
+var wpActiveEditor, send_to_editor, tb_position;
+send_to_editor = function(t) {
+ var e, i = "undefined" != typeof tinymce,
+ n = "undefined" != typeof QTags;
+ if (wpActiveEditor) i && (e = tinymce.get(wpActiveEditor));
+ else if (i && tinymce.activeEditor) e = tinymce.activeEditor, wpActiveEditor = e.id;
+ else if (!n) return !1;
+ if (e && !e.isHidden() ? e.execCommand("mceInsertContent", !1, t) : n ? QTags.insertContent(t) : document.getElementById(wpActiveEditor).value += t, window.tb_remove) try {
+ window.tb_remove()
+ } catch (t) {}
+ },
+ function(d) {
+ tb_position = function() {
+ var t = d("#TB_window"),
+ e = d(window).width(),
+ i = d(window).height(),
+ n = 833 < e ? 833 : e,
+ o = 0;
+ return d("#wpadminbar").length && (o = parseInt(d("#wpadminbar").css("height"), 10)), t.length && (t.width(n - 50).height(i - 45 - o), d("#TB_iframeContent").width(n - 50).height(i - 75 - o), t.css({
+ "margin-left": "-" + parseInt((n - 50) / 2, 10) + "px"
+ }), void 0 !== document.body.style.maxWidth && t.css({
+ top: 20 + o + "px",
+ "margin-top": "0"
+ })), d("a.thickbox").each(function() {
+ var t = d(this).attr("href");
+ t && (t = (t = t.replace(/&width=[0-9]+/g, "")).replace(/&height=[0-9]+/g, ""), d(this).attr("href", t + "&width=" + (n - 80) + "&height=" + (i - 85 - o)))
+ })
+ }, d(window).resize(function() {
+ tb_position()
})
- }, a(window).resize(function() {
- tb_position()
- })
-}(jQuery);
\ No newline at end of file
+ }(jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/nav-menu.min.js build-branch-unminified/wp-admin/js/nav-menu.min.js
--- build-unminified/wp-admin/js/nav-menu.min.js 2018-10-08 22:57:55.073475202 -0500
+++ build-branch-unminified/wp-admin/js/nav-menu.min.js 2018-10-08 22:55:06.596139127 -0500
@@ -1,497 +1,496 @@
var wpNavMenu;
-! function(a) {
- var b;
- b = wpNavMenu = {
+! function(k) {
+ var y;
+ y = wpNavMenu = {
options: {
menuItemDepthPerLevel: 30,
globalMaxDepth: 11,
sortableItems: "> *",
targetTolerance: 0
},
- menuList: undefined,
- targetList: undefined,
+ menuList: void 0,
+ targetList: void 0,
menusChanged: !1,
isRTL: !("undefined" == typeof isRtl || !isRtl),
negateIfRTL: "undefined" != typeof isRtl && isRtl ? -1 : 1,
lastSearch: "",
init: function() {
- b.menuList = a("#menu-to-edit"), b.targetList = b.menuList, this.jQueryExtensions(), this.attachMenuEditListeners(), this.attachQuickSearchListeners(), this.attachThemeLocationsListeners(), this.attachMenuSaveSubmitListeners(), this.attachTabsPanelListeners(), this.attachUnsavedChangesListener(), b.menuList.length && this.initSortables(), menus.oneThemeLocationNoMenus && a("#posttype-page").addSelectedToMenu(b.addMenuItemToBottom), this.initManageLocations(), this.initAccessibility(), this.initToggles(), this.initPreviewing()
+ y.menuList = k("#menu-to-edit"), y.targetList = y.menuList, this.jQueryExtensions(), this.attachMenuEditListeners(), this.attachQuickSearchListeners(), this.attachThemeLocationsListeners(), this.attachMenuSaveSubmitListeners(), this.attachTabsPanelListeners(), this.attachUnsavedChangesListener(), y.menuList.length && this.initSortables(), menus.oneThemeLocationNoMenus && k("#posttype-page").addSelectedToMenu(y.addMenuItemToBottom), this.initManageLocations(), this.initAccessibility(), this.initToggles(), this.initPreviewing()
},
jQueryExtensions: function() {
- a.fn.extend({
+ k.fn.extend({
menuItemDepth: function() {
- var a = b.isRTL ? this.eq(0).css("margin-right") : this.eq(0).css("margin-left");
- return b.pxToDepth(a && -1 != a.indexOf("px") ? a.slice(0, -2) : 0)
+ var e = y.isRTL ? this.eq(0).css("margin-right") : this.eq(0).css("margin-left");
+ return y.pxToDepth(e && -1 != e.indexOf("px") ? e.slice(0, -2) : 0)
},
- updateDepthClass: function(b, c) {
+ updateDepthClass: function(t, n) {
return this.each(function() {
- var d = a(this);
- c = c || d.menuItemDepth(), a(this).removeClass("menu-item-depth-" + c).addClass("menu-item-depth-" + b)
+ var e = k(this);
+ n = n || e.menuItemDepth(), k(this).removeClass("menu-item-depth-" + n).addClass("menu-item-depth-" + t)
})
},
- shiftDepthClass: function(b) {
+ shiftDepthClass: function(i) {
return this.each(function() {
- var c = a(this),
- d = c.menuItemDepth(),
- e = d + b;
- c.removeClass("menu-item-depth-" + d).addClass("menu-item-depth-" + e), 0 === e && c.find(".is-submenu").hide()
+ var e = k(this),
+ t = e.menuItemDepth(),
+ n = t + i;
+ e.removeClass("menu-item-depth-" + t).addClass("menu-item-depth-" + n), 0 === n && e.find(".is-submenu").hide()
})
},
childMenuItems: function() {
- var b = a();
+ var i = k();
return this.each(function() {
- for (var c = a(this), d = c.menuItemDepth(), e = c.next(".menu-item"); e.length && e.menuItemDepth() > d;) b = b.add(e), e = e.next(".menu-item")
- }), b
+ for (var e = k(this), t = e.menuItemDepth(), n = e.next(".menu-item"); n.length && n.menuItemDepth() > t;) i = i.add(n), n = n.next(".menu-item")
+ }), i
},
- shiftHorizontally: function(b) {
+ shiftHorizontally: function(i) {
return this.each(function() {
- var c = a(this),
- d = c.menuItemDepth(),
- e = d + b;
- c.moveHorizontally(e, d)
+ var e = k(this),
+ t = e.menuItemDepth(),
+ n = t + i;
+ e.moveHorizontally(n, t)
})
},
- moveHorizontally: function(b, c) {
+ moveHorizontally: function(a, s) {
return this.each(function() {
- var d = a(this),
- e = d.childMenuItems(),
- f = b - c,
- g = d.find(".is-submenu");
- d.updateDepthClass(b, c).updateParentMenuItemDBId(), e && e.each(function() {
- var b = a(this),
- c = b.menuItemDepth(),
- d = c + f;
- b.updateDepthClass(d, c).updateParentMenuItemDBId()
- }), 0 === b ? g.hide() : g.show()
+ var e = k(this),
+ t = e.childMenuItems(),
+ i = a - s,
+ n = e.find(".is-submenu");
+ e.updateDepthClass(a, s).updateParentMenuItemDBId(), t && t.each(function() {
+ var e = k(this),
+ t = e.menuItemDepth(),
+ n = t + i;
+ e.updateDepthClass(n, t).updateParentMenuItemDBId()
+ }), 0 === a ? n.hide() : n.show()
})
},
updateParentMenuItemDBId: function() {
return this.each(function() {
- var b = a(this),
- c = b.find(".menu-item-data-parent-id"),
- d = parseInt(b.menuItemDepth(), 10),
- e = d - 1,
- f = b.prevAll(".menu-item-depth-" + e).first();
- 0 === d ? c.val(0) : c.val(f.find(".menu-item-data-db-id").val())
+ var e = k(this),
+ t = e.find(".menu-item-data-parent-id"),
+ n = parseInt(e.menuItemDepth(), 10),
+ i = n - 1,
+ a = e.prevAll(".menu-item-depth-" + i).first();
+ 0 === n ? t.val(0) : t.val(a.find(".menu-item-data-db-id").val())
})
},
hideAdvancedMenuItemFields: function() {
return this.each(function() {
- var b = a(this);
- a(".hide-column-tog").not(":checked").each(function() {
- b.find(".field-" + a(this).val()).addClass("hidden-field")
+ var e = k(this);
+ k(".hide-column-tog").not(":checked").each(function() {
+ e.find(".field-" + k(this).val()).addClass("hidden-field")
})
})
},
- addSelectedToMenu: function(c) {
- return 0 !== a("#menu-to-edit").length && this.each(function() {
- var d = a(this),
- e = {},
- f = menus.oneThemeLocationNoMenus && 0 === d.find(".tabs-panel-active .categorychecklist li input:checked").length ? d.find('#page-all li input[type="checkbox"]') : d.find(".tabs-panel-active .categorychecklist li input:checked"),
- g = /menu-item\[([^\]]*)/;
- if (c = c || b.addMenuItemToBottom, !f.length) return !1;
- d.find(".button-controls .spinner").addClass("is-active"), a(f).each(function() {
- var d = a(this),
- f = g.exec(d.attr("name")),
- h = "undefined" == typeof f[1] ? 0 : parseInt(f[1], 10);
- this.className && -1 != this.className.indexOf("add-to-top") && (c = b.addMenuItemToTop), e[h] = d.closest("li").getItemData("add-menu-item", h)
- }), b.addItemToMenu(e, c, function() {
- f.removeAttr("checked"), d.find(".button-controls .spinner").removeClass("is-active")
+ addSelectedToMenu: function(s) {
+ return 0 !== k("#menu-to-edit").length && this.each(function() {
+ var e = k(this),
+ i = {},
+ t = menus.oneThemeLocationNoMenus && 0 === e.find(".tabs-panel-active .categorychecklist li input:checked").length ? e.find('#page-all li input[type="checkbox"]') : e.find(".tabs-panel-active .categorychecklist li input:checked"),
+ a = /menu-item\[([^\]]*)/;
+ if (s = s || y.addMenuItemToBottom, !t.length) return !1;
+ e.find(".button-controls .spinner").addClass("is-active"), k(t).each(function() {
+ var e = k(this),
+ t = a.exec(e.attr("name")),
+ n = void 0 === t[1] ? 0 : parseInt(t[1], 10);
+ this.className && -1 != this.className.indexOf("add-to-top") && (s = y.addMenuItemToTop), i[n] = e.closest("li").getItemData("add-menu-item", n)
+ }), y.addItemToMenu(i, s, function() {
+ t.removeAttr("checked"), e.find(".button-controls .spinner").removeClass("is-active")
})
})
},
- getItemData: function(a, b) {
- a = a || "menu-item";
- var c, d = {},
- e = ["menu-item-db-id", "menu-item-object-id", "menu-item-object", "menu-item-parent-id", "menu-item-position", "menu-item-type", "menu-item-title", "menu-item-url", "menu-item-description", "menu-item-attr-title", "menu-item-target", "menu-item-classes", "menu-item-xfn"];
- return b || "menu-item" != a || (b = this.find(".menu-item-data-db-id").val()), b ? (this.find("input").each(function() {
- var f;
- for (c = e.length; c--;) "menu-item" == a ? f = e[c] + "[" + b + "]" : "add-menu-item" == a && (f = "menu-item[" + b + "][" + e[c] + "]"), this.name && f == this.name && (d[e[c]] = this.value)
- }), d) : d
- },
- setItemData: function(b, c, d) {
- return c = c || "menu-item", d || "menu-item" != c || (d = a(".menu-item-data-db-id", this).val()), d ? (this.find("input").each(function() {
- var e, f = a(this);
- a.each(b, function(a, b) {
- "menu-item" == c ? e = a + "[" + d + "]" : "add-menu-item" == c && (e = "menu-item[" + d + "][" + a + "]"), e == f.attr("name") && f.val(b)
+ getItemData: function(t, n) {
+ t = t || "menu-item";
+ var i, a = {},
+ s = ["menu-item-db-id", "menu-item-object-id", "menu-item-object", "menu-item-parent-id", "menu-item-position", "menu-item-type", "menu-item-title", "menu-item-url", "menu-item-description", "menu-item-attr-title", "menu-item-target", "menu-item-classes", "menu-item-xfn"];
+ return n || "menu-item" != t || (n = this.find(".menu-item-data-db-id").val()), n && this.find("input").each(function() {
+ var e;
+ for (i = s.length; i--;) "menu-item" == t ? e = s[i] + "[" + n + "]" : "add-menu-item" == t && (e = "menu-item[" + n + "][" + s[i] + "]"), this.name && e == this.name && (a[s[i]] = this.value)
+ }), a
+ },
+ setItemData: function(e, a, s) {
+ return a = a || "menu-item", s || "menu-item" != a || (s = k(".menu-item-data-db-id", this).val()), s && this.find("input").each(function() {
+ var n, i = k(this);
+ k.each(e, function(e, t) {
+ "menu-item" == a ? n = e + "[" + s + "]" : "add-menu-item" == a && (n = "menu-item[" + s + "][" + e + "]"), n == i.attr("name") && i.val(t)
})
- }), this) : this
+ }), this
}
})
},
- countMenuItems: function(b) {
- return a(".menu-item-depth-" + b).length
+ countMenuItems: function(e) {
+ return k(".menu-item-depth-" + e).length
},
- moveMenuItem: function(c, d) {
- var e, f, g, h = a("#menu-to-edit li"),
- i = h.length,
- j = c.parents("li.menu-item"),
- k = j.childMenuItems(),
- l = j.getItemData(),
- m = parseInt(j.menuItemDepth(), 10),
- n = parseInt(j.index(), 10),
- o = j.next(),
- p = o.childMenuItems(),
- q = parseInt(o.menuItemDepth(), 10) + 1,
- r = j.prev(),
- s = parseInt(r.menuItemDepth(), 10),
- t = r.getItemData()["menu-item-db-id"];
- switch (d) {
+ moveMenuItem: function(e, t) {
+ var n, i, a, s = k("#menu-to-edit li"),
+ m = s.length,
+ u = e.parents("li.menu-item"),
+ r = u.childMenuItems(),
+ o = u.getItemData(),
+ c = parseInt(u.menuItemDepth(), 10),
+ d = parseInt(u.index(), 10),
+ l = u.next(),
+ h = l.childMenuItems(),
+ f = parseInt(l.menuItemDepth(), 10) + 1,
+ p = u.prev(),
+ v = parseInt(p.menuItemDepth(), 10),
+ g = p.getItemData()["menu-item-db-id"];
+ switch (t) {
case "up":
- if (f = n - 1, 0 === n) break;
- 0 === f && 0 !== m && j.moveHorizontally(0, m), 0 !== s && j.moveHorizontally(s, m), k ? (e = j.add(k), e.detach().insertBefore(h.eq(f)).updateParentMenuItemDBId()) : j.detach().insertBefore(h.eq(f)).updateParentMenuItemDBId();
+ if (i = d - 1, 0 === d) break;
+ 0 === i && 0 !== c && u.moveHorizontally(0, c), 0 !== v && u.moveHorizontally(v, c), r ? (n = u.add(r)).detach().insertBefore(s.eq(i)).updateParentMenuItemDBId() : u.detach().insertBefore(s.eq(i)).updateParentMenuItemDBId();
break;
case "down":
- if (k) {
- if (e = j.add(k), o = h.eq(e.length + n), p = 0 !== o.childMenuItems().length, p && (g = parseInt(o.menuItemDepth(), 10) + 1, j.moveHorizontally(g, m)), i === n + e.length) break;
- e.detach().insertAfter(h.eq(n + e.length)).updateParentMenuItemDBId()
+ if (r) {
+ if (n = u.add(r), (h = 0 !== (l = s.eq(n.length + d)).childMenuItems().length) && (a = parseInt(l.menuItemDepth(), 10) + 1, u.moveHorizontally(a, c)), m === d + n.length) break;
+ n.detach().insertAfter(s.eq(d + n.length)).updateParentMenuItemDBId()
} else {
- if (0 !== p.length && j.moveHorizontally(q, m), i === n + 1) break;
- j.detach().insertAfter(h.eq(n + 1)).updateParentMenuItemDBId()
+ if (0 !== h.length && u.moveHorizontally(f, c), m === d + 1) break;
+ u.detach().insertAfter(s.eq(d + 1)).updateParentMenuItemDBId()
}
break;
case "top":
- if (0 === n) break;
- k ? (e = j.add(k), e.detach().insertBefore(h.eq(0)).updateParentMenuItemDBId()) : j.detach().insertBefore(h.eq(0)).updateParentMenuItemDBId();
+ if (0 === d) break;
+ r ? (n = u.add(r)).detach().insertBefore(s.eq(0)).updateParentMenuItemDBId() : u.detach().insertBefore(s.eq(0)).updateParentMenuItemDBId();
break;
case "left":
- if (0 === m) break;
- j.shiftHorizontally(-1);
+ if (0 === c) break;
+ u.shiftHorizontally(-1);
break;
case "right":
- if (0 === n) break;
- if (l["menu-item-parent-id"] === t) break;
- j.shiftHorizontally(1)
+ if (0 === d) break;
+ if (o["menu-item-parent-id"] === g) break;
+ u.shiftHorizontally(1)
}
- c.focus(), b.registerChange(), b.refreshKeyboardAccessibility(), b.refreshAdvancedAccessibility()
+ e.focus(), y.registerChange(), y.refreshKeyboardAccessibility(), y.refreshAdvancedAccessibility()
},
initAccessibility: function() {
- var c = a("#menu-to-edit");
- b.refreshKeyboardAccessibility(), b.refreshAdvancedAccessibility(), c.on("mouseenter.refreshAccessibility focus.refreshAccessibility touchstart.refreshAccessibility", ".menu-item", function() {
- b.refreshAdvancedAccessibilityOfItem(a(this).find("a.item-edit"))
- }), c.on("click", "a.item-edit", function() {
- b.refreshAdvancedAccessibilityOfItem(a(this))
- }), c.on("click", ".menus-move", function() {
- var c = a(this),
- d = c.data("dir");
- void 0 !== d && b.moveMenuItem(a(this).parents("li.menu-item").find("a.item-edit"), d)
- })
- },
- refreshAdvancedAccessibilityOfItem: function(b) {
- if (!0 === a(b).data("needs_accessibility_refresh")) {
- var c, d, e, f, g, h, i, j, k, l = a(b),
- m = l.closest("li.menu-item").first(),
- n = m.menuItemDepth(),
- o = 0 === n,
- p = l.closest(".menu-item-handle").find(".menu-item-title").text(),
- q = parseInt(m.index(), 10),
- r = o ? n : parseInt(n - 1, 10),
- s = m.prevAll(".menu-item-depth-" + r).first().find(".menu-item-title").text(),
- t = m.prevAll(".menu-item-depth-" + n).first().find(".menu-item-title").text(),
- u = a("#menu-to-edit li").length,
- v = m.nextAll(".menu-item-depth-" + n).length;
- m.find(".field-move").toggle(u > 1), 0 !== q && (c = m.find(".menus-move-up"), c.attr("aria-label", menus.moveUp).css("display", "inline")), 0 !== q && o && (c = m.find(".menus-move-top"), c.attr("aria-label", menus.moveToTop).css("display", "inline")), q + 1 !== u && 0 !== q && (c = m.find(".menus-move-down"), c.attr("aria-label", menus.moveDown).css("display", "inline")), 0 === q && 0 !== v && (c = m.find(".menus-move-down"), c.attr("aria-label", menus.moveDown).css("display", "inline")), o || (c = m.find(".menus-move-left"), d = menus.outFrom.replace("%s", s), c.attr("aria-label", menus.moveOutFrom.replace("%s", s)).text(d).css("display", "inline")), 0 !== q && m.find(".menu-item-data-parent-id").val() !== m.prev().find(".menu-item-data-db-id").val() && (c = m.find(".menus-move-right"), d = menus.under.replace("%s", t), c.attr("aria-label", menus.moveUnder.replace("%s", t)).text(d).css("display", "inline")), o ? (e = a(".menu-item-depth-0"), f = e.index(m) + 1, u = e.length, g = menus.menuFocus.replace("%1$s", p).replace("%2$d", f).replace("%3$d", u)) : (h = m.prevAll(".menu-item-depth-" + parseInt(n - 1, 10)).first(), i = h.find(".menu-item-data-db-id").val(), j = h.find(".menu-item-title").text(), k = a('.menu-item .menu-item-data-parent-id[value="' + i + '"]'), f = a(k.parents(".menu-item").get().reverse()).index(m) + 1, g = menus.subMenuFocus.replace("%1$s", p).replace("%2$d", f).replace("%3$s", j)), l.attr("aria-label", g), l.data("needs_accessibility_refresh", !1)
+ var e = k("#menu-to-edit");
+ y.refreshKeyboardAccessibility(), y.refreshAdvancedAccessibility(), e.on("mouseenter.refreshAccessibility focus.refreshAccessibility touchstart.refreshAccessibility", ".menu-item", function() {
+ y.refreshAdvancedAccessibilityOfItem(k(this).find("a.item-edit"))
+ }), e.on("click", "a.item-edit", function() {
+ y.refreshAdvancedAccessibilityOfItem(k(this))
+ }), e.on("click", ".menus-move", function() {
+ var e = k(this).data("dir");
+ void 0 !== e && y.moveMenuItem(k(this).parents("li.menu-item").find("a.item-edit"), e)
+ })
+ },
+ refreshAdvancedAccessibilityOfItem: function(e) {
+ if (!0 === k(e).data("needs_accessibility_refresh")) {
+ var t, n, i, a, s, m, u, r, o, c = k(e),
+ d = c.closest("li.menu-item").first(),
+ l = d.menuItemDepth(),
+ h = 0 === l,
+ f = c.closest(".menu-item-handle").find(".menu-item-title").text(),
+ p = parseInt(d.index(), 10),
+ v = h ? l : parseInt(l - 1, 10),
+ g = d.prevAll(".menu-item-depth-" + v).first().find(".menu-item-title").text(),
+ b = d.prevAll(".menu-item-depth-" + l).first().find(".menu-item-title").text(),
+ I = k("#menu-to-edit li").length,
+ y = d.nextAll(".menu-item-depth-" + l).length;
+ d.find(".field-move").toggle(1 < I), 0 !== p && (t = d.find(".menus-move-up")).attr("aria-label", menus.moveUp).css("display", "inline"), 0 !== p && h && (t = d.find(".menus-move-top")).attr("aria-label", menus.moveToTop).css("display", "inline"), p + 1 !== I && 0 !== p && (t = d.find(".menus-move-down")).attr("aria-label", menus.moveDown).css("display", "inline"), 0 === p && 0 !== y && (t = d.find(".menus-move-down")).attr("aria-label", menus.moveDown).css("display", "inline"), h || (t = d.find(".menus-move-left"), n = menus.outFrom.replace("%s", g), t.attr("aria-label", menus.moveOutFrom.replace("%s", g)).text(n).css("display", "inline")), 0 !== p && d.find(".menu-item-data-parent-id").val() !== d.prev().find(".menu-item-data-db-id").val() && (t = d.find(".menus-move-right"), n = menus.under.replace("%s", b), t.attr("aria-label", menus.moveUnder.replace("%s", b)).text(n).css("display", "inline")), s = h ? (a = (i = k(".menu-item-depth-0")).index(d) + 1, I = i.length, menus.menuFocus.replace("%1$s", f).replace("%2$d", a).replace("%3$d", I)) : (u = (m = d.prevAll(".menu-item-depth-" + parseInt(l - 1, 10)).first()).find(".menu-item-data-db-id").val(), r = m.find(".menu-item-title").text(), o = k('.menu-item .menu-item-data-parent-id[value="' + u + '"]'), a = k(o.parents(".menu-item").get().reverse()).index(d) + 1, menus.subMenuFocus.replace("%1$s", f).replace("%2$d", a).replace("%3$s", r)), c.attr("aria-label", s), c.data("needs_accessibility_refresh", !1)
}
},
refreshAdvancedAccessibility: function() {
- a(".menu-item-settings .field-move .menus-move").hide(), a("a.item-edit").data("needs_accessibility_refresh", !0), a(".menu-item-edit-active a.item-edit").each(function() {
- b.refreshAdvancedAccessibilityOfItem(this)
+ k(".menu-item-settings .field-move .menus-move").hide(), k("a.item-edit").data("needs_accessibility_refresh", !0), k(".menu-item-edit-active a.item-edit").each(function() {
+ y.refreshAdvancedAccessibilityOfItem(this)
})
},
refreshKeyboardAccessibility: function() {
- a("a.item-edit").off("focus").on("focus", function() {
- a(this).off("keydown").on("keydown", function(c) {
- var d, e = a(this),
- f = e.parents("li.menu-item"),
- g = f.getItemData();
- if ((37 == c.which || 38 == c.which || 39 == c.which || 40 == c.which) && (e.off("keydown"), 1 !== a("#menu-to-edit li").length)) {
- switch (d = {
+ k("a.item-edit").off("focus").on("focus", function() {
+ k(this).off("keydown").on("keydown", function(e) {
+ var t, n = k(this),
+ i = n.parents("li.menu-item").getItemData();
+ if ((37 == e.which || 38 == e.which || 39 == e.which || 40 == e.which) && (n.off("keydown"), 1 !== k("#menu-to-edit li").length)) {
+ switch (t = {
38: "up",
40: "down",
37: "left",
39: "right"
- }, a("body").hasClass("rtl") && (d = {
+ }, k("body").hasClass("rtl") && (t = {
38: "up",
40: "down",
39: "left",
37: "right"
- }), d[c.which]) {
+ }), t[e.which]) {
case "up":
- b.moveMenuItem(e, "up");
+ y.moveMenuItem(n, "up");
break;
case "down":
- b.moveMenuItem(e, "down");
+ y.moveMenuItem(n, "down");
break;
case "left":
- b.moveMenuItem(e, "left");
+ y.moveMenuItem(n, "left");
break;
case "right":
- b.moveMenuItem(e, "right")
+ y.moveMenuItem(n, "right")
}
- return a("#edit-" + g["menu-item-db-id"]).focus(), !1
+ return k("#edit-" + i["menu-item-db-id"]).focus(), !1
}
})
})
},
initPreviewing: function() {
- a("#menu-to-edit").on("change input", ".edit-menu-item-title", function(b) {
- var c, d, e = a(b.currentTarget);
- c = e.val(), d = e.closest(".menu-item").find(".menu-item-title"), c ? d.text(c).removeClass("no-title") : d.text(navMenuL10n.untitled).addClass("no-title")
+ k("#menu-to-edit").on("change input", ".edit-menu-item-title", function(e) {
+ var t, n, i = k(e.currentTarget);
+ t = i.val(), n = i.closest(".menu-item").find(".menu-item-title"), t ? n.text(t).removeClass("no-title") : n.text(navMenuL10n.untitled).addClass("no-title")
})
},
initToggles: function() {
- postboxes.add_postbox_toggles("nav-menus"), columns.useCheckboxesForHidden(), columns.checked = function(b) {
- a(".field-" + b).removeClass("hidden-field")
- }, columns.unchecked = function(b) {
- a(".field-" + b).addClass("hidden-field")
- }, b.menuList.hideAdvancedMenuItemFields(), a(".hide-postbox-tog").click(function() {
- var b = a(".accordion-container li.accordion-section").filter(":hidden").map(function() {
+ postboxes.add_postbox_toggles("nav-menus"), columns.useCheckboxesForHidden(), columns.checked = function(e) {
+ k(".field-" + e).removeClass("hidden-field")
+ }, columns.unchecked = function(e) {
+ k(".field-" + e).addClass("hidden-field")
+ }, y.menuList.hideAdvancedMenuItemFields(), k(".hide-postbox-tog").click(function() {
+ var e = k(".accordion-container li.accordion-section").filter(":hidden").map(function() {
return this.id
}).get().join(",");
- a.post(ajaxurl, {
+ k.post(ajaxurl, {
action: "closed-postboxes",
- hidden: b,
+ hidden: e,
closedpostboxesnonce: jQuery("#closedpostboxesnonce").val(),
page: "nav-menus"
})
})
},
initSortables: function() {
- function c(a) {
- var c;
- i = a.placeholder.prev(".menu-item"), j = a.placeholder.next(".menu-item"), i[0] == a.item[0] && (i = i.prev(".menu-item")), j[0] == a.item[0] && (j = j.next(".menu-item")), k = i.length ? i.offset().top + i.height() : 0, l = j.length ? j.offset().top + j.height() / 3 : 0, g = j.length ? j.menuItemDepth() : 0, h = i.length ? (c = i.menuItemDepth() + 1) > b.options.globalMaxDepth ? b.options.globalMaxDepth : c : 0
- }
+ var m, s, u, n, r, o, c, d, l, h, f = 0,
+ p = y.menuList.offset().left,
+ v = k("body"),
+ g = function() {
+ if (!v[0].className) return 0;
+ var e = v[0].className.match(/menu-max-depth-(\d+)/);
+ return e && e[1] ? parseInt(e[1], 10) : 0
+ }();
- function d(a, b) {
- a.placeholder.updateDepthClass(b, p), p = b
+ function b(e) {
+ var t;
+ n = e.placeholder.prev(".menu-item"), r = e.placeholder.next(".menu-item"), n[0] == e.item[0] && (n = n.prev(".menu-item")), r[0] == e.item[0] && (r = r.next(".menu-item")), o = n.length ? n.offset().top + n.height() : 0, c = r.length ? r.offset().top + r.height() / 3 : 0, s = r.length ? r.menuItemDepth() : 0, u = n.length ? (t = n.menuItemDepth() + 1) > y.options.globalMaxDepth ? y.options.globalMaxDepth : t : 0
}
- function e(c) {
- var d, e = s;
- if (0 !== c) {
- if (c > 0)(d = o + c) > s && (e = d);
- else if (c < 0 && o == s)
- for (; !a(".menu-item-depth-" + e, b.menuList).length && e > 0;) e--;
- r.removeClass("menu-max-depth-" + s).addClass("menu-max-depth-" + e), s = e
- }
+ function I(e, t) {
+ e.placeholder.updateDepthClass(t, f), f = t
}
- var f, g, h, i, j, k, l, m, n, o, p = 0,
- q = b.menuList.offset().left,
- r = a("body"),
- s = function() {
- if (!r[0].className) return 0;
- var a = r[0].className.match(/menu-max-depth-(\d+)/);
- return a && a[1] ? parseInt(a[1], 10) : 0
- }();
- 0 !== a("#menu-to-edit li").length && a(".drag-instructions").show(), q += b.isRTL ? b.menuList.width() : 0, b.menuList.sortable({
+ 0 !== k("#menu-to-edit li").length && k(".drag-instructions").show(), p += y.isRTL ? y.menuList.width() : 0, y.menuList.sortable({
handle: ".menu-item-handle",
placeholder: "sortable-placeholder",
- items: b.options.sortableItems,
- start: function(e, g) {
- var h, i, j, k, l;
- b.isRTL && (g.item[0].style.right = "auto"), n = g.item.children(".menu-item-transport"), f = g.item.menuItemDepth(), d(g, f), j = g.item.next()[0] == g.placeholder[0] ? g.item.next() : g.item, k = j.childMenuItems(), n.append(k), h = n.outerHeight(), h += h > 0 ? 1 * g.placeholder.css("margin-top").slice(0, -2) : 0, h += g.helper.outerHeight(), m = h, h -= 2, g.placeholder.height(h), o = f, k.each(function() {
- var b = a(this).menuItemDepth();
- o = b > o ? b : o
- }), i = g.helper.find(".menu-item-handle").outerWidth(), i += b.depthToPx(o - f), i -= 2, g.placeholder.width(i), l = g.placeholder.next(".menu-item"), l.css("margin-top", m + "px"), g.placeholder.detach(), a(this).sortable("refresh"), g.item.after(g.placeholder), l.css("margin-top", 0), c(g)
- },
- stop: function(a, c) {
- var d, g, h = p - f;
- d = n.children().insertAfter(c.item), g = c.item.find(".item-title .is-submenu"), 0 < p ? g.show() : g.hide(), 0 !== h && (c.item.updateDepthClass(p), d.shiftDepthClass(h), e(h)), b.registerChange(), c.item.updateParentMenuItemDBId(), c.item[0].style.top = 0, b.isRTL && (c.item[0].style.left = "auto", c.item[0].style.right = 0), b.refreshKeyboardAccessibility(), b.refreshAdvancedAccessibility()
- },
- change: function(a, d) {
- d.placeholder.parent().hasClass("menu") || (i.length ? i.after(d.placeholder) : b.menuList.prepend(d.placeholder)), c(d)
- },
- sort: function(e, f) {
- var i = f.helper.offset(),
- n = b.isRTL ? i.left + f.helper.width() : i.left,
- o = b.negateIfRTL * b.pxToDepth(n - q);
- o > h || i.top < k - b.options.targetTolerance ? o = h : o < g && (o = g), o != p && d(f, o), l && i.top + m > l && (j.after(f.placeholder), c(f), a(this).sortable("refreshPositions"))
+ items: y.options.sortableItems,
+ start: function(e, t) {
+ var n, i, a, s;
+ y.isRTL && (t.item[0].style.right = "auto"), l = t.item.children(".menu-item-transport"), I(t, m = t.item.menuItemDepth()), a = (t.item.next()[0] == t.placeholder[0] ? t.item.next() : t.item).childMenuItems(), l.append(a), n = l.outerHeight(), n += 0 < n ? 1 * t.placeholder.css("margin-top").slice(0, -2) : 0, n += t.helper.outerHeight(), d = n, n -= 2, t.placeholder.height(n), h = m, a.each(function() {
+ var e = k(this).menuItemDepth();
+ h = h < e ? e : h
+ }), i = t.helper.find(".menu-item-handle").outerWidth(), i += y.depthToPx(h - m), i -= 2, t.placeholder.width(i), (s = t.placeholder.next(".menu-item")).css("margin-top", d + "px"), t.placeholder.detach(), k(this).sortable("refresh"), t.item.after(t.placeholder), s.css("margin-top", 0), b(t)
+ },
+ stop: function(e, t) {
+ var n, i, a = f - m;
+ n = l.children().insertAfter(t.item), i = t.item.find(".item-title .is-submenu"), 0 < f ? i.show() : i.hide(), 0 !== a && (t.item.updateDepthClass(f), n.shiftDepthClass(a), function(e) {
+ var t, n = g; {
+ if (0 === e) return;
+ if (0 < e) g < (t = h + e) && (n = t);
+ else if (e < 0 && h == g)
+ for (; !k(".menu-item-depth-" + n, y.menuList).length && 0 < n;) n--
+ }
+ v.removeClass("menu-max-depth-" + g).addClass("menu-max-depth-" + n), g = n
+ }(a)), y.registerChange(), t.item.updateParentMenuItemDBId(), t.item[0].style.top = 0, y.isRTL && (t.item[0].style.left = "auto", t.item[0].style.right = 0), y.refreshKeyboardAccessibility(), y.refreshAdvancedAccessibility()
+ },
+ change: function(e, t) {
+ t.placeholder.parent().hasClass("menu") || (n.length ? n.after(t.placeholder) : y.menuList.prepend(t.placeholder)), b(t)
+ },
+ sort: function(e, t) {
+ var n = t.helper.offset(),
+ i = y.isRTL ? n.left + t.helper.width() : n.left,
+ a = y.negateIfRTL * y.pxToDepth(i - p);
+ u < a || n.top < o - y.options.targetTolerance ? a = u : a < s && (a = s), a != f && I(t, a), c && n.top + d > c && (r.after(t.placeholder), b(t), k(this).sortable("refreshPositions"))
}
})
},
initManageLocations: function() {
- a("#menu-locations-wrap form").submit(function() {
+ k("#menu-locations-wrap form").submit(function() {
window.onbeforeunload = null
- }), a(".menu-location-menus select").on("change", function() {
- var b = a(this).closest("tr").find(".locations-edit-menu-link");
- a(this).find("option:selected").data("orig") ? b.show() : b.hide()
+ }), k(".menu-location-menus select").on("change", function() {
+ var e = k(this).closest("tr").find(".locations-edit-menu-link");
+ k(this).find("option:selected").data("orig") ? e.show() : e.hide()
})
},
attachMenuEditListeners: function() {
- var b = this;
- a("#update-nav-menu").bind("click", function(a) {
- if (a.target && a.target.className) {
- if (-1 != a.target.className.indexOf("item-edit")) return b.eventOnClickEditLink(a.target);
- if (-1 != a.target.className.indexOf("menu-save")) return b.eventOnClickMenuSave(a.target);
- if (-1 != a.target.className.indexOf("menu-delete")) return b.eventOnClickMenuDelete(a.target);
- if (-1 != a.target.className.indexOf("item-delete")) return b.eventOnClickMenuItemDelete(a.target);
- if (-1 != a.target.className.indexOf("item-cancel")) return b.eventOnClickCancelLink(a.target)
+ var t = this;
+ k("#update-nav-menu").bind("click", function(e) {
+ if (e.target && e.target.className) {
+ if (-1 != e.target.className.indexOf("item-edit")) return t.eventOnClickEditLink(e.target);
+ if (-1 != e.target.className.indexOf("menu-save")) return t.eventOnClickMenuSave(e.target);
+ if (-1 != e.target.className.indexOf("menu-delete")) return t.eventOnClickMenuDelete(e.target);
+ if (-1 != e.target.className.indexOf("item-delete")) return t.eventOnClickMenuItemDelete(e.target);
+ if (-1 != e.target.className.indexOf("item-cancel")) return t.eventOnClickCancelLink(e.target)
}
- }), a('#add-custom-links input[type="text"]').keypress(function(b) {
- a("#customlinkdiv").removeClass("form-invalid"), 13 === b.keyCode && (b.preventDefault(), a("#submit-customlinkdiv").click())
+ }), k('#add-custom-links input[type="text"]').keypress(function(e) {
+ k("#customlinkdiv").removeClass("form-invalid"), 13 === e.keyCode && (e.preventDefault(), k("#submit-customlinkdiv").click())
})
},
attachMenuSaveSubmitListeners: function() {
- a("#update-nav-menu").submit(function() {
- var b = a("#update-nav-menu").serializeArray();
- a('[name="nav-menu-data"]').val(JSON.stringify(b))
+ k("#update-nav-menu").submit(function() {
+ var e = k("#update-nav-menu").serializeArray();
+ k('[name="nav-menu-data"]').val(JSON.stringify(e))
})
},
attachThemeLocationsListeners: function() {
- var b = a("#nav-menu-theme-locations"),
- c = {};
- c.action = "menu-locations-save", c["menu-settings-column-nonce"] = a("#menu-settings-column-nonce").val(), b.find('input[type="submit"]').click(function() {
- return b.find("select").each(function() {
- c[this.name] = a(this).val()
- }), b.find(".spinner").addClass("is-active"), a.post(ajaxurl, c, function() {
- b.find(".spinner").removeClass("is-active")
+ var e = k("#nav-menu-theme-locations"),
+ t = {
+ action: "menu-locations-save"
+ };
+ t["menu-settings-column-nonce"] = k("#menu-settings-column-nonce").val(), e.find('input[type="submit"]').click(function() {
+ return e.find("select").each(function() {
+ t[this.name] = k(this).val()
+ }), e.find(".spinner").addClass("is-active"), k.post(ajaxurl, t, function() {
+ e.find(".spinner").removeClass("is-active")
}), !1
})
},
attachQuickSearchListeners: function() {
- var c, d;
- a("#nav-menu-meta").on("submit", function(a) {
- a.preventDefault()
- }), d = "oninput" in document.createElement("input") ? "input" : "keyup", a("#nav-menu-meta").on(d, ".quick-search", function() {
- var d = a(this);
- d.attr("autocomplete", "off"), c && clearTimeout(c), c = setTimeout(function() {
- b.updateQuickSearchResults(d)
+ var t, e;
+ k("#nav-menu-meta").on("submit", function(e) {
+ e.preventDefault()
+ }), e = "oninput" in document.createElement("input") ? "input" : "keyup", k("#nav-menu-meta").on(e, ".quick-search", function() {
+ var e = k(this);
+ e.attr("autocomplete", "off"), t && clearTimeout(t), t = setTimeout(function() {
+ y.updateQuickSearchResults(e)
}, 500)
}).on("blur", ".quick-search", function() {
- b.lastSearch = ""
+ y.lastSearch = ""
})
},
- updateQuickSearchResults: function(c) {
- var d, e, f = c.val();
- f.length < 2 || b.lastSearch == f || (b.lastSearch = f, d = c.parents(".tabs-panel"), e = {
+ updateQuickSearchResults: function(e) {
+ var t, n, i = e.val();
+ i.length < 2 || y.lastSearch == i || (y.lastSearch = i, t = e.parents(".tabs-panel"), n = {
action: "menu-quick-search",
"response-format": "markup",
- menu: a("#menu").val(),
- "menu-settings-column-nonce": a("#menu-settings-column-nonce").val(),
- q: f,
- type: c.attr("name")
- }, a(".spinner", d).addClass("is-active"), a.post(ajaxurl, e, function(a) {
- b.processQuickSearchQueryResponse(a, e, d)
+ menu: k("#menu").val(),
+ "menu-settings-column-nonce": k("#menu-settings-column-nonce").val(),
+ q: i,
+ type: e.attr("name")
+ }, k(".spinner", t).addClass("is-active"), k.post(ajaxurl, n, function(e) {
+ y.processQuickSearchQueryResponse(e, n, t)
}))
},
- addCustomLink: function(c) {
- var d = a("#custom-menu-item-url").val(),
- e = a("#custom-menu-item-name").val();
- if (c = c || b.addMenuItemToBottom, "" === d || "http://" == d) return a("#customlinkdiv").addClass("form-invalid"), !1;
- a(".customlinkdiv .spinner").addClass("is-active"), this.addLinkToMenu(d, e, c, function() {
- a(".customlinkdiv .spinner").removeClass("is-active"), a("#custom-menu-item-name").val("").blur(), a("#custom-menu-item-url").val("http://")
+ addCustomLink: function(e) {
+ var t = k("#custom-menu-item-url").val(),
+ n = k("#custom-menu-item-name").val();
+ if (e = e || y.addMenuItemToBottom, "" === t || "http://" == t) return k("#customlinkdiv").addClass("form-invalid"), !1;
+ k(".customlinkdiv .spinner").addClass("is-active"), this.addLinkToMenu(t, n, e, function() {
+ k(".customlinkdiv .spinner").removeClass("is-active"), k("#custom-menu-item-name").val("").blur(), k("#custom-menu-item-url").val("http://")
})
},
- addLinkToMenu: function(a, c, d, e) {
- d = d || b.addMenuItemToBottom, e = e || function() {}, b.addItemToMenu({
+ addLinkToMenu: function(e, t, n, i) {
+ n = n || y.addMenuItemToBottom, i = i || function() {}, y.addItemToMenu({
"-1": {
"menu-item-type": "custom",
- "menu-item-url": a,
- "menu-item-title": c
+ "menu-item-url": e,
+ "menu-item-title": t
}
- }, d, e)
+ }, n, i)
},
- addItemToMenu: function(b, c, d) {
- var e, f = a("#menu").val(),
- g = a("#menu-settings-column-nonce").val();
- c = c || function() {}, d = d || function() {}, e = {
+ addItemToMenu: function(e, n, i) {
+ var a, t = k("#menu").val(),
+ s = k("#menu-settings-column-nonce").val();
+ n = n || function() {}, i = i || function() {}, a = {
action: "add-menu-item",
- menu: f,
- "menu-settings-column-nonce": g,
- "menu-item": b
- }, a.post(ajaxurl, e, function(b) {
- var f = a("#menu-instructions");
- b = a.trim(b), c(b, e), a("li.pending").hide().fadeIn("slow"), a(".drag-instructions").show(), !f.hasClass("menu-instructions-inactive") && f.siblings().length && f.addClass("menu-instructions-inactive"), d()
+ menu: t,
+ "menu-settings-column-nonce": s,
+ "menu-item": e
+ }, k.post(ajaxurl, a, function(e) {
+ var t = k("#menu-instructions");
+ e = k.trim(e), n(e, a), k("li.pending").hide().fadeIn("slow"), k(".drag-instructions").show(), !t.hasClass("menu-instructions-inactive") && t.siblings().length && t.addClass("menu-instructions-inactive"), i()
})
},
- addMenuItemToBottom: function(c) {
- var d = a(c);
- d.hideAdvancedMenuItemFields().appendTo(b.targetList), b.refreshKeyboardAccessibility(), b.refreshAdvancedAccessibility(), a(document).trigger("menu-item-added", [d])
- },
- addMenuItemToTop: function(c) {
- var d = a(c);
- d.hideAdvancedMenuItemFields().prependTo(b.targetList), b.refreshKeyboardAccessibility(), b.refreshAdvancedAccessibility(), a(document).trigger("menu-item-added", [d])
+ addMenuItemToBottom: function(e) {
+ var t = k(e);
+ t.hideAdvancedMenuItemFields().appendTo(y.targetList), y.refreshKeyboardAccessibility(), y.refreshAdvancedAccessibility(), k(document).trigger("menu-item-added", [t])
+ },
+ addMenuItemToTop: function(e) {
+ var t = k(e);
+ t.hideAdvancedMenuItemFields().prependTo(y.targetList), y.refreshKeyboardAccessibility(), y.refreshAdvancedAccessibility(), k(document).trigger("menu-item-added", [t])
},
attachUnsavedChangesListener: function() {
- a("#menu-management input, #menu-management select, #menu-management, #menu-management textarea, .menu-location-menus select").change(function() {
- b.registerChange()
- }), 0 !== a("#menu-to-edit").length || 0 !== a(".menu-location-menus select").length ? window.onbeforeunload = function() {
- if (b.menusChanged) return navMenuL10n.saveAlert
- } : a("#menu-settings-column").find("input,select").end().find("a").attr("href", "#").unbind("click")
+ k("#menu-management input, #menu-management select, #menu-management, #menu-management textarea, .menu-location-menus select").change(function() {
+ y.registerChange()
+ }), 0 !== k("#menu-to-edit").length || 0 !== k(".menu-location-menus select").length ? window.onbeforeunload = function() {
+ if (y.menusChanged) return navMenuL10n.saveAlert
+ } : k("#menu-settings-column").find("input,select").end().find("a").attr("href", "#").unbind("click")
},
registerChange: function() {
- b.menusChanged = !0
+ y.menusChanged = !0
},
attachTabsPanelListeners: function() {
- a("#menu-settings-column").bind("click", function(c) {
- var d, e, f, g, h = a(c.target);
- if (h.hasClass("nav-tab-link")) e = h.data("type"), f = h.parents(".accordion-section-content").first(), a("input", f).removeAttr("checked"), a(".tabs-panel-active", f).removeClass("tabs-panel-active").addClass("tabs-panel-inactive"), a("#" + e, f).removeClass("tabs-panel-inactive").addClass("tabs-panel-active"), a(".tabs", f).removeClass("tabs"), h.parent().addClass("tabs"), a(".quick-search", f).focus(), f.find(".tabs-panel-active .menu-item-title").length ? f.removeClass("has-no-menu-item") : f.addClass("has-no-menu-item"), c.preventDefault();
- else if (h.hasClass("select-all")) {
- if ((d = /#(.*)$/.exec(c.target.href)) && d[1]) return g = a("#" + d[1] + " .tabs-panel-active .menu-item-title input"), g.length === g.filter(":checked").length ? g.removeAttr("checked") : g.prop("checked", !0), !1
- } else if (h.hasClass("submit-add-to-menu")) return b.registerChange(), c.target.id && "submit-customlinkdiv" == c.target.id ? b.addCustomLink(b.addMenuItemToBottom) : c.target.id && -1 != c.target.id.indexOf("submit-") && a("#" + c.target.id.replace(/submit-/, "")).addSelectedToMenu(b.addMenuItemToBottom), !1
- }), a("#nav-menu-meta").on("click", "a.page-numbers", function() {
- var b = a(this).closest(".inside");
- return a.post(ajaxurl, this.href.replace(/.*\?/, "").replace(/action=([^&]*)/, "") + "&action=menu-get-metabox", function(c) {
- var d, e = a.parseJSON(c); - 1 !== c.indexOf("replace-id") && (d = document.getElementById(e["replace-id"]), e.markup && d && b.html(e.markup))
+ k("#menu-settings-column").bind("click", function(e) {
+ var t, n, i, a, s = k(e.target);
+ if (s.hasClass("nav-tab-link")) n = s.data("type"), i = s.parents(".accordion-section-content").first(), k("input", i).removeAttr("checked"), k(".tabs-panel-active", i).removeClass("tabs-panel-active").addClass("tabs-panel-inactive"), k("#" + n, i).removeClass("tabs-panel-inactive").addClass("tabs-panel-active"), k(".tabs", i).removeClass("tabs"), s.parent().addClass("tabs"), k(".quick-search", i).focus(), i.find(".tabs-panel-active .menu-item-title").length ? i.removeClass("has-no-menu-item") : i.addClass("has-no-menu-item"), e.preventDefault();
+ else if (s.hasClass("select-all")) {
+ if ((t = /#(.*)$/.exec(e.target.href)) && t[1]) return (a = k("#" + t[1] + " .tabs-panel-active .menu-item-title input")).length === a.filter(":checked").length ? a.removeAttr("checked") : a.prop("checked", !0), !1
+ } else if (s.hasClass("submit-add-to-menu")) return y.registerChange(), e.target.id && "submit-customlinkdiv" == e.target.id ? y.addCustomLink(y.addMenuItemToBottom) : e.target.id && -1 != e.target.id.indexOf("submit-") && k("#" + e.target.id.replace(/submit-/, "")).addSelectedToMenu(y.addMenuItemToBottom), !1
+ }), k("#nav-menu-meta").on("click", "a.page-numbers", function() {
+ var i = k(this).closest(".inside");
+ return k.post(ajaxurl, this.href.replace(/.*\?/, "").replace(/action=([^&]*)/, "") + "&action=menu-get-metabox", function(e) {
+ var t, n = k.parseJSON(e); - 1 !== e.indexOf("replace-id") && (t = document.getElementById(n["replace-id"]), n.markup && t && i.html(n.markup))
}), !1
})
},
- eventOnClickEditLink: function(b) {
- var c, d, e = /#(.*)$/.exec(b.href);
- if (e && e[1] && (c = a("#" + e[1]), d = c.parent(), 0 !== d.length)) return d.hasClass("menu-item-edit-inactive") ? (c.data("menu-item-data") || c.data("menu-item-data", c.getItemData()), c.slideDown("fast"), d.removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active")) : (c.slideUp("fast"), d.removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive")), !1
- },
- eventOnClickCancelLink: function(b) {
- var c = a(b).closest(".menu-item-settings");
- return a(b).closest(".menu-item").removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive"), c.setItemData(c.data("menu-item-data")).hide(), !1
+ eventOnClickEditLink: function(e) {
+ var t, n, i = /#(.*)$/.exec(e.href);
+ if (i && i[1] && 0 !== (n = (t = k("#" + i[1])).parent()).length) return n.hasClass("menu-item-edit-inactive") ? (t.data("menu-item-data") || t.data("menu-item-data", t.getItemData()), t.slideDown("fast"), n.removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active")) : (t.slideUp("fast"), n.removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive")), !1
+ },
+ eventOnClickCancelLink: function(e) {
+ var t = k(e).closest(".menu-item-settings");
+ return k(e).closest(".menu-item").removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive"), t.setItemData(t.data("menu-item-data")).hide(), !1
},
eventOnClickMenuSave: function() {
- var c = "",
- d = a("#menu-name"),
- e = d.val();
- return e && e != d.attr("title") && e.replace(/\s+/, "") ? (a("#nav-menu-theme-locations select").each(function() {
- c += '<input type="hidden" name="' + this.name + '" value="' + a(this).val() + '" />'
- }), a("#update-nav-menu").append(c), b.menuList.find(".menu-item-data-position").val(function(a) {
- return a + 1
- }), window.onbeforeunload = null, !0) : (d.parent().addClass("form-invalid"), !1)
+ var e = "",
+ t = k("#menu-name"),
+ n = t.val();
+ return n && n != t.attr("title") && n.replace(/\s+/, "") ? (k("#nav-menu-theme-locations select").each(function() {
+ e += '<input type="hidden" name="' + this.name + '" value="' + k(this).val() + '" />'
+ }), k("#update-nav-menu").append(e), y.menuList.find(".menu-item-data-position").val(function(e) {
+ return e + 1
+ }), !(window.onbeforeunload = null)) : (t.parent().addClass("form-invalid"), !1)
},
eventOnClickMenuDelete: function() {
- return !!window.confirm(navMenuL10n.warnDeleteMenu) && (window.onbeforeunload = null, !0)
+ return !!window.confirm(navMenuL10n.warnDeleteMenu) && !(window.onbeforeunload = null)
},
- eventOnClickMenuItemDelete: function(c) {
- var d = parseInt(c.id.replace("delete-", ""), 10);
- return b.removeMenuItem(a("#menu-item-" + d)), b.registerChange(), !1
- },
- processQuickSearchQueryResponse: function(b, c, d) {
- var e, f, g, h = {},
- i = document.getElementById("nav-menu-meta"),
- j = /menu-item[(\[^]\]*/,
- k = a("<div>").html(b).find("li"),
- l = d.closest(".accordion-section-content");
- if (!k.length) return a(".categorychecklist", d).html("<li><p>" + navMenuL10n.noResultsFound + "</p></li>"), a(".spinner", d).removeClass("is-active"), void l.addClass("has-no-menu-item");
- k.each(function() {
- if (g = a(this), (e = j.exec(g.html())) && e[1]) {
- for (f = e[1]; i.elements["menu-item[" + f + "][menu-item-type]"] || h[f];) f--;
- h[f] = !0, f != e[1] && g.html(g.html().replace(new RegExp("menu-item\\[" + e[1] + "\\]", "g"), "menu-item[" + f + "]"))
+ eventOnClickMenuItemDelete: function(e) {
+ var t = parseInt(e.id.replace("delete-", ""), 10);
+ return y.removeMenuItem(k("#menu-item-" + t)), y.registerChange(), !1
+ },
+ processQuickSearchQueryResponse: function(e, t, n) {
+ var i, a, s, m = {},
+ u = document.getElementById("nav-menu-meta"),
+ r = /menu-item[(\[^]\]*/,
+ o = k("<div>").html(e).find("li"),
+ c = n.closest(".accordion-section-content");
+ if (!o.length) return k(".categorychecklist", n).html("<li><p>" + navMenuL10n.noResultsFound + "</p></li>"), k(".spinner", n).removeClass("is-active"), void c.addClass("has-no-menu-item");
+ o.each(function() {
+ if (s = k(this), (i = r.exec(s.html())) && i[1]) {
+ for (a = i[1]; u.elements["menu-item[" + a + "][menu-item-type]"] || m[a];) a--;
+ m[a] = !0, a != i[1] && s.html(s.html().replace(new RegExp("menu-item\\[" + i[1] + "\\]", "g"), "menu-item[" + a + "]"))
}
- }), a(".categorychecklist", d).html(k), a(".spinner", d).removeClass("is-active"), l.removeClass("has-no-menu-item")
+ }), k(".categorychecklist", n).html(o), k(".spinner", n).removeClass("is-active"), c.removeClass("has-no-menu-item")
},
- removeMenuItem: function(c) {
- var d = c.childMenuItems();
- a(document).trigger("menu-removing-item", [c]), c.addClass("deleting").animate({
+ removeMenuItem: function(t) {
+ var n = t.childMenuItems();
+ k(document).trigger("menu-removing-item", [t]), t.addClass("deleting").animate({
opacity: 0,
height: 0
}, 350, function() {
- var e = a("#menu-instructions");
- c.remove(), d.shiftDepthClass(-1).updateParentMenuItemDBId(), 0 === a("#menu-to-edit li").length && (a(".drag-instructions").hide(), e.removeClass("menu-instructions-inactive")), b.refreshAdvancedAccessibility()
+ var e = k("#menu-instructions");
+ t.remove(), n.shiftDepthClass(-1).updateParentMenuItemDBId(), 0 === k("#menu-to-edit li").length && (k(".drag-instructions").hide(), e.removeClass("menu-instructions-inactive")), y.refreshAdvancedAccessibility()
})
},
- depthToPx: function(a) {
- return a * b.options.menuItemDepthPerLevel
+ depthToPx: function(e) {
+ return e * y.options.menuItemDepthPerLevel
},
- pxToDepth: function(a) {
- return Math.floor(a / b.options.menuItemDepthPerLevel)
+ pxToDepth: function(e) {
+ return Math.floor(e / y.options.menuItemDepthPerLevel)
}
- }, a(document).ready(function() {
+ }, k(document).ready(function() {
wpNavMenu.init()
})
}(jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/password-strength-meter.min.js build-branch-unminified/wp-admin/js/password-strength-meter.min.js
--- build-unminified/wp-admin/js/password-strength-meter.min.js 2018-10-08 22:57:52.029451093 -0500
+++ build-branch-unminified/wp-admin/js/password-strength-meter.min.js 2018-10-08 22:55:03.140111683 -0500
@@ -1,19 +1,19 @@
-window.wp = window.wp || {};
var passwordStrength;
-! function(a) {
- wp.passwordStrength = {
- meter: function(b, c, d) {
- return a.isArray(c) || (c = [c.toString()]), b != d && d && d.length > 0 ? 5 : "undefined" == typeof window.zxcvbn ? -1 : zxcvbn(b, c).score
- },
- userInputBlacklist: function() {
- var b, c, d, e, f = [],
- g = [],
- h = ["user_login", "first_name", "last_name", "nickname", "display_name", "email", "url", "description", "weblog_title", "admin_email"];
- for (f.push(document.title), f.push(document.URL), c = h.length, b = 0; b < c; b++) e = a("#" + h[b]), 0 !== e.length && (f.push(e[0].defaultValue), f.push(e.val()));
- for (d = f.length, b = 0; b < d; b++) f[b] && (g = g.concat(f[b].replace(/\W/g, " ").split(" ")));
- return g = a.grep(g, function(b, c) {
- return !("" === b || 4 > b.length) && a.inArray(b, g) === c
- })
- }
- }, passwordStrength = wp.passwordStrength.meter
-}(jQuery);
\ No newline at end of file
+window.wp = window.wp || {},
+ function(s) {
+ wp.passwordStrength = {
+ meter: function(n, t, e) {
+ return s.isArray(t) || (t = [t.toString()]), n != e && e && 0 < e.length ? 5 : void 0 === window.zxcvbn ? -1 : zxcvbn(n, t).score
+ },
+ userInputBlacklist: function() {
+ var n, t, e, r, i = [],
+ a = [],
+ o = ["user_login", "first_name", "last_name", "nickname", "display_name", "email", "url", "description", "weblog_title", "admin_email"];
+ for (i.push(document.title), i.push(document.URL), t = o.length, n = 0; n < t; n++) 0 !== (r = s("#" + o[n])).length && (i.push(r[0].defaultValue), i.push(r.val()));
+ for (e = i.length, n = 0; n < e; n++) i[n] && (a = a.concat(i[n].replace(/\W/g, " ").split(" ")));
+ return a = s.grep(a, function(n, t) {
+ return !("" === n || n.length < 4) && s.inArray(n, a) === t
+ })
+ }
+ }, passwordStrength = wp.passwordStrength.meter
+ }(jQuery);
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/plugin-install.min.js build-branch-unminified/wp-admin/js/plugin-install.min.js
--- build-unminified/wp-admin/js/plugin-install.min.js 2018-10-08 22:57:57.233492309 -0500
+++ build-branch-unminified/wp-admin/js/plugin-install.min.js 2018-10-08 22:55:08.288152562 -0500
@@ -1,60 +1,56 @@
var tb_position;
jQuery(document).ready(function(a) {
- function b() {
- var b = e.find("#TB_iframeContent");
- f = b.contents().find("body"), c(), h.focus(), a("#plugin-information-tabs a", f).on("click", function() {
- c()
- }), f.on("keydown", function(a) {
- 27 === a.which && tb_remove()
- })
- }
+ var o, i, n, e, l, s = a(),
+ d = a(".upload-view-toggle"),
+ t = a(".wrap"),
+ r = a(document.body);
- function c() {
- var b;
- g = a(":tabbable", f), h = e.find("#TB_closeWindowButton"), i = g.last(), b = h.add(i), b.off("keydown.wp-plugin-details"), b.on("keydown.wp-plugin-details", function(a) {
- d(a)
+ function u() {
+ var t;
+ n = a(":tabbable", i), e = o.find("#TB_closeWindowButton"), l = n.last(), (t = e.add(l)).off("keydown.wp-plugin-details"), t.on("keydown.wp-plugin-details", function(t) {
+ ! function(t) {
+ if (9 !== t.which) return;
+ l[0] !== t.target || t.shiftKey ? e[0] === t.target && t.shiftKey && (t.preventDefault(), l.focus()) : (t.preventDefault(), e.focus())
+ }(t)
})
}
-
- function d(a) {
- 9 === a.which && (i[0] !== a.target || a.shiftKey ? h[0] === a.target && a.shiftKey && (a.preventDefault(), i.focus()) : (a.preventDefault(), h.focus()))
- }
- var e, f, g, h, i, j = a(),
- k = a(".upload-view-toggle"),
- l = a(".wrap"),
- m = a(document.body);
tb_position = function() {
- var b = a(window).width(),
- c = a(window).height() - (792 < b ? 60 : 20),
- d = 792 < b ? 772 : b - 20;
- return e = a("#TB_window"), e.length && (e.width(d).height(c), a("#TB_iframeContent").width(d).height(c), e.css({
- "margin-left": "-" + parseInt(d / 2, 10) + "px"
- }), "undefined" != typeof document.body.style.maxWidth && e.css({
+ var t = a(window).width(),
+ i = a(window).height() - (792 < t ? 60 : 20),
+ n = 792 < t ? 772 : t - 20;
+ return (o = a("#TB_window")).length && (o.width(n).height(i), a("#TB_iframeContent").width(n).height(i), o.css({
+ "margin-left": "-" + parseInt(n / 2, 10) + "px"
+ }), void 0 !== document.body.style.maxWidth && o.css({
top: "30px",
"margin-top": "0"
})), a("a.thickbox").each(function() {
- var b = a(this).attr("href");
- b && (b = b.replace(/&width=[0-9]+/g, ""), b = b.replace(/&height=[0-9]+/g, ""), a(this).attr("href", b + "&width=" + d + "&height=" + c))
+ var t = a(this).attr("href");
+ t && (t = (t = t.replace(/&width=[0-9]+/g, "")).replace(/&height=[0-9]+/g, ""), a(this).attr("href", t + "&width=" + n + "&height=" + i))
})
}, a(window).resize(function() {
tb_position()
- }), m.on("thickbox:iframe:loaded", e, function() {
- e.hasClass("plugin-details-modal") && b()
+ }), r.on("thickbox:iframe:loaded", o, function() {
+ var t;
+ o.hasClass("plugin-details-modal") && (t = o.find("#TB_iframeContent"), i = t.contents().find("body"), u(), e.focus(), a("#plugin-information-tabs a", i).on("click", function() {
+ u()
+ }), i.on("keydown", function(t) {
+ 27 === t.which && tb_remove()
+ }))
}).on("thickbox:removed", function() {
- j.focus()
- }), a(".wrap").on("click", ".thickbox.open-plugin-details-modal", function(b) {
- var c = a(this).data("title") ? plugininstallL10n.plugin_information + " " + a(this).data("title") : plugininstallL10n.plugin_modal_label;
- b.preventDefault(), b.stopPropagation(), j = a(this), tb_click.call(this), e.attr({
+ s.focus()
+ }), a(".wrap").on("click", ".thickbox.open-plugin-details-modal", function(t) {
+ var i = a(this).data("title") ? plugininstallL10n.plugin_information + " " + a(this).data("title") : plugininstallL10n.plugin_modal_label;
+ t.preventDefault(), t.stopPropagation(), s = a(this), tb_click.call(this), o.attr({
role: "dialog",
"aria-label": plugininstallL10n.plugin_modal_label
- }).addClass("plugin-details-modal"), e.find("#TB_iframeContent").attr("title", c)
- }), a("#plugin-information-tabs a").click(function(b) {
- var c = a(this).attr("name");
- b.preventDefault(), a("#plugin-information-tabs a.current").removeClass("current"), a(this).addClass("current"), "description" !== c && a(window).width() < 772 ? a("#plugin-information-content").find(".fyi").hide() : a("#plugin-information-content").find(".fyi").show(), a("#section-holder div.section").hide(), a("#section-" + c).show()
- }), l.hasClass("plugin-install-tab-upload") || k.attr({
+ }).addClass("plugin-details-modal"), o.find("#TB_iframeContent").attr("title", i)
+ }), a("#plugin-information-tabs a").click(function(t) {
+ var i = a(this).attr("name");
+ t.preventDefault(), a("#plugin-information-tabs a.current").removeClass("current"), a(this).addClass("current"), "description" !== i && a(window).width() < 772 ? a("#plugin-information-content").find(".fyi").hide() : a("#plugin-information-content").find(".fyi").show(), a("#section-holder div.section").hide(), a("#section-" + i).show()
+ }), t.hasClass("plugin-install-tab-upload") || d.attr({
role: "button",
"aria-expanded": "false"
- }).on("click", function(a) {
- a.preventDefault(), m.toggleClass("show-upload-view"), k.attr("aria-expanded", m.hasClass("show-upload-view"))
+ }).on("click", function(t) {
+ t.preventDefault(), r.toggleClass("show-upload-view"), d.attr("aria-expanded", r.hasClass("show-upload-view"))
})
});
\ No newline at end of file
diff -ur build-unminified/wp-admin/js/postbox.min.js build-branch-unminified/wp-admin/js/postbox.min.js
--- build-unminified/wp-admin/js/postbox.min.js 2018-10-08 22:57:53.065459298 -0500
+++ build-branch-unminified/wp-admin/js/postbox.min.js 2018-10-08 22:55:04.488122388 -0500
@@ -1,111 +1,110 @@
var postboxes;
! function(a) {
- var b = a(document);
+ var n = a(document);
postboxes = {
handle_click: function() {
- var c, d = a(this),
- e = d.parent(".postbox"),
- f = e.attr("id");
- "dashboard_browser_nag" !== f && (e.toggleClass("closed"), c = !e.hasClass("closed"), d.hasClass("handlediv") ? d.attr("aria-expanded", c) : d.closest(".postbox").find("button.handlediv").attr("aria-expanded", c), "press-this" !== postboxes.page && postboxes.save_state(postboxes.page), f && (!e.hasClass("closed") && a.isFunction(postboxes.pbshow) ? postboxes.pbshow(f) : e.hasClass("closed") && a.isFunction(postboxes.pbhide) && postboxes.pbhide(f)), b.trigger("postbox-toggled", e))
- },
- add_postbox_toggles: function(c, d) {
- var e = a(".postbox .hndle, .postbox .handlediv");
- this.page = c, this.init(c, d), e.on("click.postboxes", this.handle_click), a(".postbox .hndle a").click(function(a) {
- a.stopPropagation()
- }), a(".postbox a.dismiss").on("click.postboxes", function(b) {
- var c = a(this).parents(".postbox").attr("id") + "-hide";
- b.preventDefault(), a("#" + c).prop("checked", !1).triggerHandler("click")
+ var e, o = a(this),
+ s = o.parent(".postbox"),
+ t = s.attr("id");
+ "dashboard_browser_nag" !== t && (s.toggleClass("closed"), e = !s.hasClass("closed"), o.hasClass("handlediv") ? o.attr("aria-expanded", e) : o.closest(".postbox").find("button.handlediv").attr("aria-expanded", e), "press-this" !== postboxes.page && postboxes.save_state(postboxes.page), t && (!s.hasClass("closed") && a.isFunction(postboxes.pbshow) ? postboxes.pbshow(t) : s.hasClass("closed") && a.isFunction(postboxes.pbhide) && postboxes.pbhide(t)), n.trigger("postbox-toggled", s))
+ },
+ add_postbox_toggles: function(t, e) {
+ var o = a(".postbox .hndle, .postbox .handlediv");
+ this.page = t, this.init(t, e), o.on("click.postboxes", this.handle_click), a(".postbox .hndle a").click(function(e) {
+ e.stopPropagation()
+ }), a(".postbox a.dismiss").on("click.postboxes", function(e) {
+ var o = a(this).parents(".postbox").attr("id") + "-hide";
+ e.preventDefault(), a("#" + o).prop("checked", !1).triggerHandler("click")
}), a(".hide-postbox-tog").bind("click.postboxes", function() {
- var d = a(this),
- e = d.val(),
- f = a("#" + e);
- d.prop("checked") ? (f.show(), a.isFunction(postboxes.pbshow) && postboxes.pbshow(e)) : (f.hide(), a.isFunction(postboxes.pbhide) && postboxes.pbhide(e)), postboxes.save_state(c), postboxes._mark_area(), b.trigger("postbox-toggled", f)
+ var e = a(this),
+ o = e.val(),
+ s = a("#" + o);
+ e.prop("checked") ? (s.show(), a.isFunction(postboxes.pbshow) && postboxes.pbshow(o)) : (s.hide(), a.isFunction(postboxes.pbhide) && postboxes.pbhide(o)), postboxes.save_state(t), postboxes._mark_area(), n.trigger("postbox-toggled", s)
}), a('.columns-prefs input[type="radio"]').bind("click.postboxes", function() {
- var b = parseInt(a(this).val(), 10);
- b && (postboxes._pb_edit(b), postboxes.save_order(c))
+ var e = parseInt(a(this).val(), 10);
+ e && (postboxes._pb_edit(e), postboxes.save_order(t))
})
},
- init: function(c, d) {
- var e = a(document.body).hasClass("mobile"),
- f = a(".postbox .handlediv");
- a.extend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment