Comparing version 4.0.1 to 4.1.1
@@ -1,1 +0,1 @@ | ||
"use strict";$.hood||($.hood={}),$.hood.Admin={Init:function(){$(".navbar-nav .collapse").on("show.bs.collapse",function(){!function(e){var t=e.closest(".navbar-nav, .navbar-nav .nav").querySelectorAll(".collapse");[].forEach.call(t,function(t){t!==e&&$(t).collapse("hide")})}(this)}),$(".mobile-sidebar-toggle").on("click",function(){$("nav.sidebar").toggleClass("open")}),$(".right-sidebar-toggle").on("click",function(){$("#right-sidebar").toggleClass("sidebar-open")}),$(".alert.auto-dismiss").fadeTo(5e3,500).slideUp(500,function(){$(".alert.auto-dismiss").slideUp(500)}),$(".sidebar-scroll").slimScroll({height:"100%",railOpacity:.4,wheelStep:10}),$('[data-plugin="counter"]')&&$.counterUp&&$('[data-plugin="counter"]').counterUp({delay:10,time:800}),$.hood.Admin.Editors.Init(),$.hood.Admin.Stats.Init()},Editors:{Init:function(){tinymce.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"],toolbar:"styleselect | bold italic | alignleft aligncenter alignright | bullist numlist | link image media hoodimage | code",link_class_list:$.hood.LinkClasses,image_class_list:$.hood.ImageClasses,setup:$.hood.Media.Actions.Load.Insert,image_dimensions:!1}),tinymce.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:"bold italic | bullist numlist | undo redo | link",link_class_list:$.hood.LinkClasses,image_class_list:$.hood.ImageClasses,image_dimensions:!1}),tinymce.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"],toolbar:"styleselect | bold italic | alignleft aligncenter alignright | bullist numlist | link image media hoodimage | code",link_class_list:$.hood.LinkClasses,image_class_list:$.hood.ImageClasses,setup:$.hood.Media.Actions.Load.Insert,image_dimensions:!1}),tinymce.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:"bold italic | bullist numlist | undo redo | link",link_class_list:$.hood.LinkClasses,image_class_list:$.hood.ImageClasses,image_dimensions:!1})}},Load:function(){$.hood.Admin.Resize()},Ready:function(){$.hood.Admin.CheckAndLoadTabs("#page-tabs"),$.hood.Admin.Resize()},Resize:function(){$(window).width()>768&&$(".content-body").css({"min-height":$(window).height()-216})},Stats:{Init:function(){$("#admin-chart-area").exists()&&($.hood.Admin.Stats.LoadChart(),$("body").on("change","#history",function(){$.hood.Admin.Stats.LoadChart()}))},LoadChart:function(){$.get("/admin/stats/",function(e){$("#admin-chart-area").empty(),$("#admin-chart-area").html('<canvas id="admin-stats-chart"></canvas>'),$.hood.Admin.Stats.LoadStats(e),$.hood.Admin.Stats.DoCharts(e)})},SetupCharts:function(){Chart.defaults.global.responsive=!0,Chart.defaults.global.maintainAspectRatio=!1,Chart.defaults.global.defaultColor="#6E84A3",Chart.defaults.global.defaultFontColor="#6E84A3",Chart.defaults.global.defaultFontFamily="",Chart.defaults.global.defaultFontSize=16,Chart.defaults.global.layout.padding=0,Chart.defaults.global.legend.display=!0,Chart.defaults.global.legend.position="bottom",Chart.defaults.global.legend.labels.usePointStyle=!0,Chart.defaults.global.legend.labels.padding=25,Chart.defaults.global.elements.point.radius=5,Chart.defaults.global.elements.point.backgroundColor="#000000",Chart.defaults.global.elements.line.tension=.4,Chart.defaults.global.elements.line.borderWidth=3,Chart.defaults.global.elements.line.borderColor="#aaaaaa",Chart.defaults.global.elements.line.backgroundColor="transparent",Chart.defaults.global.elements.line.borderCapStyle="round",Chart.defaults.global.elements.rectangle.backgroundColor="#aaaaaa",Chart.defaults.global.elements.arc.backgroundColor="#2C7BE5",Chart.defaults.global.elements.arc.borderColor="#152E4D",Chart.defaults.global.elements.arc.borderWidth=4,Chart.defaults.global.elements.arc.hoverBorderColor="#152E4D",Chart.defaults.global.tooltips.enabled=!0,Chart.defaults.global.tooltips.mode="nearest",Chart.defaults.global.tooltips.intersect=!1,Chart.scaleService.updateScaleDefaults("linear",{gridLines:{borderDash:[2],borderDashOffset:[2],color:"#dedede",drawBorder:!1,drawTicks:!1,zeroLineColor:"#dedede",zeroLineBorderDash:[2],zeroLineBorderDashOffset:[2]},ticks:{beginAtZero:!0,padding:2,callback:function(e){return e}}}),Chart.scaleService.updateScaleDefaults("category",{gridLines:{drawBorder:!1,drawOnChartArea:!1,drawTicks:!1},ticks:{padding:5}})},DoCharts:function(e){var t=[],a=[],o="#fabd07",l="#20c997",s="#fd7e14",n=[],i=[];e.content.months.forEach(function(e){i.push(e.Value),n.push(e.Key)}),t.push({label:"New Content",data:i,borderColor:o,backgroundColor:o,pointBackgroundColor:o,pointBorderColor:"#ffffff"}),i=[],e.users.months.forEach(function(e){i.push(e.Value)}),t.push({label:"New Users",data:i,borderColor:s,backgroundColor:s,pointBackgroundColor:s,pointBorderColor:"#ffffff"}),i=[],e.properties.months.forEach(function(e){i.push(e.Value)}),t.push({label:"New Properties",data:i,borderColor:l,backgroundColor:l,pointBackgroundColor:l,pointBorderColor:"#ffffff"}),a=n;var r=document.getElementById("admin-stats-chart");new Chart(r,{type:"bar",data:{labels:a,datasets:t},responsive:!0,maintainAspectRatio:!1,options:{responsive:!0,maintainAspectRatio:!1,scales:{yAxes:[{ticks:{beginAtZero:!0}}]}}})},LoadStats:function(e){if(e.content&&($(".content-totalPosts").text(e.content.totalPosts),$(".content-totalPublished").text(e.content.totalPublished),e.content.byType))for(var t=0;t<e.content.byType.length;t++)$(".content-"+e.content.byType[t].typeName+"-total").text(e.content.byType[t].total);e.users&&($(".users-totalUsers").text(e.users.totalUsers),$(".users-totalAdmins").text(e.users.totalAdmins)),e.properties&&($(".properties-totalPosts").text(e.properties.totalPosts),$(".properties-totalPublished").text(e.properties.totalPublished))}},CheckAndLoadTabs:function(e){$(e).each(function(){var e=$('<li class="nav-item d-inline d-lg-none"></li>'),t=$('<div class="dropdown-menu"></ul>'),a=$('<ul class="navbar-nav"></ul>');$(this).find("> li").each(function(){var e=$(this).children("a:first-child"),t=$('<li class="nav-item"><a href="'+e.attr("href")+'" data-toggle="tab" class="nav-link tab-switch">'+e.html()+"</a></li>");a.append(t),$(this).addClass("d-none d-lg-inline")}),e.append('<a class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-eye mr-2"></i><span>Choose View</span></button>'),t.append(a),e.append(t),$(this).prepend(e)}),$(e+' a[data-toggle="tab"]').on("shown.bs.tab",function(t){localStorage.setItem("tab-"+$(e).data("id"),$(t.target).attr("href"))});var t=localStorage.getItem("tab-"+$(e).data("id"));t?$(e+' a[href="'+t+'"]').tab("show"):$(e+' a[data-toggle="tab"]').first().tab("show")}},$(document).ready($.hood.Admin.Ready),$(window).on("load",$.hood.Admin.Load),$(window).on("resize",$.hood.Admin.Resize),$.hood.Admin.Init(); | ||
"use strict";$.hood||($.hood={}),$.hood.Admin={Init:function(){$(".navbar-nav .collapse").on("show.bs.collapse",function(){!function(e){var a=e.closest(".navbar-nav, .navbar-nav .nav").querySelectorAll(".collapse");[].forEach.call(a,function(a){a!==e&&$(a).collapse("hide")})}(this)}),$(".mobile-sidebar-toggle").on("click",function(){$("nav.sidebar").toggleClass("open")}),$(".right-sidebar-toggle").on("click",function(){$("#right-sidebar").toggleClass("sidebar-open")}),$(".alert.auto-dismiss").fadeTo(5e3,500).slideUp(500,function(){$(".alert.auto-dismiss").slideUp(500)}),$(".sidebar-scroll").slimScroll({height:"100%",railOpacity:.4,wheelStep:10}),$('[data-plugin="counter"]')&&$.counterUp&&$('[data-plugin="counter"]').counterUp({delay:10,time:800}),$.hood.Admin.Editors.Init(),$.hood.Admin.Stats.Init()},Editors:{Init:function(){tinymce.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"],toolbar:"styleselect | bold italic | alignleft aligncenter alignright | bullist numlist | link image media hoodimage | code",link_class_list:$.hood.LinkClasses,image_class_list:$.hood.ImageClasses,setup:$.hood.Media.Actions.Load.Insert,image_dimensions:!1}),tinymce.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:"bold italic | bullist numlist | undo redo | link",link_class_list:$.hood.LinkClasses,image_class_list:$.hood.ImageClasses,image_dimensions:!1}),tinymce.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"],toolbar:"styleselect | bold italic | alignleft aligncenter alignright | bullist numlist | link image media hoodimage | code",link_class_list:$.hood.LinkClasses,image_class_list:$.hood.ImageClasses,setup:$.hood.Media.Actions.Load.Insert,image_dimensions:!1}),tinymce.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:"bold italic | bullist numlist | undo redo | link",link_class_list:$.hood.LinkClasses,image_class_list:$.hood.ImageClasses,image_dimensions:!1})}},Load:function(){$.hood.Admin.Resize()},Ready:function(){$.hood.Admin.CheckAndLoadTabs("#page-tabs"),$.hood.Admin.Resize()},Resize:function(){$(window).width()>768&&$(".content-body").css({"min-height":$(window).height()-216})},Stats:{Init:function(){$("#admin-chart-area").exists()&&($.hood.Admin.Stats.LoadChart(),$("body").on("change","#history",function(){$.hood.Admin.Stats.LoadChart()}))},LoadChart:function(){$.get("/admin/stats/",function(e){$("#admin-chart-area").empty(),$("#admin-chart-area").html('<canvas id="admin-stats-chart"></canvas>'),$.hood.Admin.Stats.LoadStats(e),$.hood.Admin.Stats.DoCharts(e)})},SetupCharts:function(){Chart.defaults.global.responsive=!0,Chart.defaults.global.maintainAspectRatio=!1,Chart.defaults.global.defaultColor="#6E84A3",Chart.defaults.global.defaultFontColor="#6E84A3",Chart.defaults.global.defaultFontFamily="",Chart.defaults.global.defaultFontSize=16,Chart.defaults.global.layout.padding=0,Chart.defaults.global.legend.display=!0,Chart.defaults.global.legend.position="bottom",Chart.defaults.global.legend.labels.usePointStyle=!0,Chart.defaults.global.legend.labels.padding=25,Chart.defaults.global.elements.point.radius=5,Chart.defaults.global.elements.point.backgroundColor="#000000",Chart.defaults.global.elements.line.tension=.4,Chart.defaults.global.elements.line.borderWidth=3,Chart.defaults.global.elements.line.borderColor="#aaaaaa",Chart.defaults.global.elements.line.backgroundColor="transparent",Chart.defaults.global.elements.line.borderCapStyle="round",Chart.defaults.global.elements.rectangle.backgroundColor="#aaaaaa",Chart.defaults.global.elements.arc.backgroundColor="#2C7BE5",Chart.defaults.global.elements.arc.borderColor="#152E4D",Chart.defaults.global.elements.arc.borderWidth=4,Chart.defaults.global.elements.arc.hoverBorderColor="#152E4D",Chart.defaults.global.tooltips.enabled=!0,Chart.defaults.global.tooltips.mode="nearest",Chart.defaults.global.tooltips.intersect=!1,Chart.scaleService.updateScaleDefaults("linear",{gridLines:{borderDash:[2],borderDashOffset:[2],color:"#dedede",drawBorder:!1,drawTicks:!1,zeroLineColor:"#dedede",zeroLineBorderDash:[2],zeroLineBorderDashOffset:[2]},ticks:{beginAtZero:!0,padding:2,callback:function(e){return e}}}),Chart.scaleService.updateScaleDefaults("category",{gridLines:{drawBorder:!1,drawOnChartArea:!1,drawTicks:!1},ticks:{padding:5}})},DoCharts:function(e){var a=[],t=[],o=[],l=[];e.content.months.forEach(function(e){l.push(e.Value),o.push(e.Key)}),a.push({label:"New Content",data:l,borderColor:"#fabd07",backgroundColor:"#fabd07",pointBackgroundColor:"#fabd07",pointBorderColor:"#ffffff"}),l=[],e.users.months.forEach(function(e){l.push(e.Value)}),a.push({label:"New Users",data:l,borderColor:"#fd7e14",backgroundColor:"#fd7e14",pointBackgroundColor:"#fd7e14",pointBorderColor:"#ffffff"}),l=[],e.properties.months.forEach(function(e){l.push(e.Value)}),a.push({label:"New Properties",data:l,borderColor:"#20c997",backgroundColor:"#20c997",pointBackgroundColor:"#20c997",pointBorderColor:"#ffffff"}),t=o;var s=document.getElementById("admin-stats-chart");new Chart(s,{type:"bar",data:{labels:t,datasets:a},responsive:!0,maintainAspectRatio:!1,options:{responsive:!0,maintainAspectRatio:!1,scales:{yAxes:[{ticks:{beginAtZero:!0}}]}}})},LoadStats:function(e){if(e.content&&($(".content-totalPosts").text(e.content.totalPosts),$(".content-totalPublished").text(e.content.totalPublished),e.content.byType))for(var a=0;a<e.content.byType.length;a++)$(".content-"+e.content.byType[a].typeName+"-total").text(e.content.byType[a].total);e.users&&($(".users-totalUsers").text(e.users.totalUsers),$(".users-totalAdmins").text(e.users.totalAdmins)),e.properties&&($(".properties-totalPosts").text(e.properties.totalPosts),$(".properties-totalPublished").text(e.properties.totalPublished))}},CheckAndLoadTabs:function(e){$(e).each(function(){var e=$('<li class="nav-item d-inline d-lg-none"></li>'),a=$('<div class="dropdown-menu"></ul>'),t=$('<ul class="navbar-nav"></ul>');$(this).find("> li").each(function(){var e=$(this).children("a:first-child"),a=$('<li class="nav-item"><a href="'+e.attr("href")+'" data-toggle="tab" class="nav-link tab-switch">'+e.html()+"</a></li>");t.append(a),$(this).addClass("d-none d-lg-inline")}),e.append('<a class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-eye mr-2"></i><span>Choose View</span></button>'),a.append(t),e.append(a),$(this).prepend(e)}),$(e+' a[data-toggle="tab"]').on("shown.bs.tab",function(a){localStorage.setItem("tab-"+$(e).data("id"),$(a.target).attr("href"))});var a=localStorage.getItem("tab-"+$(e).data("id"));a?$(e+' a[href="'+a+'"]').tab("show"):$(e+' a[data-toggle="tab"]').first().tab("show")}},$(document).ready($.hood.Admin.Ready),$(window).on("load",$.hood.Admin.Load),$(window).on("resize",$.hood.Admin.Resize),$.hood.Admin.Init(); |
@@ -1,1 +0,1 @@ | ||
"use strict";$.hood||($.hood={}),$.hood.Content={Init:function(){$("body").on("click",".content-delete",$.hood.Content.Delete),$("body").on("click",".content-meta-delete",$.hood.Content.Meta.Delete),$("body").on("click",".content-clone",$.hood.Content.Clone),$("body").on("click",".content-set-status",$.hood.Content.SetStatus),$("body").on("click",".content-media-delete",$.hood.Content.Media.Delete),$("body").on("click",".content-categories-delete",$.hood.Content.Categories.Delete),$("body").on("change",".content-categories-check",$.hood.Content.Categories.ToggleCategory),$("body").on("click",".add-custom-field",$.hood.Content.Types.AddField),$("body").on("click",".delete-custom-field",$.hood.Content.Types.DeleteField),$("body").on("keyup","#Slug",function(){$(".slug-display").html($(this).val())}),$("#content-edit-form").doesExist()&&$.hood.Content.Edit.Init(),$("#content-meta-form").doesExist()&&$.hood.Content.Meta.Init()},Lists:{Content:{Loaded:function(e,t){$.hood.Loader(!1)},Reload:function(e){$("#content-list").doesExist()&&$.hood.Inline.Reload($("#content-list"),e)}},Categories:{Loaded:function(e,t){$.hood.Loader(!1)},Reload:function(e){$("#content-categories-list").doesExist()&&$.hood.Inline.Reload($("#content-categories-list"),e)}},Fields:{Loaded:function(e,t){$.hood.Loader(!1)},Reload:function(e){$("#content-meta-list").doesExist()&&$.hood.Inline.Reload($("#content-meta-list"),e)}},Media:{Loaded:function(e,t){$.hood.Loader(!1)},Reload:function(e){$("#content-media-list").doesExist()&&$.hood.Inline.Reload($("#content-media-list"),e)}}},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Content.Reload(),e.Success&&t&&t.data("redirect")&&($.hood.Alerts.Success("<strong>Content deleted, redirecting...</strong><br />Just taking you back to the content list."),setTimeout(function(){window.location=t.data("redirect")},1500))})};$.hood.Alerts.Confirm("The content will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong></span>')},SetStatus:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),t.data("status"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Content.Reload()})};$.hood.Alerts.Confirm("The item will be immediately visible on the website.","Are you sure?",o,"warning")},Clone:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),t.data("status"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Content.Reload()})};$.hood.Alerts.Confirm("This will duplicate the content and everything inside it.","Are you sure?",o,"warning")},Create:function(){$("#content-create-form").find(".datepicker").datetimepicker({locale:"en-gb",format:"L"}),$("#content-create-form").hoodValidator({validationRules:{Title:{required:!0},Except:{required:!0},PublishDate:{required:!0,ukdate:!0}},submitButtonTag:$("#content-create-submit"),submitUrl:$("#content-create-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Content.Reload()}})},Edit:{Init:function(){$(".datepicker").datetimepicker({locale:"en-gb",format:"L"}),$(".timepicker").datetimepicker({locale:"en-gb",format:"LT"}),$(".datetimepicker").datetimepicker({locale:"en-gb",sideBySide:!0}),$.hood.Content.Edit.InitImageUploader()},InitImageUploader:function(){if($("#content-gallery-add").doesExist()){$("#content-gallery-total-progress").hide(),Dropzone.autoDiscover=!1;var e=new Dropzone("#content-gallery-upload",{url:$("#content-gallery-upload").data("url"),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:!1,paramName:"files",autoProcessQueue:!0,previewsContainer:!1,clickable:"#content-gallery-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!"});e.on("success",function(e,t){$.hood.Helpers.ProcessResponse(t),$.hood.Content.Lists.Media.Reload()}),e.on("addedfile",function(e){$("#content-gallery-total-progress .progress-bar").css({width:"0%"}),$("#content-gallery-total-progress .progress-bar .percentage").html("0%")}),e.on("totaluploadprogress",function(e){$("#content-gallery-total-progress .progress-bar").css({width:e+"%"}),$("#content-gallery-total-progress .progress-bar .percentage").html(e+"%")}),e.on("sending",function(e){$("#content-gallery-total-progress").fadeIn(),$("#content-gallery-total-progress .progress-bar").css({width:"0%"}),$("#content-gallery-total-progress .progress-bar .percentage").html("0%")}),e.on("complete",function(e){$.hood.Content.Lists.Media.Reload()}),e.on("queuecomplete",function(e){$("#content-gallery-total-progress").hide(),$.hood.Content.Lists.Media.Reload()})}}},Categories:{Editor:function(){$("#content-categories-edit-form").hoodValidator({validationRules:{DisplayName:{required:!0},Slug:{required:!0}},submitButtonTag:$("#content-categories-edit-submit"),submitUrl:$("#content-categories-edit-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Categories.Reload()}})},ToggleCategory:function(){$.post($(this).data("url"),{categoryId:$(this).val(),add:$(this).is(":checked")},function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Categories.Reload()})},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Categories.Reload()})};$.hood.Alerts.Confirm("The category will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong></span>')}},Meta:{Create:function(){$("#add-field-form").hoodValidator({validationRules:{cfName:{required:!0},cfType:{required:!0}},submitButtonTag:$("#add-field-submit"),submitUrl:"/admin/content/addmeta",submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Fields.Reload()}})},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Fields.Reload()})};$.hood.Alerts.Confirm("The field will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong></span>')}},Media:{Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Media.Reload()})};$.hood.Alerts.Confirm("The image/media will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong><br /><span class="text-warning">If this is set as a featured image, this may cause issues, make sure to set another image as featured before deleting this one.</span></span>')}},Types:{AddField:function(){var e=$("#custom-field-name-"+$(this).data("id")).val(),t=$.hood.Content.Types.GetFieldsList($(this).data("id")),o=!1;if($.each(t,function(t,n){n.Name===e&&(o=!0)}),!e)return void $.hood.Alerts.Error("You have to name the field.");if(!t)return void $.hood.Alerts.Error("The field list is empty.");if(o)return void $.hood.Alerts.Error("Cannot insert two fields with the same key.");var n={Name:$("#custom-field-name-"+$(this).data("id")).data("prefix")+$("#custom-field-name-"+$(this).data("id")).val(),Default:$("#custom-field-default-"+$(this).data("id")).val(),Type:$("#custom-field-type-"+$(this).data("id")).val(),System:!1};t.push(n),$.hood.Content.Types.ReRenderFields(t,$(this).data("id")),$("#custom-fields-"+$(this).data("id")).val(JSON.stringify(t)),$.hood.Alerts.Success("Added field.")},DeleteField:function(){var e=$.hood.Content.Types.GetFieldsList($(this).data("id")),t=$(this).data("name");e=$.grep(e,function(e){return e.Name!==t}),$.hood.Content.Types.ReRenderFields(e,$(this).data("id")),$("#custom-fields-"+$(this).data("id")).val(JSON.stringify(e)),$.hood.Alerts.Success("Deleted field.")},GetFieldsList:function(e){var t=$("#custom-fields-"+e).val();if(null!==t&&""!==t){var o=JSON.parse(t);for(var n in o)if(o[n].hasOwnProperty("Name"))return o}return new Array},ReRenderFields:function(e,t){var o=$("#field-list-"+t).empty();for(i=0;i<e.length;i++){var n="<tr><td class='col-xs-8'><strong>"+e[i].Name+"</strong> "+e[i].Type+"</td><td class='col-xs-4 text-right'>";n+=e[i].System?'<span class="label label-default">System Field</span>':"<a class='delete-custom-field btn btn-xs bg-color-red txt-color-white' data-name='"+e[i].Name+"' data-id='"+t+"'><i class='fa fa-trash-o'></i></a>",n+="</td></tr>",o.append(n)}}}},$(document).ready($.hood.Content.Init); | ||
"use strict";$.hood||($.hood={}),$.hood.Content={Init:function(){$("body").on("click",".content-delete",$.hood.Content.Delete),$("body").on("click",".content-meta-delete",$.hood.Content.Meta.Delete),$("body").on("click",".content-clone",$.hood.Content.Clone),$("body").on("click",".content-set-status",$.hood.Content.SetStatus),$("body").on("click",".content-media-delete",$.hood.Content.Media.Delete),$("body").on("click",".content-categories-delete",$.hood.Content.Categories.Delete),$("body").on("change",".content-categories-check",$.hood.Content.Categories.ToggleCategory),$("body").on("click",".add-custom-field",$.hood.Content.Types.AddField),$("body").on("click",".delete-custom-field",$.hood.Content.Types.DeleteField),$("body").on("keyup","#Slug",function(){$(".slug-display").html($(this).val())}),$("#content-edit-form").doesExist()&&$.hood.Content.Edit.Init(),$("#content-meta-form").doesExist()&&$.hood.Content.Meta.Init()},Lists:{Content:{Loaded:function(e,t){$.hood.Loader(!1)},Reload:function(e){$("#content-list").doesExist()&&$.hood.Inline.Reload($("#content-list"),e)}},Categories:{Loaded:function(e,t){$.hood.Loader(!1)},Reload:function(e){$("#content-categories-list").doesExist()&&$.hood.Inline.Reload($("#content-categories-list"),e)}},Fields:{Loaded:function(e,t){$.hood.Loader(!1)},Reload:function(e){$("#content-meta-list").doesExist()&&$.hood.Inline.Reload($("#content-meta-list"),e)}},Media:{Loaded:function(e,t){$.hood.Loader(!1)},Reload:function(e){$("#content-media-list").doesExist()&&$.hood.Inline.Reload($("#content-media-list"),e)}}},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Content.Reload(),e.Success&&t&&t.data("redirect")&&($.hood.Alerts.Success("<strong>Content deleted, redirecting...</strong><br />Just taking you back to the content list."),setTimeout(function(){window.location=t.data("redirect")},1500))})};$.hood.Alerts.Confirm("The content will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong></span>')},SetStatus:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),t.data("status"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Content.Reload()})};$.hood.Alerts.Confirm("The item will be immediately visible on the website.","Are you sure?",o,"warning")},Clone:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),t.data("status"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Content.Reload()})};$.hood.Alerts.Confirm("This will duplicate the content and everything inside it.","Are you sure?",o,"warning")},Create:function(){$("#content-create-form").find(".datepicker").datetimepicker({locale:"en-gb",format:"L"}),$("#content-create-form").hoodValidator({validationRules:{Title:{required:!0},Except:{required:!0},PublishDate:{required:!0,ukdate:!0}},submitButtonTag:$("#content-create-submit"),submitUrl:$("#content-create-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Content.Reload()}})},Edit:{Init:function(){$(".datepicker").datetimepicker({locale:"en-gb",format:"L"}),$(".timepicker").datetimepicker({locale:"en-gb",format:"LT"}),$(".datetimepicker").datetimepicker({locale:"en-gb",sideBySide:!0}),$.hood.Content.Edit.InitImageUploader()},InitImageUploader:function(){if($("#content-gallery-add").doesExist()){$("#content-gallery-total-progress").hide(),Dropzone.autoDiscover=!1;var e=new Dropzone("#content-gallery-upload",{url:$("#content-gallery-upload").data("url"),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:!1,paramName:"files",autoProcessQueue:!0,previewsContainer:!1,clickable:"#content-gallery-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!"});e.on("success",function(e,t){$.hood.Helpers.ProcessResponse(t),$.hood.Content.Lists.Media.Reload()}),e.on("addedfile",function(e){$("#content-gallery-total-progress .progress-bar").css({width:"0%"}),$("#content-gallery-total-progress .progress-bar .percentage").html("0%")}),e.on("totaluploadprogress",function(e){$("#content-gallery-total-progress .progress-bar").css({width:e+"%"}),$("#content-gallery-total-progress .progress-bar .percentage").html(e+"%")}),e.on("sending",function(e){$("#content-gallery-total-progress").fadeIn(),$("#content-gallery-total-progress .progress-bar").css({width:"0%"}),$("#content-gallery-total-progress .progress-bar .percentage").html("0%")}),e.on("complete",function(e){$.hood.Content.Lists.Media.Reload()}),e.on("queuecomplete",function(e){$("#content-gallery-total-progress").hide(),$.hood.Content.Lists.Media.Reload()})}}},Categories:{Editor:function(){$("#content-categories-edit-form").hoodValidator({validationRules:{DisplayName:{required:!0},Slug:{required:!0}},submitButtonTag:$("#content-categories-edit-submit"),submitUrl:$("#content-categories-edit-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Categories.Reload()}})},ToggleCategory:function(){$.post($(this).data("url"),{categoryId:$(this).val(),add:$(this).is(":checked")},function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Categories.Reload()})},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Categories.Reload()})};$.hood.Alerts.Confirm("The category will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong></span>')}},Meta:{Create:function(){$("#add-field-form").hoodValidator({validationRules:{cfName:{required:!0},cfType:{required:!0}},submitButtonTag:$("#add-field-submit"),submitUrl:"/admin/content/addmeta",submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Fields.Reload()}})},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Fields.Reload()})};$.hood.Alerts.Confirm("The field will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong></span>')}},Media:{Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Content.Lists.Media.Reload()})};$.hood.Alerts.Confirm("The image/media will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong><br /><span class="text-warning">If this is set as a featured image, this may cause issues, make sure to set another image as featured before deleting this one.</span></span>')}},Types:{AddField:function(){var e=$("#custom-field-name-"+$(this).data("id")).val(),t=$.hood.Content.Types.GetFieldsList($(this).data("id")),o=!1;if($.each(t,function(t,n){n.Name===e&&(o=!0)}),!e)return void $.hood.Alerts.Error("You have to name the field.");if(!t)return void $.hood.Alerts.Error("The field list is empty.");if(o)return void $.hood.Alerts.Error("Cannot insert two fields with the same key.");var n={Name:$("#custom-field-name-"+$(this).data("id")).data("prefix")+$("#custom-field-name-"+$(this).data("id")).val(),Default:$("#custom-field-default-"+$(this).data("id")).val(),Type:$("#custom-field-type-"+$(this).data("id")).val(),System:!1};t.push(n),$.hood.Content.Types.ReRenderFields(t,$(this).data("id")),$("#custom-fields-"+$(this).data("id")).val(JSON.stringify(t)),$.hood.Alerts.Success("Added field.")},DeleteField:function(){var e=$.hood.Content.Types.GetFieldsList($(this).data("id")),t=$(this).data("name");e=$.grep(e,function(e){return e.Name!==t}),$.hood.Content.Types.ReRenderFields(e,$(this).data("id")),$("#custom-fields-"+$(this).data("id")).val(JSON.stringify(e)),$.hood.Alerts.Success("Deleted field.")},GetFieldsList:function(e){var t=$("#custom-fields-"+e).val();if(null!==t&&""!==t){var o=JSON.parse(t);for(var n in o)if(o[n].hasOwnProperty("Name"))return o}return new Array},ReRenderFields:function(e,t){var o=$("#field-list-"+t).empty();for(i=0;i<e.length;i++){var n="<tr><td class='col-xs-8'><strong>"+e[i].Name+"</strong> "+e[i].Type+"</td><td class='col-xs-4 text-right'>";e[i].System?n+='<span class="label label-default">System Field</span>':n+="<a class='delete-custom-field btn btn-xs bg-color-red txt-color-white' data-name='"+e[i].Name+"' data-id='"+t+"'><i class='fa fa-trash-o'></i></a>",n+="</td></tr>",o.append(n)}}}},$(document).ready($.hood.Content.Init); |
@@ -1,1 +0,1 @@ | ||
"use strict";$.hood||($.hood={}),$.hood.Logs={Init:function(){$("body").on("change",".logs-inline",$.hood.Logs.InlineToggle)},Loaded:function(o,e){$.hood.Loader(!1)},Reload:function(o){$("#logs-list").doesExist()&&$.hood.Inline.Reload($("#logs-list"),o)},ReloadInterval:null,InlineToggle:function(o){$(this).is(":checked")?$.hood.Logs.ReloadInterval=setInterval($.hood.Logs.Reload,5e3):$.hood.Logs.ReloadInterval=setInterval($.hood.Logs.Reload,5e3)}},$(document).ready($.hood.Logs.Init); | ||
"use strict";$.hood||($.hood={}),$.hood.Logs={Init:function(){$("body").on("change",".logs-inline",$.hood.Logs.InlineToggle)},Loaded:function(o,e){$.hood.Loader(!1)},Reload:function(o){$("#logs-list").doesExist()&&$.hood.Inline.Reload($("#logs-list"),o)},ReloadInterval:null,InlineToggle:function(o){$(this).is(":checked"),$.hood.Logs.ReloadInterval=setInterval($.hood.Logs.Reload,5e3)}},$(document).ready($.hood.Logs.Init); |
@@ -1,1 +0,1 @@ | ||
"use strict";$.hood||($.hood={}),$.hood.Users={Init:function(){$("body").on("click",".user-delete",$.hood.Users.Delete),$("body").on("click",".user-reset-password",$.hood.Users.Edit.ResetPassword),$("body").on("click",".user-notes-add",$.hood.Users.Edit.Notes.Add),$("body").on("click",".user-notes-delete",$.hood.Users.Edit.Notes.Delete),$("body").on("change","#user-create-form #GeneratePassword",$.hood.Users.Create.GeneratePassword),$("body").on("change",".user-role-check",$.hood.Users.Edit.ToggleRole)},Loaded:function(e,o){$.hood.Loader(!1)},Reload:function(e){$("#user-list").doesExist()&&$.hood.Inline.Reload($("#user-list"),e)},Delete:function(e){e.preventDefault();var o=$(this),s=function(e){e&&$.post(o.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Users.Reload(),e.Success&&o&&o.data("redirect")&&($.hood.Alerts.Success("<strong>User deleted, redirecting...</strong><br />Just taking you back to the user list."),setTimeout(function(){window.location=o.data("redirect")},1500))})};$.hood.Alerts.Confirm("The user will be permanently removed, any site content will be reassigned to the ownership of the site owner, any user content (Forum Topics & Posts) will be deleted from the system and all associated media files.","Are you sure?",s,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong><br />This process will also cancel any active subscriptions.</span>')},Create:{Loaded:function(e){$("#user-create-form").hoodValidator({validationRules:{FirstName:{required:!0},LastName:{required:!0},UserName:{required:!0,email:!0},Password:{required:!0}},submitButtonTag:$("#user-create-submit"),submitUrl:$("#user-create-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Users.Reload()}})},GeneratePassword:function(){$(this).is(":checked")?($("#user-create-form #Password").val($.hood.Helpers.GenerateRandomString(0)),$("#user-create-form #Password").attr("type","text")):($("#user-create-form #Password").val(""),$("#user-create-form #Password").attr("type","password"))}},Edit:{ResetPassword:function(e){e.preventDefault();var o=$(this),s=function(e){return e!==!1&&(""===e?(swal.showInputError("You didn't supply a new password, we can't reset the password without it!"),!1):void $.post(o.attr("href"),{password:e},function(e){$.hood.Helpers.ProcessResponse(e)}))};$.hood.Alerts.Prompt("Please enter a new password for the user...","Reset password",s)},Notes:{Add:function(e){e.preventDefault();var o=$(this),s=function(e){return e===!1||""===e?(swal.showInputError("You enter anything!"),!1):void $.post(o.attr("href"),{note:e},function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Inline.Reload("#user-notes")})};$.hood.Alerts.Prompt("Enter and store a note about this user. These are internal, and are not shown to the user.","Add a note",s,"textarea")},Delete:function(e){e.preventDefault();var o=$(this),s=function(e){e?$.post(o.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Inline.Reload("#user-notes")}):swal("Cancelled","It's all good in the hood!","error")};$.hood.Alerts.Confirm("Are you sure?","The note will be removed permanently.",s)}},ToggleRole:function(){$(this).is(":checked")?$.post($(this).data("url"),{role:$(this).val(),add:!0},function(e){$.hood.Helpers.ProcessResponse(e)}):$.post($(this).data("url"),{role:$(this).val(),add:!1},function(e){$.hood.Helpers.ProcessResponse(e)})}}},$(document).ready($.hood.Users.Init); | ||
"use strict";$.hood||($.hood={}),$.hood.Users={Init:function(){$("body").on("click",".user-delete",$.hood.Users.Delete),$("body").on("click",".user-reset-password",$.hood.Users.Edit.ResetPassword),$("body").on("click",".user-notes-add",$.hood.Users.Edit.Notes.Add),$("body").on("click",".user-notes-delete",$.hood.Users.Edit.Notes.Delete),$("body").on("change","#user-create-form #GeneratePassword",$.hood.Users.Create.GeneratePassword),$("body").on("change",".user-role-check",$.hood.Users.Edit.ToggleRole)},Loaded:function(e,o){$.hood.Loader(!1)},Reload:function(e){$("#user-list").doesExist()&&$.hood.Inline.Reload($("#user-list"),e)},Delete:function(e){e.preventDefault();var o=$(this),s=function(e){e&&$.post(o.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Users.Reload(),e.Success&&o&&o.data("redirect")&&($.hood.Alerts.Success("<strong>User deleted, redirecting...</strong><br />Just taking you back to the user list."),setTimeout(function(){window.location=o.data("redirect")},1500))})};$.hood.Alerts.Confirm("The user will be permanently removed, any site content will be reassigned to the ownership of the site owner, any user content (Forum Topics & Posts) will be deleted from the system and all associated media files.","Are you sure?",s,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong><br />This process will also cancel any active subscriptions.</span>')},Create:{Loaded:function(e){$("#user-create-form").hoodValidator({validationRules:{FirstName:{required:!0},LastName:{required:!0},UserName:{required:!0,email:!0},Password:{required:!0}},submitButtonTag:$("#user-create-submit"),submitUrl:$("#user-create-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Users.Reload()}})},GeneratePassword:function(){$(this).is(":checked")?($("#user-create-form #Password").val($.hood.Helpers.GenerateRandomString(0)),$("#user-create-form #Password").attr("type","text")):($("#user-create-form #Password").val(""),$("#user-create-form #Password").attr("type","password"))}},Edit:{ResetPassword:function(e){e.preventDefault();var o=$(this),s=function(e){return!1!==e&&(""===e?(swal.showInputError("You didn't supply a new password, we can't reset the password without it!"),!1):void $.post(o.attr("href"),{password:e},function(e){$.hood.Helpers.ProcessResponse(e)}))};$.hood.Alerts.Prompt("Please enter a new password for the user...","Reset password",s)},Notes:{Add:function(e){e.preventDefault();var o=$(this),s=function(e){if(!1===e||""===e)return swal.showInputError("You enter anything!"),!1;$.post(o.attr("href"),{note:e},function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Inline.Reload("#user-notes")})};$.hood.Alerts.Prompt("Enter and store a note about this user. These are internal, and are not shown to the user.","Add a note",s,"textarea")},Delete:function(e){e.preventDefault();var o=$(this),s=function(e){e?$.post(o.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Inline.Reload("#user-notes")}):swal("Cancelled","It's all good in the hood!","error")};$.hood.Alerts.Confirm("Are you sure?","The note will be removed permanently.",s)}},ToggleRole:function(){$(this).is(":checked")?$.post($(this).data("url"),{role:$(this).val(),add:!0},function(e){$.hood.Helpers.ProcessResponse(e)}):$.post($(this).data("url"),{role:$(this).val(),add:!1},function(e){$.hood.Helpers.ProcessResponse(e)})}}},$(document).ready($.hood.Users.Init); |
110
js/app.js
@@ -13,6 +13,3 @@ $.window = $(window); | ||
Colorbox: true, | ||
ContactForms: true, | ||
Forums: true, | ||
PaymentPages: true, | ||
RichTextEditors: $('.tinymce-public').length | ||
ContactForms: true | ||
}, | ||
@@ -27,30 +24,15 @@ Init: function (options) { | ||
$.hood.App.Header.Init(); | ||
if ($.hood.App.Options.Header.Sticky) | ||
$.hood.App.Header.Init(); | ||
if ($.hood.App.Options.PaymentPages) | ||
$.hood.App.PaymentPages.Init(); | ||
if ($.hood.App.Options.FitVids) | ||
$.hood.App.ResizeVideos(); | ||
if ($.hood.App.Options.ContactForms) | ||
$.hood.App.ContactForms.Init(); | ||
if ($.hood.App.Options.Alerts) | ||
$.hood.App.Alerts(); | ||
if ($.hood.App.Options.Colorbox) | ||
$.hood.App.Colorbox(); | ||
if ($.hood.App.Options.LoadSharers) | ||
$.hood.App.Sharers(); | ||
if ($.hood.App.Options.RichTextEditors) | ||
$.hood.App.RichTextEditors(); | ||
}, | ||
Ready: function () { | ||
$.hood.App.Init(); | ||
$.hood.App.Resize(); | ||
}, | ||
Load: function () { | ||
}, | ||
Resize: function () { | ||
}, | ||
Header: { | ||
@@ -70,3 +52,3 @@ Init: function () { | ||
let header = $header.height(); | ||
let win = $.window.height() + 2 * header; | ||
let win = $.window.height() + 2 * header; | ||
let doc = $(document).height(); | ||
@@ -141,76 +123,3 @@ if ($.window.scrollTop() > headerOffset && doc > win) { | ||
}, | ||
Forums: { | ||
Init: function () { | ||
// check for highlight. | ||
var highlight = $.getUrlVars()['highlight']; | ||
if ($.isNumeric(highlight)) { | ||
let $post = $('#post-' + highlight); | ||
$('html,body').animate({ scrollTop: $post.offset().top }, 'slow'); | ||
$post.addClass('highlight'); | ||
if ($.getUrlVars()['message'] === "Created") | ||
$post.addClass('created'); | ||
} | ||
var reply = $.getUrlVars()['reply']; | ||
if ($.isNumeric(reply)) { | ||
let $post = $('#forum-post-form'); | ||
$('html,body').animate({ scrollTop: $post.offset().top }, 'slow'); | ||
} | ||
// toggle editors | ||
$('.forum').on('click', '.edit-post', function (e) { | ||
$(this).parents('.post').find('.post-view').slideToggle(); | ||
$(this).parents('.post').find('.edit-view').slideToggle(); | ||
}); | ||
} | ||
}, | ||
ResizeVideos: function () { | ||
if (!$().fitVids) { | ||
console.log('resizeVideos: FitVids not Defined.'); | ||
return true; | ||
} | ||
$("body").fitVids({ | ||
customSelector: "iframe[src^='http://www.dailymotion.com/embed'], iframe[src*='maps.google.com'], iframe[src*='google.com/maps']", | ||
ignore: '.no-fv' | ||
}); | ||
}, | ||
PaymentPages: { | ||
Init: function () { | ||
$('body').on('click', '.btn.price-select[data-target][data-value]', $.hood.App.PaymentPages.PriceSelect); | ||
$('body').on('click', '.change-price-option', $.hood.App.PaymentPages.ChangePrice); | ||
}, | ||
ChangePrice: function () { | ||
$('#price-panel').collapse('show'); | ||
$('#billing-panel').collapse('hide'); | ||
$('#confirm-panel').collapse('hide'); | ||
}, | ||
PriceSelect: function () { | ||
var $this = $(this); | ||
targetId = '#' + $this.data('target'); | ||
$(targetId).val($this.data('value')); | ||
$(".selected-price-text").html($(targetId).find(":selected").text()); | ||
$('.price-select[data-target="' + $this.data('target') + '"]').each(function () { $(this).html($(this).data('temp')).removeClass('active'); }); | ||
$('.price-select[data-target="' + $this.data('target') + '"][data-value="' + $this.data('value') + '"]').each(function () { $(this).data('temp', $(this).html()).html('Selected').addClass('active') });; | ||
$('#price-panel').collapse('hide'); | ||
$('#billing-panel').collapse('show'); | ||
$('#confirm-panel').collapse('hide'); | ||
} | ||
}, | ||
RichTextEditors: function () { | ||
tinymce.init({ | ||
selector: '.tinymce-public', | ||
height: 250, | ||
plugins: [ | ||
'advlist autolink lists link image charmap print preview anchor media', | ||
'searchreplace visualblocks code fullscreen', | ||
'insertdatetime media contextmenu paste emoticons' | ||
], | ||
menubar: false, | ||
toolbar: 'styleselect | bold italic | bullist numlist outdent indent | undo redo | link image media emoticons', | ||
image_dimensions: false, | ||
body_class: 'tiny-mce-body', | ||
content_css: '/css/site.css' | ||
}); | ||
}, | ||
Property: { | ||
@@ -227,6 +136,1 @@ Loaded: function (data) { | ||
}; | ||
// Initialise | ||
$(function () { $.hood.App.Ready(); }); | ||
$(window).on('load', $.hood.App.Load); | ||
$(window).on('resize', $.hood.App.Resize); |
@@ -1,1 +0,1 @@ | ||
"use strict";$.window=$(window),$.hood||($.hood={}),$.hood.App={Options:{Header:{Target:"#header",Sticky:!0,StickyClass:"sticky-header"},Alerts:!0,Colorbox:!0,ContactForms:!0,Forums:!0,PaymentPages:!0,RichTextEditors:$(".tinymce-public").length},Init:function(o){$.hood.App.Options=$.extend($.hood.App.Options,o||{}),o&&o.Header&&($.hood.App.Options.Header=$.extend($.hood.App.Options.Header,o.Header||{})),$.hood.App.Header.Init(),$.hood.App.Options.PaymentPages&&$.hood.App.PaymentPages.Init(),$.hood.App.Options.FitVids&&$.hood.App.ResizeVideos(),$.hood.App.Options.ContactForms&&$.hood.App.ContactForms.Init(),$.hood.App.Options.Colorbox&&$.hood.App.Colorbox(),$.hood.App.Options.LoadSharers&&$.hood.App.Sharers(),$.hood.App.Options.RichTextEditors&&$.hood.App.RichTextEditors()},Ready:function(){$.hood.App.Init(),$.hood.App.Resize()},Load:function(){},Resize:function(){},Header:{Init:function(){$.hood.App.Options.Header.Sticky&&($.hood.App.Header.StickyMenu(),$.window.on("scroll",function(){$.hood.App.Header.StickyMenu()}))},StickyMenu:function(){var o=0,e=$($.hood.App.Options.Header.Target);e.length>0&&(o=e.offset().top);var t=e.height(),i=$.window.height()+2*t,a=$(document).height();$.window.scrollTop()>o&&a>i?e.addClass($.hood.App.Options.Header.StickyClass):$.hood.App.Header.RemoveStickyness()},RemoveStickyness:function(){var o=$($.hood.App.Options.Header.Target);o.hasClass($.hood.App.Options.Header.StickyClass)&&o.removeClass($.hood.App.Options.Header.StickyClass)}},ContactForms:{Init:function(){$(".contact-form .thank-you").hide(),$(".contact-form .form-submit").show(),$("body").on("submit",".contact-form",function(o){return o.preventDefault(),$(this).addClass("loading"),$.hood.App.ContactForms.Submit(this),!1})},Submit:function(o){var e=$(o);return e.valid()&&$.post(e.attr("action"),e.serialize(),function(o){o.Success?(e.attr("data-redirect")&&(window.location=e.attr("data-redirect")),e.attr("data-alert-message")&&$.hood.Alerts.Success(e.attr("data-alert-message"),"Success",null,!0),e.find(".form").hide(),e.find(".thank-you").show()):e.attr("data-alert-error")?$.hood.Alerts.Error(e.attr("data-alert-error"),"Error",null,!0):$.hood.Alerts.Error("There was an error sending the message: "+o.Errors,"Error",null,!0),e.removeClass("loading")}),!1}},Alerts:function(){$(".alert.auto-dismiss").fadeTo(5e3,500).slideUp(500,function(){$(".alert.auto-dismiss").slideUp(500)})},Colorbox:function(){$(".colorbox").colorbox({rel:"gallery",maxWidth:"95%",maxHeight:"95%"}),$(".colorbox-iframe").colorbox({iframe:!0,maxWidth:"95%",maxHeight:"95%",innerWidth:640,innerHeight:390})},Forums:{Init:function(){var o=$.getUrlVars().highlight;if($.isNumeric(o)){var e=$("#post-"+o);$("html,body").animate({scrollTop:e.offset().top},"slow"),e.addClass("highlight"),"Created"===$.getUrlVars().message&&e.addClass("created")}var t=$.getUrlVars().reply;if($.isNumeric(t)){var i=$("#forum-post-form");$("html,body").animate({scrollTop:i.offset().top},"slow")}$(".forum").on("click",".edit-post",function(o){$(this).parents(".post").find(".post-view").slideToggle(),$(this).parents(".post").find(".edit-view").slideToggle()})}},ResizeVideos:function(){return $().fitVids?void $("body").fitVids({customSelector:"iframe[src^='http://www.dailymotion.com/embed'], iframe[src*='maps.google.com'], iframe[src*='google.com/maps']",ignore:".no-fv"}):(console.log("resizeVideos: FitVids not Defined."),!0)},PaymentPages:{Init:function(){$("body").on("click",".btn.price-select[data-target][data-value]",$.hood.App.PaymentPages.PriceSelect),$("body").on("click",".change-price-option",$.hood.App.PaymentPages.ChangePrice)},ChangePrice:function(){$("#price-panel").collapse("show"),$("#billing-panel").collapse("hide"),$("#confirm-panel").collapse("hide")},PriceSelect:function(){var o=$(this);targetId="#"+o.data("target"),$(targetId).val(o.data("value")),$(".selected-price-text").html($(targetId).find(":selected").text()),$('.price-select[data-target="'+o.data("target")+'"]').each(function(){$(this).html($(this).data("temp")).removeClass("active")}),$('.price-select[data-target="'+o.data("target")+'"][data-value="'+o.data("value")+'"]').each(function(){$(this).data("temp",$(this).html()).html("Selected").addClass("active")}),$("#price-panel").collapse("hide"),$("#billing-panel").collapse("show"),$("#confirm-panel").collapse("hide")}},RichTextEditors:function(){tinymce.init({selector:".tinymce-public",height:250,plugins:["advlist autolink lists link image charmap print preview anchor media","searchreplace visualblocks code fullscreen","insertdatetime media contextmenu paste emoticons"],menubar:!1,toolbar:"styleselect | bold italic | bullist numlist outdent indent | undo redo | link image media emoticons",image_dimensions:!1,body_class:"tiny-mce-body",content_css:"/css/site.css"})},Property:{Loaded:function(o){$.hood.Loader(!1),$.hood.Google.ClusteredMap()},Reload:function(o){$("#property-list").doesExist()&&$.hood.Inline.Reload($("#property-list"),o)}}},$(function(){$.hood.App.Ready()}),$(window).on("load",$.hood.App.Load),$(window).on("resize",$.hood.App.Resize); | ||
"use strict";$.window=$(window),$.hood||($.hood={}),$.hood.App={Options:{Header:{Target:"#header",Sticky:!0,StickyClass:"sticky-header"},Alerts:!0,Colorbox:!0,ContactForms:!0},Init:function(o){$.hood.App.Options=$.extend($.hood.App.Options,o||{}),o&&o.Header&&($.hood.App.Options.Header=$.extend($.hood.App.Options.Header,o.Header||{})),$.hood.App.Options.Header.Sticky&&$.hood.App.Header.Init(),$.hood.App.Options.ContactForms&&$.hood.App.ContactForms.Init(),$.hood.App.Options.Alerts&&$.hood.App.Alerts(),$.hood.App.Options.Colorbox&&$.hood.App.Colorbox()},Header:{Init:function(){$.hood.App.Options.Header.Sticky&&($.hood.App.Header.StickyMenu(),$.window.on("scroll",function(){$.hood.App.Header.StickyMenu()}))},StickyMenu:function(){var o=0,t=$($.hood.App.Options.Header.Target);t.length>0&&(o=t.offset().top);var e=t.height(),r=$.window.height()+2*e,a=$(document).height();$.window.scrollTop()>o&&a>r?t.addClass($.hood.App.Options.Header.StickyClass):$.hood.App.Header.RemoveStickyness()},RemoveStickyness:function(){var o=$($.hood.App.Options.Header.Target);o.hasClass($.hood.App.Options.Header.StickyClass)&&o.removeClass($.hood.App.Options.Header.StickyClass)}},ContactForms:{Init:function(){$(".contact-form .thank-you").hide(),$(".contact-form .form-submit").show(),$("body").on("submit",".contact-form",function(o){return o.preventDefault(),$(this).addClass("loading"),$.hood.App.ContactForms.Submit(this),!1})},Submit:function(o){var t=$(o);return t.valid()&&$.post(t.attr("action"),t.serialize(),function(o){o.Success?(t.attr("data-redirect")&&(window.location=t.attr("data-redirect")),t.attr("data-alert-message")&&$.hood.Alerts.Success(t.attr("data-alert-message"),"Success",null,!0),t.find(".form").hide(),t.find(".thank-you").show()):t.attr("data-alert-error")?$.hood.Alerts.Error(t.attr("data-alert-error"),"Error",null,!0):$.hood.Alerts.Error("There was an error sending the message: "+o.Errors,"Error",null,!0),t.removeClass("loading")}),!1}},Alerts:function(){$(".alert.auto-dismiss").fadeTo(5e3,500).slideUp(500,function(){$(".alert.auto-dismiss").slideUp(500)})},Colorbox:function(){$(".colorbox").colorbox({rel:"gallery",maxWidth:"95%",maxHeight:"95%"}),$(".colorbox-iframe").colorbox({iframe:!0,maxWidth:"95%",maxHeight:"95%",innerWidth:640,innerHeight:390})},Property:{Loaded:function(o){$.hood.Loader(!1),$.hood.Google.ClusteredMap()},Reload:function(o){$("#property-list").doesExist()&&$.hood.Inline.Reload($("#property-list"),o)}}}; |
@@ -1,2 +0,2 @@ | ||
"use strict";var console={};console.log=function(){},window.console=console,$.hood||($.hood={}),$.body=$("body");var console=window.console||{};console.log=console.log||function(){},console.warn=console.warn||function(){},console.error=console.error||function(){},console.info=console.info||function(){},$.fn.exists=function(){return $(this).length},$.fn.doesExist=function(){return $(this).length},$.fn.restrictToSlug=function(e){var t=$(this),o=e||/[^0-9a-zA-Z]*/g,n=function(){var e=$(this).val(),t=e.replace(o,"");e!==t&&$(this).val(t)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".restrict-to-slug").restrictToSlug(),$.fn.restrictToPageSlug=function(e){var t=$(this),o=e||/[^0-9a-zA-Z-//]*/g,n=function(){var e=$(this).val(),t=e.replace(o,"");if((t.match(new RegExp("/","g"))||[]).length>4){var n=t.lastIndexOf("/");t=t.substring(0,n)+t.substring(n+1),$.hood.Alerts.Warning("You can only have up to 4 '/' characters in a url slug.")}e!==t&&$(this).val(t)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".restrict-to-page-slug").restrictToPageSlug(),$.fn.restrictToMetaSlug=function(e){var t=$(this),o=e||/[^0-9a-zA-Z.]*/g,n=function(){var e=$(this).val(),t=e.replace(o,"");if((t.match(new RegExp(".","g"))||[]).length>1){var n=t.lastIndexOf(".");t=t.substring(0,n)+t.substring(n+1),$.hood.Alerts.Warning("You can only have up to 1 '.' characters in a meta slug.")}e!==t&&$(this).val(t)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".restrict-to-meta-slug").restrictToMetaSlug(),$.fn.characterCounter=function(e){var t=$(this),o=function(){var e=$(this).data("counter"),t=Number($(this).attr("maxlength")),o=$(this).val().length;$(e).text(t-o);var n="text-success";t-o<t/10&&(n="text-danger"),$(e).parent().removeClass("text-success").removeClass("text-danger").addClass(n)};t.on("keyup",o),t.on("paste",o),t.on("change",o)},$(".character-counter").characterCounter(),$(".character-counter").trigger("change"),$.fn.addLoader=function(){$(this).data("loadercontent",$(this).html()),$(this).addClass("loading").append('<i class="fa fa-refresh fa-spin m-l-sm"></i>')},$.fn.removeLoader=function(){$(this).empty().html($(this).data("loadercontent")),$(this).removeClass("loading")},$.fn.warningAlert=function(){var e=$(this),t=function(e){e.preventDefault();var t=function(t){if(t){var o=$(e.currentTarget).attr("href");window.location=o}};return $.hood.Alerts.Confirm($(e.currentTarget).data("warning"),$(e.currentTarget).data("title"),t,"warning",$(e.currentTarget).data("footer"),"Ok","Cancel"),!1};e.on("click",t)},$(".warning-alert").warningAlert(),$.commonHeight=function(e,t){var o=0;e.children(t).each(function(){var e=$(this).children();e.hasClass("max-height")?o=e.outerHeight():e.outerHeight()>o&&(o=e.outerHeight())}),e.children(t).each(function(){$(this).height(o)})},$.loadCss=function(e,t){$("link#"+e).length||$("<link/>",{id:e,rel:"stylesheet",type:"text/css",href:t}).appendTo("head")},$.getUrlVars=function(){for(var e,t=[],o=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),n=0;n<o.length;n++)e=o[n].split("="),t.push(e[0]),t[e[0]]=e[1];return t},$.decodeUrl=function(e){return decodeURIComponent(e).replace("+"," ")},$.numberWithCommas=function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},$.validator&&($.validator.addMethod("time",function(e,t){return this.optional(t)||/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$/i.test(e)},"Please enter a valid time."),$.validator.addMethod("ukdate",function(e,t){return e.match(/^\d\d?\/\d\d?\/\d\d\d\d$/)},"Please enter a date in the format dd/mm/yyyy.")),$.mobile={Android:function(){return navigator.userAgent.match(/Android/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)},Any:function(){return $.mobile.Android()||$.mobile.BlackBerry()||$.mobile.iOS()||$.mobile.Opera()||$.mobile.Windows()}},$.mobile.Android?$.mobile.BlackBerry?$.mobile.iOS?$.mobile.Opera?$.mobile.Windows?($.body.addClass("desktop-device"),$.device="desktop"):($.body.addClass("windows-device"),$.device="windows"):($.body.addClass("opera-device"),$.device="opera"):($.body.addClass("ios-device"),$.device="ios"):($.body.addClass("blackberry-device"),$.device="blackberry"):($.body.addClass("android-device"),$.device="android"),function(){var e={password:"0",username:"0"};$("body").on("change",".prevent-autocomplete",function(t){var o=$(this).attr("id");"0"!==e[o]&&e[o]===$(this).val()||$(this).val("")}),$("body").on("keyup",".prevent-autocomplete",function(t){var o=$(this).attr("id");e[o]=$(this).val()})}(),function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),o}return"function"!=typeof window.CustomEvent&&(e.prototype=window.Event.prototype,void(window.CustomEvent=e))}(),$.hood.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"}],$.hood.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"}],new CustomEvent("loader-show"),new CustomEvent("loader-hide"),$.hood.Loader=function(e){e?$("body").trigger("loader-show"):$("body").trigger("loader-hide")},$.hood||($.hood={}),$.hood.Helpers={IsNullOrUndefined:function(e){var t=!1;return null!==e&&"undefined"!=typeof e&&""!==e||(t=!0),t},IsSet:function(e){var t=!1;return null!==e&&"undefined"!=typeof e&&""!==e||(t=!0),!t},IsEventSupported:function(e){var t=document.createElement("div");e="on"+e;var o=e in t;return o||(t.setAttribute(e,"return;"),o="function"==typeof t[e]),t=null,o},IsFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},IsUrlExternal:function(e){var t=e.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);return"string"==typeof t[1]&&t[1].length>0&&t[1].toLowerCase()!==location.protocol||"string"==typeof t[2]&&t[2].length>0&&t[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host},IsInIframe:function(){try{return window.self!==window.top}catch(e){return!0}},HtmlEncode:function(e){return $("<div/>").text(e).html()},HtmlDecode:function(e){return $("<div/>").html(e).text()},FormatCurrency:function(e,t){return t+" "+e.toFixed(2).replace(/./g,function(e,t,o){return t>0&&"."!==e&&(o.length-t)%3===0?","+e:e})},FormatKilobytes:function(e){return e/=1024,e.toFixed(2).replace(/./g,function(e,t,o){return t>0&&"."!==e&&(o.length-t)%3===0?","+e:e})},FormatMegabytes:function(e){return e/=1024,e/=1024,currency+" "+e.toFixed(2).replace(/./g,function(e,t,o){return t>0&&"."!==e&&(o.length-t)%3===0?","+e:e})},FallbackCopyTextToClipboard:function(e){var t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch(e){console.error("Oops, unable to copy",e)}document.body.removeChild(t)},CopyTextToClipboard:function(e){return navigator.clipboard?void navigator.clipboard.writeText(e).then(function(){},function(e){console.error("Could not copy text: ",e)}):void $.hood.Handlers.FallbackCopyTextToClipboard(e)},ProcessResponse:function(e){var t="";e.Title&&(t="<strong>".concat(e.Title,"</strong><br />")),e.Success?$.hood.Alerts.Success("".concat(t).concat(e.Message)):$.hood.Alerts.Error("".concat(t).concat(e.Errors))},GetQueryStringParamByName:function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)","i"),o=t.exec(location.search);return null===o?"":decodeURIComponent(o[1].replace(/\+/g," "))},InsertQueryStringParam:function(e,t){e=escape(e),t=escape(t);var o=document.location.search.substr(1).split("&");if(""===o)document.location.search="?"+e+"="+t;else{for(var n,a=o.length;a--;)if(n=o[a].split("="),n[0]===e){n[1]=t,o[a]=n.join("=");break}a<0&&(o[o.length]=[e,t].join("=")),document.location.search=o.join("&")}},InsertQueryStringParamToUrl:function(e,t,o){t=escape(t),o=escape(o);var n=e.search.substr(1).split("&");if(""===n)e.search="?"+t+"="+o;else{for(var a,i=n.length;i--;)if(a=n[i].split("="),a[0]===t){a[1]=o,n[i]=a.join("=");break}i<0&&(n[n.length]=[t,o].join("=")),e.search=n.join("&")}return e},UrlToLocationObject:function(e){var t=document.createElement("a");return t.href=e,t},FindAndRemoveFromArray:function(e,t,o){$.each(e,function(n,a){a[t]===o&&e.splice(n,1)})},FindAndReturnFromArray:function(e,t,o){var n=null;return $.each(e,function(e,a){a[t]===o&&(n=a)}),n},LeftPad:function(e,t){for(var o=e+"";o.length<t;)o="0"+o;return o},DateAdd:function(e,t,o){var n=new Date(e);switch(t.toLowerCase()){case"year":n.setFullYear(n.getFullYear()+o);break;case"quarter":n.setMonth(n.getMonth()+3*o);break;case"month":n.setMonth(n.getMonth()+o);break;case"week":n.setDate(n.getDate()+7*o);break;case"day":n.setDate(n.getDate()+o);break;case"hour":n.setTime(n.getTime()+36e5*o);break;case"minute":n.setTime(n.getTime()+6e4*o);break;case"second":n.setTime(n.getTime()+1e3*o);break;default:n=void 0}return n},GenerateRandomString:function(e){var t="!@#$&*",o="abcdefghijklmnopqrstuvwxyz",n="ABCDEFGHIJKLMNOPQRSTUVWXYZ",a="0123456789",i=o+n+a,r=(t.pick(1)+o.pick(1)+n.pick(1)+i.pick(5,10)).shuffle();return r}},$.hood||($.hood={}),$.hood.Handlers={Init:function(){$("body").on("click",".select-text",$.hood.Handlers.SelectTextContent),$("body").on("click",".btn.click-select[data-target][data-value]",$.hood.Handlers.ClickSelect),$("body").on("click",".click-select.show-selected[data-target][data-value]",$.hood.Handlers.ClickSelect),$("body").on("click",".click-select:not(.show-selected)[data-target][data-value]",$.hood.Handlers.ClickSelectClean),$("body").on("click",".slide-link",$.hood.Handlers.SlideToAnchor),$("body").on("click",".scroll-target, .scroll-to-target",$.hood.Handlers.ScrollToTarget),$("body").on("click",".scroll-top, .scroll-to-top",$.hood.Handlers.ScrollToTop),$("body").on("change","input[type=checkbox][data-input]",$.hood.Handlers.CheckboxChange),$("body").on("change",".submit-on-change",$.hood.Handlers.SubmitOnChange),$("select[data-selected]").each($.hood.Handlers.SelectSetup),$("body").on("change",".inline-date",$.hood.Handlers.DateChange),$.hood.Handlers.Uploaders.Init(),$.hood.Handlers.ColorPickers()},ScrollToTop:function(e){return e&&e.preventDefault(),$("html, body").animate({scrollTop:0},800),!1},ScrollToTarget:function(e){e&&e.preventDefault();var t=$(this).attr("href").split("#")[0];if(t===window.location.pathname||""===t){var o=this.hash,n=$(o),a=$("header.header"),i=0;a&&(i=a.height()),$(this).data("offset")?$("html, body").stop().animate({scrollTop:n.offset().top-$(this).data("offset")},900,"swing"):$("html, body").stop().animate({scrollTop:n.offset().top-i},900,"swing")}},SubmitOnChange:function(e){e&&e.preventDefault(),$(this).parents("form").submit()},DateChange:function(e){e&&e.preventDefault();var t=$(this).parents(".hood-date").find(".date-output"),o=t.parents(".hood-date").find(".date-value").val(),n=/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/;n.test(o)||(o="01/01/2001");var a=t.parents(".hood-date").find(".hour-value").val();$.isNumeric(a)||(a="00");var i=t.parents(".hood-date").find(".minute-value").val();$.isNumeric(i)||(i="00"),t.val(o+" "+a+":"+i+":00"),t.attr("value",o+" "+a+":"+i+":00")},CheckboxChange:function(e){e&&e.preventDefault();var t=new Array;$('input[data-input="'+$(this).data("input")+'"]').each(function(){$(this).is(":checked")&&t.push($(this).val())});var o="#"+$(this).data("input"),n=JSON.stringify(t);$(o).val(n)},SelectSetup:function(){$(this).data("selected");if("undefined"!==$(this).data("selected")&&""!==$(this).data("selected")){var e=String($(this).data("selected"));$(this).val(e)}},ClickSelect:function(){var e=$(this),t="#"+e.data("target");$(t).val(e.data("value")),$(t).trigger("change"),$('.click-select[data-target="'+e.data("target")+'"]').each(function(){$(this).html($(this).data("temp")).removeClass("active")}),$('.click-select[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).data("temp",$(this).html()).html("Selected").addClass("active")})},ClickSelectClean:function(){var e=$(this),t="#"+e.data("target");$(t).val(e.data("value")),$(t).trigger("change"),$('.click-select.clean[data-target="'+e.data("target")+'"]').each(function(){$(this).removeClass("active")}),$('.click-select.clean[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).addClass("active")})},SelectTextContent:function(){var e=$(this);e.select(),e.mouseup(function(){return e.unbind("mouseup"),!1})},SlideToAnchor:function(){var e=$("body").scrollTop(),t=$($.attr(this,"href")).offset().top;return $("html, body").animate({scrollTop:t},Math.abs(t-e)),!1},Uploaders:{Init:function(){($(".image-uploader").length||$(".gallery-uploader").length)&&($(".upload-progress-bar").hide(),$.getScript("/lib/dropzone/min/dropzone.min.js",$.proxy(function(){$(".image-uploader").each(function(){$.hood.Handlers.Uploaders.SingleImage($(this).attr("id"),$(this).data("json"))}),$(".gallery-uploader").each(function(){$.hood.Handlers.Uploaders.Gallery($(this).attr("id"),$(this).data("json"))})},this)))},RefreshImage:function(e,t){$(e.data("preview")).css({"background-image":"url("+t.Media.SmallUrl+")"}),$(e.data("preview")).find("img").attr("src",t.Media.SmallUrl)},SingleImage:function(e,t){e="#"+e;$(e);Dropzone.autoDiscover=!1;var o=new Dropzone(e,{url:$(e).data("url"),maxFiles:1,paramName:"file",parallelUploads:1,acceptedFiles:$(e).data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:!1,clickable:e});o.on("addedfile",function(){}),o.on("totaluploadprogress",function(t){$(".upload-progress-bar."+e.replace("#","")+" .progress-bar").css({width:t+"%"})}),o.on("sending",function(t){$(".upload-progress-bar."+e.replace("#","")).show(),$($(e).data("preview")).addClass("loading")}),o.on("queuecomplete",function(t){$(".upload-progress-bar."+e.replace("#","")).hide()}),o.on("success",function(n,a){a.Success?(a.Media&&($(t).val(JSON.stringify(a.Media)),$($(e).data("preview")).css({"background-image":"url("+a.Media.SmallUrl+")"}),$($(e).data("preview")).find("img").attr("src",a.Media.SmallUrl)),$.hood.Alerts.Success("New image added!")):$.hood.Alerts.Error("There was a problem adding the image: "+a.Error),o.removeFile(n),$($(e).data("preview")).removeClass("loading")})},Gallery:function(e){Dropzone.autoDiscover=!1;var t=document.querySelector(e+"-template");t.id="";var o=t.parentNode.innerHTML;t.parentNode.removeChild(t);var n=new Dropzone(e,{url:$(e).data("url"),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:o,paramName:"files",acceptedFiles:$(e).data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:"#previews",clickable:".fileinput-button",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!"});$(e+" .cancel").hide(),n.on("addedfile",function(t){$(t.previewElement.querySelector(".complete")).hide(),$(t.previewElement.querySelector(".cancel")).show(),$(e+" .cancel").show()}),n.on("totaluploadprogress",function(e){document.querySelector("#total-progress .progress-bar").style.width=e+"%"}),n.on("sending",function(e){document.querySelector("#total-progress").style.opacity="1"}),n.on("complete",function(e){$(e.previewElement.querySelector(".cancel")).hide(),$(e.previewElement.querySelector(".progress")).hide(),$(e.previewElement.querySelector(".complete")).show(),$.hood.Inline.Refresh(".gallery")}),n.on("queuecomplete",function(t){document.querySelector("#total-progress").style.opacity="0",$(e+" .cancel").hide()}),n.on("success",function(e,t){$.hood.Inline.Refresh(".gallery"),t.Success?$.hood.Alerts.Success("New images added!"):$.hood.Alerts.Error("There was a problem adding the profile image: "+t.Error)}),document.querySelector(".actions .cancel").onclick=function(){n.removeAllFiles(!0)}}},ColorPickers:function(){var e=function(e,t){var o=$(t._root.button).parent().data("target");$(t._root.button).css({"background-color":e.toHEXA().toString()});for(var n=t.getColor().toHEXA(),a="",i=n.length-1;i>=0;i--)a=n[i]+a;$(o).val("#"+a)},t=[];$(".color-picker").each(function(o,n){var a=!0;"true"==$(this).data("opacity")&&(a=!1);var i=Pickr.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 o=$(t._root.button).parent().data("target"),n=$(o).val();$(o).on("click",$.proxy(function(){this.show()},t)),n&&(t.setColor(n),e(t.getColor(),t))}).on("clear",function(t){var o=$(t._root.button).parent().data("target");t.setColor("transparent"),e(t.getColor(),t),$(o).val("")}).on("change",e);t.push(i)})}},$(document).ready($.hood.Handlers.Init),String.prototype.contains=function(e){return this.indexOf(e)!==-1},String.prototype.pick=function(e,t){var o,n="";o="undefined"==typeof t?e:e+Math.floor(Math.random()*(t-e));for(var a=0;a<o;a++)n+=this.charAt(Math.floor(Math.random()*this.length));return n},String.prototype.shuffle=function(){var e,t,o=this.split(""),n=o.length;if(n)for(;--n;)t=Math.floor(Math.random()*(n+1)),e=o[t],o[t]=o[n],o[n]=e;return o.join("")},String.prototype.toSeoUrl=function(){var e=this.replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g,"-").toLowerCase();"-"===e.charAt(0)&&(e=e.substring(1));var t=e.length-1;return"-"===e.charAt(t)&&(e=e.substring(0,t)),e},$.hood||($.hood={}),$.hood.FormValidator=function(e,t){this.Options=$.extend({formTag:e,validationRules:null,validationMessages:{},placeBelow:!0,submitButtonTag:null,submitUrl:null,submitFunction:null,serializationFunction:function(){var e=$(this.formTag).serialize();return e}},t||{}),this.LoadValidation=function(){$.hood.Helpers.IsNullOrUndefined(this.Options.formTag)||($(this.Options.formTag).find("input, textarea, select").keypress($.proxy(function(e){if(13===e.which)return $.proxy(this.submitForm(),this),e.preventDefault(),!1},this)),$(this.Options.formTag).validate({submitHandler:function(e){e.preventDefault()},errorClass:this.Options.errorClass,focusInvalid:!1,rules:this.Options.validationRules,messages:this.Options.validationMessages}),$.hood.Helpers.IsNullOrUndefined(this.Options.submitButtonTag)||$(this.Options.submitButtonTag).click($.proxy(this.submitForm,this)))},this.submitForm=function(){$(this.Options.formTag).valid()&&(this.TempButtonContent=$(this.Options.submitButtonTag).removeClass("btn-primary").addClass("btn-default").html(),$(this.Options.submitButtonTag).removeClass("btn-primary").addClass("btn-default").html('<i class="fa fa-refresh fa-spin"></i> Loading...'),$(this.Options.formTag).find("input[type=checkbox]").each(function(){$(this).is(":checked")&&$(this).val("true")}),$.post(this.Options.submitUrl,this.Options.serializationFunction(),$.proxy(function(e){$(this.Options.submitButtonTag).removeClass("btn-default").addClass("btn-primary").html(this.TempButtonContent),this.Options.submitFunction(e)},this)))},this.LoadValidation(),this.Options.placeBelow&&$(this.Options.formTag).addClass("validation-below")},$.fn.hoodValidator=function(e){return this.each(function(){var t=$(this);if(!t.data("hoodValidator")){var o=new $.hood.FormValidator(this,e);t.data("hoodValidator",o)}})},$.hood||($.hood={}),$.hood.Addresses={Init:function(){$("body").on("click",".address-set-billing",$.hood.Addresses.SetBilling),$("body").on("click",".address-set-delivery",$.hood.Addresses.SetDelivery),$("body").on("click",".address-delete",$.hood.Addresses.Delete)},Lists:{Address:{Loaded:function(e){$.hood.Loader(!1)},Reload:function(e){$("#address-list").doesExist()&&$.hood.Inline.Reload($("#address-list"),e)}}},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload(),e.Success&&t&&t.data("redirect")&&($.hood.Alerts.Success("<strong>Address deleted, redirecting...</strong><br />Just taking you back to the address list."),setTimeout(function(){window.location=t.data("redirect")},1500))})};$.hood.Alerts.Confirm("The address will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong></span>')},CreateOrEdit:function(){$.hood.Google.Addresses.InitAutocomplete(),$("#address-form").hoodValidator({validationRules:{Number:{required:!0},Address1:{required:!0},City:{required:!0},County:{required:!0},Postcode:{required:!0},Country:{required:!0}},submitButtonTag:$("#address-form-submit"),submitUrl:$("#address-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload(),e.Success&&$.hood.Inline.CloseModal()}})},SetBilling:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload()})};$.hood.Alerts.Confirm("The current billing address will be overwritten.","Are you sure?",o,"error")},SetDelivery:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload()})};$.hood.Alerts.Confirm("The current delivery address will be overwritten.","Are you sure?",o,"error")}},$(document).ready($.hood.Addresses.Init);var swalWithBootstrapButtons=Swal.mixin({customClass:{confirmButton:"btn btn-success btn-lg m-1 pl-4 pr-4",cancelButton:"btn btn-danger btn-lg m-1"},buttonsStyling:!1}),Toast=Swal.mixin({toast:!0,position:"top-end",showConfirmButton:!0});$.hood||($.hood={}),$.hood.Alerts={Error:function(e,t,o,n,a,i,r){o===!0?this.SweetAlert(e,t,"error",n,a,i,r):this.Alert(e,t,"error")},Warning:function(e,t,o,n,a,i,r){o===!0?this.SweetAlert(e,t,"warning",n,a,i,r):this.Alert(e,t,"warning")},Message:function(e,t,o,n,a,i,r){o===!0?this.SweetAlert(e,t,"info",n,a,i,r):this.Alert(e,t,"info")},Success:function(e,t,o,n,a,i,r){o===!0?this.SweetAlert(e,t,"success",n,a,i,r):this.Alert(e,t,"success")},Alert:function(e,t,o){Toast.fire({type:o||"info",html:e,title:t})},SweetAlert:function(e,t,o,n,a,i,r){swalWithBootstrapButtons.fire({title:t,html:e,type:o||"info",footer:n,showConfirmButton:a,timer:i}).then(function(e){e.dismiss||r(e)})},Confirm:function(e,t,o,n,a,i,r){swalWithBootstrapButtons.fire({title:t||"Woah!",html:e||"Are you sure you want to do this?",type:n||"warning",footer:a||'<span class="text-warning"><i class="fa fa-exclamation-triangle"></i> This cannot be undone.</span>',showCancelButton:!0,confirmButtonText:i||"Ok",cancelButtonText:r||"Cancel"}).then(function(e){e.dismiss||o(e.value)})},Prompt:function(e,t,o,n,a,i,r,s,l){swalWithBootstrapButtons.fire({input:n||"text",inputAttributes:l||{autocapitalize:"off"},title:t||"Enter a value",html:e||"Fill in the field and press Ok to continue.",type:a||"info",footer:i,showCancelButton:!0,confirmButtonText:r||"Ok",cancelButtonText:s||"Cancel"}).then(function(e){e.dismiss||o(e.value)})}},$.hood||($.hood={}),$.hood.Forms={Init:function(){$(".floating-label > label").each(function(){var e=$(this);e.parent().append(e)})},GetAllowedExtensions:function(e){switch(e){case"Image":return["png","jpg","jpeg","bmp","gif"];case"Document":return["doc","docx","pdf","rtf"];case"All":return""}},GetAllowedFiles:function(e){switch(e){case"Image":return"image/png,jpg,image/jpeg,image/gif";case"Document":return"application/msword,application/pdf,text/rtf";case"All":return""}}},$(document).ready($.hood.Forms.Init),$.hood||($.hood={}),$.hood.Inline={Tags:{},Init:function(){$(".hood-inline:not(.refresh)").each($.hood.Inline.Load),$("body").on("click",".hood-inline-task",$.hood.Inline.Task),$("body").on("click",".hood-modal",function(e){e.preventDefault(),$.hood.Inline.Modal($(this).attr("href"),$(this).data("complete"),$(this).data("close"))}),$.hood.Inline.DataList.Init()},Refresh:function(e){$(e||".hood-inline").each($.hood.Inline.Load)},Load:function(){$.hood.Inline.Reload(this)},Reload:function(e,t){var o=$(e);o.addClass("loading"),t||(t=o.data("complete"));var n=o.data("url");$.get(n,$.proxy(function(e){o.html(e),o.removeClass("loading"),t&&$.hood.Inline.RunComplete(t,o,e)},o)).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},CurrentModal:null,Modal:function(e,t){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];$.hood.Inline.CurrentModal&&o&&$.hood.Inline.CloseModal(),$.get(e,function(e){var o="#"+$(e).attr("id");$(e).addClass("hood-inline-modal"),$(o).length&&$(o).remove(),$("body").append(e),$.hood.Inline.CurrentModal=$(o),$(o).modal(),$(o).on("shown.bs.modal",function(){$(document).off("focusin.modal")}),$(o).on("hidden.bs.modal",function(e){$(this).remove()}),t&&$.hood.Inline.RunComplete(t,$(o),e)}).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},CloseModal:function(){$.hood.Inline.CurrentModal&&$.hood.Inline.CurrentModal.modal("hide")},Task:function(e){e.preventDefault();var t=$(e.currentTarget);t.addClass("loading");var o=t.data("complete");$.get(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&t&&t.data("redirect")&&setTimeout(function(){window.location=t.data("redirect")},1500),t.removeClass("loading"),o&&$.hood.Inline.RunComplete(o,t,e)}).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},DataList:{Init:function(){$(".hood-inline-list.query").each(function(){$(this).data("url",$(this).data("url")+window.location.search)}),$(".hood-inline-list:not(.refresh)").each($.hood.Inline.Load),$("body").on("click","a.hood-inline-list-target",function(e){e.preventDefault(),$.hood.Loader(!0);var t=document.createElement("a");t.href=$(this).attr("href");var o=$($(this).data("target")),n=document.createElement("a");n.href=o.data("url"),n.search=t.search,$.hood.Inline.DataList.Reload(o,n),complete=$(this).data("complete"),complete&&$.hood.Inline.RunComplete(complete,$(this))}),$("body").on("click",".hood-inline-list .pagination a",function(e){e.preventDefault(),$.hood.Loader(!0);var t=document.createElement("a");t.href=$(this).attr("href");var o=$(this).parents(".hood-inline-list"),n=document.createElement("a");n.href=o.data("url"),n.search=t.search,$.hood.Inline.DataList.Reload(o,n)}),$("body").on("submit",".hood-inline-list form",function(e){e.preventDefault(),$.hood.Loader(!0);var t=$(this),o=t.parents(".hood-inline-list"),n=document.createElement("a");n.href=o.data("url"),n.search="?"+t.serialize(),$.hood.Inline.DataList.Reload(o,n)}),$("body").on("submit","form.inline",function(e){e.preventDefault(),$.hood.Loader(!0);var t=$(this),o=$(t.data("target"));o.each(function(){var e=document.createElement("a");e.href=$(this).data("url"),e.href&&(e.search="?"+t.serialize(),$.hood.Inline.DataList.Reload($(this),e))})}),$("body").on("change","form.inline .refresh-on-change, .hood-inline-list form",function(e){e.preventDefault(),$.hood.Loader(!0);var t=$(this).parents("form"),o=$(t.data("target")),n=document.createElement("a");n.href=o.data("url"),n.search="?"+t.serialize(),$.hood.Inline.DataList.Reload(o,n)})},Reload:function(e,t){if(history.pushState&&e.hasClass("query")){var o=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+t.href.substring(t.href.indexOf("?")+1);window.history.pushState({path:o},"",o)}e.data("url",$.hood.Helpers.InsertQueryStringParamToUrl(t,"inline","true")),$.hood.Inline.Reload(e)}},HandleError:function(e){500===e.status?$.hood.Alerts.Error("<strong>Error "+e.status+"</strong><br />There was an error processing the content, please contact an administrator if this continues.<br/>"):404===e.status?$.hood.Alerts.Error("<strong>Error "+e.status+"</strong><br />The content could not be found.<br/>"):401===e.status&&($.hood.Alerts.Error("<strong>Error "+e.status+"</strong><br />You are not allowed to view this resource, are you logged in correctly?<br/>"),window.location=window.location)},Finish:function(){$.hood.Loader(!1)},RunComplete:function RunComplete(complete,sender,data){if(!$.hood.Helpers.IsNullOrUndefined(complete)){var func=eval(complete);"function"==typeof func&&func(sender,data)}}},$(document).ready($.hood.Inline.Init),$.hood.Modals={Open:$.hood.Inline.Modal},$.hood||($.hood={}),$.hood.Media={Init:function(){$("body").on("click",".media-delete",$.hood.Media.Delete),$("body").on("click",".media-directories-delete",$.hood.Media.Directories.Delete),$.hood.Media.Upload.Init(),$.hood.Media.Actions.Init()},Loaded:function(e){$.hood.Loader(!1)},BladeLoaded:function(e){$.hood.Media.LoadMediaPlayers()},Reload:function(e){$.hood.Inline.Reload($("#media-list"),e)},ReloadDirectories:function(e){$.hood.Inline.Reload($("#media-directories-list"),e)},Actions:{Init:function(){$("body").on("click",".hood-image-attach",$.hood.Media.Actions.Load.Attach),$("body").on("click",".hood-image-clear",$.hood.Media.Actions.Complete.Clear),$("body").on("click",".hood-image-insert",$.hood.Media.Actions.Load.Insert),$("body").on("click",".hood-media-select",$.hood.Media.Actions.Load.Select)},Target:null,Json:null,Current:{Attach:null},Load:{Attach:function(e){e.preventDefault(),$.hood.Media.Actions.Target=$($(this).data("tag")),$.hood.Media.Actions.Json=$($(this).data("json")),$.hood.Inline.Modal($(this).data("url"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-attach"),$("body").on("click",".media-attach",$.hood.Media.Actions.Complete.Attach)}),$.hood.Media.Upload.Init()})},Insert:function(e){var t=$("#"+e.id);t.data("imagesUrl")&&e.addButton("hoodimage",{text:"Insert image...",icon:!1,onclick:$.proxy(function(t){$.hood.Inline.Modal($(this).data("imagesUrl"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-insert"),$("body").on("click",".media-insert",$.proxy($.hood.Media.Actions.Complete.Insert,e))}),$.hood.Media.Upload.Init()})},t)})},Select:function(e){$.hood.Media.Actions.Target=$($(this).data("target")),$.hood.Inline.Modal($(this).data("url"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-select"),$("body").on("click",".media-select",$.hood.Media.Actions.Complete.Select)}),$.hood.Media.Upload.Init()})}},Complete:{Attach:function(e){e.preventDefault();var t=$.hood.Media.Actions.Target,o=$.hood.Media.Actions.Json;$.post($(this).data("url"),function(e){if($.hood.Helpers.ProcessResponse(e),e.Success){var n=e.Media.Icon;"Image"===e.Media.GeneralFileType&&(n=e.Media.MediumUrl),$.hood.Helpers.IsNullOrUndefined(t)||(t.css({"background-image":"url("+n+")"}),t.find("img").attr("src",n), | ||
t.removeClass("loading")),$.hood.Helpers.IsNullOrUndefined(o)||o.val(e.MediaJson)}}).done(function(){$("#media-select-modal").modal("hide")}).fail($.hood.Inline.HandleError)},Insert:function(e){var t=$(e.target),o=this;o.insertContent('<img alt="'+t.data("title")+'" src="'+t.data("url")+'"/>'),$.hood.Inline.CloseModal()},Select:function(e){var t=$(this).data("url"),o=$.hood.Media.Actions.Target;$(o).each(function(){$(this).is("input")?$(this).val(t):($(this).attr("src",t),$(this).css({"background-image":"url("+t+")"}),$(this).find("img").attr("src",t))}),$.hood.Alerts.Success("Image URL has been inserted.<br /><strong>Remember to press save!</strong>"),$("#media-select-modal").modal("hide")},Clear:function(e){e.preventDefault();var t=$($(this).data("tag")),o=$($(this).data("json"));$.post($(this).data("url"),function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&(icon=e.Media.Icon,"Image"===e.Media.GeneralFileType&&(icon=e.Media.MediumUrl),$.hood.Helpers.IsNullOrUndefined(t)||(t.css({"background-image":"url("+icon+")"}),t.find("img").attr("src",icon),t.removeClass("loading")),$.hood.Helpers.IsNullOrUndefined(o)||o.val(e.Json))}).fail($.hood.Inline.HandleError)}},RefreshImage:function(e,t,o){var n=$(e);n.addClass("loading"),$.get(t,{id:o},$.proxy(function(e){n.css({"background-image":"url("+e.SmallUrl+")"}),n.find("img").attr("src",e.SmallUrl),n.removeClass("loading")},this))}},Upload:{Init:function(){if($("#media-add").doesExist()){$("#media-total-progress").hide(),Dropzone.autoDiscover=!1;var e=new Dropzone("#media-upload",{url:$.hood.Media.Upload.UploadUrl,thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:!1,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!"});e.on("success",function(e,t){$.hood.Helpers.ProcessResponse(t)}),e.on("addedfile",function(e){$("#media-total-progress .progress-bar").css({width:"0%"}),$("#media-total-progress .progress-bar .percentage").html("0%")}),e.on("totaluploadprogress",function(e){$("#media-total-progress .progress-bar").css({width:e+"%"}),$("#media-total-progress .progress-bar .percentage").html(e+"%")}),e.on("sending",function(e){$("#media-total-progress").fadeIn(),$("#media-total-progress .progress-bar").css({width:"0%"}),$("#media-total-progress .progress-bar .percentage").html("0%")}),e.on("complete",function(e){$.hood.Media.Reload()}),e.on("queuecomplete",function(e){$("#media-total-progress").hide(),$.hood.Media.Reload()})}},UploadUrl:function(){return $("#media-upload").data("url")+"?directoryId="+$("#media-list > #upload-directory-id").val()}},Delete:function(e){var t=$(this),o=function(e){e&&$.post("/admin/media/delete",{id:t.data("id")},function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&($.hood.Media.Reload(),$(".modal-backdrop").remove(),$(".modal").modal("hide"))})};$.hood.Alerts.Confirm("The media file will be permanently removed. This cannot be undone.","Are you sure?",o,"warning",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> Ensure this file is not attached to any posts, pages or features of the site, or it will appear as a broken image or file.</span>',"Ok","Cancel")},RestrictDir:function(){var e=/[^0-9A-Za-z- ]*/g,t=$(this).val(),o=t.replace(e,"");t!==o&&$(this).val(o)},Directories:{Editor:function(){$("#content-directories-edit-form").hoodValidator({validationRules:{DisplayName:{required:!0},Slug:{required:!0}},submitButtonTag:$("#content-directories-edit-submit"),submitUrl:$("#content-directories-edit-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Media.ReloadDirectories(),$.hood.Media.Reload()}})},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Media.ReloadDirectories(),$.hood.Media.Reload()})};$.hood.Alerts.Confirm("The directory and all files will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle mr-2"></i><strong>This cannot be undone!</strong><br />Ensure these files are not attached to any posts, pages or features of the site, or it will appear as a broken image or file.</span>')}},Players:{},LoadMediaPlayers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".hood-media",t={techOrder:["azureHtml5JS","flashSS","html5FairPlayHLS","silverlightSS","html5"],nativeControlsForTouch:!1,controls:!0,autoplay:!1,seeking:!0};$(e).each(function(){try{if(player=$.hood.Media.Players[$(this).data("id")],player)try{player.dispose()}catch(e){console.log("There was a problem disposing the old media player: ".concat(e))}$.hood.Media.Players[$(this).data("id")]=amp($(this).attr("id"),t),player=$.hood.Media.Players[$(this).data("id")],player.src([{src:$(this).data("file"),type:$(this).data("type")}])}catch(e){console.log("There was a problem playing the media file: ".concat(e))}})}},$(document).ready($.hood.Media.Init),$.window=$(window),$.hood||($.hood={}),$.hood.App={Options:{Header:{Target:"#header",Sticky:!0,StickyClass:"sticky-header"},Alerts:!0,Colorbox:!0,ContactForms:!0,Forums:!0,PaymentPages:!0,RichTextEditors:$(".tinymce-public").length},Init:function(e){$.hood.App.Options=$.extend($.hood.App.Options,e||{}),e&&e.Header&&($.hood.App.Options.Header=$.extend($.hood.App.Options.Header,e.Header||{})),$.hood.App.Header.Init(),$.hood.App.Options.PaymentPages&&$.hood.App.PaymentPages.Init(),$.hood.App.Options.FitVids&&$.hood.App.ResizeVideos(),$.hood.App.Options.ContactForms&&$.hood.App.ContactForms.Init(),$.hood.App.Options.Colorbox&&$.hood.App.Colorbox(),$.hood.App.Options.LoadSharers&&$.hood.App.Sharers(),$.hood.App.Options.RichTextEditors&&$.hood.App.RichTextEditors()},Ready:function(){$.hood.App.Init(),$.hood.App.Resize()},Load:function(){},Resize:function(){},Header:{Init:function(){$.hood.App.Options.Header.Sticky&&($.hood.App.Header.StickyMenu(),$.window.on("scroll",function(){$.hood.App.Header.StickyMenu()}))},StickyMenu:function(){var e=0,t=$($.hood.App.Options.Header.Target);t.length>0&&(e=t.offset().top);var o=t.height(),n=$.window.height()+2*o,a=$(document).height();$.window.scrollTop()>e&&a>n?t.addClass($.hood.App.Options.Header.StickyClass):$.hood.App.Header.RemoveStickyness()},RemoveStickyness:function(){var e=$($.hood.App.Options.Header.Target);e.hasClass($.hood.App.Options.Header.StickyClass)&&e.removeClass($.hood.App.Options.Header.StickyClass)}},ContactForms:{Init:function(){$(".contact-form .thank-you").hide(),$(".contact-form .form-submit").show(),$("body").on("submit",".contact-form",function(e){return e.preventDefault(),$(this).addClass("loading"),$.hood.App.ContactForms.Submit(this),!1})},Submit:function(e){var t=$(e);return t.valid()&&$.post(t.attr("action"),t.serialize(),function(e){e.Success?(t.attr("data-redirect")&&(window.location=t.attr("data-redirect")),t.attr("data-alert-message")&&$.hood.Alerts.Success(t.attr("data-alert-message"),"Success",null,!0),t.find(".form").hide(),t.find(".thank-you").show()):t.attr("data-alert-error")?$.hood.Alerts.Error(t.attr("data-alert-error"),"Error",null,!0):$.hood.Alerts.Error("There was an error sending the message: "+e.Errors,"Error",null,!0),t.removeClass("loading")}),!1}},Alerts:function(){$(".alert.auto-dismiss").fadeTo(5e3,500).slideUp(500,function(){$(".alert.auto-dismiss").slideUp(500)})},Colorbox:function(){$(".colorbox").colorbox({rel:"gallery",maxWidth:"95%",maxHeight:"95%"}),$(".colorbox-iframe").colorbox({iframe:!0,maxWidth:"95%",maxHeight:"95%",innerWidth:640,innerHeight:390})},Forums:{Init:function(){var e=$.getUrlVars().highlight;if($.isNumeric(e)){var t=$("#post-"+e);$("html,body").animate({scrollTop:t.offset().top},"slow"),t.addClass("highlight"),"Created"===$.getUrlVars().message&&t.addClass("created")}var o=$.getUrlVars().reply;if($.isNumeric(o)){var n=$("#forum-post-form");$("html,body").animate({scrollTop:n.offset().top},"slow")}$(".forum").on("click",".edit-post",function(e){$(this).parents(".post").find(".post-view").slideToggle(),$(this).parents(".post").find(".edit-view").slideToggle()})}},ResizeVideos:function(){return $().fitVids?void $("body").fitVids({customSelector:"iframe[src^='http://www.dailymotion.com/embed'], iframe[src*='maps.google.com'], iframe[src*='google.com/maps']",ignore:".no-fv"}):(console.log("resizeVideos: FitVids not Defined."),!0)},PaymentPages:{Init:function(){$("body").on("click",".btn.price-select[data-target][data-value]",$.hood.App.PaymentPages.PriceSelect),$("body").on("click",".change-price-option",$.hood.App.PaymentPages.ChangePrice)},ChangePrice:function(){$("#price-panel").collapse("show"),$("#billing-panel").collapse("hide"),$("#confirm-panel").collapse("hide")},PriceSelect:function(){var e=$(this);targetId="#"+e.data("target"),$(targetId).val(e.data("value")),$(".selected-price-text").html($(targetId).find(":selected").text()),$('.price-select[data-target="'+e.data("target")+'"]').each(function(){$(this).html($(this).data("temp")).removeClass("active")}),$('.price-select[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).data("temp",$(this).html()).html("Selected").addClass("active")}),$("#price-panel").collapse("hide"),$("#billing-panel").collapse("show"),$("#confirm-panel").collapse("hide")}},RichTextEditors:function(){tinymce.init({selector:".tinymce-public",height:250,plugins:["advlist autolink lists link image charmap print preview anchor media","searchreplace visualblocks code fullscreen","insertdatetime media contextmenu paste emoticons"],menubar:!1,toolbar:"styleselect | bold italic | bullist numlist outdent indent | undo redo | link image media emoticons",image_dimensions:!1,body_class:"tiny-mce-body",content_css:"/css/site.css"})},Property:{Loaded:function(e){$.hood.Loader(!1),$.hood.Google.ClusteredMap()},Reload:function(e){$("#property-list").doesExist()&&$.hood.Inline.Reload($("#property-list"),e)}}},$(function(){$.hood.App.Ready()}),$(window).on("load",$.hood.App.Load),$(window).on("resize",$.hood.App.Resize); | ||
"use strict";var console={};console.log=function(){},window.console=console,$.hood||($.hood={}),$.body=$("body");var console=window.console||{};console.log=console.log||function(){},console.warn=console.warn||function(){},console.error=console.error||function(){},console.info=console.info||function(){},$.fn.exists=function(){return $(this).length},$.fn.doesExist=function(){return $(this).length},$.fn.restrictToSlug=function(e){var t=$(this),o=e||/[^0-9a-zA-Z]*/g,n=function(){var e=$(this).val(),t=e.replace(o,"");e!==t&&$(this).val(t)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".restrict-to-slug").restrictToSlug(),$.fn.restrictToPageSlug=function(e){var t=$(this),o=e||/[^0-9a-zA-Z-//]*/g,n=function(){var e=$(this).val(),t=e.replace(o,"");if((t.match(new RegExp("/","g"))||[]).length>4){var n=t.lastIndexOf("/");t=t.substring(0,n)+t.substring(n+1),$.hood.Alerts.Warning("You can only have up to 4 '/' characters in a url slug.")}e!==t&&$(this).val(t)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".restrict-to-page-slug").restrictToPageSlug(),$.fn.restrictToMetaSlug=function(e){var t=$(this),o=e||/[^0-9a-zA-Z.]*/g,n=function(){var e=$(this).val(),t=e.replace(o,"");if((t.match(new RegExp(".","g"))||[]).length>1){var n=t.lastIndexOf(".");t=t.substring(0,n)+t.substring(n+1),$.hood.Alerts.Warning("You can only have up to 1 '.' characters in a meta slug.")}e!==t&&$(this).val(t)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".restrict-to-meta-slug").restrictToMetaSlug(),$.fn.characterCounter=function(e){var t=$(this),o=function(){var e=$(this).data("counter"),t=Number($(this).attr("maxlength")),o=$(this).val().length;$(e).text(t-o);var n="text-success";t-o<t/10&&(n="text-danger"),$(e).parent().removeClass("text-success").removeClass("text-danger").addClass(n)};t.on("keyup",o),t.on("paste",o),t.on("change",o)},$(".character-counter").characterCounter(),$(".character-counter").trigger("change"),$.fn.addLoader=function(){$(this).data("loadercontent",$(this).html()),$(this).addClass("loading").append('<i class="fa fa-refresh fa-spin m-l-sm"></i>')},$.fn.removeLoader=function(){$(this).empty().html($(this).data("loadercontent")),$(this).removeClass("loading")},$.fn.warningAlert=function(){var e=$(this),t=function(e){e.preventDefault();var t=function(t){if(t){var o=$(e.currentTarget).attr("href");window.location=o}};return $.hood.Alerts.Confirm($(e.currentTarget).data("warning"),$(e.currentTarget).data("title"),t,"warning",$(e.currentTarget).data("footer"),"Ok","Cancel"),!1};e.on("click",t)},$(".warning-alert").warningAlert(),$.commonHeight=function(e,t){var o=0;e.children(t).each(function(){var e=$(this).children();e.hasClass("max-height")?o=e.outerHeight():e.outerHeight()>o&&(o=e.outerHeight())}),e.children(t).each(function(){$(this).height(o)})},$.loadCss=function(e,t){$("link#"+e).length||$("<link/>",{id:e,rel:"stylesheet",type:"text/css",href:t}).appendTo("head")},$.getUrlVars=function(){for(var e,t=[],o=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),n=0;n<o.length;n++)e=o[n].split("="),t.push(e[0]),t[e[0]]=e[1];return t},$.decodeUrl=function(e){return decodeURIComponent(e).replace("+"," ")},$.numberWithCommas=function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},$.validator&&($.validator.addMethod("time",function(e,t){return this.optional(t)||/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$/i.test(e)},"Please enter a valid time."),$.validator.addMethod("ukdate",function(e,t){return e.match(/^\d\d?\/\d\d?\/\d\d\d\d$/)},"Please enter a date in the format dd/mm/yyyy.")),$.mobile={Android:function(){return navigator.userAgent.match(/Android/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)},Any:function(){return $.mobile.Android()||$.mobile.BlackBerry()||$.mobile.iOS()||$.mobile.Opera()||$.mobile.Windows()}},$.mobile.Android?$.mobile.BlackBerry?$.mobile.iOS?$.mobile.Opera?$.mobile.Windows?($.body.addClass("desktop-device"),$.device="desktop"):($.body.addClass("windows-device"),$.device="windows"):($.body.addClass("opera-device"),$.device="opera"):($.body.addClass("ios-device"),$.device="ios"):($.body.addClass("blackberry-device"),$.device="blackberry"):($.body.addClass("android-device"),$.device="android"),function(){var e={password:"0",username:"0"};$("body").on("change",".prevent-autocomplete",function(t){var o=$(this).attr("id");"0"!==e[o]&&e[o]===$(this).val()||$(this).val("")}),$("body").on("keyup",".prevent-autocomplete",function(t){var o=$(this).attr("id");e[o]=$(this).val()})}(),function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),o}if("function"==typeof window.CustomEvent)return!1;e.prototype=window.Event.prototype,window.CustomEvent=e}(),$.hood.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"}],$.hood.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"}],new CustomEvent("loader-show"),new CustomEvent("loader-hide"),$.hood.Loader=function(e){e?$("body").trigger("loader-show"):$("body").trigger("loader-hide")},$.hood||($.hood={}),$.hood.Helpers={IsNullOrUndefined:function(e){var t=!1;return null!==e&&void 0!==e&&""!==e||(t=!0),t},IsSet:function(e){var t=!1;return null!==e&&void 0!==e&&""!==e||(t=!0),!t},IsEventSupported:function(e){var t=document.createElement("div");e="on"+e;var o=e in t;return o||(t.setAttribute(e,"return;"),o="function"==typeof t[e]),t=null,o},IsFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},IsUrlExternal:function(e){var t=e.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);return"string"==typeof t[1]&&t[1].length>0&&t[1].toLowerCase()!==location.protocol||"string"==typeof t[2]&&t[2].length>0&&t[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host},IsInIframe:function(){try{return window.self!==window.top}catch(e){return!0}},HtmlEncode:function(e){return $("<div/>").text(e).html()},HtmlDecode:function(e){return $("<div/>").html(e).text()},FormatCurrency:function(e,t){return t+" "+e.toFixed(2).replace(/./g,function(e,t,o){return t>0&&"."!==e&&(o.length-t)%3==0?","+e:e})},FormatKilobytes:function(e){return e/=1024,e.toFixed(2).replace(/./g,function(e,t,o){return t>0&&"."!==e&&(o.length-t)%3==0?","+e:e})},FormatMegabytes:function(e){return e/=1024,e/=1024,currency+" "+e.toFixed(2).replace(/./g,function(e,t,o){return t>0&&"."!==e&&(o.length-t)%3==0?","+e:e})},FallbackCopyTextToClipboard:function(e){var t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch(e){console.error("Oops, unable to copy",e)}document.body.removeChild(t)},CopyTextToClipboard:function(e){if(!navigator.clipboard)return void $.hood.Handlers.FallbackCopyTextToClipboard(e);navigator.clipboard.writeText(e).then(function(){},function(e){console.error("Could not copy text: ",e)})},ProcessResponse:function(e){var t="";e.Title&&(t="<strong>".concat(e.Title,"</strong><br />")),e.Success?$.hood.Alerts.Success("".concat(t).concat(e.Message)):$.hood.Alerts.Error("".concat(t).concat(e.Errors))},GetQueryStringParamByName:function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)","i"),o=t.exec(location.search);return null===o?"":decodeURIComponent(o[1].replace(/\+/g," "))},InsertQueryStringParam:function(e,t){e=escape(e),t=escape(t);var o=document.location.search.substr(1).split("&");if(""===o)document.location.search="?"+e+"="+t;else{for(var n,a=o.length;a--;)if(n=o[a].split("="),n[0]===e){n[1]=t,o[a]=n.join("=");break}a<0&&(o[o.length]=[e,t].join("=")),document.location.search=o.join("&")}},InsertQueryStringParamToUrl:function(e,t,o){t=escape(t),o=escape(o);var n=e.search.substr(1).split("&");if(""===n)e.search="?"+t+"="+o;else{for(var a,i=n.length;i--;)if(a=n[i].split("="),a[0]===t){a[1]=o,n[i]=a.join("=");break}i<0&&(n[n.length]=[t,o].join("=")),e.search=n.join("&")}return e},UrlToLocationObject:function(e){var t=document.createElement("a");return t.href=e,t},FindAndRemoveFromArray:function(e,t,o){$.each(e,function(n,a){a[t]===o&&e.splice(n,1)})},FindAndReturnFromArray:function(e,t,o){var n=null;return $.each(e,function(e,a){a[t]===o&&(n=a)}),n},LeftPad:function(e,t){for(var o=e+"";o.length<t;)o="0"+o;return o},DateAdd:function(e,t,o){var n=new Date(e);switch(t.toLowerCase()){case"year":n.setFullYear(n.getFullYear()+o);break;case"quarter":n.setMonth(n.getMonth()+3*o);break;case"month":n.setMonth(n.getMonth()+o);break;case"week":n.setDate(n.getDate()+7*o);break;case"day":n.setDate(n.getDate()+o);break;case"hour":n.setTime(n.getTime()+36e5*o);break;case"minute":n.setTime(n.getTime()+6e4*o);break;case"second":n.setTime(n.getTime()+1e3*o);break;default:n=void 0}return n},GenerateRandomString:function(e){var t="abcdefghijklmnopqrstuvwxyz",o="ABCDEFGHIJKLMNOPQRSTUVWXYZ",n=t+o+"0123456789";return("!@#$&*".pick(1)+t.pick(1)+o.pick(1)+n.pick(5,10)).shuffle()}},$.hood||($.hood={}),$.hood.Handlers={Init:function(){$("body").on("click",".select-text",$.hood.Handlers.SelectTextContent),$("body").on("click",".btn.click-select[data-target][data-value]",$.hood.Handlers.ClickSelect),$("body").on("click",".click-select.show-selected[data-target][data-value]",$.hood.Handlers.ClickSelect),$("body").on("click",".click-select:not(.show-selected)[data-target][data-value]",$.hood.Handlers.ClickSelectClean),$("body").on("click",".slide-link",$.hood.Handlers.SlideToAnchor),$("body").on("click",".scroll-target, .scroll-to-target",$.hood.Handlers.ScrollToTarget),$("body").on("click",".scroll-top, .scroll-to-top",$.hood.Handlers.ScrollToTop),$("body").on("change","input[type=checkbox][data-input]",$.hood.Handlers.CheckboxChange),$("body").on("change",".submit-on-change",$.hood.Handlers.SubmitOnChange),$("select[data-selected]").each($.hood.Handlers.SelectSetup),$("body").on("change",".inline-date",$.hood.Handlers.DateChange),$.hood.Handlers.Uploaders.Init(),$.hood.Handlers.ColorPickers()},ScrollToTop:function(e){return e&&e.preventDefault(),$("html, body").animate({scrollTop:0},800),!1},ScrollToTarget:function(e){e&&e.preventDefault();var t=$(this).attr("href").split("#")[0];if(t===window.location.pathname||""===t){var o=this.hash,n=$(o),a=$("header.header"),i=0;a&&(i=a.height()),$(this).data("offset")?$("html, body").stop().animate({scrollTop:n.offset().top-$(this).data("offset")},900,"swing"):$("html, body").stop().animate({scrollTop:n.offset().top-i},900,"swing")}},SubmitOnChange:function(e){e&&e.preventDefault(),$(this).parents("form").submit()},DateChange:function(e){e&&e.preventDefault();var t=$(this).parents(".hood-date").find(".date-output"),o=t.parents(".hood-date").find(".date-value").val();/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/.test(o)||(o="01/01/2001");var n=t.parents(".hood-date").find(".hour-value").val();$.isNumeric(n)||(n="00");var a=t.parents(".hood-date").find(".minute-value").val();$.isNumeric(a)||(a="00"),t.val(o+" "+n+":"+a+":00"),t.attr("value",o+" "+n+":"+a+":00")},CheckboxChange:function(e){e&&e.preventDefault();var t=new Array;$('input[data-input="'+$(this).data("input")+'"]').each(function(){$(this).is(":checked")&&t.push($(this).val())});var o="#"+$(this).data("input"),n=JSON.stringify(t);$(o).val(n)},SelectSetup:function(){$(this).data("selected");if("undefined"!==$(this).data("selected")&&""!==$(this).data("selected")){var e=String($(this).data("selected"));$(this).val(e)}},ClickSelect:function(){var e=$(this),t="#"+e.data("target");$(t).val(e.data("value")),$(t).trigger("change"),$('.click-select[data-target="'+e.data("target")+'"]').each(function(){$(this).html($(this).data("temp")).removeClass("active")}),$('.click-select[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).data("temp",$(this).html()).html("Selected").addClass("active")})},ClickSelectClean:function(){var e=$(this),t="#"+e.data("target");$(t).val(e.data("value")),$(t).trigger("change"),$('.click-select.clean[data-target="'+e.data("target")+'"]').each(function(){$(this).removeClass("active")}),$('.click-select.clean[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).addClass("active")})},SelectTextContent:function(){var e=$(this);e.select(),e.mouseup(function(){return e.unbind("mouseup"),!1})},SlideToAnchor:function(){var e=$("body").scrollTop(),t=$($.attr(this,"href")).offset().top;return $("html, body").animate({scrollTop:t},Math.abs(t-e)),!1},Uploaders:{Init:function(){($(".image-uploader").length||$(".gallery-uploader").length)&&($(".upload-progress-bar").hide(),$.getScript("/lib/dropzone/min/dropzone.min.js",$.proxy(function(){$(".image-uploader").each(function(){$.hood.Handlers.Uploaders.SingleImage($(this).attr("id"),$(this).data("json"))}),$(".gallery-uploader").each(function(){$.hood.Handlers.Uploaders.Gallery($(this).attr("id"),$(this).data("json"))})},this)))},RefreshImage:function(e,t){$(e.data("preview")).css({"background-image":"url("+t.Media.SmallUrl+")"}),$(e.data("preview")).find("img").attr("src",t.Media.SmallUrl)},SingleImage:function(e,t){e="#"+e;$(e);Dropzone.autoDiscover=!1;var o=new Dropzone(e,{url:$(e).data("url"),maxFiles:1,paramName:"file",parallelUploads:1,acceptedFiles:$(e).data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:!1,clickable:e});o.on("addedfile",function(){}),o.on("totaluploadprogress",function(t){$(".upload-progress-bar."+e.replace("#","")+" .progress-bar").css({width:t+"%"})}),o.on("sending",function(t){$(".upload-progress-bar."+e.replace("#","")).show(),$($(e).data("preview")).addClass("loading")}),o.on("queuecomplete",function(t){$(".upload-progress-bar."+e.replace("#","")).hide()}),o.on("success",function(n,a){a.Success?(a.Media&&($(t).val(JSON.stringify(a.Media)),$($(e).data("preview")).css({"background-image":"url("+a.Media.SmallUrl+")"}),$($(e).data("preview")).find("img").attr("src",a.Media.SmallUrl)),$.hood.Alerts.Success("New image added!")):$.hood.Alerts.Error("There was a problem adding the image: "+a.Error),o.removeFile(n),$($(e).data("preview")).removeClass("loading")})},Gallery:function(e){Dropzone.autoDiscover=!1;var t=document.querySelector(e+"-template");t.id="";var o=t.parentNode.innerHTML;t.parentNode.removeChild(t);var n=new Dropzone(e,{url:$(e).data("url"),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:o,paramName:"files",acceptedFiles:$(e).data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:"#previews",clickable:".fileinput-button",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!"});$(e+" .cancel").hide(),n.on("addedfile",function(t){$(t.previewElement.querySelector(".complete")).hide(),$(t.previewElement.querySelector(".cancel")).show(),$(e+" .cancel").show()}),n.on("totaluploadprogress",function(e){document.querySelector("#total-progress .progress-bar").style.width=e+"%"}),n.on("sending",function(e){document.querySelector("#total-progress").style.opacity="1"}),n.on("complete",function(e){$(e.previewElement.querySelector(".cancel")).hide(),$(e.previewElement.querySelector(".progress")).hide(),$(e.previewElement.querySelector(".complete")).show(),$.hood.Inline.Refresh(".gallery")}),n.on("queuecomplete",function(t){document.querySelector("#total-progress").style.opacity="0",$(e+" .cancel").hide()}),n.on("success",function(e,t){$.hood.Inline.Refresh(".gallery"),t.Success?$.hood.Alerts.Success("New images added!"):$.hood.Alerts.Error("There was a problem adding the profile image: "+t.Error)}),document.querySelector(".actions .cancel").onclick=function(){n.removeAllFiles(!0)}}},ColorPickers:function(){var e=function(e,t){var o=$(t._root.button).parent().data("target");$(t._root.button).css({"background-color":e.toHEXA().toString()});for(var n=t.getColor().toHEXA(),a="",i=n.length-1;i>=0;i--)a=n[i]+a;$(o).val("#"+a),$(o).change()},t=[];$(".color-picker").each(function(o,n){var a=!0;"true"==$(this).data("opacity")&&(a=!1);var i=Pickr.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 o=$(t._root.button).parent().data("target"),n=$(o).val();$(o).on("click",$.proxy(function(){this.show()},t)),n&&(t.setColor(n),e(t.getColor(),t))}).on("clear",function(t){var o=$(t._root.button).parent().data("target");t.setColor("transparent"),e(t.getColor(),t),$(o).val(""),$(o).change()}).on("change",e);t.push(i)})}},$(document).ready($.hood.Handlers.Init),String.prototype.contains=function(e){return-1!==this.indexOf(e)},String.prototype.pick=function(e,t){var o,n="";o=void 0===t?e:e+Math.floor(Math.random()*(t-e));for(var a=0;a<o;a++)n+=this.charAt(Math.floor(Math.random()*this.length));return n},String.prototype.shuffle=function(){var e,t,o=this.split(""),n=o.length;if(n)for(;--n;)t=Math.floor(Math.random()*(n+1)),e=o[t],o[t]=o[n],o[n]=e;return o.join("")},String.prototype.toSeoUrl=function(){var e=this.replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g,"-").toLowerCase();"-"===e.charAt(0)&&(e=e.substring(1));var t=e.length-1;return"-"===e.charAt(t)&&(e=e.substring(0,t)),e},$.hood||($.hood={}),$.hood.FormValidator=function(e,t){this.Options=$.extend({formTag:e,validationRules:null,validationMessages:{},placeBelow:!0,submitButtonTag:null,submitUrl:null,submitFunction:null,serializationFunction:function(){return $(this.formTag).serialize()}},t||{}),this.LoadValidation=function(){$.hood.Helpers.IsNullOrUndefined(this.Options.formTag)||($(this.Options.formTag).find("input, textarea, select").keypress($.proxy(function(e){if(13===e.which)return $.proxy(this.submitForm(),this),e.preventDefault(),!1},this)),$(this.Options.formTag).validate({submitHandler:function(e){e.preventDefault()},errorClass:this.Options.errorClass,focusInvalid:!1,rules:this.Options.validationRules,messages:this.Options.validationMessages}),$.hood.Helpers.IsNullOrUndefined(this.Options.submitButtonTag)||$(this.Options.submitButtonTag).click($.proxy(this.submitForm,this)))},this.submitForm=function(){$(this.Options.formTag).valid()&&(this.TempButtonContent=$(this.Options.submitButtonTag).removeClass("btn-primary").addClass("btn-default").html(),$(this.Options.submitButtonTag).removeClass("btn-primary").addClass("btn-default").html('<i class="fa fa-refresh fa-spin"></i> Loading...'),$(this.Options.formTag).find("input[type=checkbox]").each(function(){$(this).is(":checked")&&$(this).val("true")}),$.post(this.Options.submitUrl,this.Options.serializationFunction(),$.proxy(function(e){$(this.Options.submitButtonTag).removeClass("btn-default").addClass("btn-primary").html(this.TempButtonContent),this.Options.submitFunction(e)},this)))},this.LoadValidation(),this.Options.placeBelow&&$(this.Options.formTag).addClass("validation-below")},$.fn.hoodValidator=function(e){return this.each(function(){var t=$(this);if(!t.data("hoodValidator")){var o=new $.hood.FormValidator(this,e);t.data("hoodValidator",o)}})},$.hood||($.hood={}),$.hood.Addresses={Init:function(){$("body").on("click",".address-set-billing",$.hood.Addresses.SetBilling),$("body").on("click",".address-set-delivery",$.hood.Addresses.SetDelivery),$("body").on("click",".address-delete",$.hood.Addresses.Delete)},Lists:{Address:{Loaded:function(e){$.hood.Loader(!1)},Reload:function(e){$("#address-list").doesExist()&&$.hood.Inline.Reload($("#address-list"),e)}}},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload(),e.Success&&t&&t.data("redirect")&&($.hood.Alerts.Success("<strong>Address deleted, redirecting...</strong><br />Just taking you back to the address list."),setTimeout(function(){window.location=t.data("redirect")},1500))})};$.hood.Alerts.Confirm("The address will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong></span>')},CreateOrEdit:function(){$.hood.Google.Addresses.InitAutocomplete(),$("#address-form").hoodValidator({validationRules:{Number:{required:!0},Address1:{required:!0},City:{required:!0},County:{required:!0},Postcode:{required:!0},Country:{required:!0}},submitButtonTag:$("#address-form-submit"),submitUrl:$("#address-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload(),e.Success&&$.hood.Inline.CloseModal()}})},SetBilling:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload()})};$.hood.Alerts.Confirm("The current billing address will be overwritten.","Are you sure?",o,"error")},SetDelivery:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload()})};$.hood.Alerts.Confirm("The current delivery address will be overwritten.","Are you sure?",o,"error")}},$(document).ready($.hood.Addresses.Init);var swalWithBootstrapButtons=Swal.mixin({customClass:{confirmButton:"btn btn-success btn-lg m-1 pl-4 pr-4",cancelButton:"btn btn-danger btn-lg m-1"},buttonsStyling:!1}),Toast=Swal.mixin({toast:!0,position:"top-end",showConfirmButton:!0});$.hood||($.hood={}),$.hood.Alerts={Error:function(e,t,o,n,a,i,r){!0===o?this.SweetAlert(e,t,"error",n,a,i,r):this.Alert(e,t,"error")},Warning:function(e,t,o,n,a,i,r){!0===o?this.SweetAlert(e,t,"warning",n,a,i,r):this.Alert(e,t,"warning")},Message:function(e,t,o,n,a,i,r){!0===o?this.SweetAlert(e,t,"info",n,a,i,r):this.Alert(e,t,"info")},Success:function(e,t,o,n,a,i,r){!0===o?this.SweetAlert(e,t,"success",n,a,i,r):this.Alert(e,t,"success")},Alert:function(e,t,o){Toast.fire({type:o||"info",html:e,title:t})},SweetAlert:function(e,t,o,n,a,i,r){swalWithBootstrapButtons.fire({title:t,html:e,type:o||"info",footer:n,showConfirmButton:a,timer:i}).then(function(e){e.dismiss||r(e)})},Confirm:function(e,t,o,n,a,i,r){swalWithBootstrapButtons.fire({title:t||"Woah!",html:e||"Are you sure you want to do this?",type:n||"warning",footer:a||'<span class="text-warning"><i class="fa fa-exclamation-triangle"></i> This cannot be undone.</span>',showCancelButton:!0,confirmButtonText:i||"Ok",cancelButtonText:r||"Cancel"}).then(function(e){e.dismiss||o(e.value)})},Prompt:function(e,t,o,n,a,i,r,s,l){swalWithBootstrapButtons.fire({input:n||"text",inputAttributes:l||{autocapitalize:"off"},title:t||"Enter a value",html:e||"Fill in the field and press Ok to continue.",type:a||"info",footer:i,showCancelButton:!0,confirmButtonText:r||"Ok",cancelButtonText:s||"Cancel"}).then(function(e){e.dismiss||o(e.value)})}},$.hood||($.hood={}),$.hood.Forms={Init:function(){$(".floating-label > label").each(function(){var e=$(this);e.parent().append(e)})},GetAllowedExtensions:function(e){switch(e){case"Image":return["png","jpg","jpeg","bmp","gif"];case"Document":return["doc","docx","pdf","rtf"];case"All":return""}},GetAllowedFiles:function(e){switch(e){case"Image":return"image/png,jpg,image/jpeg,image/gif";case"Document":return"application/msword,application/pdf,text/rtf";case"All":return""}}},$(document).ready($.hood.Forms.Init),$.hood||($.hood={}),$.hood.Inline={Tags:{},Init:function(){$(".hood-inline:not(.refresh)").each($.hood.Inline.Load),$("body").on("click",".hood-inline-task",$.hood.Inline.Task),$("body").on("click",".hood-modal",function(e){e.preventDefault(),$.hood.Inline.Modal($(this).attr("href"),$(this).data("complete"),$(this).data("close"))}),$.hood.Inline.DataList.Init()},Refresh:function(e){$(e||".hood-inline").each($.hood.Inline.Load)},Load:function(){$.hood.Inline.Reload(this)},Reload:function(e,t){var o=$(e);o.addClass("loading"),t||(t=o.data("complete"));var n=o.data("url");$.get(n,$.proxy(function(e){o.html(e),o.removeClass("loading"),t&&$.hood.Inline.RunComplete(t,o,e)},o)).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},CurrentModal:null,Modal:function(e,t){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];$.hood.Inline.CurrentModal&&o&&$.hood.Inline.CloseModal(),$.get(e,function(e){var o="#"+$(e).attr("id");$(e).addClass("hood-inline-modal"),$(o).length&&$(o).remove(),$("body").append(e),$.hood.Inline.CurrentModal=$(o),$(o).modal(),$(o).on("shown.bs.modal",function(){$(document).off("focusin.modal")}),$(o).on("hidden.bs.modal",function(e){$(this).remove()}),t&&$.hood.Inline.RunComplete(t,$(o),e)}).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},CloseModal:function(){$.hood.Inline.CurrentModal&&$.hood.Inline.CurrentModal.modal("hide")},Task:function(e){e.preventDefault();var t=$(e.currentTarget);t.addClass("loading");var o=t.data("complete");$.get(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&t&&t.data("redirect")&&setTimeout(function(){window.location=t.data("redirect")},1500),t.removeClass("loading"),o&&$.hood.Inline.RunComplete(o,t,e)}).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},DataList:{Init:function(){$(".hood-inline-list.query").each(function(){$(this).data("url",$(this).data("url")+window.location.search)}),$(".hood-inline-list:not(.refresh)").each($.hood.Inline.Load),$("body").on("click","a.hood-inline-list-target",function(e){e.preventDefault(),$.hood.Loader(!0);var t=document.createElement("a");t.href=$(this).attr("href");var o=$($(this).data("target")),n=document.createElement("a");n.href=o.data("url"),n.search=t.search,$.hood.Inline.DataList.Reload(o,n),complete=$(this).data("complete"),complete&&$.hood.Inline.RunComplete(complete,$(this))}),$("body").on("click",".hood-inline-list .pagination a",function(e){e.preventDefault(),$.hood.Loader(!0);var t=document.createElement("a");t.href=$(this).attr("href");var o=$(this).parents(".hood-inline-list"),n=document.createElement("a");n.href=o.data("url"),n.search=t.search,$.hood.Inline.DataList.Reload(o,n)}),$("body").on("submit",".hood-inline-list form",function(e){e.preventDefault(),$.hood.Loader(!0);var t=$(this),o=t.parents(".hood-inline-list"),n=document.createElement("a");n.href=o.data("url"),n.search="?"+t.serialize(),$.hood.Inline.DataList.Reload(o,n)}),$("body").on("submit","form.inline",function(e){e.preventDefault(),$.hood.Loader(!0);var t=$(this);$(t.data("target")).each(function(){var e=document.createElement("a");e.href=$(this).data("url"),e.href&&(e.search="?"+t.serialize(),$.hood.Inline.DataList.Reload($(this),e))})}),$("body").on("change","form.inline .refresh-on-change, .hood-inline-list form",function(e){e.preventDefault(),$.hood.Loader(!0);var t=$(this).parents("form"),o=$(t.data("target")),n=document.createElement("a");n.href=o.data("url"),n.search="?"+t.serialize(),$.hood.Inline.DataList.Reload(o,n)})},Reload:function(e,t){if(history.pushState&&e.hasClass("query")){var o=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+t.href.substring(t.href.indexOf("?")+1);window.history.pushState({path:o},"",o)}e.data("url",$.hood.Helpers.InsertQueryStringParamToUrl(t,"inline","true")),$.hood.Inline.Reload(e)}},HandleError:function(e){500===e.status?$.hood.Alerts.Error("<strong>Error "+e.status+"</strong><br />There was an error processing the content, please contact an administrator if this continues.<br/>"):404===e.status?$.hood.Alerts.Error("<strong>Error "+e.status+"</strong><br />The content could not be found.<br/>"):401===e.status&&($.hood.Alerts.Error("<strong>Error "+e.status+"</strong><br />You are not allowed to view this resource, are you logged in correctly?<br/>"),window.location=window.location)},Finish:function(){$.hood.Loader(!1)},RunComplete:function RunComplete(complete,sender,data){if(!$.hood.Helpers.IsNullOrUndefined(complete)){var func=eval(complete);"function"==typeof func&&func(sender,data)}}},$(document).ready($.hood.Inline.Init),$.hood.Modals={Open:$.hood.Inline.Modal},$.hood||($.hood={}),$.hood.Media={Init:function(){$("body").on("click",".media-delete",$.hood.Media.Delete),$("body").on("click",".media-directories-delete",$.hood.Media.Directories.Delete),$.hood.Media.Upload.Init(),$.hood.Media.Actions.Init()},Loaded:function(e){$.hood.Loader(!1)},BladeLoaded:function(e){$.hood.Media.LoadMediaPlayers()},Reload:function(e){$.hood.Inline.Reload($("#media-list"),e)},ReloadDirectories:function(e){$.hood.Inline.Reload($("#media-directories-list"),e)},Actions:{Init:function(){$("body").on("click",".hood-image-attach",$.hood.Media.Actions.Load.Attach),$("body").on("click",".hood-image-clear",$.hood.Media.Actions.Complete.Clear),$("body").on("click",".hood-image-insert",$.hood.Media.Actions.Load.Insert),$("body").on("click",".hood-media-select",$.hood.Media.Actions.Load.Select)},Target:null,Json:null,Current:{Attach:null},Load:{Attach:function(e){e.preventDefault(),$.hood.Media.Actions.Target=$($(this).data("tag")),$.hood.Media.Actions.Json=$($(this).data("json")),$.hood.Inline.Modal($(this).data("url"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-attach"),$("body").on("click",".media-attach",$.hood.Media.Actions.Complete.Attach)}),$.hood.Media.Upload.Init()})},Insert:function(e){var t=$("#"+e.id);t.data("imagesUrl")&&e.addButton("hoodimage",{text:"Insert image...",icon:!1,onclick:$.proxy(function(t){$.hood.Inline.Modal($(this).data("imagesUrl"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-insert"),$("body").on("click",".media-insert",$.proxy($.hood.Media.Actions.Complete.Insert,e))}),$.hood.Media.Upload.Init()})},t)})},Select:function(e){$.hood.Media.Actions.Target=$($(this).data("target")),$.hood.Inline.Modal($(this).data("url"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-select"),$("body").on("click",".media-select",$.hood.Media.Actions.Complete.Select)}),$.hood.Media.Upload.Init()})}},Complete:{Attach:function(e){e.preventDefault();var t=$.hood.Media.Actions.Target,o=$.hood.Media.Actions.Json;$.post($(this).data("url"),function(e){if($.hood.Helpers.ProcessResponse(e),e.Success){var n=e.Media.Icon;"Image"===e.Media.GeneralFileType&&(n=e.Media.MediumUrl),$.hood.Helpers.IsNullOrUndefined(t)||(t.css({"background-image":"url("+n+")"}),t.find("img").attr("src",n),t.removeClass("loading")), | ||
$.hood.Helpers.IsNullOrUndefined(o)||o.val(e.MediaJson)}}).done(function(){$("#media-select-modal").modal("hide")}).fail($.hood.Inline.HandleError)},Insert:function(e){var t=$(e.target);this.insertContent('<img alt="'+t.data("title")+'" src="'+t.data("url")+'"/>'),$.hood.Inline.CloseModal()},Select:function(e){var t=$(this).data("url"),o=$.hood.Media.Actions.Target;$(o).each(function(){$(this).is("input")?$(this).val(t):($(this).attr("src",t),$(this).css({"background-image":"url("+t+")"}),$(this).find("img").attr("src",t))}),$.hood.Alerts.Success("Image URL has been inserted.<br /><strong>Remember to press save!</strong>"),$("#media-select-modal").modal("hide")},Clear:function(e){e.preventDefault();var t=$($(this).data("tag")),o=$($(this).data("json"));$.post($(this).data("url"),function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&(icon=e.Media.Icon,"Image"===e.Media.GeneralFileType&&(icon=e.Media.MediumUrl),$.hood.Helpers.IsNullOrUndefined(t)||(t.css({"background-image":"url("+icon+")"}),t.find("img").attr("src",icon),t.removeClass("loading")),$.hood.Helpers.IsNullOrUndefined(o)||o.val(e.Json))}).fail($.hood.Inline.HandleError)}},RefreshImage:function(e,t,o){var n=$(e);n.addClass("loading"),$.get(t,{id:o},$.proxy(function(e){n.css({"background-image":"url("+e.SmallUrl+")"}),n.find("img").attr("src",e.SmallUrl),n.removeClass("loading")},this))}},Upload:{Init:function(){if($("#media-add").doesExist()){$("#media-total-progress").hide(),Dropzone.autoDiscover=!1;var e=new Dropzone("#media-upload",{url:$.hood.Media.Upload.UploadUrl,thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:!1,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!"});e.on("success",function(e,t){$.hood.Helpers.ProcessResponse(t)}),e.on("addedfile",function(e){$("#media-total-progress .progress-bar").css({width:"0%"}),$("#media-total-progress .progress-bar .percentage").html("0%")}),e.on("totaluploadprogress",function(e){$("#media-total-progress .progress-bar").css({width:e+"%"}),$("#media-total-progress .progress-bar .percentage").html(e+"%")}),e.on("sending",function(e){$("#media-total-progress").fadeIn(),$("#media-total-progress .progress-bar").css({width:"0%"}),$("#media-total-progress .progress-bar .percentage").html("0%")}),e.on("complete",function(e){$.hood.Media.Reload()}),e.on("queuecomplete",function(e){$("#media-total-progress").hide(),$.hood.Media.Reload()})}},UploadUrl:function(){return $("#media-upload").data("url")+"?directoryId="+$("#media-list > #upload-directory-id").val()}},Delete:function(e){var t=$(this),o=function(e){e&&$.post("/admin/media/delete",{id:t.data("id")},function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&($.hood.Media.Reload(),$(".modal-backdrop").remove(),$(".modal").modal("hide"))})};$.hood.Alerts.Confirm("The media file will be permanently removed. This cannot be undone.","Are you sure?",o,"warning",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> Ensure this file is not attached to any posts, pages or features of the site, or it will appear as a broken image or file.</span>',"Ok","Cancel")},RestrictDir:function(){var e=/[^0-9A-Za-z- ]*/g,t=$(this).val(),o=t.replace(e,"");t!==o&&$(this).val(o)},Directories:{Editor:function(){$("#content-directories-edit-form").hoodValidator({validationRules:{DisplayName:{required:!0},Slug:{required:!0}},submitButtonTag:$("#content-directories-edit-submit"),submitUrl:$("#content-directories-edit-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Media.ReloadDirectories(),$.hood.Media.Reload()}})},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Media.ReloadDirectories(),$.hood.Media.Reload()})};$.hood.Alerts.Confirm("The directory and all files will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle mr-2"></i><strong>This cannot be undone!</strong><br />Ensure these files are not attached to any posts, pages or features of the site, or it will appear as a broken image or file.</span>')}},Players:{},LoadMediaPlayers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".hood-media",t={techOrder:["azureHtml5JS","flashSS","html5FairPlayHLS","silverlightSS","html5"],nativeControlsForTouch:!1,controls:!0,autoplay:!1,seeking:!0};$(e).each(function(){try{if(player=$.hood.Media.Players[$(this).data("id")],player)try{player.dispose()}catch(e){console.log("There was a problem disposing the old media player: ".concat(e))}$.hood.Media.Players[$(this).data("id")]=amp($(this).attr("id"),t),player=$.hood.Media.Players[$(this).data("id")],player.src([{src:$(this).data("file"),type:$(this).data("type")}])}catch(e){console.log("There was a problem playing the media file: ".concat(e))}})}},$(document).ready($.hood.Media.Init),$.window=$(window),$.hood||($.hood={}),$.hood.App={Options:{Header:{Target:"#header",Sticky:!0,StickyClass:"sticky-header"},Alerts:!0,Colorbox:!0,ContactForms:!0},Init:function(e){$.hood.App.Options=$.extend($.hood.App.Options,e||{}),e&&e.Header&&($.hood.App.Options.Header=$.extend($.hood.App.Options.Header,e.Header||{})),$.hood.App.Options.Header.Sticky&&$.hood.App.Header.Init(),$.hood.App.Options.ContactForms&&$.hood.App.ContactForms.Init(),$.hood.App.Options.Alerts&&$.hood.App.Alerts(),$.hood.App.Options.Colorbox&&$.hood.App.Colorbox()},Header:{Init:function(){$.hood.App.Options.Header.Sticky&&($.hood.App.Header.StickyMenu(),$.window.on("scroll",function(){$.hood.App.Header.StickyMenu()}))},StickyMenu:function(){var e=0,t=$($.hood.App.Options.Header.Target);t.length>0&&(e=t.offset().top);var o=t.height(),n=$.window.height()+2*o,a=$(document).height();$.window.scrollTop()>e&&a>n?t.addClass($.hood.App.Options.Header.StickyClass):$.hood.App.Header.RemoveStickyness()},RemoveStickyness:function(){var e=$($.hood.App.Options.Header.Target);e.hasClass($.hood.App.Options.Header.StickyClass)&&e.removeClass($.hood.App.Options.Header.StickyClass)}},ContactForms:{Init:function(){$(".contact-form .thank-you").hide(),$(".contact-form .form-submit").show(),$("body").on("submit",".contact-form",function(e){return e.preventDefault(),$(this).addClass("loading"),$.hood.App.ContactForms.Submit(this),!1})},Submit:function(e){var t=$(e);return t.valid()&&$.post(t.attr("action"),t.serialize(),function(e){e.Success?(t.attr("data-redirect")&&(window.location=t.attr("data-redirect")),t.attr("data-alert-message")&&$.hood.Alerts.Success(t.attr("data-alert-message"),"Success",null,!0),t.find(".form").hide(),t.find(".thank-you").show()):t.attr("data-alert-error")?$.hood.Alerts.Error(t.attr("data-alert-error"),"Error",null,!0):$.hood.Alerts.Error("There was an error sending the message: "+e.Errors,"Error",null,!0),t.removeClass("loading")}),!1}},Alerts:function(){$(".alert.auto-dismiss").fadeTo(5e3,500).slideUp(500,function(){$(".alert.auto-dismiss").slideUp(500)})},Colorbox:function(){$(".colorbox").colorbox({rel:"gallery",maxWidth:"95%",maxHeight:"95%"}),$(".colorbox-iframe").colorbox({iframe:!0,maxWidth:"95%",maxHeight:"95%",innerWidth:640,innerHeight:390})},Property:{Loaded:function(e){$.hood.Loader(!1),$.hood.Google.ClusteredMap()},Reload:function(e){$("#property-list").doesExist()&&$.hood.Inline.Reload($("#property-list"),e)}}}; |
@@ -180,3 +180,3 @@ if (!$.hood) | ||
var markerCluster = new MarkerClusterer(map, markers, { | ||
imagePath: 'https://cdn.jsdelivr.net/npm/hoodcms@4.0.1/images/maps/m', | ||
imagePath: 'https://cdn.jsdelivr.net/npm/hoodcms@4.1.1/images/maps/m', | ||
maxZoom: 15 | ||
@@ -183,0 +183,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
"use strict";function initGoogleMapsComplete(){$("#address-autocomplete").length>0&&$.hood.Google.Addresses.InitAutocomplete(),$.hood.Google.Maps(),$.hood.Google.ClusteredMap();try{initMap()}catch(e){$.noop()}}$.hood||($.hood={}),$.hood.Google={Maps:function(){$(".google-map").each(function(){var e=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:e,scrollwheel:!1});new google.maps.Marker({position:e,map:o,title:$(this).data("marker")});$(window).resize(function(){google.maps.event.trigger(o,"resize")}),google.maps.event.trigger(o,"resize")})},Addresses:{AddressForm:{QuickName:"{route}, {postal_town}, {postal_code}",Number:"{street_number}",Address1:"{route}",Address2:"{locality}",City:"{postal_town}",County:"{administrative_area_level_2}",Country:"{country}",Postcode:"{postal_code}"},placeSearch:null,place:null,autocomplete:null,InitAutocomplete:function(){this.autocomplete=new google.maps.places.Autocomplete(document.getElementById("address-autocomplete"),{types:["geocode"]}),this.autocomplete.addListener("place_changed",$.hood.Google.Addresses.FillInAddress)},FillInAddress:function(){$.hood.Google.Addresses.place=$.hood.Google.Addresses.autocomplete.getPlace();for(var e in $.hood.Google.Addresses.AddressForm)if($("#"+e).doesExist()){$("#"+e).val("");var o=$.hood.Google.Addresses.AddressForm[e],a=$.hood.Google.GetPlaceholders(o);for(var t in a)o=o.replace("{"+a[t]+"}",$.hood.Google.Addresses.GetValueFromAddressComponents(a[t]));o.contains("undefined")||$("#"+e).val(o)}$("#Latitude").val($.hood.Google.Addresses.place.geometry.location.lat),$("#Longitude").val($.hood.Google.Addresses.place.geometry.location.lng)},GetValueFromAddressComponents:function(e){for(var o=0;o<$.hood.Google.Addresses.place.address_components.length;o++){var a=$.hood.Google.Addresses.place.address_components[o].types[0];if(a===e)return $.hood.Google.Addresses.place.address_components[o].long_name}},GeoLocate:function(){navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(e){var o={lat:e.coords.latitude,lng:e.coords.longitude},a=new google.maps.Circle({center:o,radius:e.coords.accuracy});$.hood.Google.Addresses.autocomplete.setBounds(a.getBounds())})}},ClusteredMap:function ClusteredMap(){var mapElement=$("#clustered-map");if(mapElement.length){var scrollWheel=!1;mapElement.attr("data-scrollwheel")&&(scrollWheel=mapElement.data("scrollwheel"));var zoom=!1;mapElement.attr("data-zoom")&&(zoom=mapElement.data("zoom"));var map=new google.maps.Map(document.getElementById("clustered-map"),{zoom:zoom,maxZoom:18,scrollwheel:scrollWheel,center:{lat:mapElement.data("lat"),lng:mapElement.data("long")}}),oms=new OverlappingMarkerSpiderfier(map,{markersWontMove:!0,markersWontHide:!0,basicFormatEvents:!0,circleFootSeparation:80,spiralFootSeparation:80}),iconSize=new google.maps.Size(30,41),labels="ABCDEFGHIJKLMNOPQRSTUVWXYZ",locations=mapElement.data("locations"),clickFunction=mapElement.data("click"),markers=locations.map(function(location,i){var marker=new google.maps.Marker({position:new google.maps.LatLng(location.Latitude,location.Longitude),optimized:!isIE});marker.setIcon({url:mapElement.data("marker"),size:iconSize,scaledSize:iconSize}),google.maps.event.addListener(marker,"spider_click",function(e){func=clickFunction+"("+location.AssociatedId+")",eval(func)});var icon1=mapElement.data("marker"),icon2=mapElement.data("highlight"),info='<div class="google-popup"><img src="'+location.ImageUrl+'" class="map-image" /><p>'+location.Address1+", "+location.Postcode+"</p><p>"+location.Description+"</p></div>",infowindow=new google.maps.InfoWindow({content:info});return google.maps.event.addListener(marker,"mouseover",function(){infowindow.open(map,this),marker.setIcon(icon2)}),google.maps.event.addListener(marker,"mouseout",function(){infowindow.close(),marker.setIcon(icon1)}),oms.addMarker(marker),marker}),markerCluster=new MarkerClusterer(map,markers,{imagePath:"https://cdn.jsdelivr.net/npm/hoodcms@4.0.1/images/maps/m",maxZoom:15})}},GetPlaceholders:function(e){for(var o=/\{(\w+)\}/g,a=[];match===o.exec(e);)a.push(match[1]);return a}}; | ||
"use strict";function initGoogleMapsComplete(){$("#address-autocomplete").length>0&&$.hood.Google.Addresses.InitAutocomplete(),$.hood.Google.Maps(),$.hood.Google.ClusteredMap();try{initMap()}catch(e){$.noop()}}$.hood||($.hood={}),$.hood.Google={Maps:function(){$(".google-map").each(function(){var e=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:e,scrollwheel:!1});new google.maps.Marker({position:e,map:o,title:$(this).data("marker")});$(window).resize(function(){google.maps.event.trigger(o,"resize")}),google.maps.event.trigger(o,"resize")})},Addresses:{AddressForm:{QuickName:"{route}, {postal_town}, {postal_code}",Number:"{street_number}",Address1:"{route}",Address2:"{locality}",City:"{postal_town}",County:"{administrative_area_level_2}",Country:"{country}",Postcode:"{postal_code}"},placeSearch:null,place:null,autocomplete:null,InitAutocomplete:function(){this.autocomplete=new google.maps.places.Autocomplete(document.getElementById("address-autocomplete"),{types:["geocode"]}),this.autocomplete.addListener("place_changed",$.hood.Google.Addresses.FillInAddress)},FillInAddress:function(){$.hood.Google.Addresses.place=$.hood.Google.Addresses.autocomplete.getPlace();for(var e in $.hood.Google.Addresses.AddressForm)if($("#"+e).doesExist()){$("#"+e).val("");var o=$.hood.Google.Addresses.AddressForm[e],a=$.hood.Google.GetPlaceholders(o);for(var t in a)o=o.replace("{"+a[t]+"}",$.hood.Google.Addresses.GetValueFromAddressComponents(a[t]));o.contains("undefined")||$("#"+e).val(o)}$("#Latitude").val($.hood.Google.Addresses.place.geometry.location.lat),$("#Longitude").val($.hood.Google.Addresses.place.geometry.location.lng)},GetValueFromAddressComponents:function(e){for(var o=0;o<$.hood.Google.Addresses.place.address_components.length;o++){if($.hood.Google.Addresses.place.address_components[o].types[0]===e)return $.hood.Google.Addresses.place.address_components[o].long_name}},GeoLocate:function(){navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(e){var o={lat:e.coords.latitude,lng:e.coords.longitude},a=new google.maps.Circle({center:o,radius:e.coords.accuracy});$.hood.Google.Addresses.autocomplete.setBounds(a.getBounds())})}},ClusteredMap:function ClusteredMap(){var mapElement=$("#clustered-map");if(mapElement.length){var scrollWheel=!1;mapElement.attr("data-scrollwheel")&&(scrollWheel=mapElement.data("scrollwheel"));var zoom=!1;mapElement.attr("data-zoom")&&(zoom=mapElement.data("zoom"));var map=new google.maps.Map(document.getElementById("clustered-map"),{zoom:zoom,maxZoom:18,scrollwheel:scrollWheel,center:{lat:mapElement.data("lat"),lng:mapElement.data("long")}}),oms=new OverlappingMarkerSpiderfier(map,{markersWontMove:!0,markersWontHide:!0,basicFormatEvents:!0,circleFootSeparation:80,spiralFootSeparation:80}),iconSize=new google.maps.Size(30,41),labels="ABCDEFGHIJKLMNOPQRSTUVWXYZ",locations=mapElement.data("locations"),clickFunction=mapElement.data("click"),markers=locations.map(function(location,i){var marker=new google.maps.Marker({position:new google.maps.LatLng(location.Latitude,location.Longitude),optimized:!isIE});marker.setIcon({url:mapElement.data("marker"),size:iconSize,scaledSize:iconSize}),google.maps.event.addListener(marker,"spider_click",function(e){func=clickFunction+"("+location.AssociatedId+")",eval(func)});var icon1=mapElement.data("marker"),icon2=mapElement.data("highlight"),info='<div class="google-popup"><img src="'+location.ImageUrl+'" class="map-image" /><p>'+location.Address1+", "+location.Postcode+"</p><p>"+location.Description+"</p></div>",infowindow=new google.maps.InfoWindow({content:info});return google.maps.event.addListener(marker,"mouseover",function(){infowindow.open(map,this),marker.setIcon(icon2)}),google.maps.event.addListener(marker,"mouseout",function(){infowindow.close(),marker.setIcon(icon1)}),oms.addMarker(marker),marker}),markerCluster=new MarkerClusterer(map,markers,{imagePath:"https://cdn.jsdelivr.net/npm/hoodcms@4.1.1/images/maps/m",maxZoom:15})}},GetPlaceholders:function(e){for(var o=/\{(\w+)\}/g,a=[];match===o.exec(e);)a.push(match[1]);return a}}; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _typeof(t){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function MarkerClusterer(t,e,r){this.extend(MarkerClusterer,google.maps.OverlayView),this.map_=t,this.markers_=[],this.clusters_=[],this.sizes=[53,56,66,78,90],this.styles_=[],this.ready_=!1;var s=r||{};this.gridSize_=s.gridSize||60,this.minClusterSize_=s.minimumClusterSize||2,this.maxZoom_=s.maxZoom||null,this.styles_=s.styles||[],this.imagePath_=s.imagePath||this.MARKER_CLUSTER_IMAGE_PATH_,this.imageExtension_=s.imageExtension||this.MARKER_CLUSTER_IMAGE_EXTENSION_,this.zoomOnClick_=!0,void 0!=s.zoomOnClick&&(this.zoomOnClick_=s.zoomOnClick),this.averageCenter_=!1,void 0!=s.averageCenter&&(this.averageCenter_=s.averageCenter),this.setupStyles_(),this.setMap(t),this.prevZoom_=this.map_.getZoom();var i=this;google.maps.event.addListener(this.map_,"zoom_changed",function(){var t=i.map_.getZoom(),e=i.map_.minZoom||0,r=Math.min(i.map_.maxZoom||100,i.map_.mapTypes[i.map_.getMapTypeId()].maxZoom);t=Math.min(Math.max(t,e),r),i.prevZoom_!=t&&(i.prevZoom_=t,i.resetViewport())}),google.maps.event.addListener(this.map_,"idle",function(){i.redraw()}),e&&(e.length||Object.keys(e).length)&&this.addMarkers(e,!1)}function Cluster(t){this.markerClusterer_=t,this.map_=t.getMap(),this.gridSize_=t.getGridSize(),this.minClusterSize_=t.getMinClusterSize(),this.averageCenter_=t.isAverageCenter(),this.center_=null,this.markers_=[],this.bounds_=null,this.clusterIcon_=new ClusterIcon(this,t.getStyles(),t.getGridSize())}function ClusterIcon(t,e,r){t.getMarkerClusterer().extend(ClusterIcon,google.maps.OverlayView),this.styles_=e,this.padding_=r||0,this.cluster_=t,this.center_=null,this.map_=t.getMap(),this.div_=null,this.sums_=null,this.visible_=!1,this.setMap(this.map_)}MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_="../images/m",MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_="png",MarkerClusterer.prototype.extend=function(t,e){return function(t){for(var e in t.prototype)this.prototype[e]=t.prototype[e];return this}.apply(t,[e])},MarkerClusterer.prototype.onAdd=function(){this.setReady_(!0)},MarkerClusterer.prototype.draw=function(){},MarkerClusterer.prototype.setupStyles_=function(){if(!this.styles_.length)for(var t,e=0;t=this.sizes[e];e++)this.styles_.push({url:this.imagePath_+(e+1)+"."+this.imageExtension_,height:t,width:t})},MarkerClusterer.prototype.fitMapToMarkers=function(){for(var t,e=this.getMarkers(),r=new google.maps.LatLngBounds,s=0;t=e[s];s++)r.extend(t.getPosition());this.map_.fitBounds(r)},MarkerClusterer.prototype.setStyles=function(t){this.styles_=t},MarkerClusterer.prototype.getStyles=function(){return this.styles_},MarkerClusterer.prototype.isZoomOnClick=function(){return this.zoomOnClick_},MarkerClusterer.prototype.isAverageCenter=function(){return this.averageCenter_},MarkerClusterer.prototype.getMarkers=function(){return this.markers_},MarkerClusterer.prototype.getTotalMarkers=function(){return this.markers_.length},MarkerClusterer.prototype.setMaxZoom=function(t){this.maxZoom_=t},MarkerClusterer.prototype.getMaxZoom=function(){return this.maxZoom_},MarkerClusterer.prototype.calculator_=function(t,e){for(var r=0,s=t.length,i=s;0!==i;)i=parseInt(i/10,10),r++;return r=Math.min(r,e),{text:s,index:r}},MarkerClusterer.prototype.setCalculator=function(t){this.calculator_=t},MarkerClusterer.prototype.getCalculator=function(){return this.calculator_},MarkerClusterer.prototype.addMarkers=function(t,e){if(t.length)for(var r,s=0;r=t[s];s++)this.pushMarkerTo_(r);else if(Object.keys(t).length)for(var r in t)this.pushMarkerTo_(t[r]);e||this.redraw()},MarkerClusterer.prototype.pushMarkerTo_=function(t){if(t.isAdded=!1,t.draggable){var e=this;google.maps.event.addListener(t,"dragend",function(){t.isAdded=!1,e.repaint()})}this.markers_.push(t)},MarkerClusterer.prototype.addMarker=function(t,e){this.pushMarkerTo_(t),e||this.redraw()},MarkerClusterer.prototype.removeMarker_=function(t){var e=-1;if(this.markers_.indexOf)e=this.markers_.indexOf(t);else for(var r,s=0;r=this.markers_[s];s++)if(r==t){e=s;break}return e!=-1&&(t.setMap(null),this.markers_.splice(e,1),!0)},MarkerClusterer.prototype.removeMarker=function(t,e){var r=this.removeMarker_(t);return!(e||!r)&&(this.resetViewport(),this.redraw(),!0)},MarkerClusterer.prototype.removeMarkers=function(t,e){for(var r,s=!1,i=0;r=t[i];i++){var o=this.removeMarker_(r);s=s||o}if(!e&&s)return this.resetViewport(),this.redraw(),!0},MarkerClusterer.prototype.setReady_=function(t){this.ready_||(this.ready_=t,this.createClusters_())},MarkerClusterer.prototype.getTotalClusters=function(){return this.clusters_.length},MarkerClusterer.prototype.getMap=function(){return this.map_},MarkerClusterer.prototype.setMap=function(t){this.map_=t},MarkerClusterer.prototype.getGridSize=function(){return this.gridSize_},MarkerClusterer.prototype.setGridSize=function(t){this.gridSize_=t},MarkerClusterer.prototype.getMinClusterSize=function(){return this.minClusterSize_},MarkerClusterer.prototype.setMinClusterSize=function(t){this.minClusterSize_=t},MarkerClusterer.prototype.getExtendedBounds=function(t){var e=this.getProjection(),r=new google.maps.LatLng(t.getNorthEast().lat(),t.getNorthEast().lng()),s=new google.maps.LatLng(t.getSouthWest().lat(),t.getSouthWest().lng()),i=e.fromLatLngToDivPixel(r);i.x+=this.gridSize_,i.y-=this.gridSize_;var o=e.fromLatLngToDivPixel(s);o.x-=this.gridSize_,o.y+=this.gridSize_;var n=e.fromDivPixelToLatLng(i),a=e.fromDivPixelToLatLng(o);return t.extend(n),t.extend(a),t},MarkerClusterer.prototype.isMarkerInBounds_=function(t,e){return e.contains(t.getPosition())},MarkerClusterer.prototype.clearMarkers=function(){this.resetViewport(!0),this.markers_=[]},MarkerClusterer.prototype.resetViewport=function(t){for(var e,r=0;e=this.clusters_[r];r++)e.remove();for(var s,r=0;s=this.markers_[r];r++)s.isAdded=!1,t&&s.setMap(null);this.clusters_=[]},MarkerClusterer.prototype.repaint=function(){var t=this.clusters_.slice();this.clusters_.length=0,this.resetViewport(),this.redraw(),window.setTimeout(function(){for(var e,r=0;e=t[r];r++)e.remove()},0)},MarkerClusterer.prototype.redraw=function(){this.createClusters_()},MarkerClusterer.prototype.distanceBetweenPoints_=function(t,e){if(!t||!e)return 0;var r=6371,s=(e.lat()-t.lat())*Math.PI/180,i=(e.lng()-t.lng())*Math.PI/180,o=Math.sin(s/2)*Math.sin(s/2)+Math.cos(t.lat()*Math.PI/180)*Math.cos(e.lat()*Math.PI/180)*Math.sin(i/2)*Math.sin(i/2),n=2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)),a=r*n;return a},MarkerClusterer.prototype.addToClosestCluster_=function(t){for(var e,r=4e4,s=null,i=(t.getPosition(),0);e=this.clusters_[i];i++){var o=e.getCenter();if(o){var n=this.distanceBetweenPoints_(o,t.getPosition());n<r&&(r=n,s=e)}}if(s&&s.isMarkerInClusterBounds(t))s.addMarker(t);else{var e=new Cluster(this);e.addMarker(t),this.clusters_.push(e)}},MarkerClusterer.prototype.createClusters_=function(){if(this.ready_)for(var t,e=new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),this.map_.getBounds().getNorthEast()),r=this.getExtendedBounds(e),s=0;t=this.markers_[s];s++)!t.isAdded&&this.isMarkerInBounds_(t,r)&&this.addToClosestCluster_(t)},Cluster.prototype.isMarkerAlreadyAdded=function(t){if(this.markers_.indexOf)return this.markers_.indexOf(t)!=-1;for(var e,r=0;e=this.markers_[r];r++)if(e==t)return!0;return!1},Cluster.prototype.addMarker=function(t){if(this.isMarkerAlreadyAdded(t))return!1;if(this.center_){if(this.averageCenter_){var e=this.markers_.length+1,r=(this.center_.lat()*(e-1)+t.getPosition().lat())/e,s=(this.center_.lng()*(e-1)+t.getPosition().lng())/e;this.center_=new google.maps.LatLng(r,s),this.calculateBounds_()}}else this.center_=t.getPosition(),this.calculateBounds_();t.isAdded=!0,this.markers_.push(t);var i=this.markers_.length;if(i<this.minClusterSize_&&t.getMap()!=this.map_&&t.setMap(this.map_),i==this.minClusterSize_)for(var o=0;o<i;o++)this.markers_[o].setMap(null);return i>=this.minClusterSize_&&t.setMap(null),this.updateIcon(),!0},Cluster.prototype.getMarkerClusterer=function(){return this.markerClusterer_},Cluster.prototype.getBounds=function(){for(var t,e=new google.maps.LatLngBounds(this.center_,this.center_),r=this.getMarkers(),s=0;t=r[s];s++)e.extend(t.getPosition());return e},Cluster.prototype.remove=function(){this.clusterIcon_.remove(),this.markers_.length=0,delete this.markers_},Cluster.prototype.getSize=function(){return this.markers_.length},Cluster.prototype.getMarkers=function(){return this.markers_},Cluster.prototype.getCenter=function(){return this.center_},Cluster.prototype.calculateBounds_=function(){var t=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.markerClusterer_.getExtendedBounds(t)},Cluster.prototype.isMarkerInClusterBounds=function(t){return this.bounds_.contains(t.getPosition())},Cluster.prototype.getMap=function(){return this.map_},Cluster.prototype.updateIcon=function(){var t=this.map_.getZoom(),e=this.markerClusterer_.getMaxZoom();if(e&&t>e)for(var r,s=0;r=this.markers_[s];s++)r.setMap(this.map_);else{if(this.markers_.length<this.minClusterSize_)return void this.clusterIcon_.hide();var i=this.markerClusterer_.getStyles().length,o=this.markerClusterer_.getCalculator()(this.markers_,i);this.clusterIcon_.setCenter(this.center_),this.clusterIcon_.setSums(o),this.clusterIcon_.show()}},ClusterIcon.prototype.triggerClusterClick=function(){var t=this.cluster_.getMarkerClusterer();google.maps.event.trigger(t,"clusterclick",this.cluster_),t.isZoomOnClick()&&this.map_.fitBounds(this.cluster_.getBounds())},ClusterIcon.prototype.onAdd=function(){if(this.div_=document.createElement("DIV"),this.visible_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(t),this.div_.innerHTML=this.sums_.text}var e=this.getPanes();e.overlayMouseTarget.appendChild(this.div_);var r=this;google.maps.event.addDomListener(this.div_,"click",function(){r.triggerClusterClick()})},ClusterIcon.prototype.getPosFromLatLng_=function(t){var e=this.getProjection().fromLatLngToDivPixel(t);return e.x-=parseInt(this.width_/2,10),e.y-=parseInt(this.height_/2,10),e},ClusterIcon.prototype.draw=function(){if(this.visible_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.top=t.y+"px",this.div_.style.left=t.x+"px"}},ClusterIcon.prototype.hide=function(){this.div_&&(this.div_.style.display="none"),this.visible_=!1},ClusterIcon.prototype.show=function(){if(this.div_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(t),this.div_.style.display=""}this.visible_=!0},ClusterIcon.prototype.remove=function(){this.setMap(null)},ClusterIcon.prototype.onRemove=function(){this.div_&&this.div_.parentNode&&(this.hide(),this.div_.parentNode.removeChild(this.div_),this.div_=null)},ClusterIcon.prototype.setSums=function(t){this.sums_=t,this.text_=t.text,this.index_=t.index,this.div_&&(this.div_.innerHTML=t.text),this.useStyle()},ClusterIcon.prototype.useStyle=function(){var t=Math.max(0,this.sums_.index-1);t=Math.min(this.styles_.length-1,t);var e=this.styles_[t];this.url_=e.url,this.height_=e.height,this.width_=e.width,this.textColor_=e.textColor,this.anchor_=e.anchor,this.textSize_=e.textSize,this.backgroundPosition_=e.backgroundPosition},ClusterIcon.prototype.setCenter=function(t){this.center_=t},ClusterIcon.prototype.createCss=function(t){var e=[];e.push("background-image:url("+this.url_+");");var r=this.backgroundPosition_?this.backgroundPosition_:"0 0";e.push("background-position:"+r+";"),"object"===_typeof(this.anchor_)?("number"==typeof this.anchor_[0]&&this.anchor_[0]>0&&this.anchor_[0]<this.height_?e.push("height:"+(this.height_-this.anchor_[0])+"px; padding-top:"+this.anchor_[0]+"px;"):e.push("height:"+this.height_+"px; line-height:"+this.height_+"px;"),"number"==typeof this.anchor_[1]&&this.anchor_[1]>0&&this.anchor_[1]<this.width_?e.push("width:"+(this.width_-this.anchor_[1])+"px; padding-left:"+this.anchor_[1]+"px;"):e.push("width:"+this.width_+"px; text-align:center;")):e.push("height:"+this.height_+"px; line-height:"+this.height_+"px; width:"+this.width_+"px; text-align:center;");var s=this.textColor_?this.textColor_:"black",i=this.textSize_?this.textSize_:11;return e.push("cursor:pointer; top:"+t.y+"px; left:"+t.x+"px; color:"+s+"; position:absolute; font-size:"+i+"px; font-family:Arial,sans-serif; font-weight:bold"),e.join("")}; | ||
"use strict";function _typeof(t){"@babel/helpers - typeof";return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function MarkerClusterer(t,e,r){this.extend(MarkerClusterer,google.maps.OverlayView),this.map_=t,this.markers_=[],this.clusters_=[],this.sizes=[53,56,66,78,90],this.styles_=[],this.ready_=!1;var s=r||{};this.gridSize_=s.gridSize||60,this.minClusterSize_=s.minimumClusterSize||2,this.maxZoom_=s.maxZoom||null,this.styles_=s.styles||[],this.imagePath_=s.imagePath||this.MARKER_CLUSTER_IMAGE_PATH_,this.imageExtension_=s.imageExtension||this.MARKER_CLUSTER_IMAGE_EXTENSION_,this.zoomOnClick_=!0,void 0!=s.zoomOnClick&&(this.zoomOnClick_=s.zoomOnClick),this.averageCenter_=!1,void 0!=s.averageCenter&&(this.averageCenter_=s.averageCenter),this.setupStyles_(),this.setMap(t),this.prevZoom_=this.map_.getZoom();var i=this;google.maps.event.addListener(this.map_,"zoom_changed",function(){var t=i.map_.getZoom(),e=i.map_.minZoom||0,r=Math.min(i.map_.maxZoom||100,i.map_.mapTypes[i.map_.getMapTypeId()].maxZoom);t=Math.min(Math.max(t,e),r),i.prevZoom_!=t&&(i.prevZoom_=t,i.resetViewport())}),google.maps.event.addListener(this.map_,"idle",function(){i.redraw()}),e&&(e.length||Object.keys(e).length)&&this.addMarkers(e,!1)}function Cluster(t){this.markerClusterer_=t,this.map_=t.getMap(),this.gridSize_=t.getGridSize(),this.minClusterSize_=t.getMinClusterSize(),this.averageCenter_=t.isAverageCenter(),this.center_=null,this.markers_=[],this.bounds_=null,this.clusterIcon_=new ClusterIcon(this,t.getStyles(),t.getGridSize())}function ClusterIcon(t,e,r){t.getMarkerClusterer().extend(ClusterIcon,google.maps.OverlayView),this.styles_=e,this.padding_=r||0,this.cluster_=t,this.center_=null,this.map_=t.getMap(),this.div_=null,this.sums_=null,this.visible_=!1,this.setMap(this.map_)}MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_="../images/m",MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_="png",MarkerClusterer.prototype.extend=function(t,e){return function(t){for(var e in t.prototype)this.prototype[e]=t.prototype[e];return this}.apply(t,[e])},MarkerClusterer.prototype.onAdd=function(){this.setReady_(!0)},MarkerClusterer.prototype.draw=function(){},MarkerClusterer.prototype.setupStyles_=function(){if(!this.styles_.length)for(var t,e=0;t=this.sizes[e];e++)this.styles_.push({url:this.imagePath_+(e+1)+"."+this.imageExtension_,height:t,width:t})},MarkerClusterer.prototype.fitMapToMarkers=function(){for(var t,e=this.getMarkers(),r=new google.maps.LatLngBounds,s=0;t=e[s];s++)r.extend(t.getPosition());this.map_.fitBounds(r)},MarkerClusterer.prototype.setStyles=function(t){this.styles_=t},MarkerClusterer.prototype.getStyles=function(){return this.styles_},MarkerClusterer.prototype.isZoomOnClick=function(){return this.zoomOnClick_},MarkerClusterer.prototype.isAverageCenter=function(){return this.averageCenter_},MarkerClusterer.prototype.getMarkers=function(){return this.markers_},MarkerClusterer.prototype.getTotalMarkers=function(){return this.markers_.length},MarkerClusterer.prototype.setMaxZoom=function(t){this.maxZoom_=t},MarkerClusterer.prototype.getMaxZoom=function(){return this.maxZoom_},MarkerClusterer.prototype.calculator_=function(t,e){for(var r=0,s=t.length,i=s;0!==i;)i=parseInt(i/10,10),r++;return r=Math.min(r,e),{text:s,index:r}},MarkerClusterer.prototype.setCalculator=function(t){this.calculator_=t},MarkerClusterer.prototype.getCalculator=function(){return this.calculator_},MarkerClusterer.prototype.addMarkers=function(t,e){if(t.length)for(var r,s=0;r=t[s];s++)this.pushMarkerTo_(r);else if(Object.keys(t).length)for(var r in t)this.pushMarkerTo_(t[r]);e||this.redraw()},MarkerClusterer.prototype.pushMarkerTo_=function(t){if(t.isAdded=!1,t.draggable){var e=this;google.maps.event.addListener(t,"dragend",function(){t.isAdded=!1,e.repaint()})}this.markers_.push(t)},MarkerClusterer.prototype.addMarker=function(t,e){this.pushMarkerTo_(t),e||this.redraw()},MarkerClusterer.prototype.removeMarker_=function(t){var e=-1;if(this.markers_.indexOf)e=this.markers_.indexOf(t);else for(var r,s=0;r=this.markers_[s];s++)if(r==t){e=s;break}return-1!=e&&(t.setMap(null),this.markers_.splice(e,1),!0)},MarkerClusterer.prototype.removeMarker=function(t,e){var r=this.removeMarker_(t);return!(e||!r)&&(this.resetViewport(),this.redraw(),!0)},MarkerClusterer.prototype.removeMarkers=function(t,e){for(var r,s=!1,i=0;r=t[i];i++){var o=this.removeMarker_(r);s=s||o}if(!e&&s)return this.resetViewport(),this.redraw(),!0},MarkerClusterer.prototype.setReady_=function(t){this.ready_||(this.ready_=t,this.createClusters_())},MarkerClusterer.prototype.getTotalClusters=function(){return this.clusters_.length},MarkerClusterer.prototype.getMap=function(){return this.map_},MarkerClusterer.prototype.setMap=function(t){this.map_=t},MarkerClusterer.prototype.getGridSize=function(){return this.gridSize_},MarkerClusterer.prototype.setGridSize=function(t){this.gridSize_=t},MarkerClusterer.prototype.getMinClusterSize=function(){return this.minClusterSize_},MarkerClusterer.prototype.setMinClusterSize=function(t){this.minClusterSize_=t},MarkerClusterer.prototype.getExtendedBounds=function(t){var e=this.getProjection(),r=new google.maps.LatLng(t.getNorthEast().lat(),t.getNorthEast().lng()),s=new google.maps.LatLng(t.getSouthWest().lat(),t.getSouthWest().lng()),i=e.fromLatLngToDivPixel(r);i.x+=this.gridSize_,i.y-=this.gridSize_;var o=e.fromLatLngToDivPixel(s);o.x-=this.gridSize_,o.y+=this.gridSize_;var n=e.fromDivPixelToLatLng(i),a=e.fromDivPixelToLatLng(o);return t.extend(n),t.extend(a),t},MarkerClusterer.prototype.isMarkerInBounds_=function(t,e){return e.contains(t.getPosition())},MarkerClusterer.prototype.clearMarkers=function(){this.resetViewport(!0),this.markers_=[]},MarkerClusterer.prototype.resetViewport=function(t){for(var e,r=0;e=this.clusters_[r];r++)e.remove();for(var s,r=0;s=this.markers_[r];r++)s.isAdded=!1,t&&s.setMap(null);this.clusters_=[]},MarkerClusterer.prototype.repaint=function(){var t=this.clusters_.slice();this.clusters_.length=0,this.resetViewport(),this.redraw(),window.setTimeout(function(){for(var e,r=0;e=t[r];r++)e.remove()},0)},MarkerClusterer.prototype.redraw=function(){this.createClusters_()},MarkerClusterer.prototype.distanceBetweenPoints_=function(t,e){if(!t||!e)return 0;var r=(e.lat()-t.lat())*Math.PI/180,s=(e.lng()-t.lng())*Math.PI/180,i=Math.sin(r/2)*Math.sin(r/2)+Math.cos(t.lat()*Math.PI/180)*Math.cos(e.lat()*Math.PI/180)*Math.sin(s/2)*Math.sin(s/2);return 2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i))*6371},MarkerClusterer.prototype.addToClosestCluster_=function(t){for(var e,r=4e4,s=null,i=(t.getPosition(),0);e=this.clusters_[i];i++){var o=e.getCenter();if(o){var n=this.distanceBetweenPoints_(o,t.getPosition());n<r&&(r=n,s=e)}}if(s&&s.isMarkerInClusterBounds(t))s.addMarker(t);else{var e=new Cluster(this);e.addMarker(t),this.clusters_.push(e)}},MarkerClusterer.prototype.createClusters_=function(){if(this.ready_)for(var t,e=new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),this.map_.getBounds().getNorthEast()),r=this.getExtendedBounds(e),s=0;t=this.markers_[s];s++)!t.isAdded&&this.isMarkerInBounds_(t,r)&&this.addToClosestCluster_(t)},Cluster.prototype.isMarkerAlreadyAdded=function(t){if(this.markers_.indexOf)return-1!=this.markers_.indexOf(t);for(var e,r=0;e=this.markers_[r];r++)if(e==t)return!0;return!1},Cluster.prototype.addMarker=function(t){if(this.isMarkerAlreadyAdded(t))return!1;if(this.center_){if(this.averageCenter_){var e=this.markers_.length+1,r=(this.center_.lat()*(e-1)+t.getPosition().lat())/e,s=(this.center_.lng()*(e-1)+t.getPosition().lng())/e;this.center_=new google.maps.LatLng(r,s),this.calculateBounds_()}}else this.center_=t.getPosition(),this.calculateBounds_();t.isAdded=!0,this.markers_.push(t);var i=this.markers_.length;if(i<this.minClusterSize_&&t.getMap()!=this.map_&&t.setMap(this.map_),i==this.minClusterSize_)for(var o=0;o<i;o++)this.markers_[o].setMap(null);return i>=this.minClusterSize_&&t.setMap(null),this.updateIcon(),!0},Cluster.prototype.getMarkerClusterer=function(){return this.markerClusterer_},Cluster.prototype.getBounds=function(){for(var t,e=new google.maps.LatLngBounds(this.center_,this.center_),r=this.getMarkers(),s=0;t=r[s];s++)e.extend(t.getPosition());return e},Cluster.prototype.remove=function(){this.clusterIcon_.remove(),this.markers_.length=0,delete this.markers_},Cluster.prototype.getSize=function(){return this.markers_.length},Cluster.prototype.getMarkers=function(){return this.markers_},Cluster.prototype.getCenter=function(){return this.center_},Cluster.prototype.calculateBounds_=function(){var t=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.markerClusterer_.getExtendedBounds(t)},Cluster.prototype.isMarkerInClusterBounds=function(t){return this.bounds_.contains(t.getPosition())},Cluster.prototype.getMap=function(){return this.map_},Cluster.prototype.updateIcon=function(){var t=this.map_.getZoom(),e=this.markerClusterer_.getMaxZoom();if(e&&t>e)for(var r,s=0;r=this.markers_[s];s++)r.setMap(this.map_);else{if(this.markers_.length<this.minClusterSize_)return void this.clusterIcon_.hide();var i=this.markerClusterer_.getStyles().length,o=this.markerClusterer_.getCalculator()(this.markers_,i);this.clusterIcon_.setCenter(this.center_),this.clusterIcon_.setSums(o),this.clusterIcon_.show()}},ClusterIcon.prototype.triggerClusterClick=function(){var t=this.cluster_.getMarkerClusterer();google.maps.event.trigger(t,"clusterclick",this.cluster_),t.isZoomOnClick()&&this.map_.fitBounds(this.cluster_.getBounds())},ClusterIcon.prototype.onAdd=function(){if(this.div_=document.createElement("DIV"),this.visible_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(t),this.div_.innerHTML=this.sums_.text}this.getPanes().overlayMouseTarget.appendChild(this.div_);var e=this;google.maps.event.addDomListener(this.div_,"click",function(){e.triggerClusterClick()})},ClusterIcon.prototype.getPosFromLatLng_=function(t){var e=this.getProjection().fromLatLngToDivPixel(t);return e.x-=parseInt(this.width_/2,10),e.y-=parseInt(this.height_/2,10),e},ClusterIcon.prototype.draw=function(){if(this.visible_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.top=t.y+"px",this.div_.style.left=t.x+"px"}},ClusterIcon.prototype.hide=function(){this.div_&&(this.div_.style.display="none"),this.visible_=!1},ClusterIcon.prototype.show=function(){if(this.div_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(t),this.div_.style.display=""}this.visible_=!0},ClusterIcon.prototype.remove=function(){this.setMap(null)},ClusterIcon.prototype.onRemove=function(){this.div_&&this.div_.parentNode&&(this.hide(),this.div_.parentNode.removeChild(this.div_),this.div_=null)},ClusterIcon.prototype.setSums=function(t){this.sums_=t,this.text_=t.text,this.index_=t.index,this.div_&&(this.div_.innerHTML=t.text),this.useStyle()},ClusterIcon.prototype.useStyle=function(){var t=Math.max(0,this.sums_.index-1);t=Math.min(this.styles_.length-1,t);var e=this.styles_[t];this.url_=e.url,this.height_=e.height,this.width_=e.width,this.textColor_=e.textColor,this.anchor_=e.anchor,this.textSize_=e.textSize,this.backgroundPosition_=e.backgroundPosition},ClusterIcon.prototype.setCenter=function(t){this.center_=t},ClusterIcon.prototype.createCss=function(t){var e=[];e.push("background-image:url("+this.url_+");");var r=this.backgroundPosition_?this.backgroundPosition_:"0 0";e.push("background-position:"+r+";"),"object"===_typeof(this.anchor_)?("number"==typeof this.anchor_[0]&&this.anchor_[0]>0&&this.anchor_[0]<this.height_?e.push("height:"+(this.height_-this.anchor_[0])+"px; padding-top:"+this.anchor_[0]+"px;"):e.push("height:"+this.height_+"px; line-height:"+this.height_+"px;"),"number"==typeof this.anchor_[1]&&this.anchor_[1]>0&&this.anchor_[1]<this.width_?e.push("width:"+(this.width_-this.anchor_[1])+"px; padding-left:"+this.anchor_[1]+"px;"):e.push("width:"+this.width_+"px; text-align:center;")):e.push("height:"+this.height_+"px; line-height:"+this.height_+"px; width:"+this.width_+"px; text-align:center;");var s=this.textColor_?this.textColor_:"black",i=this.textSize_?this.textSize_:11;return e.push("cursor:pointer; top:"+t.y+"px; left:"+t.x+"px; color:"+s+"; position:absolute; font-size:"+i+"px; font-family:Arial,sans-serif; font-weight:bold"),e.join("")}; |
@@ -401,3 +401,3 @@ "use strict"; | ||
eventName = 'on' + eventName; | ||
var isSupported = eventName in el; | ||
var isSupported = (eventName in el); | ||
@@ -924,2 +924,3 @@ if (!isSupported) { | ||
$(elemId).val('#' + result); | ||
$(elemId).change(); | ||
}; | ||
@@ -972,2 +973,3 @@ | ||
$(elemId).val(''); | ||
$(elemId).change(); | ||
}).on('change', updateColorFieldValue); | ||
@@ -974,0 +976,0 @@ pickrs.push(pickr); |
@@ -1,2 +0,2 @@ | ||
"use strict";var console={};console.log=function(){},window.console=console,$.hood||($.hood={}),$.body=$("body");var console=window.console||{};console.log=console.log||function(){},console.warn=console.warn||function(){},console.error=console.error||function(){},console.info=console.info||function(){},$.fn.exists=function(){return $(this).length},$.fn.doesExist=function(){return $(this).length},$.fn.restrictToSlug=function(e){var t=$(this),o=e||/[^0-9a-zA-Z]*/g,n=function(){var e=$(this).val(),t=e.replace(o,"");e!==t&&$(this).val(t)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".restrict-to-slug").restrictToSlug(),$.fn.restrictToPageSlug=function(e){var t=$(this),o=e||/[^0-9a-zA-Z-//]*/g,n=function(){var e=$(this).val(),t=e.replace(o,"");if((t.match(new RegExp("/","g"))||[]).length>4){var n=t.lastIndexOf("/");t=t.substring(0,n)+t.substring(n+1),$.hood.Alerts.Warning("You can only have up to 4 '/' characters in a url slug.")}e!==t&&$(this).val(t)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".restrict-to-page-slug").restrictToPageSlug(),$.fn.restrictToMetaSlug=function(e){var t=$(this),o=e||/[^0-9a-zA-Z.]*/g,n=function(){var e=$(this).val(),t=e.replace(o,"");if((t.match(new RegExp(".","g"))||[]).length>1){var n=t.lastIndexOf(".");t=t.substring(0,n)+t.substring(n+1),$.hood.Alerts.Warning("You can only have up to 1 '.' characters in a meta slug.")}e!==t&&$(this).val(t)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".restrict-to-meta-slug").restrictToMetaSlug(),$.fn.characterCounter=function(e){var t=$(this),o=function(){var e=$(this).data("counter"),t=Number($(this).attr("maxlength")),o=$(this).val().length;$(e).text(t-o);var n="text-success";t-o<t/10&&(n="text-danger"),$(e).parent().removeClass("text-success").removeClass("text-danger").addClass(n)};t.on("keyup",o),t.on("paste",o),t.on("change",o)},$(".character-counter").characterCounter(),$(".character-counter").trigger("change"),$.fn.addLoader=function(){$(this).data("loadercontent",$(this).html()),$(this).addClass("loading").append('<i class="fa fa-refresh fa-spin m-l-sm"></i>')},$.fn.removeLoader=function(){$(this).empty().html($(this).data("loadercontent")),$(this).removeClass("loading")},$.fn.warningAlert=function(){var e=$(this),t=function(e){e.preventDefault();var t=function(t){if(t){var o=$(e.currentTarget).attr("href");window.location=o}};return $.hood.Alerts.Confirm($(e.currentTarget).data("warning"),$(e.currentTarget).data("title"),t,"warning",$(e.currentTarget).data("footer"),"Ok","Cancel"),!1};e.on("click",t)},$(".warning-alert").warningAlert(),$.commonHeight=function(e,t){var o=0;e.children(t).each(function(){var e=$(this).children();e.hasClass("max-height")?o=e.outerHeight():e.outerHeight()>o&&(o=e.outerHeight())}),e.children(t).each(function(){$(this).height(o)})},$.loadCss=function(e,t){$("link#"+e).length||$("<link/>",{id:e,rel:"stylesheet",type:"text/css",href:t}).appendTo("head")},$.getUrlVars=function(){for(var e,t=[],o=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),n=0;n<o.length;n++)e=o[n].split("="),t.push(e[0]),t[e[0]]=e[1];return t},$.decodeUrl=function(e){return decodeURIComponent(e).replace("+"," ")},$.numberWithCommas=function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},$.validator&&($.validator.addMethod("time",function(e,t){return this.optional(t)||/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$/i.test(e)},"Please enter a valid time."),$.validator.addMethod("ukdate",function(e,t){return e.match(/^\d\d?\/\d\d?\/\d\d\d\d$/)},"Please enter a date in the format dd/mm/yyyy.")),$.mobile={Android:function(){return navigator.userAgent.match(/Android/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)},Any:function(){return $.mobile.Android()||$.mobile.BlackBerry()||$.mobile.iOS()||$.mobile.Opera()||$.mobile.Windows()}},$.mobile.Android?$.mobile.BlackBerry?$.mobile.iOS?$.mobile.Opera?$.mobile.Windows?($.body.addClass("desktop-device"),$.device="desktop"):($.body.addClass("windows-device"),$.device="windows"):($.body.addClass("opera-device"),$.device="opera"):($.body.addClass("ios-device"),$.device="ios"):($.body.addClass("blackberry-device"),$.device="blackberry"):($.body.addClass("android-device"),$.device="android"),function(){var e={password:"0",username:"0"};$("body").on("change",".prevent-autocomplete",function(t){var o=$(this).attr("id");"0"!==e[o]&&e[o]===$(this).val()||$(this).val("")}),$("body").on("keyup",".prevent-autocomplete",function(t){var o=$(this).attr("id");e[o]=$(this).val()})}(),function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),o}return"function"!=typeof window.CustomEvent&&(e.prototype=window.Event.prototype,void(window.CustomEvent=e))}(),$.hood.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"}],$.hood.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"}],new CustomEvent("loader-show"),new CustomEvent("loader-hide"),$.hood.Loader=function(e){e?$("body").trigger("loader-show"):$("body").trigger("loader-hide")},$.hood||($.hood={}),$.hood.Helpers={IsNullOrUndefined:function(e){var t=!1;return null!==e&&"undefined"!=typeof e&&""!==e||(t=!0),t},IsSet:function(e){var t=!1;return null!==e&&"undefined"!=typeof e&&""!==e||(t=!0),!t},IsEventSupported:function(e){var t=document.createElement("div");e="on"+e;var o=e in t;return o||(t.setAttribute(e,"return;"),o="function"==typeof t[e]),t=null,o},IsFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},IsUrlExternal:function(e){var t=e.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);return"string"==typeof t[1]&&t[1].length>0&&t[1].toLowerCase()!==location.protocol||"string"==typeof t[2]&&t[2].length>0&&t[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host},IsInIframe:function(){try{return window.self!==window.top}catch(e){return!0}},HtmlEncode:function(e){return $("<div/>").text(e).html()},HtmlDecode:function(e){return $("<div/>").html(e).text()},FormatCurrency:function(e,t){return t+" "+e.toFixed(2).replace(/./g,function(e,t,o){return t>0&&"."!==e&&(o.length-t)%3===0?","+e:e})},FormatKilobytes:function(e){return e/=1024,e.toFixed(2).replace(/./g,function(e,t,o){return t>0&&"."!==e&&(o.length-t)%3===0?","+e:e})},FormatMegabytes:function(e){return e/=1024,e/=1024,currency+" "+e.toFixed(2).replace(/./g,function(e,t,o){return t>0&&"."!==e&&(o.length-t)%3===0?","+e:e})},FallbackCopyTextToClipboard:function(e){var t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch(e){console.error("Oops, unable to copy",e)}document.body.removeChild(t)},CopyTextToClipboard:function(e){return navigator.clipboard?void navigator.clipboard.writeText(e).then(function(){},function(e){console.error("Could not copy text: ",e)}):void $.hood.Handlers.FallbackCopyTextToClipboard(e)},ProcessResponse:function(e){var t="";e.Title&&(t="<strong>".concat(e.Title,"</strong><br />")),e.Success?$.hood.Alerts.Success("".concat(t).concat(e.Message)):$.hood.Alerts.Error("".concat(t).concat(e.Errors))},GetQueryStringParamByName:function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)","i"),o=t.exec(location.search);return null===o?"":decodeURIComponent(o[1].replace(/\+/g," "))},InsertQueryStringParam:function(e,t){e=escape(e),t=escape(t);var o=document.location.search.substr(1).split("&");if(""===o)document.location.search="?"+e+"="+t;else{for(var n,a=o.length;a--;)if(n=o[a].split("="),n[0]===e){n[1]=t,o[a]=n.join("=");break}a<0&&(o[o.length]=[e,t].join("=")),document.location.search=o.join("&")}},InsertQueryStringParamToUrl:function(e,t,o){t=escape(t),o=escape(o);var n=e.search.substr(1).split("&");if(""===n)e.search="?"+t+"="+o;else{for(var a,i=n.length;i--;)if(a=n[i].split("="),a[0]===t){a[1]=o,n[i]=a.join("=");break}i<0&&(n[n.length]=[t,o].join("=")),e.search=n.join("&")}return e},UrlToLocationObject:function(e){var t=document.createElement("a");return t.href=e,t},FindAndRemoveFromArray:function(e,t,o){$.each(e,function(n,a){a[t]===o&&e.splice(n,1)})},FindAndReturnFromArray:function(e,t,o){var n=null;return $.each(e,function(e,a){a[t]===o&&(n=a)}),n},LeftPad:function(e,t){for(var o=e+"";o.length<t;)o="0"+o;return o},DateAdd:function(e,t,o){var n=new Date(e);switch(t.toLowerCase()){case"year":n.setFullYear(n.getFullYear()+o);break;case"quarter":n.setMonth(n.getMonth()+3*o);break;case"month":n.setMonth(n.getMonth()+o);break;case"week":n.setDate(n.getDate()+7*o);break;case"day":n.setDate(n.getDate()+o);break;case"hour":n.setTime(n.getTime()+36e5*o);break;case"minute":n.setTime(n.getTime()+6e4*o);break;case"second":n.setTime(n.getTime()+1e3*o);break;default:n=void 0}return n},GenerateRandomString:function(e){var t="!@#$&*",o="abcdefghijklmnopqrstuvwxyz",n="ABCDEFGHIJKLMNOPQRSTUVWXYZ",a="0123456789",i=o+n+a,r=(t.pick(1)+o.pick(1)+n.pick(1)+i.pick(5,10)).shuffle();return r}},$.hood||($.hood={}),$.hood.Handlers={Init:function(){$("body").on("click",".select-text",$.hood.Handlers.SelectTextContent),$("body").on("click",".btn.click-select[data-target][data-value]",$.hood.Handlers.ClickSelect),$("body").on("click",".click-select.show-selected[data-target][data-value]",$.hood.Handlers.ClickSelect),$("body").on("click",".click-select:not(.show-selected)[data-target][data-value]",$.hood.Handlers.ClickSelectClean),$("body").on("click",".slide-link",$.hood.Handlers.SlideToAnchor),$("body").on("click",".scroll-target, .scroll-to-target",$.hood.Handlers.ScrollToTarget),$("body").on("click",".scroll-top, .scroll-to-top",$.hood.Handlers.ScrollToTop),$("body").on("change","input[type=checkbox][data-input]",$.hood.Handlers.CheckboxChange),$("body").on("change",".submit-on-change",$.hood.Handlers.SubmitOnChange),$("select[data-selected]").each($.hood.Handlers.SelectSetup),$("body").on("change",".inline-date",$.hood.Handlers.DateChange),$.hood.Handlers.Uploaders.Init(),$.hood.Handlers.ColorPickers()},ScrollToTop:function(e){return e&&e.preventDefault(),$("html, body").animate({scrollTop:0},800),!1},ScrollToTarget:function(e){e&&e.preventDefault();var t=$(this).attr("href").split("#")[0];if(t===window.location.pathname||""===t){var o=this.hash,n=$(o),a=$("header.header"),i=0;a&&(i=a.height()),$(this).data("offset")?$("html, body").stop().animate({scrollTop:n.offset().top-$(this).data("offset")},900,"swing"):$("html, body").stop().animate({scrollTop:n.offset().top-i},900,"swing")}},SubmitOnChange:function(e){e&&e.preventDefault(),$(this).parents("form").submit()},DateChange:function(e){e&&e.preventDefault();var t=$(this).parents(".hood-date").find(".date-output"),o=t.parents(".hood-date").find(".date-value").val(),n=/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/;n.test(o)||(o="01/01/2001");var a=t.parents(".hood-date").find(".hour-value").val();$.isNumeric(a)||(a="00");var i=t.parents(".hood-date").find(".minute-value").val();$.isNumeric(i)||(i="00"),t.val(o+" "+a+":"+i+":00"),t.attr("value",o+" "+a+":"+i+":00")},CheckboxChange:function(e){e&&e.preventDefault();var t=new Array;$('input[data-input="'+$(this).data("input")+'"]').each(function(){$(this).is(":checked")&&t.push($(this).val())});var o="#"+$(this).data("input"),n=JSON.stringify(t);$(o).val(n)},SelectSetup:function(){$(this).data("selected");if("undefined"!==$(this).data("selected")&&""!==$(this).data("selected")){var e=String($(this).data("selected"));$(this).val(e)}},ClickSelect:function(){var e=$(this),t="#"+e.data("target");$(t).val(e.data("value")),$(t).trigger("change"),$('.click-select[data-target="'+e.data("target")+'"]').each(function(){$(this).html($(this).data("temp")).removeClass("active")}),$('.click-select[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).data("temp",$(this).html()).html("Selected").addClass("active")})},ClickSelectClean:function(){var e=$(this),t="#"+e.data("target");$(t).val(e.data("value")),$(t).trigger("change"),$('.click-select.clean[data-target="'+e.data("target")+'"]').each(function(){$(this).removeClass("active")}),$('.click-select.clean[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).addClass("active")})},SelectTextContent:function(){var e=$(this);e.select(),e.mouseup(function(){return e.unbind("mouseup"),!1})},SlideToAnchor:function(){var e=$("body").scrollTop(),t=$($.attr(this,"href")).offset().top;return $("html, body").animate({scrollTop:t},Math.abs(t-e)),!1},Uploaders:{Init:function(){($(".image-uploader").length||$(".gallery-uploader").length)&&($(".upload-progress-bar").hide(),$.getScript("/lib/dropzone/min/dropzone.min.js",$.proxy(function(){$(".image-uploader").each(function(){$.hood.Handlers.Uploaders.SingleImage($(this).attr("id"),$(this).data("json"))}),$(".gallery-uploader").each(function(){$.hood.Handlers.Uploaders.Gallery($(this).attr("id"),$(this).data("json"))})},this)))},RefreshImage:function(e,t){$(e.data("preview")).css({"background-image":"url("+t.Media.SmallUrl+")"}),$(e.data("preview")).find("img").attr("src",t.Media.SmallUrl)},SingleImage:function(e,t){e="#"+e;$(e);Dropzone.autoDiscover=!1;var o=new Dropzone(e,{url:$(e).data("url"),maxFiles:1,paramName:"file",parallelUploads:1,acceptedFiles:$(e).data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:!1,clickable:e});o.on("addedfile",function(){}),o.on("totaluploadprogress",function(t){$(".upload-progress-bar."+e.replace("#","")+" .progress-bar").css({width:t+"%"})}),o.on("sending",function(t){$(".upload-progress-bar."+e.replace("#","")).show(),$($(e).data("preview")).addClass("loading")}),o.on("queuecomplete",function(t){$(".upload-progress-bar."+e.replace("#","")).hide()}),o.on("success",function(n,a){a.Success?(a.Media&&($(t).val(JSON.stringify(a.Media)),$($(e).data("preview")).css({"background-image":"url("+a.Media.SmallUrl+")"}),$($(e).data("preview")).find("img").attr("src",a.Media.SmallUrl)),$.hood.Alerts.Success("New image added!")):$.hood.Alerts.Error("There was a problem adding the image: "+a.Error),o.removeFile(n),$($(e).data("preview")).removeClass("loading")})},Gallery:function(e){Dropzone.autoDiscover=!1;var t=document.querySelector(e+"-template");t.id="";var o=t.parentNode.innerHTML;t.parentNode.removeChild(t);var n=new Dropzone(e,{url:$(e).data("url"),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:o,paramName:"files",acceptedFiles:$(e).data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:"#previews",clickable:".fileinput-button",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!"});$(e+" .cancel").hide(),n.on("addedfile",function(t){$(t.previewElement.querySelector(".complete")).hide(),$(t.previewElement.querySelector(".cancel")).show(),$(e+" .cancel").show()}),n.on("totaluploadprogress",function(e){document.querySelector("#total-progress .progress-bar").style.width=e+"%"}),n.on("sending",function(e){document.querySelector("#total-progress").style.opacity="1"}),n.on("complete",function(e){$(e.previewElement.querySelector(".cancel")).hide(),$(e.previewElement.querySelector(".progress")).hide(),$(e.previewElement.querySelector(".complete")).show(),$.hood.Inline.Refresh(".gallery")}),n.on("queuecomplete",function(t){document.querySelector("#total-progress").style.opacity="0",$(e+" .cancel").hide()}),n.on("success",function(e,t){$.hood.Inline.Refresh(".gallery"),t.Success?$.hood.Alerts.Success("New images added!"):$.hood.Alerts.Error("There was a problem adding the profile image: "+t.Error)}),document.querySelector(".actions .cancel").onclick=function(){n.removeAllFiles(!0)}}},ColorPickers:function(){var e=function(e,t){var o=$(t._root.button).parent().data("target");$(t._root.button).css({"background-color":e.toHEXA().toString()});for(var n=t.getColor().toHEXA(),a="",i=n.length-1;i>=0;i--)a=n[i]+a;$(o).val("#"+a)},t=[];$(".color-picker").each(function(o,n){var a=!0;"true"==$(this).data("opacity")&&(a=!1);var i=Pickr.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 o=$(t._root.button).parent().data("target"),n=$(o).val();$(o).on("click",$.proxy(function(){this.show()},t)),n&&(t.setColor(n),e(t.getColor(),t))}).on("clear",function(t){var o=$(t._root.button).parent().data("target");t.setColor("transparent"),e(t.getColor(),t),$(o).val("")}).on("change",e);t.push(i)})}},$(document).ready($.hood.Handlers.Init),String.prototype.contains=function(e){return this.indexOf(e)!==-1},String.prototype.pick=function(e,t){var o,n="";o="undefined"==typeof t?e:e+Math.floor(Math.random()*(t-e));for(var a=0;a<o;a++)n+=this.charAt(Math.floor(Math.random()*this.length));return n},String.prototype.shuffle=function(){var e,t,o=this.split(""),n=o.length;if(n)for(;--n;)t=Math.floor(Math.random()*(n+1)),e=o[t],o[t]=o[n],o[n]=e;return o.join("")},String.prototype.toSeoUrl=function(){var e=this.replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g,"-").toLowerCase();"-"===e.charAt(0)&&(e=e.substring(1));var t=e.length-1;return"-"===e.charAt(t)&&(e=e.substring(0,t)),e},$.hood||($.hood={}),$.hood.FormValidator=function(e,t){this.Options=$.extend({formTag:e,validationRules:null,validationMessages:{},placeBelow:!0,submitButtonTag:null,submitUrl:null,submitFunction:null,serializationFunction:function(){var e=$(this.formTag).serialize();return e}},t||{}),this.LoadValidation=function(){$.hood.Helpers.IsNullOrUndefined(this.Options.formTag)||($(this.Options.formTag).find("input, textarea, select").keypress($.proxy(function(e){if(13===e.which)return $.proxy(this.submitForm(),this),e.preventDefault(),!1},this)),$(this.Options.formTag).validate({submitHandler:function(e){e.preventDefault()},errorClass:this.Options.errorClass,focusInvalid:!1,rules:this.Options.validationRules,messages:this.Options.validationMessages}),$.hood.Helpers.IsNullOrUndefined(this.Options.submitButtonTag)||$(this.Options.submitButtonTag).click($.proxy(this.submitForm,this)))},this.submitForm=function(){$(this.Options.formTag).valid()&&(this.TempButtonContent=$(this.Options.submitButtonTag).removeClass("btn-primary").addClass("btn-default").html(),$(this.Options.submitButtonTag).removeClass("btn-primary").addClass("btn-default").html('<i class="fa fa-refresh fa-spin"></i> Loading...'),$(this.Options.formTag).find("input[type=checkbox]").each(function(){$(this).is(":checked")&&$(this).val("true")}),$.post(this.Options.submitUrl,this.Options.serializationFunction(),$.proxy(function(e){$(this.Options.submitButtonTag).removeClass("btn-default").addClass("btn-primary").html(this.TempButtonContent),this.Options.submitFunction(e)},this)))},this.LoadValidation(),this.Options.placeBelow&&$(this.Options.formTag).addClass("validation-below")},$.fn.hoodValidator=function(e){return this.each(function(){var t=$(this);if(!t.data("hoodValidator")){var o=new $.hood.FormValidator(this,e);t.data("hoodValidator",o)}})},$.hood||($.hood={}),$.hood.Addresses={Init:function(){$("body").on("click",".address-set-billing",$.hood.Addresses.SetBilling),$("body").on("click",".address-set-delivery",$.hood.Addresses.SetDelivery),$("body").on("click",".address-delete",$.hood.Addresses.Delete)},Lists:{Address:{Loaded:function(e){$.hood.Loader(!1)},Reload:function(e){$("#address-list").doesExist()&&$.hood.Inline.Reload($("#address-list"),e)}}},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload(),e.Success&&t&&t.data("redirect")&&($.hood.Alerts.Success("<strong>Address deleted, redirecting...</strong><br />Just taking you back to the address list."),setTimeout(function(){window.location=t.data("redirect")},1500))})};$.hood.Alerts.Confirm("The address will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong></span>')},CreateOrEdit:function(){$.hood.Google.Addresses.InitAutocomplete(),$("#address-form").hoodValidator({validationRules:{Number:{required:!0},Address1:{required:!0},City:{required:!0},County:{required:!0},Postcode:{required:!0},Country:{required:!0}},submitButtonTag:$("#address-form-submit"),submitUrl:$("#address-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload(),e.Success&&$.hood.Inline.CloseModal()}})},SetBilling:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload()})};$.hood.Alerts.Confirm("The current billing address will be overwritten.","Are you sure?",o,"error")},SetDelivery:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload()})};$.hood.Alerts.Confirm("The current delivery address will be overwritten.","Are you sure?",o,"error")}},$(document).ready($.hood.Addresses.Init);var swalWithBootstrapButtons=Swal.mixin({customClass:{confirmButton:"btn btn-success btn-lg m-1 pl-4 pr-4",cancelButton:"btn btn-danger btn-lg m-1"},buttonsStyling:!1}),Toast=Swal.mixin({toast:!0,position:"top-end",showConfirmButton:!0});$.hood||($.hood={}),$.hood.Alerts={Error:function(e,t,o,n,a,i,r){o===!0?this.SweetAlert(e,t,"error",n,a,i,r):this.Alert(e,t,"error")},Warning:function(e,t,o,n,a,i,r){o===!0?this.SweetAlert(e,t,"warning",n,a,i,r):this.Alert(e,t,"warning")},Message:function(e,t,o,n,a,i,r){o===!0?this.SweetAlert(e,t,"info",n,a,i,r):this.Alert(e,t,"info")},Success:function(e,t,o,n,a,i,r){o===!0?this.SweetAlert(e,t,"success",n,a,i,r):this.Alert(e,t,"success")},Alert:function(e,t,o){Toast.fire({type:o||"info",html:e,title:t})},SweetAlert:function(e,t,o,n,a,i,r){swalWithBootstrapButtons.fire({title:t,html:e,type:o||"info",footer:n,showConfirmButton:a,timer:i}).then(function(e){e.dismiss||r(e)})},Confirm:function(e,t,o,n,a,i,r){swalWithBootstrapButtons.fire({title:t||"Woah!",html:e||"Are you sure you want to do this?",type:n||"warning",footer:a||'<span class="text-warning"><i class="fa fa-exclamation-triangle"></i> This cannot be undone.</span>',showCancelButton:!0,confirmButtonText:i||"Ok",cancelButtonText:r||"Cancel"}).then(function(e){e.dismiss||o(e.value)})},Prompt:function(e,t,o,n,a,i,r,l,s){swalWithBootstrapButtons.fire({input:n||"text",inputAttributes:s||{autocapitalize:"off"},title:t||"Enter a value",html:e||"Fill in the field and press Ok to continue.",type:a||"info",footer:i,showCancelButton:!0,confirmButtonText:r||"Ok",cancelButtonText:l||"Cancel"}).then(function(e){e.dismiss||o(e.value)})}},$.hood||($.hood={}),$.hood.Forms={Init:function(){$(".floating-label > label").each(function(){var e=$(this);e.parent().append(e)})},GetAllowedExtensions:function(e){switch(e){case"Image":return["png","jpg","jpeg","bmp","gif"];case"Document":return["doc","docx","pdf","rtf"];case"All":return""}},GetAllowedFiles:function(e){switch(e){case"Image":return"image/png,jpg,image/jpeg,image/gif";case"Document":return"application/msword,application/pdf,text/rtf";case"All":return""}}},$(document).ready($.hood.Forms.Init),$.hood||($.hood={}),$.hood.Inline={Tags:{},Init:function(){$(".hood-inline:not(.refresh)").each($.hood.Inline.Load),$("body").on("click",".hood-inline-task",$.hood.Inline.Task),$("body").on("click",".hood-modal",function(e){e.preventDefault(),$.hood.Inline.Modal($(this).attr("href"),$(this).data("complete"),$(this).data("close"))}),$.hood.Inline.DataList.Init()},Refresh:function(e){$(e||".hood-inline").each($.hood.Inline.Load)},Load:function(){$.hood.Inline.Reload(this)},Reload:function(e,t){var o=$(e);o.addClass("loading"),t||(t=o.data("complete"));var n=o.data("url");$.get(n,$.proxy(function(e){o.html(e),o.removeClass("loading"),t&&$.hood.Inline.RunComplete(t,o,e)},o)).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},CurrentModal:null,Modal:function(e,t){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];$.hood.Inline.CurrentModal&&o&&$.hood.Inline.CloseModal(),$.get(e,function(e){var o="#"+$(e).attr("id");$(e).addClass("hood-inline-modal"),$(o).length&&$(o).remove(),$("body").append(e),$.hood.Inline.CurrentModal=$(o),$(o).modal(),$(o).on("shown.bs.modal",function(){$(document).off("focusin.modal")}),$(o).on("hidden.bs.modal",function(e){$(this).remove()}),t&&$.hood.Inline.RunComplete(t,$(o),e)}).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},CloseModal:function(){$.hood.Inline.CurrentModal&&$.hood.Inline.CurrentModal.modal("hide")},Task:function(e){e.preventDefault();var t=$(e.currentTarget);t.addClass("loading");var o=t.data("complete");$.get(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&t&&t.data("redirect")&&setTimeout(function(){window.location=t.data("redirect")},1500),t.removeClass("loading"),o&&$.hood.Inline.RunComplete(o,t,e)}).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},DataList:{Init:function(){$(".hood-inline-list.query").each(function(){$(this).data("url",$(this).data("url")+window.location.search)}),$(".hood-inline-list:not(.refresh)").each($.hood.Inline.Load),$("body").on("click","a.hood-inline-list-target",function(e){e.preventDefault(),$.hood.Loader(!0);var t=document.createElement("a");t.href=$(this).attr("href");var o=$($(this).data("target")),n=document.createElement("a");n.href=o.data("url"),n.search=t.search,$.hood.Inline.DataList.Reload(o,n),complete=$(this).data("complete"),complete&&$.hood.Inline.RunComplete(complete,$(this))}),$("body").on("click",".hood-inline-list .pagination a",function(e){e.preventDefault(),$.hood.Loader(!0);var t=document.createElement("a");t.href=$(this).attr("href");var o=$(this).parents(".hood-inline-list"),n=document.createElement("a");n.href=o.data("url"),n.search=t.search,$.hood.Inline.DataList.Reload(o,n)}),$("body").on("submit",".hood-inline-list form",function(e){e.preventDefault(),$.hood.Loader(!0);var t=$(this),o=t.parents(".hood-inline-list"),n=document.createElement("a");n.href=o.data("url"),n.search="?"+t.serialize(),$.hood.Inline.DataList.Reload(o,n)}),$("body").on("submit","form.inline",function(e){e.preventDefault(),$.hood.Loader(!0);var t=$(this),o=$(t.data("target"));o.each(function(){var e=document.createElement("a");e.href=$(this).data("url"),e.href&&(e.search="?"+t.serialize(),$.hood.Inline.DataList.Reload($(this),e))})}),$("body").on("change","form.inline .refresh-on-change, .hood-inline-list form",function(e){e.preventDefault(),$.hood.Loader(!0);var t=$(this).parents("form"),o=$(t.data("target")),n=document.createElement("a");n.href=o.data("url"),n.search="?"+t.serialize(),$.hood.Inline.DataList.Reload(o,n)})},Reload:function(e,t){if(history.pushState&&e.hasClass("query")){var o=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+t.href.substring(t.href.indexOf("?")+1);window.history.pushState({path:o},"",o)}e.data("url",$.hood.Helpers.InsertQueryStringParamToUrl(t,"inline","true")),$.hood.Inline.Reload(e)}},HandleError:function(e){500===e.status?$.hood.Alerts.Error("<strong>Error "+e.status+"</strong><br />There was an error processing the content, please contact an administrator if this continues.<br/>"):404===e.status?$.hood.Alerts.Error("<strong>Error "+e.status+"</strong><br />The content could not be found.<br/>"):401===e.status&&($.hood.Alerts.Error("<strong>Error "+e.status+"</strong><br />You are not allowed to view this resource, are you logged in correctly?<br/>"),window.location=window.location)},Finish:function(){$.hood.Loader(!1)},RunComplete:function RunComplete(complete,sender,data){if(!$.hood.Helpers.IsNullOrUndefined(complete)){var func=eval(complete);"function"==typeof func&&func(sender,data)}}},$(document).ready($.hood.Inline.Init),$.hood.Modals={Open:$.hood.Inline.Modal},$.hood||($.hood={}),$.hood.Media={Init:function(){$("body").on("click",".media-delete",$.hood.Media.Delete),$("body").on("click",".media-directories-delete",$.hood.Media.Directories.Delete),$.hood.Media.Upload.Init(),$.hood.Media.Actions.Init()},Loaded:function(e){$.hood.Loader(!1)},BladeLoaded:function(e){$.hood.Media.LoadMediaPlayers()},Reload:function(e){$.hood.Inline.Reload($("#media-list"),e)},ReloadDirectories:function(e){$.hood.Inline.Reload($("#media-directories-list"),e)},Actions:{Init:function(){$("body").on("click",".hood-image-attach",$.hood.Media.Actions.Load.Attach),$("body").on("click",".hood-image-clear",$.hood.Media.Actions.Complete.Clear),$("body").on("click",".hood-image-insert",$.hood.Media.Actions.Load.Insert),$("body").on("click",".hood-media-select",$.hood.Media.Actions.Load.Select)},Target:null,Json:null,Current:{Attach:null},Load:{Attach:function(e){e.preventDefault(),$.hood.Media.Actions.Target=$($(this).data("tag")),$.hood.Media.Actions.Json=$($(this).data("json")),$.hood.Inline.Modal($(this).data("url"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-attach"),$("body").on("click",".media-attach",$.hood.Media.Actions.Complete.Attach)}),$.hood.Media.Upload.Init()})},Insert:function(e){var t=$("#"+e.id);t.data("imagesUrl")&&e.addButton("hoodimage",{text:"Insert image...",icon:!1,onclick:$.proxy(function(t){$.hood.Inline.Modal($(this).data("imagesUrl"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-insert"),$("body").on("click",".media-insert",$.proxy($.hood.Media.Actions.Complete.Insert,e))}),$.hood.Media.Upload.Init()})},t)})},Select:function(e){$.hood.Media.Actions.Target=$($(this).data("target")),$.hood.Inline.Modal($(this).data("url"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-select"),$("body").on("click",".media-select",$.hood.Media.Actions.Complete.Select)}),$.hood.Media.Upload.Init()})}},Complete:{Attach:function(e){e.preventDefault();var t=$.hood.Media.Actions.Target,o=$.hood.Media.Actions.Json;$.post($(this).data("url"),function(e){if($.hood.Helpers.ProcessResponse(e),e.Success){var n=e.Media.Icon;"Image"===e.Media.GeneralFileType&&(n=e.Media.MediumUrl),$.hood.Helpers.IsNullOrUndefined(t)||(t.css({"background-image":"url("+n+")"}),t.find("img").attr("src",n), | ||
t.removeClass("loading")),$.hood.Helpers.IsNullOrUndefined(o)||o.val(e.MediaJson)}}).done(function(){$("#media-select-modal").modal("hide")}).fail($.hood.Inline.HandleError)},Insert:function(e){var t=$(e.target),o=this;o.insertContent('<img alt="'+t.data("title")+'" src="'+t.data("url")+'"/>'),$.hood.Inline.CloseModal()},Select:function(e){var t=$(this).data("url"),o=$.hood.Media.Actions.Target;$(o).each(function(){$(this).is("input")?$(this).val(t):($(this).attr("src",t),$(this).css({"background-image":"url("+t+")"}),$(this).find("img").attr("src",t))}),$.hood.Alerts.Success("Image URL has been inserted.<br /><strong>Remember to press save!</strong>"),$("#media-select-modal").modal("hide")},Clear:function(e){e.preventDefault();var t=$($(this).data("tag")),o=$($(this).data("json"));$.post($(this).data("url"),function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&(icon=e.Media.Icon,"Image"===e.Media.GeneralFileType&&(icon=e.Media.MediumUrl),$.hood.Helpers.IsNullOrUndefined(t)||(t.css({"background-image":"url("+icon+")"}),t.find("img").attr("src",icon),t.removeClass("loading")),$.hood.Helpers.IsNullOrUndefined(o)||o.val(e.Json))}).fail($.hood.Inline.HandleError)}},RefreshImage:function(e,t,o){var n=$(e);n.addClass("loading"),$.get(t,{id:o},$.proxy(function(e){n.css({"background-image":"url("+e.SmallUrl+")"}),n.find("img").attr("src",e.SmallUrl),n.removeClass("loading")},this))}},Upload:{Init:function(){if($("#media-add").doesExist()){$("#media-total-progress").hide(),Dropzone.autoDiscover=!1;var e=new Dropzone("#media-upload",{url:$.hood.Media.Upload.UploadUrl,thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:!1,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!"});e.on("success",function(e,t){$.hood.Helpers.ProcessResponse(t)}),e.on("addedfile",function(e){$("#media-total-progress .progress-bar").css({width:"0%"}),$("#media-total-progress .progress-bar .percentage").html("0%")}),e.on("totaluploadprogress",function(e){$("#media-total-progress .progress-bar").css({width:e+"%"}),$("#media-total-progress .progress-bar .percentage").html(e+"%")}),e.on("sending",function(e){$("#media-total-progress").fadeIn(),$("#media-total-progress .progress-bar").css({width:"0%"}),$("#media-total-progress .progress-bar .percentage").html("0%")}),e.on("complete",function(e){$.hood.Media.Reload()}),e.on("queuecomplete",function(e){$("#media-total-progress").hide(),$.hood.Media.Reload()})}},UploadUrl:function(){return $("#media-upload").data("url")+"?directoryId="+$("#media-list > #upload-directory-id").val()}},Delete:function(e){var t=$(this),o=function(e){e&&$.post("/admin/media/delete",{id:t.data("id")},function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&($.hood.Media.Reload(),$(".modal-backdrop").remove(),$(".modal").modal("hide"))})};$.hood.Alerts.Confirm("The media file will be permanently removed. This cannot be undone.","Are you sure?",o,"warning",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> Ensure this file is not attached to any posts, pages or features of the site, or it will appear as a broken image or file.</span>',"Ok","Cancel")},RestrictDir:function(){var e=/[^0-9A-Za-z- ]*/g,t=$(this).val(),o=t.replace(e,"");t!==o&&$(this).val(o)},Directories:{Editor:function(){$("#content-directories-edit-form").hoodValidator({validationRules:{DisplayName:{required:!0},Slug:{required:!0}},submitButtonTag:$("#content-directories-edit-submit"),submitUrl:$("#content-directories-edit-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Media.ReloadDirectories(),$.hood.Media.Reload()}})},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Media.ReloadDirectories(),$.hood.Media.Reload()})};$.hood.Alerts.Confirm("The directory and all files will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle mr-2"></i><strong>This cannot be undone!</strong><br />Ensure these files are not attached to any posts, pages or features of the site, or it will appear as a broken image or file.</span>')}},Players:{},LoadMediaPlayers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".hood-media",t={techOrder:["azureHtml5JS","flashSS","html5FairPlayHLS","silverlightSS","html5"],nativeControlsForTouch:!1,controls:!0,autoplay:!1,seeking:!0};$(e).each(function(){try{if(player=$.hood.Media.Players[$(this).data("id")],player)try{player.dispose()}catch(e){console.log("There was a problem disposing the old media player: ".concat(e))}$.hood.Media.Players[$(this).data("id")]=amp($(this).attr("id"),t),player=$.hood.Media.Players[$(this).data("id")],player.src([{src:$(this).data("file"),type:$(this).data("type")}])}catch(e){console.log("There was a problem playing the media file: ".concat(e))}})}},$(document).ready($.hood.Media.Init); | ||
"use strict";var console={};console.log=function(){},window.console=console,$.hood||($.hood={}),$.body=$("body");var console=window.console||{};console.log=console.log||function(){},console.warn=console.warn||function(){},console.error=console.error||function(){},console.info=console.info||function(){},$.fn.exists=function(){return $(this).length},$.fn.doesExist=function(){return $(this).length},$.fn.restrictToSlug=function(e){var t=$(this),o=e||/[^0-9a-zA-Z]*/g,n=function(){var e=$(this).val(),t=e.replace(o,"");e!==t&&$(this).val(t)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".restrict-to-slug").restrictToSlug(),$.fn.restrictToPageSlug=function(e){var t=$(this),o=e||/[^0-9a-zA-Z-//]*/g,n=function(){var e=$(this).val(),t=e.replace(o,"");if((t.match(new RegExp("/","g"))||[]).length>4){var n=t.lastIndexOf("/");t=t.substring(0,n)+t.substring(n+1),$.hood.Alerts.Warning("You can only have up to 4 '/' characters in a url slug.")}e!==t&&$(this).val(t)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".restrict-to-page-slug").restrictToPageSlug(),$.fn.restrictToMetaSlug=function(e){var t=$(this),o=e||/[^0-9a-zA-Z.]*/g,n=function(){var e=$(this).val(),t=e.replace(o,"");if((t.match(new RegExp(".","g"))||[]).length>1){var n=t.lastIndexOf(".");t=t.substring(0,n)+t.substring(n+1),$.hood.Alerts.Warning("You can only have up to 1 '.' characters in a meta slug.")}e!==t&&$(this).val(t)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".restrict-to-meta-slug").restrictToMetaSlug(),$.fn.characterCounter=function(e){var t=$(this),o=function(){var e=$(this).data("counter"),t=Number($(this).attr("maxlength")),o=$(this).val().length;$(e).text(t-o);var n="text-success";t-o<t/10&&(n="text-danger"),$(e).parent().removeClass("text-success").removeClass("text-danger").addClass(n)};t.on("keyup",o),t.on("paste",o),t.on("change",o)},$(".character-counter").characterCounter(),$(".character-counter").trigger("change"),$.fn.addLoader=function(){$(this).data("loadercontent",$(this).html()),$(this).addClass("loading").append('<i class="fa fa-refresh fa-spin m-l-sm"></i>')},$.fn.removeLoader=function(){$(this).empty().html($(this).data("loadercontent")),$(this).removeClass("loading")},$.fn.warningAlert=function(){var e=$(this),t=function(e){e.preventDefault();var t=function(t){if(t){var o=$(e.currentTarget).attr("href");window.location=o}};return $.hood.Alerts.Confirm($(e.currentTarget).data("warning"),$(e.currentTarget).data("title"),t,"warning",$(e.currentTarget).data("footer"),"Ok","Cancel"),!1};e.on("click",t)},$(".warning-alert").warningAlert(),$.commonHeight=function(e,t){var o=0;e.children(t).each(function(){var e=$(this).children();e.hasClass("max-height")?o=e.outerHeight():e.outerHeight()>o&&(o=e.outerHeight())}),e.children(t).each(function(){$(this).height(o)})},$.loadCss=function(e,t){$("link#"+e).length||$("<link/>",{id:e,rel:"stylesheet",type:"text/css",href:t}).appendTo("head")},$.getUrlVars=function(){for(var e,t=[],o=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),n=0;n<o.length;n++)e=o[n].split("="),t.push(e[0]),t[e[0]]=e[1];return t},$.decodeUrl=function(e){return decodeURIComponent(e).replace("+"," ")},$.numberWithCommas=function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},$.validator&&($.validator.addMethod("time",function(e,t){return this.optional(t)||/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$/i.test(e)},"Please enter a valid time."),$.validator.addMethod("ukdate",function(e,t){return e.match(/^\d\d?\/\d\d?\/\d\d\d\d$/)},"Please enter a date in the format dd/mm/yyyy.")),$.mobile={Android:function(){return navigator.userAgent.match(/Android/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)},Any:function(){return $.mobile.Android()||$.mobile.BlackBerry()||$.mobile.iOS()||$.mobile.Opera()||$.mobile.Windows()}},$.mobile.Android?$.mobile.BlackBerry?$.mobile.iOS?$.mobile.Opera?$.mobile.Windows?($.body.addClass("desktop-device"),$.device="desktop"):($.body.addClass("windows-device"),$.device="windows"):($.body.addClass("opera-device"),$.device="opera"):($.body.addClass("ios-device"),$.device="ios"):($.body.addClass("blackberry-device"),$.device="blackberry"):($.body.addClass("android-device"),$.device="android"),function(){var e={password:"0",username:"0"};$("body").on("change",".prevent-autocomplete",function(t){var o=$(this).attr("id");"0"!==e[o]&&e[o]===$(this).val()||$(this).val("")}),$("body").on("keyup",".prevent-autocomplete",function(t){var o=$(this).attr("id");e[o]=$(this).val()})}(),function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),o}if("function"==typeof window.CustomEvent)return!1;e.prototype=window.Event.prototype,window.CustomEvent=e}(),$.hood.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"}],$.hood.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"}],new CustomEvent("loader-show"),new CustomEvent("loader-hide"),$.hood.Loader=function(e){e?$("body").trigger("loader-show"):$("body").trigger("loader-hide")},$.hood||($.hood={}),$.hood.Helpers={IsNullOrUndefined:function(e){var t=!1;return null!==e&&void 0!==e&&""!==e||(t=!0),t},IsSet:function(e){var t=!1;return null!==e&&void 0!==e&&""!==e||(t=!0),!t},IsEventSupported:function(e){var t=document.createElement("div");e="on"+e;var o=e in t;return o||(t.setAttribute(e,"return;"),o="function"==typeof t[e]),t=null,o},IsFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},IsUrlExternal:function(e){var t=e.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);return"string"==typeof t[1]&&t[1].length>0&&t[1].toLowerCase()!==location.protocol||"string"==typeof t[2]&&t[2].length>0&&t[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host},IsInIframe:function(){try{return window.self!==window.top}catch(e){return!0}},HtmlEncode:function(e){return $("<div/>").text(e).html()},HtmlDecode:function(e){return $("<div/>").html(e).text()},FormatCurrency:function(e,t){return t+" "+e.toFixed(2).replace(/./g,function(e,t,o){return t>0&&"."!==e&&(o.length-t)%3==0?","+e:e})},FormatKilobytes:function(e){return e/=1024,e.toFixed(2).replace(/./g,function(e,t,o){return t>0&&"."!==e&&(o.length-t)%3==0?","+e:e})},FormatMegabytes:function(e){return e/=1024,e/=1024,currency+" "+e.toFixed(2).replace(/./g,function(e,t,o){return t>0&&"."!==e&&(o.length-t)%3==0?","+e:e})},FallbackCopyTextToClipboard:function(e){var t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch(e){console.error("Oops, unable to copy",e)}document.body.removeChild(t)},CopyTextToClipboard:function(e){if(!navigator.clipboard)return void $.hood.Handlers.FallbackCopyTextToClipboard(e);navigator.clipboard.writeText(e).then(function(){},function(e){console.error("Could not copy text: ",e)})},ProcessResponse:function(e){var t="";e.Title&&(t="<strong>".concat(e.Title,"</strong><br />")),e.Success?$.hood.Alerts.Success("".concat(t).concat(e.Message)):$.hood.Alerts.Error("".concat(t).concat(e.Errors))},GetQueryStringParamByName:function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)","i"),o=t.exec(location.search);return null===o?"":decodeURIComponent(o[1].replace(/\+/g," "))},InsertQueryStringParam:function(e,t){e=escape(e),t=escape(t);var o=document.location.search.substr(1).split("&");if(""===o)document.location.search="?"+e+"="+t;else{for(var n,a=o.length;a--;)if(n=o[a].split("="),n[0]===e){n[1]=t,o[a]=n.join("=");break}a<0&&(o[o.length]=[e,t].join("=")),document.location.search=o.join("&")}},InsertQueryStringParamToUrl:function(e,t,o){t=escape(t),o=escape(o);var n=e.search.substr(1).split("&");if(""===n)e.search="?"+t+"="+o;else{for(var a,i=n.length;i--;)if(a=n[i].split("="),a[0]===t){a[1]=o,n[i]=a.join("=");break}i<0&&(n[n.length]=[t,o].join("=")),e.search=n.join("&")}return e},UrlToLocationObject:function(e){var t=document.createElement("a");return t.href=e,t},FindAndRemoveFromArray:function(e,t,o){$.each(e,function(n,a){a[t]===o&&e.splice(n,1)})},FindAndReturnFromArray:function(e,t,o){var n=null;return $.each(e,function(e,a){a[t]===o&&(n=a)}),n},LeftPad:function(e,t){for(var o=e+"";o.length<t;)o="0"+o;return o},DateAdd:function(e,t,o){var n=new Date(e);switch(t.toLowerCase()){case"year":n.setFullYear(n.getFullYear()+o);break;case"quarter":n.setMonth(n.getMonth()+3*o);break;case"month":n.setMonth(n.getMonth()+o);break;case"week":n.setDate(n.getDate()+7*o);break;case"day":n.setDate(n.getDate()+o);break;case"hour":n.setTime(n.getTime()+36e5*o);break;case"minute":n.setTime(n.getTime()+6e4*o);break;case"second":n.setTime(n.getTime()+1e3*o);break;default:n=void 0}return n},GenerateRandomString:function(e){var t="abcdefghijklmnopqrstuvwxyz",o="ABCDEFGHIJKLMNOPQRSTUVWXYZ",n=t+o+"0123456789";return("!@#$&*".pick(1)+t.pick(1)+o.pick(1)+n.pick(5,10)).shuffle()}},$.hood||($.hood={}),$.hood.Handlers={Init:function(){$("body").on("click",".select-text",$.hood.Handlers.SelectTextContent),$("body").on("click",".btn.click-select[data-target][data-value]",$.hood.Handlers.ClickSelect),$("body").on("click",".click-select.show-selected[data-target][data-value]",$.hood.Handlers.ClickSelect),$("body").on("click",".click-select:not(.show-selected)[data-target][data-value]",$.hood.Handlers.ClickSelectClean),$("body").on("click",".slide-link",$.hood.Handlers.SlideToAnchor),$("body").on("click",".scroll-target, .scroll-to-target",$.hood.Handlers.ScrollToTarget),$("body").on("click",".scroll-top, .scroll-to-top",$.hood.Handlers.ScrollToTop),$("body").on("change","input[type=checkbox][data-input]",$.hood.Handlers.CheckboxChange),$("body").on("change",".submit-on-change",$.hood.Handlers.SubmitOnChange),$("select[data-selected]").each($.hood.Handlers.SelectSetup),$("body").on("change",".inline-date",$.hood.Handlers.DateChange),$.hood.Handlers.Uploaders.Init(),$.hood.Handlers.ColorPickers()},ScrollToTop:function(e){return e&&e.preventDefault(),$("html, body").animate({scrollTop:0},800),!1},ScrollToTarget:function(e){e&&e.preventDefault();var t=$(this).attr("href").split("#")[0];if(t===window.location.pathname||""===t){var o=this.hash,n=$(o),a=$("header.header"),i=0;a&&(i=a.height()),$(this).data("offset")?$("html, body").stop().animate({scrollTop:n.offset().top-$(this).data("offset")},900,"swing"):$("html, body").stop().animate({scrollTop:n.offset().top-i},900,"swing")}},SubmitOnChange:function(e){e&&e.preventDefault(),$(this).parents("form").submit()},DateChange:function(e){e&&e.preventDefault();var t=$(this).parents(".hood-date").find(".date-output"),o=t.parents(".hood-date").find(".date-value").val();/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/.test(o)||(o="01/01/2001");var n=t.parents(".hood-date").find(".hour-value").val();$.isNumeric(n)||(n="00");var a=t.parents(".hood-date").find(".minute-value").val();$.isNumeric(a)||(a="00"),t.val(o+" "+n+":"+a+":00"),t.attr("value",o+" "+n+":"+a+":00")},CheckboxChange:function(e){e&&e.preventDefault();var t=new Array;$('input[data-input="'+$(this).data("input")+'"]').each(function(){$(this).is(":checked")&&t.push($(this).val())});var o="#"+$(this).data("input"),n=JSON.stringify(t);$(o).val(n)},SelectSetup:function(){$(this).data("selected");if("undefined"!==$(this).data("selected")&&""!==$(this).data("selected")){var e=String($(this).data("selected"));$(this).val(e)}},ClickSelect:function(){var e=$(this),t="#"+e.data("target");$(t).val(e.data("value")),$(t).trigger("change"),$('.click-select[data-target="'+e.data("target")+'"]').each(function(){$(this).html($(this).data("temp")).removeClass("active")}),$('.click-select[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).data("temp",$(this).html()).html("Selected").addClass("active")})},ClickSelectClean:function(){var e=$(this),t="#"+e.data("target");$(t).val(e.data("value")),$(t).trigger("change"),$('.click-select.clean[data-target="'+e.data("target")+'"]').each(function(){$(this).removeClass("active")}),$('.click-select.clean[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).addClass("active")})},SelectTextContent:function(){var e=$(this);e.select(),e.mouseup(function(){return e.unbind("mouseup"),!1})},SlideToAnchor:function(){var e=$("body").scrollTop(),t=$($.attr(this,"href")).offset().top;return $("html, body").animate({scrollTop:t},Math.abs(t-e)),!1},Uploaders:{Init:function(){($(".image-uploader").length||$(".gallery-uploader").length)&&($(".upload-progress-bar").hide(),$.getScript("/lib/dropzone/min/dropzone.min.js",$.proxy(function(){$(".image-uploader").each(function(){$.hood.Handlers.Uploaders.SingleImage($(this).attr("id"),$(this).data("json"))}),$(".gallery-uploader").each(function(){$.hood.Handlers.Uploaders.Gallery($(this).attr("id"),$(this).data("json"))})},this)))},RefreshImage:function(e,t){$(e.data("preview")).css({"background-image":"url("+t.Media.SmallUrl+")"}),$(e.data("preview")).find("img").attr("src",t.Media.SmallUrl)},SingleImage:function(e,t){e="#"+e;$(e);Dropzone.autoDiscover=!1;var o=new Dropzone(e,{url:$(e).data("url"),maxFiles:1,paramName:"file",parallelUploads:1,acceptedFiles:$(e).data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:!1,clickable:e});o.on("addedfile",function(){}),o.on("totaluploadprogress",function(t){$(".upload-progress-bar."+e.replace("#","")+" .progress-bar").css({width:t+"%"})}),o.on("sending",function(t){$(".upload-progress-bar."+e.replace("#","")).show(),$($(e).data("preview")).addClass("loading")}),o.on("queuecomplete",function(t){$(".upload-progress-bar."+e.replace("#","")).hide()}),o.on("success",function(n,a){a.Success?(a.Media&&($(t).val(JSON.stringify(a.Media)),$($(e).data("preview")).css({"background-image":"url("+a.Media.SmallUrl+")"}),$($(e).data("preview")).find("img").attr("src",a.Media.SmallUrl)),$.hood.Alerts.Success("New image added!")):$.hood.Alerts.Error("There was a problem adding the image: "+a.Error),o.removeFile(n),$($(e).data("preview")).removeClass("loading")})},Gallery:function(e){Dropzone.autoDiscover=!1;var t=document.querySelector(e+"-template");t.id="";var o=t.parentNode.innerHTML;t.parentNode.removeChild(t);var n=new Dropzone(e,{url:$(e).data("url"),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:o,paramName:"files",acceptedFiles:$(e).data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:"#previews",clickable:".fileinput-button",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!"});$(e+" .cancel").hide(),n.on("addedfile",function(t){$(t.previewElement.querySelector(".complete")).hide(),$(t.previewElement.querySelector(".cancel")).show(),$(e+" .cancel").show()}),n.on("totaluploadprogress",function(e){document.querySelector("#total-progress .progress-bar").style.width=e+"%"}),n.on("sending",function(e){document.querySelector("#total-progress").style.opacity="1"}),n.on("complete",function(e){$(e.previewElement.querySelector(".cancel")).hide(),$(e.previewElement.querySelector(".progress")).hide(),$(e.previewElement.querySelector(".complete")).show(),$.hood.Inline.Refresh(".gallery")}),n.on("queuecomplete",function(t){document.querySelector("#total-progress").style.opacity="0",$(e+" .cancel").hide()}),n.on("success",function(e,t){$.hood.Inline.Refresh(".gallery"),t.Success?$.hood.Alerts.Success("New images added!"):$.hood.Alerts.Error("There was a problem adding the profile image: "+t.Error)}),document.querySelector(".actions .cancel").onclick=function(){n.removeAllFiles(!0)}}},ColorPickers:function(){var e=function(e,t){var o=$(t._root.button).parent().data("target");$(t._root.button).css({"background-color":e.toHEXA().toString()});for(var n=t.getColor().toHEXA(),a="",i=n.length-1;i>=0;i--)a=n[i]+a;$(o).val("#"+a),$(o).change()},t=[];$(".color-picker").each(function(o,n){var a=!0;"true"==$(this).data("opacity")&&(a=!1);var i=Pickr.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 o=$(t._root.button).parent().data("target"),n=$(o).val();$(o).on("click",$.proxy(function(){this.show()},t)),n&&(t.setColor(n),e(t.getColor(),t))}).on("clear",function(t){var o=$(t._root.button).parent().data("target");t.setColor("transparent"),e(t.getColor(),t),$(o).val(""),$(o).change()}).on("change",e);t.push(i)})}},$(document).ready($.hood.Handlers.Init),String.prototype.contains=function(e){return-1!==this.indexOf(e)},String.prototype.pick=function(e,t){var o,n="";o=void 0===t?e:e+Math.floor(Math.random()*(t-e));for(var a=0;a<o;a++)n+=this.charAt(Math.floor(Math.random()*this.length));return n},String.prototype.shuffle=function(){var e,t,o=this.split(""),n=o.length;if(n)for(;--n;)t=Math.floor(Math.random()*(n+1)),e=o[t],o[t]=o[n],o[n]=e;return o.join("")},String.prototype.toSeoUrl=function(){var e=this.replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g,"-").toLowerCase();"-"===e.charAt(0)&&(e=e.substring(1));var t=e.length-1;return"-"===e.charAt(t)&&(e=e.substring(0,t)),e},$.hood||($.hood={}),$.hood.FormValidator=function(e,t){this.Options=$.extend({formTag:e,validationRules:null,validationMessages:{},placeBelow:!0,submitButtonTag:null,submitUrl:null,submitFunction:null,serializationFunction:function(){return $(this.formTag).serialize()}},t||{}),this.LoadValidation=function(){$.hood.Helpers.IsNullOrUndefined(this.Options.formTag)||($(this.Options.formTag).find("input, textarea, select").keypress($.proxy(function(e){if(13===e.which)return $.proxy(this.submitForm(),this),e.preventDefault(),!1},this)),$(this.Options.formTag).validate({submitHandler:function(e){e.preventDefault()},errorClass:this.Options.errorClass,focusInvalid:!1,rules:this.Options.validationRules,messages:this.Options.validationMessages}),$.hood.Helpers.IsNullOrUndefined(this.Options.submitButtonTag)||$(this.Options.submitButtonTag).click($.proxy(this.submitForm,this)))},this.submitForm=function(){$(this.Options.formTag).valid()&&(this.TempButtonContent=$(this.Options.submitButtonTag).removeClass("btn-primary").addClass("btn-default").html(),$(this.Options.submitButtonTag).removeClass("btn-primary").addClass("btn-default").html('<i class="fa fa-refresh fa-spin"></i> Loading...'),$(this.Options.formTag).find("input[type=checkbox]").each(function(){$(this).is(":checked")&&$(this).val("true")}),$.post(this.Options.submitUrl,this.Options.serializationFunction(),$.proxy(function(e){$(this.Options.submitButtonTag).removeClass("btn-default").addClass("btn-primary").html(this.TempButtonContent),this.Options.submitFunction(e)},this)))},this.LoadValidation(),this.Options.placeBelow&&$(this.Options.formTag).addClass("validation-below")},$.fn.hoodValidator=function(e){return this.each(function(){var t=$(this);if(!t.data("hoodValidator")){var o=new $.hood.FormValidator(this,e);t.data("hoodValidator",o)}})},$.hood||($.hood={}),$.hood.Addresses={Init:function(){$("body").on("click",".address-set-billing",$.hood.Addresses.SetBilling),$("body").on("click",".address-set-delivery",$.hood.Addresses.SetDelivery),$("body").on("click",".address-delete",$.hood.Addresses.Delete)},Lists:{Address:{Loaded:function(e){$.hood.Loader(!1)},Reload:function(e){$("#address-list").doesExist()&&$.hood.Inline.Reload($("#address-list"),e)}}},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload(),e.Success&&t&&t.data("redirect")&&($.hood.Alerts.Success("<strong>Address deleted, redirecting...</strong><br />Just taking you back to the address list."),setTimeout(function(){window.location=t.data("redirect")},1500))})};$.hood.Alerts.Confirm("The address will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> <strong>This process CANNOT be undone!</strong></span>')},CreateOrEdit:function(){$.hood.Google.Addresses.InitAutocomplete(),$("#address-form").hoodValidator({validationRules:{Number:{required:!0},Address1:{required:!0},City:{required:!0},County:{required:!0},Postcode:{required:!0},Country:{required:!0}},submitButtonTag:$("#address-form-submit"),submitUrl:$("#address-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload(),e.Success&&$.hood.Inline.CloseModal()}})},SetBilling:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload()})};$.hood.Alerts.Confirm("The current billing address will be overwritten.","Are you sure?",o,"error")},SetDelivery:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Addresses.Lists.Address.Reload()})};$.hood.Alerts.Confirm("The current delivery address will be overwritten.","Are you sure?",o,"error")}},$(document).ready($.hood.Addresses.Init);var swalWithBootstrapButtons=Swal.mixin({customClass:{confirmButton:"btn btn-success btn-lg m-1 pl-4 pr-4",cancelButton:"btn btn-danger btn-lg m-1"},buttonsStyling:!1}),Toast=Swal.mixin({toast:!0,position:"top-end",showConfirmButton:!0});$.hood||($.hood={}),$.hood.Alerts={Error:function(e,t,o,n,a,i,r){!0===o?this.SweetAlert(e,t,"error",n,a,i,r):this.Alert(e,t,"error")},Warning:function(e,t,o,n,a,i,r){!0===o?this.SweetAlert(e,t,"warning",n,a,i,r):this.Alert(e,t,"warning")},Message:function(e,t,o,n,a,i,r){!0===o?this.SweetAlert(e,t,"info",n,a,i,r):this.Alert(e,t,"info")},Success:function(e,t,o,n,a,i,r){!0===o?this.SweetAlert(e,t,"success",n,a,i,r):this.Alert(e,t,"success")},Alert:function(e,t,o){Toast.fire({type:o||"info",html:e,title:t})},SweetAlert:function(e,t,o,n,a,i,r){swalWithBootstrapButtons.fire({title:t,html:e,type:o||"info",footer:n,showConfirmButton:a,timer:i}).then(function(e){e.dismiss||r(e)})},Confirm:function(e,t,o,n,a,i,r){swalWithBootstrapButtons.fire({title:t||"Woah!",html:e||"Are you sure you want to do this?",type:n||"warning",footer:a||'<span class="text-warning"><i class="fa fa-exclamation-triangle"></i> This cannot be undone.</span>',showCancelButton:!0,confirmButtonText:i||"Ok",cancelButtonText:r||"Cancel"}).then(function(e){e.dismiss||o(e.value)})},Prompt:function(e,t,o,n,a,i,r,l,s){swalWithBootstrapButtons.fire({input:n||"text",inputAttributes:s||{autocapitalize:"off"},title:t||"Enter a value",html:e||"Fill in the field and press Ok to continue.",type:a||"info",footer:i,showCancelButton:!0,confirmButtonText:r||"Ok",cancelButtonText:l||"Cancel"}).then(function(e){e.dismiss||o(e.value)})}},$.hood||($.hood={}),$.hood.Forms={Init:function(){$(".floating-label > label").each(function(){var e=$(this);e.parent().append(e)})},GetAllowedExtensions:function(e){switch(e){case"Image":return["png","jpg","jpeg","bmp","gif"];case"Document":return["doc","docx","pdf","rtf"];case"All":return""}},GetAllowedFiles:function(e){switch(e){case"Image":return"image/png,jpg,image/jpeg,image/gif";case"Document":return"application/msword,application/pdf,text/rtf";case"All":return""}}},$(document).ready($.hood.Forms.Init),$.hood||($.hood={}),$.hood.Inline={Tags:{},Init:function(){$(".hood-inline:not(.refresh)").each($.hood.Inline.Load),$("body").on("click",".hood-inline-task",$.hood.Inline.Task),$("body").on("click",".hood-modal",function(e){e.preventDefault(),$.hood.Inline.Modal($(this).attr("href"),$(this).data("complete"),$(this).data("close"))}),$.hood.Inline.DataList.Init()},Refresh:function(e){$(e||".hood-inline").each($.hood.Inline.Load)},Load:function(){$.hood.Inline.Reload(this)},Reload:function(e,t){var o=$(e);o.addClass("loading"),t||(t=o.data("complete"));var n=o.data("url");$.get(n,$.proxy(function(e){o.html(e),o.removeClass("loading"),t&&$.hood.Inline.RunComplete(t,o,e)},o)).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},CurrentModal:null,Modal:function(e,t){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];$.hood.Inline.CurrentModal&&o&&$.hood.Inline.CloseModal(),$.get(e,function(e){var o="#"+$(e).attr("id");$(e).addClass("hood-inline-modal"),$(o).length&&$(o).remove(),$("body").append(e),$.hood.Inline.CurrentModal=$(o),$(o).modal(),$(o).on("shown.bs.modal",function(){$(document).off("focusin.modal")}),$(o).on("hidden.bs.modal",function(e){$(this).remove()}),t&&$.hood.Inline.RunComplete(t,$(o),e)}).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},CloseModal:function(){$.hood.Inline.CurrentModal&&$.hood.Inline.CurrentModal.modal("hide")},Task:function(e){e.preventDefault();var t=$(e.currentTarget);t.addClass("loading");var o=t.data("complete");$.get(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&t&&t.data("redirect")&&setTimeout(function(){window.location=t.data("redirect")},1500),t.removeClass("loading"),o&&$.hood.Inline.RunComplete(o,t,e)}).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},DataList:{Init:function(){$(".hood-inline-list.query").each(function(){$(this).data("url",$(this).data("url")+window.location.search)}),$(".hood-inline-list:not(.refresh)").each($.hood.Inline.Load),$("body").on("click","a.hood-inline-list-target",function(e){e.preventDefault(),$.hood.Loader(!0);var t=document.createElement("a");t.href=$(this).attr("href");var o=$($(this).data("target")),n=document.createElement("a");n.href=o.data("url"),n.search=t.search,$.hood.Inline.DataList.Reload(o,n),complete=$(this).data("complete"),complete&&$.hood.Inline.RunComplete(complete,$(this))}),$("body").on("click",".hood-inline-list .pagination a",function(e){e.preventDefault(),$.hood.Loader(!0);var t=document.createElement("a");t.href=$(this).attr("href");var o=$(this).parents(".hood-inline-list"),n=document.createElement("a");n.href=o.data("url"),n.search=t.search,$.hood.Inline.DataList.Reload(o,n)}),$("body").on("submit",".hood-inline-list form",function(e){e.preventDefault(),$.hood.Loader(!0);var t=$(this),o=t.parents(".hood-inline-list"),n=document.createElement("a");n.href=o.data("url"),n.search="?"+t.serialize(),$.hood.Inline.DataList.Reload(o,n)}),$("body").on("submit","form.inline",function(e){e.preventDefault(),$.hood.Loader(!0);var t=$(this);$(t.data("target")).each(function(){var e=document.createElement("a");e.href=$(this).data("url"),e.href&&(e.search="?"+t.serialize(),$.hood.Inline.DataList.Reload($(this),e))})}),$("body").on("change","form.inline .refresh-on-change, .hood-inline-list form",function(e){e.preventDefault(),$.hood.Loader(!0);var t=$(this).parents("form"),o=$(t.data("target")),n=document.createElement("a");n.href=o.data("url"),n.search="?"+t.serialize(),$.hood.Inline.DataList.Reload(o,n)})},Reload:function(e,t){if(history.pushState&&e.hasClass("query")){var o=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+t.href.substring(t.href.indexOf("?")+1);window.history.pushState({path:o},"",o)}e.data("url",$.hood.Helpers.InsertQueryStringParamToUrl(t,"inline","true")),$.hood.Inline.Reload(e)}},HandleError:function(e){500===e.status?$.hood.Alerts.Error("<strong>Error "+e.status+"</strong><br />There was an error processing the content, please contact an administrator if this continues.<br/>"):404===e.status?$.hood.Alerts.Error("<strong>Error "+e.status+"</strong><br />The content could not be found.<br/>"):401===e.status&&($.hood.Alerts.Error("<strong>Error "+e.status+"</strong><br />You are not allowed to view this resource, are you logged in correctly?<br/>"),window.location=window.location)},Finish:function(){$.hood.Loader(!1)},RunComplete:function RunComplete(complete,sender,data){if(!$.hood.Helpers.IsNullOrUndefined(complete)){var func=eval(complete);"function"==typeof func&&func(sender,data)}}},$(document).ready($.hood.Inline.Init),$.hood.Modals={Open:$.hood.Inline.Modal},$.hood||($.hood={}),$.hood.Media={Init:function(){$("body").on("click",".media-delete",$.hood.Media.Delete),$("body").on("click",".media-directories-delete",$.hood.Media.Directories.Delete),$.hood.Media.Upload.Init(),$.hood.Media.Actions.Init()},Loaded:function(e){$.hood.Loader(!1)},BladeLoaded:function(e){$.hood.Media.LoadMediaPlayers()},Reload:function(e){$.hood.Inline.Reload($("#media-list"),e)},ReloadDirectories:function(e){$.hood.Inline.Reload($("#media-directories-list"),e)},Actions:{Init:function(){$("body").on("click",".hood-image-attach",$.hood.Media.Actions.Load.Attach),$("body").on("click",".hood-image-clear",$.hood.Media.Actions.Complete.Clear),$("body").on("click",".hood-image-insert",$.hood.Media.Actions.Load.Insert),$("body").on("click",".hood-media-select",$.hood.Media.Actions.Load.Select)},Target:null,Json:null,Current:{Attach:null},Load:{Attach:function(e){e.preventDefault(),$.hood.Media.Actions.Target=$($(this).data("tag")),$.hood.Media.Actions.Json=$($(this).data("json")),$.hood.Inline.Modal($(this).data("url"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-attach"),$("body").on("click",".media-attach",$.hood.Media.Actions.Complete.Attach)}),$.hood.Media.Upload.Init()})},Insert:function(e){var t=$("#"+e.id);t.data("imagesUrl")&&e.addButton("hoodimage",{text:"Insert image...",icon:!1,onclick:$.proxy(function(t){$.hood.Inline.Modal($(this).data("imagesUrl"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-insert"),$("body").on("click",".media-insert",$.proxy($.hood.Media.Actions.Complete.Insert,e))}),$.hood.Media.Upload.Init()})},t)})},Select:function(e){$.hood.Media.Actions.Target=$($(this).data("target")),$.hood.Inline.Modal($(this).data("url"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-select"),$("body").on("click",".media-select",$.hood.Media.Actions.Complete.Select)}),$.hood.Media.Upload.Init()})}},Complete:{Attach:function(e){e.preventDefault();var t=$.hood.Media.Actions.Target,o=$.hood.Media.Actions.Json;$.post($(this).data("url"),function(e){if($.hood.Helpers.ProcessResponse(e),e.Success){var n=e.Media.Icon;"Image"===e.Media.GeneralFileType&&(n=e.Media.MediumUrl),$.hood.Helpers.IsNullOrUndefined(t)||(t.css({"background-image":"url("+n+")"}),t.find("img").attr("src",n),t.removeClass("loading")), | ||
$.hood.Helpers.IsNullOrUndefined(o)||o.val(e.MediaJson)}}).done(function(){$("#media-select-modal").modal("hide")}).fail($.hood.Inline.HandleError)},Insert:function(e){var t=$(e.target);this.insertContent('<img alt="'+t.data("title")+'" src="'+t.data("url")+'"/>'),$.hood.Inline.CloseModal()},Select:function(e){var t=$(this).data("url"),o=$.hood.Media.Actions.Target;$(o).each(function(){$(this).is("input")?$(this).val(t):($(this).attr("src",t),$(this).css({"background-image":"url("+t+")"}),$(this).find("img").attr("src",t))}),$.hood.Alerts.Success("Image URL has been inserted.<br /><strong>Remember to press save!</strong>"),$("#media-select-modal").modal("hide")},Clear:function(e){e.preventDefault();var t=$($(this).data("tag")),o=$($(this).data("json"));$.post($(this).data("url"),function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&(icon=e.Media.Icon,"Image"===e.Media.GeneralFileType&&(icon=e.Media.MediumUrl),$.hood.Helpers.IsNullOrUndefined(t)||(t.css({"background-image":"url("+icon+")"}),t.find("img").attr("src",icon),t.removeClass("loading")),$.hood.Helpers.IsNullOrUndefined(o)||o.val(e.Json))}).fail($.hood.Inline.HandleError)}},RefreshImage:function(e,t,o){var n=$(e);n.addClass("loading"),$.get(t,{id:o},$.proxy(function(e){n.css({"background-image":"url("+e.SmallUrl+")"}),n.find("img").attr("src",e.SmallUrl),n.removeClass("loading")},this))}},Upload:{Init:function(){if($("#media-add").doesExist()){$("#media-total-progress").hide(),Dropzone.autoDiscover=!1;var e=new Dropzone("#media-upload",{url:$.hood.Media.Upload.UploadUrl,thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:!1,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!"});e.on("success",function(e,t){$.hood.Helpers.ProcessResponse(t)}),e.on("addedfile",function(e){$("#media-total-progress .progress-bar").css({width:"0%"}),$("#media-total-progress .progress-bar .percentage").html("0%")}),e.on("totaluploadprogress",function(e){$("#media-total-progress .progress-bar").css({width:e+"%"}),$("#media-total-progress .progress-bar .percentage").html(e+"%")}),e.on("sending",function(e){$("#media-total-progress").fadeIn(),$("#media-total-progress .progress-bar").css({width:"0%"}),$("#media-total-progress .progress-bar .percentage").html("0%")}),e.on("complete",function(e){$.hood.Media.Reload()}),e.on("queuecomplete",function(e){$("#media-total-progress").hide(),$.hood.Media.Reload()})}},UploadUrl:function(){return $("#media-upload").data("url")+"?directoryId="+$("#media-list > #upload-directory-id").val()}},Delete:function(e){var t=$(this),o=function(e){e&&$.post("/admin/media/delete",{id:t.data("id")},function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&($.hood.Media.Reload(),$(".modal-backdrop").remove(),$(".modal").modal("hide"))})};$.hood.Alerts.Confirm("The media file will be permanently removed. This cannot be undone.","Are you sure?",o,"warning",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> Ensure this file is not attached to any posts, pages or features of the site, or it will appear as a broken image or file.</span>',"Ok","Cancel")},RestrictDir:function(){var e=/[^0-9A-Za-z- ]*/g,t=$(this).val(),o=t.replace(e,"");t!==o&&$(this).val(o)},Directories:{Editor:function(){$("#content-directories-edit-form").hoodValidator({validationRules:{DisplayName:{required:!0},Slug:{required:!0}},submitButtonTag:$("#content-directories-edit-submit"),submitUrl:$("#content-directories-edit-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Media.ReloadDirectories(),$.hood.Media.Reload()}})},Delete:function(e){e.preventDefault();var t=$(this),o=function(e){e&&$.post(t.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Media.ReloadDirectories(),$.hood.Media.Reload()})};$.hood.Alerts.Confirm("The directory and all files will be permanently removed.","Are you sure?",o,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle mr-2"></i><strong>This cannot be undone!</strong><br />Ensure these files are not attached to any posts, pages or features of the site, or it will appear as a broken image or file.</span>')}},Players:{},LoadMediaPlayers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".hood-media",t={techOrder:["azureHtml5JS","flashSS","html5FairPlayHLS","silverlightSS","html5"],nativeControlsForTouch:!1,controls:!0,autoplay:!1,seeking:!0};$(e).each(function(){try{if(player=$.hood.Media.Players[$(this).data("id")],player)try{player.dispose()}catch(e){console.log("There was a problem disposing the old media player: ".concat(e))}$.hood.Media.Players[$(this).data("id")]=amp($(this).attr("id"),t),player=$.hood.Media.Players[$(this).data("id")],player.src([{src:$(this).data("file"),type:$(this).data("type")}])}catch(e){console.log("There was a problem playing the media file: ".concat(e))}})}},$(document).ready($.hood.Media.Init); |
@@ -1,1 +0,1 @@ | ||
"use strict";var swalWithBootstrapButtons=Swal.mixin({customClass:{confirmButton:"btn btn-success btn-lg m-1 pl-4 pr-4",cancelButton:"btn btn-danger btn-lg m-1"},buttonsStyling:!1}),Toast=Swal.mixin({toast:!0,position:"top-end",showConfirmButton:!0});$.hood||($.hood={}),$.hood.Alerts={Error:function(t,n,o,e,i,s,r){o===!0?this.SweetAlert(t,n,"error",e,i,s,r):this.Alert(t,n,"error")},Warning:function(t,n,o,e,i,s,r){o===!0?this.SweetAlert(t,n,"warning",e,i,s,r):this.Alert(t,n,"warning")},Message:function(t,n,o,e,i,s,r){o===!0?this.SweetAlert(t,n,"info",e,i,s,r):this.Alert(t,n,"info")},Success:function(t,n,o,e,i,s,r){o===!0?this.SweetAlert(t,n,"success",e,i,s,r):this.Alert(t,n,"success")},Alert:function(t,n,o){Toast.fire({type:o||"info",html:t,title:n})},SweetAlert:function(t,n,o,e,i,s,r){swalWithBootstrapButtons.fire({title:n,html:t,type:o||"info",footer:e,showConfirmButton:i,timer:s}).then(function(t){t.dismiss||r(t)})},Confirm:function(t,n,o,e,i,s,r){swalWithBootstrapButtons.fire({title:n||"Woah!",html:t||"Are you sure you want to do this?",type:e||"warning",footer:i||'<span class="text-warning"><i class="fa fa-exclamation-triangle"></i> This cannot be undone.</span>',showCancelButton:!0,confirmButtonText:s||"Ok",cancelButtonText:r||"Cancel"}).then(function(t){t.dismiss||o(t.value)})},Prompt:function(t,n,o,e,i,s,r,a,l){swalWithBootstrapButtons.fire({input:e||"text",inputAttributes:l||{autocapitalize:"off"},title:n||"Enter a value",html:t||"Fill in the field and press Ok to continue.",type:i||"info",footer:s,showCancelButton:!0,confirmButtonText:r||"Ok",cancelButtonText:a||"Cancel"}).then(function(t){t.dismiss||o(t.value)})}}; | ||
"use strict";var swalWithBootstrapButtons=Swal.mixin({customClass:{confirmButton:"btn btn-success btn-lg m-1 pl-4 pr-4",cancelButton:"btn btn-danger btn-lg m-1"},buttonsStyling:!1}),Toast=Swal.mixin({toast:!0,position:"top-end",showConfirmButton:!0});$.hood||($.hood={}),$.hood.Alerts={Error:function(t,n,o,e,i,s,r){!0===o?this.SweetAlert(t,n,"error",e,i,s,r):this.Alert(t,n,"error")},Warning:function(t,n,o,e,i,s,r){!0===o?this.SweetAlert(t,n,"warning",e,i,s,r):this.Alert(t,n,"warning")},Message:function(t,n,o,e,i,s,r){!0===o?this.SweetAlert(t,n,"info",e,i,s,r):this.Alert(t,n,"info")},Success:function(t,n,o,e,i,s,r){!0===o?this.SweetAlert(t,n,"success",e,i,s,r):this.Alert(t,n,"success")},Alert:function(t,n,o){Toast.fire({type:o||"info",html:t,title:n})},SweetAlert:function(t,n,o,e,i,s,r){swalWithBootstrapButtons.fire({title:n,html:t,type:o||"info",footer:e,showConfirmButton:i,timer:s}).then(function(t){t.dismiss||r(t)})},Confirm:function(t,n,o,e,i,s,r){swalWithBootstrapButtons.fire({title:n||"Woah!",html:t||"Are you sure you want to do this?",type:e||"warning",footer:i||'<span class="text-warning"><i class="fa fa-exclamation-triangle"></i> This cannot be undone.</span>',showCancelButton:!0,confirmButtonText:s||"Ok",cancelButtonText:r||"Cancel"}).then(function(t){t.dismiss||o(t.value)})},Prompt:function(t,n,o,e,i,s,r,a,l){swalWithBootstrapButtons.fire({input:e||"text",inputAttributes:l||{autocapitalize:"off"},title:n||"Enter a value",html:t||"Fill in the field and press Ok to continue.",type:i||"info",footer:s,showCancelButton:!0,confirmButtonText:r||"Ok",cancelButtonText:a||"Cancel"}).then(function(t){t.dismiss||o(t.value)})}}; |
@@ -1,1 +0,1 @@ | ||
"use strict";$.hood||($.hood={}),$.body=$("body");var console=window.console||{};console.log=console.log||function(){},console.warn=console.warn||function(){},console.error=console.error||function(){},console.info=console.info||function(){},$.fn.exists=function(){return $(this).length},$.fn.doesExist=function(){return $(this).length},$.fn.restrictToSlug=function(e){var t=$(this),n=e||/[^0-9a-zA-Z]*/g,o=function(){var e=$(this).val(),t=e.replace(n,"");e!==t&&$(this).val(t)};t.on("keyup",o),t.on("paste",o),t.on("change",o)},$(".restrict-to-slug").restrictToSlug(),$.fn.restrictToPageSlug=function(e){var t=$(this),n=e||/[^0-9a-zA-Z-//]*/g,o=function(){var e=$(this).val(),t=e.replace(n,"");if((t.match(new RegExp("/","g"))||[]).length>4){var o=t.lastIndexOf("/");t=t.substring(0,o)+t.substring(o+1),$.hood.Alerts.Warning("You can only have up to 4 '/' characters in a url slug.")}e!==t&&$(this).val(t)};t.on("keyup",o),t.on("paste",o),t.on("change",o)},$(".restrict-to-page-slug").restrictToPageSlug(),$.fn.restrictToMetaSlug=function(e){var t=$(this),n=e||/[^0-9a-zA-Z.]*/g,o=function(){var e=$(this).val(),t=e.replace(n,"");if((t.match(new RegExp(".","g"))||[]).length>1){var o=t.lastIndexOf(".");t=t.substring(0,o)+t.substring(o+1),$.hood.Alerts.Warning("You can only have up to 1 '.' characters in a meta slug.")}e!==t&&$(this).val(t)};t.on("keyup",o),t.on("paste",o),t.on("change",o)},$(".restrict-to-meta-slug").restrictToMetaSlug(),$.fn.characterCounter=function(e){var t=$(this),n=function(){var e=$(this).data("counter"),t=Number($(this).attr("maxlength")),n=$(this).val().length;$(e).text(t-n);var o="text-success";t-n<t/10&&(o="text-danger"),$(e).parent().removeClass("text-success").removeClass("text-danger").addClass(o)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".character-counter").characterCounter(),$(".character-counter").trigger("change"),$.fn.addLoader=function(){$(this).data("loadercontent",$(this).html()),$(this).addClass("loading").append('<i class="fa fa-refresh fa-spin m-l-sm"></i>')},$.fn.removeLoader=function(){$(this).empty().html($(this).data("loadercontent")),$(this).removeClass("loading")},$.fn.warningAlert=function(){var e=$(this),t=function(e){e.preventDefault();var t=function(t){if(t){var n=$(e.currentTarget).attr("href");window.location=n}};return $.hood.Alerts.Confirm($(e.currentTarget).data("warning"),$(e.currentTarget).data("title"),t,"warning",$(e.currentTarget).data("footer"),"Ok","Cancel"),!1};e.on("click",t)},$(".warning-alert").warningAlert(),$.commonHeight=function(e,t){var n=0;e.children(t).each(function(){var e=$(this).children();e.hasClass("max-height")?n=e.outerHeight():e.outerHeight()>n&&(n=e.outerHeight())}),e.children(t).each(function(){$(this).height(n)})},$.loadCss=function(e,t){$("link#"+e).length||$("<link/>",{id:e,rel:"stylesheet",type:"text/css",href:t}).appendTo("head")},$.getUrlVars=function(){for(var e,t=[],n=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),o=0;o<n.length;o++)e=n[o].split("="),t.push(e[0]),t[e[0]]=e[1];return t},$.decodeUrl=function(e){return decodeURIComponent(e).replace("+"," ")},$.numberWithCommas=function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},$.validator&&($.validator.addMethod("time",function(e,t){return this.optional(t)||/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$/i.test(e)},"Please enter a valid time."),$.validator.addMethod("ukdate",function(e,t){return e.match(/^\d\d?\/\d\d?\/\d\d\d\d$/)},"Please enter a date in the format dd/mm/yyyy.")),$.mobile={Android:function(){return navigator.userAgent.match(/Android/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)},Any:function(){return $.mobile.Android()||$.mobile.BlackBerry()||$.mobile.iOS()||$.mobile.Opera()||$.mobile.Windows()}},$.mobile.Android?$.mobile.BlackBerry?$.mobile.iOS?$.mobile.Opera?$.mobile.Windows?($.body.addClass("desktop-device"),$.device="desktop"):($.body.addClass("windows-device"),$.device="windows"):($.body.addClass("opera-device"),$.device="opera"):($.body.addClass("ios-device"),$.device="ios"):($.body.addClass("blackberry-device"),$.device="blackberry"):($.body.addClass("android-device"),$.device="android"),function(){var e={password:"0",username:"0"};$("body").on("change",".prevent-autocomplete",function(t){var n=$(this).attr("id");"0"!==e[n]&&e[n]===$(this).val()||$(this).val("")}),$("body").on("keyup",".prevent-autocomplete",function(t){var n=$(this).attr("id");e[n]=$(this).val()})}(),function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}return"function"!=typeof window.CustomEvent&&(e.prototype=window.Event.prototype,void(window.CustomEvent=e))}(),$.hood.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"}],$.hood.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"}],new CustomEvent("loader-show"),new CustomEvent("loader-hide"),$.hood.Loader=function(e){e?$("body").trigger("loader-show"):$("body").trigger("loader-hide")}; | ||
"use strict";$.hood||($.hood={}),$.body=$("body");var console=window.console||{};console.log=console.log||function(){},console.warn=console.warn||function(){},console.error=console.error||function(){},console.info=console.info||function(){},$.fn.exists=function(){return $(this).length},$.fn.doesExist=function(){return $(this).length},$.fn.restrictToSlug=function(e){var t=$(this),n=e||/[^0-9a-zA-Z]*/g,o=function(){var e=$(this).val(),t=e.replace(n,"");e!==t&&$(this).val(t)};t.on("keyup",o),t.on("paste",o),t.on("change",o)},$(".restrict-to-slug").restrictToSlug(),$.fn.restrictToPageSlug=function(e){var t=$(this),n=e||/[^0-9a-zA-Z-//]*/g,o=function(){var e=$(this).val(),t=e.replace(n,"");if((t.match(new RegExp("/","g"))||[]).length>4){var o=t.lastIndexOf("/");t=t.substring(0,o)+t.substring(o+1),$.hood.Alerts.Warning("You can only have up to 4 '/' characters in a url slug.")}e!==t&&$(this).val(t)};t.on("keyup",o),t.on("paste",o),t.on("change",o)},$(".restrict-to-page-slug").restrictToPageSlug(),$.fn.restrictToMetaSlug=function(e){var t=$(this),n=e||/[^0-9a-zA-Z.]*/g,o=function(){var e=$(this).val(),t=e.replace(n,"");if((t.match(new RegExp(".","g"))||[]).length>1){var o=t.lastIndexOf(".");t=t.substring(0,o)+t.substring(o+1),$.hood.Alerts.Warning("You can only have up to 1 '.' characters in a meta slug.")}e!==t&&$(this).val(t)};t.on("keyup",o),t.on("paste",o),t.on("change",o)},$(".restrict-to-meta-slug").restrictToMetaSlug(),$.fn.characterCounter=function(e){var t=$(this),n=function(){var e=$(this).data("counter"),t=Number($(this).attr("maxlength")),n=$(this).val().length;$(e).text(t-n);var o="text-success";t-n<t/10&&(o="text-danger"),$(e).parent().removeClass("text-success").removeClass("text-danger").addClass(o)};t.on("keyup",n),t.on("paste",n),t.on("change",n)},$(".character-counter").characterCounter(),$(".character-counter").trigger("change"),$.fn.addLoader=function(){$(this).data("loadercontent",$(this).html()),$(this).addClass("loading").append('<i class="fa fa-refresh fa-spin m-l-sm"></i>')},$.fn.removeLoader=function(){$(this).empty().html($(this).data("loadercontent")),$(this).removeClass("loading")},$.fn.warningAlert=function(){var e=$(this),t=function(e){e.preventDefault();var t=function(t){if(t){var n=$(e.currentTarget).attr("href");window.location=n}};return $.hood.Alerts.Confirm($(e.currentTarget).data("warning"),$(e.currentTarget).data("title"),t,"warning",$(e.currentTarget).data("footer"),"Ok","Cancel"),!1};e.on("click",t)},$(".warning-alert").warningAlert(),$.commonHeight=function(e,t){var n=0;e.children(t).each(function(){var e=$(this).children();e.hasClass("max-height")?n=e.outerHeight():e.outerHeight()>n&&(n=e.outerHeight())}),e.children(t).each(function(){$(this).height(n)})},$.loadCss=function(e,t){$("link#"+e).length||$("<link/>",{id:e,rel:"stylesheet",type:"text/css",href:t}).appendTo("head")},$.getUrlVars=function(){for(var e,t=[],n=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),o=0;o<n.length;o++)e=n[o].split("="),t.push(e[0]),t[e[0]]=e[1];return t},$.decodeUrl=function(e){return decodeURIComponent(e).replace("+"," ")},$.numberWithCommas=function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},$.validator&&($.validator.addMethod("time",function(e,t){return this.optional(t)||/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$/i.test(e)},"Please enter a valid time."),$.validator.addMethod("ukdate",function(e,t){return e.match(/^\d\d?\/\d\d?\/\d\d\d\d$/)},"Please enter a date in the format dd/mm/yyyy.")),$.mobile={Android:function(){return navigator.userAgent.match(/Android/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)},Any:function(){return $.mobile.Android()||$.mobile.BlackBerry()||$.mobile.iOS()||$.mobile.Opera()||$.mobile.Windows()}},$.mobile.Android?$.mobile.BlackBerry?$.mobile.iOS?$.mobile.Opera?$.mobile.Windows?($.body.addClass("desktop-device"),$.device="desktop"):($.body.addClass("windows-device"),$.device="windows"):($.body.addClass("opera-device"),$.device="opera"):($.body.addClass("ios-device"),$.device="ios"):($.body.addClass("blackberry-device"),$.device="blackberry"):($.body.addClass("android-device"),$.device="android"),function(){var e={password:"0",username:"0"};$("body").on("change",".prevent-autocomplete",function(t){var n=$(this).attr("id");"0"!==e[n]&&e[n]===$(this).val()||$(this).val("")}),$("body").on("keyup",".prevent-autocomplete",function(t){var n=$(this).attr("id");e[n]=$(this).val()})}(),function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}if("function"==typeof window.CustomEvent)return!1;e.prototype=window.Event.prototype,window.CustomEvent=e}(),$.hood.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"}],$.hood.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"}],new CustomEvent("loader-show"),new CustomEvent("loader-hide"),$.hood.Loader=function(e){e?$("body").trigger("loader-show"):$("body").trigger("loader-hide")}; |
@@ -273,2 +273,3 @@ if (!$.hood) | ||
$(elemId).val('#' + result); | ||
$(elemId).change(); | ||
}; | ||
@@ -320,2 +321,3 @@ var pickrs = []; | ||
$(elemId).val(''); | ||
$(elemId).change(); | ||
}) | ||
@@ -322,0 +324,0 @@ .on('change', updateColorFieldValue); |
@@ -1,1 +0,1 @@ | ||
"use strict";$.hood||($.hood={}),$.hood.Handlers={Init:function(){$("body").on("click",".select-text",$.hood.Handlers.SelectTextContent),$("body").on("click",".btn.click-select[data-target][data-value]",$.hood.Handlers.ClickSelect),$("body").on("click",".click-select.show-selected[data-target][data-value]",$.hood.Handlers.ClickSelect),$("body").on("click",".click-select:not(.show-selected)[data-target][data-value]",$.hood.Handlers.ClickSelectClean),$("body").on("click",".slide-link",$.hood.Handlers.SlideToAnchor),$("body").on("click",".scroll-target, .scroll-to-target",$.hood.Handlers.ScrollToTarget),$("body").on("click",".scroll-top, .scroll-to-top",$.hood.Handlers.ScrollToTop),$("body").on("change","input[type=checkbox][data-input]",$.hood.Handlers.CheckboxChange),$("body").on("change",".submit-on-change",$.hood.Handlers.SubmitOnChange),$("select[data-selected]").each($.hood.Handlers.SelectSetup),$("body").on("change",".inline-date",$.hood.Handlers.DateChange),$.hood.Handlers.Uploaders.Init(),$.hood.Handlers.ColorPickers()},ScrollToTop:function(e){return e&&e.preventDefault(),$("html, body").animate({scrollTop:0},800),!1},ScrollToTarget:function(e){e&&e.preventDefault();var t=$(this).attr("href").split("#")[0];if(t===window.location.pathname||""===t){var a=this.hash,o=$(a),r=$("header.header"),l=0;r&&(l=r.height()),$(this).data("offset")?$("html, body").stop().animate({scrollTop:o.offset().top-$(this).data("offset")},900,"swing"):$("html, body").stop().animate({scrollTop:o.offset().top-l},900,"swing")}},SubmitOnChange:function(e){e&&e.preventDefault(),$(this).parents("form").submit()},DateChange:function(e){e&&e.preventDefault();var t=$(this).parents(".hood-date").find(".date-output"),a=t.parents(".hood-date").find(".date-value").val(),o=/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/;o.test(a)||(a="01/01/2001");var r=t.parents(".hood-date").find(".hour-value").val();$.isNumeric(r)||(r="00");var l=t.parents(".hood-date").find(".minute-value").val();$.isNumeric(l)||(l="00"),t.val(a+" "+r+":"+l+":00"),t.attr("value",a+" "+r+":"+l+":00")},CheckboxChange:function(e){e&&e.preventDefault();var t=new Array;$('input[data-input="'+$(this).data("input")+'"]').each(function(){$(this).is(":checked")&&t.push($(this).val())});var a="#"+$(this).data("input"),o=JSON.stringify(t);$(a).val(o)},SelectSetup:function(){$(this).data("selected");if("undefined"!==$(this).data("selected")&&""!==$(this).data("selected")){var e=String($(this).data("selected"));$(this).val(e)}},ClickSelect:function(){var e=$(this),t="#"+e.data("target");$(t).val(e.data("value")),$(t).trigger("change"),$('.click-select[data-target="'+e.data("target")+'"]').each(function(){$(this).html($(this).data("temp")).removeClass("active")}),$('.click-select[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).data("temp",$(this).html()).html("Selected").addClass("active")})},ClickSelectClean:function(){var e=$(this),t="#"+e.data("target");$(t).val(e.data("value")),$(t).trigger("change"),$('.click-select.clean[data-target="'+e.data("target")+'"]').each(function(){$(this).removeClass("active")}),$('.click-select.clean[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).addClass("active")})},SelectTextContent:function(){var e=$(this);e.select(),e.mouseup(function(){return e.unbind("mouseup"),!1})},SlideToAnchor:function(){var e=$("body").scrollTop(),t=$($.attr(this,"href")).offset().top;return $("html, body").animate({scrollTop:t},Math.abs(t-e)),!1},Uploaders:{Init:function(){($(".image-uploader").length||$(".gallery-uploader").length)&&($(".upload-progress-bar").hide(),$.getScript("/lib/dropzone/min/dropzone.min.js",$.proxy(function(){$(".image-uploader").each(function(){$.hood.Handlers.Uploaders.SingleImage($(this).attr("id"),$(this).data("json"))}),$(".gallery-uploader").each(function(){$.hood.Handlers.Uploaders.Gallery($(this).attr("id"),$(this).data("json"))})},this)))},RefreshImage:function(e,t){$(e.data("preview")).css({"background-image":"url("+t.Media.SmallUrl+")"}),$(e.data("preview")).find("img").attr("src",t.Media.SmallUrl)},SingleImage:function(e,t){e="#"+e;$(e);Dropzone.autoDiscover=!1;var a=new Dropzone(e,{url:$(e).data("url"),maxFiles:1,paramName:"file",parallelUploads:1,acceptedFiles:$(e).data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:!1,clickable:e});a.on("addedfile",function(){}),a.on("totaluploadprogress",function(t){$(".upload-progress-bar."+e.replace("#","")+" .progress-bar").css({width:t+"%"})}),a.on("sending",function(t){$(".upload-progress-bar."+e.replace("#","")).show(),$($(e).data("preview")).addClass("loading")}),a.on("queuecomplete",function(t){$(".upload-progress-bar."+e.replace("#","")).hide()}),a.on("success",function(o,r){r.Success?(r.Media&&($(t).val(JSON.stringify(r.Media)),$($(e).data("preview")).css({"background-image":"url("+r.Media.SmallUrl+")"}),$($(e).data("preview")).find("img").attr("src",r.Media.SmallUrl)),$.hood.Alerts.Success("New image added!")):$.hood.Alerts.Error("There was a problem adding the image: "+r.Error),a.removeFile(o),$($(e).data("preview")).removeClass("loading")})},Gallery:function(e){Dropzone.autoDiscover=!1;var t=document.querySelector(e+"-template");t.id="";var a=t.parentNode.innerHTML;t.parentNode.removeChild(t);var o=new Dropzone(e,{url:$(e).data("url"),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:a,paramName:"files",acceptedFiles:$(e).data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:"#previews",clickable:".fileinput-button",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!"});$(e+" .cancel").hide(),o.on("addedfile",function(t){$(t.previewElement.querySelector(".complete")).hide(),$(t.previewElement.querySelector(".cancel")).show(),$(e+" .cancel").show()}),o.on("totaluploadprogress",function(e){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(),$.hood.Inline.Refresh(".gallery")}),o.on("queuecomplete",function(t){document.querySelector("#total-progress").style.opacity="0",$(e+" .cancel").hide()}),o.on("success",function(e,t){$.hood.Inline.Refresh(".gallery"),t.Success?$.hood.Alerts.Success("New images added!"):$.hood.Alerts.Error("There was a problem adding the profile image: "+t.Error)}),document.querySelector(".actions .cancel").onclick=function(){o.removeAllFiles(!0)}}},ColorPickers:function(){var e=function(e,t){var a=$(t._root.button).parent().data("target");$(t._root.button).css({"background-color":e.toHEXA().toString()});for(var o=t.getColor().toHEXA(),r="",l=o.length-1;l>=0;l--)r=o[l]+r;$(a).val("#"+r)},t=[];$(".color-picker").each(function(a,o){var r=!0;"true"==$(this).data("opacity")&&(r=!1);var l=Pickr.create({el:o.children[0],appClass:"custom-class",theme:"monolith",useAsButton:!0,default:$(this).data("default")||"none",lockOpacity:r,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 a=$(t._root.button).parent().data("target"),o=$(a).val();$(a).on("click",$.proxy(function(){this.show()},t)),o&&(t.setColor(o),e(t.getColor(),t))}).on("clear",function(t){var a=$(t._root.button).parent().data("target");t.setColor("transparent"),e(t.getColor(),t),$(a).val("")}).on("change",e);t.push(l)})}},$(document).ready($.hood.Handlers.Init); | ||
"use strict";$.hood||($.hood={}),$.hood.Handlers={Init:function(){$("body").on("click",".select-text",$.hood.Handlers.SelectTextContent),$("body").on("click",".btn.click-select[data-target][data-value]",$.hood.Handlers.ClickSelect),$("body").on("click",".click-select.show-selected[data-target][data-value]",$.hood.Handlers.ClickSelect),$("body").on("click",".click-select:not(.show-selected)[data-target][data-value]",$.hood.Handlers.ClickSelectClean),$("body").on("click",".slide-link",$.hood.Handlers.SlideToAnchor),$("body").on("click",".scroll-target, .scroll-to-target",$.hood.Handlers.ScrollToTarget),$("body").on("click",".scroll-top, .scroll-to-top",$.hood.Handlers.ScrollToTop),$("body").on("change","input[type=checkbox][data-input]",$.hood.Handlers.CheckboxChange),$("body").on("change",".submit-on-change",$.hood.Handlers.SubmitOnChange),$("select[data-selected]").each($.hood.Handlers.SelectSetup),$("body").on("change",".inline-date",$.hood.Handlers.DateChange),$.hood.Handlers.Uploaders.Init(),$.hood.Handlers.ColorPickers()},ScrollToTop:function(e){return e&&e.preventDefault(),$("html, body").animate({scrollTop:0},800),!1},ScrollToTarget:function(e){e&&e.preventDefault();var t=$(this).attr("href").split("#")[0];if(t===window.location.pathname||""===t){var a=this.hash,o=$(a),r=$("header.header"),l=0;r&&(l=r.height()),$(this).data("offset")?$("html, body").stop().animate({scrollTop:o.offset().top-$(this).data("offset")},900,"swing"):$("html, body").stop().animate({scrollTop:o.offset().top-l},900,"swing")}},SubmitOnChange:function(e){e&&e.preventDefault(),$(this).parents("form").submit()},DateChange:function(e){e&&e.preventDefault();var t=$(this).parents(".hood-date").find(".date-output"),a=t.parents(".hood-date").find(".date-value").val();/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/.test(a)||(a="01/01/2001");var o=t.parents(".hood-date").find(".hour-value").val();$.isNumeric(o)||(o="00");var r=t.parents(".hood-date").find(".minute-value").val();$.isNumeric(r)||(r="00"),t.val(a+" "+o+":"+r+":00"),t.attr("value",a+" "+o+":"+r+":00")},CheckboxChange:function(e){e&&e.preventDefault();var t=new Array;$('input[data-input="'+$(this).data("input")+'"]').each(function(){$(this).is(":checked")&&t.push($(this).val())});var a="#"+$(this).data("input"),o=JSON.stringify(t);$(a).val(o)},SelectSetup:function(){$(this).data("selected");if("undefined"!==$(this).data("selected")&&""!==$(this).data("selected")){var e=String($(this).data("selected"));$(this).val(e)}},ClickSelect:function(){var e=$(this),t="#"+e.data("target");$(t).val(e.data("value")),$(t).trigger("change"),$('.click-select[data-target="'+e.data("target")+'"]').each(function(){$(this).html($(this).data("temp")).removeClass("active")}),$('.click-select[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).data("temp",$(this).html()).html("Selected").addClass("active")})},ClickSelectClean:function(){var e=$(this),t="#"+e.data("target");$(t).val(e.data("value")),$(t).trigger("change"),$('.click-select.clean[data-target="'+e.data("target")+'"]').each(function(){$(this).removeClass("active")}),$('.click-select.clean[data-target="'+e.data("target")+'"][data-value="'+e.data("value")+'"]').each(function(){$(this).addClass("active")})},SelectTextContent:function(){var e=$(this);e.select(),e.mouseup(function(){return e.unbind("mouseup"),!1})},SlideToAnchor:function(){var e=$("body").scrollTop(),t=$($.attr(this,"href")).offset().top;return $("html, body").animate({scrollTop:t},Math.abs(t-e)),!1},Uploaders:{Init:function(){($(".image-uploader").length||$(".gallery-uploader").length)&&($(".upload-progress-bar").hide(),$.getScript("/lib/dropzone/min/dropzone.min.js",$.proxy(function(){$(".image-uploader").each(function(){$.hood.Handlers.Uploaders.SingleImage($(this).attr("id"),$(this).data("json"))}),$(".gallery-uploader").each(function(){$.hood.Handlers.Uploaders.Gallery($(this).attr("id"),$(this).data("json"))})},this)))},RefreshImage:function(e,t){$(e.data("preview")).css({"background-image":"url("+t.Media.SmallUrl+")"}),$(e.data("preview")).find("img").attr("src",t.Media.SmallUrl)},SingleImage:function(e,t){e="#"+e;$(e);Dropzone.autoDiscover=!1;var a=new Dropzone(e,{url:$(e).data("url"),maxFiles:1,paramName:"file",parallelUploads:1,acceptedFiles:$(e).data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:!1,clickable:e});a.on("addedfile",function(){}),a.on("totaluploadprogress",function(t){$(".upload-progress-bar."+e.replace("#","")+" .progress-bar").css({width:t+"%"})}),a.on("sending",function(t){$(".upload-progress-bar."+e.replace("#","")).show(),$($(e).data("preview")).addClass("loading")}),a.on("queuecomplete",function(t){$(".upload-progress-bar."+e.replace("#","")).hide()}),a.on("success",function(o,r){r.Success?(r.Media&&($(t).val(JSON.stringify(r.Media)),$($(e).data("preview")).css({"background-image":"url("+r.Media.SmallUrl+")"}),$($(e).data("preview")).find("img").attr("src",r.Media.SmallUrl)),$.hood.Alerts.Success("New image added!")):$.hood.Alerts.Error("There was a problem adding the image: "+r.Error),a.removeFile(o),$($(e).data("preview")).removeClass("loading")})},Gallery:function(e){Dropzone.autoDiscover=!1;var t=document.querySelector(e+"-template");t.id="";var a=t.parentNode.innerHTML;t.parentNode.removeChild(t);var o=new Dropzone(e,{url:$(e).data("url"),thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:a,paramName:"files",acceptedFiles:$(e).data("types")||".png,.jpg,.jpeg,.gif",autoProcessQueue:!0,previewsContainer:"#previews",clickable:".fileinput-button",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!"});$(e+" .cancel").hide(),o.on("addedfile",function(t){$(t.previewElement.querySelector(".complete")).hide(),$(t.previewElement.querySelector(".cancel")).show(),$(e+" .cancel").show()}),o.on("totaluploadprogress",function(e){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(),$.hood.Inline.Refresh(".gallery")}),o.on("queuecomplete",function(t){document.querySelector("#total-progress").style.opacity="0",$(e+" .cancel").hide()}),o.on("success",function(e,t){$.hood.Inline.Refresh(".gallery"),t.Success?$.hood.Alerts.Success("New images added!"):$.hood.Alerts.Error("There was a problem adding the profile image: "+t.Error)}),document.querySelector(".actions .cancel").onclick=function(){o.removeAllFiles(!0)}}},ColorPickers:function(){var e=function(e,t){var a=$(t._root.button).parent().data("target");$(t._root.button).css({"background-color":e.toHEXA().toString()});for(var o=t.getColor().toHEXA(),r="",l=o.length-1;l>=0;l--)r=o[l]+r;$(a).val("#"+r),$(a).change()},t=[];$(".color-picker").each(function(a,o){var r=!0;"true"==$(this).data("opacity")&&(r=!1);var l=Pickr.create({el:o.children[0],appClass:"custom-class",theme:"monolith",useAsButton:!0,default:$(this).data("default")||"none",lockOpacity:r,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 a=$(t._root.button).parent().data("target"),o=$(a).val();$(a).on("click",$.proxy(function(){this.show()},t)),o&&(t.setColor(o),e(t.getColor(),t))}).on("clear",function(t){var a=$(t._root.button).parent().data("target");t.setColor("transparent"),e(t.getColor(),t),$(a).val(""),$(a).change()}).on("change",e);t.push(l)})}},$(document).ready($.hood.Handlers.Init); |
@@ -1,1 +0,1 @@ | ||
"use strict";$.hood||($.hood={}),$.hood.Helpers={IsNullOrUndefined:function(e){var t=!1;return null!==e&&"undefined"!=typeof e&&""!==e||(t=!0),t},IsSet:function(e){var t=!1;return null!==e&&"undefined"!=typeof e&&""!==e||(t=!0),!t},IsEventSupported:function(e){var t=document.createElement("div");e="on"+e;var n=e in t;return n||(t.setAttribute(e,"return;"),n="function"==typeof t[e]),t=null,n},IsFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},IsUrlExternal:function(e){var t=e.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);return"string"==typeof t[1]&&t[1].length>0&&t[1].toLowerCase()!==location.protocol||"string"==typeof t[2]&&t[2].length>0&&t[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host},IsInIframe:function(){try{return window.self!==window.top}catch(e){return!0}},HtmlEncode:function(e){return $("<div/>").text(e).html()},HtmlDecode:function(e){return $("<div/>").html(e).text()},FormatCurrency:function(e,t){return t+" "+e.toFixed(2).replace(/./g,function(e,t,n){return t>0&&"."!==e&&(n.length-t)%3===0?","+e:e})},FormatKilobytes:function(e){return e/=1024,e.toFixed(2).replace(/./g,function(e,t,n){return t>0&&"."!==e&&(n.length-t)%3===0?","+e:e})},FormatMegabytes:function(e){return e/=1024,e/=1024,currency+" "+e.toFixed(2).replace(/./g,function(e,t,n){return t>0&&"."!==e&&(n.length-t)%3===0?","+e:e})},FallbackCopyTextToClipboard:function(e){var t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch(e){console.error("Oops, unable to copy",e)}document.body.removeChild(t)},CopyTextToClipboard:function(e){return navigator.clipboard?void navigator.clipboard.writeText(e).then(function(){},function(e){console.error("Could not copy text: ",e)}):void $.hood.Handlers.FallbackCopyTextToClipboard(e)},ProcessResponse:function(e){var t="";e.Title&&(t="<strong>".concat(e.Title,"</strong><br />")),e.Success?$.hood.Alerts.Success("".concat(t).concat(e.Message)):$.hood.Alerts.Error("".concat(t).concat(e.Errors))},GetQueryStringParamByName:function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)","i"),n=t.exec(location.search);return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))},InsertQueryStringParam:function(e,t){e=escape(e),t=escape(t);var n=document.location.search.substr(1).split("&");if(""===n)document.location.search="?"+e+"="+t;else{for(var r,o=n.length;o--;)if(r=n[o].split("="),r[0]===e){r[1]=t,n[o]=r.join("=");break}o<0&&(n[n.length]=[e,t].join("=")),document.location.search=n.join("&")}},InsertQueryStringParamToUrl:function(e,t,n){t=escape(t),n=escape(n);var r=e.search.substr(1).split("&");if(""===r)e.search="?"+t+"="+n;else{for(var o,c=r.length;c--;)if(o=r[c].split("="),o[0]===t){o[1]=n,r[c]=o.join("=");break}c<0&&(r[r.length]=[t,n].join("=")),e.search=r.join("&")}return e},UrlToLocationObject:function(e){var t=document.createElement("a");return t.href=e,t},FindAndRemoveFromArray:function(e,t,n){$.each(e,function(r,o){o[t]===n&&e.splice(r,1)})},FindAndReturnFromArray:function(e,t,n){var r=null;return $.each(e,function(e,o){o[t]===n&&(r=o)}),r},LeftPad:function(e,t){for(var n=e+"";n.length<t;)n="0"+n;return n},DateAdd:function(e,t,n){var r=new Date(e);switch(t.toLowerCase()){case"year":r.setFullYear(r.getFullYear()+n);break;case"quarter":r.setMonth(r.getMonth()+3*n);break;case"month":r.setMonth(r.getMonth()+n);break;case"week":r.setDate(r.getDate()+7*n);break;case"day":r.setDate(r.getDate()+n);break;case"hour":r.setTime(r.getTime()+36e5*n);break;case"minute":r.setTime(r.getTime()+6e4*n);break;case"second":r.setTime(r.getTime()+1e3*n);break;default:r=void 0}return r},GenerateRandomString:function(e){var t="!@#$&*",n="abcdefghijklmnopqrstuvwxyz",r="ABCDEFGHIJKLMNOPQRSTUVWXYZ",o="0123456789",c=n+r+o,a=(t.pick(1)+n.pick(1)+r.pick(1)+c.pick(5,10)).shuffle();return a}}; | ||
"use strict";$.hood||($.hood={}),$.hood.Helpers={IsNullOrUndefined:function(e){var t=!1;return null!==e&&void 0!==e&&""!==e||(t=!0),t},IsSet:function(e){var t=!1;return null!==e&&void 0!==e&&""!==e||(t=!0),!t},IsEventSupported:function(e){var t=document.createElement("div");e="on"+e;var n=e in t;return n||(t.setAttribute(e,"return;"),n="function"==typeof t[e]),t=null,n},IsFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},IsUrlExternal:function(e){var t=e.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);return"string"==typeof t[1]&&t[1].length>0&&t[1].toLowerCase()!==location.protocol||"string"==typeof t[2]&&t[2].length>0&&t[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host},IsInIframe:function(){try{return window.self!==window.top}catch(e){return!0}},HtmlEncode:function(e){return $("<div/>").text(e).html()},HtmlDecode:function(e){return $("<div/>").html(e).text()},FormatCurrency:function(e,t){return t+" "+e.toFixed(2).replace(/./g,function(e,t,n){return t>0&&"."!==e&&(n.length-t)%3==0?","+e:e})},FormatKilobytes:function(e){return e/=1024,e.toFixed(2).replace(/./g,function(e,t,n){return t>0&&"."!==e&&(n.length-t)%3==0?","+e:e})},FormatMegabytes:function(e){return e/=1024,e/=1024,currency+" "+e.toFixed(2).replace(/./g,function(e,t,n){return t>0&&"."!==e&&(n.length-t)%3==0?","+e:e})},FallbackCopyTextToClipboard:function(e){var t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch(e){console.error("Oops, unable to copy",e)}document.body.removeChild(t)},CopyTextToClipboard:function(e){if(!navigator.clipboard)return void $.hood.Handlers.FallbackCopyTextToClipboard(e);navigator.clipboard.writeText(e).then(function(){},function(e){console.error("Could not copy text: ",e)})},ProcessResponse:function(e){var t="";e.Title&&(t="<strong>".concat(e.Title,"</strong><br />")),e.Success?$.hood.Alerts.Success("".concat(t).concat(e.Message)):$.hood.Alerts.Error("".concat(t).concat(e.Errors))},GetQueryStringParamByName:function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)","i"),n=t.exec(location.search);return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))},InsertQueryStringParam:function(e,t){e=escape(e),t=escape(t);var n=document.location.search.substr(1).split("&");if(""===n)document.location.search="?"+e+"="+t;else{for(var r,o=n.length;o--;)if(r=n[o].split("="),r[0]===e){r[1]=t,n[o]=r.join("=");break}o<0&&(n[n.length]=[e,t].join("=")),document.location.search=n.join("&")}},InsertQueryStringParamToUrl:function(e,t,n){t=escape(t),n=escape(n);var r=e.search.substr(1).split("&");if(""===r)e.search="?"+t+"="+n;else{for(var o,c=r.length;c--;)if(o=r[c].split("="),o[0]===t){o[1]=n,r[c]=o.join("=");break}c<0&&(r[r.length]=[t,n].join("=")),e.search=r.join("&")}return e},UrlToLocationObject:function(e){var t=document.createElement("a");return t.href=e,t},FindAndRemoveFromArray:function(e,t,n){$.each(e,function(r,o){o[t]===n&&e.splice(r,1)})},FindAndReturnFromArray:function(e,t,n){var r=null;return $.each(e,function(e,o){o[t]===n&&(r=o)}),r},LeftPad:function(e,t){for(var n=e+"";n.length<t;)n="0"+n;return n},DateAdd:function(e,t,n){var r=new Date(e);switch(t.toLowerCase()){case"year":r.setFullYear(r.getFullYear()+n);break;case"quarter":r.setMonth(r.getMonth()+3*n);break;case"month":r.setMonth(r.getMonth()+n);break;case"week":r.setDate(r.getDate()+7*n);break;case"day":r.setDate(r.getDate()+n);break;case"hour":r.setTime(r.getTime()+36e5*n);break;case"minute":r.setTime(r.getTime()+6e4*n);break;case"second":r.setTime(r.getTime()+1e3*n);break;default:r=void 0}return r},GenerateRandomString:function(e){var t="abcdefghijklmnopqrstuvwxyz",n="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r=t+n+"0123456789";return("!@#$&*".pick(1)+t.pick(1)+n.pick(1)+r.pick(5,10)).shuffle()}}; |
@@ -1,1 +0,1 @@ | ||
"use strict";$.hood||($.hood={}),$.hood.Inline={Tags:{},Init:function(){$(".hood-inline:not(.refresh)").each($.hood.Inline.Load),$("body").on("click",".hood-inline-task",$.hood.Inline.Task),$("body").on("click",".hood-modal",function(o){o.preventDefault(),$.hood.Inline.Modal($(this).attr("href"),$(this).data("complete"),$(this).data("close"))}),$.hood.Inline.DataList.Init()},Refresh:function(o){$(o||".hood-inline").each($.hood.Inline.Load)},Load:function(){$.hood.Inline.Reload(this)},Reload:function(o,e){var n=$(o);n.addClass("loading"),e||(e=n.data("complete"));var t=n.data("url");$.get(t,$.proxy(function(o){n.html(o),n.removeClass("loading"),e&&$.hood.Inline.RunComplete(e,n,o)},n)).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},CurrentModal:null,Modal:function(o,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];$.hood.Inline.CurrentModal&&n&&$.hood.Inline.CloseModal(),$.get(o,function(o){var n="#"+$(o).attr("id");$(o).addClass("hood-inline-modal"),$(n).length&&$(n).remove(),$("body").append(o),$.hood.Inline.CurrentModal=$(n),$(n).modal(),$(n).on("shown.bs.modal",function(){$(document).off("focusin.modal")}),$(n).on("hidden.bs.modal",function(o){$(this).remove()}),e&&$.hood.Inline.RunComplete(e,$(n),o)}).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},CloseModal:function(){$.hood.Inline.CurrentModal&&$.hood.Inline.CurrentModal.modal("hide")},Task:function(o){o.preventDefault();var e=$(o.currentTarget);e.addClass("loading");var n=e.data("complete");$.get(e.attr("href"),function(o){$.hood.Helpers.ProcessResponse(o),o.Success&&e&&e.data("redirect")&&setTimeout(function(){window.location=e.data("redirect")},1500),e.removeClass("loading"),n&&$.hood.Inline.RunComplete(n,e,o)}).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},DataList:{Init:function(){$(".hood-inline-list.query").each(function(){$(this).data("url",$(this).data("url")+window.location.search)}),$(".hood-inline-list:not(.refresh)").each($.hood.Inline.Load),$("body").on("click","a.hood-inline-list-target",function(o){o.preventDefault(),$.hood.Loader(!0);var e=document.createElement("a");e.href=$(this).attr("href");var n=$($(this).data("target")),t=document.createElement("a");t.href=n.data("url"),t.search=e.search,$.hood.Inline.DataList.Reload(n,t),complete=$(this).data("complete"),complete&&$.hood.Inline.RunComplete(complete,$(this))}),$("body").on("click",".hood-inline-list .pagination a",function(o){o.preventDefault(),$.hood.Loader(!0);var e=document.createElement("a");e.href=$(this).attr("href");var n=$(this).parents(".hood-inline-list"),t=document.createElement("a");t.href=n.data("url"),t.search=e.search,$.hood.Inline.DataList.Reload(n,t)}),$("body").on("submit",".hood-inline-list form",function(o){o.preventDefault(),$.hood.Loader(!0);var e=$(this),n=e.parents(".hood-inline-list"),t=document.createElement("a");t.href=n.data("url"),t.search="?"+e.serialize(),$.hood.Inline.DataList.Reload(n,t)}),$("body").on("submit","form.inline",function(o){o.preventDefault(),$.hood.Loader(!0);var e=$(this),n=$(e.data("target"));n.each(function(){var o=document.createElement("a");o.href=$(this).data("url"),o.href&&(o.search="?"+e.serialize(),$.hood.Inline.DataList.Reload($(this),o))})}),$("body").on("change","form.inline .refresh-on-change, .hood-inline-list form",function(o){o.preventDefault(),$.hood.Loader(!0);var e=$(this).parents("form"),n=$(e.data("target")),t=document.createElement("a");t.href=n.data("url"),t.search="?"+e.serialize(),$.hood.Inline.DataList.Reload(n,t)})},Reload:function(o,e){if(history.pushState&&o.hasClass("query")){var n=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+e.href.substring(e.href.indexOf("?")+1);window.history.pushState({path:n},"",n)}o.data("url",$.hood.Helpers.InsertQueryStringParamToUrl(e,"inline","true")),$.hood.Inline.Reload(o)}},HandleError:function(o){500===o.status?$.hood.Alerts.Error("<strong>Error "+o.status+"</strong><br />There was an error processing the content, please contact an administrator if this continues.<br/>"):404===o.status?$.hood.Alerts.Error("<strong>Error "+o.status+"</strong><br />The content could not be found.<br/>"):401===o.status&&($.hood.Alerts.Error("<strong>Error "+o.status+"</strong><br />You are not allowed to view this resource, are you logged in correctly?<br/>"),window.location=window.location)},Finish:function(){$.hood.Loader(!1)},RunComplete:function RunComplete(complete,sender,data){if(!$.hood.Helpers.IsNullOrUndefined(complete)){var func=eval(complete);"function"==typeof func&&func(sender,data)}}},$(document).ready($.hood.Inline.Init),$.hood.Modals={Open:$.hood.Inline.Modal}; | ||
"use strict";$.hood||($.hood={}),$.hood.Inline={Tags:{},Init:function(){$(".hood-inline:not(.refresh)").each($.hood.Inline.Load),$("body").on("click",".hood-inline-task",$.hood.Inline.Task),$("body").on("click",".hood-modal",function(o){o.preventDefault(),$.hood.Inline.Modal($(this).attr("href"),$(this).data("complete"),$(this).data("close"))}),$.hood.Inline.DataList.Init()},Refresh:function(o){$(o||".hood-inline").each($.hood.Inline.Load)},Load:function(){$.hood.Inline.Reload(this)},Reload:function(o,e){var n=$(o);n.addClass("loading"),e||(e=n.data("complete"));var t=n.data("url");$.get(t,$.proxy(function(o){n.html(o),n.removeClass("loading"),e&&$.hood.Inline.RunComplete(e,n,o)},n)).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},CurrentModal:null,Modal:function(o,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];$.hood.Inline.CurrentModal&&n&&$.hood.Inline.CloseModal(),$.get(o,function(o){var n="#"+$(o).attr("id");$(o).addClass("hood-inline-modal"),$(n).length&&$(n).remove(),$("body").append(o),$.hood.Inline.CurrentModal=$(n),$(n).modal(),$(n).on("shown.bs.modal",function(){$(document).off("focusin.modal")}),$(n).on("hidden.bs.modal",function(o){$(this).remove()}),e&&$.hood.Inline.RunComplete(e,$(n),o)}).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},CloseModal:function(){$.hood.Inline.CurrentModal&&$.hood.Inline.CurrentModal.modal("hide")},Task:function(o){o.preventDefault();var e=$(o.currentTarget);e.addClass("loading");var n=e.data("complete");$.get(e.attr("href"),function(o){$.hood.Helpers.ProcessResponse(o),o.Success&&e&&e.data("redirect")&&setTimeout(function(){window.location=e.data("redirect")},1500),e.removeClass("loading"),n&&$.hood.Inline.RunComplete(n,e,o)}).fail($.hood.Inline.HandleError).always($.hood.Inline.Finish)},DataList:{Init:function(){$(".hood-inline-list.query").each(function(){$(this).data("url",$(this).data("url")+window.location.search)}),$(".hood-inline-list:not(.refresh)").each($.hood.Inline.Load),$("body").on("click","a.hood-inline-list-target",function(o){o.preventDefault(),$.hood.Loader(!0);var e=document.createElement("a");e.href=$(this).attr("href");var n=$($(this).data("target")),t=document.createElement("a");t.href=n.data("url"),t.search=e.search,$.hood.Inline.DataList.Reload(n,t),complete=$(this).data("complete"),complete&&$.hood.Inline.RunComplete(complete,$(this))}),$("body").on("click",".hood-inline-list .pagination a",function(o){o.preventDefault(),$.hood.Loader(!0);var e=document.createElement("a");e.href=$(this).attr("href");var n=$(this).parents(".hood-inline-list"),t=document.createElement("a");t.href=n.data("url"),t.search=e.search,$.hood.Inline.DataList.Reload(n,t)}),$("body").on("submit",".hood-inline-list form",function(o){o.preventDefault(),$.hood.Loader(!0);var e=$(this),n=e.parents(".hood-inline-list"),t=document.createElement("a");t.href=n.data("url"),t.search="?"+e.serialize(),$.hood.Inline.DataList.Reload(n,t)}),$("body").on("submit","form.inline",function(o){o.preventDefault(),$.hood.Loader(!0);var e=$(this);$(e.data("target")).each(function(){var o=document.createElement("a");o.href=$(this).data("url"),o.href&&(o.search="?"+e.serialize(),$.hood.Inline.DataList.Reload($(this),o))})}),$("body").on("change","form.inline .refresh-on-change, .hood-inline-list form",function(o){o.preventDefault(),$.hood.Loader(!0);var e=$(this).parents("form"),n=$(e.data("target")),t=document.createElement("a");t.href=n.data("url"),t.search="?"+e.serialize(),$.hood.Inline.DataList.Reload(n,t)})},Reload:function(o,e){if(history.pushState&&o.hasClass("query")){var n=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+e.href.substring(e.href.indexOf("?")+1);window.history.pushState({path:n},"",n)}o.data("url",$.hood.Helpers.InsertQueryStringParamToUrl(e,"inline","true")),$.hood.Inline.Reload(o)}},HandleError:function(o){500===o.status?$.hood.Alerts.Error("<strong>Error "+o.status+"</strong><br />There was an error processing the content, please contact an administrator if this continues.<br/>"):404===o.status?$.hood.Alerts.Error("<strong>Error "+o.status+"</strong><br />The content could not be found.<br/>"):401===o.status&&($.hood.Alerts.Error("<strong>Error "+o.status+"</strong><br />You are not allowed to view this resource, are you logged in correctly?<br/>"),window.location=window.location)},Finish:function(){$.hood.Loader(!1)},RunComplete:function RunComplete(complete,sender,data){if(!$.hood.Helpers.IsNullOrUndefined(complete)){var func=eval(complete);"function"==typeof func&&func(sender,data)}}},$(document).ready($.hood.Inline.Init),$.hood.Modals={Open:$.hood.Inline.Modal}; |
@@ -1,1 +0,1 @@ | ||
"use strict";$.hood||($.hood={}),$.hood.Media={Init:function(){$("body").on("click",".media-delete",$.hood.Media.Delete),$("body").on("click",".media-directories-delete",$.hood.Media.Directories.Delete),$.hood.Media.Upload.Init(),$.hood.Media.Actions.Init()},Loaded:function(e){$.hood.Loader(!1)},BladeLoaded:function(e){$.hood.Media.LoadMediaPlayers()},Reload:function(e){$.hood.Inline.Reload($("#media-list"),e)},ReloadDirectories:function(e){$.hood.Inline.Reload($("#media-directories-list"),e)},Actions:{Init:function(){$("body").on("click",".hood-image-attach",$.hood.Media.Actions.Load.Attach),$("body").on("click",".hood-image-clear",$.hood.Media.Actions.Complete.Clear),$("body").on("click",".hood-image-insert",$.hood.Media.Actions.Load.Insert),$("body").on("click",".hood-media-select",$.hood.Media.Actions.Load.Select)},Target:null,Json:null,Current:{Attach:null},Load:{Attach:function(e){e.preventDefault(),$.hood.Media.Actions.Target=$($(this).data("tag")),$.hood.Media.Actions.Json=$($(this).data("json")),$.hood.Inline.Modal($(this).data("url"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-attach"),$("body").on("click",".media-attach",$.hood.Media.Actions.Complete.Attach)}),$.hood.Media.Upload.Init()})},Insert:function(e){var o=$("#"+e.id);o.data("imagesUrl")&&e.addButton("hoodimage",{text:"Insert image...",icon:!1,onclick:$.proxy(function(o){$.hood.Inline.Modal($(this).data("imagesUrl"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-insert"),$("body").on("click",".media-insert",$.proxy($.hood.Media.Actions.Complete.Insert,e))}),$.hood.Media.Upload.Init()})},o)})},Select:function(e){$.hood.Media.Actions.Target=$($(this).data("target")),$.hood.Inline.Modal($(this).data("url"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-select"),$("body").on("click",".media-select",$.hood.Media.Actions.Complete.Select)}),$.hood.Media.Upload.Init()})}},Complete:{Attach:function(e){e.preventDefault();var o=$.hood.Media.Actions.Target,a=$.hood.Media.Actions.Json;$.post($(this).data("url"),function(e){if($.hood.Helpers.ProcessResponse(e),e.Success){var i=e.Media.Icon;"Image"===e.Media.GeneralFileType&&(i=e.Media.MediumUrl),$.hood.Helpers.IsNullOrUndefined(o)||(o.css({"background-image":"url("+i+")"}),o.find("img").attr("src",i),o.removeClass("loading")),$.hood.Helpers.IsNullOrUndefined(a)||a.val(e.MediaJson)}}).done(function(){$("#media-select-modal").modal("hide")}).fail($.hood.Inline.HandleError)},Insert:function(e){var o=$(e.target),a=this;a.insertContent('<img alt="'+o.data("title")+'" src="'+o.data("url")+'"/>'),$.hood.Inline.CloseModal()},Select:function(e){var o=$(this).data("url"),a=$.hood.Media.Actions.Target;$(a).each(function(){$(this).is("input")?$(this).val(o):($(this).attr("src",o),$(this).css({"background-image":"url("+o+")"}),$(this).find("img").attr("src",o))}),$.hood.Alerts.Success("Image URL has been inserted.<br /><strong>Remember to press save!</strong>"),$("#media-select-modal").modal("hide")},Clear:function(e){e.preventDefault();var o=$($(this).data("tag")),a=$($(this).data("json"));$.post($(this).data("url"),function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&(icon=e.Media.Icon,"Image"===e.Media.GeneralFileType&&(icon=e.Media.MediumUrl),$.hood.Helpers.IsNullOrUndefined(o)||(o.css({"background-image":"url("+icon+")"}),o.find("img").attr("src",icon),o.removeClass("loading")),$.hood.Helpers.IsNullOrUndefined(a)||a.val(e.Json))}).fail($.hood.Inline.HandleError)}},RefreshImage:function(e,o,a){var i=$(e);i.addClass("loading"),$.get(o,{id:a},$.proxy(function(e){i.css({"background-image":"url("+e.SmallUrl+")"}),i.find("img").attr("src",e.SmallUrl),i.removeClass("loading")},this))}},Upload:{Init:function(){if($("#media-add").doesExist()){$("#media-total-progress").hide(),Dropzone.autoDiscover=!1;var e=new Dropzone("#media-upload",{url:$.hood.Media.Upload.UploadUrl,thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:!1,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!"});e.on("success",function(e,o){$.hood.Helpers.ProcessResponse(o)}),e.on("addedfile",function(e){$("#media-total-progress .progress-bar").css({width:"0%"}),$("#media-total-progress .progress-bar .percentage").html("0%")}),e.on("totaluploadprogress",function(e){$("#media-total-progress .progress-bar").css({width:e+"%"}),$("#media-total-progress .progress-bar .percentage").html(e+"%")}),e.on("sending",function(e){$("#media-total-progress").fadeIn(),$("#media-total-progress .progress-bar").css({width:"0%"}),$("#media-total-progress .progress-bar .percentage").html("0%")}),e.on("complete",function(e){$.hood.Media.Reload()}),e.on("queuecomplete",function(e){$("#media-total-progress").hide(),$.hood.Media.Reload()})}},UploadUrl:function(){return $("#media-upload").data("url")+"?directoryId="+$("#media-list > #upload-directory-id").val()}},Delete:function(e){var o=$(this),a=function(e){e&&$.post("/admin/media/delete",{id:o.data("id")},function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&($.hood.Media.Reload(),$(".modal-backdrop").remove(),$(".modal").modal("hide"))})};$.hood.Alerts.Confirm("The media file will be permanently removed. This cannot be undone.","Are you sure?",a,"warning",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> Ensure this file is not attached to any posts, pages or features of the site, or it will appear as a broken image or file.</span>',"Ok","Cancel")},RestrictDir:function(){var e=/[^0-9A-Za-z- ]*/g,o=$(this).val(),a=o.replace(e,"");o!==a&&$(this).val(a)},Directories:{Editor:function(){$("#content-directories-edit-form").hoodValidator({validationRules:{DisplayName:{required:!0},Slug:{required:!0}},submitButtonTag:$("#content-directories-edit-submit"),submitUrl:$("#content-directories-edit-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Media.ReloadDirectories(),$.hood.Media.Reload()}})},Delete:function(e){e.preventDefault();var o=$(this),a=function(e){e&&$.post(o.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Media.ReloadDirectories(),$.hood.Media.Reload()})};$.hood.Alerts.Confirm("The directory and all files will be permanently removed.","Are you sure?",a,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle mr-2"></i><strong>This cannot be undone!</strong><br />Ensure these files are not attached to any posts, pages or features of the site, or it will appear as a broken image or file.</span>')}},Players:{},LoadMediaPlayers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".hood-media",o={techOrder:["azureHtml5JS","flashSS","html5FairPlayHLS","silverlightSS","html5"],nativeControlsForTouch:!1,controls:!0,autoplay:!1,seeking:!0};$(e).each(function(){try{if(player=$.hood.Media.Players[$(this).data("id")],player)try{player.dispose()}catch(e){console.log("There was a problem disposing the old media player: ".concat(e))}$.hood.Media.Players[$(this).data("id")]=amp($(this).attr("id"),o),player=$.hood.Media.Players[$(this).data("id")],player.src([{src:$(this).data("file"),type:$(this).data("type")}])}catch(e){console.log("There was a problem playing the media file: ".concat(e))}})}},$(document).ready($.hood.Media.Init); | ||
"use strict";$.hood||($.hood={}),$.hood.Media={Init:function(){$("body").on("click",".media-delete",$.hood.Media.Delete),$("body").on("click",".media-directories-delete",$.hood.Media.Directories.Delete),$.hood.Media.Upload.Init(),$.hood.Media.Actions.Init()},Loaded:function(e){$.hood.Loader(!1)},BladeLoaded:function(e){$.hood.Media.LoadMediaPlayers()},Reload:function(e){$.hood.Inline.Reload($("#media-list"),e)},ReloadDirectories:function(e){$.hood.Inline.Reload($("#media-directories-list"),e)},Actions:{Init:function(){$("body").on("click",".hood-image-attach",$.hood.Media.Actions.Load.Attach),$("body").on("click",".hood-image-clear",$.hood.Media.Actions.Complete.Clear),$("body").on("click",".hood-image-insert",$.hood.Media.Actions.Load.Insert),$("body").on("click",".hood-media-select",$.hood.Media.Actions.Load.Select)},Target:null,Json:null,Current:{Attach:null},Load:{Attach:function(e){e.preventDefault(),$.hood.Media.Actions.Target=$($(this).data("tag")),$.hood.Media.Actions.Json=$($(this).data("json")),$.hood.Inline.Modal($(this).data("url"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-attach"),$("body").on("click",".media-attach",$.hood.Media.Actions.Complete.Attach)}),$.hood.Media.Upload.Init()})},Insert:function(e){var o=$("#"+e.id);o.data("imagesUrl")&&e.addButton("hoodimage",{text:"Insert image...",icon:!1,onclick:$.proxy(function(o){$.hood.Inline.Modal($(this).data("imagesUrl"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-insert"),$("body").on("click",".media-insert",$.proxy($.hood.Media.Actions.Complete.Insert,e))}),$.hood.Media.Upload.Init()})},o)})},Select:function(e){$.hood.Media.Actions.Target=$($(this).data("target")),$.hood.Inline.Modal($(this).data("url"),function(){$.hood.Media.Reload(function(){$("body").off("click",".media-select"),$("body").on("click",".media-select",$.hood.Media.Actions.Complete.Select)}),$.hood.Media.Upload.Init()})}},Complete:{Attach:function(e){e.preventDefault();var o=$.hood.Media.Actions.Target,a=$.hood.Media.Actions.Json;$.post($(this).data("url"),function(e){if($.hood.Helpers.ProcessResponse(e),e.Success){var i=e.Media.Icon;"Image"===e.Media.GeneralFileType&&(i=e.Media.MediumUrl),$.hood.Helpers.IsNullOrUndefined(o)||(o.css({"background-image":"url("+i+")"}),o.find("img").attr("src",i),o.removeClass("loading")),$.hood.Helpers.IsNullOrUndefined(a)||a.val(e.MediaJson)}}).done(function(){$("#media-select-modal").modal("hide")}).fail($.hood.Inline.HandleError)},Insert:function(e){var o=$(e.target);this.insertContent('<img alt="'+o.data("title")+'" src="'+o.data("url")+'"/>'),$.hood.Inline.CloseModal()},Select:function(e){var o=$(this).data("url"),a=$.hood.Media.Actions.Target;$(a).each(function(){$(this).is("input")?$(this).val(o):($(this).attr("src",o),$(this).css({"background-image":"url("+o+")"}),$(this).find("img").attr("src",o))}),$.hood.Alerts.Success("Image URL has been inserted.<br /><strong>Remember to press save!</strong>"),$("#media-select-modal").modal("hide")},Clear:function(e){e.preventDefault();var o=$($(this).data("tag")),a=$($(this).data("json"));$.post($(this).data("url"),function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&(icon=e.Media.Icon,"Image"===e.Media.GeneralFileType&&(icon=e.Media.MediumUrl),$.hood.Helpers.IsNullOrUndefined(o)||(o.css({"background-image":"url("+icon+")"}),o.find("img").attr("src",icon),o.removeClass("loading")),$.hood.Helpers.IsNullOrUndefined(a)||a.val(e.Json))}).fail($.hood.Inline.HandleError)}},RefreshImage:function(e,o,a){var i=$(e);i.addClass("loading"),$.get(o,{id:a},$.proxy(function(e){i.css({"background-image":"url("+e.SmallUrl+")"}),i.find("img").attr("src",e.SmallUrl),i.removeClass("loading")},this))}},Upload:{Init:function(){if($("#media-add").doesExist()){$("#media-total-progress").hide(),Dropzone.autoDiscover=!1;var e=new Dropzone("#media-upload",{url:$.hood.Media.Upload.UploadUrl,thumbnailWidth:80,thumbnailHeight:80,parallelUploads:5,previewTemplate:!1,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!"});e.on("success",function(e,o){$.hood.Helpers.ProcessResponse(o)}),e.on("addedfile",function(e){$("#media-total-progress .progress-bar").css({width:"0%"}),$("#media-total-progress .progress-bar .percentage").html("0%")}),e.on("totaluploadprogress",function(e){$("#media-total-progress .progress-bar").css({width:e+"%"}),$("#media-total-progress .progress-bar .percentage").html(e+"%")}),e.on("sending",function(e){$("#media-total-progress").fadeIn(),$("#media-total-progress .progress-bar").css({width:"0%"}),$("#media-total-progress .progress-bar .percentage").html("0%")}),e.on("complete",function(e){$.hood.Media.Reload()}),e.on("queuecomplete",function(e){$("#media-total-progress").hide(),$.hood.Media.Reload()})}},UploadUrl:function(){return $("#media-upload").data("url")+"?directoryId="+$("#media-list > #upload-directory-id").val()}},Delete:function(e){var o=$(this),a=function(e){e&&$.post("/admin/media/delete",{id:o.data("id")},function(e){$.hood.Helpers.ProcessResponse(e),e.Success&&($.hood.Media.Reload(),$(".modal-backdrop").remove(),$(".modal").modal("hide"))})};$.hood.Alerts.Confirm("The media file will be permanently removed. This cannot be undone.","Are you sure?",a,"warning",'<span class="text-danger"><i class="fa fa-exclamation-triangle"></i> Ensure this file is not attached to any posts, pages or features of the site, or it will appear as a broken image or file.</span>',"Ok","Cancel")},RestrictDir:function(){var e=/[^0-9A-Za-z- ]*/g,o=$(this).val(),a=o.replace(e,"");o!==a&&$(this).val(a)},Directories:{Editor:function(){$("#content-directories-edit-form").hoodValidator({validationRules:{DisplayName:{required:!0},Slug:{required:!0}},submitButtonTag:$("#content-directories-edit-submit"),submitUrl:$("#content-directories-edit-form").attr("action"),submitFunction:function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Media.ReloadDirectories(),$.hood.Media.Reload()}})},Delete:function(e){e.preventDefault();var o=$(this),a=function(e){e&&$.post(o.attr("href"),function(e){$.hood.Helpers.ProcessResponse(e),$.hood.Media.ReloadDirectories(),$.hood.Media.Reload()})};$.hood.Alerts.Confirm("The directory and all files will be permanently removed.","Are you sure?",a,"error",'<span class="text-danger"><i class="fa fa-exclamation-triangle mr-2"></i><strong>This cannot be undone!</strong><br />Ensure these files are not attached to any posts, pages or features of the site, or it will appear as a broken image or file.</span>')}},Players:{},LoadMediaPlayers:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".hood-media",o={techOrder:["azureHtml5JS","flashSS","html5FairPlayHLS","silverlightSS","html5"],nativeControlsForTouch:!1,controls:!0,autoplay:!1,seeking:!0};$(e).each(function(){try{if(player=$.hood.Media.Players[$(this).data("id")],player)try{player.dispose()}catch(e){console.log("There was a problem disposing the old media player: ".concat(e))}$.hood.Media.Players[$(this).data("id")]=amp($(this).attr("id"),o),player=$.hood.Media.Players[$(this).data("id")],player.src([{src:$(this).data("file"),type:$(this).data("type")}])}catch(e){console.log("There was a problem playing the media file: ".concat(e))}})}},$(document).ready($.hood.Media.Init); |
@@ -1,1 +0,1 @@ | ||
"use strict";String.prototype.contains=function(t){return this.indexOf(t)!==-1},String.prototype.pick=function(t,r){var n,o="";n="undefined"==typeof r?t:t+Math.floor(Math.random()*(r-t));for(var e=0;e<n;e++)o+=this.charAt(Math.floor(Math.random()*this.length));return o},String.prototype.shuffle=function(){var t,r,n=this.split(""),o=n.length;if(o)for(;--o;)r=Math.floor(Math.random()*(o+1)),t=n[r],n[r]=n[o],n[o]=t;return n.join("")},String.prototype.toSeoUrl=function(){var t=this.replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g,"-").toLowerCase();"-"===t.charAt(0)&&(t=t.substring(1));var r=t.length-1;return"-"===t.charAt(r)&&(t=t.substring(0,r)),t}; | ||
"use strict";String.prototype.contains=function(t){return-1!==this.indexOf(t)},String.prototype.pick=function(t,r){var o,n="";o=void 0===r?t:t+Math.floor(Math.random()*(r-t));for(var i=0;i<o;i++)n+=this.charAt(Math.floor(Math.random()*this.length));return n},String.prototype.shuffle=function(){var t,r,o=this.split(""),n=o.length;if(n)for(;--n;)r=Math.floor(Math.random()*(n+1)),t=o[r],o[r]=o[n],o[n]=t;return o.join("")},String.prototype.toSeoUrl=function(){var t=this.replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g,"-").toLowerCase();"-"===t.charAt(0)&&(t=t.substring(1));var r=t.length-1;return"-"===t.charAt(r)&&(t=t.substring(0,r)),t}; |
@@ -1,1 +0,1 @@ | ||
"use strict";$.hood||($.hood={}),$.hood.FormValidator=function(t,i){this.Options=$.extend({formTag:t,validationRules:null,validationMessages:{},placeBelow:!0,submitButtonTag:null,submitUrl:null,submitFunction:null,serializationFunction:function(){var t=$(this.formTag).serialize();return t}},i||{}),this.LoadValidation=function(){$.hood.Helpers.IsNullOrUndefined(this.Options.formTag)||($(this.Options.formTag).find("input, textarea, select").keypress($.proxy(function(t){if(13===t.which)return $.proxy(this.submitForm(),this),t.preventDefault(),!1},this)),$(this.Options.formTag).validate({submitHandler:function(t){t.preventDefault()},errorClass:this.Options.errorClass,focusInvalid:!1,rules:this.Options.validationRules,messages:this.Options.validationMessages}),$.hood.Helpers.IsNullOrUndefined(this.Options.submitButtonTag)||$(this.Options.submitButtonTag).click($.proxy(this.submitForm,this)))},this.submitForm=function(){$(this.Options.formTag).valid()&&(this.TempButtonContent=$(this.Options.submitButtonTag).removeClass("btn-primary").addClass("btn-default").html(),$(this.Options.submitButtonTag).removeClass("btn-primary").addClass("btn-default").html('<i class="fa fa-refresh fa-spin"></i> Loading...'),$(this.Options.formTag).find("input[type=checkbox]").each(function(){$(this).is(":checked")&&$(this).val("true")}),$.post(this.Options.submitUrl,this.Options.serializationFunction(),$.proxy(function(t){$(this.Options.submitButtonTag).removeClass("btn-default").addClass("btn-primary").html(this.TempButtonContent),this.Options.submitFunction(t)},this)))},this.LoadValidation(),this.Options.placeBelow&&$(this.Options.formTag).addClass("validation-below")},$.fn.hoodValidator=function(t){return this.each(function(){var i=$(this);if(!i.data("hoodValidator")){var s=new $.hood.FormValidator(this,t);i.data("hoodValidator",s)}})}; | ||
"use strict";$.hood||($.hood={}),$.hood.FormValidator=function(t,i){this.Options=$.extend({formTag:t,validationRules:null,validationMessages:{},placeBelow:!0,submitButtonTag:null,submitUrl:null,submitFunction:null,serializationFunction:function(){return $(this.formTag).serialize()}},i||{}),this.LoadValidation=function(){$.hood.Helpers.IsNullOrUndefined(this.Options.formTag)||($(this.Options.formTag).find("input, textarea, select").keypress($.proxy(function(t){if(13===t.which)return $.proxy(this.submitForm(),this),t.preventDefault(),!1},this)),$(this.Options.formTag).validate({submitHandler:function(t){t.preventDefault()},errorClass:this.Options.errorClass,focusInvalid:!1,rules:this.Options.validationRules,messages:this.Options.validationMessages}),$.hood.Helpers.IsNullOrUndefined(this.Options.submitButtonTag)||$(this.Options.submitButtonTag).click($.proxy(this.submitForm,this)))},this.submitForm=function(){$(this.Options.formTag).valid()&&(this.TempButtonContent=$(this.Options.submitButtonTag).removeClass("btn-primary").addClass("btn-default").html(),$(this.Options.submitButtonTag).removeClass("btn-primary").addClass("btn-default").html('<i class="fa fa-refresh fa-spin"></i> Loading...'),$(this.Options.formTag).find("input[type=checkbox]").each(function(){$(this).is(":checked")&&$(this).val("true")}),$.post(this.Options.submitUrl,this.Options.serializationFunction(),$.proxy(function(t){$(this.Options.submitButtonTag).removeClass("btn-default").addClass("btn-primary").html(this.TempButtonContent),this.Options.submitFunction(t)},this)))},this.LoadValidation(),this.Options.placeBelow&&$(this.Options.formTag).addClass("validation-below")},$.fn.hoodValidator=function(t){return this.each(function(){var i=$(this);if(!i.data("hoodValidator")){var s=new $.hood.FormValidator(this,t);i.data("hoodValidator",s)}})}; |
{ | ||
"name": "hoodcms", | ||
"version": "4.0.1", | ||
"version": "4.1.1", | ||
"description": "Hood Digital's own content management system, built in ASP.NET Core 2.2, with JS and SCSS.", | ||
@@ -5,0 +5,0 @@ "dependencies": {}, |
@@ -27,3 +27,3 @@ # Hood CMS | ||
"destination": "wwwroot/hood", | ||
"library": "hoodcms@latest", | ||
"library": "hoodcms@4.1.1", | ||
"provider": "jsdelivr" | ||
@@ -30,0 +30,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
12859914
104742