1010 lines
38 KiB
JavaScript
Executable File
1010 lines
38 KiB
JavaScript
Executable File
!(function (e) {
|
|
e.deparam = function (t, i) {
|
|
var a = {},
|
|
n = { true: !0, false: !1, null: null };
|
|
return (
|
|
e.each(t.replace(/\+/g, " ").split("&"), function (t, o) {
|
|
var r,
|
|
c = o.split("="),
|
|
d = decodeURIComponent(c[0]),
|
|
l = a,
|
|
s = 0,
|
|
u = d.split("]["),
|
|
p = u.length - 1;
|
|
if (
|
|
(/\[/.test(u[0]) && /\]$/.test(u[p])
|
|
? ((u[p] = u[p].replace(/\]$/, "")),
|
|
(p = (u = u.shift().split("[").concat(u)).length - 1))
|
|
: (p = 0),
|
|
2 === c.length)
|
|
)
|
|
if (
|
|
((r = decodeURIComponent(c[1])),
|
|
i &&
|
|
(r =
|
|
r && !isNaN(r)
|
|
? +r
|
|
: "undefined" === r
|
|
? void 0
|
|
: void 0 !== n[r]
|
|
? n[r]
|
|
: r),
|
|
p)
|
|
)
|
|
for (; s <= p; s++)
|
|
l = l[(d = "" === u[s] ? l.length : u[s])] =
|
|
s < p ? l[d] || (u[s + 1] && isNaN(u[s + 1]) ? {} : []) : r;
|
|
else
|
|
e.isArray(a[d])
|
|
? a[d].push(r)
|
|
: void 0 !== a[d]
|
|
? (a[d] = [a[d], r])
|
|
: (a[d] = r);
|
|
else d && (a[d] = i ? void 0 : "");
|
|
}),
|
|
a
|
|
);
|
|
};
|
|
})(jQuery),
|
|
(function (e) {
|
|
function t(e) {
|
|
var t;
|
|
return (
|
|
(e = e.replace(/ /g, "")).match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)
|
|
? ((t =
|
|
100 *
|
|
parseFloat(e.match(/rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/)[1]).toFixed(
|
|
2
|
|
)),
|
|
(t = parseInt(t)))
|
|
: (t = 100),
|
|
t
|
|
);
|
|
}
|
|
function i(e, t, i, n) {
|
|
var o, r, c;
|
|
(o = t.data("a8cIris")),
|
|
(r = t.data("wpWpColorPicker")),
|
|
(o._color._alpha = e),
|
|
(c = o._color.toString()),
|
|
t.val(c),
|
|
t.trigger("color_change"),
|
|
r.toggler.css({ "background-color": c }),
|
|
n && a(e, i),
|
|
t.wpColorPicker("color", c);
|
|
}
|
|
function a(e, t) {
|
|
t.slider("value", e), t.find(".ui-slider-handle").text(e.toString());
|
|
}
|
|
(Color.prototype.toString = function (e) {
|
|
if ("no-alpha" == e) return this.toCSS("rgba", "1").replace(/\s+/g, "");
|
|
if (1 > this._alpha)
|
|
return this.toCSS("rgba", this._alpha).replace(/\s+/g, "");
|
|
var t = parseInt(this._color, 10).toString(16);
|
|
if (this.error) return "";
|
|
if (6 > t.length) for (var i = 6 - t.length - 1; 0 <= i; i--) t = "0" + t;
|
|
return "#" + t;
|
|
}),
|
|
(e.fn.alphaColorPicker = function () {
|
|
return this.each(function () {
|
|
var n, o, r, c, d, l, s, u, p, h;
|
|
(n = e(this)).wrap('<div class="alpha-color-picker-wrap"></div>'),
|
|
(r = n.attr("data-palette") || "true"),
|
|
(c = n.attr("data-show-opacity") || "true"),
|
|
(d = n.attr("data-default-color") || ""),
|
|
(l = -1 !== r.indexOf("|") ? r.split("|") : "false" != r),
|
|
"" == (o = n.val().replace(/\s+/g, "")) && (o = d),
|
|
(s = {
|
|
change: function (e, i) {
|
|
var a, o, r;
|
|
(a = n.attr("data-customize-setting-link")),
|
|
(o = n.wpColorPicker("color")),
|
|
d == o && ((r = t(o)), p.find(".ui-slider-handle").text(r)),
|
|
void 0 !== wp.customize &&
|
|
wp.customize(a, function (e) {
|
|
e.set(o);
|
|
}),
|
|
u
|
|
.find(".transparency")
|
|
.css("background-color", i.color.toString("no-alpha")),
|
|
n.trigger("color_change");
|
|
},
|
|
clear: function () {
|
|
var e = n.attr("data-customize-setting-link") || "";
|
|
e &&
|
|
"" !== e &&
|
|
void 0 !== wp.customize &&
|
|
wp.customize(e, function (e) {
|
|
e.set("");
|
|
}),
|
|
n.val(""),
|
|
n.trigger("color_change");
|
|
},
|
|
palettes: l,
|
|
}),
|
|
n.wpColorPicker(s),
|
|
(u = n.parents(".wp-picker-container:first")),
|
|
e(
|
|
'<div class="alpha-color-picker-container"><div class="min-click-zone click-zone"></div><div class="max-click-zone click-zone"></div><div class="alpha-slider"></div><div class="transparency"></div></div>'
|
|
).appendTo(u.find(".wp-picker-holder")),
|
|
(p = u.find(".alpha-slider")),
|
|
(h = {
|
|
create: function (t, i) {
|
|
var a = e(this).slider("value");
|
|
e(this).find(".ui-slider-handle").text(a),
|
|
e(this).siblings(".transparency ").css("background-color", o);
|
|
},
|
|
value: t(o),
|
|
range: "max",
|
|
step: 1,
|
|
min: 0,
|
|
max: 100,
|
|
animate: 300,
|
|
}),
|
|
p.slider(h),
|
|
"true" == c && p.find(".ui-slider-handle").addClass("show-opacity"),
|
|
u.find(".min-click-zone").on("click", function () {
|
|
i(0, n, p, !0);
|
|
}),
|
|
u.find(".max-click-zone").on("click", function () {
|
|
i(100, n, p, !0);
|
|
}),
|
|
u.find(".iris-palette").on("click", function () {
|
|
var i, o;
|
|
a((o = t((i = e(this).css("background-color")))), p),
|
|
100 != o &&
|
|
(i = i.replace(/[^,]+(?=\))/, (o / 100).toFixed(2))),
|
|
n.wpColorPicker("color", i);
|
|
}),
|
|
u.find(".button.wp-picker-default").on("click", function () {
|
|
a(t(d), p);
|
|
}),
|
|
n.on("input", function () {
|
|
a(t(e(this).val()), p);
|
|
}),
|
|
p.slider().on("slide", function (t, a) {
|
|
i(parseFloat(a.value) / 100, n, p, !1),
|
|
e(this).find(".ui-slider-handle").text(a.value);
|
|
});
|
|
});
|
|
});
|
|
})(jQuery),
|
|
(function (e, t) {
|
|
e.controlConstructor["alpha-color"] = e.Control.extend({
|
|
ready: function () {
|
|
t(".alpha-color-control", this.container).alphaColorPicker({
|
|
clear: function (e, t) {},
|
|
});
|
|
},
|
|
});
|
|
})(wp.customize, jQuery),
|
|
(function (e, t) {
|
|
e.controlConstructor["bloglo-repeater"] = e.Control.extend({
|
|
ready: function () {
|
|
var e = this;
|
|
setTimeout(function () {
|
|
e._init();
|
|
}, 2500);
|
|
},
|
|
eval: function (e, i, a) {
|
|
switch (a) {
|
|
case "not_in":
|
|
return (i = i.split(",")), 0 > t.inArray(e, i);
|
|
case "in":
|
|
return (i = i.split(",")), -1 < t.inArray(e, i);
|
|
case "!=":
|
|
return e != i;
|
|
case "<=":
|
|
return e <= i;
|
|
case "<":
|
|
return e < i;
|
|
case ">=":
|
|
return e >= i;
|
|
case ">":
|
|
return e > i;
|
|
case "==":
|
|
case "=":
|
|
return e == i;
|
|
}
|
|
},
|
|
compare: function (e, t, i) {
|
|
var a,
|
|
n = !1;
|
|
switch (t) {
|
|
case "===":
|
|
n = e === i;
|
|
break;
|
|
case ">":
|
|
n = e > i;
|
|
break;
|
|
case "<":
|
|
n = e < i;
|
|
break;
|
|
case "!=":
|
|
n = e != i;
|
|
break;
|
|
case "empty":
|
|
(a = _.clone(e)),
|
|
_.isObject(a) || _.isArray(a)
|
|
? (_.each(a, function (e, t) {
|
|
_.isEmpty(e) && delete a[t];
|
|
}),
|
|
(n = !!_.isEmpty(a)))
|
|
: (n = !(!_.isNull(a) && "" != a));
|
|
break;
|
|
case "not_empty":
|
|
(a = _.clone(e)),
|
|
(_.isObject(a) || _.isArray(a)) &&
|
|
_.each(a, function (e, t) {
|
|
_.isEmpty(e) && delete a[t];
|
|
}),
|
|
(n = !_.isEmpty(a));
|
|
break;
|
|
default:
|
|
n = e == i;
|
|
}
|
|
return n;
|
|
},
|
|
multiple_compare: function (e, t) {
|
|
var i = this,
|
|
a = !0;
|
|
try {
|
|
var n = e[0];
|
|
if (((a = !0), _.isString(n))) {
|
|
a = !1;
|
|
var o,
|
|
r = e[1],
|
|
c = e[2];
|
|
_.isUndefined(t[n]) || ((o = t[n]), (a = i.compare(o, r, c)));
|
|
} else
|
|
_.isArray(n) &&
|
|
((a = !0),
|
|
_.each(e, function (e) {
|
|
var n = e[0],
|
|
o = e[1],
|
|
r = e[2],
|
|
c = t[n];
|
|
_.isUndefined(c) && (c = ""), i.compare(c, o, r) || (a = !1);
|
|
}));
|
|
} catch (e) {
|
|
a = !1;
|
|
}
|
|
return a;
|
|
},
|
|
conditionize: function (e) {
|
|
var i = this;
|
|
if (!e.hasClass("conditionized")) {
|
|
e.addClass("conditionized");
|
|
var a = t(".field--item", e);
|
|
e.on(
|
|
"change condition_check",
|
|
"input, select, textarea",
|
|
function (n) {
|
|
var o = t(".form", e),
|
|
r = t("input, textarea, select", o).serialize();
|
|
r = jQuery.deparam(r);
|
|
var c = {};
|
|
_.isObject(r) &&
|
|
_.each(r._items, function (e) {
|
|
c = e;
|
|
}),
|
|
a.each(function () {
|
|
var e = t(this),
|
|
a = e.attr("data-cond") || !1;
|
|
!_.isUndefined(a) &&
|
|
a &&
|
|
((a = JSON.parse(a)),
|
|
i.multiple_compare(a, c)
|
|
? e
|
|
.slideDown()
|
|
.removeClass("cond-hide")
|
|
.addClass("cond-show")
|
|
: e
|
|
.hide()
|
|
.addClass("cond-hide")
|
|
.removeClass("cond-show"));
|
|
});
|
|
}
|
|
),
|
|
t("input, select, textarea", e).eq(0).trigger("condition_check");
|
|
}
|
|
},
|
|
remove_editor: function (e) {},
|
|
editor: function (e) {},
|
|
_init: function () {
|
|
var e,
|
|
i = this,
|
|
a = i.params.fields;
|
|
try {
|
|
e =
|
|
"string" == typeof i.params.value
|
|
? JSON.parse(i.params.value)
|
|
: i.params.value;
|
|
} catch (t) {
|
|
e = {};
|
|
}
|
|
var n,
|
|
o = 0,
|
|
r = i.params.limited_msg || "";
|
|
isNaN(parseInt(i.params.max_item)) || (o = parseInt(i.params.max_item)),
|
|
i.params.changeable,
|
|
i.container.on(
|
|
"click",
|
|
".widget .widget-action, .widget .repeat-control-close, .widget-title",
|
|
function (e) {
|
|
e.preventDefault();
|
|
var i = t(this).closest(".widget");
|
|
i.hasClass("explained")
|
|
? t(".widget-inside", i).slideUp(200, "linear", function () {
|
|
t(".widget-inside", i).removeClass("show").addClass("hide"),
|
|
i.removeClass("explained");
|
|
})
|
|
: t(".widget-inside", i).slideDown(200, "linear", function () {
|
|
t(".widget-inside", i).removeClass("hide").addClass("show"),
|
|
i.addClass("explained");
|
|
});
|
|
}
|
|
),
|
|
i.container.on("click", ".repeat-control-remove", function (e) {
|
|
e.preventDefault();
|
|
var a = t(this).closest(".repeatable-customize-control");
|
|
t("body").trigger("repeat-control-remove-item", [a]),
|
|
i.remove_editor(a),
|
|
a.remove(),
|
|
i.rename(),
|
|
i.updateValue(),
|
|
i._check_max_item();
|
|
}),
|
|
(i.getData = function () {
|
|
var e = t(".form-data", i.container),
|
|
a = t("input, textarea, select", e).serialize();
|
|
return JSON.stringify(a);
|
|
}),
|
|
(i.updateValue = function () {
|
|
var e = i.getData();
|
|
i.setting.set(e);
|
|
}),
|
|
(i.update_value = function () {
|
|
var e,
|
|
i = {};
|
|
this.container.find("[data-option]").each(function () {
|
|
(e = t(this).data("option")),
|
|
(i[e] =
|
|
"background-size" === e || "background-attachment" === e
|
|
? t(this).is(":checked")
|
|
? t(this).val()
|
|
: i[e]
|
|
: t(this).val());
|
|
}),
|
|
this.setting.set(i);
|
|
}),
|
|
(i.rename = function () {
|
|
t(".list-repeatable li", i.container).each(function (e) {
|
|
var i = t(this);
|
|
t("input, textarea, select", i).each(function () {
|
|
var i = t(this),
|
|
a = i.attr("data-repeat-name") || void 0;
|
|
void 0 !== a &&
|
|
((a = a.replace(/__i__/g, e)), i.attr("name", a));
|
|
});
|
|
});
|
|
}),
|
|
(i.autocorrect_range_input_number = function (e, t) {
|
|
var a = e,
|
|
n = a.parent().find('input[type="range"]'),
|
|
o = parseFloat(a.val()),
|
|
r = parseFloat(
|
|
n.find(".bloglo-reset-range").attr("data-reset_value")
|
|
),
|
|
c = parseFloat(a.attr("step")),
|
|
d = parseFloat(a.attr("min")),
|
|
l = parseFloat(a.attr("max"));
|
|
clearTimeout(t),
|
|
(t = setTimeout(function () {
|
|
if (isNaN(o)) return a.val(r), void n.val(r).trigger("change");
|
|
1 <= c &&
|
|
0 != o % 1 &&
|
|
((o = Math.round(o)), a.val(o), n.val(o).trigger("change")),
|
|
o > l && (a.val(l), n.val(l).trigger("change")),
|
|
o < d && (a.val(d), n.val(d).trigger("change"));
|
|
}, t)),
|
|
n.val(o).trigger("change"),
|
|
i.updateValue();
|
|
}),
|
|
window._upload_bloglo ||
|
|
(window._upload_bloglo = wp.media({
|
|
title: wp.media.view.l10n.addMedia,
|
|
multiple: !1,
|
|
})),
|
|
window._upload_bloglo.on("close", function () {
|
|
window._upload_bloglo.state().get("selection");
|
|
}),
|
|
(window.media_current = {}),
|
|
(window.media_btn = {}),
|
|
window._upload_bloglo.on("select", function () {
|
|
var e,
|
|
i,
|
|
a = window._upload_bloglo
|
|
.state()
|
|
.get("selection")
|
|
.first()
|
|
.toJSON();
|
|
t(".image_id", window.media_current).val(a.id),
|
|
(i = a.url),
|
|
t(".current", window.media_current)
|
|
.removeClass("hide")
|
|
.addClass("show"),
|
|
t(".image_url", window.media_current).val(i),
|
|
"image" == a.type &&
|
|
((e = '<img src="' + i + '" alt="">'),
|
|
t(".thumbnail-image", window.media_current).html(e)),
|
|
t(".remove-button", window.media_current).show(),
|
|
t(".image_id", window.media_current).trigger("change");
|
|
try {
|
|
window.media_btn.text(window.media_btn.attr("data-change-txt"));
|
|
} catch (e) {}
|
|
}),
|
|
(i.handleMedia = function (e) {
|
|
t(".item-media", e).each(function () {
|
|
var e = t(this);
|
|
t(".remove-button", e).on("click", function (i) {
|
|
i.preventDefault(),
|
|
t(".image_id, .image_url", e).val(""),
|
|
t(".thumbnail-image", e).html(""),
|
|
t(".current", e).removeClass("show").addClass("hide"),
|
|
t(this).hide(),
|
|
t(".upload-button", e).text(
|
|
t(".upload-button", e).attr("data-add-txt")
|
|
),
|
|
t(".image_id", e).trigger("change");
|
|
}),
|
|
t(".upload-button, .attachment-media-view", e).on(
|
|
"click",
|
|
function (i) {
|
|
i.preventDefault(),
|
|
(window.media_current = e),
|
|
(window.media_btn = t(this)),
|
|
window._upload_bloglo.open();
|
|
}
|
|
);
|
|
});
|
|
}),
|
|
(i.handleGradient = function (e) {
|
|
var i = this,
|
|
a = i.setting.get();
|
|
i.container.find(".popup-content");
|
|
t(".item-gradient", e).each(function () {
|
|
var e = t(this);
|
|
e.find(".bloglo-range-wrapper").each(function () {
|
|
var e = t(this);
|
|
e.rangeControl({
|
|
id: i.params.id + "-" + e.data("option-id"),
|
|
option: e.data("option-id"),
|
|
value: a[e.data("options-id")],
|
|
responsive: i.params.responsive,
|
|
change: function () {
|
|
i.update_value();
|
|
},
|
|
}),
|
|
e
|
|
.find("input.bloglo-range-input")
|
|
.on("change keyup", function () {
|
|
i.autocorrect_range_input_number(t(this), 1e3, void 0);
|
|
})
|
|
.on("focusout", function () {
|
|
i.autocorrect_range_input_number(t(this), 0, void 0);
|
|
});
|
|
}),
|
|
e.on(
|
|
"change",
|
|
'[data-option="background-type"], [data-option="gradient-type"]',
|
|
function () {
|
|
var i = t(this).attr("data-option");
|
|
e.find('[data-dep-field="' + i + '"]').hide(),
|
|
e
|
|
.find(
|
|
'[data-dep-field="' +
|
|
i +
|
|
'"][data-dep-value="' +
|
|
t(this).val() +
|
|
'"]'
|
|
)
|
|
.show();
|
|
}
|
|
),
|
|
e
|
|
.find(
|
|
'[data-option="background-type"], [data-option="gradient-type"]'
|
|
)
|
|
.trigger("change"),
|
|
e.on("change", ".bloglo-select-wrapper", function () {
|
|
i.update_value();
|
|
});
|
|
});
|
|
}),
|
|
(i.handleBackground = function (e) {
|
|
var i = this,
|
|
a = i.setting.get(),
|
|
n = i.container.find(".popup-content");
|
|
t(".item-design-options", e).each(function () {
|
|
var e = t(this);
|
|
e.find(".bloglo-range-wrapper").each(function () {
|
|
var e = t(this);
|
|
e.rangeControl({
|
|
id: i.params.id + "-" + e.data("option-id"),
|
|
option: e.data("option-id"),
|
|
value: a[e.data("options-id")],
|
|
responsive: i.params.responsive,
|
|
change: function () {
|
|
i.update_value();
|
|
},
|
|
}),
|
|
e
|
|
.find("input.bloglo-range-input")
|
|
.on("change keyup", function () {
|
|
i.autocorrect_range_input_number(t(this), 1e3, void 0);
|
|
})
|
|
.on("focusout", function () {
|
|
i.autocorrect_range_input_number(t(this), 0, void 0);
|
|
});
|
|
}),
|
|
e.on(
|
|
"change",
|
|
'[data-option="background-type"], [data-option="gradient-type"]',
|
|
function () {
|
|
var i = t(this).attr("data-option");
|
|
e.find('[data-dep-field="' + i + '"]').hide(),
|
|
e
|
|
.find(
|
|
'[data-dep-field="' +
|
|
i +
|
|
'"][data-dep-value="' +
|
|
t(this).val() +
|
|
'"]'
|
|
)
|
|
.show();
|
|
}
|
|
),
|
|
e
|
|
.find(
|
|
'[data-option="background-type"], [data-option="gradient-type"]'
|
|
)
|
|
.trigger("change"),
|
|
e.on("change", ".bloglo-select-wrapper", function () {
|
|
i.update_value();
|
|
}),
|
|
e.find(".popup-link").on("click", function () {
|
|
n.toggleClass("hidden"),
|
|
t(this).toggleClass("active"),
|
|
t(this).siblings(".reset-defaults").toggleClass("active"),
|
|
t("body").on("click", o);
|
|
});
|
|
var o = function (i) {
|
|
t(i.target).closest(".customize-save-button-wrapper").length ||
|
|
e.has(t(i.target).closest(".popup-link")).length ||
|
|
e.has(t(i.target).closest(".popup-content")).length ||
|
|
n.hasClass("hidden") ||
|
|
t(i.target).closest(".reset-defaults").length ||
|
|
(n.addClass("hidden"),
|
|
e.find(".popup-link").removeClass("active"),
|
|
e.find(".reset-defaults").removeClass("active"),
|
|
t("body").off("click", o));
|
|
};
|
|
e.find(".background-image-advanced").hide(),
|
|
e.on("change", ".background-repeat select", function () {
|
|
i.update_value();
|
|
}),
|
|
e.on("change click", ".background-size input", function () {
|
|
i.update_value();
|
|
}),
|
|
e.on(
|
|
"change click",
|
|
".background-attachment input",
|
|
function () {
|
|
i.update_value();
|
|
}
|
|
),
|
|
e.on("click", ".background-image-upload-button", function (a) {
|
|
t("body").off("click", o);
|
|
var n = wp
|
|
.media({
|
|
multiple: !1,
|
|
title: i.params.l10n.image.select_image,
|
|
button: { text: i.params.l10n.image.use_image },
|
|
})
|
|
.open()
|
|
.on("select", function () {
|
|
var a,
|
|
r,
|
|
c,
|
|
d,
|
|
l,
|
|
s = n.state().get("selection").first().toJSON();
|
|
(a = _.isUndefined(s.sizes)
|
|
? s.url
|
|
: _.isUndefined(s.sizes.medium)
|
|
? _.isUndefined(s.sizes.thumbnail)
|
|
? _.isUndefined(s.sizes.full)
|
|
? s.url
|
|
: s.sizes.full.url
|
|
: s.sizes.thumbnail.url
|
|
: s.sizes.medium.url),
|
|
(r = s.url),
|
|
(c = s.id),
|
|
s.width,
|
|
s.height,
|
|
"" !== r &&
|
|
(e.find(".background-image-advanced").show(),
|
|
e
|
|
.find(".advanced-settings")
|
|
.removeClass("hidden")
|
|
.addClass("up")),
|
|
e.find('[data-option="background-image"]').val(r),
|
|
e.find('[data-option="background-image-id"]').val(c),
|
|
i.update_value(),
|
|
(d = e.find(".placeholder, .thumbnail")),
|
|
(l = e.find(".background-image-upload-remove-button")),
|
|
d.length &&
|
|
d
|
|
.removeClass()
|
|
.addClass("thumbnail thumbnail-image")
|
|
.html('<img src="' + a + '" alt="" />'),
|
|
l.length && l.show(),
|
|
setTimeout(function () {
|
|
t("body").on("click", o);
|
|
}, 100);
|
|
});
|
|
a.preventDefault();
|
|
}),
|
|
e.on(
|
|
"click",
|
|
".background-image-upload-remove-button",
|
|
function (t) {
|
|
var a, n;
|
|
t.preventDefault(),
|
|
e.find('[data-option="background-image"]').val(""),
|
|
e.find('[data-option="background-image-id"]').val(""),
|
|
i.update_value(),
|
|
(a = e.find(".placeholder, .thumbnail")),
|
|
(n = e.find(".background-image-upload-remove-button")),
|
|
e.find(".background-image-advanced").hide(),
|
|
e
|
|
.find(".advanced-settings")
|
|
.addClass("hidden")
|
|
.removeClass("up"),
|
|
a.length &&
|
|
a
|
|
.removeClass()
|
|
.addClass("placeholder")
|
|
.html(i.params.l10n.image.placeholder),
|
|
n.length && n.hide();
|
|
}
|
|
),
|
|
e.on("click", ".advanced-settings", function (i) {
|
|
t(this).toggleClass("up"),
|
|
e.find(".background-image-advanced").toggle();
|
|
}),
|
|
e.on("click", ".bloglo-spacing-linked", function () {
|
|
var e = t(this);
|
|
e.closest("ul").find(".spacing-input").removeClass("linked"),
|
|
e.parent(".spacing-link-values").removeClass("unlinked");
|
|
}),
|
|
e.on("click", ".bloglo-spacing-unlinked", function () {
|
|
var e = t(this);
|
|
e.closest("ul").find(".spacing-input").addClass("linked"),
|
|
e.parent(".spacing-link-values").addClass("unlinked");
|
|
}),
|
|
e.on("input", ".linked input", function () {
|
|
var e = t(this).val();
|
|
t(this)
|
|
.closest(".spacing-input")
|
|
.siblings(".linked")
|
|
.find("input")
|
|
.val(e)
|
|
.change();
|
|
}),
|
|
e.on("change input", ".spacing-input input", function () {
|
|
i.update_value();
|
|
}),
|
|
e.find(".reset-defaults").on("click", function () {
|
|
var a, n;
|
|
e.find("[data-option]").each(function () {
|
|
(a = t(this)),
|
|
"background-size" === (n = a.data("option")) ||
|
|
"background-attachment" === n
|
|
? (a.prop("checked", !1),
|
|
n in i.params.default &&
|
|
i.params.default[n] === a.val() &&
|
|
a.prop("checked", !0))
|
|
: a
|
|
.val(i.params.default[a.data("option")])
|
|
.trigger("change");
|
|
}),
|
|
e.find(".background-image-upload-remove-button").click(),
|
|
i.update_value();
|
|
});
|
|
});
|
|
}),
|
|
(i.colorPicker = function (e) {
|
|
t(".c-color", e).wpColorPicker({
|
|
change: function (e, t) {
|
|
i.updateValue();
|
|
},
|
|
clear: function (e, t) {
|
|
i.updateValue();
|
|
},
|
|
}),
|
|
t(".c-coloralpha", e).each(function () {
|
|
var e = t(this),
|
|
a = e.val();
|
|
e.removeAttr("value"),
|
|
e.prop("value", a),
|
|
e.alphaColorPicker({
|
|
change: function (e, t) {
|
|
i.updateValue();
|
|
},
|
|
clear: function (e, t) {
|
|
i.updateValue();
|
|
},
|
|
});
|
|
});
|
|
}),
|
|
(i.actions = function (e) {
|
|
if (i.params.live_title_id) {
|
|
e.attr("data-title-format") ||
|
|
e.attr("data-title-format", i.params.title_format);
|
|
var a = e.attr("data-title-format") || "";
|
|
if (
|
|
("bloglo_section_order_styling" === i.id &&
|
|
"click" !== e.find("input.add_by").val() &&
|
|
(a = "[live_title]"),
|
|
i.params.live_title_id &&
|
|
0 <
|
|
t("[data-live-id='" + i.params.live_title_id + "']", e)
|
|
.length)
|
|
) {
|
|
var n = "";
|
|
"" ==
|
|
(n = t(
|
|
"[data-live-id='" + i.params.live_title_id + "']",
|
|
e
|
|
).is(".select-one")
|
|
? t("[data-live-id='" + i.params.live_title_id + "']", e)
|
|
.find("option:selected")
|
|
.eq(0)
|
|
.text()
|
|
: t("[data-live-id='" + i.params.live_title_id + "']", e)
|
|
.eq(0)
|
|
.val()) && (n = i.params.default_empty_title),
|
|
"" !== a && (n = a.replace("[live_title]", n)),
|
|
t(".widget-title .live-title", e).text(n),
|
|
e.on(
|
|
"keyup change",
|
|
"[data-live-id='" + i.params.live_title_id + "']",
|
|
function () {
|
|
var a = "",
|
|
n = e.attr("data-title-format") || "";
|
|
"bloglo_section_order_styling" === i.id &&
|
|
"click" !== e.find("input.add_by").val() &&
|
|
(n = "[live_title]"),
|
|
"" ==
|
|
(a = t(this).is(".select-one")
|
|
? t(this).find("option:selected").eq(0).text()
|
|
: t(this).val()) &&
|
|
(a = i.params.default_empty_title),
|
|
"" !== n && (a = n.replace("[live_title]", a)),
|
|
t(".widget-title .live-title", e).text(a);
|
|
}
|
|
);
|
|
}
|
|
}
|
|
}),
|
|
(i._check_max_item = function () {
|
|
if (
|
|
t(
|
|
".list-repeatable > li.repeatable-customize-control",
|
|
i.container
|
|
).length >= o
|
|
)
|
|
if (
|
|
(t(".repeatable-actions", i.container).hide(),
|
|
0 >= t(".limited-msg", i.container).length)
|
|
) {
|
|
if ("" !== r) {
|
|
var e = t('<p class="limited-msg"/>');
|
|
e.html(r),
|
|
e.insertAfter(t(".repeatable-actions", i.container)),
|
|
e.show();
|
|
}
|
|
} else t(".limited-msg", i.container).show();
|
|
else
|
|
t(".repeatable-actions", i.container).show(),
|
|
t(".limited-msg", i.container).hide();
|
|
}),
|
|
(i.repeaterTemplate = _.memoize(function () {
|
|
var e = {
|
|
evaluate: /<#([\s\S]+?)#>/g,
|
|
interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
|
|
escape: /\{\{([^\}]+?)\}\}(?!\})/g,
|
|
variable: "data",
|
|
};
|
|
return function (i) {
|
|
return (
|
|
void 0 === window.repeater_item_tpl &&
|
|
(window.repeater_item_tpl = t(
|
|
"#repeatable-js-item-tpl"
|
|
).html()),
|
|
_.template(window.repeater_item_tpl, null, e)(i)
|
|
);
|
|
};
|
|
})),
|
|
(i.template = i.repeaterTemplate()),
|
|
(i.intItem = function (e) {
|
|
i.rename(),
|
|
i.conditionize(e),
|
|
i.colorPicker(e),
|
|
i.handleMedia(e),
|
|
i.handleGradient(e),
|
|
i.handleBackground(e),
|
|
t('[data-live-id="section_id"]', e).each(function () {
|
|
t(this)
|
|
.closest(".repeatable-customize-control")
|
|
.addClass("section-" + t(this).val()),
|
|
"map" === t(this).val() &&
|
|
e.addClass("show-display-field-only");
|
|
}),
|
|
"bloglo_section_order_styling" === i.id &&
|
|
("click" !== e.find("input.add_by").val()
|
|
? (e.addClass("no-changeable"),
|
|
t(".item-editor textarea", e).remove())
|
|
: (e.find(".item-title").removeClass("item-hidden "),
|
|
e
|
|
.find('.item-title input[type="hidden"]')
|
|
.attr("type", "text"),
|
|
e.find(".item-section_id").removeClass("item-hidden "),
|
|
e
|
|
.find('.item-section_id input[type="hidden"]')
|
|
.attr("type", "text"))),
|
|
t(".item-editor textarea", e).each(function () {
|
|
i.editor(t(this));
|
|
}),
|
|
t("body").trigger("repeater-control-init-item", [e]);
|
|
}),
|
|
t(".list-repeatable", i.container).sortable({
|
|
handle: ".widget-title",
|
|
containment: i.container,
|
|
update: function (e, t) {
|
|
i.rename(), i.updateValue();
|
|
},
|
|
}),
|
|
(n = t.extend(!0, {}, i.params.fields)),
|
|
t.each(e, function (a, o) {
|
|
if ((o = e[a]))
|
|
for (var r in o)
|
|
n.hasOwnProperty(r) &&
|
|
o.hasOwnProperty(r) &&
|
|
(n[r].value = o[r]);
|
|
var c = t(i.template(n));
|
|
t(".list-repeatable", i.container).append(c),
|
|
i.intItem(c),
|
|
i.actions(c);
|
|
}),
|
|
i.container.on("click", ".add-new-repeat-item", function () {
|
|
var e = t(i.template(a));
|
|
t(".list-repeatable", i.container).append(e),
|
|
"" !== i.params.id_key &&
|
|
e
|
|
.find(".item-" + i.params.id_key)
|
|
.find("input")
|
|
.val("sid" + new Date().getTime()),
|
|
e.find("input.add_by").val("click"),
|
|
i.intItem(e),
|
|
i.actions(e),
|
|
i.updateValue(),
|
|
i._check_max_item();
|
|
}),
|
|
t(".list-repeatable", i.container).on(
|
|
"keyup change color_change",
|
|
"input, select, textarea",
|
|
function (e) {
|
|
i.updateValue();
|
|
}
|
|
),
|
|
i._check_max_item();
|
|
},
|
|
});
|
|
})(wp.customize, jQuery),
|
|
jQuery(document).ready(function (e) {
|
|
window.editing_icon = !1;
|
|
var t = e(
|
|
'<div class="c-icon-picker"><div class="c-icon-type-wrap"><select class="c-icon-type"></select></div><div class="c-icon-search"><input class="" type="text"></div><div class="c-icon-list"></div></div>'
|
|
),
|
|
i = "",
|
|
a = "";
|
|
e.each(Bloglo_Icon_Picker.fonts, function (t, n) {
|
|
(n = e.extend({}, { url: "", name: "", prefix: "", icons: "" }, n)),
|
|
e("<link>")
|
|
.appendTo("head")
|
|
.attr({ type: "text/css", rel: "stylesheet" })
|
|
.attr("id", "customizer-icon-" + t)
|
|
.attr("href", n.url),
|
|
(i += '<option value="' + t + '">' + n.name + "</option>");
|
|
var o = n.icons.split("|");
|
|
(a +=
|
|
'<div class="ic-icons-group" style="display: none;" data-group-name="' +
|
|
t +
|
|
'">'),
|
|
e.each(o, function (e, t) {
|
|
n.prefix && (t = n.prefix + " " + t),
|
|
(a +=
|
|
'<span title="' +
|
|
t +
|
|
'" data-name="' +
|
|
t +
|
|
'"><i class="' +
|
|
t +
|
|
'"></i></span>');
|
|
}),
|
|
(a += "</div>");
|
|
}),
|
|
t
|
|
.find(".c-icon-search input")
|
|
.attr("placeholder", Bloglo_Icon_Picker.search),
|
|
t.find(".c-icon-type").html(i),
|
|
t.find(".c-icon-list").append(a),
|
|
e(".wp-full-overlay").append(t),
|
|
e("body").on("change", "select.c-icon-type", function () {
|
|
var i = e(this).val();
|
|
t.find(".ic-icons-group").hide(),
|
|
t.find('.ic-icons-group[data-group-name="' + i + '"]').show();
|
|
}),
|
|
t.find("select.c-icon-type").trigger("change"),
|
|
e("body").on("keyup", ".c-icon-search input", function () {
|
|
var t = e(this).val();
|
|
if ("" == t) e(".c-icon-list span").show();
|
|
else {
|
|
e(".c-icon-list span").hide();
|
|
try {
|
|
e('.c-icon-list span[data-name*="' + t + '"]').show();
|
|
} catch (e) {}
|
|
}
|
|
}),
|
|
e("body").on("click", ".icon-wrapper", function (i) {
|
|
i.preventDefault();
|
|
var a = e(this);
|
|
(window.editing_icon = a),
|
|
t.addClass("ic-active"),
|
|
e("body").find(".icon-wrapper").removeClass("icon-editing"),
|
|
a.addClass("icon-editing");
|
|
}),
|
|
e("body").on("click", ".item-icon .remove-icon", function (t) {
|
|
t.preventDefault();
|
|
var i = e(this).closest(".item-icon");
|
|
i.find(".icon-wrapper input").val(""),
|
|
i.find(".icon-wrapper input").trigger("change"),
|
|
i.find(".icon-wrapper i").attr("class", ""),
|
|
e("body").find(".icon-wrapper").removeClass("icon-editing");
|
|
}),
|
|
e("body").on("click", ".c-icon-list span", function (i) {
|
|
i.preventDefault();
|
|
var a = e(this).attr("data-name") || "";
|
|
window.editing_icon &&
|
|
(window.editing_icon
|
|
.find("i")
|
|
.attr("class", "")
|
|
.addClass(e(this).find("i").attr("class")),
|
|
window.editing_icon.find("input").val(a).trigger("change")),
|
|
t.removeClass("ic-active"),
|
|
(window.editing_icon = !1),
|
|
e("body").find(".icon-wrapper").removeClass("icon-editing");
|
|
}),
|
|
e(document).mouseup(function (e) {
|
|
window.editing_icon &&
|
|
(window.editing_icon.is(e.target) ||
|
|
0 !== window.editing_icon.has(e.target).length ||
|
|
t.is(e.target) ||
|
|
0 !== t.has(e.target).length ||
|
|
t.removeClass("ic-active"));
|
|
});
|
|
});
|