Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * These are Bolt’s COMPILED JS files!
- * Do not edit this file, because all changes will be lost. You can edit the
- * `*.js` files in `app/src/js/` and then run `yarn grunt updateBolt` to generate
- * this file. You will need to use the "Clone the Git Repository" installation method, to
- * get these files. See: https://docs.bolt.cm/core-development/install-git-clone,
- * as well as the `README.md` file in the `app/src/` folder.
- */
- String.prototype.subst = function(t) {
- "use strict";
- return this.replace(/%[A-Z][A-Z0-9_]+%/g, function(e) {
- return e in t ? t[e] : e
- })
- };
- var init = {
- depublishTracking: function() {
- "use strict";
- var i = "dateDepublishNotice",
- n = $("#datedepublish").data("notice");
- $("#datedepublish, #statusselect").on("change", function() {
- var e = $("#statusselect").val(),
- t = $("#datedepublish").val();
- $("." + i).remove(), "" !== t && "published" === e && moment(t + Bolt.conf("timezone.offset")) < moment() && $('<div class="' + i + ' alert alert-warning alert-dismissible"><button type="button" class="close" data-dismiss="alert">×</button>' + n + "</div>").hide().insertAfter(".depublish-group").slideDown("fast")
- }), $("#datedepublish").trigger("change")
- },
- bindEditFile: function(e) {
- "use strict";
- var n;
- if ("undefined" != typeof CodeMirror) {
- n = CodeMirror.fromTextArea(document.getElementById("file_edit_contents"), {
- lineNumbers: !0,
- autofocus: !0,
- foldGutter: {
- rangeFinder: CodeMirror.fold.indent
- },
- gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
- extraKeys: {
- "Ctrl-Q": function(e) {
- e.foldCode(e.getCursor(), {
- rangeFinder: CodeMirror.fold.indent,
- minFoldSize: 3
- })
- },
- Tab: function(e) {
- e.somethingSelected() ? e.indentSelection("add") : e.replaceSelection(e.getOption("indentWithTabs") ? "\t" : Array(e.getOption("indentUnit") + 1).join(" "), "end", "+input")
- },
- "Ctrl-S": function() {
- $("#file_edit_save").click()
- },
- "Ctrl-H": "replaceAll"
- },
- tabSize: 4,
- indentUnit: 4,
- indentWithTabs: !1,
- readOnly: e.readonly
- });
- var t = $(window).height() - 312;
- t < 200 && (t = 200), n.setSize(null, t)
- }
- $("#file_edit_save").on("click", function(e) {
- Bolt.events.fire("Bolt.File.Save.Start"), e.preventDefault(), n && n.save();
- $("#file_edit_save").addClass("disabled"), $("#file_edit_save i").addClass("fa-spin fa-spinner"), $("p.lastsaved").text(Bolt.data("editcontent.msg.saving"));
- var t = $(e.target),
- i = $('form[name="file_edit"]').serialize() + "&" + encodeURI(t.attr("name")) + "=" + encodeURI(t.attr("value"));
- $.post("?returnto=ajax", i).done(function(e) {
- e.ok ? Bolt.events.fire("Bolt.File.Save.Done", e) : (alert(e.msg), Bolt.events.fire("Bolt.File.Save.Fail", e)), $("p.lastsaved").html(e.msg)
- }).fail(function() {
- Bolt.events.fire("Bolt.File.Save.Fail"), alert("Not saved")
- }).always(function() {
- Bolt.events.fire("Bolt.File.Save.Always"), window.setTimeout(function() {
- $("#file_edit_save").removeClass("disabled").blur(), $("#file_edit_save i").removeClass("fa-spin fa-spinner")
- }, 300)
- })
- })
- },
- bindEditLocale: function(e) {
- "use strict";
- CodeMirror.fromTextArea(document.getElementById("file_edit_contents"), {
- lineNumbers: !0,
- autofocus: !0,
- tabSize: 4,
- indentUnit: 4,
- indentWithTabs: !1,
- readOnly: e.readonly
- }).setSize(null, $(window).height() - 276)
- },
- bindFileBrowser: function() {
- "use strict";
- $("#myTab a").click(function(e) {
- e.preventDefault(), $(this).tab("show")
- });
- var e, t, i = (e = new RegExp("(?:[?&]|&)" + "CKEditorFuncNum" + "=([^&]+)", "i"), (t = window.location.search.match(e)) && 1 < t.length ? t[1] : null);
- $("a.filebrowserCallbackLink").bind("click", function(e) {
- e.preventDefault();
- var t = $(this).attr("href");
- window.opener.CKEDITOR.tools.callFunction(i, t), window.close()
- }), $("a.filebrowserCloseLink").bind("click", function() {
- window.close()
- })
- },
- bindCkFileSelect: function() {
- "use strict";
- var e, t, i = (e = new RegExp("(?:[?&]|&)" + "CKEditorFuncNum" + "=([^&]+)", "i"), (t = window.location.search.match(e)) && 1 < t.length ? t[1] : null);
- $("a.filebrowserCallbackLink").bind("click", function(e) {
- e.preventDefault();
- var t = $(this).attr("href");
- window.opener.CKEDITOR.tools.callFunction(i, t), window.close()
- })
- },
- bindPrefill: function() {
- "use strict";
- var e = $("#form_contenttypes").find(":checkbox");
- $("#prefill_check_all").on("click", function() {
- e.removeAttr("checked").trigger("click")
- }), $("#prefill_uncheck_all").on("click", function() {
- e.removeAttr("checked")
- })
- },
- confirmationDialogs: function() {
- "use strict";
- $(".confirm").on("click", function() {
- return confirm($(this).data("confirm"))
- })
- },
- dropDowns: function() {
- "use strict";
- $('[data-toggle="dropdown"]').each(function(e, t) {
- var a;
- "undefined" == typeof event ? $(t).parent().click(function(e) {
- a = e
- }) : a = event, $(t).parent().on("show.bs.dropdown", function() {
- if (null != a) {
- var e = $(this).find('[data-toggle="dropdown"]').next(".dropdown-menu"),
- t = a.pageY + 20,
- i = e.height(),
- n = $(window).height() - t + i;
- 20 < t - i && n < 37 && e.css({
- top: "auto",
- bottom: "100%"
- })
- }
- })
- })
- },
- dropZone: function() {
- "use strict";
- $(document).bind("dragover", function(e) {
- var t = $(".elm-dropzone"),
- i = window.dropZoneTimeout;
- i ? clearTimeout(i) : t.addClass("in"), e.target === t[0] ? t.addClass("hover") : t.removeClass("hover"), window.dropZoneTimeout = setTimeout(function() {
- window.dropZoneTimeout = null, t.removeClass("in hover")
- }, 100)
- })
- },
- magnificPopup: function() {
- "use strict";
- $(".magnific, .fancybox").magnificPopup({
- type: "image",
- gallery: {
- enabled: !0
- },
- disableOn: 400,
- closeBtnInside: !0,
- enableEscapeKey: !0,
- mainClass: "mfp-with-zoom",
- zoom: {
- enabled: !0,
- duration: 300,
- easing: "ease-in-out",
- opener: function(e) {
- return e.parent().parent().find("img")
- }
- }
- })
- },
- focusStatusSelect: function() {
- "use strict";
- $("#lastsavedstatus").click(function(e) {
- e.preventDefault(), $('a[href="#tab-meta"]').click(), $("#statusselect").focus()
- })
- },
- passwordInput: function() {
- "use strict";
- $(".togglepass").on("click", function() {
- $(this).hasClass("show-password") ? ($('input[name="user_login[password]"]').attr("type", "text"), $(".togglepass.show-password").hide(), $(".togglepass.hide-password").show()) : ($('input[name="user_login[password]"]').attr("type", "password"), $(".togglepass.show-password").show(), $(".togglepass.hide-password").hide())
- }), $(".login-forgot").bind("click", function() {
- $(".login-group, .password-group").hide(), $("#user_login_password").attr("required", !1), $(".reset-group").show()
- }), $(".login-remembered").bind("click", function() {
- $(".login-group, .password-group").show(), $("#user_login_password").attr("required", !0), $(".reset-group").hide()
- })
- },
- popOvers: function() {
- "use strict";
- $(".info-pop").popover({
- trigger: "hover",
- delay: {
- show: 500,
- hide: 200
- }
- })
- },
- sortables: function() {
- "use strict";
- $("tbody.sortable").sortable({
- items: "tr",
- opacity: "0.5",
- axis: "y",
- handle: ".sorthandle",
- update: function() {
- var e = $(this).sortable("serialize");
- $.ajax({
- url: $("#baseurl").attr("value") + "content/sortcontent/" + $(this).parent("table").data("contenttype"),
- type: "POST",
- data: e,
- success: function() {}
- })
- }
- })
- }
- },
- Bolt = {};
- ! function(bolt, $) {
- "use strict";
- var actions = {
- init: function() {
- $("button, input[type=button], a").off("click.action"), $("[data-action]").on("click.action", function(e) {
- var action = $(this).attr("data-action");
- void 0 !== action && "" !== action && (e.preventDefault(), eval(action), e.stopPropagation())
- }).on("click.popover", ".popover", function(e) {
- e.stopPropagation()
- }), $(".clickspinner").on("click.spinner", function() {
- $(this).addClass("disabled").blur(), $(this).find("i").addClass("fa-spin fa-spinner"), window.setTimeout(function(e) {
- $(e).removeClass("disabled"), $(e).find("i").removeClass("fa-spin fa-spinner")
- }, 1e4, this)
- }), $(".submitspinner").on("submit.spinner", function() {
- $(this).find("button[type=submit]").addClass("disabled").blur(), $(this).find("button[type=submit] i").addClass("fa-spin fa-spinner"), window.setTimeout(function(e) {
- $(e).removeClass("disabled"), $(e).find("i").removeClass("fa-spin fa-spinner")
- }, 1e4, $(this).find("button[type=submit]"))
- })
- },
- submit: function(e, t) {
- $('<input type="hidden" />').attr("name", t.name).val(1).appendTo(e), e.submit()
- }
- };
- bolt.actions = actions
- }(Bolt || {}, jQuery),
- function(t, n, i, a) {
- "use strict";
- var o, e = {},
- s = 1e4;
- e.gMapsApiReady = function() {
- o = !0, t.events.fire("Bolt.GoogleMapsAPI.Load.Done")
- }, e.run = function() {
- var e;
- t.conf.init(), t.data.init(), s = t.conf("buid").match(/(\d+)$/)[1], e = t.conf("locale.long"), n.fn.select2.defaults.set("language", e.replace("_", "-")), i.locale(e), n.datepicker.setDefaults(n.datepicker.regional[e]), t.events.on("Bolt.GoogleMapsAPI.Load.Request", function() {
- if (void 0 === o) {
- o = !1;
- var e = "https://maps.google.com/maps/api/js?sensor=false&callback=Bolt.app.gMapsApiReady";
- Bolt.conf.get("google_api_key") && (e = e + "&key=" + Bolt.conf.get("google_api_key")), n.getScript(e).fail(function() {
- o = void 0, t.events.fire("Bolt.GoogleMapsAPI.Load.Fail")
- })
- } else !0 === o && t.events.fire("Bolt.GoogleMapsAPI.Load.Done")
- }), t.actions.init(), t.secmenu.init(), t.stack.init(), t.omnisearch.init(), t.extend.init(), t.filemanager.init(), t.ckeditor.init(), t.datetime.init(), a.confirmationDialogs(), a.magnificPopup(), a.dropZone(), a.popOvers(), a.dropDowns(), a.passwordInput(), a.sortables(), a.focusStatusSelect(), a.depublishTracking(), n("[data-bind]").each(function() {
- var e = n(this).data("bind");
- switch (e.bind) {
- case "editcontent":
- t.editcontent.init(e);
- break;
- case "editfile":
- a.bindEditFile(e);
- break;
- case "editlocale":
- a.bindEditLocale(e);
- break;
- case "filebrowser":
- a.bindFileBrowser();
- break;
- case "ckfileselect":
- a.bindCkFileSelect();
- break;
- case "prefill":
- a.bindPrefill()
- }
- }), t.app.initWidgets()
- }, e.buid = function() {
- return "buid-" + s++
- }, e.initWidgets = function(e) {
- void 0 === e && (e = n(document.documentElement)), n("[data-bolt-widget]", e).each(function() {
- var i = n(this),
- e = i.data("bolt-widget"),
- t = {};
- "string" == typeof e ? t[e] = {} : t = e, n.each(t, function(e, t) {
- i[e](t).removeAttr("data-bolt-widget").removeData("bolt-widget")
- })
- })
- }, n(document).ready(e.run), t.app = e
- }(Bolt || {}, jQuery, moment, init),
- function(a, o, t) {
- "use strict";
- var e = {};
- function s() {
- var e = [];
- for (var t in arguments)
- if (1 === arguments[t].length || arguments[t][0]) {
- var i = arguments[t][arguments[t].length - 1];
- "string" == typeof i && "|" === i.substr(0, 1) && (i = i.substr(1), e = e.concat("-")), e = e.concat(i)
- }
- return e
- }
- e.init = function() {
- t && (t = e.initcke(t))
- }, e.update = function() {
- if (t)
- for (var e in t.instances) t.instances.hasOwnProperty(e) && t.instances[e].updateElement()
- }, e.add = function(e) {
- t && t.replace(e)
- }, e.initcke = function(e) {
- return e.editorConfig = function(e) {
- var t, i = o(this.element.$).data("param") || {},
- n = a.conf("ckeditor");
- for (t in e.language = a.conf("ckeditor.lang"), e.skin = "moono-lisa", e.resize_enabled = !0, e.entities = !1, e.fillEmptyBlocks = !1, e.extraPlugins += (e.extraPlugins ? "," : "") + "codemirror", e.baseFloatZIndex = 100015, e.toolbar = s([{
- name: "clipboard",
- items: s([n.clipboard, "Undo"], [n.clipboard, "Redo"], [n.copypaste, "Cut"], [n.copypaste, "Copy"], [n.copypaste, "Paste"], [n.copypaste, "PasteFromWord"], [n.copypaste, "PasteText"])
- }], [{
- name: "styles",
- items: s(["Format"], [n.styles, "Styles"])
- }], [{
- name: "basicstyles",
- items: s(["Bold"], ["Italic"], [n.underline, "Underline"], [n.strike, "Strike"])
- }], [{
- name: "paragraph",
- items: s(["NumberedList"], ["BulletedList"], ["Indent"], ["Outdent"], [n.blockquote, "|Blockquote"])
- }], [{
- name: "links",
- items: s(["Link"], ["Unlink"], [n.anchor, "|Anchor"])
- }], [n.subsuper, {
- name: "subsuper",
- items: s(["Subscript"], ["Superscript"])
- }], [n.images, {
- name: "image",
- items: s(["Image"])
- }], [n.embed, {
- name: "embed",
- items: s(["oembed"])
- }], [n.tables, {
- name: "table",
- items: s(["Table"])
- }], [n.ruler, {
- name: "ruler",
- items: s(["HorizontalRule"])
- }], [n.align, {
- name: "align",
- items: s(["JustifyLeft"], ["JustifyCenter"], ["JustifyRight"], ["JustifyBlock"])
- }], [n.fontcolor, {
- name: "colors",
- items: s(["TextColor"], ["BGColor"])
- }], [n.codesnippet, {
- name: "code",
- items: s(["|CodeSnippet"])
- }], [{
- name: "tools",
- items: s(["RemoveFormat"], ["Maximize"], ["|Source"], [n.specialchar, "|SpecialChar"])
- }]), n.embed && (e.extraPlugins += ",oembed,widget", e.oembed_maxWidth = "853", e.oembed_maxHeight = "480"), e.height = 250, e.autoGrow_onStartup = !0, e.autoGrow_minHeight = 150, e.autoGrow_maxHeight = 400, e.autoGrow_bottomSpace = 24, e.removePlugins = "elementspath", e.resize_dir = "vertical", n.filebrowser ? (n.filebrowser.browseUrl && (e.filebrowserBrowseUrl = n.filebrowser.browseUrl), n.filebrowser.imageBrowseUrl && (e.filebrowserImageBrowseUrl = n.filebrowser.imageBrowseUrl), n.filebrowser.uploadUrl && (e.filebrowserUploadUrl = n.filebrowser.uploadUrl), n.filebrowser.imageUploadUrl && (e.filebrowserImageUploadUrl = n.filebrowser.imageUploadUrl)) : (e.filebrowserBrowseUrl = "", e.filebrowserImageBrowseUrl = "", e.filebrowserUploadUrl = "", e.filebrowserImageUploadUrl = ""), e.codemirror = {
- theme: "default",
- lineNumbers: !0,
- lineWrapping: !0,
- matchBrackets: !0,
- autoCloseTags: !0,
- autoCloseBrackets: !0,
- enableSearchTools: !0,
- enableCodeFolding: !0,
- enableCodeFormatting: !0,
- autoFormatOnStart: !1,
- autoFormatOnUncomment: !1,
- autoFormatOnModeChange: !1,
- highlightActiveLine: !0,
- highlightMatches: !0,
- showFormatButton: !1,
- showCommentButton: !1,
- showUncommentButton: !1
- }, n.ck) n.ck.hasOwnProperty(t) && (e[t] = n.ck[t]);
- for (t in i.height && (e.height = parseInt(i.height), e.autoGrow_minHeight = Math.max(e.autoGrow_minHeight, e.height), e.autoGrow_maxHeight = Math.max(e.autoGrow_maxHeight, e.height)), i.ckeditor) i.ckeditor.hasOwnProperty(t) && (e[t] = i.ckeditor[t])
- }, a.conf("ckeditor").ck.allowNbsp && e.on("instanceReady", function(e) {
- e.editor.on("paste", function(e) {
- e.data.dataValue = e.data.dataValue.replace(/ /g, " "), e.data.dataValue = e.data.dataValue.replace(/<p> <\/p>/g, "")
- }, null, null, 9)
- }), e
- }, a.ckeditor = e
- }(Bolt || {}, jQuery, "undefined" != typeof CKEDITOR ? CKEDITOR : void 0),
- function(e, t, i) {
- "use strict";
- var a = {},
- n = function(e) {
- var t, i = e.split("."),
- n = a;
- for (t = 0; t < i.length; t++) {
- if (void 0 === n[i[t]]) return;
- n = n[i[t]]
- }
- return n
- };
- (n.get = n).init = function() {
- a = t("script[data-config]").first().data("config")
- }, e.conf = n
- }(Bolt || {}, jQuery),
- function(e, t, i) {
- "use strict";
- var o = {},
- n = function(e, t) {
- var i, n = e.split("."),
- a = o;
- for (i = 0; i < n.length; i++) {
- if (void 0 === a[n[i]]) return;
- a = a[n[i]]
- }
- return t && "string" == typeof a ? a.subst(t) : a
- };
- (n.get = n).init = function() {
- o = t("script[data-jsdata]").first().data("jsdata") || {}
- }, e.data = n
- }(Bolt || {}, jQuery),
- function(e, l, d) {
- "use strict";
- var r, t = {},
- a = [];
- function o(e) {
- var t, i, n, a, o = "",
- s = "";
- "datedepublish" === e.data.attr("id") && "1900-01-01 00:00:00" === e.data.val() && e.data.val(""), (i = e.data.val().match(/^(\d{4}-\d{2}-\d{2})(?: (\d{2}:\d{2}:\d{2}))?$/)) && (o = i[1], s = i[2] || ""), n = "" === o || "0000-00-00" === o ? "" : l.datepicker.parseDate("yy-mm-dd", o), e.date.datepicker("setDate", n), e.time.exists && "0000-00-00" !== o && (s = "" === s ? "" !== o ? "00:00" : "" : r ? e.data.val().slice(11, 16) : (a = (t = parseInt(s.slice(0, 2))) < 12 ? " AM" : " PM", (t % 12 || 12) + s.slice(2, 5) + a), e.time.val(s)), e.data.trigger("change")
- }
- function s(e) {
- var t, i, n, a = d(e.date.datepicker("getDate")),
- o = d([2001, 11, 24]),
- s = !1;
- if (e.time.exists) {
- var l = new RegExp("^(?:(?:([01]?[0-9]|2[0-3]))[:,.]([0-5]?[0-9])|(1[012]|0?[1-9])[:,.]([0-5]?[0-9])(?:\\s*([AP])[. ]?M\\.?))$");
- (n = e.time.val().trim().toUpperCase().match(l)) && (t = parseInt(n[1] ? n[1] : n[3]), i = parseInt(n[2] ? n[2] : n[4]), "P" === n[5] && 12 !== t ? t += 12 : "A" === n[5] && 12 === t && (t -= 12), o = d([2001, 11, 24, t, i]), s = !0)
- }
- if (a.isValid()) {
- var r = e.time.exists ? " " + o.format("HH:mm:00") : "";
- e.data.val(a.format("YYYY-MM-DD") + r)
- } else s ? e.data.val(d().format("YYYY-MM-DD") + " " + o.format("HH:mm:00")) : e.data.val("")
- }
- t.update = function() {
- for (var e in a) a.hasOwnProperty(e) && o(a[e])
- }, t.init = function() {
- r = !d.localeData()._longDateFormat.LT.replace(/\[.+?\]/gi, "").match(/A/), l("input.datetime").each(function() {
- var e, t, i, n = (e = l(this), t = e.closest(".datetime-container"), (i = {}).data = e, i.date = t.find("input.datepicker"), i.time = t.find("input.timepicker"), i.show = t.find("button.btn-tertiary"), i.clear = t.find("button.btn-default"), i.time.exists = 0 < i.time.length, i);
- a.push(n),
- function(e) {
- var t = e.date.data("field-options"),
- i = {
- showOn: "none"
- };
- for (var n in t) t.hasOwnProperty(n) && (i[n] = t[n]);
- e.date.datepicker(i), e.show.click(function() {
- e.date.datepicker("show")
- }), e.clear.click(function() {
- e.data.val(""), o(e)
- })
- }(n), o(n), n.date.change(function() {
- s(n), o(n)
- }), n.time.change(function() {
- s(n), o(n)
- })
- })
- }, e.datetime = t
- }(Bolt || {}, jQuery, moment),
- function(r, d, c, u, o, p) {
- "use strict";
- var e = {};
- function i(e) {
- var t;
- return e.name && (t = d(e).val(), "select-multiple" === e.type && (t = JSON.stringify(t))), t
- }
- function f() {
- d('form[name="content_edit"]').find("input, textarea, select").each(function() {
- if ("textarea" === this.type && d(this).hasClass("ckeditor")) p.instances[this.id].checkDirty() && (p.instances[this.id].updateElement(), p.instances[this.id].resetDirty());
- else {
- var e = i(this);
- void 0 !== e && d(this).data("watch", e)
- }
- }), c.onbeforeunload = function() {
- if (t = 0, d('form[name="content_edit"]').find("input, textarea, select").each(function() {
- if ("content_edit[save]" !== d(this).attr("name"))
- if ("textarea" === this.type && d(this).hasClass("ckeditor")) p.instances[this.id].checkDirty() && t++;
- else {
- var e = i(this);
- void 0 !== e && d(this).data("watch") !== e && t++
- }
- }), 0 < t || r.liveEditor.active) return r.data("editcontent.msg.change_quit");
- var t
- }
- }
- function s() {
- c.onbeforeunload = null
- }
- function h() {
- d("#sidebar_save, #content_edit_save, #live_editor_save").addClass("disabled"), d("#sidebar_save i, #content_edit_save i").addClass("fa-spin fa-spinner"), d("p.lastsaved").text(r.data("editcontent.msg.saving"))
- }
- e.init = function(e) {
- var t, l, i, n, a;
- (t = d('form[name="content_edit"]')).attr("novalidate", "novalidate").on("submit", function(e) {
- var t = r.validation.run(this);
- if (d(this).data("valid", t), !t) return e.preventDefault(), !1
- }), t.on("boltvalidate", function() {
- var e = r.validation.run(this);
- return d(this).data("valid", e), e
- }), l = e, d("#sidebar_save").bind("click", function() {
- d("#content_edit_save").trigger("click")
- }), d("#content_edit_save").bind("click", function(e) {
- e.preventDefault();
- var n = d('form[name="content_edit"]');
- if (n.trigger("boltvalidate"), !n.data("valid")) return !1;
- var t = l.newRecord,
- i = l.savedon,
- a = l.msgNotSaved;
- if (h(), t) f(), r.liveEditor.active && r.liveEditor.stop(), l.duplicate && (c.onbeforeunload = null), r.actions.submit(n, this);
- else {
- f(), r.events.fire("Bolt.Content.Save.Start");
- var o = d(e.target),
- s = n.serialize() + "&" + encodeURI(o.attr("name")) + "=" + encodeURI(o.attr("value"));
- d.post("", s).done(function(t) {
- r.events.fire("Bolt.Content.Save.Done", {
- form: t
- }), c.onbeforeunload = null, d("p.lastsaved").removeClass("alert alert-danger").html(i).find("strong").text(u(t.datechanged).format("MMM D, HH:mm")).end().find(".buic-moment").buicMoment().buicMoment("set", t.datechanged);
- var e = d("#statusselect").find("option:selected");
- d("a#lastsavedstatus strong").html('<i class="fa fa-circle status-' + e.val() + '"></i> ' + e.text()), d("#sidebar_save i, #content_edit_save i").removeClass("fa-flag fa-spin fa-spinner fa-exclamation-triangle").addClass("fa-check"), "object" === d.type(t) && (d.each(t, function(i, e) {
- if ("object" === d.type(e)) d.each(e, function(e, t) {
- d(':input[name="' + i + "[" + e + ']"]').val(t)
- });
- else if ("array" === d.type(e));
- else {
- var t = d(n.name).find("[name=" + i + "]");
- "checkbox" === t.attr("type") ? t.prop("checked", "1" === e) : t.val(e), p && p.instances[i] && p.instances[i].setData(e, {
- callback: function() {
- this.resetDirty()
- }
- })
- }
- }), d("a[data-href-placeholder]").each(function() {
- var e = d(this).data("href-placeholder").replace("__replaceme", t.slug);
- d(this).attr("href", e)
- })), r.datetime.update(), f()
- }).fail(function(e) {
- r.events.fire("Bolt.Content.Save.Fail");
- var t = d.parseJSON(e.responseText),
- i = "<b>" + a + "</b><br><small>" + t.error.message + "</small>";
- d("p.lastsaved").html(i).addClass("alert alert-danger"), d("#sidebar_save i, #content_edit_save i").removeClass("fa-flag fa-spin fa-spinner").addClass("fa-exclamation-triangle")
- }).always(function() {
- r.events.fire("Bolt.Content.Save.Always"), c.setTimeout(function() {
- d("#sidebar_save, #content_edit_save, #live_editor_save").removeClass("disabled").blur()
- }, 1e3), c.setTimeout(function() {
- d("#sidebar_save i, #content_edit_save i").addClass("fa-flag")
- }, 5e3)
- })
- }
- }), d("#sidebar_save_return").bind("click", function() {
- d("#content_edit_save_return").trigger("click")
- }), d("#content_edit_save_return").bind("click", function() {
- h(), s()
- }), d("#sidebar_save_create").bind("click", function() {
- d("#content_edit_save_create").trigger("click")
- }), d("#content_edit_save_create").bind("click", function() {
- h(), s(), r.actions.submit(d('form[name="content_edit"]'), this)
- }), (i = d('form[name="content_edit"]')).find("#sidebar_preview").attr("disabled", !1), i.find("#content_edit_preview").attr("disabled", !1), d("#sidebar_preview").bind("click", function() {
- d("#content_edit_preview").trigger("click")
- }), d("#content_edit_preview").bind("click", function(e) {
- var t = d(e.target).data("url");
- e.preventDefault(), i.attr("action", t).attr("target", "_blank").submit(), i.attr("action", "").attr("target", "_self")
- }), d("#sidebar_delete").bind("click", function() {
- d("#content_edit_delete").trigger("click")
- }), d("#content_edit_delete").bind("click", function(e) {
- e.preventDefault();
- var i = this;
- o.confirm(r.data("editcontent.delete"), function(e) {
- if (d(".alert").alert(), !0 === e) {
- var t = d('form[name="content_edit"]');
- c.onbeforeunload = null, r.actions.submit(t, i)
- }
- })
- }), n = c.location.hash, a = d("#filtertabs"), n && a.find('a[href="#tab-' + n.replace(/^#/, "") + '"]').tab("show"), a.find("a").click(function() {
- var e;
- d(this).tab("show"), e = d("body").scrollTop(), c.location.hash = this.hash.replace(/^#tab-/, ""), d("html,body").scrollTop(e)
- }), r.liveEditor.init(e), c.setTimeout(function() {
- d("#content_edit_save").is("*") && (d("body, input").bind("keydown", "ctrl+s meta+s", function(e) {
- e.preventDefault(), f(), d("#content_edit_save").trigger("click")
- }), c.setTimeout(function() {
- f()
- }, 1e3))
- }, 1e3)
- }, r.editcontent = e
- }(Bolt || {}, jQuery, window, moment, bootbox, "undefined" != typeof CKEDITOR ? CKEDITOR : void 0),
- function(C, E) {
- "use strict";
- var T, t, e = {};
- function S(e) {
- return E(".extend-bolt-container").find(e)
- }
- function I(e) {
- var t, i, n = "",
- a = "",
- o = "";
- try {
- n = E.parseJSON(e.responseText)
- } catch (e) {}
- void 0 === n.error ? (o = "This was the received response:\n\n<textarea>" + (t = e.responseText, ((i = E(t)).find("h1, h2, h3, p").text() || i.text()).trim().replace(/ +/g, " ").replace(/\s+\n/g, "\n")) + "</textarea>\n\nInspect the console output in the browser's Debug Inspector for more details.", a = C.data("extend.packages.error", {
- "%ERROR_TYPE%": "Unknown Error",
- "%ERROR_MESSAGE%": o,
- "%ERROR_LOCATION%": ""
- }), console.error(e)) : a = "Bolt\\Exception\\PackageManagerException" === n.error.type ? (o = n.error.message.replace(/(<http)/g, '<a href="http').replace(/(\w+>)/g, '">this link</a>'), C.data("extend.packages.error", {
- "%ERROR_TYPE%": "Composer Error",
- "%ERROR_MESSAGE%": o,
- "%ERROR_LOCATION%": ""
- })) : "Bolt\\Exception\\ExtensionsInfoServiceException" === n.error.type ? (o = n.error.message, C.data("extend.packages.error", {
- "%ERROR_TYPE%": "Extension Site Error",
- "%ERROR_MESSAGE%": o,
- "%ERROR_LOCATION%": ""
- })) : C.data("extend.packages.error", {
- "%ERROR_TYPE%": "PHP Error",
- "%ERROR_MESSAGE%": n.error.message,
- "%ERROR_LOCATION%": "File: " + n.error.file + "::" + n.error.line
- }), E(".modal").modal("hide"), bootbox.alert(a)
- }
- function R() {
- S(".installed-container").each(function() {
- var n = E(this).find(".installed-list");
- T = S(".installed-container .console"), E.get(C.data("extend.baseurl") + "installed", function(e) {
- var t = "";
- if ("object" == typeof e) {
- n.show(), n.find(".installed-list-items").html(""), S(".installed-container .console").hide();
- var i = !0;
- "object" == typeof e && (t += function(e) {
- var t = "";
- for (var i in e)
- if (e.hasOwnProperty(i)) {
- var n = e[i],
- a = C.data("extend.packages"),
- o = [],
- s = [],
- l = 0;
- if (n.authors && 0 < n.authors.length)
- for (l = 0; l < n.authors.length; l++) o.push(a.author.subst({
- "%AUTHOR%": n.authors[l].name
- }));
- if (o = o.length ? a.authors.subst({
- "%AUTHORS%": o.join(", ")
- }) : "", n.keywords && 0 < n.keywords.length)
- for (l = 0; l < n.keywords.length; l++) s.push(a.keyword.subst({
- "%KEYWORD%": n.keywords[l]
- }));
- s = s.length ? a.keywords.subst({
- "%KEYWORDS%": s.join(" ")
- }) : "", "wikimedia/composer-merge-plugin" === n.name && (n.title = "Local Extension Helper");
- var r = "",
- d = {
- "%NAME%": n.name,
- "%VERSION%": n.version,
- "%BASEURL%": C.data("extend.baseurl"),
- "%MARKETPLACE_URL%": "https://market.bolt.cm/view/" + n.name,
- "%REPOSITORY_URL%": n.repositoryLink
- };
- r = "installed" === n.status && "composer-plugin" !== n.type ? a.manage_dropdown_installed.subst(d) : a.manage_dropdown_uninstalled.subst(d);
- var c = a.left_buttons.subst({
- "%README%": null !== n.readmeLink ? a.readme_button.subst({
- "%README%": n.readmeLink
- }) : "",
- "%CONFIG%": null !== n.configLink ? a.config_button.subst({
- "%CONFIG%": n.configLink
- }) : "",
- "%THEME%": "bolt-theme" === n.type ? a.theme_button.subst({
- "%NAME%": n.name
- }) : ""
- });
- t += a.item.subst({
- "%TITLE%": n.title ? n.title : n.name,
- "%NAME%": n.name,
- "%VERSION%": n.version,
- "%AUTHORS%": o,
- "%TYPE%": n.type,
- "%MANAGE%": r,
- "%DETAILS%": c,
- "%BASEURL%": C.data("extend.baseurl"),
- "%DESCRIPTION%": n.description ? a.description.subst({
- "%DESCRIPTION%": n.description
- }) : "",
- "%KEYWORDS%": s,
- "%STATUS%": !1 === n.valid ? " — [INVALID] " : "",
- "%ENABLED%": !1 === n.enabled ? " — [DISABLED] " : "",
- "%CONSTRAINT%": null !== n.constraint ? '<i class="fa fa-cog fa-fw"></i> Requires Bolt ' + n.constraint : ""
- })
- }
- return t
- }(e), i = !1), i && (t = C.data("extend.packages.empty"), T.hide()), n.find(".installed-list-items").append(t)
- } else T.html(C.data("extend.text.bad-json"))
- }).fail(function(e) {
- I(e)
- })
- })
- }
- var i, A = (i = 0, function(e, t) {
- clearTimeout(i), i = setTimeout(e, t)
- });
- function D(e, t, i) {
- var n = S(".update-container");
- e && n.find(".update-output-title").html(e), t && (n.find(".update-output-console").find(".console").html(t), n.find(".update-output-console").show()), i && n.find(".update-output-notice").html(i).show(), n.show()
- }
- function O(e, t) {
- var i = S(".update-container");
- e && i.find(".update-output-console").find(".console").html(e).show(), t && i.find(".update-output-notice").html(t).show()
- }
- function o(e) {
- var t, i, n = "";
- for (var a in e) e.hasOwnProperty(a) && void 0 !== (t = e[a]) && (i = "approved" === t.buildStatus ? " label-success" : "", n += C.data("extend.packages.versions", {
- "%NAME%": t.name,
- "%VERSION%": t.version,
- "%CLASS%%": i,
- "%BUILDSTATUS%": t.buildStatus
- }));
- return n
- }
- function $(e) {
- T = S(".update-output"), E.get(C.data("extend.baseurl") + "installInfo?package=" + e, function(e) {
- var t = e.dev,
- i = e.beta,
- n = e.RC,
- a = e.stable;
- S(".dev-version-container .installed-version-item").html(""), 0 < a.length ? (S(".stable-version-container .installed-version-item").html(""), S(".stable-version-container .installed-version-item").append(o(a)), S(".latest-version-container .installed-version-item").html(""), S(".latest-version-container .installed-version-item").append(o([e.stable[0]])), S(".install-latest-container").show()) : S(".install-version-container").show(), 0 < n.length && S(".dev-version-container .installed-version-item").append(o(n)), 0 < i.length && S(".dev-version-container .installed-version-item").append(o(i)), 0 < t.length && S(".dev-version-container .installed-version-item").append(o(t)), S("#installModal .loader").hide()
- }).fail(function(e) {
- I(e)
- })
- }
- function B(e, t) {
- E.get(C.data("extend.baseurl") + "packageInfo", {
- package: e,
- version: t
- }).done(function(e) {
- var t, i, n;
- "bolt-extension" === e.type && (t = e, S(".extension-postinstall").show(), S(".extension-postinstall .modal-success").show(), S(".postinstall-footer .ext-link").attr("href", t.source), S(".postinstall-footer").show()), "bolt-theme" === e.type && (n = (i = e).name.split(/\/+/).pop(), S(".install-response-container").hide(), S(".theme-postinstall").show(), S(".theme-generation-container").show(), S(".theme-postinstall .theme-generator").data("theme", i.name), S(".theme-postinstall #theme-name").val(n), S(".postinstall-footer").show())
- }).fail(function(e) {
- I(e)
- })
- }
- var n = function(e) {
- var t, i, n, a, o, s, l, r, d, c, u, p, f, h, m, g, v, b, _, k, w, y, x;
- switch (E(e.target).data("request")) {
- case "update-check":
- S(".update-container").show(), x = S(".update-output-console").html(), S(".update-output-notice").html(x), S(".update-output-notice").find(".update-output-element").removeClass("update-output-element").addClass("update-output").show(), S(".update-list").hide(), (y = S(".update-list-items")).html(""), (T = S(".update-output")).html(C.data("extend.text.updating")), E.get(C.data("extend.baseurl") + "check", function(e) {
- if (0 < e.updates.length || 0 < e.installs.length) {
- var t, i;
- for (t in e.installs) e.installs.hasOwnProperty(t) && (i = e.installs[t], y.append(C.data("extend.packages.install_new", {
- "%PACKAGE%": i.name,
- "%VERSION%": i.version,
- "%PRETTYVERSION%": i.prettyversion
- })));
- for (t in e.updates) e.updates.hasOwnProperty(t) && (i = e.updates[t], y.append(C.data("extend.packages.install_update", {
- "%PACKAGE%": i.name,
- "%VERSION%": i.version,
- "%PRETTYVERSION%": i.prettyversion
- })));
- T.hide(), S(".update-list").show()
- } else T.html(C.data("extend.text.updated"))
- }).fail(function(e) {
- I(e)
- });
- break;
- case "update-run":
- D(C.data("extend.text.running-update-all"), C.data("extend.text.running-update"), !1), E.get(C.data("extend.baseurl") + "update", function(e) {
- setTimeout(function() {
- S(".update-container").hide()
- }, 7e3), O(e), R()
- }).fail(function(e) {
- I(e)
- });
- break;
- case "update-package":
- _ = e.originalEvent, k = S(".update-output").html(C.data("extend.text.updating")), w = E(_.target).data("package"), k.show(), T = k, E.get(C.data("extend.baseurl") + "update?package=" + w).success(function(e) {
- S(".update-output").html(e), S('.update-list-items tr[data-package="' + w + '"]').remove(), A(function() {
- T.hide()
- }, 4e3), S(".update-list-items tbody tr").length < 1 && S(".update-container").hide(), R()
- }).fail(function(e) {
- I(e)
- }), _.preventDefault();
- break;
- case "check-package":
- g = e.originalEvent, v = S('input[name="check-package"]').val(), (b = S('input[name="check-package"]').data("packagename")) && (v = b), $(v), g.preventDefault();
- break;
- case "uninstall-package":
- ! function(e) {
- var t = S(".installed-container .console").html(C.data("extend.text.removing"));
- if (!1 === confirm(C.data("extend.text.confirm-remove"))) return e.stopPropagation(), e.preventDefault();
- t.show(), T = t, E.get(E(e.target).attr("href")).done(function(e) {
- S(".installed-container .console").html(e), R(), A(function() {
- T.hide()
- }, 2e3)
- }).fail(function(e) {
- I(e)
- }), e.preventDefault()
- }(e.originalEvent);
- break;
- case "install-package":
- f = e.originalEvent, h = E(f.target).data("package"), m = E(f.target).data("version"), S(".install-response-container").show(), S(".install-latest-container").hide(), S(".install-version-container").hide(), (T = S(".install-response-container .console")).html(C.data("extend.text.installing")), S("#installModal .loader .message").html(C.data("extend.text.installing")), E.get(C.data("extend.baseurl") + "install", {
- package: h,
- version: m
- }).done(function() {
- B(h, m), S(".install-response-container").hide(), S(".check-package").show(), S('input[name="check-package"]').val(""), R()
- }).fail(function(e) {
- I(e)
- }), f.preventDefault();
- break;
- case "prefill-package":
- u = e.originalEvent, p = E(u.target), S('input[name="check-package"]').val(p.closest("a").text()), S('input[name="check-package"]').data("packagename", p.data("packagename")), S(".auto-search").hide();
- break;
- case "install-run":
- c = e.originalEvent, D(C.data("extend.text.install-running"), C.data("extend.text.install-all"), !1), E.get(C.data("extend.baseurl") + "installAll", function(e) {
- A(function() {
- S(".update-container").hide()
- }, 7e3), O(e), R()
- }).fail(function(e) {
- I(e)
- }), c.stopPropagation(), c.preventDefault();
- break;
- case "autoload-dump":
- d = e.originalEvent, D(C.data("extend.text.autoloader-update"), C.data("extend.text.autoloader-start") + " …", !1), E.get(C.data("extend.baseurl") + "dumpAutoload", function(e) {
- A(function() {
- S(".update-container").hide()
- }, 7e3), O(e)
- }).fail(function(e) {
- I(e)
- }), d.stopPropagation(), d.preventDefault();
- break;
- case "generate-theme":
- s = e.originalEvent, l = E(s.target).data("theme"), r = S("#theme-name").val(), E.get(C.data("extend.baseurl") + "generateTheme", {
- theme: l,
- name: r
- }).done(function(e) {
- S(".theme-generate-response").html("<p>" + e + "</p>").show(), S(".theme-generation-container").hide()
- }).fail(function(e) {
- I(e)
- }), s.preventDefault();
- break;
- case "package-available":
- o = e.originalEvent, $(E(o.target).data("available"));
- break;
- case "package-copy":
- ! function(e) {
- var t = E(e.target).data("theme"),
- i = S("#theme-name").val();
- if (confirm(C.data("extend.text.overwrite"))) {
- var n = S(".installed-container .console").html(C.data("extend.text.copying"));
- n.show(), T = n, E.get(C.data("extend.baseurl") + "generateTheme", {
- theme: t,
- name: i
- }).done(function(e) {
- T.html(e), A(function() {
- n.hide()
- }, 5e3)
- }).fail(function(e) {
- I(e)
- })
- }
- e.preventDefault()
- }(e.originalEvent);
- break;
- case "package-readme":
- a = e.originalEvent, E.get(E(a.target).data("readme")).done(function(e) {
- bootbox.dialog({
- message: e || "Readme is empty."
- })
- }).fail(function(e) {
- I(e)
- }), a.preventDefault();
- break;
- case "package-depends":
- t = e.originalEvent, i = E(t.target).data("needle"), n = E(t.target).data("constraint"), S(".dependency-response-container").show(), S(".install-latest-container").hide(), S(".install-version-container").hide(), (T = S(".dependency-response-container .console")).html(""), E.get(C.data("extend.baseurl") + "depends", {
- needle: i,
- constraint: n
- }).done(function(e) {
- S(".loader").hide(), S(".dependency-response-container").hide(), S(".check-package").show(), S('input[name="check-package"]').val("");
- var t = S("#installModal .extension-dependencies-list");
- t.html(""), e.forEach(function(e) {
- t.append("<li>" + e.link + "</li>")
- }), t.show(), S(".extension-dependencies").show(), S(".postinstall-footer").show()
- }).fail(function(e) {
- I(e)
- }), t.preventDefault();
- break;
- case "show-all":
- e.originalEvent, S(".install-latest-container").hide(), S(".install-version-container").show()
- }
- };
- e.init = function() {
- var o, e = E(".extend-bolt-container");
- e.length && (e.on("click", n), E(document).ajaxStart(function() {
- t = setInterval(function() {
- T && T.append(".")
- }, 1e3)
- }).ajaxSuccess(function() {
- clearInterval(t)
- }).ajaxError(function() {
- clearInterval(t)
- }), R(), (o = S('input[name="check-package"]')).on("keyup", function() {
- var e = E(this).val();
- e.length < 3 || A(function() {
- E.ajax({
- url: C.data("extend.siteurl") + "list.json",
- dataType: "jsonp",
- data: {
- name: e,
- bolt: C.data("extend.sitever")
- }
- }).success(function(e) {
- if (e.packages.length) {
- var t = o.parent().find(".auto-search");
- for (var i in t.html("").show(), e.packages)
- if (e.packages.hasOwnProperty(i)) {
- var n = e.packages[i],
- a = 'data-request="prefill-package" data-packagename="' + n.name + '"';
- t.append('<a class="btn btn-block btn-default prefill-package" ' + a + 'style="text-align: left;">' + n.title + " <small " + a + ">(" + n.authors + " - " + n.name + ")</small></a>")
- }
- o.on("blur", function() {
- t.fadeOut()
- })
- }
- })
- }, 500)
- }), E("#installModal").on("hide.bs.modal", function() {
- S(".latest-version-container .installed-version-item").html('<tr><td colspan="3"><strong>' + C.data("extend.text.no-stable") + "</strong></td></tr>"), S(".stable-version-container .installed-version-item").html('<tr><td colspan="3"><strong>' + C.data("extend.text.no-stable") + "</strong></td></tr>"), S(".dev-version-container .installed-version-item").html('<tr><td colspan="3"><strong>' + C.data("extend.text.no-test") + "</strong></td></tr>"), S(".install-response-container .console").html(C.data("extend.text.installing")), S(".theme-postinstall").hide(), S(".theme-generate-response").hide(), S(".extension-postinstall").hide(), S(".install-response-container").hide(), S(".install-latest-container").hide(), S(".install-version-container").hide(), S(".postinstall-footer").hide(), S("#installModal .loader").show()
- }))
- }, C.extend = e
- }(Bolt || {}, jQuery),
- function(e, i) {
- "use strict";
- var t = {},
- n = {},
- a = /^([a-zA-Z0-9_-]+)(?:\.([a-zA-Z0-9_-]+))?(?:\.([a-zA-Z0-9_-]+))?(?:\.([a-zA-Z0-9_-]+))?$/;
- t.fire = function(e, t) {
- var i = a.exec(e);
- if (i && void 0 !== i[4])
- for (; e;) n[e] && n[e].fire({
- namespace: i[1],
- domain: i[2],
- event: i[3],
- status: i[4]
- }, t), e = e.replace(/\.?[a-zA-Z0-9_-]+$/, "")
- }, t.on = function(e, t) {
- a.exec(e) && (n[e] || (n[e] = i.Callbacks("unique")), n[e].add(t))
- }, t.off = function(e, t) {
- a.exec(e) && n[e] && n[e].remove(t)
- }, e.events = t
- }(Bolt || {}, jQuery),
- function(a, o) {
- "use strict";
- var e = {};
- function s(e, t, i, n) {
- var a = {
- url: e,
- type: "POST",
- data: t,
- success: function() {
- document.location.reload()
- },
- error: function(e) {
- alert(e.responseText), console.error(i)
- }
- };
- n && (a.success = n), o.ajax(a)
- }
- e.createFile = function(e, t) {
- var i = window.prompt(a.data("files.msg.create_file"));
- i.length && s(a.data("url.file.create"), {
- filename: i,
- parentPath: t,
- namespace: e
- }, "Something went wrong creating this file!")
- }, e.renameFile = function(e, t, i) {
- var n = window.prompt(a.data("files.msg.rename_file"), i);
- n.length && n !== i && s(a.data("url.file.rename"), {
- namespace: e,
- parent: t,
- oldname: i,
- newname: n
- }, "Something went wrong renaming this file!")
- }, e.deleteFile = function(e, t, i) {
- confirm(a.data("files.msg.delete_file", {
- "%FILENAME%": t
- })) && s(a.data("url.file.delete"), {
- namespace: e,
- filename: t
- }, "Failed to delete the file from the server", function() {
- null !== i && o(i).closest("tr").slideUp()
- })
- }, e.duplicateFile = function(e, t) {
- s(a.data("url.file.duplicate"), {
- namespace: e,
- filename: t
- }, "Something went wrong duplicating this file!")
- }, e.createFolder = function(e, t) {
- var i = window.prompt(a.data("files.msg.create_folder"));
- i.length && s(a.data("url.folder.create"), {
- parent: t,
- foldername: i,
- namespace: e
- }, "Something went wrong renaming this folder!")
- }, e.renameFolder = function(e, t, i) {
- var n = window.prompt(a.data("files.msg.rename_folder"), i);
- n.length && n !== i && s(a.data("url.folder.rename"), {
- namespace: e,
- parent: t,
- oldname: i,
- newname: n
- }, "Something went wrong renaming this folder!")
- }, e.deleteFolder = function(e, t, i) {
- window.confirm(a.data("files.msg.delete_folder", {
- "%FOLDERNAME%": i
- })) && s(a.data("url.folder.delete"), {
- namespace: e,
- parent: t,
- foldername: i
- }, "Something went wrong renaming this folder!")
- }, a.files = e
- }(Bolt || {}, jQuery),
- function(i, a, n) {
- "use strict";
- var e = {};
- function t() {
- var n = a(this).val();
- a(".dashboardlisting").find("[data-bolt-browse-name]").each(function() {
- var i = a(this).data("bolt-browse-name"),
- e = i.search(n) < 0;
- a(this).toggleClass("hidden", e), e || a(this).find(".name").each(function() {
- var e, t;
- a(this).html((t = "<mark>" + (e = n) + "</mark>", i.replace(new RegExp(e.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"), "g"), t))), 0 === n.length && a(this).html(i)
- })
- })
- }
- function o() {
- for (var e = document.querySelectorAll("img[data-src]"), t = 0; t < e.length; t++) e[t].getAttribute("data-src") && (e[t].setAttribute("src", e[t].getAttribute("data-src")), e[t].removeAttribute("data-src"))
- }
- function s() {
- var e = a('form[name="file_upload"]').find("#file_upload__token").val(),
- t = new n(document.body, {
- url: i.conf("uploadConfig.url"),
- previewsContainer: "#dropzone-preview",
- acceptedFiles: "." + i.conf("uploadConfig.acceptFilesTypes").join(",."),
- uploadMultiple: "true",
- enqueueForUpload: "true",
- hiddenInputContainer: ".form-horizontal",
- paramName: "file_upload[select]",
- clickable: !1,
- autoProcessQueue: !0,
- params: {
- "file_upload[_token]": e
- },
- init: function() {
- var e, t, i;
- e = this, t = a("body"), i = 0, t.bind({
- dragenter: function(e) {
- e.preventDefault(), i++, a(this).addClass("dropzone-active")
- },
- dragleave: function() {
- 0 == --i && a(this).removeClass("dropzone-active")
- }
- }), e.on("drop", function() {
- t.removeClass("dropzone-active")
- })
- }
- });
- t.on("sending", function() {
- a(".panel-uploadprogress").removeClass("hidden")
- }), t.on("complete", function(e) {
- t.removeFile(e)
- }), t.on("totaluploadprogress", function(e) {
- 100 === e && window.setTimeout(function() {
- location.reload()
- }, 200)
- })
- }
- e.init = function() {
- n.autoDiscover = !1, null !== document.querySelector("div.file-manager") && (s(), document.getElementById("file-manager-search").addEventListener("keyup", t), a("#file_upload_select").addClass("btn-secondary").bootstrapFileInput(), document.getElementById("file_upload_select").addEventListener("change", function() {
- document.getElementById("file_upload_upload").removeAttribute("disabled")
- }), window.addEventListener("load", o))
- }, i.filemanager = e
- }(Bolt || {}, jQuery, Dropzone),
- function(d, c, e, o) {
- "use strict";
- var u = {},
- p = ["text", "html", "textarea"],
- a = null;
- u.init = function(e) {
- u.previewUrl = e.previewUrl, Modernizr.contenteditable ? (c("#sidebar_live_edit, #content_edit_live_edit").bind("click", u.start), c(".close-live-editor").bind("click", u.stop), c(".save-live-editor").bind("click", u.save)) : c(".live-editor, #sidebar_live_editor, #content_edit_live_edit").remove()
- }, u.start = function() {
- var l = c('form[name="content_edit"]');
- if (d.validation.run(l[0])) {
- var e = l.find("*[name=_live-editor-preview]"),
- t = c("#navpage-primary").find(".navbar-header a"),
- i = c("#live-editor-iframe"),
- r = function(e) {
- e.preventDefault()
- },
- n = function() {
- var e = i[0],
- n = e.contentWindow || e,
- a = n.document,
- t = c(a);
- t.on("click", "a", r);
- var o = d.ckeditor.initcke(n.CKEDITOR),
- s = o.editorConfig;
- o.editorConfig = function(e) {
- for (var t in s.bind(this)(e), e.toolbar)
- if ("tools" === e.toolbar[t].name) {
- var i = e.toolbar[t].items.indexOf("Source"); - 1 < i && delete e.toolbar[t].items[i]
- }
- }, o.disableAutoInline = !1, t.find("[data-bolt-field]").each(function() {
- var e = l.find("*[name=" + u.escapejQuery(c(this).data("bolt-field")) + "]").closest("[data-bolt-fieldset]").data("bolt-fieldset");
- if (c(this).addClass("bolt-editable"), !c(this).data("no-edit") && -1 !== p.indexOf(e))
- if (c(this).attr("contenteditable", !0), "html" === e) {
- var t = o.inline(this, {
- allowedContent: ""
- }),
- i = d.utils.debounce(function() {
- t.element.data("src", t.getData())
- }, 500);
- t.on("instanceReady", i), t.on("change", i)
- } else c(this).on("paste", function(e) {
- var t;
- e.preventDefault(), e.originalEvent.clipboardData ? (t = e.originalEvent.clipboardData.getData("text/plain"), a.execCommand("insertText", !1, t)) : n.clipboardData && (t = n.clipboardData.getData("Text"), n.getSelection && n.getSelection().getRangeAt(0).insertNode(a.createTextNode(t)))
- }), "textarea" === e ? c(this).on("keypress", function(e) {
- 13 === e.which && (e.preventDefault(), a.execCommand("insertHTML", !1, "<br><br>"))
- }) : c(this).on("keypress", function(e) {
- return 13 !== e.which
- }).on("focus blur", function() {
- c(this).html(c(this).text())
- })
- })
- };
- i.on("load", n), d.liveEditor.active = !0, c("body").addClass("live-editor-active"), t.on("click", r), e.val("yes"), l.attr("action", u.previewUrl).attr("target", "live-editor-iframe").submit(), l.attr("action", "").attr("target", "_self"), e.val(""), a = function() {
- i.off("load", n), t.off("click", r)
- }
- }
- }, u.save = function() {
- u.extractText(), c("#content_edit_save").trigger("click")
- }, u.stop = function() {
- var e = c("#live-editor-iframe")[0];
- u.extractText(), c(e).attr("src", ""), d.liveEditor.active = !1, c("body").removeClass("live-editor-active"), a()
- }, u.extractText = function() {
- var e = c("#live-editor-iframe")[0],
- t = (e.contentWindow || e).document;
- c(t).find("[data-bolt-field]").each(function() {
- var e = c('form[name="content_edit"]'),
- t = c(this).data("bolt-field"),
- i = e.find("[name=" + u.escapejQuery(t) + "]"),
- n = i.closest("[data-bolt-fieldset]").data("bolt-fieldset");
- if ("html" === n) {
- var a = i.attr("id");
- o.instances.hasOwnProperty(a) && o.instances[a].setData(c(this).data("src"))
- } else i.val(u.cleanText(c(this), n))
- })
- }, u.cleanText = function(e, t) {
- return "textarea" === t && e.html(e.html().replace(/ /g, " ").replace(/\s?<br.*?>\s?/g, "\n")), e.text()
- }, u.escapejQuery = function(e) {
- return e.replace(/[:\.\[\],]/g, "\\$1")
- }, u.active = !1, u.previewUrl = null, d.liveEditor = u
- }(Bolt || {}, jQuery, window, "undefined" != typeof CKEDITOR ? CKEDITOR : void 0),
- function(t, n, i) {
- "use strict";
- var e = {
- init: function() {
- var e = n(".omnisearch select");
- e.select2({
- width: "100%",
- placeholder: t.data("omnisearch.placeholder"),
- minimumInputLength: 3,
- multiple: !0,
- ajax: {
- delay: 600,
- url: e.data("omnisearchUrl"),
- dataType: "json",
- data: function(e) {
- return {
- q: e.term
- }
- },
- processResults: function(e) {
- var i = [];
- return n.each(e, function(e, t) {
- i.push({
- id: t.path,
- path: t.path,
- text: t.label
- })
- }), {
- results: i
- }
- }
- },
- templateResult: function(e) {
- var t = e.path ? "<small>" + e.path + "</small>" : "";
- return "<div>" + (e.loading ? '<i class="fa fa-spinner fa-spin"></i> ' : "") + e.text + "</div>" + t
- },
- templateSelection: function(e) {
- return i.location.href = e.path, null
- },
- escapeMarkup: function(e) {
- return e
- }
- })
- }
- };
- t.omnisearch = e
- }(Bolt || {}, jQuery, window),
- function(e, s, l) {
- "use strict";
- var t = {},
- n = 0;
- function r() {
- var e = s("#navpage-content").outerHeight(),
- t = s("#navpage-secondary"),
- i = t.outerHeight(),
- n = s(document).height() - t.position().top,
- a = Math.max(e, n),
- o = 5e3;
- i !== a && (t.outerHeight(a), o = 500), l.setTimeout(r, o)
- }
- t.init = function() {
- var e = !s(".navbar-toggle").is(":visible");
- s(".navbar-toggle").on("click", function() {
- var e = s("#navpage-wrapper");
- e.hasClass("nav-secondary-opened") ? e.removeClass("nav-secondary-opened nav-secondary-collapsed") : e.removeClass("nav-secondary-collapsed").addClass("nav-secondary-opened")
- }), s(".nav-secondary-collapse a").on("click", function() {
- return s("#navpage-wrapper").removeClass("nav-secondary-opened").addClass("nav-secondary-collapsed"), setTimeout(function() {
- s("#navpage-wrapper").addClass("nav-secondary-collapsed-hoverable")
- }, 300), s.cookie("sidebar", "collapsed", {
- expires: 21,
- path: "/"
- }), s("#bolt-footer").addClass("bolt-footer-hidden"), !1
- }), s(".nav-secondary-expand a").on("click", function() {
- return s("#navpage-wrapper").removeClass("nav-secondary-collapsed nav-secondary-opened nav-secondary-collapsed-hoverable"), s.removeCookie("sidebar", {
- path: "/"
- }), s("#bolt-footer").removeClass("bolt-footer-hidden"), !1
- }), s("#navpage-secondary").length && r(), e ? s("#navpage-secondary").find("a.menu-pop").each(function() {
- var e = s(this),
- t = "";
- e.nextAll(".submenu").children().each(function() {
- s(this).hasClass("subdivider") && (t += "<hr>"), t += s(this).html().trim().replace(/[ \n]+/g, " ").replace(/(>) | (<)/g, "$1$2")
- }), e.popover({
- trigger: "manual",
- content: t,
- html: !0
- }), e.on("mouseover focus click dblclick", function(e) {
- var t = this,
- i = 300;
- "click" !== e.type || s(t).next().hasClass("popover") || (e.preventDefault(), i = 0), l.clearTimeout(n), n = l.setTimeout(function() {
- s("#navpage-secondary a.menu-pop").not(t).popover("hide"), s(t).popover("show")
- }, i)
- })
- }).end().on("mouseenter focus", ".popover", function() {
- l.clearTimeout(n)
- }).on("mouseleave blur", "a.menu-pop, .popover", function() {
- l.clearTimeout(n), n = l.setTimeout(function() {
- s("#navpage-secondary a.menu-pop").popover("hide")
- }, 300)
- }) : s("#navpage-secondary a.menu-pop").on("click", function(e) {
- var t = s(this).nextAll(".submenu");
- e.preventDefault(), t.hasClass("show") ? t.removeClass("show") : (s("#navpage-secondary .submenu").removeClass("show"), t.addClass("show"))
- })
- }, e.secmenu = t
- }(Bolt || {}, jQuery, window),
- function(t, n) {
- "use strict";
- var a = {
- init: function() {
- n("a[data-bolt-addtostack]").each(function() {
- n(this).on("click", function(e) {
- var t = n(e.currentTarget),
- i = t.data("bolt-addtostack");
- e.preventDefault(), a.addToStack(i, t)
- })
- })
- },
- addToStack: function(e, i) {
- n.post(t.conf("stackAddUrl"), {
- filename: e
- }).done(function(t) {
- i && n(i).addClass("disabled"), n(":bolt-buicStack").buicStack("prepend", t.panel, t.removed), t.removed && n(".select-from-stack [data-file]").each(function() {
- n(this).data("file").fullPath === t.removed && n(this).remove()
- }), n(".select-from-stack").each(function() {
- var e = n(this).data("type");
- e && t.type !== e || n(this).prepend(t.list)
- })
- }).fail(function() {
- console.error("Failed to add file to stack")
- })
- }
- };
- t.stack = a
- }(Bolt || {}, jQuery),
- function(i) {
- "use strict";
- var e = {
- humanBytes: function(e) {
- for (var t = -1; ++t < 8 && 1e3 <= Math.abs(e);) e /= 1e3;
- return (e = "object" == typeof Intl && Intl && "function" == typeof Intl.NumberFormat ? e.toLocaleString(i.conf("locale.long").replace(/_/g, "-"), {
- maximumSignificantDigits: 3
- }) : e.toFixed(2)) + " " + " kMGTPEZY" [t].trim() + "B"
- },
- filterInt: function(e, t) {
- return /^(\-|\+)?([0-9]+|Infinity)$/.test(e) ? Number(e) : t || NaN
- },
- debounce: function(n, a, o) {
- var s;
- return function() {
- var e = this,
- t = arguments,
- i = o && !s;
- clearTimeout(s), s = setTimeout(function() {
- s = null, o || n.apply(e, t)
- }, a), i && n.apply(e, t)
- }
- }
- };
- i.utils = e
- }(Bolt || {}),
- function(e) {
- "use strict";
- jQuery.widget("bolt.baseField", {
- _create: function() {}
- })
- }(),
- function(a) {
- "use strict";
- var o = {};
- a.widget("bolt.baseInterval", {
- options: {
- delay: 1e4
- },
- _create: function() {
- var e = this,
- t = this.widgetName;
- if (!o[t]) {
- var i = a.Callbacks(),
- n = setInterval(i.fire, this.options.delay);
- o[t] = {
- id: n,
- delay: this.options.delay,
- callbacks: i
- }
- }
- this._fncUpdate = function() {
- e._update()
- }, o[t].callbacks.add(this._fncUpdate)
- },
- _destroy: function() {
- var e = this.widgetName;
- o[e].callbacks.remove(this._fncUpdate), o[e].callbacks.has() || (clearInterval(o[e].id), delete o[e])
- }
- })
- }(jQuery),
- function(l) {
- "use strict";
- l.widget("bolt.buicBrowser", {
- options: {
- url: "",
- multiselect: !1
- },
- _create: function() {
- this._url = this.options.url, this._on({
- click: function() {
- this._browse()
- }
- })
- },
- _browse: function() {
- var a = this,
- e = {
- multiselect: this.options.multiselect
- },
- o = [],
- s = !1;
- l("body").buicModal({
- size: "large",
- remote: {
- url: a._url,
- data: e
- },
- loaded: function(e, n) {
- var i = n.footer.find("[data-fbrowser-add-checked]");
- n.header.on("click.bolt", "[data-fbrowser-chdir]", function(e) {
- e.preventDefault(), a._url = l(this).data("fbrowser-chdir"), a._browse()
- }), n.body.on("click.bolt", "[data-fbrowser-chdir]", function(e) {
- e.preventDefault(), a._url = l(this).data("fbrowser-chdir"), a._browse()
- }).on("click.bolt", "[data-file] a", function(e) {
- e.preventDefault();
- var t = l(this).closest("[data-file]").data("file");
- a._trigger("selected", null, t), n.close()
- }).on("click.bolt", "[aria-pressed]", function(e) {
- var t = "false" === l(this).attr("aria-pressed"),
- i = this.className.replace("toogle-", "");
- l(this).attr("aria-pressed", t ? "true" : "false"), n.body.find("tbody." + i).toggleClass("hidden", !t), 0 < e.clientX && this.blur()
- }).on("change", 'select[name="ext"]', function() {
- a._filter(n)
- }).keyup('input[name="filter"]', function() {
- a._filter(n)
- }).on("change", "[data-fbrowser-check]", function() {
- var e = l(this).closest("[data-file]").data("file"),
- t = o.indexOf(e.fullPath); - 1 < t ? (o.splice(t, 1), s = !1, 0 === o.length && i.addClass("disabled")) : (o.push(e.fullPath), i.removeClass("disabled"))
- }), n.footer.on("click.bolt", ".toggle-all", function(e) {
- e.preventDefault(), s ? (n.body.find("[data-fbrowser-check]").each(function() {
- l(this).prop("checked", !1)
- }), o.length = 0, s = !1, i.addClass("disabled")) : (n.body.find("[data-fbrowser-check]").each(function() {
- l(this).prop("checked", !0);
- var e = l(this).closest("[data-file]").data("file");
- o.push(e.fullPath)
- }), s = !0, i.removeClass("disabled"))
- }).on("click.bolt", "[data-fbrowser-add-checked]:not(.disabled)", function(e) {
- e.preventDefault(), n.body.find("[data-fbrowser-check]").each(function() {
- if (l(this).prop("checked")) {
- var e = l(this).closest("[data-file]").data("file");
- a._trigger("selected", null, e)
- }
- }), n.close()
- })
- }
- })
- },
- _filter: function(e) {
- var t, i, n = e.body.find('input[name="filter"]').val(),
- a = e.body.find('select[name="ext"]').val();
- e.body.find("[data-file],[data-folder]").each(function() {
- t = l(this).data("file") || l(this).data("folder"), i = "" !== a && t.extension !== a || "" !== n && t.filename.search(n) < 0, l(this).toggleClass("hidden", i), i || l(this).find("a, span").each(function() {
- l(this).html(t.filename.replace(n, "<mark>" + n + "</mark>"))
- })
- })
- }
- })
- }(jQuery),
- function(e) {
- "use strict";
- jQuery.widget("bolt.buicCheckbox", {
- _create: function() {
- var e = this.element.find("button"),
- t = this.element.find("input");
- this._on(e, {
- click: function() {
- t.prop("checked", !t.prop("checked"))
- }
- })
- }
- })
- }(),
- function(l, r) {
- "use strict";
- l.widget("bolt.buicListing", {
- _create: function() {
- this.csrfToken = this.element.data("bolt_csrf_token"), this.contentType = this.element.data("contenttype"), this.contentTypeName = this.element.data("contenttype-name"), this.element.find("table.listing tbody").buicListingPart()
- },
- modifyRecords: function(e, t, i) {
- var n, a = this,
- o = {},
- s = {
- delete: {
- safe: !1,
- name: r.data("recordlisting.action.delete", {
- "%CTNAME%": this.contentTypeName
- }),
- cmd: {
- delete: null
- }
- },
- publish: {
- safe: !0,
- name: r.data("recordlisting.action.publish", {
- "%CTNAME%": this.contentTypeName
- }),
- cmd: {
- modify: {
- status: "published"
- }
- }
- },
- depublish: {
- safe: !0,
- name: r.data("recordlisting.action.depublish"),
- cmd: {
- modify: {
- status: "held"
- }
- }
- },
- draft: {
- safe: !0,
- name: r.data("recordlisting.action.draft"),
- cmd: {
- modify: {
- status: "draft"
- }
- }
- }
- };
- o[a.contentType] = {}, l(t).each(function() {
- o[a.contentType][this] = s[e].cmd
- }), n = (n = 1 === t.length ? r.data("recordlisting.confirm.one") : r.data("recordlisting.confirm.multi", {
- "%NUMBER%": "<b>" + t.length + "</b>"
- })) + "<br><br><b>" + r.data("recordlisting.confirm.no-undo") + "</b>", s[e].safe ? a._sendModifyRecordsQuery(o) : bootbox.dialog({
- message: n,
- title: s[e].name,
- buttons: {
- cancel: {
- label: r.data("recordlisting.action.cancel"),
- className: "btn-default"
- },
- ok: {
- label: i,
- className: "btn-danger",
- callback: function() {
- a._sendModifyRecordsQuery(o)
- }
- }
- }
- })
- },
- _sendModifyRecordsQuery: function(e) {
- var t = this;
- l.ajax({
- url: r.conf("contentActionUrl"),
- type: "POST",
- data: {
- bolt_csrf_token: t.csrfToken,
- contenttype: t.contentType,
- actions: e
- },
- success: function(e) {
- t.element.html(e), t.element.find("table.listing tbody").buicListingPart()
- },
- error: function(e, t, i) {
- console.error(e.status + " (" + i + "):"), console.error(JSON.parse(e.responseText))
- },
- dataType: "html"
- })
- }
- })
- }(jQuery, Bolt),
- function(a) {
- "use strict";
- a.widget("bolt.buicListingPart", {
- _create: function() {
- var t = this;
- this.listing = this.element.closest(":bolt-buicListing"), this.toolbar = this.element.find("tr.selectiontoolbar"), this.toolbarCount = this.toolbar.find("div.count"), this.menu = this.element.find("tr.header th.menu"), this.menuOnlyOnSelection = this.menu.find("li:not(.select-all)"), this.menuSelectionCount = this.menu.find("li.dropdown-header"), this.menuSelectionCountTemplate = this.menuSelectionCount.text(), this.selectedIds = [], this.menu.find("li.select-all, li.select-none").on("click", function() {
- var e = a(this).hasClass("select-all");
- t.element.find('td input:checkbox[name="checkRow"]').each(function() {
- this.checked = e, t._update(this)
- })
- }), this.element.find('td input:checkbox[name="checkRow"]').on("click", function() {
- t._update(this)
- }), this.toolbar.find('button[data-stb-cmd^="record:"]').on("click", function() {
- t._modifyRecords(a(this).data("stb-cmd"), t.selectedIds, a(this).html())
- }), this.element.find('a[data-listing-cmd^="record:"]').on("click", function() {
- t._modifyRecords(a(this).data("listing-cmd"), [a(this).parents("tr").attr("id").substr(5)], a(this).html())
- })
- },
- _modifyRecords: function(e, t, i) {
- 0 < t.length && this.listing.buicListing("modifyRecords", e.replace(/^record:/, ""), t, i)
- },
- _update: function(e) {
- var t, i = a(e).closest("tr"),
- n = i.attr("id").substr(5);
- e.checked ? (-1 === this.selectedIds.indexOf(n) && this.selectedIds.push(n), i.addClass("row-selected")) : (this.selectedIds.splice(this.selectedIds.indexOf(n), 1), i.removeClass("row-selected")), (t = this.selectedIds.length) ? (this.toolbar.removeClass("hidden"), this.menuOnlyOnSelection.removeClass("hidden")) : (this.toolbar.addClass("hidden"), this.menuOnlyOnSelection.addClass("hidden")), this.toolbarCount.text(t), this.menuSelectionCount.text(this.menuSelectionCountTemplate.replace("(#)", "(" + t + ")"))
- }
- })
- }(jQuery),
- function(l) {
- "use strict";
- l.widget("bolt.buicModal", {
- options: {
- size: void 0,
- closer: !1,
- classname: void 0,
- headline: void 0,
- header: void 0,
- body: void 0,
- footer: void 0,
- remote: void 0,
- loaded: void 0
- },
- _create: function() {
- var e = this,
- t = l('<div class="modal-header hidden"/>'),
- i = l("<div class=modal-body/>"),
- n = l('<div class="modal-footer hidden"/>'),
- a = l("<div class=modal-content/>").append(t, i, n),
- o = l("<div class=modal-dialog role=document/>").append(a),
- s = l('<div tabindex=-1 role=dialog class="modal fade buic-modal"/>').append(o);
- this._ui = {
- header: t,
- body: i,
- footer: n,
- content: a,
- dialog: o,
- modal: s
- }, this._on(this.element, {
- "click .modal-retry": function() {
- e._load()
- }
- }), e.element.prepend(e._ui.modal), e._ui.modal.on("show.bs.modal", function() {
- e._fire("show")
- }).on("shown.bs.modal", function() {
- e._fire("shown")
- }).on("hide.bs.modal", function() {
- e._fire("hide")
- }).on("hidden.bs.modal", function() {
- e._fire("hidden"), e.destroy()
- }).modal("show")
- },
- _destroy: function() {
- this._ui.modal.data("modal", null).remove()
- },
- _fire: function(e) {
- var t = this;
- t._trigger(e, null, {
- close: function() {
- t._ui.modal.modal("hide")
- },
- header: t._ui.header,
- body: t._ui.body,
- footer: t._ui.footer
- })
- },
- _init: function() {
- this._ui.dialog.toggleClass("modal-sm", "small" === this.options.size).toggleClass("modal-lg", "large" === this.options.size), this.options.remote ? this._load() : this._update()
- },
- _load: function() {
- var a = this;
- a._ui.content.addClass("modal-loading"), l.get(a.options.remote.url, a.options.remote.data || {}).done(function(n) {
- a.options.classname = l(n)[0].className, l.each(["header", "body", "footer"], function(e, t) {
- var i = l(n).children(t.replace("body", "main"))[0];
- a.options[t] = i ? i.innerHTML : void 0
- }), a._update(), a._fire("loaded")
- }).fail(function() {
- a.options.header = void 0, a.options.body = '<button type=button class="btn btn-default modal-retry"><i class="fa fa-refresh"></i></button>', a.options.footer = void 0, a._update()
- }).always(function() {
- a._ui.content.removeClass("modal-loading")
- })
- },
- _update: function() {
- var i, n = this;
- void 0 !== this.options.headline && (this.options.header = l(), this.options.closer && (this.options.header = this.options.header.add('<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>')), this.options.header = this.options.header.add(l('<h4 class="modal-title"/>').append(this.options.headline))), this._ui.content.attr("class", "modal-content").addClass(this.options.classname), l.each(["header", "body", "footer"], function(e, t) {
- i = l("<div>").append(n.options[t]).html() || "", n._ui[t].off().toggleClass("hidden", !i.length).html(i)
- }), this._ui.modal.modal("handleUpdate")
- }
- })
- }(jQuery),
- function(e, t) {
- "use strict";
- e.widget("bolt.buicMoment", e.bolt.baseInterval, {
- options: {
- delay: 15e3,
- titleFormat: "YYYY-MM-DD HH:mm:ss ZZ"
- },
- _create: function() {
- this.set(), this._super()
- },
- _update: function() {
- this.element.html(t(this.element.attr("datetime")).fromNow())
- },
- set: function(e) {
- e ? this.element.attr("datetime", t(e).format()) : e = this.element.attr("datetime"), this.element.attr("title", t(e).format(this.options.titleFormat)), this._update()
- }
- })
- }(jQuery, moment),
- function(n) {
- "use strict";
- n.widget("bolt.buicProgress", {
- _create: function() {
- this.bars = {}, this.element.addClass("buic-progress")
- },
- _set: function(e, t) {
- t = parseFloat(t), t = isNaN(t) ? 0 : Math.min(100, Math.max(0, Math.round(100 * t))), this.bars[e] && this.bars[e].find(".progress-bar").attr("aria-valuenow", t).css("width", t + "%")
- },
- add: function(e, t, i) {
- this.bars[e] || (this.bars[e] = n('<div class="progress"><div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100"></div></div>'), this.bars[e].attr("data-label", i || e).find(".progress-bar").text(i || e), this._set(e, t), this.element.append(this.bars[e]).show(), this.bars[e].show(300))
- },
- remove: function(e) {
- if (this.bars[e]) {
- var t = this,
- i = this.bars[e];
- delete this.bars[e], i.hide(300, function() {
- i.remove(), 0 === Object.keys(t.bars).length && t.element.hide()
- })
- }
- },
- set: function(e, t) {
- this._set(e, t)
- }
- })
- }(jQuery),
- function(e) {
- "use strict";
- jQuery.widget("bolt.buicSelect", {
- _create: function() {
- this.select = this.element.find("select"), this.buttonAll = this.element.find(".select-all"), this.buttonNone = this.element.find(".select-none"), this.buttonAll.prop("title", this.buttonAll.text().trim()), this._on(this.buttonAll, {
- click: function() {
- this.all()
- }
- }), this.buttonNone.prop("title", this.buttonNone.text().trim()), this._on(this.buttonNone, {
- click: function() {
- this.none()
- }
- }), this._update(), this._on(this.select, {
- change: function() {
- this._update()
- }
- })
- },
- _update: function() {
- var e = this.select.find("option"),
- t = e.length,
- i = e.filter(":selected").length,
- n = this.select.prop("multiple") ? 0 === i : "" === this.select.val();
- this.buttonAll.prop("disabled", i === t), this.buttonNone.prop("disabled", n)
- },
- all: function() {
- this.select.find("option").prop("selected", !0).trigger("change")
- },
- none: function() {
- this.select.val(null).trigger("change")
- }
- })
- }(),
- function(i, n) {
- "use strict";
- i.widget("bolt.buicStack", {
- _addPath: function(e, t) {
- n.stack.addToStack(t.path)
- },
- _create: function() {
- var e = this.element;
- this._ui = {
- holder: e.find(".stackholder")
- }, this._on({
- buicbrowserselected: this._addPath,
- buicuploaduploaded: this._addPath
- }), e.on("inserted.bs.popover", ".stackitem", function() {
- n.app.initWidgets()
- }), e.buicUpload()
- },
- prepend: function(e, t) {
- t && this._ui.holder.find("[data-file]").each(function() {
- i(this).data("file").fullPath === t && i(this).remove()
- }), this._ui.holder.find(".empty").remove(), this._ui.holder.prepend(e), this._ui.holder.find(".info-pop").popover({
- trigger: "hover",
- delay: {
- show: 500,
- hide: 200
- }
- })
- }
- })
- }(jQuery, Bolt),
- function(l, r) {
- "use strict";
- l.widget("bolt.buicUpload", {
- _create: function() {
- var e = this.element,
- t = l("input[type=file]", e),
- i = l(".elm-dropzone", e),
- n = l(t).attr("accept"),
- a = n ? n.replace(/^\./, "").split(/,\./) : [],
- o = new RegExp("(\\.|\\/)(" + a.join("|") + ")$", "i");
- if (null === this.options.maxSize) {
- var s = Math.floor(r.conf("uploadConfig.maxSize"));
- this.options.maxSize = r.utils.filterInt(s, 2e6)
- }
- this._ui = {
- progress: null
- }, t.fileupload({
- dataType: "json",
- dropZone: i,
- pasteZone: null,
- maxFileSize: 0 < this.options.maxSize ? this.options.maxSize : void 0,
- minFileSize: void 0,
- acceptFileTypes: n ? o : void 0,
- maxNumberOfFiles: void 0,
- messages: {
- maxFileSize: ">:" + r.utils.humanBytes(this.options.maxSize),
- minFileSize: "<",
- acceptFileTypes: "T:." + a.join(", ."),
- maxNumberOfFiles: "#"
- }
- }), this._on({
- fileuploadprocessfail: this._onProcessFail,
- fileuploadsubmit: this._onUploadSubmit,
- fileuploadprogress: this._onUploadProgress,
- fileuploadalways: this._onUploadAlways,
- fileuploaddone: this._onUploadDone
- })
- },
- _onProcessFail: function(e, t) {
- var i, n = t.files[t.index],
- a = n.error.substr(0, 1),
- o = {
- "%FILENAME%": n.name,
- "%FILESIZE%": r.utils.humanBytes(n.size),
- "%FILETYPE%": n.type,
- "%ALLOWED%": n.error.substr(2)
- };
- switch (a) {
- case ">":
- i = r.data("field.uploads.template.large-file", o);
- break;
- case "T":
- i = r.data("field.uploads.template.wrong-type", o);
- break;
- default:
- i = "<p>" + n.error + "</p>"
- }
- bootbox.alert(i)
- },
- _onUploadSubmit: function(e, t) {
- this._progress("add", t.files)
- },
- _onUploadProgress: function(e, t) {
- this._progress("set", t.files, t.loaded / t.total)
- },
- _onUploadAlways: function(e, t) {
- this._progress("remove", t.files)
- },
- _onUploadDone: function(i, e) {
- var n = this;
- l.each(e.result, function(e, t) {
- t.error ? bootbox.alert(r.data("field.uploads.template.error", {
- "%ERROR%": t.error
- })) : n._trigger("uploaded", i, t)
- })
- },
- _progress: function(e, t, i) {
- var n = this;
- null === n._ui.progress && (n._ui.progress = l(":bolt-buicProgress", n.element)), l.each(t, function() {
- n._ui.progress.buicProgress(e, this.name, i)
- })
- },
- options: {
- maxSize: null
- }
- })
- }(jQuery, Bolt),
- function(a, o, i) {
- "use strict";
- a.widget("bolt.fieldBlock", a.bolt.baseField, {
- options: {
- name: ""
- },
- _create: function() {
- var i = this;
- this._ui = {
- add: i.element.find(".block-add .add-button"),
- slot: i.element.find(".block-slot")
- }, this._templates = i.element.find('script[type="text/template"]'), i._ui.add.on("click", function(e) {
- i._append(e)
- }), i.element.find(".block-slot").sortable({
- cursor: "move",
- handle: ".panel-heading",
- stop: function(e, t) {
- i._renumber(), i._resetEditors(t.item)
- }
- }), i.element.on("click", ".delete-button", function() {
- var t = a(this).closest(".block-group");
- bootbox.confirm(o.data("editcontent.deleteset"), function(e) {
- a(".alert").alert(), !0 === e && (t.remove(), i._renumber())
- })
- }), i.element.on("click", ".move-up", function() {
- var e = a(this).closest(".block-group");
- e.insertBefore(e.prev(".block-group")), i._renumber(), i._resetEditors(e)
- }), i.element.on("click", ".move-down", function() {
- var e = a(this).closest(".block-group");
- e.insertAfter(e.next(".block-group")), i._renumber(), i._resetEditors(e)
- }), i.element.on("click", ".repeater-collapse", function() {
- var e = a(this).closest(".block-group").find(".panel-body");
- a(this).toggleClass("collapsed"), e.slideToggle()
- }), i.element.on("click", ".hide-all-blocks", function() {
- var e = a(this).closest(".bolt-field-block"),
- t = e.find(".panel-body");
- e.find(".repeater-collapse").addClass("collapsed"), t.slideUp()
- }), i.element.on("click", ".show-all-blocks", function() {
- var e = a(this).closest(".bolt-field-block"),
- t = e.find(".panel-body");
- e.find(".repeater-collapse").removeClass("collapsed"), t.slideDown()
- }), i.element.on("keyup change", "input[type=text]", function() {
- if (a(this).closest(".bolt-field-text").length) {
- var e = a(this).closest(".block-group"),
- t = e.find(".bolt-field-text input:first"),
- i = e.find(".block-heading"),
- n = i.data("default");
- i.text(a(t).val().substring(0, 60) || n)
- }
- })
- },
- _append: function(e) {
- var i, n = a(e.target).data("block-type");
- a.each(this._templates, function(e, t) {
- a(t).data("block-type") === n && (i = a(t).html())
- });
- var t = this._clone(i);
- t.data("block-type", n), this._ui.slot.append(t), this._renumber(), o.datetime.init(), o.ckeditor.init(), init.popOvers()
- },
- _clone: function(e) {
- var i = a(e).clone();
- return i.find("[id]").each(function() {
- var e = a(this).attr("id"),
- t = o.app.buid();
- a(this).attr("id", t), i.find('[for="' + e + '"]').each(function() {
- a(this).attr("for", t)
- })
- }), o.app.initWidgets(i), i
- },
- _renumber: function() {
- var i = new RegExp("^([^\\[]+\\[)([#|\\d]+)(\\].*)$", "gi");
- this._ui.slot.find("div.block-group").each(function(e, t) {
- a(t).find("[name]").each(function() {
- this.name = this.name.replace(i, "$1" + e + "$3")
- }), a(t).is(":first-of-type") ? a(t).find(".move-up").addClass("disabled") : a(t).find(".move-up").removeClass("disabled"), a(t).is(":last-of-type") ? a(t).find(".move-down").addClass("disabled") : a(t).find(".move-down").removeClass("disabled")
- })
- },
- _resetEditors: function(e) {
- e.find(".ckeditor").each(function(e, t) {
- i.instances[t.id] && i.instances[t.id].destroy(), i.replace(t.id)
- })
- }
- })
- }(jQuery, Bolt, "undefined" != typeof CKEDITOR ? CKEDITOR : void 0),
- function(e, t) {
- "use strict";
- e.widget("bolt.fieldCategories", e.bolt.baseField, {
- _create: function() {
- this.element.find("select").select2({
- width: "100%",
- allowClear: !0,
- placeholder: {
- id: "",
- text: t.data("field.categories.text.placeholder")
- }
- })
- }
- })
- }(jQuery, Bolt),
- function(a, o) {
- "use strict";
- a.widget("bolt.fieldEmbed", a.bolt.baseField, {
- _create: function() {
- var e = this,
- t = this.element,
- i = 0;
- this._ui = {
- url: t.find("input.url"),
- width: t.find("input.width"),
- height: t.find("input.height"),
- html: t.find("input.html"),
- ratio: t.find("input.ratio"),
- authorName: t.find("input.author_name"),
- authorUrl: t.find("input.author_url"),
- provider_name: t.find("input.provider_name"),
- thumbnailUrl: t.find("input.thumbnail_url"),
- preview: t.find("img"),
- play: t.find("button.preview"),
- refresh: t.find("button.refresh"),
- spinner: t.find("button.refresh i")
- }, e._ui.url.on("propertychange input", function() {
- clearTimeout(i), i = setTimeout(function() {
- e._update()
- }, 1e3)
- }), e._ui.width.on("propertychange input", function() {
- 0 < e._ui.ratio.val() && e._ui.height.val(Math.round(e._ui.width.val() / e._ui.ratio.val()))
- }), e._ui.height.on("propertychange input", function() {
- 0 < e._ui.ratio.val() && e._ui.width.val(Math.round(e._ui.height.val() * e._ui.ratio.val()))
- }), e._ui.refresh.on("click", function() {
- e._update()
- }), e._ui.play.on("click", function() {
- a("body").buicModal({
- size: "large",
- closer: !0,
- headline: e._ui.provider_name.val(),
- body: e._ui.html.val()
- })
- })
- },
- _update: function() {
- var t = this,
- e = o.data("endpoint.embed"),
- i = a("#id").closest("form").find('input[name="content_edit[_token]"]').val(),
- n = {
- format: "json",
- url: t._ui.url.val(),
- _token: i,
- provider: "oembed"
- };
- n.url.length < 2 ? t._set({}) : (this._ui.refresh.prop("disabled", !0), t._ui.spinner.addClass("fa-spin"), a.post(e, n).done(function(e) {
- t._set(e)
- }).fail(function() {
- t._set({})
- }).always(function() {
- t._ui.spinner.removeClass("fa-spin")
- }))
- },
- _set: function(e) {
- this._ui.html.val(e.html || ""), this._ui.width.val(e.width || ""), this._ui.height.val(e.height || ""), this._ui.authorName.val(e.author_name || ""), this._ui.authorUrl.val(e.author_url || ""), this._ui.provider_name.val(e.provider_name || ""), this._ui.thumbnailUrl.val(e.thumbnail_url || this._ui.preview.data("defaultUrl")), this._ui.refresh.prop("disabled", this._ui.url.val().length <= 2 || 0 < this._ui.html.val().length)
- }
- })
- }(jQuery, Bolt),
- function(n, i) {
- "use strict";
- n.widget("bolt.fieldFile", n.bolt.baseField, {
- _create: function() {
- var i = this,
- e = this.element,
- t = n("input.path", e);
- t.data("selected", {
- path: t.val()
- }), t.autocomplete({
- source: e.find("[data-autocomplete-url]").data("autocompleteUrl"),
- minLength: 2,
- focus: function(e, t) {
- return i._onPreview(e, t.item), !1
- },
- select: function(e, t) {
- return i._onSelect(e, t.item), !1
- },
- close: function() {
- i._onClose()
- }
- }).autocomplete("instance")._renderItem = function(e, t) {
- return n("<li>").append(t.path).appendTo(e)
- }, t.on("change", function() {
- n(this).data("changeWithoutSelection", !0)
- }), t.on("blur", function() {
- n(this).data("changeWithoutSelection") && ("" === n(this).val() ? i._onClear() : i._onClose())
- }), i._on({
- "click.select-from-stack a": i._onSelectFromStack,
- buicbrowserselected: i._onSelect,
- buicuploaduploaded: i._onSelect
- }), e.buicUpload()
- },
- _onPreview: function(e, t) {
- n("input.path", this.element).val(t.path)
- },
- _onSelectFromStack: function(e) {
- var t = n(e.target),
- i = t.parent("[data-file]");
- t.closest(".btn-group").removeClass("open"), this._onSelect(e, i.data("file")), e.preventDefault()
- },
- _onSelect: function(e, t) {
- n("input.path", this.element).data("changeWithoutSelection", !1).data("selected", t).val(t.path).trigger("change"), "click" !== e.type && i.stack.addToStack(t.path)
- },
- _onClose: function() {
- var e = n("input.path", this.element);
- e.val(e.data("selected").path)
- },
- _onClear: function() {
- var e = n("input.path", this.element);
- e.val(""), e.data("selected", {})
- }
- })
- }(jQuery, Bolt),
- function(d, o) {
- "use strict";
- d.widget("bolt.fieldFilelist", d.bolt.baseField, {
- _create: function() {
- var e = this,
- r = this.element;
- this._ui = {
- data: r.find("textarea"),
- list: r.find(".list")
- }, this._lastClickIndex = 0, e.options.isImage = this.options.isImage || !1, e._ui.list.sortable({
- helper: function(e, t) {
- return t.addClass("selected"), d("<div/>")
- },
- start: function(e, t) {
- var i = d(".selected", r).not(".ui-sortable-placeholder"),
- n = i.length,
- a = t.placeholder,
- o = a.outerHeight(!0),
- s = a.height(),
- l = parseInt(a.css("margin-top")) + parseInt(a.css("margin-bottom"));
- i.hide(), a.height(s + (n - 1) * o - l), t.item.data("items", i)
- },
- beforeStop: function(e, t) {
- t.item.before(t.item.data("items"))
- },
- stop: function() {
- d(".selected", r).show(), e._serialize()
- },
- axis: "y",
- delay: 100,
- distance: 5
- }), e._on(e._ui.list, {
- "click.item": e._onSelect,
- "click.remove": e._onRemove,
- "change input": e._serialize
- }), d("input.title", e._ui.list).on("keyup", e._updateTitle), e._on({
- "click.select-from-stack a": e._onSelectFromStack,
- buicbrowserselected: e._onAddPath,
- buicuploaduploaded: e._onAddPath
- }), r.buicUpload()
- },
- _onAddPath: function(e, t) {
- d(">p", this._ui.list).remove(), this._ui.list.append(d(Bolt.data(this.options.isImage ? "field.imagelist.template.item" : "field.filelist.template.item", {
- "%TITLE_A%": t.path.replace(/\.[a-z0-9]+$/, ""),
- "%FILEPATH_E%": d("<div>").text(t.path).html(),
- "%FILEPATH_A%": t.path,
- "%EXT_E%": t.extension.toUpperCase(),
- "%PREVIEW_A%": t.previewListUrl,
- "%URL_A%": t.url
- }))), this._serialize()
- },
- _onRemove: function(e) {
- var t = d(e.target).closest(".item"),
- i = t.hasClass("selected") ? d(".selected", this._ui.list) : t,
- n = this.options.isImage ? "field.imagelist.message.remove" : "field.filelist.message.remove",
- a = this.options.isImage ? "field.imagelist.message.removeMulti" : "field.filelist.message.removeMulti";
- i.addClass("zombie"), confirm(o.data(1 < i.length ? a : n)) ? (d(e.target).closest(".item").remove(), this._serialize()) : i.removeClass("zombie"), e.preventDefault(), e.stopPropagation()
- },
- _onSelect: function(e) {
- var t = d(e.target);
- if (t.hasClass("item"))
- if (e.shiftKey) {
- var i = Math.min(this._lastClickIndex, t.index()),
- n = Math.max(this._lastClickIndex, t.index());
- this._ui.list.children().each(function(e, t) {
- d(t).toggleClass("selected", i <= e && e <= n)
- })
- } else if (e.ctrlKey || e.metaKey) t.toggleClass("selected"), this._lastClickIndex = t.index();
- else {
- var a = this._ui.list.children(".selected").not(t);
- a.removeClass("selected"), t.toggleClass("selected", 0 < a.length || null), this._lastClickIndex = t.index()
- }
- },
- _onSelectFromStack: function(e) {
- var t = d(e.target),
- i = t.closest("[data-file]");
- t.closest(".btn-group").removeClass("open"), this._onAddPath(e, i.data("file")), e.preventDefault()
- },
- _serialize: function() {
- var e = this.options.isImage ? "field.imagelist.template.empty" : "field.filelist.template.empty",
- t = [];
- d(".item", this._ui.list).each(function() {
- t.push({
- filename: d("input.filename", this).val(),
- title: d("input.title", this).val()
- })
- }), this._ui.data.val(JSON.stringify(t)), 0 === t.length && this._ui.list.html(o.data(e))
- },
- _updateTitle: function(e) {
- var t = d(e.target).closest(".item");
- d("a", t).attr("title", d(".title", t).val())
- }
- })
- }(jQuery, Bolt),
- function(a, o) {
- "use strict";
- a.widget("bolt.fieldGeolocation", a.bolt.baseField, {
- options: {
- latitude: "",
- longitude: ""
- },
- _create: function() {
- var e = this,
- t = e.element;
- this._ui = {
- address: t.find(".address"),
- matched: t.find(".matched"),
- mapholder: t.find(".mapholder"),
- spinner: t.find(".mapholder i"),
- latitude: t.find(".latitude"),
- longitude: t.find(".longitude"),
- snap: t.find(".snap")
- }, this._map = null, this._marker = null, this._timeout = 0, e._on({
- "click.expand": e._onExpand,
- "click.compress": e._onExpand
- });
- var i = function() {
- o.events.off("Bolt.GoogleMapsAPI.Load.Done", i), e._initGoogleMap(e.options.latitude, e.options.longitude)
- };
- o.events.on("Bolt.GoogleMapsAPI.Load.Done", i), o.events.on("Bolt.GoogleMapsAPI.Load.Fail", function() {
- e._ui.spinner.removeClass("fa-spinner fa-spin").addClass("fa-refresh").one("click", function() {
- e._ui.spinner.removeClass("fa-refresh").addClass("fa-spinner fa-spin"), o.events.fire("Bolt.GoogleMapsAPI.Load.Request")
- })
- }), o.events.fire("Bolt.GoogleMapsAPI.Load.Request")
- },
- _geoCode: function(n) {
- var a = this;
- n && (new google.maps.Geocoder).geocode(n, function(e, t) {
- var i;
- t === google.maps.GeocoderStatus.OK && (i = n.latLng && !a._ui.snap.is(":checked") ? n.latLng : e[0].geometry.location, a._display(e[0].formatted_address, i.lat(), i.lng()), a._marker.setPosition(i), a._map.setCenter(i))
- }), a._display()
- },
- _display: function(e, t, i) {
- this._ui.matched.val(e || ""), this._ui.latitude.val(t || ""), this._ui.longitude.val(i || "")
- },
- _initGoogleMap: function(e, t) {
- var i = this,
- n = {
- zoom: 15,
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- center: new google.maps.LatLng(e, t),
- streetViewControl: !1
- };
- i._map = new google.maps.Map(i._ui.mapholder[0], n), i._marker = new google.maps.Marker({
- map: i._map,
- position: n.center,
- title: o.data("field.geolocation.marker"),
- draggable: !0,
- animation: google.maps.Animation.DROP,
- icon: i.element.data("pin-icon")
- }), google.maps.event.addListener(i._marker, "mouseup", function() {
- i._geoCode({
- latLng: i._marker.getPosition()
- })
- }), i._ui.address.on("propertychange input", function() {
- clearTimeout(i._timeout), i._timeout = setTimeout(function() {
- var e = i._ui.address.val();
- i._geoCode(2 < e.length ? {
- address: e
- } : void 0)
- }, 800)
- }), a('a[data-toggle="tab"]').on("shown.bs.tab", function() {
- i._ui.mapholder.closest("div.tab-pane").hasClass("active") && google.maps.event.trigger(i._map, "resize")
- })
- },
- _onExpand: function() {
- var e = this._marker.getPosition();
- this._ui.mapholder.parent().toggleClass("expanded"), google.maps.event.trigger(this._map, "resize"), this._map.setCenter(e)
- }
- })
- }(jQuery, Bolt),
- function(e, t) {
- "use strict";
- e.widget("bolt.fieldHtml", e.bolt.baseField, {
- _create: function() {
- t.ckeditor.add(this.element.find(".ckeditor")[0])
- }
- })
- }(jQuery, Bolt),
- function(t) {
- "use strict";
- t.widget("bolt.fieldImage", t.bolt.fieldFile, {
- _create: function() {
- this._super(), t("input.path", this.element).data("selected").previewUrl = this.element.find("img").attr("src")
- },
- _onPreview: function(e, t) {
- this._super(e, t), this.element.find("img").attr("src", t.previewUrl)
- },
- _onSelect: function(e, t) {
- this._super(e, t), this.element.find("img").attr("src", t.previewUrl)
- },
- _onClose: function() {
- this._super();
- var e = t("input.path", this.element);
- this.element.find("img").attr("src", e.data("selected").previewUrl)
- },
- _onClear: function() {
- this._super();
- var e = this.element.find("img");
- e.attr("src", e.data("defaultUrl"))
- }
- })
- }(jQuery),
- function(e) {
- "use strict";
- e.widget("bolt.fieldImagelist", e.bolt.fieldFilelist, {
- _create: function() {
- this.options.isImage = !0, this._super()
- }
- })
- }(jQuery),
- function(e, t) {
- "use strict";
- e.widget("bolt.fieldMarkdown", e.bolt.baseField, {
- _create: function() {
- t.$("textarea[data-uk-htmleditor]", this.element).each(function() {
- var e = t.$(this);
- e.data("htmleditor") || t.htmleditor(e, t.Utils.options(e.attr("data-uk-htmleditor")))
- })
- }
- })
- }(jQuery, "undefined" != typeof UIkit ? UIkit : void 0),
- function(e) {
- "use strict";
- e.widget("bolt.fieldMeta", e.bolt.baseField, {
- _create: function() {
- var e = this.element.find("#statusselect"),
- t = this.element.find("#ownerid");
- e.select2({
- width: "50%",
- minimumResultsForSearch: 1 / 0
- }), t.select2({
- width: "50%",
- minimumResultsForSearch: 1 / 0
- })
- }
- })
- }(jQuery),
- function(i, e) {
- "use strict";
- i.widget("bolt.fieldRelationship", i.bolt.baseField, {
- _create: function() {
- this.element.find("select").select2({
- width: "100%",
- placeholder: {
- id: "",
- text: e.data("field.relationship.text.placeholder")
- },
- allowClear: !0,
- templateSelection: function(e) {
- var t = i(e.element).parent().attr("label");
- return (t ? t + ": " : "") + e.text
- }
- })
- }
- })
- }(jQuery, Bolt),
- function(o, n, i) {
- "use strict";
- o.widget("bolt.fieldRepeater", o.bolt.baseField, {
- options: {
- minimum: 1,
- maximum: 1,
- name: ""
- },
- _create: function() {
- var i = this;
- for (this._ui = {
- add: i.element.find(".add-button"),
- slot: i.element.find(".repeater-slot")
- }, this._template = o(i.element.find('script[type="text/template"]').html()), this._count = i._ui.slot.find("div.repeater-group").length, 0 === i.options.maximum && (i.options.maximum = 1 / 0), i._setCount(), i._ui.add.on("click", function() {
- i._append()
- }), i.element.on("click", ".duplicate-button", function() {
- var e = o(this).closest(".repeater-group"),
- a = i._clone(i._template);
- o(e).find(":input").each(function(e) {
- var t = o(this),
- i = t.attr("id"),
- n = t.val();
- t.hasClass("ckeditor") && void 0 !== CKEDITOR.instances[i] ? o(a).find(":input").eq(e).val(CKEDITOR.instances[i].getData()) : n && o(a).find(":input").eq(e).val(n)
- }), e.after(a), i._setCount(1), i._renumber()
- }), i.element.find(".repeater-slot").sortable({
- cursor: "move",
- handle: ".panel-heading",
- stop: function(e, t) {
- i._renumber(), i._resetEditors(t.item)
- }
- }), i.element.on("click", ".delete-button", function() {
- var t = o(this).closest(".repeater-group");
- bootbox.confirm(n.data("editcontent.deleteset"), function(e) {
- o(".alert").alert(), !0 === e && (t.remove(), i._setCount(-1), i._renumber())
- })
- }), i.element.on("click", ".move-up", function() {
- var e = o(this).closest(".repeater-group");
- e.insertBefore(e.prev(".repeater-group")), i._renumber(), i._resetEditors(e)
- }), i.element.on("click", ".move-down", function() {
- var e = o(this).closest(".repeater-group");
- e.insertAfter(e.next(".repeater-group")), i._renumber(), i._resetEditors(e)
- }), i.element.on("click", ".repeater-collapse", function() {
- var e = o(this).closest(".repeater-group").find(".panel-body");
- o(this).toggleClass("collapsed"), e.slideToggle()
- }), i.element.on("click", ".hide-all-blocks", function() {
- var e = o(this).closest(".bolt-field-repeater"),
- t = e.find(".panel-body");
- e.find(".repeater-collapse").addClass("collapsed"), t.slideUp()
- }), i.element.on("click", ".show-all-blocks", function() {
- var e = o(this).closest(".bolt-field-repeater"),
- t = e.find(".panel-body");
- e.find(".repeater-collapse").removeClass("collapsed"), t.slideDown()
- }), i.element.on("keyup change", "input[type=text]", function() {
- if (o(this).closest(".bolt-field-text").length) {
- var e = o(this).closest(".repeater-group"),
- t = e.find(".bolt-field-text input:first"),
- i = e.find(".repeater-heading"),
- n = i.data("default");
- i.text(o(t).val().substring(0, 60) || n)
- }
- }); i._count < i.options.minimum;) i._append()
- },
- _append: function() {
- var e = this._clone(this._template);
- this._ui.slot.append(e), this._setCount(1), this._renumber(), n.datetime.init(), n.ckeditor.init(), init.popOvers()
- },
- _clone: function(e) {
- var i = o(e).clone();
- return i.find("[id]").each(function() {
- var e = o(this).attr("id"),
- t = n.app.buid();
- o(this).attr("id", t), i.find('[for="' + e + '"]').each(function() {
- o(this).attr("for", t)
- })
- }), n.app.initWidgets(i), i
- },
- _renumber: function() {
- var i = this.options.name,
- e = i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
- n = new RegExp("^" + e + "\\[(#|\\d+)\\]");
- this._ui.slot.find("div.repeater-group").each(function(e, t) {
- o(t).find("[name]").each(function() {
- this.name = this.name.replace(n, i + "[" + e + "]")
- }), o(t).is(":first-of-type") ? o(t).find(".move-up").addClass("disabled") : o(t).find(".move-up").removeClass("disabled"), o(t).is(":last-of-type") ? o(t).find(".move-down").addClass("disabled") : o(t).find(".move-down").removeClass("disabled")
- })
- },
- _resetEditors: function(e) {
- e.find(".ckeditor").each(function(e, t) {
- i.instances[t.id] && i.instances[t.id].destroy(), i.replace(t.id)
- })
- },
- _setCount: function(e) {
- this._count += e || 0, this._count >= this.options.maximum ? (this._ui.add.addClass("disabled"), this._ui.add.prop("disabled", "disabled"), this.element.find(".duplicate-button").addClass("disabled"), this.element.find(".duplicate-button").prop("disabled", "disabled")) : (this._ui.add.removeClass("disabled"), this._ui.add.prop("disabled", !1), this.element.find(".duplicate-button").removeClass("disabled"), this.element.find(".duplicate-button").prop("disabled", !1)), this._count <= this.options.minimum ? (this.element.find(".delete-button").addClass("disabled"), this.element.find(".delete-button").prop("disabled", "disabled")) : (this.element.find(".delete-button").removeClass("disabled"), this.element.find(".delete-button").prop("disabled", !1))
- }
- })
- }(jQuery, Bolt, "undefined" != typeof CKEDITOR ? CKEDITOR : void 0),
- function(e, i) {
- "use strict";
- e.widget("bolt.fieldSelect", e.bolt.baseField, {
- options: {
- autocomplete: !1
- },
- _create: function() {
- var e = this.element.find("select"),
- t = {
- width: "100%",
- placeholder: {
- id: "",
- text: i.data("field.select.text.placeholder")
- },
- allowClear: !0,
- minimumResultsForSearch: this.options.autocomplete ? 0 : 1 / 0
- };
- this.options.sortable ? e.select2Sortable(t) : e.select2(t)
- }
- })
- }(jQuery, Bolt),
- function(a) {
- "use strict";
- var o = 1,
- s = 2,
- l = 3;
- a.widget("bolt.fieldSlug", a.bolt.baseField, {
- options: {
- contentId: null,
- key: "",
- slug: "",
- uses: []
- },
- _create: function() {
- var e = this,
- t = this.element;
- this._ui = {
- form: this.element.closest("form"),
- group: t.find(".input-group"),
- data: t.find("input"),
- uses: a()
- }, a("[name]", e._ui.form).each(function() {
- 0 <= e.options.uses.indexOf(this.name.replace(/\[\]$/, "")) && (e._ui.uses = e._ui.uses.add(a(this)))
- }), this._timeout = 0, this._mode = o, this._ui.group.hasClass("linked") ? this._setMode(s) : this._ui.group.hasClass("editable") && (this._mode = l), this._on({
- "click li.lock": function(e) {
- e.preventDefault(), this._setMode(o)
- },
- "click li.link": function(e) {
- e.preventDefault(), this._setMode(s)
- },
- "click li.edit": function(e) {
- e.preventDefault(), this._setMode(l), this.element.find("input").focus()
- },
- "focusout input": function() {
- this._mode === l && this._setMode(o)
- }
- })
- },
- _destroy: function() {
- clearTimeout(this._timeout)
- },
- _setMode: function(e) {
- var t = e === o,
- i = e === s,
- n = e === l;
- a("li.lock", this.element).toggleClass("disabled", t), a("li.link", this.element).toggleClass("disabled", i), a("li.edit", this.element).toggleClass("disabled", n), this._ui.group.toggleClass("locked", t).toggleClass("linked", i).toggleClass("edititable", n), a(".warning", this.element).toggleClass("hidden", !n), this._ui.data.prop("readonly", !n), i ? (this._buildSlug(), this._on(this._ui.uses, {
- change: function() {
- this._buildSlug()
- },
- input: function() {
- this._buildSlug()
- }
- })) : 0 < this._timeout && (clearTimeout(this._timeout), this._timeout = 0, this._off(this._ui.uses, "change"), this._off(this._ui.uses, "input")), this._mode = e
- },
- _buildSlug: function() {
- var i, e = this,
- n = "";
- a.each(e.options.uses, function(e, t) {
- (i = a("#" + t).val()) && (n += ("object" == typeof i ? i.join(" ") : i) + " ")
- }), clearTimeout(e._timeout), e._timeout = setTimeout(function() {
- e._getUri(n.trim())
- }, 200)
- },
- _getUri: function(e) {
- var t = this,
- i = {
- title: e,
- contenttypeslug: t.options.slug,
- id: t.options.contentId,
- slugfield: t.options.key,
- fulluri: !1
- };
- t._ui.group.addClass("loading"), a.get(t._ui.data.data("createSlugUrl"), i).done(function(e) {
- t._mode === s && t._ui.data.val(e)
- }).fail(function() {
- console.error("Failed to get URI for " + t.options.slug + "/" + t.options.contentId)
- }).always(function() {
- t._ui.group.removeClass("loading")
- })
- }
- })
- }(jQuery),
- function(s) {
- "use strict";
- s.widget("bolt.fieldTags", s.bolt.baseField, {
- options: {
- allowSpaces: !1
- },
- _create: function() {
- var o = this.element.find("select"),
- i = this.element.find(".tagcloud"),
- e = [","];
- this.options.allowSpaces || e.push(" "), o.select2({
- width: "100%",
- tags: {},
- minimumInputLength: 1,
- tokenSeparators: e
- }), s.ajax({
- url: this.element.data("tagsUrl"),
- dataType: "json",
- success: function(e) {
- for (var t = o.val() || [], i = e.length, n = "", a = 0; a < i; a++) t.indexOf(e[a].name) < 0 && (t.push(e[a].name), n += '<option value="' + e[a].name + '">' + e[a].name + "</option>");
- o.append(s(n)).trigger("change")
- }
- }), i && s.ajax({
- url: this.element.data("popularTagsUrl"),
- dataType: "json",
- data: {
- limit: 40
- },
- success: function(e) {
- 0 < e.length && (s.each(e, function(e, t) {
- i.append(s("<button/>", {
- type: "button",
- text: t.name,
- rel: t.count
- })).append("")
- }), i.find("button").on("click", function() {
- var e = s(this).text(),
- t = o.find('option[value="' + e + '"]');
- 0 < t.length ? t = t.not(":selected").attr("selected", !0).trigger("change") : o.append(s("<option/>", {
- value: e,
- text: e,
- selected: !0
- })).trigger("change")
- }), s.fn.tagcloud.defaults = {
- size: {
- start: 10,
- end: 20,
- unit: "px"
- },
- color: {
- start: "#888",
- end: "#194770"
- }
- }, i.find("button").tagcloud(), i.css("display", "block"))
- }
- })
- }
- })
- }(jQuery),
- function(o, s) {
- "use strict";
- o.widget("bolt.fieldTemplateselect", o.bolt.baseField, {
- options: {
- currentHas: !1,
- current: "",
- fieldTemplates: []
- },
- _create: function() {
- var t = this,
- i = t.element.find("select"),
- n = t.element.find("p"),
- a = n.parent();
- i.select2({
- width: "100%",
- allowClear: !0,
- placeholder: {
- id: "",
- text: s.data("field.templateselect.text.default")
- },
- minimumResultsForSearch: 1 / 0
- }), i.on("change", function() {
- if (a.addClass("hidden"), n.html("").removeClass("text-danger"), i.val() !== t.options.current)
- if (t.options.currentHas) {
- n.html(s.data("field.templateselect.template.warning", {
- "%STATUS%": s.data("field.templateselect.message.status"),
- "%MESSAGE%": s.data("field.templateselect.message.warning")
- }));
- var e = !0;
- o('[name^="templatefields"]').each(function() {
- "checkbox" !== o(this).attr("type") && "SELECT" !== o(this).prop("tagName") && "" !== o(this).val() && (e = !1), "checkbox" === o(this).attr("type") && o(this).prop("checked") && (e = !1)
- }), e ? o("#tabindicator-tab-template").hide() : (n.addClass("text-danger"), a.removeClass("hidden"))
- } else -1 < t.options.fieldTemplates.indexOf(i.val()) && (n.html(s.data("field.templateselect.message.change")), a.removeClass("hidden"), o("#tabindicator-tab-template").show())
- })
- }
- })
- }(jQuery, Bolt),
- function(e) {
- "use strict";
- e.widget("bolt.fieldText", e.bolt.baseField, {
- _create: function() {}
- })
- }(jQuery),
- function(e) {
- "use strict";
- e.widget("bolt.fieldTextarea", e.bolt.baseField, {
- _create: function() {}
- })
- }(jQuery),
- function(a, o) {
- "use strict";
- a.widget("bolt.fieldVideo", a.bolt.baseField, {
- _create: function() {
- var e = this,
- t = this.element,
- i = 0;
- this._ui = {
- url: t.find("input.url"),
- width: t.find("input.width"),
- height: t.find("input.height"),
- html: t.find("input.html"),
- ratio: t.find("input.ratio"),
- authorName: t.find("input.authorname"),
- authorUrl: t.find("input.authorurl"),
- title: t.find("input.title"),
- thumbnailUrl: t.find("input.thumbnailurl"),
- preview: t.find("img"),
- play: t.find(".imageholder button"),
- refresh: t.find("button.refresh"),
- spinner: t.find("button.refresh i")
- }, e._ui.url.on("propertychange input", function() {
- clearTimeout(i), i = setTimeout(function() {
- e._update()
- }, 1e3)
- }), e._ui.width.on("propertychange input", function() {
- 0 < e._ui.ratio.val() && e._ui.height.val(Math.round(e._ui.width.val() / e._ui.ratio.val()))
- }), e._ui.height.on("propertychange input", function() {
- 0 < e._ui.ratio.val() && e._ui.width.val(Math.round(e._ui.height.val() * e._ui.ratio.val()))
- }), e._ui.refresh.on("click", function() {
- e._update()
- }), e._ui.play.on("click", function() {
- a("body").buicModal({
- size: "large",
- closer: !0,
- headline: e._ui.title.val(),
- body: e._ui.html.val()
- })
- })
- },
- _update: function() {
- var t = this,
- e = o.data("endpoint.embed"),
- i = a("#id").closest("form").find('input[name="content_edit[_token]"]').val(),
- n = {
- format: "json",
- url: t._ui.url.val(),
- _token: i,
- provider: "oembed"
- };
- n.url.length < 2 ? t._set({}) : (this._ui.refresh.prop("disabled", !0), t._ui.spinner.addClass("fa-spin"), a.post(e, n).done(function(e) {
- t._set(e)
- }).fail(function() {
- t._set({})
- }).always(function() {
- t._ui.spinner.removeClass("fa-spin")
- }))
- },
- _set: function(e) {
- var t = e.thumbnail_url || this._ui.preview.data("defaultUrl");
- this._ui.html.val(e.html || ""), this._ui.width.val(e.width || ""), this._ui.height.val(e.height || ""), this._ui.ratio.val(e.width && e.height ? e.width / e.height : ""), this._ui.authorName.val(e.author_name || ""), this._ui.authorUrl.val(e.author_url || ""), this._ui.title.val(e.title || ""), this._ui.thumbnailUrl.val(e.thumbnail_url || ""), this._ui.preview.attr("src", t), e.html ? this._ui.play.removeClass("hidden") : this._ui.play.addClass("hidden"), this._ui.refresh.prop("disabled", this._ui.url.val().length <= 2 || 0 < this._ui.html.val().length)
- }
- })
- }(jQuery, Bolt),
- function(n, a) {
- "use strict";
- n.widget("bolt.panelActivity", n.bolt.baseInterval, {
- options: {
- delay: 3e4
- },
- _create: function() {
- this._super()
- },
- _update: function() {
- var i = this;
- n.get(i.element.data("url")).done(function(e) {
- var t = n(e);
- a.app.initWidgets(t), i.element.html(t)
- })
- }
- })
- }(jQuery, Bolt), Bolt.validation = function() {
- "use strict";
- function E(e) {
- var t = !0,
- i = e.value,
- n = e.getAttribute("type"),
- a = "checkbox" === n || "radio" === n,
- o = e.getAttribute("required"),
- s = e.getAttribute("minlength"),
- l = e.getAttribute("maxlength"),
- r = e.getAttribute("pattern");
- return e.disabled || (t = (t = t && (!o || a && e.checked || !a && "" !== i)) && (a || (!s || i.length >= s) && (!l || i.length <= l))) && r && (t = (r = new RegExp("^(?:" + r + ")$")).test(i)), t
- }
- function T(e, t) {
- void 0 !== e.willValidate ? e.setCustomValidity(t) : e.validity.valid = "" === t
- }
- function o(e) {
- var t, i, n, a, o, s, l, r, d, c = void 0 !== e.willValidate,
- u = e.value,
- p = "",
- f = $(e).data("validate");
- if (f) {
- for (i in f)
- if (f.hasOwnProperty(i)) {
- switch (n = f[i], i) {
- case "float":
- p = "" === (d = u) || d.match(/^[-+]?[0-9]*[,.]?[0-9]+([eE][-+]?[0-9]+)?$/) ? "" : Bolt.data("validation.float");
- break;
- case "required":
- r = u, p = !0 === n && "" === r ? Bolt.data("validation.required") : "";
- break;
- case "min":
- l = n, p = "" !== (s = u) && Number(s.replace(",", ".")) < l ? Bolt.data("validation.min", {
- "%MINVAL%": l
- }) : "";
- break;
- case "max":
- o = n, p = "" !== (a = u) && Number(a.replace(",", ".")) > o ? Bolt.data("validation.max", {
- "%MAXVAL%": o
- }) : "";
- break;
- default:
- console.error("UNKNOWN VALIDATION" + i + " -> " + n)
- }
- if (p) break
- }
- T(e, p)
- } else if (c ? ("INPUT" === e.nodeName && e.type !== e.getAttribute("type") && e.setCustomValidity(E(e) ? "" : "error"), e.checkValidity()) : (e.validity = e.validity || {}, e.validity.valid = E(e)), t = "TEXTAREA" === e.nodeName && $(e).hasClass("ckeditor")) {
- var h = CKEDITOR.instances[e.id];
- h && T(e, !0 === h._.required && "" === h.getData().trim() ? "Required" : "")
- }
- var m, g, v, b, _, k, w, y, x, C = "notice--" + e.id;
- return $("#" + C).remove(), e.validity.valid ? (y = e, x = t, $(y).removeClass("error"), x && $("#cke_" + y.id).removeClass("cke_error"), !0) : (k = e, w = t, $(k).addClass("error"), w && $("#cke_" + k.id).addClass("cke_error"), m = C, g = e, v = p, _ = (_ = $('label[for="' + g.id + '"]').contents().first().text().trim() || g.name).replace(/(.*):+$/g, "$1"), b = Bolt.data("validation.alertbox", {
- "%NOTICE_ID%": m,
- "%FIELD_ID%": g.id,
- "%FIELD_NAME%": _,
- "%MESSAGE%": v || $(g).data("errortext") || Bolt.data("validation.generic_msg")
- }), $(b).hide().insertAfter(".page-header").slideDown("fast"), !1)
- }
- return {
- run: function(e) {
- var t, i, n = e.elements.length,
- a = !0;
- for (t = 0; t < n; t++) "INPUT" !== (i = e.elements[t]).nodeName && "TEXTAREA" !== i.nodeName && "SELECT" !== i.nodeName || ("INPUT" === i.nodeName && (i.value = i.value.trim()), !1 === o(i) && (a = !1));
- return a
- }
- }
- }();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement