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/dist/js/app.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
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
|
-
(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports,require('sweetalert2'),require('bootstrap')):typeof define==='function'&&define.amd?define(['exports','sweetalert2','bootstrap'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.
|
|
7
|
+
(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports,require('sweetalert2'),require('@simonwep/pickr'),require('tinymce/tinymce'),require('bootstrap')):typeof define==='function'&&define.amd?define(['exports','sweetalert2','@simonwep/pickr','tinymce/tinymce','bootstrap'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.hood={},g.Swal,g.Pickr,g.tinymce,g.bootstrap));})(this,(function(exports,Swal,Pickr,tinymce,bootstrap){'use strict';function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var Swal__default=/*#__PURE__*/_interopDefaultLegacy(Swal);var Pickr__default=/*#__PURE__*/_interopDefaultLegacy(Pickr);var tinymce__default=/*#__PURE__*/_interopDefaultLegacy(tinymce);/*! *****************************************************************************
|
|
6
8
|
Copyright (c) Microsoft Corporation.
|
|
7
9
|
|
|
8
10
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -16,7 +18,6 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
16
18
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
19
|
PERFORMANCE OF THIS SOFTWARE.
|
|
18
20
|
***************************************************************************** */
|
|
19
|
-
var extendStatics=function(t,e){return (extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e;}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);})(t,e)};function __extends(t,e){function r(){this.constructor=t;}extendStatics(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r);}var __assign=function(){return (__assign=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};"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),!1!==this.options.bgColor&&this._toastEl.css("background-color",this.options.bgColor),!1!==this.options.textColor&&this._toastEl.css("color",this.options.textColor),this.options.textAlign&&this._toastEl.css("text-align",this.options.textAlign),!1!==this.options.icon&&(this._toastEl.addClass("jq-has-icon"),-1!==t.inArray(this.options.icon,this._defaultIcons)&&this._toastEl.addClass("jq-icon-"+this.options.icon)),!1!==this.options.class&&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-this.options.stack;i>0&&t(".jq-toast-wrap").find(".jq-toast-single").slice(0,i).remove();}this._container=o;},canAutoHide:function(){return !1!==this.options.hideAfter&&!isNaN(parseInt(this.options.hideAfter,10))},processLoader:function(){if(!this.canAutoHide()||!1===this.options.loader)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()){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);var BootstrapSwal=Swal__default['default'].mixin({customClass:{confirmButton:"btn btn-success m-1 px-3",cancelButton:"btn btn-danger m-1 px-3"},buttonsStyling:!1}),Alerts=function(){function o(){}return o.log=function(o,t){if(void 0===t&&(t="message"),document.body.classList.contains("dev-mode"))switch(t){case"error":console.error(o);break;case"message":console.log(o);break;case"warning":console.warn(o);break;case"info":console.info(o);}},o.error=function(o,t,e){void 0===t&&(t=null),void 0===e&&(e=null),$.toast({heading:t,text:o,icon:"error",position:"bottom-left",loader:!1,bgColor:"#d0100b",textColor:"white",hideAfter:e});},o.warning=function(o,t,e){void 0===t&&(t=null),void 0===e&&(e=null),$.toast({heading:t,text:o,icon:"error",position:"bottom-left",loader:!1,bgColor:"#ef9007",textColor:"white",hideAfter:e});},o.message=function(o,t,e){void 0===t&&(t=null),void 0===e&&(e=null),$.toast({heading:t,text:o,icon:"error",position:"bottom-left",loader:!1,bgColor:"#222222",textColor:"white",hideAfter:e});},o.success=function(o,t,e){void 0===t&&(t=null),void 0===e&&(e=null),$.toast({heading:t,text:o,icon:"error",position:"bottom-left",loader:!1,bgColor:"#28a745",textColor:"white",hideAfter:e});},o.alert=function(t,e,n,i){switch(void 0===e&&(e=null),void 0===n&&(n="info"),void 0===i&&(i=1e4),n){case"error":o.error(t,e,i);break;case"warning":o.warning(t,e,i);break;case"info":o.message(t,e,i);break;case"success":o.success(t,e,i);}},o.sweetAlert=function(o,t){BootstrapSwal.fire(o).then((function(o){t(o);}));},o.confirm=function(t,e){o.sweetAlert(__assign(__assign({},{showCancelButton:!0,footer:null,title:"Are you sure?",html:"Are you sure you want to do this?",confirmButtonText:"Ok",cancelButtonText:"Cancel"}),t),e);},o.prompt=function(t,e){o.sweetAlert(__assign(__assign({},{input:"text",inputAttributes:{autocapitalize:"off"},showCancelButton:!0,icon:"info",footer:'<span class="text-warning"><i class="fa fa-exclamation-triangle"></i> This cannot be undone.</span>',confirmButtonText:"Ok",cancelButtonText:"Cancel"}),t),e);},o.prototype.log=function(t,e){void 0===e&&(e="message"),o.log(t,e);},o.prototype.error=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null),o.error(t,e,n);},o.prototype.warning=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null),o.warning(t,e,n);},o.prototype.message=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null),o.message(t,e,n);},o.prototype.success=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null),o.success(t,e,n);},o.prototype.alert=function(t,e,n,i){void 0===n&&(n="info"),void 0===i&&(i=1e4),o.alert(t,t,n,i);},o.prototype.sweetAlert=function(t,e){o.sweetAlert(t,e);},o.prototype.confirm=function(t,e){o.confirm(t,e);},o.prototype.prompt=function(t,e){o.prompt(t,e);},o}();var Handlers=function(){function t(){}return t.prototype.initDefaultHandlers=function(){this.checkboxToCsvInput(),this.iconSelector(),this.initSelectValues(),this.scrollHandlers(),this.selectText(),this.setValueOnClick(),this.submitOnChange();},t.prototype.initSelectValues=function(t){void 0===t&&(t="body"),$(t).find("select[data-selected]").each(this.initSelectValuesHandler);},t.prototype.initSelectValuesHandler=function(t,e){var o=$(this).data("selected");if("undefined"!==o&&""!==o){var a=String(o);$(this).val(a);}},t.prototype.iconSelector=function(t){void 0===t&&(t="body"),$(t).find("[data-hood-icon]").each(this.iconSelectorHandler);},t.prototype.iconSelectorHandler=function(t,e){var o=$(this),a=o.find("input[data-hood-icon-input]"),n=o.find("[data-hood-icon-display]"),i=o.find(".collapse");o.find("[data-hood-icon-key][data-hood-icon-value]").on("click",(function(){o.find("[data-hood-icon-key][data-hood-icon-value]").removeClass("active"),$(this).addClass("active");var t=$(this).data("hoodIconKey"),e=$(this).data("hoodIconValue");$(this),n.html(e),a.val(t),i&&i.removeClass("show");}));},t.prototype.selectText=function(t){void 0===t&&(t="body"),$(t).on("click",".select-text",this.selectTextHandler);},t.prototype.selectTextHandler=function(){var t=$(this);t.select(),t.mouseup((function(){return t.unbind("mouseup"),!1}));},t.prototype.scrollHandlers=function(t){void 0===t&&(t="body"),$(t).on("click",".scroll-top, .scroll-to-top",this.scrollTop),$(t).on("click",".scroll-target, .scroll-to-target",this.scrollTarget),$(t).on("click",".scroll-target-direct, .scroll-to-target-direct",this.scrollTargetDirect);},t.prototype.scrollTop=function(t){return t&&t.preventDefault(),$("html, body").animate({scrollTop:0},800),!1},t.prototype.scrollTarget=function(t){t&&t.preventDefault();var e=$(this).attr("href").split("#")[0];if(e===window.location.pathname||""===e){var o=this.hash,a=$(o),n=$("header.header"),i=0;n&&(i=n.height()),$(this).data("offset")?$("html, body").stop().animate({scrollTop:a.offset().top-$(this).data("offset")},900,"swing"):$("html, body").stop().animate({scrollTop:a.offset().top-i},900,"swing");}},t.prototype.scrollTargetDirect=function(){var t=$("body").scrollTop(),e=$($(this).attr("href")).offset().top;return $("html, body").animate({scrollTop:e},Math.abs(e-t)),!1},t.prototype.checkboxToCsvInput=function(t){void 0===t&&(t="body"),$(t).on("change","input[type=checkbox][data-hood-csv-input]",this.checkboxToCsvInputHandler);},t.prototype.checkboxToCsvInputHandler=function(t){t&&t.preventDefault();var e=new Array;$('input[data-hood-csv-input="'+$(this).data("hoodCsvInput")+'"]').each((function(){$(this).is(":checked")&&e.push($(this).val());}));var o="#"+$(this).data("input"),a=JSON.stringify(e);$(o).val(a);},t.prototype.submitOnChange=function(t){void 0===t&&(t="body"),$(t).on("change",".submit-on-change",this.submitOnChangeHandler);},t.prototype.submitOnChangeHandler=function(t){t&&t.preventDefault(),$(this).parents("form").submit();},t.prototype.setValueOnClick=function(t){void 0===t&&(t="body"),$(t).on("click",".click-select[data-target][data-value]",this.setValueOnClickHandler);},t.prototype.setValueOnClickHandler=function(){var t=$(this),e="#"+t.data("target");$(e).val(t.data("value")),$(e).trigger("change"),$('.click-select.clean[data-target="'+t.data("target")+'"]').each((function(){$(this).removeClass("active");})),$('.click-select.clean[data-target="'+t.data("target")+'"][data-value="'+t.data("value")+'"]').each((function(){$(this).addClass("active");}));},t}();var Response=function(){function e(){}return e.process=function(e,s){void 0===s&&(s=5e3),e.success?Alerts.success(e.message,e.title,s):Alerts.error(e.errors,e.title,s);},e}();var Inline=function(){function o(){}return o.load=function(n,r){var t,e=$(n);e.addClass("loading"),r.onLoad&&r.onLoad(n);var l=e.data("url");$.get(l,(function(o){r.onRender&&(o=r.onRender(o,n)),e.html(o),e.removeClass("loading"),r.onComplete&&r.onComplete(o,n);})).fail(null!==(t=r.onError)&&void 0!==t?t:o.handleError);},o.task=function(n,r,t,e){void 0===t&&(t=null),void 0===e&&(e=null),r&&r.classList.add("loading"),$.get(n,(function(o){r&&r.classList.remove("loading"),t&&t(o,r);})).fail(null!=e?e:o.handleError);},o.post=function(n,r,t,e){void 0===t&&(t=null),void 0===e&&(e=null),r&&r.classList.add("loading"),$.post(n,(function(o){r&&r.classList.remove("loading"),t&&t(o,r);})).fail(null!=e?e:o.handleError);},o.handleError=function(o,n,r){500===o.status?Alerts.error("There was an error processing the content, please contact an administrator if this continues.","Error "+o.status,1e4):404===o.status?Alerts.error("The content could not be found.","Error "+o.status,1e4):401===o.status&&(Alerts.error("You are not allowed to view this resource, are you logged in correctly?","Error "+o.status,1e4),window.location=window.location);},o}();var DataList=function(){function e(e,t){if(this.element=e,this.element.hoodDataList=this,void 0!==e&&null!=e){if(this.options=__assign(__assign({},this.options),t),$(this.element).hasClass("query")){var n=$(this.element).data("url")+window.location.search;$(this.element).attr("data-url",n),$(this.element).data("url",n);}if(!$(this.element).hasClass("refresh-only")){var i=document.createElement("a");i.href=$(this.element).data("url"),this.reload(new URL(i.href));}$(this.element).on("click",".pagination a, a.hood-inline-list-target",function(e){e.preventDefault();var t=document.createElement("a");t.href=e.currentTarget.href;var n=document.createElement("a");n.href=$(this.element).data("url"),n.search=t.search,this.reload(new URL(n.href));}.bind(this)),$("body").on("submit",'form.inline[data-target="#'+this.element.id+'"]',function(e){e.preventDefault();var t=$(e.currentTarget),n=document.createElement("a");n.href=$(this.element).data("url"),n.search="?"+t.serialize(),this.reload(new URL(n.href));}.bind(this));}else Alerts.log("Could not DataList to element, element does not exist.","error");}return e.prototype.reload=function(e){if(void 0===e&&(e=null),e){if(history.pushState&&$(this.element).hasClass("query")){var t=window.location.protocol+"//"+window.location.host+window.location.pathname+(e.href.contains("?")?"?"+e.href.substring(e.href.indexOf("?")+1):"");window.history.pushState({path:t},"",t);}$(this.element).data("url",e);}Inline.load(this.element,__assign({},this.options));},e}();
|
|
20
|
-
var ModalController=function(){function t(t){void 0===t&&(t=null),this.isOpen=!1,this.options={closePrevious:!0},this.options=__assign(__assign({},this.options),t);}return t.prototype.show=function(t,o){this.options.onLoad&&this.options.onLoad(this.element),this.isOpen||(this.isOpen=!0,$.get(t,function(t){this.modal&&this.options.closePrevious&&this.close(),this.options.onRender&&(t=this.options.onRender(this.element,t)),this.element=this.createElementFromHTML(t),this.element.classList.add("hood-inline-modal"),$("body").append(this.element),this.modal=new bootstrap.Modal(this.element,{}),this.modal.show(),this.element.addEventListener("shown.bs.modal",function(){$(document).off("focusin.modal");}.bind(this)),this.element.addEventListener("hidden.bs.modal",function(){this.options.onHidden&&this.options.onHidden(this.element),this.dispose(),this.isOpen=!1;}.bind(this)),this.options.onComplete&&this.options.onComplete(this.element);}.bind(this)).fail(function(t,o,i){this.isOpen=!1,this.options.onError&&this.options.onError(t,o,i),Inline.handleError(t,o,i);}.bind(this)));},t.prototype.close=function(){this.modal&&this.modal.hide();},t.prototype.dispose=function(){this.modal.dispose(),this.element.remove();},t.prototype.createElementFromHTML=function(t){var o=document.createElement("div");return o.innerHTML=t.trim(),o.firstChild},t}();var Validator=function(){function t(t,i){if(this.options={errorAlert:"There are errors, please check the form.",useAjax:!0},this.element=t,this.element){this.options.serializationFunction=function(){return $(this.element).serialize()}.bind(this),this.options=__assign(__assign({},this.options),i),this.element.addEventListener("submit",function(t){t.preventDefault(),t.stopImmediatePropagation(),this.submitForm();}.bind(this));var e='[data-submit="#'+this.element.id+'"]',n=$(e);n&&n.on("click",function(t){t.preventDefault(),t.stopImmediatePropagation(),$(t.currentTarget).data("exit")&&($(this.element).find("input#exit").remove(),$("<input id='exit' />").attr("type","hidden").attr("name","exit").attr("value","true").appendTo(this.element)),this.submitForm();}.bind(this));}}return t.prototype.submitForm=function(){var t;if(this.element.classList.add("was-validated"),this.element.checkValidity()){this.element.classList.add("loading");var i=this.element.querySelector("input[type=checkbox]");if(i&&Array.prototype.slice.call(i).forEach((function(t){$(this).is(":checked")&&$(this).val("true");})),this.options.onSubmit&&this.options.onSubmit(this),this.options.useAjax){var e=this.options.serializationFunction();$.post(this.element.action,e,function(t){this.options.onComplete&&this.options.onComplete(t,this);}.bind(this)).fail(null!==(t=this.options.onError)&&void 0!==t?t:Inline.handleError);}else this.element.submit();}else this.options.errorAlert&&Alerts.error(this.options.errorAlert,null,5e3);},t}();var MediaService=function(){function e(e,t){this.options={action:"show",size:"large"},this.galleryInitialised=!1,this.selectedMedia=new Array,this.element=e,this.element&&(this.options=__assign(__assign({},this.options),t),$("body").off("click",".media-delete",this.delete.bind(this)),$("body").on("click",".media-delete",this.delete.bind(this)),$(this.element).on("click",".media-item",this.action.bind(this)),$(this.element).on("click",".media-create-directory",this.createDirectory.bind(this)),$(this.element).on("click",".media-delete-directory",this.deleteDirectory.bind(this)),this.media=new DataList(this.element,{onLoad:this.options.onListLoad,onError:this.options.onError,onRender:this.options.onListRender,onComplete:function(e,t){this.initUploader(),"gallery"!=this.options.action||this.galleryInitialised||($("#media-select-modal .modal-footer").removeClass("d-none"),$("#media-select-modal .modal-footer").on("click",this.galleryAdd.bind(this)),this.galleryInitialised=!0),this.options.onListComplete&&this.options.onListComplete(e,t);}.bind(this)}));}return e.prototype.initUploader=function(){if(this.uploadButton=document.getElementById("media-add"),this.uploader=document.getElementById("media-upload"),this.uploadButton&&this.uploader){this.progressArea=document.getElementById("media-progress"),this.progressText=$('<div class="progress-text text-muted mb-3"><i class="fa fa-info-circle me-2"></i>Uploading file <span></span>...</div>'),this.progress=$('<div class="progress"><div class= "progress-bar progress-bar-striped" role="progressbar" style="width:0%" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100" ></div></div>'),this.progressText.appendTo(this.progressArea),this.progress.appendTo(this.progressArea);var e=null;$("#media-upload").dropzone({url:$("#media-upload").data("url")+"?directoryId="+$("#media-list > #upload-directory-id").val(),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,paramName:"files",acceptedFiles:$("#media-upload").data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:!1,clickable:"#media-add",dictDefaultMessage:'<span><i class="fa fa-cloud-upload fa-4x"></i><br />Drag and drop files here, or simply click me!</div>',dictResponseError:"Error while uploading file!",init:function(){e=this;}}),e.on("success",function(e,t){Response.process(t);}.bind(this)),e.on("addedfile",function(e){this.progress.find(".progress-bar").css({width:"0%"}),this.progressText.find("span").html("0%");}.bind(this)),e.on("totaluploadprogress",function(e,t,i){this.progress.find(".progress-bar").css({width:e+"%"}),this.progressText.find("span").html(Math.round(e)+"% - "+i.formatKilobytes()+" / "+t.formatKilobytes());}.bind(this)),e.on("sending",function(e){this.progressArea.classList.remove("collapse"),this.progress.find(".progress-bar").css({width:"0%"}),this.progressText.find("span").html("0%");}.bind(this)),e.on("complete",function(e){this.media.reload();}.bind(this)),e.on("queuecomplete",function(){this.progressArea.classList.add("collapse"),this.media.reload();}.bind(this));}},e.prototype.createDirectory=function(e){e.preventDefault(),e.stopPropagation();var t=new ModalController({onComplete:function(){var e=document.getElementById("content-directories-edit-form");new Validator(e,{onComplete:function(e){Response.process(e,5e3),e.success&&(this.media.reload(),t.close());}.bind(this)});}.bind(this)});t.show($(e.currentTarget).attr("href"),this.element);},e.prototype.deleteDirectory=function(e){e.preventDefault(),e.stopPropagation(),Alerts.confirm({},function(t){t.isConfirmed&&Inline.post(e.currentTarget.href,e.currentTarget,function(e,t){if(Response.process(e,5e3),e.data.length>0){var i=document.createElement("a");i.href=$(this.element).data("url"),i.search="?dir="+e.data[0],this.media.reload(new URL(i.href));}}.bind(this));}.bind(this));},e.prototype.uploadUrl=function(){return $("#media-upload").data("url")+"?directoryId="+$("#media-list > #upload-directory-id").val()},e.prototype.action=function(e){e.preventDefault(),e.stopPropagation();var t=$(e.currentTarget).data("json");switch(this.options.action){case"select":this.select(t,e);break;case"insert":this.insert(t,e);break;case"attach":this.attach(t,e);break;case"gallery":this.galleryClick(t,e);break;default:this.show(t,e);}},e.prototype.show=function(e,t){this.currentBlade=new ModalController,this.currentBlade.show($(t.target).data("blade"),t.target);},e.prototype.select=function(t,i){if(Alerts.log("[MediaService.select] Selecting media object id "+t.id+" - "+t.filename+" and inserting "+this.options.size+" url to target: "+this.options.target),this.options.target){var o=$(this.options.target);switch(this.options.size){case"thumb":o.val(t.thumbUrl);break;case"small":o.val(t.smallUrl);break;case"medium":o.val(t.mediumUrl);break;case"large":o.val(t.largeUrl);break;case"full":o.val(t.url);}}this.options.refresh&&e.refresh(t,this.options.refresh),this.options.onAction&&this.options.onAction(t);},e.prototype.insert=function(e,t){Alerts.log("[MediaService.insert] Selecting media object id "+e.id+" - "+e.filename+" and inserting "+this.options.size+" image to target editor: "+this.options.target),this.options.targetEditor.insertContent('<img alt="'+e.filename+'" src="'+e.url+'" class="img-fluid" />'),this.options.onAction&&this.options.onAction(e);},e.prototype.attach=function(t,i){Alerts.log("[MediaService.attach] Attaching media object id "+t.id+" - "+t.filename+" to url: "+this.options.url),$.post(this.options.url,{mediaId:t.id},function(i){Response.process(i,5e3),e.refresh(i.media,this.options.refresh),this.options.onAction&&this.options.onAction(t);}.bind(this));},e.prototype.galleryClick=function(e,t){this.isMediaSelected(e)?(Alerts.log("[MediaService.galleryClick] Removing media from selection - id "+e.id+" - "+e.filename+".}"),this.selectedMedia=this.selectedMedia.filter((function(t){return t.id!==e.id})),$(t.currentTarget).parents(".media-item").removeClass("active")):(Alerts.log("[MediaService.galleryClick] Adding to selected media objects - id "+e.id+" - "+e.filename+"."),this.selectedMedia.push(e),$(t.currentTarget).parents(".media-item").addClass("active"));},e.prototype.galleryAdd=function(e){e.preventDefault(),e.stopPropagation(),Alerts.log("[MediaService.galleryAdd] Adding "+this.selectedMedia.length+" selected media objects to url: "+this.options.url);var t=this.selectedMedia.map((function(e){return e.id}));$.post(this.options.url,{media:t},function(e){Response.process(e),document.getElementById(this.options.target).hoodDataList.reload(),this.options.onAction&&this.options.onAction(e.media);}.bind(this));},e.prototype.isMediaSelected=function(e){var t=!1;return this.selectedMedia.forEach((function(i,o,s){i.id==e.id&&(t=!0);})),t},e.refresh=function(e,t){var i=e.icon;if("Image"===e.genericFileType&&(i=e.mediumUrl),t){var o=$(t);o.css({"background-image":"url("+i+")"}),o.find("img").attr("src",i),o.removeClass("loading");}},e.prototype.delete=function(e){e.preventDefault(),e.stopPropagation(),Alerts.confirm({html:"This file will be permanently deleted, are you sure?"},function(t){t.isConfirmed&&Inline.post(e.currentTarget.href,e.currentTarget,function(e){Response.process(e,5e3),this.media.reload(),this.currentBlade&&this.currentBlade.close();}.bind(this));}.bind(this));},e}();var MediaModal=function(){function e(){$("body").on("click","[data-hood-media=attach],[data-hood-media=select],[data-hood-media=gallery]",this.load.bind(this)),$("body").on("click","[data-hood-media=clear]",this.clear.bind(this)),$("[data-hood-media=gallery]").each(this.initGallery.bind(this));}return e.prototype.initGallery=function(e,t){var i=document.getElementById(t.dataset.hoodMediaTarget);i&&new DataList(i,{onComplete:function(e,t){Alerts.log("Finished loading gallery media list.","info");}.bind(this)});},e.prototype.load=function(e){e.preventDefault(),e.stopPropagation(),this.element=e.currentTarget,this.modal&&this.modal.isOpen||(this.modal=new ModalController({onComplete:function(e){this.list=document.getElementById("media-list"),this.service=new MediaService(this.list,{action:this.element.dataset.hoodMedia,url:this.element.dataset.hoodMediaUrl,refresh:this.element.dataset.hoodMediaRefresh,target:this.element.dataset.hoodMediaTarget,size:this.element.dataset.hoodMediaSize,beforeAction:function(e,t){}.bind(this),onAction:function(e,t){this.modal.close();}.bind(this),onListLoad:function(e){},onListRender:function(e){return e},onListComplete:function(e){},onError:function(e,t,i){}});}.bind(this)}),this.modal.show($(e.currentTarget).data("hood-media-list"),e.currentTarget));},e.prototype.clear=function(e){e.preventDefault(),e.stopPropagation(),Alerts.confirm({},function(t){t.isConfirmed&&Inline.post(e.currentTarget.href,e.currentTarget,function(t){Response.process(t,5e3),MediaService.refresh(t.media,e.currentTarget.dataset.hoodMediaRefresh);}.bind(this));}.bind(this));},e}();var Uploader=function(){function e(){($(".image-uploader").length||$(".gallery-uploader").length)&&($(".upload-progress-bar").hide(),$(".image-uploader").each(this.singleImage),$(".gallery-uploader").each(this.gallery));}return e.prototype.refreshImage=function(e,r){$(e.data("preview")).css({"background-image":"url("+r.media.smallUrl+")"}),$(e.data("preview")).find("img").attr("src",r.media.smallUrl);},e.prototype.singleImage=function(){var e="#"+$(this).attr("id"),r=$(e),a="#"+$(this).attr("json"),l=null;r.dropzone({url:r.data("url"),maxFiles:1,paramName:"file",parallelUploads:1,acceptedFiles:r.data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:!1,clickable:e,init:function(){l=this;}}),l.on("addedfile",(function(){})),l.on("totaluploadprogress",(function(r){$(".upload-progress-bar."+e.replace("#","")+" .progress-bar").css({width:r+"%"});})),l.on("sending",(function(a){$(".upload-progress-bar."+e.replace("#","")).show(),$(r.data("preview")).addClass("loading");})),l.on("queuecomplete",(function(r){$(".upload-progress-bar."+e.replace("#","")).hide();})),l.on("success",(function(e,o){o.success?(o.media&&($(a).val(JSON.stringify(o.media)),$(r.data("preview")).css({"background-image":"url("+o.media.smallUrl+")"}),$(r.data("preview")).find("img").attr("src",o.media.smallUrl)),Alerts.success("New image added!")):Alerts.error("There was a problem adding the image: "+o.error),l.removeFile(e),$(r.data("preview")).removeClass("loading");}));},e.prototype.gallery=function(){var e="#"+$(this).attr("id"),r=$(e),a=document.querySelector(e+"-template");a.id="";var l=a.parentNode.innerHTML;a.parentNode.removeChild(a);var o=null;r.dropzone({url:r.data("url"),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:l,paramName:"files",acceptedFiles:r.data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:"#previews",clickable:".fileinput-button",init:function(){o=this;}}),$(e+" .cancel").hide(),o.on("addedfile",(function(r){$(r.previewElement.querySelector(".complete")).hide(),$(r.previewElement.querySelector(".cancel")).show(),$(e+" .cancel").show();})),o.on("totaluploadprogress",(function(e,r,a){document.querySelector("#total-progress .progress-bar").style.width=e+"%";})),o.on("sending",(function(e){document.querySelector("#total-progress").style.opacity="1";})),o.on("complete",(function(e){$(e.previewElement.querySelector(".cancel")).hide(),$(e.previewElement.querySelector(".progress")).hide(),$(e.previewElement.querySelector(".complete")).show(),console.error("Uploader.Gallery.Dropzone.OnComplete - Inline.Refresh('.gallery') is not implemented.");})),o.on("queuecomplete",(function(r){document.querySelector("#total-progress").style.opacity="0",$(e+" .cancel").hide();})),o.on("success",(function(e,r){console.error("Uploader.Gallery.Dropzone.OnSuccess - Inline.Refresh('.gallery') is not implemented."),r.success?Alerts.success("New images added!"):Alerts.error("There was a problem adding the profile image: "+r.error);})),$(".actions .cancel").click((function(){o.removeAllFiles(!0);}));},e}();var HoodApi=function(){function o(){this.alerts=new Alerts,this.uploader=new Uploader,this.handlers=new Handlers,this.mediaModal=new MediaModal,this.setupLoaders();}return o.prototype.setupLoaders=function(){$("body").on("loader-show",(function(){Alerts.success("Showing loader...");})),$("body").on("loader-hide",(function(){Alerts.error("Hiding loader...");}));},o}();var PropertyController=function(){function t(){this.map=null,this.center={lat:30,lng:-110},this.initList();}return t.prototype.initList=function(){this.element=document.getElementById("property-list"),this.element&&(this.list=new DataList(this.element,{onComplete:function(t,e){Alerts.log("Finished loading property list.","info");}.bind(this)}));},t.prototype.initMapList=function(){this.mapListElement=document.getElementById("property-map-list"),this.mapElement&&(this.mapList=new DataList(this.mapListElement,{onComplete:function(t,e){Alerts.log("Finished loading map list.","info"),this.reloadMarkers();}.bind(this)}));},t.prototype.initMap=function(t){void 0===t&&(t="property-map"),this.mapElement=document.getElementById(t),this.mapElement&&(this.center={lat:+this.mapElement.dataset.lat,lng:+this.mapElement.dataset.long},this.map=new google.maps.Map(this.mapElement,{zoom:+this.mapElement.dataset.zoom||15,center:this.center,scrollwheel:!1}),$(window).resize(function(){google.maps.event.trigger(this.map,"resize");}.bind(this)),google.maps.event.trigger(this.map,"resize"),this.initMapList());},t.prototype.reloadMarkers=function(){var t=null;if(this.mapElement){var e=this.map;if(this.markers)for(var i=0;i<this.markers.length;i++)this.markers[i].setMap(null);this.markers=[],$("#property-map-locations").data("locations").map(function(i,n){var o=new google.maps.Marker({position:new google.maps.LatLng(+i.Latitude,+i.Longitude),map:this.map,optimized:!0});o.info='<div class="card border-0" style="max-width:300px">\n <div style="background-image:url('+i.ImageUrl+')" class="rounded img-full img img-wide"></div>\n <div class="card-body border-0">\n <p style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">\n <strong>'+i.Address1+", "+i.Postcode+"</strong>\n </p>\n <p>"+i.Description+'</p>\n <a href="'+i.MarkerUrl+'" class="btn btn-block btn-primary">Find out more...</a>\n </div>\n</div>',google.maps.event.addListener(o,"click",function(){t&&t.close(),(t=new google.maps.InfoWindow({content:this.info})).open(e,this);}.bind(this)),this.markers.push(o);}.bind(this));}},t}();$.fn.exists=function(){return $(this).length},$.fn.restrictToSlug=function(t){void 0===t&&(t=/[^0-9a-zA-Z]*/g);var n=$(this),e=function(){var n=$(this).val(),e=n.replace(t,"");n!==e&&$(this).val(e);};n.on("keyup",e),n.on("paste",e),n.on("change",e);},$.fn.restrictToPageSlug=function(t){void 0===t&&(t=/[^0-9a-zA-Z-//]*/g);var n=$(this),e=function(){var n=$(this).val(),e=n.replace(t,"");if((e.match(new RegExp("/","g"))||[]).length>4){var a=e.lastIndexOf("/");e=e.substring(0,a)+e.substring(a+1),Alerts.warning("You can only have up to 4 '/' characters in a url slug.");}n!==e&&$(this).val(e);};n.on("keyup",e),n.on("paste",e),n.on("change",e);},$.fn.restrictToMetaSlug=function(t){void 0===t&&(t=/[^0-9a-zA-Z.]*/g);var n=$(this),e=function(){var n=$(this).val(),e=n.replace(t,"");if((e.match(new RegExp(".","g"))||[]).length>1){var a=e.lastIndexOf(".");e=e.substring(0,a)+e.substring(a+1),Alerts.warning("You can only have up to 1 '.' characters in a meta slug.");}n!==e&&$(this).val(e);};n.on("keyup",e),n.on("paste",e),n.on("change",e);},$.fn.characterCounter=function(){var t=$(this),n=function(){var t=$(this).data("counter"),n=Number($(this).attr("maxlength")),e=$(this).val().length;$(t).text(n-e);var a="text-success";n-e<n/10&&(a="text-danger"),$(t).parent().removeClass("text-success").removeClass("text-danger").addClass(a);};t.on("keyup",n),t.on("paste",n),t.on("change",n);},$.fn.warningAlert=function(){$(this).on("click",(function(t){t.preventDefault();return Alerts.confirm({title:$(t.currentTarget).data("title"),html:$(t.currentTarget).data("warning"),footer:$(t.currentTarget).data("footer"),icon:"warning"},(function(n){if(n.isConfirmed){var e=$(t.currentTarget).attr("href");window.location.href=e;}})),!1}));};
|
|
21
|
-
|
|
22
|
-
if (typeof this !== 'undefined' && this.hood){ this.hoodCMS = this.Hood = this.hoodCMS = this.HoodCMS = this.hood}
|
|
21
|
+
var extendStatics=function(t,e){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e;}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);},extendStatics(t,e)};function __extends(t,e){function r(){this.constructor=t;}extendStatics(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r);}var __assign=function(){return __assign=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},__assign.apply(this,arguments)};"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),!1!==this.options.bgColor&&this._toastEl.css("background-color",this.options.bgColor),!1!==this.options.textColor&&this._toastEl.css("color",this.options.textColor),this.options.textAlign&&this._toastEl.css("text-align",this.options.textAlign),!1!==this.options.icon&&(this._toastEl.addClass("jq-has-icon"),-1!==t.inArray(this.options.icon,this._defaultIcons)&&this._toastEl.addClass("jq-icon-"+this.options.icon)),!1!==this.options.class&&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-this.options.stack;i>0&&t(".jq-toast-wrap").find(".jq-toast-single").slice(0,i).remove();}this._container=o;},canAutoHide:function(){return !1!==this.options.hideAfter&&!isNaN(parseInt(this.options.hideAfter,10))},processLoader:function(){if(!this.canAutoHide()||!1===this.options.loader)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()){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);var BootstrapSwal=Swal__default["default"].mixin({customClass:{confirmButton:"btn btn-success m-1 px-3",cancelButton:"btn btn-danger m-1 px-3"},buttonsStyling:!1}),Alerts=function(){function o(){}return o.log=function(o,t){if(void 0===t&&(t="message"),document.body.classList.contains("dev-mode"))switch(t){case"error":console.error(o);break;case"message":console.log(o);break;case"warning":console.warn(o);break;case"info":console.info(o);}},o.error=function(o,t,e){void 0===t&&(t=null),void 0===e&&(e=null),$.toast({heading:t,text:o,icon:"error",position:"bottom-left",loader:!1,bgColor:"#d0100b",textColor:"white",hideAfter:e});},o.warning=function(o,t,e){void 0===t&&(t=null),void 0===e&&(e=null),$.toast({heading:t,text:o,icon:"error",position:"bottom-left",loader:!1,bgColor:"#ef9007",textColor:"white",hideAfter:e});},o.message=function(o,t,e){void 0===t&&(t=null),void 0===e&&(e=null),$.toast({heading:t,text:o,icon:"error",position:"bottom-left",loader:!1,bgColor:"#222222",textColor:"white",hideAfter:e});},o.success=function(o,t,e){void 0===t&&(t=null),void 0===e&&(e=null),$.toast({heading:t,text:o,icon:"error",position:"bottom-left",loader:!1,bgColor:"#28a745",textColor:"white",hideAfter:e});},o.alert=function(t,e,n,i){switch(void 0===e&&(e=null),void 0===n&&(n="info"),void 0===i&&(i=1e4),n){case"error":o.error(t,e,i);break;case"warning":o.warning(t,e,i);break;case"info":o.message(t,e,i);break;case"success":o.success(t,e,i);}},o.sweetAlert=function(o,t){BootstrapSwal.fire(o).then((function(o){t(o);}));},o.confirm=function(t,e){o.sweetAlert(__assign(__assign({},{showCancelButton:!0,footer:null,title:"Are you sure?",html:"Are you sure you want to do this?",confirmButtonText:"Ok",cancelButtonText:"Cancel"}),t),e);},o.prompt=function(t,e){o.sweetAlert(__assign(__assign({},{input:"text",inputAttributes:{autocapitalize:"off"},showCancelButton:!0,icon:"info",footer:'<span class="text-warning"><i class="fa fa-exclamation-triangle"></i> This cannot be undone.</span>',confirmButtonText:"Ok",cancelButtonText:"Cancel"}),t),e);},o.prototype.log=function(t,e){void 0===e&&(e="message"),o.log(t,e);},o.prototype.error=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null),o.error(t,e,n);},o.prototype.warning=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null),o.warning(t,e,n);},o.prototype.message=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null),o.message(t,e,n);},o.prototype.success=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null),o.success(t,e,n);},o.prototype.alert=function(t,e,n,i){void 0===n&&(n="info"),void 0===i&&(i=1e4),o.alert(t,t,n,i);},o.prototype.sweetAlert=function(t,e){o.sweetAlert(t,e);},o.prototype.confirm=function(t,e){o.confirm(t,e);},o.prototype.prompt=function(t,e){o.prompt(t,e);},o}();var ColorPickers=function(){function t(){}return t.prototype.loadColorPickers=function(t){void 0===t&&(t=".color-picker");var o=function(t,o,r){var n=$(r._root.button).parent().data("target");$(r._root.button).parent().css({"background-color":t.toHEXA().toString()});for(var a=r.getColor().toHEXA(),e="",i=a.length-1;i>=0;i--)e=a[i]+e;$(n).val("#"+e),$(n).change();};$(t).each((function(t,n){var a=!0;"true"==$(this).data("opacity")&&(a=!1);Pickr__default["default"].create({el:n.children[0],appClass:"custom-class",theme:"monolith",useAsButton:!0,default:$(this).data("default")||"none",lockOpacity:a,defaultRepresentation:"HEXA",position:"bottom-end",components:{opacity:!0,hue:!0,interaction:{hex:!1,rgba:!1,hsva:!1,input:!0,clear:!0}}}).on("init",(function(t){var r=$(t._root.button).parent().data("target"),n=$(r).val();$(t._root.button).parent().on("click",$.proxy((function(){this.show();}),t)),$(r).on("click",$.proxy((function(){this.show();}),t)),n&&(t.setColor(n),o(t.getColor(),0,t));})).on("clear",(function(t){var r=$(t._root.button).parent().data("target");t.setColor("transparent"),o(t.getColor(),0,t),$(r).val(""),$(r).change();})).on("change",o);}));},t}();var Response=function(){function e(){}return e.process=function(e,s){void 0===s&&(s=5e3),e.success?Alerts.success(e.message,e.title,s):Alerts.error(e.errors,e.title,s);},e}();var Inline=function(){function o(){}return o.load=function(n,r){var t,e=$(n);e.addClass("loading"),r.onLoad&&r.onLoad(n);var l=e.data("url");$.get(l,(function(o){r.onRender&&(o=r.onRender(o,n)),e.html(o),e.removeClass("loading"),r.onComplete&&r.onComplete(o,n);})).fail(null!==(t=r.onError)&&void 0!==t?t:o.handleError);},o.task=function(n,r,t,e){void 0===t&&(t=null),void 0===e&&(e=null),r&&r.classList.add("loading"),$.get(n,(function(o){r&&r.classList.remove("loading"),t&&t(o,r);})).fail(null!=e?e:o.handleError);},o.post=function(n,r,t,e){void 0===t&&(t=null),void 0===e&&(e=null),r&&r.classList.add("loading"),$.post(n,(function(o){r&&r.classList.remove("loading"),t&&t(o,r);})).fail(null!=e?e:o.handleError);},o.handleError=function(o,n,r){500===o.status?Alerts.error("There was an error processing the content, please contact an administrator if this continues.","Error "+o.status,1e4):404===o.status?Alerts.error("The content could not be found.","Error "+o.status,1e4):401===o.status&&(Alerts.error("You are not allowed to view this resource, are you logged in correctly?","Error "+o.status,1e4),window.location=window.location);},o}();var DataList=function(){function e(e,t){if(this.element=e,this.element.hoodDataList=this,void 0!==e&&null!=e){if(this.options=__assign(__assign({},this.options),t),$(this.element).hasClass("query")){var n=$(this.element).data("url")+window.location.search;$(this.element).attr("data-url",n),$(this.element).data("url",n);}if(!$(this.element).hasClass("refresh-only")){var i=document.createElement("a");i.href=$(this.element).data("url"),this.reload(new URL(i.href));}$(this.element).on("click",".pagination a, a.hood-inline-list-target",function(e){e.preventDefault();var t=document.createElement("a");t.href=e.currentTarget.href;var n=document.createElement("a");n.href=$(this.element).data("url"),n.search=t.search,this.reload(new URL(n.href));}.bind(this)),$("body").on("submit",'form.inline[data-target="#'.concat(this.element.id,'"]'),function(e){e.preventDefault();var t=$(e.currentTarget),n=document.createElement("a");n.href=$(this.element).data("url"),n.search="?"+t.serialize(),this.reload(new URL(n.href));}.bind(this));}else Alerts.log("Could not DataList to element, element does not exist.","error");}return e.prototype.reload=function(e){if(void 0===e&&(e=null),e){if(history.pushState&&$(this.element).hasClass("query")){var t=window.location.protocol+"//"+window.location.host+window.location.pathname+(e.href.contains("?")?"?"+e.href.substring(e.href.indexOf("?")+1):"");window.history.pushState({path:t},"",t);}$(this.element).data("url",e);}Inline.load(this.element,__assign({},this.options));},e}();
|
|
22
|
+
var ModalController=function(){function t(t){void 0===t&&(t=null),this.isOpen=!1,this.options={closePrevious:!0},this.options=__assign(__assign({},this.options),t);}return t.prototype.show=function(t,o){this.options.onLoad&&this.options.onLoad(this.element),this.isOpen||(this.isOpen=!0,$.get(t,function(t){this.modal&&this.options.closePrevious&&this.close(),this.options.onRender&&(t=this.options.onRender(this.element,t)),this.element=this.createElementFromHTML(t),this.element.classList.add("hood-inline-modal"),$("body").append(this.element),this.modal=new bootstrap.Modal(this.element,{}),this.modal.show(),this.element.addEventListener("shown.bs.modal",function(){$(document).off("focusin.modal");}.bind(this)),this.element.addEventListener("hidden.bs.modal",function(){this.options.onHidden&&this.options.onHidden(this.element),this.dispose(),this.isOpen=!1;}.bind(this)),this.options.onComplete&&this.options.onComplete(this.element);}.bind(this)).fail(function(t,o,i){this.isOpen=!1,this.options.onError&&this.options.onError(t,o,i),Inline.handleError(t,o,i);}.bind(this)));},t.prototype.close=function(){this.modal&&this.modal.hide();},t.prototype.dispose=function(){this.modal.dispose(),this.element.remove();},t.prototype.createElementFromHTML=function(t){var o=document.createElement("div");return o.innerHTML=t.trim(),o.firstChild},t}();var Validator=function(){function t(t,i){if(this.options={errorAlert:"There are errors, please check the form.",useAjax:!0},this.element=t,this.element){this.options.serializationFunction=function(){return $(this.element).serialize()}.bind(this),this.options=__assign(__assign({},this.options),i),this.element.addEventListener("submit",function(t){t.preventDefault(),t.stopImmediatePropagation(),this.submitForm();}.bind(this));var e='[data-submit="#'+this.element.id+'"]',n=$(e);n&&n.on("click",function(t){t.preventDefault(),t.stopImmediatePropagation(),$(t.currentTarget).data("exit")&&($(this.element).find("input#exit").remove(),$("<input id='exit' />").attr("type","hidden").attr("name","exit").attr("value","true").appendTo(this.element)),this.submitForm();}.bind(this));}}return t.prototype.submitForm=function(){var t;if(this.element.classList.add("was-validated"),this.element.checkValidity()){this.element.classList.add("loading");var i=this.element.querySelector("input[type=checkbox]");if(i&&Array.prototype.slice.call(i).forEach((function(t){$(this).is(":checked")&&$(this).val("true");})),this.options.onSubmit&&this.options.onSubmit(this),this.options.useAjax){var e=this.options.serializationFunction();$.post(this.element.action,e,function(t){this.options.onComplete&&this.options.onComplete(t,this);}.bind(this)).fail(null!==(t=this.options.onError)&&void 0!==t?t:Inline.handleError);}else this.element.submit();}else this.options.errorAlert&&Alerts.error(this.options.errorAlert,null,5e3);},t}();var MediaService=function(){function e(e,t){this.options={action:"show",size:"large"},this.galleryInitialised=!1,this.selectedMedia=new Array,this.element=e,this.element&&(this.options=__assign(__assign({},this.options),t),$("body").off("click",".media-delete",this.delete.bind(this)),$("body").on("click",".media-delete",this.delete.bind(this)),$(this.element).on("click",".media-item",this.action.bind(this)),$(this.element).on("click",".media-create-directory",this.createDirectory.bind(this)),$(this.element).on("click",".media-delete-directory",this.deleteDirectory.bind(this)),this.media=new DataList(this.element,{onLoad:this.options.onListLoad,onError:this.options.onError,onRender:this.options.onListRender,onComplete:function(e,t){this.initUploader(),"gallery"!=this.options.action||this.galleryInitialised||($("#media-select-modal .modal-footer").removeClass("d-none"),$("#media-select-modal .modal-footer").on("click",this.galleryAdd.bind(this)),this.galleryInitialised=!0),this.options.onListComplete&&this.options.onListComplete(e,t);}.bind(this)}));}return e.prototype.initUploader=function(){if(this.uploadButton=document.getElementById("media-add"),this.uploader=document.getElementById("media-upload"),this.uploadButton&&this.uploader){this.progressArea=document.getElementById("media-progress"),this.progressText=$('<div class="progress-text text-muted mb-3"><i class="fa fa-info-circle me-2"></i>Uploading file <span></span>...</div>'),this.progress=$('<div class="progress"><div class= "progress-bar progress-bar-striped" role="progressbar" style="width:0%" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100" ></div></div>'),this.progressText.appendTo(this.progressArea),this.progress.appendTo(this.progressArea);var e=null;$("#media-upload").dropzone({url:$("#media-upload").data("url")+"?directoryId="+$("#media-list > #upload-directory-id").val(),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,paramName:"files",acceptedFiles:$("#media-upload").data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:!1,clickable:"#media-add",dictDefaultMessage:'<span><i class="fa fa-cloud-upload fa-4x"></i><br />Drag and drop files here, or simply click me!</div>',dictResponseError:"Error while uploading file!",init:function(){e=this;}}),e.on("error",function(e,t){Alerts.warning(t);}.bind(this)),e.on("success",function(e,t){Response.process(t);}.bind(this)),e.on("addedfile",function(e){this.progress.find(".progress-bar").css({width:"0%"}),this.progressText.find("span").html("0%");}.bind(this)),e.on("totaluploadprogress",function(e,t,i){this.progress.find(".progress-bar").css({width:e+"%"}),this.progressText.find("span").html(Math.round(e)+"% - "+i.formatKilobytes()+" / "+t.formatKilobytes());}.bind(this)),e.on("sending",function(e){this.progressArea.classList.remove("collapse"),this.progress.find(".progress-bar").css({width:"0%"}),this.progressText.find("span").html("0%");}.bind(this)),e.on("complete",function(e){this.media.reload();}.bind(this)),e.on("queuecomplete",function(){this.progressArea.classList.add("collapse"),this.media.reload();}.bind(this));}},e.prototype.createDirectory=function(e){e.preventDefault(),e.stopPropagation();var t=new ModalController({onComplete:function(){var e=document.getElementById("content-directories-edit-form");new Validator(e,{onComplete:function(e){Response.process(e,5e3),e.success&&(this.media.reload(),t.close());}.bind(this)});}.bind(this)});t.show($(e.currentTarget).attr("href"),this.element);},e.prototype.deleteDirectory=function(e){e.preventDefault(),e.stopPropagation(),Alerts.confirm({},function(t){t.isConfirmed&&Inline.post(e.currentTarget.href,e.currentTarget,function(e,t){if(Response.process(e,5e3),e.data.length>0){var i=document.createElement("a");i.href=$(this.element).data("url"),i.search="?dir=".concat(e.data[0]),this.media.reload(new URL(i.href));}}.bind(this));}.bind(this));},e.prototype.uploadUrl=function(){return $("#media-upload").data("url")+"?directoryId="+$("#media-list > #upload-directory-id").val()},e.prototype.action=function(e){e.preventDefault(),e.stopPropagation();var t=$(e.currentTarget).data("json");switch(this.options.action){case"select":this.select(t,e);break;case"insert":this.insert(t,e);break;case"attach":this.attach(t,e);break;case"gallery":this.galleryClick(t,e);break;default:this.show(t,e);}},e.prototype.show=function(e,t){this.currentBlade=new ModalController,this.currentBlade.show($(t.target).data("blade"),t.target);},e.prototype.select=function(t,i){if(Alerts.log("[MediaService.select] Selecting media object id ".concat(t.id," - ").concat(t.filename," and inserting ").concat(this.options.size," url to target: ").concat(this.options.target)),this.options.target){var o=$(this.options.target);switch(this.options.size){case"thumb":o.val(t.thumbUrl);break;case"small":o.val(t.smallUrl);break;case"medium":o.val(t.mediumUrl);break;case"large":o.val(t.largeUrl);break;case"full":o.val(t.url);}}this.options.refresh&&e.refresh(t,this.options.refresh),this.options.onAction&&this.options.onAction(t);},e.prototype.insert=function(e,t){Alerts.log("[MediaService.insert] Selecting media object id ".concat(e.id," - ").concat(e.filename," and inserting ").concat(this.options.size," image to target editor: ").concat(this.options.target)),this.options.targetEditor.insertContent('<img alt="'+e.filename+'" src="'+e.url+'" class="img-fluid" />'),this.options.onAction&&this.options.onAction(e);},e.prototype.attach=function(t,i){Alerts.log("[MediaService.attach] Attaching media object id ".concat(t.id," - ").concat(t.filename," to url: ").concat(this.options.url)),$.post(this.options.url,{mediaId:t.id},function(i){Response.process(i,5e3),e.refresh(i.media,this.options.refresh),this.options.onAction&&this.options.onAction(t);}.bind(this));},e.prototype.galleryClick=function(e,t){this.isMediaSelected(e)?(Alerts.log("[MediaService.galleryClick] Removing media from selection - id ".concat(e.id," - ").concat(e.filename,".}")),this.selectedMedia=this.selectedMedia.filter((function(t){return t.id!==e.id})),$(t.currentTarget).parents(".media-item").removeClass("active")):(Alerts.log("[MediaService.galleryClick] Adding to selected media objects - id ".concat(e.id," - ").concat(e.filename,".")),this.selectedMedia.push(e),$(t.currentTarget).parents(".media-item").addClass("active"));},e.prototype.galleryAdd=function(e){e.preventDefault(),e.stopPropagation(),Alerts.log("[MediaService.galleryAdd] Adding ".concat(this.selectedMedia.length," selected media objects to url: ").concat(this.options.url));var t=this.selectedMedia.map((function(e){return e.id}));$.post(this.options.url,{media:t},function(e){Response.process(e),document.getElementById(this.options.target).hoodDataList.reload(),this.options.onAction&&this.options.onAction(e.media);}.bind(this));},e.prototype.isMediaSelected=function(e){var t=!1;return this.selectedMedia.forEach((function(i,o,s){i.id==e.id&&(t=!0);})),t},e.refresh=function(e,t){var i=e.icon;if("Image"===e.genericFileType&&(i=e.mediumUrl),t){var o=$(t);o.css({"background-image":"url("+i+")"}),o.find("img").attr("src",i),o.removeClass("loading");}},e.prototype.delete=function(e){e.preventDefault(),e.stopPropagation(),Alerts.confirm({html:"This file will be permanently deleted, are you sure?"},function(t){t.isConfirmed&&Inline.post(e.currentTarget.href,e.currentTarget,function(e){Response.process(e,5e3),this.media.reload(),this.currentBlade&&this.currentBlade.close();}.bind(this));}.bind(this));},e}();var MediaModal=function(){function e(){$("body").on("click","[data-hood-media=attach],[data-hood-media=select],[data-hood-media=gallery]",this.load.bind(this)),$("body").on("click","[data-hood-media=clear]",this.clear.bind(this)),$("[data-hood-media=gallery]").each(this.initGallery.bind(this));}return e.prototype.initGallery=function(e,t){var i=document.getElementById(t.dataset.hoodMediaTarget);i&&new DataList(i,{onComplete:function(e,t){Alerts.log("Finished loading gallery media list.","info");}.bind(this)});},e.prototype.load=function(e){e.preventDefault(),e.stopPropagation(),this.element=e.currentTarget,this.modal&&this.modal.isOpen||(this.modal=new ModalController({onComplete:function(e){this.list=document.getElementById("media-list"),this.service=new MediaService(this.list,{action:this.element.dataset.hoodMedia,url:this.element.dataset.hoodMediaUrl,refresh:this.element.dataset.hoodMediaRefresh,target:this.element.dataset.hoodMediaTarget,size:this.element.dataset.hoodMediaSize,beforeAction:function(e,t){}.bind(this),onAction:function(e,t){this.modal.close();}.bind(this),onListLoad:function(e){},onListRender:function(e){return e},onListComplete:function(e){},onError:function(e,t,i){}});}.bind(this)}),this.modal.show($(e.currentTarget).data("hood-media-list"),e.currentTarget));},e.prototype.clear=function(e){e.preventDefault(),e.stopPropagation(),Alerts.confirm({},function(t){t.isConfirmed&&Inline.post(e.currentTarget.href,e.currentTarget,function(t){Response.process(t,5e3),MediaService.refresh(t.media,e.currentTarget.dataset.hoodMediaRefresh);}.bind(this));}.bind(this));},e}();var Editors=function(){function e(e){this.options={linkClasses:[{title:"None",value:""},{title:"Button link",value:"btn btn-default"},{title:"Theme coloured button link",value:"btn btn-primary"},{title:"Popup image/video",value:"colorbox-iframe"},{title:"Button popup link",value:"btn btn-default colorbox-iframe"},{title:"Theme coloured button popup link",value:"btn btn-primary colorbox-iframe"},{title:"Large link",value:"font-lg"},{title:"Large button link",value:"btn btn-default btn-lg"},{title:"Large theme coloured button link",value:"btn btn-primary btn-lg"},{title:"Large popup image/video",value:"font-lg colorbox-iframe"},{title:"Large Button popup link",value:"btn btn-default btn-lg colorbox-iframe"},{title:"Theme coloured button popup link",value:"btn btn-primary btn-lg colorbox-iframe"}],imageClasses:[{title:"None",value:""},{title:"Full Width",value:"user-image full"},{title:"Left Aligned",value:"user-image left"},{title:"Centered",value:"user-image center"},{title:"Right Aligned",value:"user-image right"},{title:"Inline with text, top aligned",value:"user-image inline top"},{title:"Inline with text, middle aligned",value:"user-image inline"},{title:"Inline with text, bottom aligned",value:"user-image inline bottom"},{title:"Pulled Left",value:"user-image pull-left"},{title:"Pulled Right",value:"user-image pull-right"}]},this.options=__assign(__assign({},this.options),e);}return e.prototype.richTextEditors=function(){tinymce__default["default"].init({selector:".tinymce-full",height:150,menubar:!1,plugins:["advlist autolink lists link image charmap print preview anchor media","searchreplace visualblocks code fullscreen","insertdatetime media contextmenu paste code textcolor"],toolbar:"fullscreen | styleselect forecolor backcolor | hoodimage link media image | bold italic | alignleft aligncenter alignright | bullist numlist | table | undo redo",link_class_list:this.options.linkClasses,image_class_list:this.options.imageClasses,setup:this.setupCommands.bind(this),image_dimensions:!1,content_css:["/dist/css/editor.css"]}),tinymce__default["default"].init({selector:".tinymce-simple",height:150,plugins:["advlist autolink lists link image charmap print preview anchor media","searchreplace visualblocks code fullscreen","insertdatetime media contextmenu paste code"],menubar:!1,toolbar:"fullscreen | bold italic | bullist numlist | undo redo | link",link_class_list:this.options.linkClasses,image_class_list:this.options.imageClasses,setup:this.setupCommands.bind(this),image_dimensions:!1}),tinymce__default["default"].init({selector:".tinymce-full-content",height:500,menubar:!1,plugins:["advlist autolink lists link image charmap print preview anchor media","searchreplace visualblocks code fullscreen","insertdatetime media contextmenu paste code textcolor"],toolbar:"fullscreen | styleselect forecolor backcolor | hoodimage link media image | bold italic | alignleft aligncenter alignright | bullist numlist | table | undo redo",link_class_list:this.options.linkClasses,image_class_list:this.options.imageClasses,setup:this.setupCommands.bind(this),image_dimensions:!1}),tinymce__default["default"].init({selector:".tinymce-simple-content",height:500,plugins:["advlist autolink lists link image charmap print preview anchor media","searchreplace visualblocks code fullscreen","insertdatetime media contextmenu paste code"],menubar:!1,toolbar:"fullscreen | bold italic | bullist numlist | undo redo | link",link_class_list:this.options.linkClasses,image_class_list:this.options.imageClasses,image_dimensions:!1});},e.prototype.setupCommands=function(e){this.currentEditor=$("#"+e.id),this.currentEditor.data("hoodMediaList")&&e.addButton("hoodimage",{text:"Insert image...",icon:!1,onclick:function(t){this.mediaModal=new ModalController({onComplete:function(t){this.list=document.getElementById("media-list"),this.service=new MediaService(this.list,{action:"insert",url:this.currentEditor.data("hoodMediaList"),targetEditor:e,size:this.currentEditor.data("hoodMediaSize"),beforeAction:function(e,t){}.bind(this),onAction:function(e,t){this.mediaModal.close();}.bind(this),onListLoad:function(e){},onListRender:function(e){return e},onListComplete:function(e){},onError:function(e,t,i){}});}.bind(this)}),this.mediaModal.show(this.currentEditor.data("hoodMediaList"),t.currentTarget);}.bind(this)});},e}();var Handlers=function(){function t(){}return t.prototype.initDefaultHandlers=function(){this.checkboxToCsvInput(),this.iconSelector(),this.initSelectValues(),this.scrollHandlers(),this.selectText(),this.setValueOnClick(),this.submitOnChange();},t.prototype.initSelectValues=function(t){void 0===t&&(t="body"),$(t).find("select[data-selected]").each(this.initSelectValuesHandler);},t.prototype.initSelectValuesHandler=function(t,e){var o=$(this).data("selected");if("undefined"!==o&&""!==o){var a=String(o);$(this).val(a);}},t.prototype.iconSelector=function(t){void 0===t&&(t="body"),$(t).find("[data-hood-icon]").each(this.iconSelectorHandler);},t.prototype.iconSelectorHandler=function(t,e){var o=$(this),a=o.find("input[data-hood-icon-input]"),n=o.find("[data-hood-icon-display]"),i=o.find(".collapse");o.find("[data-hood-icon-key][data-hood-icon-value]").on("click",(function(){o.find("[data-hood-icon-key][data-hood-icon-value]").removeClass("active"),$(this).addClass("active");var t=$(this).data("hoodIconKey"),e=$(this).data("hoodIconValue");$(this),n.html(e),a.val(t),i&&i.removeClass("show");}));},t.prototype.selectText=function(t){void 0===t&&(t="body"),$(t).on("click",".select-text",this.selectTextHandler);},t.prototype.selectTextHandler=function(){var t=$(this);t.select(),t.mouseup((function(){return t.unbind("mouseup"),!1}));},t.prototype.scrollHandlers=function(t){void 0===t&&(t="body"),$(t).on("click",".scroll-top, .scroll-to-top",this.scrollTop),$(t).on("click",".scroll-target, .scroll-to-target",this.scrollTarget),$(t).on("click",".scroll-target-direct, .scroll-to-target-direct",this.scrollTargetDirect);},t.prototype.scrollTop=function(t){return t&&t.preventDefault(),$("html, body").animate({scrollTop:0},800),!1},t.prototype.scrollTarget=function(t){t&&t.preventDefault();var e=$(this).attr("href").split("#")[0];if(e===window.location.pathname||""===e){var o=this.hash,a=$(o),n=$("header.header"),i=0;n&&(i=n.height()),$(this).data("offset")?$("html, body").stop().animate({scrollTop:a.offset().top-$(this).data("offset")},900,"swing"):$("html, body").stop().animate({scrollTop:a.offset().top-i},900,"swing");}},t.prototype.scrollTargetDirect=function(){var t=$("body").scrollTop(),e=$($(this).attr("href")).offset().top;return $("html, body").animate({scrollTop:e},Math.abs(e-t)),!1},t.prototype.checkboxToCsvInput=function(t){void 0===t&&(t="body"),$(t).on("change","input[type=checkbox][data-hood-csv-input]",this.checkboxToCsvInputHandler);},t.prototype.checkboxToCsvInputHandler=function(t){t&&t.preventDefault();var e=new Array;$('input[data-hood-csv-input="'+$(this).data("hoodCsvInput")+'"]').each((function(){$(this).is(":checked")&&e.push($(this).val());}));var o="#"+$(this).data("input"),a=JSON.stringify(e);$(o).val(a);},t.prototype.submitOnChange=function(t){void 0===t&&(t="body"),$(t).on("change",".submit-on-change",this.submitOnChangeHandler);},t.prototype.submitOnChangeHandler=function(t){t&&t.preventDefault(),$(this).parents("form").submit();},t.prototype.setValueOnClick=function(t){void 0===t&&(t="body"),$(t).on("click",".click-select[data-target][data-value]",this.setValueOnClickHandler);},t.prototype.setValueOnClickHandler=function(){var t=$(this),e="#"+t.data("target");$(e).val(t.data("value")),$(e).trigger("change"),$('.click-select.clean[data-target="'+t.data("target")+'"]').each((function(){$(this).removeClass("active");})),$('.click-select.clean[data-target="'+t.data("target")+'"][data-value="'+t.data("value")+'"]').each((function(){$(this).addClass("active");}));},t}();var Uploader=function(){function e(){($(".image-uploader").length||$(".gallery-uploader").length)&&($(".upload-progress-bar").hide(),$(".image-uploader").each(this.singleImage),$(".gallery-uploader").each(this.gallery));}return e.prototype.refreshImage=function(e,r){$(e.data("preview")).css({"background-image":"url("+r.media.smallUrl+")"}),$(e.data("preview")).find("img").attr("src",r.media.smallUrl);},e.prototype.singleImage=function(){var e="#"+$(this).attr("id"),r=$(e),a="#"+$(this).attr("json"),l=null;r.dropzone({url:r.data("url"),maxFiles:1,paramName:"file",parallelUploads:1,acceptedFiles:r.data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:!1,clickable:e,init:function(){l=this;}}),l.on("addedfile",(function(){})),l.on("totaluploadprogress",(function(r){$(".upload-progress-bar."+e.replace("#","")+" .progress-bar").css({width:r+"%"});})),l.on("sending",(function(a){$(".upload-progress-bar."+e.replace("#","")).show(),$(r.data("preview")).addClass("loading");})),l.on("queuecomplete",(function(r){$(".upload-progress-bar."+e.replace("#","")).hide();})),l.on("success",(function(e,o){o.success?(o.media&&($(a).val(JSON.stringify(o.media)),$(r.data("preview")).css({"background-image":"url("+o.media.smallUrl+")"}),$(r.data("preview")).find("img").attr("src",o.media.smallUrl)),Alerts.success("New image added!")):Alerts.error("There was a problem adding the image: "+o.error),l.removeFile(e),$(r.data("preview")).removeClass("loading");}));},e.prototype.gallery=function(){var e="#"+$(this).attr("id"),r=$(e),a=document.querySelector(e+"-template");a.id="";var l=a.parentNode.innerHTML;a.parentNode.removeChild(a);var o=null;r.dropzone({url:r.data("url"),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:l,paramName:"files",acceptedFiles:r.data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:"#previews",clickable:".fileinput-button",init:function(){o=this;}}),$(e+" .cancel").hide(),o.on("addedfile",(function(r){$(r.previewElement.querySelector(".complete")).hide(),$(r.previewElement.querySelector(".cancel")).show(),$(e+" .cancel").show();})),o.on("totaluploadprogress",(function(e,r,a){document.querySelector("#total-progress .progress-bar").style.width=e+"%";})),o.on("sending",(function(e){document.querySelector("#total-progress").style.opacity="1";})),o.on("complete",(function(e){$(e.previewElement.querySelector(".cancel")).hide(),$(e.previewElement.querySelector(".progress")).hide(),$(e.previewElement.querySelector(".complete")).show(),console.error("Uploader.Gallery.Dropzone.OnComplete - Inline.Refresh('.gallery') is not implemented.");})),o.on("queuecomplete",(function(r){document.querySelector("#total-progress").style.opacity="0",$(e+" .cancel").hide();})),o.on("success",(function(e,r){console.error("Uploader.Gallery.Dropzone.OnSuccess - Inline.Refresh('.gallery') is not implemented."),r.success?Alerts.success("New images added!"):Alerts.error("There was a problem adding the profile image: "+r.error);})),$(".actions .cancel").click((function(){o.removeAllFiles(!0);}));},e}();var HoodApi=function(){function o(){this.alerts=new Alerts,this.uploader=new Uploader,this.handlers=new Handlers,this.editors=new Editors,this.colorPickers=new ColorPickers,this.mediaModal=new MediaModal,this.setupLoaders();}return o.prototype.setupLoaders=function(){$("body").on("loader-show",(function(){Alerts.success("Showing loader...");})),$("body").on("loader-hide",(function(){Alerts.error("Hiding loader...");}));},o}();var PropertyController=function(){function t(){this.map=null,this.center={lat:30,lng:-110},this.initList();}return t.prototype.initList=function(){this.element=document.getElementById("property-list"),this.element&&(this.list=new DataList(this.element,{onComplete:function(t,e){Alerts.log("Finished loading property list.","info");}.bind(this)}));},t.prototype.initMapList=function(){this.mapListElement=document.getElementById("property-map-list"),this.mapElement&&(this.mapList=new DataList(this.mapListElement,{onComplete:function(t,e){Alerts.log("Finished loading map list.","info"),this.reloadMarkers();}.bind(this)}));},t.prototype.initMap=function(t){void 0===t&&(t="property-map"),this.mapElement=document.getElementById(t),this.mapElement&&(this.center={lat:+this.mapElement.dataset.lat,lng:+this.mapElement.dataset.long},this.map=new google.maps.Map(this.mapElement,{zoom:+this.mapElement.dataset.zoom||15,center:this.center,scrollwheel:!1}),$(window).resize(function(){google.maps.event.trigger(this.map,"resize");}.bind(this)),google.maps.event.trigger(this.map,"resize"),this.initMapList());},t.prototype.reloadMarkers=function(){var t=null;if(this.mapElement){var e=this.map;if(this.markers)for(var i=0;i<this.markers.length;i++)this.markers[i].setMap(null);this.markers=[],$("#property-map-locations").data("locations").map(function(i,n){var o=new google.maps.Marker({position:new google.maps.LatLng(+i.Latitude,+i.Longitude),map:this.map,optimized:!0});o.info='<div class="card border-0" style="max-width:300px">\n <div style="background-image:url('.concat(i.ImageUrl,')" class="rounded img-full img img-wide"></div>\n <div class="card-body border-0">\n <p style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">\n <strong>').concat(i.Address1,", ").concat(i.Postcode,"</strong>\n </p>\n <p>").concat(i.Description,'</p>\n <a href="').concat(i.MarkerUrl,'" class="btn btn-block btn-primary">Find out more...</a>\n </div>\n</div>'),google.maps.event.addListener(o,"click",function(){t&&t.close(),(t=new google.maps.InfoWindow({content:this.info})).open(e,this);}.bind(this)),this.markers.push(o);}.bind(this));}},t}();var App=function(r){function o(){var o=r.call(this)||this;return o.handlers.initDefaultHandlers(),o.initContactForms(),o.propertyController=new PropertyController,o}return __extends(o,r),o.prototype.initGoogleMaps=function(r){void 0===r&&(r=".google-map"),$(r).each((function(){var r=new google.maps.LatLng($(this).data("lat"),$(this).data("long"));console.log("Loading map at: "+$(this).data("lat")+", "+$(this).data("long"));var o=new google.maps.Map(this,{zoom:$(this).data("zoom")||15,center:r,scrollwheel:!1});new google.maps.Marker({position:r,map:o,title:$(this).data("marker")});$(window).resize((function(){google.maps.event.trigger(o,"resize");})),google.maps.event.trigger(o,"resize");}));},o.prototype.initContactForms=function(r){void 0===r&&(r=".contact-form");var o=$(r);o.find(".thank-you").hide(),o.find(".form-content").show();var t=$(r)[0];new Validator(t,{onComplete:function(r){Response.process(r,5e3),r.success?(o.attr("data-redirect")&&(window.location.href=o.attr("data-redirect")),o.attr("data-alert-message")&&Alerts.success(o.attr("data-alert-message"),"Success"),o.find(".form").hide(),o.find(".thank-you").show()):o.attr("data-alert-error")?Alerts.error(o.attr("data-alert-error"),"Error"):Alerts.error("There was an error sending the message: "+r.errors,"Error");}.bind(this)});},o}(HoodApi);window.hood=new App;exports.App=App;Object.defineProperty(exports,'__esModule',{value:true});}));
|
|
23
|
+
if (typeof this !== 'undefined' && this.hood){ this.hoodCMS = this.Hood = this.hoodCMS = this.HoodCMS = this.hood }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SweetAlertOptions, SweetAlertResult } from 'sweetalert2';
|
|
2
|
+
import 'jquery-toast-plugin';
|
|
3
|
+
export declare class Alerts {
|
|
4
|
+
static log(message: any, type?: 'message' | 'error' | 'warning' | 'info'): void;
|
|
5
|
+
static error(message: string, title?: string, hideAfter?: number): void;
|
|
6
|
+
static warning(message: string, title?: string, hideAfter?: number): void;
|
|
7
|
+
static message(message: string, title?: string, hideAfter?: number): void;
|
|
8
|
+
static success(message: string, title?: string, hideAfter?: number): void;
|
|
9
|
+
static alert(message: string, title?: string, icon?: string, hideAfter?: number): void;
|
|
10
|
+
static sweetAlert(options: SweetAlertOptions, callback: (result: SweetAlertResult<any>) => void): void;
|
|
11
|
+
static confirm(options: SweetAlertOptions, callback: (result: SweetAlertResult<any>) => void): void;
|
|
12
|
+
static prompt(options: SweetAlertOptions, callback: (result: SweetAlertResult<any>) => void): void;
|
|
13
|
+
log(message: string, type?: 'message' | 'error' | 'warning' | 'info'): void;
|
|
14
|
+
error(message: string, title?: string, hideAfter?: number): void;
|
|
15
|
+
warning(message: string, title?: string, hideAfter?: number): void;
|
|
16
|
+
message(message: string, title?: string, hideAfter?: number): void;
|
|
17
|
+
success(message: string, title?: string, hideAfter?: number): void;
|
|
18
|
+
alert(message: string, title?: string, icon?: string, hideAfter?: number): void;
|
|
19
|
+
sweetAlert(options: SweetAlertOptions, callback: (result: SweetAlertResult<any>) => void): void;
|
|
20
|
+
confirm(options: SweetAlertOptions, callback: (result: SweetAlertResult<any>) => void): void;
|
|
21
|
+
prompt(options: SweetAlertOptions, callback: (result: SweetAlertResult<any>) => void): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import Swal from 'sweetalert2';
|
|
2
|
+
import 'jquery-toast-plugin';
|
|
3
|
+
const BootstrapSwal = Swal.mixin({
|
|
4
|
+
customClass: {
|
|
5
|
+
confirmButton: 'btn btn-success m-1 px-3',
|
|
6
|
+
cancelButton: 'btn btn-danger m-1 px-3'
|
|
7
|
+
},
|
|
8
|
+
buttonsStyling: false
|
|
9
|
+
});
|
|
10
|
+
export class Alerts {
|
|
11
|
+
static log(message, type = 'message') {
|
|
12
|
+
if (!document.body.classList.contains('dev-mode')) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
switch (type) {
|
|
16
|
+
case 'error':
|
|
17
|
+
console.error(message);
|
|
18
|
+
break;
|
|
19
|
+
case 'message':
|
|
20
|
+
console.log(message);
|
|
21
|
+
break;
|
|
22
|
+
case 'warning':
|
|
23
|
+
console.warn(message);
|
|
24
|
+
break;
|
|
25
|
+
case 'info':
|
|
26
|
+
console.info(message);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
static error(message, title = null, hideAfter = null) {
|
|
31
|
+
$.toast({
|
|
32
|
+
heading: title,
|
|
33
|
+
text: message,
|
|
34
|
+
icon: 'error',
|
|
35
|
+
position: 'bottom-left',
|
|
36
|
+
loader: false,
|
|
37
|
+
bgColor: '#d0100b',
|
|
38
|
+
textColor: 'white',
|
|
39
|
+
hideAfter: hideAfter
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
static warning(message, title = null, hideAfter = null) {
|
|
43
|
+
$.toast({
|
|
44
|
+
heading: title,
|
|
45
|
+
text: message,
|
|
46
|
+
icon: 'error',
|
|
47
|
+
position: 'bottom-left',
|
|
48
|
+
loader: false,
|
|
49
|
+
bgColor: '#ef9007',
|
|
50
|
+
textColor: 'white',
|
|
51
|
+
hideAfter: hideAfter
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
static message(message, title = null, hideAfter = null) {
|
|
55
|
+
$.toast({
|
|
56
|
+
heading: title,
|
|
57
|
+
text: message,
|
|
58
|
+
icon: 'error',
|
|
59
|
+
position: 'bottom-left',
|
|
60
|
+
loader: false,
|
|
61
|
+
bgColor: '#222222',
|
|
62
|
+
textColor: 'white',
|
|
63
|
+
hideAfter: hideAfter
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
static success(message, title = null, hideAfter = null) {
|
|
67
|
+
$.toast({
|
|
68
|
+
heading: title,
|
|
69
|
+
text: message,
|
|
70
|
+
icon: 'error',
|
|
71
|
+
position: 'bottom-left',
|
|
72
|
+
loader: false,
|
|
73
|
+
bgColor: '#28a745',
|
|
74
|
+
textColor: 'white',
|
|
75
|
+
hideAfter: hideAfter
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
static alert(message, title = null, icon = 'info', hideAfter = 10000) {
|
|
79
|
+
switch (icon) {
|
|
80
|
+
case 'error':
|
|
81
|
+
Alerts.error(message, title, hideAfter);
|
|
82
|
+
break;
|
|
83
|
+
case 'warning':
|
|
84
|
+
Alerts.warning(message, title, hideAfter);
|
|
85
|
+
break;
|
|
86
|
+
case 'info':
|
|
87
|
+
Alerts.message(message, title, hideAfter);
|
|
88
|
+
break;
|
|
89
|
+
case 'success':
|
|
90
|
+
Alerts.success(message, title, hideAfter);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
static sweetAlert(options, callback) {
|
|
95
|
+
BootstrapSwal.fire(options).then(function (result) {
|
|
96
|
+
callback(result);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
static confirm(options, callback) {
|
|
100
|
+
let baseOptions = {
|
|
101
|
+
showCancelButton: true,
|
|
102
|
+
footer: null,
|
|
103
|
+
title: 'Are you sure?',
|
|
104
|
+
html: 'Are you sure you want to do this?',
|
|
105
|
+
confirmButtonText: 'Ok',
|
|
106
|
+
cancelButtonText: 'Cancel'
|
|
107
|
+
};
|
|
108
|
+
Alerts.sweetAlert(Object.assign(Object.assign({}, baseOptions), options), callback);
|
|
109
|
+
}
|
|
110
|
+
static prompt(options, callback) {
|
|
111
|
+
let baseOptions = {
|
|
112
|
+
input: 'text',
|
|
113
|
+
inputAttributes: {
|
|
114
|
+
autocapitalize: 'off'
|
|
115
|
+
},
|
|
116
|
+
showCancelButton: true,
|
|
117
|
+
icon: 'info',
|
|
118
|
+
footer: '<span class="text-warning"><i class="fa fa-exclamation-triangle"></i> This cannot be undone.</span>',
|
|
119
|
+
confirmButtonText: 'Ok',
|
|
120
|
+
cancelButtonText: 'Cancel'
|
|
121
|
+
};
|
|
122
|
+
Alerts.sweetAlert(Object.assign(Object.assign({}, baseOptions), options), callback);
|
|
123
|
+
}
|
|
124
|
+
log(message, type = 'message') {
|
|
125
|
+
Alerts.log(message, type);
|
|
126
|
+
}
|
|
127
|
+
error(message, title = null, hideAfter = null) {
|
|
128
|
+
Alerts.error(message, title, hideAfter);
|
|
129
|
+
}
|
|
130
|
+
warning(message, title = null, hideAfter = null) {
|
|
131
|
+
Alerts.warning(message, title, hideAfter);
|
|
132
|
+
}
|
|
133
|
+
message(message, title = null, hideAfter = null) {
|
|
134
|
+
Alerts.message(message, title, hideAfter);
|
|
135
|
+
}
|
|
136
|
+
success(message, title = null, hideAfter = null) {
|
|
137
|
+
Alerts.success(message, title, hideAfter);
|
|
138
|
+
}
|
|
139
|
+
alert(message, title = null, icon = 'info', hideAfter = 10000) {
|
|
140
|
+
Alerts.alert(message, message, icon, hideAfter);
|
|
141
|
+
}
|
|
142
|
+
sweetAlert(options, callback) {
|
|
143
|
+
Alerts.sweetAlert(options, callback);
|
|
144
|
+
}
|
|
145
|
+
confirm(options, callback) {
|
|
146
|
+
Alerts.confirm(options, callback);
|
|
147
|
+
}
|
|
148
|
+
prompt(options, callback) {
|
|
149
|
+
Alerts.prompt(options, callback);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import Pickr from '@simonwep/pickr';
|
|
2
|
+
import '@simonwep/pickr';
|
|
3
|
+
export class ColorPickers {
|
|
4
|
+
constructor() {
|
|
5
|
+
}
|
|
6
|
+
loadColorPickers(tag = '.color-picker') {
|
|
7
|
+
let updateColorFieldValue = function (color, eventSource, instance) {
|
|
8
|
+
let elemId = $(instance._root.button).parent().data('target');
|
|
9
|
+
$(instance._root.button).parent().css({ 'background-color': color.toHEXA().toString() });
|
|
10
|
+
let colorHex = instance.getColor().toHEXA();
|
|
11
|
+
var result = "";
|
|
12
|
+
for (let i = colorHex.length - 1; i >= 0; i--) {
|
|
13
|
+
result = colorHex[i] + result;
|
|
14
|
+
}
|
|
15
|
+
$(elemId).val('#' + result);
|
|
16
|
+
$(elemId).change();
|
|
17
|
+
};
|
|
18
|
+
var pickrs = [];
|
|
19
|
+
// Simple example, see optional options for more configuration.
|
|
20
|
+
$(tag).each(function (index, elem) {
|
|
21
|
+
let lockOpacity = true;
|
|
22
|
+
if ($(this).data('opacity') == 'true') {
|
|
23
|
+
lockOpacity = false;
|
|
24
|
+
}
|
|
25
|
+
let pickr = Pickr.create({
|
|
26
|
+
el: elem.children[0],
|
|
27
|
+
appClass: 'custom-class',
|
|
28
|
+
theme: 'monolith',
|
|
29
|
+
useAsButton: true,
|
|
30
|
+
default: $(this).data('default') || 'none',
|
|
31
|
+
lockOpacity: lockOpacity,
|
|
32
|
+
defaultRepresentation: 'HEXA',
|
|
33
|
+
position: 'bottom-end',
|
|
34
|
+
components: {
|
|
35
|
+
opacity: true,
|
|
36
|
+
hue: true,
|
|
37
|
+
interaction: {
|
|
38
|
+
hex: false,
|
|
39
|
+
rgba: false,
|
|
40
|
+
hsva: false,
|
|
41
|
+
input: true,
|
|
42
|
+
clear: true
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
.on('init', function (instance) {
|
|
47
|
+
let elemId = $(instance._root.button).parent().data('target');
|
|
48
|
+
let value = $(elemId).val();
|
|
49
|
+
$(instance._root.button).parent().on('click', $.proxy(function () {
|
|
50
|
+
this.show();
|
|
51
|
+
}, instance));
|
|
52
|
+
$(elemId).on('click', $.proxy(function () {
|
|
53
|
+
this.show();
|
|
54
|
+
}, instance));
|
|
55
|
+
if (value) {
|
|
56
|
+
instance.setColor(value);
|
|
57
|
+
updateColorFieldValue(instance.getColor(), null, instance);
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
.on('clear', function (instance) {
|
|
61
|
+
let elemId = $(instance._root.button).parent().data('target');
|
|
62
|
+
instance.setColor('transparent');
|
|
63
|
+
updateColorFieldValue(instance.getColor(), null, instance);
|
|
64
|
+
$(elemId).val('');
|
|
65
|
+
$(elemId).change();
|
|
66
|
+
})
|
|
67
|
+
.on('change', updateColorFieldValue);
|
|
68
|
+
pickrs.push(pickr);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface HTMLElement {
|
|
3
|
+
hoodDataList: DataList;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export interface DataListOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Called before the data is fetched.
|
|
9
|
+
*/
|
|
10
|
+
onLoad?: (sender?: HTMLElement) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Called before the fetched HTML is rendered to the list. Must return the data back to datalist to render.
|
|
13
|
+
*/
|
|
14
|
+
onRender?: (html: string, sender?: HTMLElement) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Called when loading and rendering is complete.
|
|
17
|
+
*/
|
|
18
|
+
onComplete?: (html: string, sender?: HTMLElement) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Called when an error occurs.
|
|
21
|
+
*/
|
|
22
|
+
onError?: (jqXHR: any, textStatus: any, errorThrown: any) => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Attach a data list feed to an HTML element. The element must have a data-url attribute to connect to a feed.
|
|
26
|
+
*/
|
|
27
|
+
export declare class DataList {
|
|
28
|
+
element: HTMLElement;
|
|
29
|
+
options: DataListOptions;
|
|
30
|
+
/**
|
|
31
|
+
* @param element The datalist element. The element must have a data-url attribute to connect to a feed.
|
|
32
|
+
*/
|
|
33
|
+
constructor(element: HTMLElement, options: DataListOptions);
|
|
34
|
+
reload(this: DataList, url?: URL): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Alerts } from "./Alerts";
|
|
2
|
+
import { Inline } from "./Inline";
|
|
3
|
+
/**
|
|
4
|
+
* Attach a data list feed to an HTML element. The element must have a data-url attribute to connect to a feed.
|
|
5
|
+
*/
|
|
6
|
+
export class DataList {
|
|
7
|
+
/**
|
|
8
|
+
* @param element The datalist element. The element must have a data-url attribute to connect to a feed.
|
|
9
|
+
*/
|
|
10
|
+
constructor(element, options) {
|
|
11
|
+
this.element = element;
|
|
12
|
+
this.element.hoodDataList = this;
|
|
13
|
+
if (typeof (element) == 'undefined' || element == null) {
|
|
14
|
+
Alerts.log('Could not DataList to element, element does not exist.', 'error');
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this.options = Object.assign(Object.assign({}, this.options), options);
|
|
18
|
+
if ($(this.element).hasClass('query')) {
|
|
19
|
+
let pageUrl = $(this.element).data('url') + window.location.search;
|
|
20
|
+
$(this.element).attr('data-url', pageUrl);
|
|
21
|
+
$(this.element).data('url', pageUrl);
|
|
22
|
+
}
|
|
23
|
+
if (!$(this.element).hasClass('refresh-only')) {
|
|
24
|
+
var listUrl = document.createElement('a');
|
|
25
|
+
listUrl.href = $(this.element).data('url');
|
|
26
|
+
this.reload(new URL(listUrl.href));
|
|
27
|
+
}
|
|
28
|
+
$(this.element).on('click', '.pagination a, a.hood-inline-list-target', function (e) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
var url = document.createElement('a');
|
|
31
|
+
url.href = e.currentTarget.href;
|
|
32
|
+
var listUrl = document.createElement('a');
|
|
33
|
+
listUrl.href = $(this.element).data('url');
|
|
34
|
+
listUrl.search = url.search;
|
|
35
|
+
this.reload(new URL(listUrl.href));
|
|
36
|
+
}.bind(this));
|
|
37
|
+
$('body').on('submit', `form.inline[data-target="#${this.element.id}"]`, function (e) {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
let $form = $(e.currentTarget);
|
|
40
|
+
var listUrl = document.createElement('a');
|
|
41
|
+
listUrl.href = $(this.element).data('url');
|
|
42
|
+
listUrl.search = "?" + $form.serialize();
|
|
43
|
+
this.reload(new URL(listUrl.href));
|
|
44
|
+
}.bind(this));
|
|
45
|
+
}
|
|
46
|
+
reload(url = null) {
|
|
47
|
+
if (url) {
|
|
48
|
+
if (history.pushState && $(this.element).hasClass('query')) {
|
|
49
|
+
let newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + (url.href.contains('?') ? "?" + url.href.substring(url.href.indexOf('?') + 1) : '');
|
|
50
|
+
window.history.pushState({ path: newurl }, '', newurl);
|
|
51
|
+
}
|
|
52
|
+
$(this.element).data('url', url);
|
|
53
|
+
}
|
|
54
|
+
Inline.load(this.element, Object.assign({}, this.options));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MediaService } from './Media';
|
|
2
|
+
import { ModalController } from './Modal';
|
|
3
|
+
export declare interface EditorOptions {
|
|
4
|
+
linkClasses?: any;
|
|
5
|
+
imageClasses?: any;
|
|
6
|
+
}
|
|
7
|
+
export declare class Editors {
|
|
8
|
+
options: EditorOptions;
|
|
9
|
+
constructor(options?: EditorOptions);
|
|
10
|
+
richTextEditors(): void;
|
|
11
|
+
mediaModal: ModalController;
|
|
12
|
+
list: HTMLElement;
|
|
13
|
+
service: MediaService;
|
|
14
|
+
currentEditor: JQuery<HTMLElement>;
|
|
15
|
+
setupCommands(editor: any): void;
|
|
16
|
+
}
|