hoodcms 5.0.5 → 5.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/admin.css +1 -1
- package/dist/css/app.css +1 -1
- package/dist/css/button.css +1 -1
- package/dist/css/editor.css +1 -1
- package/dist/css/install.css +1 -1
- package/dist/css/login.css +1 -1
- package/dist/js/admin.js +8 -6
- package/dist/js/app.js +7 -6
- package/dist/js/core/Alerts.d.ts +22 -0
- package/dist/js/core/Alerts.js +151 -0
- package/dist/js/core/BaseSite.d.ts +6 -0
- package/dist/js/core/BaseSite.js +14 -0
- package/dist/js/core/ColorPicker.d.ts +5 -0
- package/dist/js/core/ColorPicker.js +71 -0
- package/dist/js/core/DataList.d.ts +35 -0
- package/dist/js/core/DataList.js +56 -0
- package/dist/js/core/Editors.d.ts +16 -0
- package/dist/js/core/Editors.js +137 -0
- package/dist/js/core/Handlers.d.ts +47 -0
- package/dist/js/core/Handlers.js +160 -0
- package/dist/js/core/HoodApi.d.ts +25 -0
- package/dist/js/core/HoodApi.js +22 -0
- package/dist/js/core/Inline.d.ts +27 -0
- package/dist/js/core/Inline.js +63 -0
- package/dist/js/core/Loader.d.ts +5 -0
- package/dist/js/core/Loader.js +13 -0
- package/dist/js/core/Media.d.ts +113 -0
- package/dist/js/core/Media.js +363 -0
- package/dist/js/core/Modal.d.ts +35 -0
- package/dist/js/core/Modal.js +69 -0
- package/dist/js/core/RandomStringGenerator.d.ts +11 -0
- package/dist/js/core/RandomStringGenerator.js +23 -0
- package/dist/js/core/Response.d.ts +20 -0
- package/dist/js/core/Response.js +13 -0
- package/dist/js/core/Uploader.d.ts +7 -0
- package/dist/js/core/Uploader.js +134 -0
- package/dist/js/core/Validator.d.ts +27 -0
- package/dist/js/core/Validator.js +80 -0
- package/dist/js/extensions/jqueryExtensions.d.ts +11 -0
- package/dist/js/extensions/jqueryExtensions.js +99 -0
- package/dist/js/extensions/numberExtensions.d.ts +8 -0
- package/dist/js/extensions/numberExtensions.js +19 -0
- package/dist/js/extensions/stringExtensions.d.ts +12 -0
- package/dist/js/extensions/stringExtensions.js +49 -0
- package/dist/js/index.d.ts +22 -0
- package/dist/js/index.js +22 -0
- package/dist/js/interfaces/KeyValue.d.ts +4 -0
- package/dist/js/interfaces/KeyValue.js +1 -0
- package/dist/js/login.js +4 -3
- package/dist/js/models/Content.d.ts +50 -0
- package/dist/js/models/Content.js +1 -0
- package/dist/js/models/Property.d.ts +9 -0
- package/dist/js/models/Property.js +2 -0
- package/dist/js/models/Users.d.ts +7 -0
- package/dist/js/models/Users.js +2 -0
- package/package.json +59 -55
- package/src/css/admin.css +580 -187
- package/src/css/admin.css.map +1 -1
- package/src/css/app.css +576 -183
- package/src/css/app.css.map +1 -1
- package/src/css/button.css +0 -3
- package/src/css/button.css.map +1 -1
- package/src/css/editor.css +576 -183
- package/src/css/editor.css.map +1 -1
- package/src/css/install.css +576 -183
- package/src/css/install.css.map +1 -1
- package/src/css/login.css +576 -183
- package/src/css/login.css.map +1 -1
- package/src/js/admin.js +717 -699
- package/src/js/admin.js.map +1 -1
- package/src/js/app.js +395 -351
- package/src/js/app.js.map +1 -1
- package/src/js/login.js +8 -7
- package/src/js/login.js.map +1 -1
- package/src/scss/admin/layout/content/footer.scss +3 -4
- package/src/scss/admin/layout/content/title.scss +3 -6
- package/src/scss/admin/layout/content.scss +3 -5
- package/src/scss/admin/media.scss +13 -22
- package/src/scss/admin.scss +2 -6
- package/src/scss/app.scss +2 -2
- package/src/scss/button.scss +1 -14
- package/src/scss/editor.scss +2 -3
- package/src/scss/install.scss +1 -1
- package/src/scss/login.scss +2 -16
- package/src/ts/admin.ts +7 -8
- package/src/ts/app.ts +0 -2
- package/src/ts/core/BaseSite.ts +21 -0
- package/src/ts/core/ColorPicker.ts +5 -1
- package/src/ts/core/Editors.ts +6 -7
- package/src/ts/core/HoodApi.ts +5 -0
- package/src/ts/core/Media.ts +4 -0
- package/src/ts/index.ts +25 -0
- package/src/ts/hood.ts +0 -5
package/src/js/admin.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* hoodcms v5.0.
|
|
2
|
+
* hoodcms v5.0.9
|
|
3
|
+
* A fully customisable content management system built in ASP.NET Core 5 & Bootstrap 5.
|
|
4
|
+
* Written by George Whysall, 2021
|
|
3
5
|
* Released under the GPL-3.0 License.
|
|
4
6
|
*/
|
|
5
7
|
(function (global, factory) {
|
|
6
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(
|
|
7
|
-
typeof define === 'function' && define.amd ? define(['
|
|
8
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.
|
|
9
|
-
}(this, (function (
|
|
8
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('bootstrap'), require('sweetalert2'), require('@simonwep/pickr'), require('tinymce/tinymce'), require('chart.js')) :
|
|
9
|
+
typeof define === 'function' && define.amd ? define(['bootstrap', 'sweetalert2', '@simonwep/pickr', 'tinymce/tinymce', 'chart.js'], factory) :
|
|
10
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.bootstrap, global.swal, global.Pickr, global.tinymce, global.chart_js));
|
|
11
|
+
})(this, (function (bootstrap, swal, Pickr, tinymce, chart_js) { 'use strict';
|
|
10
12
|
|
|
11
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
14
|
|
|
@@ -19,21 +21,19 @@
|
|
|
19
21
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
22
|
Object.defineProperty(n, k, d.get ? d : {
|
|
21
23
|
enumerable: true,
|
|
22
|
-
get: function () {
|
|
23
|
-
return e[k];
|
|
24
|
-
}
|
|
24
|
+
get: function () { return e[k]; }
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
n[
|
|
29
|
+
n["default"] = e;
|
|
30
30
|
return Object.freeze(n);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
var swal__default = /*#__PURE__*/_interopDefaultLegacy(swal);
|
|
34
33
|
var bootstrap__namespace = /*#__PURE__*/_interopNamespace(bootstrap);
|
|
35
|
-
var
|
|
34
|
+
var swal__default = /*#__PURE__*/_interopDefaultLegacy(swal);
|
|
36
35
|
var Pickr__default = /*#__PURE__*/_interopDefaultLegacy(Pickr);
|
|
36
|
+
var tinymce__default = /*#__PURE__*/_interopDefaultLegacy(tinymce);
|
|
37
37
|
|
|
38
38
|
/*! *****************************************************************************
|
|
39
39
|
Copyright (c) Microsoft Corporation.
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
|
|
78
78
|
"function"!=typeof Object.create&&(Object.create=function(t){function o(){}return o.prototype=t,new o}),function(t,o,i,s){var n={_positionClasses:["bottom-left","bottom-right","top-right","top-left","bottom-center","top-center","mid-center"],_defaultIcons:["success","error","info","warning"],init:function(o,i){this.prepareOptions(o,t.toast.options),this.process();},prepareOptions:function(o,i){var s={};"string"==typeof o||o instanceof Array?s.text=o:s=o,this.options=t.extend({},i,s);},process:function(){this.setup(),this.addToDom(),this.position(),this.bindToast(),this.animate();},setup:function(){var o="";if(this._toastEl=this._toastEl||t("<div></div>",{"class":"jq-toast-single"}),o+='<span class="jq-toast-loader"></span>',this.options.allowToastClose&&(o+='<span class="close-jq-toast-single">×</span>'),this.options.text instanceof Array){this.options.heading&&(o+='<h2 class="jq-toast-heading">'+this.options.heading+"</h2>"),o+='<ul class="jq-toast-ul">';for(var i=0;i<this.options.text.length;i++)o+='<li class="jq-toast-li" id="jq-toast-item-'+i+'">'+this.options.text[i]+"</li>";o+="</ul>";}else this.options.heading&&(o+='<h2 class="jq-toast-heading">'+this.options.heading+"</h2>"),o+=this.options.text;this._toastEl.html(o),this.options.bgColor!==!1&&this._toastEl.css("background-color",this.options.bgColor),this.options.textColor!==!1&&this._toastEl.css("color",this.options.textColor),this.options.textAlign&&this._toastEl.css("text-align",this.options.textAlign),this.options.icon!==!1&&(this._toastEl.addClass("jq-has-icon"),-1!==t.inArray(this.options.icon,this._defaultIcons)&&this._toastEl.addClass("jq-icon-"+this.options.icon)),this.options["class"]!==!1&&this._toastEl.addClass(this.options["class"]);},position:function(){"string"==typeof this.options.position&&-1!==t.inArray(this.options.position,this._positionClasses)?"bottom-center"===this.options.position?this._container.css({left:t(o).outerWidth()/2-this._container.outerWidth()/2,bottom:20}):"top-center"===this.options.position?this._container.css({left:t(o).outerWidth()/2-this._container.outerWidth()/2,top:20}):"mid-center"===this.options.position?this._container.css({left:t(o).outerWidth()/2-this._container.outerWidth()/2,top:t(o).outerHeight()/2-this._container.outerHeight()/2}):this._container.addClass(this.options.position):"object"==typeof this.options.position?this._container.css({top:this.options.position.top?this.options.position.top:"auto",bottom:this.options.position.bottom?this.options.position.bottom:"auto",left:this.options.position.left?this.options.position.left:"auto",right:this.options.position.right?this.options.position.right:"auto"}):this._container.addClass("bottom-left");},bindToast:function(){var t=this;this._toastEl.on("afterShown",function(){t.processLoader();}),this._toastEl.find(".close-jq-toast-single").on("click",function(o){o.preventDefault(),"fade"===t.options.showHideTransition?(t._toastEl.trigger("beforeHide"),t._toastEl.fadeOut(function(){t._toastEl.trigger("afterHidden");})):"slide"===t.options.showHideTransition?(t._toastEl.trigger("beforeHide"),t._toastEl.slideUp(function(){t._toastEl.trigger("afterHidden");})):(t._toastEl.trigger("beforeHide"),t._toastEl.hide(function(){t._toastEl.trigger("afterHidden");}));}),"function"==typeof this.options.beforeShow&&this._toastEl.on("beforeShow",function(){t.options.beforeShow();}),"function"==typeof this.options.afterShown&&this._toastEl.on("afterShown",function(){t.options.afterShown();}),"function"==typeof this.options.beforeHide&&this._toastEl.on("beforeHide",function(){t.options.beforeHide();}),"function"==typeof this.options.afterHidden&&this._toastEl.on("afterHidden",function(){t.options.afterHidden();});},addToDom:function(){var o=t(".jq-toast-wrap");if(0===o.length?(o=t("<div></div>",{"class":"jq-toast-wrap"}),t("body").append(o)):(!this.options.stack||isNaN(parseInt(this.options.stack,10)))&&o.empty(),o.find(".jq-toast-single:hidden").remove(),o.append(this._toastEl),this.options.stack&&!isNaN(parseInt(this.options.stack),10)){var i=o.find(".jq-toast-single").length,s=i-this.options.stack;s>0&&t(".jq-toast-wrap").find(".jq-toast-single").slice(0,s).remove();}this._container=o;},canAutoHide:function(){return this.options.hideAfter!==!1&&!isNaN(parseInt(this.options.hideAfter,10))},processLoader:function(){if(!this.canAutoHide()||this.options.loader===!1)return !1;var t=this._toastEl.find(".jq-toast-loader"),o=(this.options.hideAfter-400)/1e3+"s",i=this.options.loaderBg,s=t.attr("style")||"";s=s.substring(0,s.indexOf("-webkit-transition")),s+="-webkit-transition: width "+o+" ease-in; -o-transition: width "+o+" ease-in; transition: width "+o+" ease-in; background-color: "+i+";",t.attr("style",s).addClass("jq-toast-loaded");},animate:function(){var t=this;if(this._toastEl.hide(),this._toastEl.trigger("beforeShow"),"fade"===this.options.showHideTransition.toLowerCase()?this._toastEl.fadeIn(function(){t._toastEl.trigger("afterShown");}):"slide"===this.options.showHideTransition.toLowerCase()?this._toastEl.slideDown(function(){t._toastEl.trigger("afterShown");}):this._toastEl.show(function(){t._toastEl.trigger("afterShown");}),this.canAutoHide()){var t=this;o.setTimeout(function(){"fade"===t.options.showHideTransition.toLowerCase()?(t._toastEl.trigger("beforeHide"),t._toastEl.fadeOut(function(){t._toastEl.trigger("afterHidden");})):"slide"===t.options.showHideTransition.toLowerCase()?(t._toastEl.trigger("beforeHide"),t._toastEl.slideUp(function(){t._toastEl.trigger("afterHidden");})):(t._toastEl.trigger("beforeHide"),t._toastEl.hide(function(){t._toastEl.trigger("afterHidden");}));},this.options.hideAfter);}},reset:function(o){"all"===o?t(".jq-toast-wrap").remove():this._toastEl.remove();},update:function(t){this.prepareOptions(t,this.options),this.setup(),this.bindToast();}};t.toast=function(t){var o=Object.create(n);return o.init(t,this),{reset:function(t){o.reset(t);},update:function(t){o.update(t);}}},t.toast.options={text:"",heading:"",showHideTransition:"fade",allowToastClose:!0,hideAfter:3e3,loader:!0,loaderBg:"#9EC600",stack:5,position:"bottom-left",bgColor:!1,textColor:!1,textAlign:"left",icon:!1,beforeShow:function(){},afterShown:function(){},beforeHide:function(){},afterHidden:function(){}};}(jQuery,window);
|
|
79
79
|
|
|
80
|
-
var BootstrapSwal = swal__default[
|
|
80
|
+
var BootstrapSwal = swal__default["default"].mixin({
|
|
81
81
|
customClass: {
|
|
82
82
|
confirmButton: 'btn btn-success m-1 px-3',
|
|
83
83
|
cancelButton: 'btn btn-danger m-1 px-3'
|
|
@@ -253,429 +253,145 @@
|
|
|
253
253
|
return Alerts;
|
|
254
254
|
}());
|
|
255
255
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
$(
|
|
256
|
+
var ColorPickers = /** @class */ (function () {
|
|
257
|
+
function ColorPickers() {
|
|
258
|
+
}
|
|
259
|
+
ColorPickers.prototype.loadColorPickers = function (tag) {
|
|
260
|
+
if (tag === void 0) { tag = '.color-picker'; }
|
|
261
|
+
var updateColorFieldValue = function (color, eventSource, instance) {
|
|
262
|
+
var elemId = $(instance._root.button).parent().data('target');
|
|
263
|
+
$(instance._root.button).parent().css({ 'background-color': color.toHEXA().toString() });
|
|
264
|
+
var colorHex = instance.getColor().toHEXA();
|
|
265
|
+
var result = "";
|
|
266
|
+
for (var i = colorHex.length - 1; i >= 0; i--) {
|
|
267
|
+
result = colorHex[i] + result;
|
|
268
|
+
}
|
|
269
|
+
$(elemId).val('#' + result);
|
|
270
|
+
$(elemId).change();
|
|
271
|
+
};
|
|
272
|
+
// Simple example, see optional options for more configuration.
|
|
273
|
+
$(tag).each(function (index, elem) {
|
|
274
|
+
var lockOpacity = true;
|
|
275
|
+
if ($(this).data('opacity') == 'true') {
|
|
276
|
+
lockOpacity = false;
|
|
277
|
+
}
|
|
278
|
+
Pickr__default["default"].create({
|
|
279
|
+
el: elem.children[0],
|
|
280
|
+
appClass: 'custom-class',
|
|
281
|
+
theme: 'monolith',
|
|
282
|
+
useAsButton: true,
|
|
283
|
+
default: $(this).data('default') || 'none',
|
|
284
|
+
lockOpacity: lockOpacity,
|
|
285
|
+
defaultRepresentation: 'HEXA',
|
|
286
|
+
position: 'bottom-end',
|
|
287
|
+
components: {
|
|
288
|
+
opacity: true,
|
|
289
|
+
hue: true,
|
|
290
|
+
interaction: {
|
|
291
|
+
hex: false,
|
|
292
|
+
rgba: false,
|
|
293
|
+
hsva: false,
|
|
294
|
+
input: true,
|
|
295
|
+
clear: true
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
.on('init', function (instance) {
|
|
300
|
+
var elemId = $(instance._root.button).parent().data('target');
|
|
301
|
+
var value = $(elemId).val();
|
|
302
|
+
$(instance._root.button).parent().on('click', $.proxy(function () {
|
|
303
|
+
this.show();
|
|
304
|
+
}, instance));
|
|
305
|
+
$(elemId).on('click', $.proxy(function () {
|
|
306
|
+
this.show();
|
|
307
|
+
}, instance));
|
|
308
|
+
if (value) {
|
|
309
|
+
instance.setColor(value);
|
|
310
|
+
updateColorFieldValue(instance.getColor(), null, instance);
|
|
311
|
+
}
|
|
312
|
+
})
|
|
313
|
+
.on('clear', function (instance) {
|
|
314
|
+
var elemId = $(instance._root.button).parent().data('target');
|
|
315
|
+
instance.setColor('transparent');
|
|
316
|
+
updateColorFieldValue(instance.getColor(), null, instance);
|
|
317
|
+
$(elemId).val('');
|
|
318
|
+
$(elemId).change();
|
|
319
|
+
})
|
|
320
|
+
.on('change', updateColorFieldValue);
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
return ColorPickers;
|
|
324
|
+
}());
|
|
325
|
+
|
|
326
|
+
var Inline = /** @class */ (function () {
|
|
327
|
+
function Inline() {
|
|
328
|
+
}
|
|
329
|
+
Inline.load = function (tag, options) {
|
|
330
|
+
var _a;
|
|
331
|
+
var $tag = $(tag);
|
|
332
|
+
$tag.addClass('loading');
|
|
333
|
+
if (options.onLoad) {
|
|
334
|
+
options.onLoad(tag);
|
|
271
335
|
}
|
|
336
|
+
var url = $tag.data('url');
|
|
337
|
+
$.get(url, function (data) {
|
|
338
|
+
if (options.onRender) {
|
|
339
|
+
data = options.onRender(data, tag);
|
|
340
|
+
}
|
|
341
|
+
$tag.html(data);
|
|
342
|
+
$tag.removeClass('loading');
|
|
343
|
+
if (options.onComplete) {
|
|
344
|
+
options.onComplete(data, tag);
|
|
345
|
+
}
|
|
346
|
+
})
|
|
347
|
+
.fail((_a = options.onError) !== null && _a !== void 0 ? _a : Inline.handleError);
|
|
272
348
|
};
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (restrictPattern === void 0) { restrictPattern = /[^0-9a-zA-Z-//]*/g; }
|
|
279
|
-
var targets = $(this);
|
|
280
|
-
// The characters inside this pattern are accepted
|
|
281
|
-
// and everything else will be 'cleaned'
|
|
282
|
-
var restrictHandler = function () {
|
|
283
|
-
var val = $(this).val();
|
|
284
|
-
var newVal = val.replace(restrictPattern, '');
|
|
285
|
-
if ((newVal.match(new RegExp("/", "g")) || []).length > 4) {
|
|
286
|
-
var pos = newVal.lastIndexOf('/');
|
|
287
|
-
newVal = newVal.substring(0, pos) + newVal.substring(pos + 1);
|
|
288
|
-
Alerts.warning("You can only have up to 4 '/' characters in a url slug.");
|
|
349
|
+
Inline.task = function (url, sender, complete, error) {
|
|
350
|
+
if (complete === void 0) { complete = null; }
|
|
351
|
+
if (error === void 0) { error = null; }
|
|
352
|
+
if (sender) {
|
|
353
|
+
sender.classList.add('loading');
|
|
289
354
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
355
|
+
$.get(url, function (response) {
|
|
356
|
+
if (sender) {
|
|
357
|
+
sender.classList.remove('loading');
|
|
358
|
+
}
|
|
359
|
+
if (complete) {
|
|
360
|
+
complete(response, sender);
|
|
361
|
+
}
|
|
362
|
+
})
|
|
363
|
+
.fail(error !== null && error !== void 0 ? error : Inline.handleError);
|
|
364
|
+
};
|
|
365
|
+
Inline.post = function (url, sender, complete, error) {
|
|
366
|
+
if (complete === void 0) { complete = null; }
|
|
367
|
+
if (error === void 0) { error = null; }
|
|
368
|
+
if (sender) {
|
|
369
|
+
sender.classList.add('loading');
|
|
293
370
|
}
|
|
371
|
+
$.post(url, function (response) {
|
|
372
|
+
if (sender) {
|
|
373
|
+
sender.classList.remove('loading');
|
|
374
|
+
}
|
|
375
|
+
if (complete) {
|
|
376
|
+
complete(response, sender);
|
|
377
|
+
}
|
|
378
|
+
})
|
|
379
|
+
.fail(error !== null && error !== void 0 ? error : Inline.handleError);
|
|
294
380
|
};
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
};
|
|
299
|
-
$.fn.restrictToMetaSlug = function (restrictPattern) {
|
|
300
|
-
if (restrictPattern === void 0) { restrictPattern = /[^0-9a-zA-Z.]*/g; }
|
|
301
|
-
var targets = $(this);
|
|
302
|
-
// The characters inside this pattern are accepted
|
|
303
|
-
// and everything else will be 'cleaned'
|
|
304
|
-
var restrictHandler = function () {
|
|
305
|
-
var val = $(this).val();
|
|
306
|
-
var newVal = val.replace(restrictPattern, '');
|
|
307
|
-
if ((newVal.match(new RegExp(".", "g")) || []).length > 1) {
|
|
308
|
-
var pos = newVal.lastIndexOf('.');
|
|
309
|
-
newVal = newVal.substring(0, pos) + newVal.substring(pos + 1);
|
|
310
|
-
Alerts.warning("You can only have up to 1 '.' characters in a meta slug.");
|
|
381
|
+
Inline.handleError = function (xhr, textStatus, errorThrown) {
|
|
382
|
+
if (xhr.status === 500) {
|
|
383
|
+
Alerts.error("There was an error processing the content, please contact an administrator if this continues.", "Error " + xhr.status, 10000);
|
|
311
384
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
385
|
+
else if (xhr.status === 404) {
|
|
386
|
+
Alerts.error("The content could not be found.", "Error " + xhr.status, 10000);
|
|
387
|
+
}
|
|
388
|
+
else if (xhr.status === 401) {
|
|
389
|
+
Alerts.error("You are not allowed to view this resource, are you logged in correctly?", "Error " + xhr.status, 10000);
|
|
390
|
+
window.location = window.location;
|
|
315
391
|
}
|
|
316
392
|
};
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
targets.on('change', restrictHandler);
|
|
320
|
-
};
|
|
321
|
-
$.fn.characterCounter = function () {
|
|
322
|
-
var targets = $(this);
|
|
323
|
-
var characterCounterHandler = function () {
|
|
324
|
-
var counter = $(this).data('counter');
|
|
325
|
-
var max = Number($(this).attr('maxlength'));
|
|
326
|
-
var len = $(this).val().length;
|
|
327
|
-
$(counter).text(max - len);
|
|
328
|
-
var cls = "text-success";
|
|
329
|
-
if (max - len < max / 10)
|
|
330
|
-
cls = "text-danger";
|
|
331
|
-
$(counter).parent().removeClass('text-success').removeClass('text-danger').addClass(cls);
|
|
332
|
-
};
|
|
333
|
-
targets.on('keyup', characterCounterHandler);
|
|
334
|
-
targets.on('paste', characterCounterHandler);
|
|
335
|
-
targets.on('change', characterCounterHandler);
|
|
336
|
-
};
|
|
337
|
-
$.fn.warningAlert = function () {
|
|
338
|
-
var targets = $(this);
|
|
339
|
-
var warningAlertHandler = function (e) {
|
|
340
|
-
e.preventDefault();
|
|
341
|
-
var warningAlertCallback = function (result) {
|
|
342
|
-
if (result.isConfirmed) {
|
|
343
|
-
var url = $(e.currentTarget).attr('href');
|
|
344
|
-
window.location.href = url;
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
Alerts.confirm({
|
|
348
|
-
title: $(e.currentTarget).data('title'),
|
|
349
|
-
html: $(e.currentTarget).data('warning'),
|
|
350
|
-
footer: $(e.currentTarget).data('footer'),
|
|
351
|
-
icon: 'warning'
|
|
352
|
-
}, warningAlertCallback);
|
|
353
|
-
return false;
|
|
354
|
-
};
|
|
355
|
-
targets.on('click', warningAlertHandler);
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
Number.prototype.formatCurrency = function (currency) {
|
|
359
|
-
return currency + " " + this.toFixed(2).replace(/./g, function (c, i, a) {
|
|
360
|
-
return i > 0 && c !== "." && (a.length - i) % 3 === 0 ? "," + c : c;
|
|
361
|
-
});
|
|
362
|
-
};
|
|
363
|
-
Number.prototype.formatKilobytes = function () {
|
|
364
|
-
var n = this / 1024;
|
|
365
|
-
return n.toFixed(0).replace(/./g, function (c, i, a) {
|
|
366
|
-
return i > 0 && c !== "." && (a.length - i) % 3 === 0 ? "," + c : c;
|
|
367
|
-
}) + "Kb";
|
|
368
|
-
};
|
|
369
|
-
Number.prototype.formatMegabytes = function () {
|
|
370
|
-
var n = this / 1024;
|
|
371
|
-
n = n / 1024;
|
|
372
|
-
return n.toFixed(0).replace(/./g, function (c, i, a) {
|
|
373
|
-
return i > 0 && c !== "." && (a.length - i) % 3 === 0 ? "," + c : c;
|
|
374
|
-
}) + "Mb";
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
String.prototype.htmlEncode = function () {
|
|
378
|
-
//create a in-memory div, set it's inner text(which jQuery automatically encodes)
|
|
379
|
-
//then grab the encoded contents back out. The div never exists on the page.
|
|
380
|
-
return $('<div/>').text(this).html();
|
|
381
|
-
};
|
|
382
|
-
String.prototype.htmlDecode = function () {
|
|
383
|
-
return $('<div/>').html(this).text();
|
|
384
|
-
};
|
|
385
|
-
String.prototype.contains = function (it) {
|
|
386
|
-
return this.indexOf(it) !== -1;
|
|
387
|
-
};
|
|
388
|
-
String.prototype.pick = function (min, max) {
|
|
389
|
-
var n, chars = '';
|
|
390
|
-
if (typeof max === 'undefined') {
|
|
391
|
-
n = min;
|
|
392
|
-
}
|
|
393
|
-
else {
|
|
394
|
-
n = min + Math.floor(Math.random() * (max - min));
|
|
395
|
-
}
|
|
396
|
-
for (var i = 0; i < n; i++) {
|
|
397
|
-
chars += this.charAt(Math.floor(Math.random() * this.length));
|
|
398
|
-
}
|
|
399
|
-
return chars;
|
|
400
|
-
};
|
|
401
|
-
// Credit to @Christoph: http://stackoverflow.com/a/962890/464744
|
|
402
|
-
String.prototype.shuffle = function () {
|
|
403
|
-
var array = this.split('');
|
|
404
|
-
var tmp, current, top = array.length;
|
|
405
|
-
if (top)
|
|
406
|
-
while (--top) {
|
|
407
|
-
current = Math.floor(Math.random() * (top + 1));
|
|
408
|
-
tmp = array[current];
|
|
409
|
-
array[current] = array[top];
|
|
410
|
-
array[top] = tmp;
|
|
411
|
-
}
|
|
412
|
-
return array.join('');
|
|
413
|
-
};
|
|
414
|
-
String.prototype.toSeoUrl = function () {
|
|
415
|
-
var output = this.replace(/[^a-zA-Z0-9]/g, ' ').replace(/\s+/g, "-").toLowerCase();
|
|
416
|
-
/* remove first dash */
|
|
417
|
-
if (output.charAt(0) === '-')
|
|
418
|
-
output = output.substring(1);
|
|
419
|
-
/* remove last dash */
|
|
420
|
-
var last = output.length - 1;
|
|
421
|
-
if (output.charAt(last) === '-')
|
|
422
|
-
output = output.substring(0, last);
|
|
423
|
-
return output;
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
var Handlers = /** @class */ (function () {
|
|
427
|
-
function Handlers() {
|
|
428
|
-
}
|
|
429
|
-
/**
|
|
430
|
-
* Initialise all default Hood CMS handlers.
|
|
431
|
-
*/
|
|
432
|
-
Handlers.prototype.initDefaultHandlers = function () {
|
|
433
|
-
this.checkboxToCsvInput();
|
|
434
|
-
this.iconSelector();
|
|
435
|
-
this.initSelectValues();
|
|
436
|
-
this.scrollHandlers();
|
|
437
|
-
this.selectText();
|
|
438
|
-
this.setValueOnClick();
|
|
439
|
-
this.submitOnChange();
|
|
440
|
-
};
|
|
441
|
-
/**
|
|
442
|
-
* Sets values of any selects that have the value set in data-selected, useful for
|
|
443
|
-
*/
|
|
444
|
-
Handlers.prototype.initSelectValues = function (tag) {
|
|
445
|
-
if (tag === void 0) { tag = 'body'; }
|
|
446
|
-
$(tag).find('select[data-selected]').each(this.initSelectValuesHandler);
|
|
447
|
-
};
|
|
448
|
-
Handlers.prototype.initSelectValuesHandler = function (index, element) {
|
|
449
|
-
var sel = $(this).data('selected');
|
|
450
|
-
if (sel !== 'undefined' && sel !== '') {
|
|
451
|
-
var selected = String(sel);
|
|
452
|
-
$(this).val(selected);
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
/**
|
|
456
|
-
* Sets up any Hood Icon selector fields, requires the correct HTML setup.
|
|
457
|
-
*/
|
|
458
|
-
Handlers.prototype.iconSelector = function (tag) {
|
|
459
|
-
if (tag === void 0) { tag = 'body'; }
|
|
460
|
-
$(tag).find('[data-hood-icon]').each(this.iconSelectorHandler);
|
|
461
|
-
};
|
|
462
|
-
Handlers.prototype.iconSelectorHandler = function (index, element) {
|
|
463
|
-
var $tag = $(this);
|
|
464
|
-
var input = $tag.find('input[data-hood-icon-input]');
|
|
465
|
-
var display = $tag.find('[data-hood-icon-display]');
|
|
466
|
-
var collapse = $tag.find('.collapse');
|
|
467
|
-
$tag.find('[data-hood-icon-key][data-hood-icon-value]').on('click', function () {
|
|
468
|
-
$tag.find('[data-hood-icon-key][data-hood-icon-value]').removeClass('active');
|
|
469
|
-
$(this).addClass('active');
|
|
470
|
-
var key = $(this).data('hoodIconKey');
|
|
471
|
-
var value = $(this).data('hoodIconValue');
|
|
472
|
-
$(this);
|
|
473
|
-
display.html(value);
|
|
474
|
-
input.val(key);
|
|
475
|
-
if (collapse) {
|
|
476
|
-
collapse.removeClass('show');
|
|
477
|
-
}
|
|
478
|
-
});
|
|
479
|
-
};
|
|
480
|
-
/**
|
|
481
|
-
* Submits the form when input is changed, mark inputs with .submit-on-change class.
|
|
482
|
-
*/
|
|
483
|
-
Handlers.prototype.selectText = function (tag) {
|
|
484
|
-
if (tag === void 0) { tag = 'body'; }
|
|
485
|
-
$(tag).on('click', '.select-text', this.selectTextHandler);
|
|
486
|
-
};
|
|
487
|
-
Handlers.prototype.selectTextHandler = function () {
|
|
488
|
-
var $this = $(this);
|
|
489
|
-
$this.select();
|
|
490
|
-
// Work around Chrome's little problem
|
|
491
|
-
$this.mouseup(function () {
|
|
492
|
-
// Prevent further mouseup intervention
|
|
493
|
-
$this.unbind("mouseup");
|
|
494
|
-
return false;
|
|
495
|
-
});
|
|
496
|
-
};
|
|
497
|
-
/**
|
|
498
|
-
* Attaches handlers for default scrolling functions, scroll to top, scroll to target (with header.header offset calculated)
|
|
499
|
-
* and scroll to target direct (with no calculated offset).
|
|
500
|
-
*/
|
|
501
|
-
Handlers.prototype.scrollHandlers = function (tag) {
|
|
502
|
-
if (tag === void 0) { tag = 'body'; }
|
|
503
|
-
$(tag).on('click', '.scroll-top, .scroll-to-top', this.scrollTop);
|
|
504
|
-
$(tag).on('click', '.scroll-target, .scroll-to-target', this.scrollTarget);
|
|
505
|
-
$(tag).on('click', '.scroll-target-direct, .scroll-to-target-direct', this.scrollTargetDirect);
|
|
506
|
-
};
|
|
507
|
-
Handlers.prototype.scrollTop = function (e) {
|
|
508
|
-
if (e)
|
|
509
|
-
e.preventDefault();
|
|
510
|
-
$('html, body').animate({ scrollTop: 0 }, 800);
|
|
511
|
-
return false;
|
|
512
|
-
};
|
|
513
|
-
Handlers.prototype.scrollTarget = function (e) {
|
|
514
|
-
if (e)
|
|
515
|
-
e.preventDefault();
|
|
516
|
-
var url = $(this).attr('href').split('#')[0];
|
|
517
|
-
if (url !== window.location.pathname && url !== "") {
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
var target = this.hash;
|
|
521
|
-
var $target = $(target);
|
|
522
|
-
var $header = $('header.header');
|
|
523
|
-
var headerOffset = 0;
|
|
524
|
-
if ($header) {
|
|
525
|
-
headerOffset = $header.height();
|
|
526
|
-
}
|
|
527
|
-
if ($(this).data('offset'))
|
|
528
|
-
$('html, body').stop().animate({
|
|
529
|
-
'scrollTop': $target.offset().top - $(this).data('offset')
|
|
530
|
-
}, 900, 'swing');
|
|
531
|
-
else
|
|
532
|
-
$('html, body').stop().animate({
|
|
533
|
-
'scrollTop': $target.offset().top - headerOffset
|
|
534
|
-
}, 900, 'swing');
|
|
535
|
-
};
|
|
536
|
-
Handlers.prototype.scrollTargetDirect = function () {
|
|
537
|
-
var scrollTop = $('body').scrollTop();
|
|
538
|
-
var top = $($(this).attr('href')).offset().top;
|
|
539
|
-
$('html, body').animate({
|
|
540
|
-
scrollTop: top
|
|
541
|
-
}, Math.abs(top - scrollTop));
|
|
542
|
-
return false;
|
|
543
|
-
};
|
|
544
|
-
/**
|
|
545
|
-
* Compiles any selected checkboxes with matching data-hood-csv-input tags,
|
|
546
|
-
* then saves the CSV list of the values to the input given in the tag.
|
|
547
|
-
*/
|
|
548
|
-
Handlers.prototype.checkboxToCsvInput = function (tag) {
|
|
549
|
-
if (tag === void 0) { tag = 'body'; }
|
|
550
|
-
$(tag).on('change', 'input[type=checkbox][data-hood-csv-input]', this.checkboxToCsvInputHandler);
|
|
551
|
-
};
|
|
552
|
-
Handlers.prototype.checkboxToCsvInputHandler = function (e) {
|
|
553
|
-
if (e)
|
|
554
|
-
e.preventDefault();
|
|
555
|
-
// when i change - create an array, with any other checked of the same data-input checkboxes. and add to the data-input referenced tag.
|
|
556
|
-
var items = new Array();
|
|
557
|
-
$('input[data-hood-csv-input="' + $(this).data('hoodCsvInput') + '"]').each(function () {
|
|
558
|
-
if ($(this).is(":checked"))
|
|
559
|
-
items.push($(this).val());
|
|
560
|
-
});
|
|
561
|
-
var id = '#' + $(this).data('input');
|
|
562
|
-
var vals = JSON.stringify(items);
|
|
563
|
-
$(id).val(vals);
|
|
564
|
-
};
|
|
565
|
-
/**
|
|
566
|
-
* Submits the form when input is changed, mark inputs with .submit-on-change class.
|
|
567
|
-
*/
|
|
568
|
-
Handlers.prototype.submitOnChange = function (tag) {
|
|
569
|
-
if (tag === void 0) { tag = 'body'; }
|
|
570
|
-
$(tag).on('change', '.submit-on-change', this.submitOnChangeHandler);
|
|
571
|
-
};
|
|
572
|
-
Handlers.prototype.submitOnChangeHandler = function (e) {
|
|
573
|
-
if (e)
|
|
574
|
-
e.preventDefault();
|
|
575
|
-
$(this).parents('form').submit();
|
|
576
|
-
};
|
|
577
|
-
/**
|
|
578
|
-
* Sets the value of the input [data-target] when clicked to the value in [data-value]
|
|
579
|
-
*/
|
|
580
|
-
Handlers.prototype.setValueOnClick = function (tag) {
|
|
581
|
-
if (tag === void 0) { tag = 'body'; }
|
|
582
|
-
$(tag).on('click', '.click-select[data-target][data-value]', this.setValueOnClickHandler);
|
|
583
|
-
};
|
|
584
|
-
Handlers.prototype.setValueOnClickHandler = function () {
|
|
585
|
-
var $this = $(this);
|
|
586
|
-
var targetId = '#' + $this.data('target');
|
|
587
|
-
$(targetId).val($this.data('value'));
|
|
588
|
-
$(targetId).trigger('change');
|
|
589
|
-
$('.click-select.clean[data-target="' + $this.data('target') + '"]').each(function () { $(this).removeClass('active'); });
|
|
590
|
-
$('.click-select.clean[data-target="' + $this.data('target') + '"][data-value="' + $this.data('value') + '"]').each(function () { $(this).addClass('active'); });
|
|
591
|
-
};
|
|
592
|
-
return Handlers;
|
|
593
|
-
}());
|
|
594
|
-
|
|
595
|
-
var Response = /** @class */ (function () {
|
|
596
|
-
function Response() {
|
|
597
|
-
}
|
|
598
|
-
Response.process = function (data, autoHide) {
|
|
599
|
-
if (autoHide === void 0) { autoHide = 5000; }
|
|
600
|
-
if (data.success) {
|
|
601
|
-
Alerts.success(data.message, data.title, autoHide);
|
|
602
|
-
}
|
|
603
|
-
else {
|
|
604
|
-
Alerts.error(data.errors, data.title, autoHide);
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
return Response;
|
|
608
|
-
}());
|
|
609
|
-
|
|
610
|
-
var Inline = /** @class */ (function () {
|
|
611
|
-
function Inline() {
|
|
612
|
-
}
|
|
613
|
-
Inline.load = function (tag, options) {
|
|
614
|
-
var _a;
|
|
615
|
-
var $tag = $(tag);
|
|
616
|
-
$tag.addClass('loading');
|
|
617
|
-
if (options.onLoad) {
|
|
618
|
-
options.onLoad(tag);
|
|
619
|
-
}
|
|
620
|
-
var url = $tag.data('url');
|
|
621
|
-
$.get(url, function (data) {
|
|
622
|
-
if (options.onRender) {
|
|
623
|
-
data = options.onRender(data, tag);
|
|
624
|
-
}
|
|
625
|
-
$tag.html(data);
|
|
626
|
-
$tag.removeClass('loading');
|
|
627
|
-
if (options.onComplete) {
|
|
628
|
-
options.onComplete(data, tag);
|
|
629
|
-
}
|
|
630
|
-
})
|
|
631
|
-
.fail((_a = options.onError) !== null && _a !== void 0 ? _a : Inline.handleError);
|
|
632
|
-
};
|
|
633
|
-
Inline.task = function (url, sender, complete, error) {
|
|
634
|
-
if (complete === void 0) { complete = null; }
|
|
635
|
-
if (error === void 0) { error = null; }
|
|
636
|
-
if (sender) {
|
|
637
|
-
sender.classList.add('loading');
|
|
638
|
-
}
|
|
639
|
-
$.get(url, function (response) {
|
|
640
|
-
if (sender) {
|
|
641
|
-
sender.classList.remove('loading');
|
|
642
|
-
}
|
|
643
|
-
if (complete) {
|
|
644
|
-
complete(response, sender);
|
|
645
|
-
}
|
|
646
|
-
})
|
|
647
|
-
.fail(error !== null && error !== void 0 ? error : Inline.handleError);
|
|
648
|
-
};
|
|
649
|
-
Inline.post = function (url, sender, complete, error) {
|
|
650
|
-
if (complete === void 0) { complete = null; }
|
|
651
|
-
if (error === void 0) { error = null; }
|
|
652
|
-
if (sender) {
|
|
653
|
-
sender.classList.add('loading');
|
|
654
|
-
}
|
|
655
|
-
$.post(url, function (response) {
|
|
656
|
-
if (sender) {
|
|
657
|
-
sender.classList.remove('loading');
|
|
658
|
-
}
|
|
659
|
-
if (complete) {
|
|
660
|
-
complete(response, sender);
|
|
661
|
-
}
|
|
662
|
-
})
|
|
663
|
-
.fail(error !== null && error !== void 0 ? error : Inline.handleError);
|
|
664
|
-
};
|
|
665
|
-
Inline.handleError = function (xhr, textStatus, errorThrown) {
|
|
666
|
-
if (xhr.status === 500) {
|
|
667
|
-
Alerts.error("There was an error processing the content, please contact an administrator if this continues.", "Error " + xhr.status, 10000);
|
|
668
|
-
}
|
|
669
|
-
else if (xhr.status === 404) {
|
|
670
|
-
Alerts.error("The content could not be found.", "Error " + xhr.status, 10000);
|
|
671
|
-
}
|
|
672
|
-
else if (xhr.status === 401) {
|
|
673
|
-
Alerts.error("You are not allowed to view this resource, are you logged in correctly?", "Error " + xhr.status, 10000);
|
|
674
|
-
window.location = window.location;
|
|
675
|
-
}
|
|
676
|
-
};
|
|
677
|
-
return Inline;
|
|
678
|
-
}());
|
|
393
|
+
return Inline;
|
|
394
|
+
}());
|
|
679
395
|
|
|
680
396
|
/**
|
|
681
397
|
* Attach a data list feed to an HTML element. The element must have a data-url attribute to connect to a feed.
|
|
@@ -711,7 +427,7 @@
|
|
|
711
427
|
listUrl.search = url.search;
|
|
712
428
|
this.reload(new URL(listUrl.href));
|
|
713
429
|
}.bind(this));
|
|
714
|
-
$('body').on('submit', "form.inline[data-target=\"#"
|
|
430
|
+
$('body').on('submit', "form.inline[data-target=\"#".concat(this.element.id, "\"]"), function (e) {
|
|
715
431
|
e.preventDefault();
|
|
716
432
|
var $form = $(e.currentTarget);
|
|
717
433
|
var listUrl = document.createElement('a');
|
|
@@ -729,9 +445,24 @@
|
|
|
729
445
|
}
|
|
730
446
|
$(this.element).data('url', url);
|
|
731
447
|
}
|
|
732
|
-
Inline.load(this.element, __assign({}, this.options));
|
|
448
|
+
Inline.load(this.element, __assign({}, this.options));
|
|
449
|
+
};
|
|
450
|
+
return DataList;
|
|
451
|
+
}());
|
|
452
|
+
|
|
453
|
+
var Response = /** @class */ (function () {
|
|
454
|
+
function Response() {
|
|
455
|
+
}
|
|
456
|
+
Response.process = function (data, autoHide) {
|
|
457
|
+
if (autoHide === void 0) { autoHide = 5000; }
|
|
458
|
+
if (data.success) {
|
|
459
|
+
Alerts.success(data.message, data.title, autoHide);
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
Alerts.error(data.errors, data.title, autoHide);
|
|
463
|
+
}
|
|
733
464
|
};
|
|
734
|
-
return
|
|
465
|
+
return Response;
|
|
735
466
|
}());
|
|
736
467
|
|
|
737
468
|
var ModalController = /** @class */ (function () {
|
|
@@ -947,6 +678,9 @@
|
|
|
947
678
|
dz = this;
|
|
948
679
|
}
|
|
949
680
|
});
|
|
681
|
+
dz.on("error", function (file, errormessage) {
|
|
682
|
+
Alerts.warning(errormessage);
|
|
683
|
+
}.bind(this));
|
|
950
684
|
dz.on("success", function (file, data) {
|
|
951
685
|
Response.process(data);
|
|
952
686
|
}.bind(this));
|
|
@@ -1005,7 +739,7 @@
|
|
|
1005
739
|
if (response.data.length > 0) {
|
|
1006
740
|
var listUrl = document.createElement('a');
|
|
1007
741
|
listUrl.href = $(this.element).data('url');
|
|
1008
|
-
listUrl.search = "?dir="
|
|
742
|
+
listUrl.search = "?dir=".concat(response.data[0]);
|
|
1009
743
|
this.media.reload(new URL(listUrl.href));
|
|
1010
744
|
}
|
|
1011
745
|
}.bind(this));
|
|
@@ -1046,7 +780,7 @@
|
|
|
1046
780
|
// TODO: On close, reload the list and reinstate the modal??
|
|
1047
781
|
};
|
|
1048
782
|
MediaService.prototype.select = function (mediaObject, e) {
|
|
1049
|
-
Alerts.log("[MediaService.select] Selecting media object id "
|
|
783
|
+
Alerts.log("[MediaService.select] Selecting media object id ".concat(mediaObject.id, " - ").concat(mediaObject.filename, " and inserting ").concat(this.options.size, " url to target: ").concat(this.options.target));
|
|
1050
784
|
if (this.options.target) {
|
|
1051
785
|
var target = $(this.options.target);
|
|
1052
786
|
switch (this.options.size) {
|
|
@@ -1077,7 +811,7 @@
|
|
|
1077
811
|
};
|
|
1078
812
|
MediaService.prototype.insert = function (mediaObject, e) {
|
|
1079
813
|
// basic functionality to insert the correct string from the media response (from uploader) to given input element.
|
|
1080
|
-
Alerts.log("[MediaService.insert] Selecting media object id "
|
|
814
|
+
Alerts.log("[MediaService.insert] Selecting media object id ".concat(mediaObject.id, " - ").concat(mediaObject.filename, " and inserting ").concat(this.options.size, " image to target editor: ").concat(this.options.target));
|
|
1081
815
|
this.options.targetEditor.insertContent('<img alt="' + mediaObject.filename + '" src="' + mediaObject.url + '" class="img-fluid" />');
|
|
1082
816
|
// Run the callback for onAction
|
|
1083
817
|
if (this.options.onAction) {
|
|
@@ -1086,7 +820,7 @@
|
|
|
1086
820
|
};
|
|
1087
821
|
MediaService.prototype.attach = function (mediaObject, e) {
|
|
1088
822
|
// once file is uploaded to given directory, send media id to the given attach endpoint.
|
|
1089
|
-
Alerts.log("[MediaService.attach] Attaching media object id "
|
|
823
|
+
Alerts.log("[MediaService.attach] Attaching media object id ".concat(mediaObject.id, " - ").concat(mediaObject.filename, " to url: ").concat(this.options.url));
|
|
1090
824
|
$.post(this.options.url, { mediaId: mediaObject.id }, function (response) {
|
|
1091
825
|
Response.process(response, 5000);
|
|
1092
826
|
MediaService.refresh(response.media, this.options.refresh);
|
|
@@ -1099,12 +833,12 @@
|
|
|
1099
833
|
MediaService.prototype.galleryClick = function (mediaObject, e) {
|
|
1100
834
|
// once file is uploaded to given directory, send media id to the given attach endpoint.
|
|
1101
835
|
if (!this.isMediaSelected(mediaObject)) {
|
|
1102
|
-
Alerts.log("[MediaService.galleryClick] Adding to selected media objects - id "
|
|
836
|
+
Alerts.log("[MediaService.galleryClick] Adding to selected media objects - id ".concat(mediaObject.id, " - ").concat(mediaObject.filename, "."));
|
|
1103
837
|
this.selectedMedia.push(mediaObject);
|
|
1104
838
|
$(e.currentTarget).parents('.media-item').addClass('active');
|
|
1105
839
|
}
|
|
1106
840
|
else {
|
|
1107
|
-
Alerts.log("[MediaService.galleryClick] Removing media from selection - id "
|
|
841
|
+
Alerts.log("[MediaService.galleryClick] Removing media from selection - id ".concat(mediaObject.id, " - ").concat(mediaObject.filename, ".}"));
|
|
1108
842
|
this.selectedMedia = this.selectedMedia.filter(function (obj) {
|
|
1109
843
|
return obj.id !== mediaObject.id;
|
|
1110
844
|
});
|
|
@@ -1115,7 +849,7 @@
|
|
|
1115
849
|
e.preventDefault();
|
|
1116
850
|
e.stopPropagation();
|
|
1117
851
|
// once file is uploaded to given directory, send media id to the given attach endpoint.
|
|
1118
|
-
Alerts.log("[MediaService.galleryAdd] Adding "
|
|
852
|
+
Alerts.log("[MediaService.galleryAdd] Adding ".concat(this.selectedMedia.length, " selected media objects to url: ").concat(this.options.url));
|
|
1119
853
|
var mediaIds = this.selectedMedia.map(function (v) {
|
|
1120
854
|
return v.id;
|
|
1121
855
|
});
|
|
@@ -1224,21 +958,326 @@
|
|
|
1224
958
|
});
|
|
1225
959
|
}.bind(this)
|
|
1226
960
|
});
|
|
1227
|
-
this.modal.show($(e.currentTarget).data('hood-media-list'), e.currentTarget);
|
|
961
|
+
this.modal.show($(e.currentTarget).data('hood-media-list'), e.currentTarget);
|
|
962
|
+
};
|
|
963
|
+
MediaModal.prototype.clear = function (e) {
|
|
964
|
+
e.preventDefault();
|
|
965
|
+
e.stopPropagation();
|
|
966
|
+
Alerts.confirm({}, function (result) {
|
|
967
|
+
if (result.isConfirmed) {
|
|
968
|
+
Inline.post(e.currentTarget.href, e.currentTarget, function (response) {
|
|
969
|
+
Response.process(response, 5000);
|
|
970
|
+
MediaService.refresh(response.media, e.currentTarget.dataset.hoodMediaRefresh);
|
|
971
|
+
}.bind(this));
|
|
972
|
+
}
|
|
973
|
+
}.bind(this));
|
|
974
|
+
};
|
|
975
|
+
return MediaModal;
|
|
976
|
+
}());
|
|
977
|
+
|
|
978
|
+
var Editors = /** @class */ (function () {
|
|
979
|
+
function Editors(options) {
|
|
980
|
+
this.options = {
|
|
981
|
+
linkClasses: [
|
|
982
|
+
{ title: 'None', value: '' },
|
|
983
|
+
{ title: 'Button link', value: 'btn btn-default' },
|
|
984
|
+
{ title: 'Theme coloured button link', value: 'btn btn-primary' },
|
|
985
|
+
{ title: 'Popup image/video', value: 'colorbox-iframe' },
|
|
986
|
+
{ title: 'Button popup link', value: 'btn btn-default colorbox-iframe' },
|
|
987
|
+
{ title: 'Theme coloured button popup link', value: 'btn btn-primary colorbox-iframe' },
|
|
988
|
+
{ title: 'Large link', value: 'font-lg' },
|
|
989
|
+
{ title: 'Large button link', value: 'btn btn-default btn-lg' },
|
|
990
|
+
{ title: 'Large theme coloured button link', value: 'btn btn-primary btn-lg' },
|
|
991
|
+
{ title: 'Large popup image/video', value: 'font-lg colorbox-iframe' },
|
|
992
|
+
{ title: 'Large Button popup link', value: 'btn btn-default btn-lg colorbox-iframe' },
|
|
993
|
+
{ title: 'Theme coloured button popup link', value: 'btn btn-primary btn-lg colorbox-iframe' }
|
|
994
|
+
],
|
|
995
|
+
imageClasses: [
|
|
996
|
+
{ title: 'None', value: '' },
|
|
997
|
+
{ title: 'Full Width', value: 'user-image full' },
|
|
998
|
+
{ title: 'Left Aligned', value: 'user-image left' },
|
|
999
|
+
{ title: 'Centered', value: 'user-image center' },
|
|
1000
|
+
{ title: 'Right Aligned', value: 'user-image right' },
|
|
1001
|
+
{ title: 'Inline with text, top aligned', value: 'user-image inline top' },
|
|
1002
|
+
{ title: 'Inline with text, middle aligned', value: 'user-image inline' },
|
|
1003
|
+
{ title: 'Inline with text, bottom aligned', value: 'user-image inline bottom' },
|
|
1004
|
+
{ title: 'Pulled Left', value: 'user-image pull-left' },
|
|
1005
|
+
{ title: 'Pulled Right', value: 'user-image pull-right' },
|
|
1006
|
+
]
|
|
1007
|
+
};
|
|
1008
|
+
this.options = __assign(__assign({}, this.options), options);
|
|
1009
|
+
}
|
|
1010
|
+
Editors.prototype.richTextEditors = function () {
|
|
1011
|
+
tinymce__default["default"].init({
|
|
1012
|
+
selector: '.tinymce-full',
|
|
1013
|
+
height: 150,
|
|
1014
|
+
menubar: false,
|
|
1015
|
+
plugins: [
|
|
1016
|
+
'advlist autolink lists link image charmap print preview anchor media',
|
|
1017
|
+
'searchreplace visualblocks code fullscreen',
|
|
1018
|
+
'insertdatetime media contextmenu paste code textcolor'
|
|
1019
|
+
],
|
|
1020
|
+
toolbar: "fullscreen | styleselect forecolor backcolor | hoodimage link media image | bold italic | alignleft aligncenter alignright | bullist numlist | table | undo redo",
|
|
1021
|
+
link_class_list: this.options.linkClasses,
|
|
1022
|
+
image_class_list: this.options.imageClasses,
|
|
1023
|
+
setup: this.setupCommands.bind(this),
|
|
1024
|
+
image_dimensions: false,
|
|
1025
|
+
content_css: [
|
|
1026
|
+
'/dist/css/editor.css'
|
|
1027
|
+
],
|
|
1028
|
+
});
|
|
1029
|
+
tinymce__default["default"].init({
|
|
1030
|
+
selector: '.tinymce-simple',
|
|
1031
|
+
height: 150,
|
|
1032
|
+
plugins: [
|
|
1033
|
+
'advlist autolink lists link image charmap print preview anchor media',
|
|
1034
|
+
'searchreplace visualblocks code fullscreen',
|
|
1035
|
+
'insertdatetime media contextmenu paste code'
|
|
1036
|
+
],
|
|
1037
|
+
menubar: false,
|
|
1038
|
+
toolbar: 'fullscreen | bold italic | bullist numlist | undo redo | link',
|
|
1039
|
+
link_class_list: this.options.linkClasses,
|
|
1040
|
+
image_class_list: this.options.imageClasses,
|
|
1041
|
+
setup: this.setupCommands.bind(this),
|
|
1042
|
+
image_dimensions: false
|
|
1043
|
+
});
|
|
1044
|
+
tinymce__default["default"].init({
|
|
1045
|
+
selector: '.tinymce-full-content',
|
|
1046
|
+
height: 500,
|
|
1047
|
+
menubar: false,
|
|
1048
|
+
plugins: [
|
|
1049
|
+
'advlist autolink lists link image charmap print preview anchor media',
|
|
1050
|
+
'searchreplace visualblocks code fullscreen',
|
|
1051
|
+
'insertdatetime media contextmenu paste code textcolor'
|
|
1052
|
+
],
|
|
1053
|
+
toolbar: "fullscreen | styleselect forecolor backcolor | hoodimage link media image | bold italic | alignleft aligncenter alignright | bullist numlist | table | undo redo",
|
|
1054
|
+
link_class_list: this.options.linkClasses,
|
|
1055
|
+
image_class_list: this.options.imageClasses,
|
|
1056
|
+
setup: this.setupCommands.bind(this),
|
|
1057
|
+
image_dimensions: false
|
|
1058
|
+
});
|
|
1059
|
+
tinymce__default["default"].init({
|
|
1060
|
+
selector: '.tinymce-simple-content',
|
|
1061
|
+
height: 500,
|
|
1062
|
+
plugins: [
|
|
1063
|
+
'advlist autolink lists link image charmap print preview anchor media',
|
|
1064
|
+
'searchreplace visualblocks code fullscreen',
|
|
1065
|
+
'insertdatetime media contextmenu paste code'
|
|
1066
|
+
],
|
|
1067
|
+
menubar: false,
|
|
1068
|
+
toolbar: 'fullscreen | bold italic | bullist numlist | undo redo | link',
|
|
1069
|
+
link_class_list: this.options.linkClasses,
|
|
1070
|
+
image_class_list: this.options.imageClasses,
|
|
1071
|
+
image_dimensions: false
|
|
1072
|
+
});
|
|
1073
|
+
};
|
|
1074
|
+
Editors.prototype.setupCommands = function (editor) {
|
|
1075
|
+
this.currentEditor = $('#' + editor.id);
|
|
1076
|
+
if (this.currentEditor.data('hoodMediaList')) {
|
|
1077
|
+
editor.addButton('hoodimage', {
|
|
1078
|
+
text: 'Insert image...',
|
|
1079
|
+
icon: false,
|
|
1080
|
+
onclick: function (e) {
|
|
1081
|
+
this.mediaModal = new ModalController({
|
|
1082
|
+
onComplete: function (sender) {
|
|
1083
|
+
this.list = document.getElementById('media-list');
|
|
1084
|
+
this.service = new MediaService(this.list, {
|
|
1085
|
+
action: 'insert',
|
|
1086
|
+
url: this.currentEditor.data('hoodMediaList'),
|
|
1087
|
+
targetEditor: editor,
|
|
1088
|
+
size: this.currentEditor.data('hoodMediaSize'),
|
|
1089
|
+
beforeAction: function (sender, mediaObject) {
|
|
1090
|
+
}.bind(this),
|
|
1091
|
+
onAction: function (sender, mediaObject) {
|
|
1092
|
+
this.mediaModal.close();
|
|
1093
|
+
}.bind(this),
|
|
1094
|
+
onListLoad: function (sender) {
|
|
1095
|
+
},
|
|
1096
|
+
onListRender: function (data) {
|
|
1097
|
+
return data;
|
|
1098
|
+
},
|
|
1099
|
+
onListComplete: function (data) {
|
|
1100
|
+
},
|
|
1101
|
+
onError: function (jqXHR, textStatus, errorThrown) {
|
|
1102
|
+
},
|
|
1103
|
+
});
|
|
1104
|
+
}.bind(this)
|
|
1105
|
+
});
|
|
1106
|
+
this.mediaModal.show(this.currentEditor.data('hoodMediaList'), e.currentTarget);
|
|
1107
|
+
}.bind(this)
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1111
|
+
return Editors;
|
|
1112
|
+
}());
|
|
1113
|
+
|
|
1114
|
+
var Handlers = /** @class */ (function () {
|
|
1115
|
+
function Handlers() {
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Initialise all default Hood CMS handlers.
|
|
1119
|
+
*/
|
|
1120
|
+
Handlers.prototype.initDefaultHandlers = function () {
|
|
1121
|
+
this.checkboxToCsvInput();
|
|
1122
|
+
this.iconSelector();
|
|
1123
|
+
this.initSelectValues();
|
|
1124
|
+
this.scrollHandlers();
|
|
1125
|
+
this.selectText();
|
|
1126
|
+
this.setValueOnClick();
|
|
1127
|
+
this.submitOnChange();
|
|
1128
|
+
};
|
|
1129
|
+
/**
|
|
1130
|
+
* Sets values of any selects that have the value set in data-selected, useful for
|
|
1131
|
+
*/
|
|
1132
|
+
Handlers.prototype.initSelectValues = function (tag) {
|
|
1133
|
+
if (tag === void 0) { tag = 'body'; }
|
|
1134
|
+
$(tag).find('select[data-selected]').each(this.initSelectValuesHandler);
|
|
1135
|
+
};
|
|
1136
|
+
Handlers.prototype.initSelectValuesHandler = function (index, element) {
|
|
1137
|
+
var sel = $(this).data('selected');
|
|
1138
|
+
if (sel !== 'undefined' && sel !== '') {
|
|
1139
|
+
var selected = String(sel);
|
|
1140
|
+
$(this).val(selected);
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
/**
|
|
1144
|
+
* Sets up any Hood Icon selector fields, requires the correct HTML setup.
|
|
1145
|
+
*/
|
|
1146
|
+
Handlers.prototype.iconSelector = function (tag) {
|
|
1147
|
+
if (tag === void 0) { tag = 'body'; }
|
|
1148
|
+
$(tag).find('[data-hood-icon]').each(this.iconSelectorHandler);
|
|
1149
|
+
};
|
|
1150
|
+
Handlers.prototype.iconSelectorHandler = function (index, element) {
|
|
1151
|
+
var $tag = $(this);
|
|
1152
|
+
var input = $tag.find('input[data-hood-icon-input]');
|
|
1153
|
+
var display = $tag.find('[data-hood-icon-display]');
|
|
1154
|
+
var collapse = $tag.find('.collapse');
|
|
1155
|
+
$tag.find('[data-hood-icon-key][data-hood-icon-value]').on('click', function () {
|
|
1156
|
+
$tag.find('[data-hood-icon-key][data-hood-icon-value]').removeClass('active');
|
|
1157
|
+
$(this).addClass('active');
|
|
1158
|
+
var key = $(this).data('hoodIconKey');
|
|
1159
|
+
var value = $(this).data('hoodIconValue');
|
|
1160
|
+
$(this);
|
|
1161
|
+
display.html(value);
|
|
1162
|
+
input.val(key);
|
|
1163
|
+
if (collapse) {
|
|
1164
|
+
collapse.removeClass('show');
|
|
1165
|
+
}
|
|
1166
|
+
});
|
|
1167
|
+
};
|
|
1168
|
+
/**
|
|
1169
|
+
* Submits the form when input is changed, mark inputs with .submit-on-change class.
|
|
1170
|
+
*/
|
|
1171
|
+
Handlers.prototype.selectText = function (tag) {
|
|
1172
|
+
if (tag === void 0) { tag = 'body'; }
|
|
1173
|
+
$(tag).on('click', '.select-text', this.selectTextHandler);
|
|
1174
|
+
};
|
|
1175
|
+
Handlers.prototype.selectTextHandler = function () {
|
|
1176
|
+
var $this = $(this);
|
|
1177
|
+
$this.select();
|
|
1178
|
+
// Work around Chrome's little problem
|
|
1179
|
+
$this.mouseup(function () {
|
|
1180
|
+
// Prevent further mouseup intervention
|
|
1181
|
+
$this.unbind("mouseup");
|
|
1182
|
+
return false;
|
|
1183
|
+
});
|
|
1184
|
+
};
|
|
1185
|
+
/**
|
|
1186
|
+
* Attaches handlers for default scrolling functions, scroll to top, scroll to target (with header.header offset calculated)
|
|
1187
|
+
* and scroll to target direct (with no calculated offset).
|
|
1188
|
+
*/
|
|
1189
|
+
Handlers.prototype.scrollHandlers = function (tag) {
|
|
1190
|
+
if (tag === void 0) { tag = 'body'; }
|
|
1191
|
+
$(tag).on('click', '.scroll-top, .scroll-to-top', this.scrollTop);
|
|
1192
|
+
$(tag).on('click', '.scroll-target, .scroll-to-target', this.scrollTarget);
|
|
1193
|
+
$(tag).on('click', '.scroll-target-direct, .scroll-to-target-direct', this.scrollTargetDirect);
|
|
1194
|
+
};
|
|
1195
|
+
Handlers.prototype.scrollTop = function (e) {
|
|
1196
|
+
if (e)
|
|
1197
|
+
e.preventDefault();
|
|
1198
|
+
$('html, body').animate({ scrollTop: 0 }, 800);
|
|
1199
|
+
return false;
|
|
1200
|
+
};
|
|
1201
|
+
Handlers.prototype.scrollTarget = function (e) {
|
|
1202
|
+
if (e)
|
|
1203
|
+
e.preventDefault();
|
|
1204
|
+
var url = $(this).attr('href').split('#')[0];
|
|
1205
|
+
if (url !== window.location.pathname && url !== "") {
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
var target = this.hash;
|
|
1209
|
+
var $target = $(target);
|
|
1210
|
+
var $header = $('header.header');
|
|
1211
|
+
var headerOffset = 0;
|
|
1212
|
+
if ($header) {
|
|
1213
|
+
headerOffset = $header.height();
|
|
1214
|
+
}
|
|
1215
|
+
if ($(this).data('offset'))
|
|
1216
|
+
$('html, body').stop().animate({
|
|
1217
|
+
'scrollTop': $target.offset().top - $(this).data('offset')
|
|
1218
|
+
}, 900, 'swing');
|
|
1219
|
+
else
|
|
1220
|
+
$('html, body').stop().animate({
|
|
1221
|
+
'scrollTop': $target.offset().top - headerOffset
|
|
1222
|
+
}, 900, 'swing');
|
|
1223
|
+
};
|
|
1224
|
+
Handlers.prototype.scrollTargetDirect = function () {
|
|
1225
|
+
var scrollTop = $('body').scrollTop();
|
|
1226
|
+
var top = $($(this).attr('href')).offset().top;
|
|
1227
|
+
$('html, body').animate({
|
|
1228
|
+
scrollTop: top
|
|
1229
|
+
}, Math.abs(top - scrollTop));
|
|
1230
|
+
return false;
|
|
1231
|
+
};
|
|
1232
|
+
/**
|
|
1233
|
+
* Compiles any selected checkboxes with matching data-hood-csv-input tags,
|
|
1234
|
+
* then saves the CSV list of the values to the input given in the tag.
|
|
1235
|
+
*/
|
|
1236
|
+
Handlers.prototype.checkboxToCsvInput = function (tag) {
|
|
1237
|
+
if (tag === void 0) { tag = 'body'; }
|
|
1238
|
+
$(tag).on('change', 'input[type=checkbox][data-hood-csv-input]', this.checkboxToCsvInputHandler);
|
|
1239
|
+
};
|
|
1240
|
+
Handlers.prototype.checkboxToCsvInputHandler = function (e) {
|
|
1241
|
+
if (e)
|
|
1242
|
+
e.preventDefault();
|
|
1243
|
+
// when i change - create an array, with any other checked of the same data-input checkboxes. and add to the data-input referenced tag.
|
|
1244
|
+
var items = new Array();
|
|
1245
|
+
$('input[data-hood-csv-input="' + $(this).data('hoodCsvInput') + '"]').each(function () {
|
|
1246
|
+
if ($(this).is(":checked"))
|
|
1247
|
+
items.push($(this).val());
|
|
1248
|
+
});
|
|
1249
|
+
var id = '#' + $(this).data('input');
|
|
1250
|
+
var vals = JSON.stringify(items);
|
|
1251
|
+
$(id).val(vals);
|
|
1228
1252
|
};
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
Response.process(response, 5000);
|
|
1236
|
-
MediaService.refresh(response.media, e.currentTarget.dataset.hoodMediaRefresh);
|
|
1237
|
-
}.bind(this));
|
|
1238
|
-
}
|
|
1239
|
-
}.bind(this));
|
|
1253
|
+
/**
|
|
1254
|
+
* Submits the form when input is changed, mark inputs with .submit-on-change class.
|
|
1255
|
+
*/
|
|
1256
|
+
Handlers.prototype.submitOnChange = function (tag) {
|
|
1257
|
+
if (tag === void 0) { tag = 'body'; }
|
|
1258
|
+
$(tag).on('change', '.submit-on-change', this.submitOnChangeHandler);
|
|
1240
1259
|
};
|
|
1241
|
-
|
|
1260
|
+
Handlers.prototype.submitOnChangeHandler = function (e) {
|
|
1261
|
+
if (e)
|
|
1262
|
+
e.preventDefault();
|
|
1263
|
+
$(this).parents('form').submit();
|
|
1264
|
+
};
|
|
1265
|
+
/**
|
|
1266
|
+
* Sets the value of the input [data-target] when clicked to the value in [data-value]
|
|
1267
|
+
*/
|
|
1268
|
+
Handlers.prototype.setValueOnClick = function (tag) {
|
|
1269
|
+
if (tag === void 0) { tag = 'body'; }
|
|
1270
|
+
$(tag).on('click', '.click-select[data-target][data-value]', this.setValueOnClickHandler);
|
|
1271
|
+
};
|
|
1272
|
+
Handlers.prototype.setValueOnClickHandler = function () {
|
|
1273
|
+
var $this = $(this);
|
|
1274
|
+
var targetId = '#' + $this.data('target');
|
|
1275
|
+
$(targetId).val($this.data('value'));
|
|
1276
|
+
$(targetId).trigger('change');
|
|
1277
|
+
$('.click-select.clean[data-target="' + $this.data('target') + '"]').each(function () { $(this).removeClass('active'); });
|
|
1278
|
+
$('.click-select.clean[data-target="' + $this.data('target') + '"][data-value="' + $this.data('value') + '"]').each(function () { $(this).addClass('active'); });
|
|
1279
|
+
};
|
|
1280
|
+
return Handlers;
|
|
1242
1281
|
}());
|
|
1243
1282
|
|
|
1244
1283
|
var Uploader = /** @class */ (function () {
|
|
@@ -1381,16 +1420,228 @@
|
|
|
1381
1420
|
this.alerts = new Alerts();
|
|
1382
1421
|
this.uploader = new Uploader();
|
|
1383
1422
|
this.handlers = new Handlers();
|
|
1423
|
+
this.editors = new Editors();
|
|
1424
|
+
this.colorPickers = new ColorPickers();
|
|
1384
1425
|
this.mediaModal = new MediaModal();
|
|
1385
1426
|
// Global Handlers
|
|
1386
1427
|
this.setupLoaders();
|
|
1387
1428
|
}
|
|
1388
|
-
HoodApi.prototype.setupLoaders = function () {
|
|
1389
|
-
$('body').on('loader-show', function () { Alerts.success("Showing loader..."); });
|
|
1390
|
-
$('body').on('loader-hide', function () { Alerts.error("Hiding loader..."); });
|
|
1391
|
-
};
|
|
1392
|
-
return HoodApi;
|
|
1393
|
-
}());
|
|
1429
|
+
HoodApi.prototype.setupLoaders = function () {
|
|
1430
|
+
$('body').on('loader-show', function () { Alerts.success("Showing loader..."); });
|
|
1431
|
+
$('body').on('loader-hide', function () { Alerts.error("Hiding loader..."); });
|
|
1432
|
+
};
|
|
1433
|
+
return HoodApi;
|
|
1434
|
+
}());
|
|
1435
|
+
|
|
1436
|
+
var Loader = /** @class */ (function () {
|
|
1437
|
+
function Loader() {
|
|
1438
|
+
new CustomEvent('loader-show');
|
|
1439
|
+
new CustomEvent('loader-hide');
|
|
1440
|
+
}
|
|
1441
|
+
Loader.show = function () {
|
|
1442
|
+
$('body').trigger('loader-show');
|
|
1443
|
+
};
|
|
1444
|
+
Loader.hide = function () {
|
|
1445
|
+
$('body').trigger('loader-hide');
|
|
1446
|
+
};
|
|
1447
|
+
return Loader;
|
|
1448
|
+
}());
|
|
1449
|
+
new Loader();
|
|
1450
|
+
|
|
1451
|
+
var RandomStringGenerator = /** @class */ (function () {
|
|
1452
|
+
function RandomStringGenerator(options) {
|
|
1453
|
+
this.options = {
|
|
1454
|
+
specials: '!@#$&*',
|
|
1455
|
+
alpha: 'abcdefghijklmnopqrstuvwxyz',
|
|
1456
|
+
numeric: '0123456789',
|
|
1457
|
+
numSpecial: 2
|
|
1458
|
+
};
|
|
1459
|
+
this.options = __assign(__assign({}, this.options), options);
|
|
1460
|
+
}
|
|
1461
|
+
RandomStringGenerator.prototype.generate = function (length) {
|
|
1462
|
+
var password = '';
|
|
1463
|
+
var len = Math.ceil((length - this.options.numSpecial) / 2);
|
|
1464
|
+
for (var i = 0; i < len; i++) {
|
|
1465
|
+
password += this.options.alpha.charAt(Math.floor(Math.random() * this.options.alpha.length));
|
|
1466
|
+
password += this.options.numeric.charAt(Math.floor(Math.random() * this.options.numeric.length));
|
|
1467
|
+
}
|
|
1468
|
+
for (var j = 0; j < this.options.numSpecial; j++)
|
|
1469
|
+
password += this.options.specials.charAt(Math.floor(Math.random() * this.options.specials.length));
|
|
1470
|
+
password = password.split('').sort(function () { return 0.5 - Math.random(); }).join('');
|
|
1471
|
+
return password;
|
|
1472
|
+
};
|
|
1473
|
+
return RandomStringGenerator;
|
|
1474
|
+
}());
|
|
1475
|
+
|
|
1476
|
+
$.fn.exists = function () {
|
|
1477
|
+
return $(this).length;
|
|
1478
|
+
};
|
|
1479
|
+
$.fn.restrictToSlug = function (restrictPattern) {
|
|
1480
|
+
if (restrictPattern === void 0) { restrictPattern = /[^0-9a-zA-Z]*/g; }
|
|
1481
|
+
var targets = $(this);
|
|
1482
|
+
// The characters inside this pattern are accepted
|
|
1483
|
+
// and everything else will be 'cleaned'
|
|
1484
|
+
// For example 'ABCdEfGhI5' become 'ABCEGI5'
|
|
1485
|
+
var restrictHandler = function () {
|
|
1486
|
+
var val = $(this).val();
|
|
1487
|
+
var newVal = val.replace(restrictPattern, '');
|
|
1488
|
+
// This condition is to prevent selection and keyboard navigation issues
|
|
1489
|
+
if (val !== newVal) {
|
|
1490
|
+
$(this).val(newVal);
|
|
1491
|
+
}
|
|
1492
|
+
};
|
|
1493
|
+
targets.on('keyup', restrictHandler);
|
|
1494
|
+
targets.on('paste', restrictHandler);
|
|
1495
|
+
targets.on('change', restrictHandler);
|
|
1496
|
+
};
|
|
1497
|
+
$.fn.restrictToPageSlug = function (restrictPattern) {
|
|
1498
|
+
if (restrictPattern === void 0) { restrictPattern = /[^0-9a-zA-Z-//]*/g; }
|
|
1499
|
+
var targets = $(this);
|
|
1500
|
+
// The characters inside this pattern are accepted
|
|
1501
|
+
// and everything else will be 'cleaned'
|
|
1502
|
+
var restrictHandler = function () {
|
|
1503
|
+
var val = $(this).val();
|
|
1504
|
+
var newVal = val.replace(restrictPattern, '');
|
|
1505
|
+
if ((newVal.match(new RegExp("/", "g")) || []).length > 4) {
|
|
1506
|
+
var pos = newVal.lastIndexOf('/');
|
|
1507
|
+
newVal = newVal.substring(0, pos) + newVal.substring(pos + 1);
|
|
1508
|
+
Alerts.warning("You can only have up to 4 '/' characters in a url slug.");
|
|
1509
|
+
}
|
|
1510
|
+
// This condition is to prevent selection and keyboard navigation issues
|
|
1511
|
+
if (val !== newVal) {
|
|
1512
|
+
$(this).val(newVal);
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1515
|
+
targets.on('keyup', restrictHandler);
|
|
1516
|
+
targets.on('paste', restrictHandler);
|
|
1517
|
+
targets.on('change', restrictHandler);
|
|
1518
|
+
};
|
|
1519
|
+
$.fn.restrictToMetaSlug = function (restrictPattern) {
|
|
1520
|
+
if (restrictPattern === void 0) { restrictPattern = /[^0-9a-zA-Z.]*/g; }
|
|
1521
|
+
var targets = $(this);
|
|
1522
|
+
// The characters inside this pattern are accepted
|
|
1523
|
+
// and everything else will be 'cleaned'
|
|
1524
|
+
var restrictHandler = function () {
|
|
1525
|
+
var val = $(this).val();
|
|
1526
|
+
var newVal = val.replace(restrictPattern, '');
|
|
1527
|
+
if ((newVal.match(new RegExp(".", "g")) || []).length > 1) {
|
|
1528
|
+
var pos = newVal.lastIndexOf('.');
|
|
1529
|
+
newVal = newVal.substring(0, pos) + newVal.substring(pos + 1);
|
|
1530
|
+
Alerts.warning("You can only have up to 1 '.' characters in a meta slug.");
|
|
1531
|
+
}
|
|
1532
|
+
// This condition is to prevent selection and keyboard navigation issues
|
|
1533
|
+
if (val !== newVal) {
|
|
1534
|
+
$(this).val(newVal);
|
|
1535
|
+
}
|
|
1536
|
+
};
|
|
1537
|
+
targets.on('keyup', restrictHandler);
|
|
1538
|
+
targets.on('paste', restrictHandler);
|
|
1539
|
+
targets.on('change', restrictHandler);
|
|
1540
|
+
};
|
|
1541
|
+
$.fn.characterCounter = function () {
|
|
1542
|
+
var targets = $(this);
|
|
1543
|
+
var characterCounterHandler = function () {
|
|
1544
|
+
var counter = $(this).data('counter');
|
|
1545
|
+
var max = Number($(this).attr('maxlength'));
|
|
1546
|
+
var len = $(this).val().length;
|
|
1547
|
+
$(counter).text(max - len);
|
|
1548
|
+
var cls = "text-success";
|
|
1549
|
+
if (max - len < max / 10)
|
|
1550
|
+
cls = "text-danger";
|
|
1551
|
+
$(counter).parent().removeClass('text-success').removeClass('text-danger').addClass(cls);
|
|
1552
|
+
};
|
|
1553
|
+
targets.on('keyup', characterCounterHandler);
|
|
1554
|
+
targets.on('paste', characterCounterHandler);
|
|
1555
|
+
targets.on('change', characterCounterHandler);
|
|
1556
|
+
};
|
|
1557
|
+
$.fn.warningAlert = function () {
|
|
1558
|
+
var targets = $(this);
|
|
1559
|
+
var warningAlertHandler = function (e) {
|
|
1560
|
+
e.preventDefault();
|
|
1561
|
+
var warningAlertCallback = function (result) {
|
|
1562
|
+
if (result.isConfirmed) {
|
|
1563
|
+
var url = $(e.currentTarget).attr('href');
|
|
1564
|
+
window.location.href = url;
|
|
1565
|
+
}
|
|
1566
|
+
};
|
|
1567
|
+
Alerts.confirm({
|
|
1568
|
+
title: $(e.currentTarget).data('title'),
|
|
1569
|
+
html: $(e.currentTarget).data('warning'),
|
|
1570
|
+
footer: $(e.currentTarget).data('footer'),
|
|
1571
|
+
icon: 'warning'
|
|
1572
|
+
}, warningAlertCallback);
|
|
1573
|
+
return false;
|
|
1574
|
+
};
|
|
1575
|
+
targets.on('click', warningAlertHandler);
|
|
1576
|
+
};
|
|
1577
|
+
|
|
1578
|
+
Number.prototype.formatCurrency = function (currency) {
|
|
1579
|
+
return currency + " " + this.toFixed(2).replace(/./g, function (c, i, a) {
|
|
1580
|
+
return i > 0 && c !== "." && (a.length - i) % 3 === 0 ? "," + c : c;
|
|
1581
|
+
});
|
|
1582
|
+
};
|
|
1583
|
+
Number.prototype.formatKilobytes = function () {
|
|
1584
|
+
var n = this / 1024;
|
|
1585
|
+
return n.toFixed(0).replace(/./g, function (c, i, a) {
|
|
1586
|
+
return i > 0 && c !== "." && (a.length - i) % 3 === 0 ? "," + c : c;
|
|
1587
|
+
}) + "Kb";
|
|
1588
|
+
};
|
|
1589
|
+
Number.prototype.formatMegabytes = function () {
|
|
1590
|
+
var n = this / 1024;
|
|
1591
|
+
n = n / 1024;
|
|
1592
|
+
return n.toFixed(0).replace(/./g, function (c, i, a) {
|
|
1593
|
+
return i > 0 && c !== "." && (a.length - i) % 3 === 0 ? "," + c : c;
|
|
1594
|
+
}) + "Mb";
|
|
1595
|
+
};
|
|
1596
|
+
|
|
1597
|
+
String.prototype.htmlEncode = function () {
|
|
1598
|
+
//create a in-memory div, set it's inner text(which jQuery automatically encodes)
|
|
1599
|
+
//then grab the encoded contents back out. The div never exists on the page.
|
|
1600
|
+
return $('<div/>').text(this).html();
|
|
1601
|
+
};
|
|
1602
|
+
String.prototype.htmlDecode = function () {
|
|
1603
|
+
return $('<div/>').html(this).text();
|
|
1604
|
+
};
|
|
1605
|
+
String.prototype.contains = function (it) {
|
|
1606
|
+
return this.indexOf(it) !== -1;
|
|
1607
|
+
};
|
|
1608
|
+
String.prototype.pick = function (min, max) {
|
|
1609
|
+
var n, chars = '';
|
|
1610
|
+
if (typeof max === 'undefined') {
|
|
1611
|
+
n = min;
|
|
1612
|
+
}
|
|
1613
|
+
else {
|
|
1614
|
+
n = min + Math.floor(Math.random() * (max - min));
|
|
1615
|
+
}
|
|
1616
|
+
for (var i = 0; i < n; i++) {
|
|
1617
|
+
chars += this.charAt(Math.floor(Math.random() * this.length));
|
|
1618
|
+
}
|
|
1619
|
+
return chars;
|
|
1620
|
+
};
|
|
1621
|
+
// Credit to @Christoph: http://stackoverflow.com/a/962890/464744
|
|
1622
|
+
String.prototype.shuffle = function () {
|
|
1623
|
+
var array = this.split('');
|
|
1624
|
+
var tmp, current, top = array.length;
|
|
1625
|
+
if (top)
|
|
1626
|
+
while (--top) {
|
|
1627
|
+
current = Math.floor(Math.random() * (top + 1));
|
|
1628
|
+
tmp = array[current];
|
|
1629
|
+
array[current] = array[top];
|
|
1630
|
+
array[top] = tmp;
|
|
1631
|
+
}
|
|
1632
|
+
return array.join('');
|
|
1633
|
+
};
|
|
1634
|
+
String.prototype.toSeoUrl = function () {
|
|
1635
|
+
var output = this.replace(/[^a-zA-Z0-9]/g, ' ').replace(/\s+/g, "-").toLowerCase();
|
|
1636
|
+
/* remove first dash */
|
|
1637
|
+
if (output.charAt(0) === '-')
|
|
1638
|
+
output = output.substring(1);
|
|
1639
|
+
/* remove last dash */
|
|
1640
|
+
var last = output.length - 1;
|
|
1641
|
+
if (output.charAt(last) === '-')
|
|
1642
|
+
output = output.substring(0, last);
|
|
1643
|
+
return output;
|
|
1644
|
+
};
|
|
1394
1645
|
|
|
1395
1646
|
var HomeController = /** @class */ (function () {
|
|
1396
1647
|
function HomeController() {
|
|
@@ -1510,13 +1761,13 @@
|
|
|
1510
1761
|
this.service = new MediaService(this.list, {
|
|
1511
1762
|
action: 'show',
|
|
1512
1763
|
onAction: function (mediaObject) {
|
|
1513
|
-
Alerts.log("Showing media object id "
|
|
1764
|
+
Alerts.log("Showing media object id ".concat(mediaObject.id, " - ").concat(mediaObject.filename));
|
|
1514
1765
|
}.bind(this),
|
|
1515
1766
|
onListLoad: function () {
|
|
1516
1767
|
Alerts.log('Commencing media list fetch.');
|
|
1517
1768
|
},
|
|
1518
1769
|
onError: function (jqXHR, textStatus, errorThrown) {
|
|
1519
|
-
Alerts.log("Error loading media list: "
|
|
1770
|
+
Alerts.log("Error loading media list: ".concat(textStatus));
|
|
1520
1771
|
},
|
|
1521
1772
|
onListRender: function (data) {
|
|
1522
1773
|
Alerts.log('Fetched media list data.');
|
|
@@ -1828,31 +2079,6 @@
|
|
|
1828
2079
|
return PropertyController;
|
|
1829
2080
|
}());
|
|
1830
2081
|
|
|
1831
|
-
var RandomStringGenerator = /** @class */ (function () {
|
|
1832
|
-
function RandomStringGenerator(options) {
|
|
1833
|
-
this.options = {
|
|
1834
|
-
specials: '!@#$&*',
|
|
1835
|
-
alpha: 'abcdefghijklmnopqrstuvwxyz',
|
|
1836
|
-
numeric: '0123456789',
|
|
1837
|
-
numSpecial: 2
|
|
1838
|
-
};
|
|
1839
|
-
this.options = __assign(__assign({}, this.options), options);
|
|
1840
|
-
}
|
|
1841
|
-
RandomStringGenerator.prototype.generate = function (length) {
|
|
1842
|
-
var password = '';
|
|
1843
|
-
var len = Math.ceil((length - this.options.numSpecial) / 2);
|
|
1844
|
-
for (var i = 0; i < len; i++) {
|
|
1845
|
-
password += this.options.alpha.charAt(Math.floor(Math.random() * this.options.alpha.length));
|
|
1846
|
-
password += this.options.numeric.charAt(Math.floor(Math.random() * this.options.numeric.length));
|
|
1847
|
-
}
|
|
1848
|
-
for (var j = 0; j < this.options.numSpecial; j++)
|
|
1849
|
-
password += this.options.specials.charAt(Math.floor(Math.random() * this.options.specials.length));
|
|
1850
|
-
password = password.split('').sort(function () { return 0.5 - Math.random(); }).join('');
|
|
1851
|
-
return password;
|
|
1852
|
-
};
|
|
1853
|
-
return RandomStringGenerator;
|
|
1854
|
-
}());
|
|
1855
|
-
|
|
1856
2082
|
var UsersController = /** @class */ (function () {
|
|
1857
2083
|
function UsersController() {
|
|
1858
2084
|
this.initLists();
|
|
@@ -1961,7 +2187,7 @@
|
|
|
1961
2187
|
if (inputValue === false)
|
|
1962
2188
|
return false;
|
|
1963
2189
|
if (inputValue === "") {
|
|
1964
|
-
swal__default[
|
|
2190
|
+
swal__default["default"].showValidationMessage("You didn't supply a new password, we can't reset the password without it!");
|
|
1965
2191
|
return false;
|
|
1966
2192
|
}
|
|
1967
2193
|
}
|
|
@@ -1986,7 +2212,7 @@
|
|
|
1986
2212
|
if (inputValue === false)
|
|
1987
2213
|
return false;
|
|
1988
2214
|
if (inputValue === "") {
|
|
1989
|
-
swal__default[
|
|
2215
|
+
swal__default["default"].showValidationMessage("You didn't enter a note!");
|
|
1990
2216
|
return false;
|
|
1991
2217
|
}
|
|
1992
2218
|
}
|
|
@@ -2304,212 +2530,6 @@
|
|
|
2304
2530
|
return PropertyImporter;
|
|
2305
2531
|
}());
|
|
2306
2532
|
|
|
2307
|
-
var Editors = /** @class */ (function () {
|
|
2308
|
-
function Editors(options) {
|
|
2309
|
-
this.options = {
|
|
2310
|
-
linkClasses: [
|
|
2311
|
-
{ title: 'None', value: '' },
|
|
2312
|
-
{ title: 'Button link', value: 'btn btn-default' },
|
|
2313
|
-
{ title: 'Theme coloured button link', value: 'btn btn-primary' },
|
|
2314
|
-
{ title: 'Popup image/video', value: 'colorbox-iframe' },
|
|
2315
|
-
{ title: 'Button popup link', value: 'btn btn-default colorbox-iframe' },
|
|
2316
|
-
{ title: 'Theme coloured button popup link', value: 'btn btn-primary colorbox-iframe' },
|
|
2317
|
-
{ title: 'Large link', value: 'font-lg' },
|
|
2318
|
-
{ title: 'Large button link', value: 'btn btn-default btn-lg' },
|
|
2319
|
-
{ title: 'Large theme coloured button link', value: 'btn btn-primary btn-lg' },
|
|
2320
|
-
{ title: 'Large popup image/video', value: 'font-lg colorbox-iframe' },
|
|
2321
|
-
{ title: 'Large Button popup link', value: 'btn btn-default btn-lg colorbox-iframe' },
|
|
2322
|
-
{ title: 'Theme coloured button popup link', value: 'btn btn-primary btn-lg colorbox-iframe' }
|
|
2323
|
-
],
|
|
2324
|
-
imageClasses: [
|
|
2325
|
-
{ title: 'None', value: '' },
|
|
2326
|
-
{ title: 'Full Width', value: 'user-image full' },
|
|
2327
|
-
{ title: 'Left Aligned', value: 'user-image left' },
|
|
2328
|
-
{ title: 'Centered', value: 'user-image center' },
|
|
2329
|
-
{ title: 'Right Aligned', value: 'user-image right' },
|
|
2330
|
-
{ title: 'Inline with text, top aligned', value: 'user-image inline top' },
|
|
2331
|
-
{ title: 'Inline with text, middle aligned', value: 'user-image inline' },
|
|
2332
|
-
{ title: 'Inline with text, bottom aligned', value: 'user-image inline bottom' },
|
|
2333
|
-
{ title: 'Pulled Left', value: 'user-image pull-left' },
|
|
2334
|
-
{ title: 'Pulled Right', value: 'user-image pull-right' },
|
|
2335
|
-
]
|
|
2336
|
-
};
|
|
2337
|
-
this.options = __assign(__assign({}, this.options), options);
|
|
2338
|
-
this.richTextEditors();
|
|
2339
|
-
}
|
|
2340
|
-
Editors.prototype.richTextEditors = function () {
|
|
2341
|
-
tinymce__default['default'].init({
|
|
2342
|
-
selector: '.tinymce-full',
|
|
2343
|
-
height: 150,
|
|
2344
|
-
menubar: false,
|
|
2345
|
-
plugins: [
|
|
2346
|
-
'advlist autolink lists link image charmap print preview anchor media',
|
|
2347
|
-
'searchreplace visualblocks code fullscreen',
|
|
2348
|
-
'insertdatetime media contextmenu paste code'
|
|
2349
|
-
],
|
|
2350
|
-
toolbar: 'styleselect | bold italic | alignleft aligncenter alignright | bullist numlist | link image media hoodimage | code',
|
|
2351
|
-
link_class_list: this.options.linkClasses,
|
|
2352
|
-
image_class_list: this.options.imageClasses,
|
|
2353
|
-
setup: this.setupCommands.bind(this),
|
|
2354
|
-
image_dimensions: false,
|
|
2355
|
-
content_css: [
|
|
2356
|
-
'/dist/css/editor.css'
|
|
2357
|
-
],
|
|
2358
|
-
});
|
|
2359
|
-
tinymce__default['default'].init({
|
|
2360
|
-
selector: '.tinymce-simple',
|
|
2361
|
-
height: 150,
|
|
2362
|
-
plugins: [
|
|
2363
|
-
'advlist autolink lists link image charmap print preview anchor media',
|
|
2364
|
-
'searchreplace visualblocks code fullscreen',
|
|
2365
|
-
'insertdatetime media contextmenu paste code'
|
|
2366
|
-
],
|
|
2367
|
-
menubar: false,
|
|
2368
|
-
toolbar: 'bold italic | bullist numlist | undo redo | link',
|
|
2369
|
-
link_class_list: this.options.linkClasses,
|
|
2370
|
-
image_class_list: this.options.imageClasses,
|
|
2371
|
-
setup: this.setupCommands.bind(this),
|
|
2372
|
-
image_dimensions: false
|
|
2373
|
-
});
|
|
2374
|
-
tinymce__default['default'].init({
|
|
2375
|
-
selector: '.tinymce-full-content',
|
|
2376
|
-
height: 500,
|
|
2377
|
-
menubar: false,
|
|
2378
|
-
plugins: [
|
|
2379
|
-
'advlist autolink lists link image charmap print preview anchor media',
|
|
2380
|
-
'searchreplace visualblocks code fullscreen',
|
|
2381
|
-
'insertdatetime media contextmenu paste code'
|
|
2382
|
-
],
|
|
2383
|
-
toolbar: 'styleselect | bold italic | alignleft aligncenter alignright | bullist numlist | link image media hoodimage | code',
|
|
2384
|
-
link_class_list: this.options.linkClasses,
|
|
2385
|
-
image_class_list: this.options.imageClasses,
|
|
2386
|
-
setup: this.setupCommands.bind(this),
|
|
2387
|
-
image_dimensions: false
|
|
2388
|
-
});
|
|
2389
|
-
tinymce__default['default'].init({
|
|
2390
|
-
selector: '.tinymce-simple-content',
|
|
2391
|
-
height: 500,
|
|
2392
|
-
plugins: [
|
|
2393
|
-
'advlist autolink lists link image charmap print preview anchor media',
|
|
2394
|
-
'searchreplace visualblocks code fullscreen',
|
|
2395
|
-
'insertdatetime media contextmenu paste code'
|
|
2396
|
-
],
|
|
2397
|
-
menubar: false,
|
|
2398
|
-
toolbar: 'bold italic | bullist numlist | undo redo | link',
|
|
2399
|
-
link_class_list: this.options.linkClasses,
|
|
2400
|
-
image_class_list: this.options.imageClasses,
|
|
2401
|
-
image_dimensions: false
|
|
2402
|
-
});
|
|
2403
|
-
};
|
|
2404
|
-
Editors.prototype.setupCommands = function (editor) {
|
|
2405
|
-
this.currentEditor = $('#' + editor.id);
|
|
2406
|
-
if (this.currentEditor.data('hoodMediaList')) {
|
|
2407
|
-
editor.addButton('hoodimage', {
|
|
2408
|
-
text: 'Insert image...',
|
|
2409
|
-
icon: false,
|
|
2410
|
-
onclick: function (e) {
|
|
2411
|
-
this.mediaModal = new ModalController({
|
|
2412
|
-
onComplete: function (sender) {
|
|
2413
|
-
this.list = document.getElementById('media-list');
|
|
2414
|
-
this.service = new MediaService(this.list, {
|
|
2415
|
-
action: 'insert',
|
|
2416
|
-
url: this.currentEditor.data('hoodMediaList'),
|
|
2417
|
-
targetEditor: editor,
|
|
2418
|
-
size: this.currentEditor.data('hoodMediaSize'),
|
|
2419
|
-
beforeAction: function (sender, mediaObject) {
|
|
2420
|
-
}.bind(this),
|
|
2421
|
-
onAction: function (sender, mediaObject) {
|
|
2422
|
-
this.mediaModal.close();
|
|
2423
|
-
}.bind(this),
|
|
2424
|
-
onListLoad: function (sender) {
|
|
2425
|
-
},
|
|
2426
|
-
onListRender: function (data) {
|
|
2427
|
-
return data;
|
|
2428
|
-
},
|
|
2429
|
-
onListComplete: function (data) {
|
|
2430
|
-
},
|
|
2431
|
-
onError: function (jqXHR, textStatus, errorThrown) {
|
|
2432
|
-
},
|
|
2433
|
-
});
|
|
2434
|
-
}.bind(this)
|
|
2435
|
-
});
|
|
2436
|
-
this.mediaModal.show(this.currentEditor.data('hoodMediaList'), e.currentTarget);
|
|
2437
|
-
}.bind(this)
|
|
2438
|
-
});
|
|
2439
|
-
}
|
|
2440
|
-
};
|
|
2441
|
-
return Editors;
|
|
2442
|
-
}());
|
|
2443
|
-
|
|
2444
|
-
var ColorPickers = /** @class */ (function () {
|
|
2445
|
-
function ColorPickers(tag) {
|
|
2446
|
-
if (tag === void 0) { tag = '.color-picker'; }
|
|
2447
|
-
var updateColorFieldValue = function (color, eventSource, instance) {
|
|
2448
|
-
var elemId = $(instance._root.button).parent().data('target');
|
|
2449
|
-
$(instance._root.button).parent().css({ 'background-color': color.toHEXA().toString() });
|
|
2450
|
-
var colorHex = instance.getColor().toHEXA();
|
|
2451
|
-
var result = "";
|
|
2452
|
-
for (var i = colorHex.length - 1; i >= 0; i--) {
|
|
2453
|
-
result = colorHex[i] + result;
|
|
2454
|
-
}
|
|
2455
|
-
$(elemId).val('#' + result);
|
|
2456
|
-
$(elemId).change();
|
|
2457
|
-
};
|
|
2458
|
-
// Simple example, see optional options for more configuration.
|
|
2459
|
-
$(tag).each(function (index, elem) {
|
|
2460
|
-
var lockOpacity = true;
|
|
2461
|
-
if ($(this).data('opacity') == 'true') {
|
|
2462
|
-
lockOpacity = false;
|
|
2463
|
-
}
|
|
2464
|
-
Pickr__default['default'].create({
|
|
2465
|
-
el: elem.children[0],
|
|
2466
|
-
appClass: 'custom-class',
|
|
2467
|
-
theme: 'monolith',
|
|
2468
|
-
useAsButton: true,
|
|
2469
|
-
default: $(this).data('default') || 'none',
|
|
2470
|
-
lockOpacity: lockOpacity,
|
|
2471
|
-
defaultRepresentation: 'HEXA',
|
|
2472
|
-
position: 'bottom-end',
|
|
2473
|
-
components: {
|
|
2474
|
-
opacity: true,
|
|
2475
|
-
hue: true,
|
|
2476
|
-
interaction: {
|
|
2477
|
-
hex: false,
|
|
2478
|
-
rgba: false,
|
|
2479
|
-
hsva: false,
|
|
2480
|
-
input: true,
|
|
2481
|
-
clear: true
|
|
2482
|
-
}
|
|
2483
|
-
}
|
|
2484
|
-
})
|
|
2485
|
-
.on('init', function (instance) {
|
|
2486
|
-
var elemId = $(instance._root.button).parent().data('target');
|
|
2487
|
-
var value = $(elemId).val();
|
|
2488
|
-
$(instance._root.button).parent().on('click', $.proxy(function () {
|
|
2489
|
-
this.show();
|
|
2490
|
-
}, instance));
|
|
2491
|
-
$(elemId).on('click', $.proxy(function () {
|
|
2492
|
-
this.show();
|
|
2493
|
-
}, instance));
|
|
2494
|
-
if (value) {
|
|
2495
|
-
instance.setColor(value);
|
|
2496
|
-
updateColorFieldValue(instance.getColor(), null, instance);
|
|
2497
|
-
}
|
|
2498
|
-
})
|
|
2499
|
-
.on('clear', function (instance) {
|
|
2500
|
-
var elemId = $(instance._root.button).parent().data('target');
|
|
2501
|
-
instance.setColor('transparent');
|
|
2502
|
-
updateColorFieldValue(instance.getColor(), null, instance);
|
|
2503
|
-
$(elemId).val('');
|
|
2504
|
-
$(elemId).change();
|
|
2505
|
-
})
|
|
2506
|
-
.on('change', updateColorFieldValue);
|
|
2507
|
-
});
|
|
2508
|
-
}
|
|
2509
|
-
return ColorPickers;
|
|
2510
|
-
}());
|
|
2511
|
-
|
|
2512
|
-
/// <reference types="jquery.slimscroll" />
|
|
2513
2533
|
var Admin = /** @class */ (function (_super) {
|
|
2514
2534
|
__extends(Admin, _super);
|
|
2515
2535
|
function Admin() {
|
|
@@ -2526,8 +2546,10 @@
|
|
|
2526
2546
|
_this.propertyImporter = new PropertyImporter();
|
|
2527
2547
|
_this.themes = new ThemesController();
|
|
2528
2548
|
_this.users = new UsersController();
|
|
2529
|
-
|
|
2530
|
-
|
|
2549
|
+
// Hook up rich text editors
|
|
2550
|
+
_this.editors.richTextEditors();
|
|
2551
|
+
// Hook up colour pickers
|
|
2552
|
+
_this.colorPickers.loadColorPickers();
|
|
2531
2553
|
if ($('#page-tabs').length > 0) {
|
|
2532
2554
|
_this.checkAndLoadTabs('#page-tabs');
|
|
2533
2555
|
}
|
|
@@ -2568,10 +2590,6 @@
|
|
|
2568
2590
|
}(HoodApi));
|
|
2569
2591
|
window.hood = new Admin();
|
|
2570
2592
|
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2574
|
-
|
|
2575
|
-
})));
|
|
2576
|
-
if (typeof this !== 'undefined' && this.hood){ this.hoodCMS = this.Hood = this.hoodCMS = this.HoodCMS = this.hood}
|
|
2593
|
+
}));
|
|
2594
|
+
if (typeof this !== 'undefined' && this.hood){ this.hoodCMS = this.Hood = this.hoodCMS = this.HoodCMS = this.hood }
|
|
2577
2595
|
//# sourceMappingURL=admin.js.map
|