File: /www/wwwroot/www.scdc-marine.com/wp-content/plugins/Heku-Admin-Page/js/heku-setting copy.js
function(e, t, n) {
"use strict";
n.d(t, "a", (function() {
return r
}));
n(45);
function i(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var r = function() {
function e(t, n) { !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.name = n,
this.element = t,
this.init()
}
var t, n, r;
return t = e,
(n = [{
key: "getInput",
value: function() {
return this.element.querySelector("input")
}
},
{
key: "init",
value: function() {
var e = this,
t = this.getInput();
t && t.addEventListener("change", (function() {
e.persist()
}))
}
},
{
key: "persist",
value: function() {
return jQuery.ajax({
url: ajaxurl,
method: "POST",
data: {
action: "ac_admin_screen_options",
option_name: this.name,
option_value: this.getInput().checked ? 1 : 0,
_ajax_nonce: AC._ajax_nonce
}
})
}
}]) && i(t.prototype, n),
r && i(t, r),
e
} ()
},
function(e, t, n) {
"use strict";
n(45),
n(30),
n(23),
n(36),
n(44),
n(4),
n(57);
function i(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var r = "closed",
o = "open",
a = function() {
function e(t) { !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.$el = t,
this.el = t[0],
this.settings = [],
this.state = r,
this._type = this.$el.data("type")
}
var t, n, a;
return t = e,
(n = [{
key: "isOriginal",
value: function() {
return 1 === this.$el.data("original")
}
},
{
key: "isDisabled",
value: function() {
return this.$el.hasClass("disabled")
}
},
{
key: "disable",
value: function() {
return this.$el.addClass("disabled"),
this
}
},
{
key: "enable",
value: function() {
return this.$el.removeClass("disabled"),
this
}
},
{
key: "initNewInstance",
value: function() {
var e = "_new_column_" + AC.Column.getNewIncementalName(),
t = this.name;
return this.$el.find("input, select, label").each((function(n, i) {
var r = jQuery(i);
r.attr("name") && r.attr("name", r.attr("name").replace("columns[".concat(t, "]"), "columns[".concat(e, "]"))),
r.attr("id") && r.attr("id", r.attr("id").replace("-".concat(t, "-"), "-".concat(e, "-")))
})),
this.name = e,
AC.incremental_column_name++,
this
}
},
{
key: "bindEvents",
value: function() {
var e = this;
return e.$el.data("column", e),
Object.keys(AC.Column.events).forEach((function(t) {
e.isBound(t) || (AC.Column.events[t](e), e.bind(t))
})),
this.bindSettings(),
jQuery(document).trigger("AC_Column_InitSettings", [e]),
this
}
},
{
key: "bindSettings",
value: function() {
var e = this;
Object.keys(AC.Column.settings).forEach((function(t) {
e.isBound(t) || (AC.Column.settings[t](e), e.bind(t))
}))
}
},
{
key: "isBound",
value: function(e) {
return this.$el.data(e)
}
},
{
key: "bind",
value: function(e) {
this.$el.data(e, !0)
}
},
{
key: "destroy",
value: function() {
this.$el.remove()
}
},
{
key: "remove",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 350,
t = this;
this.$el.addClass("deleting").animate({
opacity: 0,
height: 0
},
e, (function() {
t.destroy()
}))
}
},
{
key: "getState",
value: function() {
return this.state
}
},
{
key: "toggle",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 150;
this.getState() === o ? this.close(e) : this.open(e)
}
},
{
key: "close",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
this.$el.removeClass("opened").find(".ac-column-body").slideUp(e),
this.state = r
}
},
{
key: "open",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
this.$el.addClass("opened").find(".ac-column-body").slideDown(e),
this.state = o
}
},
{
key: "showMessage",
value: function(e) {
this.$el.find(".ac-column-setting--type .msg").html(e).show()
}
},
{
key: "switchToType",
value: function(e) {
var t = this;
return jQuery.ajax({
url: ajaxurl,
method: "post",
dataType: "json",
data: {
action: "ac-columns",
id: "select",
type: e,
data: AC.Form.serialize(),
current_original_columns: AC.Form.originalColumns(),
original_columns: AC.original_columns,
_ajax_nonce: AC._ajax_nonce
},
success: function(n) {
if (!0 === n.success) {
var i = jQuery(n.data);
t.$el.replaceWith(i),
t.$el = i,
t.el = i[0],
t._type = e,
t.initNewInstance(),
t.bindEvents(),
t.open(),
jQuery(document).trigger("AC_Column_Change", [t])
} else t.showMessage(n.data.error)
}
})
}
},
{
key: "refresh",
value: function() {
var e = this,
t = this.$el.find(":input").serializeArray(),
n = {
action: "ac-columns",
id: "refresh",
_ajax_nonce: AC._ajax_nonce,
data: AC.Form.serialize(),
column_name: this.name,
original_columns: AC.original_columns
};
return jQuery.each(n, (function(e, n) {
t.push({
name: e,
value: n
})
})),
jQuery.ajax({
type: "post",
url: ajaxurl,
data: t,
success: function(t) {
if (!0 === t.success) {
var n = jQuery(t.data);
e.$el.replaceWith(n),
e.$el = n,
e.el = n[0],
e.bindEvents(),
e.getState() === o && e.open(),
jQuery(document).trigger("AC_Column_Refresh", [e])
}
}
})
}
},
{
key: "create",
value: function() {
return this.initNewInstance(),
this.bindEvents(),
jQuery(document).trigger("AC_Column_Created", [this]),
this
}
},
{
key: "clone",
value: function() {
var t = this.$el.clone();
t.data("column-name", this.$el.data("column-name"));
var n = new e(t);
return n.initNewInstance(),
n.bindEvents(),
n
}
},
{
key: "name",
get: function() {
return this.$el.data("column-name")
},
set: function(e) {
this.$el.data("column-name", e)
}
},
{
key: "type",
get: function() {
return this._type
},
set: function(e) {
this.$el.data("type", e)
}
}]) && i(t.prototype, n),
a && i(t, a),
e
} ();
function s(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var u = function() {
function e(t) { !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.form = t,
this.$form = jQuery(t),
this.$column_container = this.$form.find(".ac-columns"),
this.$container = jQuery("#cpac .ac-admin"),
this.columns = {},
this._validators = [],
jQuery(document).trigger("AC_Form_Loaded"),
this.init()
}
var t, n, i;
return t = e,
(n = [{
key: "init",
value: function() {
this.initColumns(),
this.bindFormEvents(),
this.bindOrdering(),
this.$form.hasClass("-disabled") && this.disableFields(),
jQuery(document).trigger("AC_Form_Ready", this)
}
},
{
key: "bindOrdering",
value: function() {
this.$form.hasClass("ui-sortable") ? this.$form.sortable("refresh") : this.$form.sortable({
items: ".ac-column",
handle: ".column_sort"
})
}
},
{
key: "originalColumns",
value: function() {
var e = this,
t = [];
return Object.keys(e.columns).forEach((function(n) {
var i = e.columns[n];
i.isOriginal() && t.push(i.type)
})),
t
}
},
{
key: "validateForm",
value: function() {
var e = this,
t = !0;
return this._validators.forEach((function(n) {
t = n.call(e, e)
})),
t
}
},
{
key: "addValidator",
value: function(e) {
this._validators.push(e)
}
},
{
key: "bindFormEvents",
value: function() {
var e = this,
t = jQuery(".sidebox a.submit, .column-footer a.submit");
t.on("click", (function() {
e.validateForm() && (t.attr("disabled", "disabled"), e.$container.addClass("saving"), e.submitForm().always((function() {
t.removeAttr("disabled", "disabled"),
e.$container.removeClass("saving")
})))
})),
e.$container.find(".add_column").on("click", (function() {
e.addColumn()
}));
var n = jQuery("#cpac .ac-boxes");
n.hasClass("disabled") && n.find(".ac-column").each((function(e, t) {
jQuery(t).data("column").disable(),
jQuery(t).find("input, select").prop("disabled", !0)
})),
jQuery("a[data-clear-columns]").on("click", (function() {
e.resetColumns()
}))
}
},
{
key: "initColumns",
value: function() {
var e = this;
e.columns = {},
this.$form.find(".ac-column").each((function() {
var t = jQuery(this),
n = new a(t);
n.bindEvents(),
t.data("column", n),
e.columns[n.name] = n
}))
}
},
{
key: "reindexColumns",
value: function() {
var e = this;
e.columns = {},
this.$form.find(".ac-column").each((function() {
var t = jQuery(this).data("column");
e.columns[t.name] = t
}))
}
},
{
key: "resetColumns",
value: function() {
var e = this;
Object.keys(this.columns).forEach((function(t) {
e.columns[t].destroy()
}))
}
},
{
key: "serialize",
value: function() {
return this.$form.serialize()
}
},
{
key: "disableFields",
value: function() {
var e = document.querySelector(this.form);
if (e) for (var t = e.elements,
n = 0; n < t.length; n++) t[n].readOnly = !0,
t[n].setAttribute("disabled", !0)
}
},
{
key: "enableFields",
value: function() {}
},
{
key: "submitForm",
value: function() {
var e = this,
t = jQuery.post(ajaxurl, {
action: "ac-columns",
id: "save",
_ajax_nonce: AC._ajax_nonce,
data: this.serialize()
},
(function(t) {
t && (t.success ? (e.showMessage(t.data, "updated"), e.$container.addClass("stored")) : t.data && e.showMessage(t.data.message, "notice notice-warning"))
}), "json");
return t.fail((function(t) {
e.showMessage(AC.i18n.errors.save_settings, "notice notice-warning")
})),
jQuery(document).trigger("AC_Form_AfterUpdate", [e.$container]),
t
}
},
{
key: "showMessage",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "updated",
n = jQuery('<div class="ac-message hidden ' + t + '"><p>' + e + "</p></div>");
this.$container.find(".ac-message").stop().remove(),
this.$container.find(".ac-admin__main").prepend(n),
n.slideDown()
}
},
{
key: "cloneColumn",
value: function(e) {
return this._addColumnToForm(new a(e).clone(), e.hasClass("opened"), e)
}
},
{
key: "addColumn",
value: function() {
var e = jQuery("#add-new-column-template").find(".ac-column").clone(),
t = new a(e).create();
return this._addColumnToForm(t)
}
},
{
key: "removeColumn",
value: function(e) {
this.columns[e] && (this.columns[e].remove(), delete this.columns[e])
}
},
{
key: "getListScreen",
value: function() {
return this.$form.find('input[name="list_screen"]').val()
}
},
{
key: "getListScreenID",
value: function() {
return this.$form.find('input[name="list_screen_id"]').val()
}
},
{
key: "getTitle",
value: function() {
return this.$form.find('input[name="title"]').val()
}
},
{
key: "getColumnSettings",
value: function() {
return this.$form.find('[name^="columns["]').serialize()
}
},
{
key: "_addColumnToForm",
value: function(e) {
var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1],
n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
return this.columns[e.name] = e,
n ? e.$el.insertAfter(n) : this.$column_container.append(e.$el),
t && e.open(),
e.$el.hide().slideDown(),
jQuery(document).trigger("AC_Column_Added", [e]),
c(e.$el) || jQuery("html, body").animate({
scrollTop: e.$el.offset().top - 58
},
300),
e
}
}]) && s(t.prototype, n),
i && s(t, i),
e
} (),
c = (t.a = u,
function(e) {
var t = e.offset().top,
n = t + e.outerHeight(),
i = jQuery(window).scrollTop(),
r = i + jQuery(window).height();
return n > i && t < r
})
}
"use strict";
function add_property(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
function() {
function class_fun(t) { !
function(class_fun, t) {
if (! ( class_fun instanceof t)) throw new TypeError("Cannot call a class as a function")
} ( this, class_fun ),
this.form = t,
this.$form = jQuery( "#heku_listscreen_settings" ),
this.$column_container = this.$form.find( ".ac-columns" ),
this.$submit = jQuery( ".sidebox a.submit, .column-footer a.submit" ),
this.$container = jQuery( "#cpac .ac-admin" ),
this.columns = {},
this.init()
}
var t, n, i;
return t = e,
(n = [{
key: "init",
value: function() {
this.initColumns(),
this.bindFormEvents(),
this.bindOrdering(),
this.$form.hasClass("-disabled") && this.disableFields(),
jQuery(document).trigger("AC_Form_Ready", this)
}
}, {
key: "bindFormEvents",
value: function() {
var e = this,
t = jQuery(".sidebox a.submit, .column-footer a.submit");
t.on("click", (function() {
e.validateForm() && (t.attr("disabled", "disabled"), e.$container.addClass("saving"), e.submitForm().always((function() {
t.removeAttr("disabled", "disabled"),
e.$container.removeClass("saving")
})))
})),
e.$container.find(".add_column").on("click", (function() {
e.addColumn()
}));
var n = jQuery("#cpac .ac-boxes");
n.hasClass("disabled") && n.find(".ac-column").each((function(e, t) {
jQuery(t).data("column").disable(),
jQuery(t).find("input, select").prop("disabled", !0)
})),
jQuery("a[data-clear-columns]").on("click", (function() {
e.resetColumns()
}))
}
}, {
key: "initColumns",
value: function() {
var e = this;
e.columns = {},
this.$form.find(".ac-column").each((function() {
var t = jQuery(this),
n = new a(t);
n.bindEvents(),
t.data("column", n),
e.columns[n.name] = n
}))
}
}, {
key: "resetColumns",
value: function() {
var e = this;
Object.keys(this.columns).forEach((function(t) {
e.columns[t].destroy()
}))
}
}, {
key: "serialize",
value: function() {
return this.$form.serialize()
}
}, {
key: "disableFields",
value: function() {
var e = document.querySelector(this.form);
if (e) for (var t = e.elements,
n = 0; n < t.length; n++) t[n].readOnly = !0,
t[n].setAttribute("disabled", !0)
}
}, {
key: "enableFields",
value: function() {}
}, {
key: "submitForm",
value: function() {
var e = this,
t = jQuery.post(ajaxurl, {
action: "ac-columns",
id: "save",
_ajax_nonce: Heku.nonce,
data: this.serialize()
},
(function(t) {
t && (t.success ? (e.showMessage(t.data, "updated"), e.$container.addClass("stored")) : t.data && e.showMessage(t.data.message, "notice notice-warning"))
}), "json");
return t.fail((function(t) {
e.showMessage(AC.i18n.errors.save_settings, "notice notice-warning")
})),
jQuery(document).trigger("AC_Form_AfterUpdate", [e.$container]),
t
}
}, {
key: "showMessage",
value: function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "updated",
n = jQuery('<div class="ac-message hidden ' + t + '"><p>' + e + "</p></div>");
this.$container.find(".ac-message").stop().remove(),
this.$container.find(".ac-admin__main").prepend(n),
n.slideDown()
}
}, {
key: "cloneColumn",
value: function(e) {
return this._addColumnToForm(new a(e).clone(), e.hasClass("opened"), e)
}
}, {
key: "addColumn",
value: function() {
var e = jQuery("#add-new-column-template").find(".ac-column").clone(),
t = new a(e).create();
return this._addColumnToForm(t)
}
}, {
key: "removeColumn",
value: function(e) {
this.columns[e] && (this.columns[e].remove(), delete this.columns[e])
}
}]) && class_fun( t.prototype, n),
i && class_fun( t, i),
class_fun
} ();