diff --git a/Builds/NuGet/UmbracoForms.uCaptcha.nuspec b/Builds/NuGet/UmbracoForms.uCaptcha.nuspec index a5b2146..f064cb8 100644 --- a/Builds/NuGet/UmbracoForms.uCaptcha.nuspec +++ b/Builds/NuGet/UmbracoForms.uCaptcha.nuspec @@ -2,7 +2,7 @@ AaronSadler.uCaptcha - 1.0.3 + 1.0.4 UmbracoForms.uCaptcha Aaron Sadler Aaron Sadler @@ -17,9 +17,9 @@ umbraco, umbraco-cms, hCaptcha, umbraco-forms, reCaptcha - - - + + + diff --git a/Builds/package.xml b/Builds/package.xml index 9f36cca..d197ef9 100644 --- a/Builds/package.xml +++ b/Builds/package.xml @@ -3,13 +3,13 @@ UmbracoForms.uCaptcha - 1.0.3 + 1.0.4 MIT https://github.com/AaronSadlerUK/UmbracoForms.uCaptcha 8 - 6 + 13 0 diff --git a/TestSite-V8.7.3/App_Data/packages/installedPackages.config b/TestSite-V8.7.3/App_Data/packages/installedPackages.config new file mode 100644 index 0000000..3299dfc --- /dev/null +++ b/TestSite-V8.7.3/App_Data/packages/installedPackages.config @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Assets/umbracoforms.hcaptcha.js b/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Assets/umbracoforms.hcaptcha.js new file mode 100644 index 0000000..935eb6a --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Assets/umbracoforms.hcaptcha.js @@ -0,0 +1,11 @@ +//hCaptcha callback +function onSubmit(token) { + //Find form which triggered hCaptcha + var uf = $("form"); + uf.each(function () { + if ($(this).find('.h-captcha-response').val(token)) { + //Set hidden field to true if response matches + $(this).find('.u-captcha-bool').val("true"); + } + }); +} \ No newline at end of file diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Assets/umbracoforms.invisible.hcaptcha.js b/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Assets/umbracoforms.invisible.hcaptcha.js new file mode 100644 index 0000000..82e07a6 --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Assets/umbracoforms.invisible.hcaptcha.js @@ -0,0 +1,40 @@ +var submittedFormId = null; + +//hCaptcha callback +function onSubmit(token) { + //Get form container with the id set earlier + var frm = $("#" + submittedFormId); + var form = frm.find('form').first(); + //Check we have the correct form by comparing response token + if (form.length > 0 && form.find(".h-captcha-response").val(token)) { + //Set hCaptcha field to true + form.find(".u-captcha-bool").val("true"); + //Submit the form + form.submit(); + } +} + +function validate() { + //trigger hCaptcha + hcaptcha.execute(); +} + +//Remove umbraco forms click event +$(".umbraco-forms-form input[type=submit]").not(".cancel").off('click'); + +//Replace with hCaptcha trigger +$(".umbraco-forms-form input[type=submit]").not(".cancel").click(function (evt) { + evt.preventDefault(); + var self = $(this); + var frm = self.closest("form"); + //Validate the form as per usual Umbraco forms way + frm.validate(); + if (frm.valid()) { + //Set form id for easy form finding on call back + submittedFormId = frm.parent(".umbraco-forms-form").attr('id'); + //Start hCaptcha process + validate(); + //Disable submit button + self.attr("disabled", "disabled"); + } +}); \ No newline at end of file diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Assets/umbracoforms.invisible.recaptcha.js b/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Assets/umbracoforms.invisible.recaptcha.js new file mode 100644 index 0000000..70831d6 --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Assets/umbracoforms.invisible.recaptcha.js @@ -0,0 +1,40 @@ +var submittedFormId = null; + +//hCaptcha callback +function onSubmit(token) { + //Get form container with the id set earlier + var frm = $("#" + submittedFormId); + var form = frm.find('form').first(); + //Check we have the correct form by comparing response token + if (form.length > 0 && form.find(".g-captcha-response").val(token)) { + //Set hCaptcha field to true + form.find(".u-captcha-bool").val("true"); + //Submit the form + form.submit(); + } +} + +function validate() { + //trigger hCaptcha + hcaptcha.execute(); +} + +//Remove umbraco forms click event +$(".umbraco-forms-form input[type=submit]").not(".cancel").off('click'); + +//Replace with hCaptcha trigger +$(".umbraco-forms-form input[type=submit]").not(".cancel").click(function (evt) { + evt.preventDefault(); + var self = $(this); + var frm = self.closest("form"); + //Validate the form as per usual Umbraco forms way + frm.validate(); + if (frm.valid()) { + //Set form id for easy form finding on call back + submittedFormId = frm.parent(".umbraco-forms-form").attr('id'); + //Start hCaptcha process + validate(); + //Disable submit button + self.attr("disabled", "disabled"); + } +}); \ No newline at end of file diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Assets/umbracoforms.recaptcha.js b/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Assets/umbracoforms.recaptcha.js new file mode 100644 index 0000000..cc75373 --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Assets/umbracoforms.recaptcha.js @@ -0,0 +1,11 @@ +//hCaptcha callback +function onSubmit(token) { + //Find form which triggered hCaptcha + var uf = $("form"); + uf.each(function () { + if ($(this).find('.g-captcha-response').val(token)) { + //Set hidden field to true if response matches + $(this).find('.u-captcha-bool').val("true"); + } + }); +} \ No newline at end of file diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Backoffice/Common/FieldTypes/ucaptchafield.html b/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Backoffice/Common/FieldTypes/ucaptchafield.html new file mode 100644 index 0000000..3f78e23 --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Backoffice/Common/FieldTypes/ucaptchafield.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Images/uCaptcha.png b/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Images/uCaptcha.png new file mode 100644 index 0000000..d748fa7 --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms.uCaptcha/Images/uCaptcha.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2828675c304a4efa7205c23fd740992fed92cbfab8bfaca6a8994116de2f1416 +size 7245 diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/BaremetricsCalendar/public/css/application.css b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/BaremetricsCalendar/public/css/application.css new file mode 100644 index 0000000..09cd661 --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/BaremetricsCalendar/public/css/application.css @@ -0,0 +1 @@ +.daterange{position:relative}.daterange *{-webkit-box-sizing:border-box;box-sizing:border-box}.daterange div,.daterange li,.daterange span,.daterange ul{margin:0;padding:0;border:0}.daterange ul{list-style:none}.daterange.dr-active{z-index:10}.daterange .dr-input{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;border:1px solid #c3cacd;-webkit-border-radius:5px;border-radius:5px;background-color:#fff;position:relative;z-index:5;overflow:hidden;height:40px}.daterange .dr-input:hover{border-color:#2693d5}.daterange .dr-input.dr-active{-webkit-box-shadow:0 0 0 3px rgba(38,147,213,.3);box-shadow:0 0 0 3px rgba(38,147,213,.3);border-color:#2693d5}.daterange .dr-input .dr-dates{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;padding:0 1.5rem 0 .75rem;min-width:-webkit-calc(100% - 35px);min-width:calc(100% - 35px)}.daterange .dr-input .dr-dates .dr-date{font-size:.9375rem;padding:.65625rem 0;text-align:center;white-space:nowrap;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;outline:0}.daterange .dr-input .dr-dates .dr-date.dr-active,.daterange .dr-input .dr-dates .dr-date:focus,.daterange .dr-input .dr-dates .dr-date:hover{color:#2693d5}.daterange .dr-input .dr-dates .dr-date:empty:after{content:attr(placeholder);color:#9ba3a7}.daterange .dr-input .dr-dates .dr-dates-dash{color:#9ba3a7;padding:0 10px;-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;font-weight:600}.daterange .dr-input .dr-presets{width:2.1875rem;border-left:1px solid #c3cacd;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;cursor:pointer;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.daterange .dr-input .dr-presets.dr-active,.daterange .dr-input .dr-presets:hover{border-color:#2693d5;-webkit-box-shadow:inset 0 2px 3px #ebf1f4;box-shadow:inset 0 2px 3px #ebf1f4}.daterange .dr-input .dr-presets.dr-active .dr-preset-bar,.daterange .dr-input .dr-presets:hover .dr-preset-bar{background-color:#2693d5}.daterange .dr-input .dr-presets .dr-preset-bar{height:2px;background-color:#c3cacd;margin:1px 0 1px 25%}.daterange .dr-input .dr-presets .dr-preset-bar:nth-child(1){width:50%}.daterange .dr-input .dr-presets .dr-preset-bar:nth-child(2){width:40%}.daterange .dr-input .dr-presets .dr-preset-bar:nth-child(3){width:30%}.daterange .dr-selections{position:absolute}.daterange .dr-selections .dr-calendar{background-color:#fff;font-size:.9375rem;-webkit-box-shadow:0 0 5px #c3cacd;box-shadow:0 0 5px #c3cacd;-webkit-border-radius:5px;border-radius:5px;position:relative;overflow:hidden;z-index:4;padding-top:5px;top:-5px;left:4px;-webkit-transition:width .2s;-o-transition:width .2s;transition:width .2s;min-width:210px}.daterange .dr-selections .dr-calendar .dr-range-switcher{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;padding:.375rem .5rem;font-size:.875rem}.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-switcher{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;border:1px solid rgba(195,202,205,.5);-webkit-border-radius:5px;border-radius:5px;height:1.5625rem}.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-switcher i{color:#c3cacd;position:relative;top:-1px;cursor:pointer;font-size:.75rem;height:100%;width:20px}.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-switcher i:hover:after,.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-switcher i:hover:before{background-color:#2693d5}.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-switcher i.dr-disabled{pointer-events:none;opacity:0}.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-switcher i:after,.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-switcher i:before{content:"";position:absolute;width:7px;height:2px;background-color:#c3cacd;-webkit-border-radius:1px;border-radius:1px;left:50%}.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-switcher i.dr-left:before{top:-webkit-calc(50% - 2px);top:calc(50% - 2px);-webkit-transform:translate(-50%,-50%) rotate(-45deg);-ms-transform:translate(-50%,-50%) rotate(-45deg);transform:translate(-50%,-50%) rotate(-45deg)}.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-switcher i.dr-left:after{top:-webkit-calc(50% + 2px);top:calc(50% + 2px);-webkit-transform:translate(-50%,-50%) rotate(45deg);-ms-transform:translate(-50%,-50%) rotate(45deg);transform:translate(-50%,-50%) rotate(45deg)}.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-switcher i.dr-right:before{top:-webkit-calc(50% - 2px);top:calc(50% - 2px);-webkit-transform:translate(-50%,-50%) rotate(45deg);-ms-transform:translate(-50%,-50%) rotate(45deg);transform:translate(-50%,-50%) rotate(45deg)}.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-switcher i.dr-right:after{top:-webkit-calc(50% + 2px);top:calc(50% + 2px);-webkit-transform:translate(-50%,-50%) rotate(-45deg);-ms-transform:translate(-50%,-50%) rotate(-45deg);transform:translate(-50%,-50%) rotate(-45deg)}.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-month-switcher{width:100%;margin-right:.375rem}.daterange .dr-selections .dr-calendar .dr-range-switcher .dr-year-switcher{min-width:80px}.daterange .dr-selections .dr-calendar .dr-days-of-week-list{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;background-color:#ebf1f4;font-size:.625rem;color:#9ba3a7;padding:.3125rem 0;border:1px solid rgba(195,202,205,.5);border-left:none;border-right:none}.daterange .dr-selections .dr-calendar .dr-days-of-week-list .dr-day-of-week{width:14.28%;text-align:center}.daterange .dr-selections .dr-calendar .dr-day-list{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;font-size:.9375rem}.daterange .dr-selections .dr-calendar .dr-day-list .dr-day{padding:.3125rem;text-align:center;width:14.28%;cursor:pointer;color:#4f565c}.daterange .dr-selections .dr-calendar .dr-day-list .dr-day.dr-hover:not(.dr-current){background-color:#ebf1f4!important}.daterange .dr-selections .dr-calendar .dr-day-list .dr-day.dr-hover-before{border-left:2px solid #2693d5!important;-webkit-border-radius:2px 0 0 2px;border-radius:2px 0 0 2px;padding-left:.1875rem!important}.daterange .dr-selections .dr-calendar .dr-day-list .dr-day.dr-hover-after{border-right:2px solid #2693d5!important;-webkit-border-radius:0 2px 2px 0;border-radius:0 2px 2px 0;padding-right:.1875rem!important}.daterange .dr-selections .dr-calendar .dr-day-list .dr-end,.daterange .dr-selections .dr-calendar .dr-day-list .dr-selected,.daterange .dr-selections .dr-calendar .dr-day-list .dr-start{background-color:#ebf1f4}.daterange .dr-selections .dr-calendar .dr-day-list .dr-maybe{background-color:#ebf1f4!important}.daterange .dr-selections .dr-calendar .dr-day-list .dr-fade{color:#c3cacd}.daterange .dr-selections .dr-calendar .dr-day-list .dr-start{border-left:2px solid #2693d5;-webkit-border-radius:2px 0 0 2px;border-radius:2px 0 0 2px;padding-left:.1875rem}.daterange .dr-selections .dr-calendar .dr-day-list .dr-end{border-right:2px solid #2693d5;-webkit-border-radius:0 2px 2px 0;border-radius:0 2px 2px 0;padding-right:.1875rem}.daterange .dr-selections .dr-calendar .dr-day-list .dr-current{color:#2693d5!important;background-color:rgba(38,147,213,.2)!important}.daterange .dr-selections .dr-calendar .dr-day-list .dr-outside{pointer-events:none;cursor:default;color:rgba(195,202,205,.5)}.daterange .dr-selections .dr-preset-list{background-color:#fff;color:#2693d5;font-size:.9375rem;-webkit-box-shadow:0 0 5px #c3cacd;box-shadow:0 0 5px #c3cacd;-webkit-border-radius:5px;border-radius:5px;position:relative;overflow:hidden;z-index:4;padding-top:5px;top:-5px;left:4px;width:100%}.daterange .dr-selections .dr-list-item{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:end;-webkit-align-items:flex-end;-ms-flex-align:end;align-items:flex-end;padding:.75rem .625rem;border-bottom:1px solid #ebf1f4;cursor:pointer;white-space:nowrap}.daterange .dr-selections .dr-list-item:hover{background-color:#ebf1f4}.daterange .dr-selections .dr-list-item .dr-item-aside{color:#9ba3a7;font-size:.75rem;margin-left:.3125rem;position:relative;top:-1px}.daterange--single .dr-input{cursor:text}.daterange--single .dr-input .dr-dates{padding:0;min-width:160px;width:100%}.daterange--single .dr-input .dr-dates .dr-date{width:100%;padding:.65625rem .75rem;text-align:left;color:#4f565c} \ No newline at end of file diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/BaremetricsCalendar/public/js/Calendar.js b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/BaremetricsCalendar/public/js/Calendar.js new file mode 100644 index 0000000..4dabee8 --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/BaremetricsCalendar/public/js/Calendar.js @@ -0,0 +1,787 @@ +'use strict'; + + +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery', 'moment'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS + module.exports = factory(require('jquery'), require('moment')); + } else { + // Browser globals + root.Calendar = factory(jQuery, moment); + } +} (this, function ($, moment) { + function Calendar(settings) { + var self = this; + + this.settings = settings; + + this.calIsOpen = false; + this.presetIsOpen = false; + this.sameDayRange = settings.same_day_range || false; + + this.element = settings.element || $('.daterange'); + this.selected = null; + + this.type = this.element.hasClass('daterange--single') ? 'single' : 'double'; + this.required = settings.required == false ? false : true; + + this.format = settings.format || {}; + this.format.input = settings.format && settings.format.input || 'MMMM D, YYYY'; + this.format.preset = settings.format && settings.format.preset || 'll'; + this.format.jump_month = settings.format && settings.format.jump_month || 'MMMM'; + this.format.jump_year = settings.format && settings.format.jump_year || 'YYYY'; + + this.placeholder = settings.placeholder || this.format.input; + + this.days_array = settings.days_array && settings.days_array.length == 7 ? + settings.days_array : moment.weekdaysMin(); + + this.orig_start_date = null; + this.orig_end_date = null; + this.orig_current_date = null; + + this.earliest_date = settings.earliest_date ? moment(settings.earliest_date) + : moment('1900-01-01', 'YYYY-MM-DD'); + this.latest_date = settings.latest_date ? moment(settings.latest_date) + : moment('2900-12-31', 'YYYY-MM-DD'); + this.end_date = settings.end_date ? moment(settings.end_date) + : (this.type == 'double' ? moment() : null); + this.start_date = settings.start_date ? moment(settings.start_date) + : (this.type == 'double' ? this.end_date.clone().subtract(1, 'month') : null); + this.current_date = settings.current_date ? moment(settings.current_date) + : (this.type == 'single' ? moment() : null); + + this.presets = settings.presets == false || this.type == 'single' ? false : true; + + this.callback = settings.callback || this.calendarSetDates; + + this.calendarHTML(this.type); + + $('.dr-presets', this.element).click(function() { + self.presetToggle(); + }); + + $('.dr-list-item', this.element).click(function() { + var start = $('.dr-item-aside', this).data('start'); + var end = $('.dr-item-aside', this).data('end'); + + self.start_date = self.calendarCheckDate(start); + self.end_date = self.calendarCheckDate(end); + + self.calendarSetDates(); + self.presetToggle(); + self.calendarSaveDates(); + }); + + $('.dr-date', this.element).on({ + 'click': function() { + self.calendarOpen(this); + }, + + 'keyup': function(event) { + if (event.keyCode == 9 && !self.calIsOpen && !self.start_date && !self.end_date) + self.calendarOpen(this); + }, + + 'keydown': function(event) { + switch (event.keyCode) { + + case 9: // Tab + if ($(self.selected).hasClass('dr-date-start')) { + event.preventDefault(); + self.calendarCheckDates(); + self.calendarSetDates(); + $('.dr-date-end', self.element).trigger('click'); + } else { + self.calendarCheckDates(); + self.calendarSetDates(); + self.calendarSaveDates(); + self.calendarClose('force'); + } + break; + + case 13: // Enter + event.preventDefault(); + self.calendarCheckDates(); + self.calendarSetDates(); + self.calendarSaveDates(); + self.calendarClose('force'); + break; + + case 27: // ESC + self.calendarSetDates(); + self.calendarClose('force'); + break; + + case 38: // Up + event.preventDefault(); + var timeframe = 'day'; + + if (event.shiftKey) + timeframe = 'week'; + + if (event.metaKey) + timeframe = 'month'; + + var back = moment(self.current_date).subtract(1, timeframe); + + $(this).html(back.format(self.format.input)); + self.current_date = back; + break; + + case 40: // Down + event.preventDefault(); + var timeframe = 'day'; + + if (event.shiftKey) + timeframe = 'week'; + + if (event.metaKey) + timeframe = 'month'; + + var forward = moment(self.current_date).add(1, timeframe); + + $(this).html(forward.format(self.format.input)); + self.current_date = forward; + break; + } + } + }); + + $('.dr-month-switcher i', this.element).click(function() { + var m = $('.dr-month-switcher span', self.element).data('month'); + var y = $('.dr-year-switcher span', self.element).data('year'); + var this_moment = moment([y, m, 1]); + var back = this_moment.clone().subtract(1, 'month'); + var forward = this_moment.clone().add(1, 'month').startOf('day'); + + if ($(this).hasClass('dr-left')) { + self.calendarOpen(self.selected, back); + } else if ($(this).hasClass('dr-right')) { + self.calendarOpen(self.selected, forward); + } + }); + + $('.dr-year-switcher i', this.element).click(function() { + var m = $('.dr-month-switcher span', self.element).data('month'); + var y = $('.dr-year-switcher span', self.element).data('year'); + var this_moment = moment([y, m, 1]); + var back = this_moment.clone().subtract(1, 'year'); + var forward = this_moment.clone().add(1, 'year').startOf('day'); + + + if ($(this).hasClass('dr-left')) { + self.calendarOpen(self.selected, back); + } else if ($(this).hasClass('dr-right')) { + self.calendarOpen(self.selected, forward); + } + }); + + $('.dr-dates-dash', this.element).click(function() { + $('.dr-date-start', self.element).trigger('click'); + }); + + // Once you click into a selection.. this lets you click out + this.element.on('click', function() { + document.addEventListener('click', function (event) { + var contains = $(event.target).parents(self.element); + + if (!contains.length) { + if (self.presetIsOpen) + self.presetToggle(); + + if (self.calIsOpen) { + if ($(self.selected).hasClass('dr-date-end')) + self.calendarSaveDates(); + + self.calendarSetDates(); + self.calendarClose('force'); + } + } + }); + }); + } + + + Calendar.prototype.presetToggle = function() { + if (this.presetIsOpen == false) { + this.orig_start_date = this.start_date; + this.orig_end_date = this.end_date; + this.orig_current_date = this.current_date; + + this.presetIsOpen = true; + } else if (this.presetIsOpen) { + this.presetIsOpen = false; + } + + if (this.calIsOpen == true) + this.calendarClose(); + + $('.dr-preset-list', this.element).slideToggle(200); + $('.dr-input', this.element).toggleClass('dr-active'); + $('.dr-presets', this.element).toggleClass('dr-active'); + this.element.toggleClass('dr-active'); + } + + + Calendar.prototype.presetCreate = function() { + var self = this; + var ul_presets = $(''); + var presets = typeof self.settings.presets === 'object' ? self.settings.presets : + [{ + label: 'Last 30 days', + start: moment(self.latest_date).subtract(29, 'days'), + end: self.latest_date + },{ + label: 'Last month', + start: moment(self.latest_date).subtract(1, 'month').startOf('month'), + end: moment(self.latest_date).subtract(1, 'month').endOf('month') + },{ + label: 'Last 3 months', + start: moment(self.latest_date).subtract(3, 'month').startOf('month'), + end: moment(self.latest_date).subtract(1, 'month').endOf('month') + },{ + label: 'Last 6 months', + start: moment(self.latest_date).subtract(6, 'month').startOf('month'), + end: moment(self.latest_date).subtract(1, 'month').endOf('month') + },{ + label: 'Last year', + start: moment(self.latest_date).subtract(1, 'year').startOf('year'), + end: moment(self.latest_date).subtract(1, 'year').endOf('year') + },{ + label: 'All time', + start: self.earliest_date, + end: self.latest_date + }]; + + if (moment(self.latest_date).diff(moment(self.latest_date).startOf('month'), 'days') >= 6 && + typeof self.settings.presets !== 'object' + ) { + presets.splice(1, 0, { + label: 'This month', + start: moment(self.latest_date).startOf('month'), + end: self.latest_date + }); + } + + $.each(presets, function(i, d) { + if (moment(d.start).isBefore(self.earliest_date)) { + d.start = self.earliest_date; + } + if (moment(d.start).isAfter(self.latest_date)) { + d.start = self.latest_date; + } + if (moment(d.end).isBefore(self.earliest_date)) { + d.end = self.earliest_date; + } + if (moment(d.end).isAfter(self.latest_date)) { + d.end = self.latest_date; + } + + var startISO = moment(d.start).toISOString(); + var endISO = moment(d.end).toISOString(); + var string = moment(d.start).format(self.format.preset) +' – '+ moment(d.end).format(self.format.preset); + + if ($('.dr-preset-list', self.element).length) { + var item = $('.dr-preset-list .dr-list-item:nth-of-type('+ (i + 1) +') .dr-item-aside', self.element); + item.data('start', startISO); + item.data('end', endISO); + item.html(string); + } else { + ul_presets.append('
  • '+ d.label + + ''+ string +''+ + '
  • '); + } + }); + + return ul_presets; + } + + + Calendar.prototype.calendarSetDates = function() { + $('.dr-date-start', this.element).html(moment(this.start_date).format(this.format.input)); + $('.dr-date-end', this.element).html(moment(this.end_date).format(this.format.input)); + + if (!this.start_date && !this.end_date) { + var old_date = $('.dr-date', this.element).html(); + var new_date = moment(this.current_date).format(this.format.input); + + if (old_date.length === 0 && !this.required) + new_date = ''; + + if (old_date != new_date) + $('.dr-date', this.element).html(new_date); + } + } + + + Calendar.prototype.calendarSaveDates = function() { + if (this.type === 'double') { + if (!moment(this.orig_end_date).isSame(this.end_date) || !moment(this.orig_start_date).isSame(this.start_date)) + return this.callback(); + } else { + if (!this.required || !moment(this.orig_current_date).isSame(this.current_date)) + return this.callback(); + } + } + + Calendar.prototype.calendarCheckDate = function(d) { + // Today + if (d === 'today' || d === 'now') + return moment().isAfter(this.latest_date) ? this.latest_date : + moment().isBefore(this.earliest_date) ? this.earliest_date : moment(); + + // Earliest + if (d === 'earliest') + return this.earliest_date; + + // Latest + if (d === 'latest') + return this.latest_date; + + // Convert string to a date if keyword ago or ahead exists + if (d && (/\bago\b/.test(d) || /\bahead\b/.test(d))) + return this.stringToDate(d); + + var regex = /(?:\d)((?:st|nd|rd|th)?,?)/; + var d_array = d ? d.replace(regex, '').split(' ') : []; + + // Add current year if year is not included + if (d_array.length == 2) { + d_array.push(moment().format(this.format.jump_year)); + d = d_array.join(' '); + } + + // Convert using settings format + var parsed_d = this.parseDate(d); + + if (!parsed_d.isValid()) + return moment(d); // occurs when parsing preset dates + + return parsed_d; + } + + Calendar.prototype.calendarCheckDates = function() { + var startTxt = $('.dr-date-start', this.element).html(); + var endTxt = $('.dr-date-end', this.element).html(); + var c = this.calendarCheckDate($(this.selected).html()); + var s; + var e; + + // Modify strings via some specific keywords to create valid dates + // Finally set all strings as dates + if (startTxt === 'ytd' || endTxt === 'ytd') { // Year to date + s = moment().startOf('year'); + e = moment().endOf('year'); + } else { + s = this.calendarCheckDate(startTxt); + e = this.calendarCheckDate(endTxt); + } + + if (c.isBefore(this.earliest_date)) + c = this.earliest_date; + if (s.isBefore(this.earliest_date)) + s = this.earliest_date; + if (e.isBefore(this.earliest_date) || e.isBefore(s)) + e = s.clone().add(6, 'day'); + + if (c.isAfter(this.latest_date)) + c = this.latest_date; + if (e.isAfter(this.latest_date)) + e = this.latest_date; + if (s.isAfter(this.latest_date) || s.isAfter(e)) + s = e.clone().subtract(6, 'day'); + + // Push and save if it's valid otherwise return to previous state + if (this.type === 'double') { + + // Is this a valid date? + if (s.isSame(e) && !this.sameDayRange) + return this.calendarSetDates(); + + this.start_date = s.isValid() ? s : this.start_date; + this.end_date = e.isValid() ? e : this.end_date; + } + + this.current_date = c.isValid() ? c : this.current_date; + } + + + Calendar.prototype.stringToDate = function(str) { + var date_arr = str.split(' '); + + if (date_arr[2] === 'ago') { + return moment(this.current_date).subtract(date_arr[0], date_arr[1]); + } + + else if (date_arr[2] === 'ahead') { + return moment(this.current_date).add(date_arr[0], date_arr[1]); + } + + return this.current_date; + } + + + Calendar.prototype.calendarOpen = function(selected, switcher) { + var self = this; + var other; + var cal_width = $('.dr-dates', this.element).innerWidth() - 8; + + this.selected = selected || this.selected; + + if (this.presetIsOpen == true) + this.presetToggle(); + + if (this.calIsOpen == true) { + this.calendarClose(switcher ? 'switcher' : undefined); + } else if ($(this.selected).html().length) { + this.orig_start_date = this.start_date; + this.orig_end_date = this.end_date; + this.orig_current_date = this.current_date; + } + + this.calendarCheckDates(); + this.calendarCreate(switcher); + this.calendarSetDates(); + + var next_month = moment(switcher || this.current_date).add(1, 'month').startOf('month').startOf('day'); + var past_month = moment(switcher || this.current_date).subtract(1, 'month').endOf('month'); + var next_year = moment(switcher || this.current_date).add(1, 'year').startOf('month').startOf('day'); + var past_year = moment(switcher || this.current_date).subtract(1, 'year').endOf('month'); + var this_moment = moment(switcher || this.current_date); + + $('.dr-month-switcher span', this.element) + .data('month', this_moment.month()) + .html(this_moment.format(this.format.jump_month)); + $('.dr-year-switcher span', this.element) + .data('year', this_moment.year()) + .html(this_moment.format(this.format.jump_year)); + + $('.dr-switcher i', this.element).removeClass('dr-disabled'); + + if (next_month.isAfter(this.latest_date)) + $('.dr-month-switcher .dr-right', this.element).addClass('dr-disabled'); + + if (past_month.isBefore(this.earliest_date)) + $('.dr-month-switcher .dr-left', this.element).addClass('dr-disabled'); + + if (next_year.isAfter(this.latest_date)) + $('.dr-year-switcher .dr-right', this.element).addClass('dr-disabled'); + + if (past_year.isBefore(this.earliest_date)) + $('.dr-year-switcher .dr-left', this.element).addClass('dr-disabled'); + + $('.dr-day', this.element).on({ + mouseenter: function() { + var selected = $(this); + var start_date = moment(self.start_date); + var end_date = moment(self.end_date); + var current_date = moment(self.current_date); + + if ($(self.selected).hasClass("dr-date-start")) { + selected.addClass('dr-hover dr-hover-before'); + $('.dr-start', self.element).css({'border': 'none', 'padding-left': '0.3125rem'}); + setMaybeRange('start'); + } + + if ($(self.selected).hasClass("dr-date-end")) { + selected.addClass('dr-hover dr-hover-after'); + $('.dr-end', self.element).css({'border': 'none', 'padding-right': '0.3125rem'}); + setMaybeRange('end'); + } + + if (!self.start_date && !self.end_date) + selected.addClass('dr-maybe'); + + $('.dr-selected', self.element).css('background-color', 'transparent'); + + function setMaybeRange(type) { + other = undefined; + + self.range(6 * 7).forEach(function(i) { + var next = selected.next().data('date'); + var prev = selected.prev().data('date'); + var curr = selected.data('date'); + + if (!curr) + return false; + + if (!prev) + prev = curr; + + if (!next) + next = curr; + + if (type == 'start') { + if (moment(next).isSame(self.end_date) || (self.sameDayRange && moment(curr).isSame(self.end_date))) + return false; + + if (moment(curr).isAfter(self.end_date)) { + other = other || moment(curr).add(6, 'day').startOf('day'); + + if (i > 5 || (next ? moment(next).isAfter(self.latest_date) : false)) { + $(selected).addClass('dr-end'); + other = moment(curr); + return false; + } + } + + selected = selected.next().addClass('dr-maybe'); + } else if (type == 'end') { + if (moment(prev).isSame(self.start_date) || (self.sameDayRange && moment(curr).isSame(self.start_date))) + return false; + + if (moment(curr).isBefore(self.start_date)) { + other = other || moment(curr).subtract(6, 'day'); + + if (i > 5 || (prev ? moment(prev).isBefore(self.earliest_date) : false)) { + $(selected).addClass('dr-start'); + other = moment(curr); + return false; + } + } + + selected = selected.prev().addClass('dr-maybe'); + } + }); + } + }, + mouseleave: function() { + if ($(this).hasClass('dr-hover-before dr-end')) + $(this).removeClass('dr-end'); + + if ($(this).hasClass('dr-hover-after dr-start')) + $(this).removeClass('dr-start'); + + $(this).removeClass('dr-hover dr-hover-before dr-hover-after'); + $('.dr-start, .dr-end', self.element).css({'border': '', 'padding': ''}); + $('.dr-maybe:not(.dr-current)', self.element).removeClass('dr-start dr-end'); + $('.dr-day', self.element).removeClass('dr-maybe'); + $('.dr-selected', self.element).css('background-color', ''); + } + }); + + if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) { + $('.dr-day', this.element).on({ + touchstart: function() { + self.selectOneDate(other, self, $(this).data('date')); + } + }); + + $('div[contenteditable]', this.element).removeAttr('contenteditable'); + } else { + $('.dr-day', this.element).on({ + mousedown: function () { + self.selectOneDate(other, self, $(this).data('date')); + } + }); + } + + $('.dr-calendar', this.element) + .css('width', cal_width) + .slideDown(200); + $('.dr-input', this.element).addClass('dr-active'); + $(selected).addClass('dr-active').focus(); + this.element.addClass('dr-active'); + + this.calIsOpen = true; + } + + + Calendar.prototype.calendarClose = function(type) { + var self = this; + + if (!this.calIsOpen || this.presetIsOpen || type == 'force') { + $('.dr-calendar', this.element).slideUp(200, function() { + $('.dr-day', self.element).remove(); + }); + } else { + $('.dr-day', this.element).remove(); + } + + if (type == 'switcher') { + return false; + } + + $('.dr-input, .dr-date', this.element).removeClass('dr-active'); + this.element.removeClass('dr-active'); + + this.calIsOpen = false; + } + + + Calendar.prototype.calendarCreate = function(switcher) { + var self = this; + var array = this.calendarArray(this.start_date, this.end_date, this.current_date, switcher); + + array.forEach(function(d, i) { + var classString = "dr-day"; + + if (d.fade) + classString += " dr-fade"; + + if (d.start) + classString += " dr-start"; + + if (d.end) + classString += " dr-end"; + + if (d.current) + classString += " dr-current"; + + if (d.selected) + classString += " dr-selected"; + + if (d.outside) + classString += " dr-outside"; + + $('.dr-day-list', self.element).append('
  • '+ d.str +'
  • '); + }); + } + + + Calendar.prototype.calendarArray = function(start, end, current, switcher) { + var self = this; + current = moment(current || start || end).startOf('day'); + + var reference = switcher || current || start || end; + + var startRange = moment(reference).startOf('month').startOf('week'); + var endRange = moment(startRange).add(6*7 - 1, 'days').endOf('day'); + + var daysInRange = []; + var d = moment(startRange); + while ( d.isBefore(endRange) ) { + daysInRange.push( { + str: +d.format('D'), + start: start && d.isSame(start, 'day'), + end: end && d.isSame(end, 'day'), + current: current && d.isSame(current, 'day'), + selected: start && end && d.isBetween(start, end), + date: d.toISOString(), + outside: d.isBefore(self.earliest_date) || d.isAfter(self.latest_date), + fade: !d.isSame(reference, 'month') + } ); + d.add(1, 'd'); + } + + return daysInRange; + } + + + Calendar.prototype.calendarHTML = function(type) { + var ul_days_of_the_week = $('
      '); + var days = this.days_array.splice(moment.localeData().firstDayOfWeek()).concat(this.days_array.splice(0, moment.localeData().firstDayOfWeek())); + + $.each(days, function(i, elem) { + ul_days_of_the_week.append('
    • ' + elem + '
    • '); + }); + + if (type == "double") + return this.element.append('
      ' + + '
      ' + + '
      '+ moment(this.start_date).format(this.format.input) +'
      ' + + '' + + '
      '+ moment(this.end_date).format(this.format.input) +'
      ' + + '
      ' + + + (this.presets ? '
      ' + + '' + + '' + + '' + + '
      ' : '') + + '
      ' + + + '
      ' + + '' + + (this.presets ? this.presetCreate()[0].outerHTML : '') + + '
      '); + + return this.element.append('
      ' + + '
      ' + + '
      '+ (this.settings.current_date ? moment(this.current_date).format(this.format.input) : '') +'
      ' + + '
      ' + + '
      ' + + + '
      ' + + '' + + '
      '); + } + + + Calendar.prototype.parseDate = function(d) { + if (moment.defaultZone !== null && moment.hasOwnProperty('tz')) { + return moment.tz(d, this.format.input, moment.defaultZone.name); + } else { + return moment(d, this.format.input); + } + } + + + Calendar.prototype.range = function(length) { + var range = new Array(length); + + for (var idx = 0; idx < length; idx++) { + range[idx] = idx; + } + + return range; + } + + + Calendar.prototype.selectOneDate = function(other, cal, date) { + var string = moment(date).format(cal.format.input); + + if (other) { + $('.dr-date', cal.element) + .not(cal.selected) + .html(other.format(cal.format.input)); + } + + $(cal.selected).html(string); + cal.calendarOpen(cal.selected); + + if ($(cal.selected).hasClass('dr-date-start')) { + $('.dr-date-end', cal.element).trigger('click'); + } else { + cal.calendarSaveDates(); + cal.calendarClose('force'); + } + } + + + return Calendar; +})); diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/Email-Example/sample-image.jpg b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/Email-Example/sample-image.jpg new file mode 100644 index 0000000..abd4aff --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/Email-Example/sample-image.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff7f50829671436db61b15966bbf65d35edf52b21fb9ed88aa1d64757889d156 +size 273162 diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/Email-Example/umbraco-logo.png b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/Email-Example/umbraco-logo.png new file mode 100644 index 0000000..584ab69 --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/Email-Example/umbraco-logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c47661c50db00434216915b2845a28aee86a6429c08e81ea8c1bb8773fad2125 +size 14066 diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/aspnet-validation/dist/aspnet-validation.min.js b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/aspnet-validation/dist/aspnet-validation.min.js new file mode 100644 index 0000000..e442df5 --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/aspnet-validation/dist/aspnet-validation.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.aspnetValidation=t():e.aspnetValidation=t()}(window,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";r.r(t),r.d(t,"MvcValidationProviders",function(){return o}),r.d(t,"ValidationService",function(){return s});var n=function(e,t,r,n){return new(r||(r=Promise))(function(a,i){function o(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?a(e.value):new r(function(t){t(e.value)}).then(o,s)}u((n=n.apply(e,t||[])).next())})},a=function(e,t){var r,n,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]-1){var a=e.substr(0,n)+"."+r,i=document.getElementsByName(a)[0];if(i)return i}return document.getElementsByName(r)[0]}var o=function(){return function(){this.required=function(e,t,r){return Boolean(e)},this.stringLength=function(e,t,r){if(!e)return!0;if(r.min){var n=parseInt(r.min);if(e.lengtha)return!1}return!0},this.compare=function(e,t,r){if(!r.other)return!0;var n=i(t.name,r.other);return!n||n.value===e},this.range=function(e,t,r){if(!e)return!0;var n=parseFloat(e);return!isNaN(n)&&(!(r.min&&nparseFloat(r.max)))},this.regex=function(e,t,r){return!e||!r.pattern||new RegExp(r.pattern).test(e)},this.email=function(e,t,r){return!e||/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*(\.\w{2,})+$/.test(e)},this.creditcard=function(e,t,r){if(!e)return!0;if(/[^0-9 \-]+/.test(e))return!1;var n,a,i=0,o=0,s=!1;if((e=e.replace(/\D/g,"")).length<13||e.length>19)return!1;for(n=e.length-1;n>=0;n--)a=e.charAt(n),o=parseInt(a,10),s&&(o*=2)>9&&(o-=9),i+=o,s=!s;return i%10==0},this.url=function(e,t,r){return!e||new RegExp("^(?:(?:https?|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))\\.?)(?::\\d{2,5})?(?:[/?#]\\S*)?$","i").test(e)},this.phone=function(e,t,r){return!e||!/[\+\-\s][\-\s]/g.test(e)&&/^\+?[0-9\-\s]+$/.test(e)},this.remote=function(e,t,r){if(!e)return!0;for(var n=r.additionalfields.split(","),a={},o=0,s=n;o=200&&n.status<300){var a=JSON.parse(n.responseText);e(a)}else t({status:n.status,statusText:n.statusText,data:n.responseText})},n.onerror=function(e){t({status:n.status,statusText:n.statusText,data:n.responseText})}})}}}(),s=function(){function e(){this.providers={},this.messageFor={},this.elementUIDs=[],this.elementByUID={},this.formInputs={},this.validators={},this.elementEvents={},this.summary={},this.debounce=300}return e.prototype.addProvider=function(e,t){this.providers[e]||(this.providers[e]=t)},e.prototype.addMvcProviders=function(){var e=new o;this.addProvider("required",e.required),this.addProvider("length",e.stringLength),this.addProvider("maxlength",e.stringLength),this.addProvider("minlength",e.stringLength),this.addProvider("equalto",e.compare),this.addProvider("range",e.range),this.addProvider("regex",e.regex),this.addProvider("creditcard",e.creditcard),this.addProvider("email",e.email),this.addProvider("url",e.url),this.addProvider("phone",e.phone),this.addProvider("remote",e.remote)},e.prototype.scanMessages=function(){for(var e=document.querySelectorAll("[data-valmsg-for]"),t=0;t>>0,s=0;sTe(e)?(d=e+1,_-Te(e)):(d=e,_),{year:d,dayOfYear:r}}function Ce(e,a,t){var s,n,d=Ne(e.year(),a,t),r=Math.floor((e.dayOfYear()-d-1)/7)+1;return r<1?s=r+Ie(n=e.year()-1,a,t):r>Ie(e.year(),a,t)?(s=r-Ie(e.year(),a,t),n=e.year()+1):(n=e.year(),s=r),{week:s,year:n}}function Ie(e,a,t){var s=Ne(e,a,t),n=Ne(e+1,a,t);return(Te(e)-s+n)/7}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),O("week","w"),O("isoWeek","W"),E("week",5),E("isoWeek",5),ie("w",B),ie("ww",B,V),ie("W",B),ie("WW",B,V),Me(["w","ww","W","WW"],function(e,a,t,s){a[s.substr(0,1)]=g(e)});function Ue(e,a){return e.slice(a,7).concat(e.slice(0,a))}C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),O("day","d"),O("weekday","e"),O("isoWeekday","E"),E("day",11),E("weekday",11),E("isoWeekday",11),ie("d",B),ie("e",B),ie("E",B),ie("dd",function(e,a){return a.weekdaysMinRegex(e)}),ie("ddd",function(e,a){return a.weekdaysShortRegex(e)}),ie("dddd",function(e,a){return a.weekdaysRegex(e)}),Me(["dd","ddd","dddd"],function(e,a,t,s){var n=t._locale.weekdaysParse(e,s,t._strict);null!=n?a.d=n:Y(t).invalidWeekday=e}),Me(["d","e","E"],function(e,a,t,s){a[s]=g(e)});var Ge="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var Ve="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var Ke="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var Ze=re;var $e=re;var Be=re;function qe(){function e(e,a){return a.length-e.length}var a,t,s,n,d,r=[],_=[],i=[],o=[];for(a=0;a<7;a++)t=c([2e3,1]).day(a),s=this.weekdaysMin(t,""),n=this.weekdaysShort(t,""),d=this.weekdays(t,""),r.push(s),_.push(n),i.push(d),o.push(s),o.push(n),o.push(d);for(r.sort(e),_.sort(e),i.sort(e),o.sort(e),a=0;a<7;a++)_[a]=me(_[a]),i[a]=me(i[a]),o[a]=me(o[a]);this._weekdaysRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+_.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Qe(){return this.hours()%12||12}function Xe(e,a){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),a)})}function ea(e,a){return a._meridiemParse}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,Qe),C("k",["kk",2],0,function(){return this.hours()||24}),C("hmm",0,0,function(){return""+Qe.apply(this)+F(this.minutes(),2)}),C("hmmss",0,0,function(){return""+Qe.apply(this)+F(this.minutes(),2)+F(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+F(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+F(this.minutes(),2)+F(this.seconds(),2)}),Xe("a",!0),Xe("A",!1),O("hour","h"),E("hour",13),ie("a",ea),ie("A",ea),ie("H",B),ie("h",B),ie("k",B),ie("HH",B,V),ie("hh",B,V),ie("kk",B,V),ie("hmm",q),ie("hmmss",Q),ie("Hmm",q),ie("Hmmss",Q),le(["H","HH"],Ye),le(["k","kk"],function(e,a,t){var s=g(e);a[Ye]=24===s?0:s}),le(["a","A"],function(e,a,t){t._isPm=t._locale.isPM(e),t._meridiem=e}),le(["h","hh"],function(e,a,t){a[Ye]=g(e),Y(t).bigHour=!0}),le("hmm",function(e,a,t){var s=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s)),Y(t).bigHour=!0}),le("hmmss",function(e,a,t){var s=e.length-4,n=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s,2)),a[fe]=g(e.substr(n)),Y(t).bigHour=!0}),le("Hmm",function(e,a,t){var s=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s))}),le("Hmmss",function(e,a,t){var s=e.length-4,n=e.length-2;a[Ye]=g(e.substr(0,s)),a[ye]=g(e.substr(s,2)),a[fe]=g(e.substr(n))});var aa,ta=Se("Hours",!0),sa={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Oe,monthsShort:Pe,week:{dow:0,doy:6},weekdays:Ge,weekdaysMin:Ke,weekdaysShort:Ve,meridiemParse:/[ap]\.?m?\.?/i},na={},da={};function ra(e){return e?e.toLowerCase().replace("_","-"):e}function _a(e){var a=null;if(!na[e]&&"undefined"!=typeof module&&module&&module.exports)try{a=aa._abbr,require("./locale/"+e),ia(a)}catch(e){}return na[e]}function ia(e,a){var t;return e&&((t=o(a)?ma(e):oa(e,a))?aa=t:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),aa._abbr}function oa(e,a){if(null===a)return delete na[e],null;var t,s=sa;if(a.abbr=e,null!=na[e])S("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=na[e]._config;else if(null!=a.parentLocale)if(null!=na[a.parentLocale])s=na[a.parentLocale]._config;else{if(null==(t=_a(a.parentLocale)))return da[a.parentLocale]||(da[a.parentLocale]=[]),da[a.parentLocale].push({name:e,config:a}),null;s=t._config}return na[e]=new j(b(s,a)),da[e]&&da[e].forEach(function(e){oa(e.name,e.config)}),ia(e),na[e]}function ma(e){var a;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return aa;if(!_(e)){if(a=_a(e))return a;e=[e]}return function(e){for(var a,t,s,n,d=0;d=a&&r(n,t,!0)>=a-1)break;a--}d++}return aa}(e)}function ua(e){var a,t=e._a;return t&&-2===Y(e).overflow&&(a=t[Le]<0||11je(t[he],t[Le])?ce:t[Ye]<0||24Ie(t,d,r)?Y(e)._overflowWeeks=!0:null!=i?Y(e)._overflowWeekday=!0:(_=Re(t,s,n,d,r),e._a[he]=_.year,e._dayOfYear=_.dayOfYear)}(e),null!=e._dayOfYear&&(d=la(e._a[he],s[he]),(e._dayOfYear>Te(d)||0===e._dayOfYear)&&(Y(e)._overflowDayOfYear=!0),t=Je(d,0,e._dayOfYear),e._a[Le]=t.getUTCMonth(),e._a[ce]=t.getUTCDate()),a=0;a<3&&null==e._a[a];++a)e._a[a]=r[a]=s[a];for(;a<7;a++)e._a[a]=r[a]=null==e._a[a]?2===a?1:0:e._a[a];24===e._a[Ye]&&0===e._a[ye]&&0===e._a[fe]&&0===e._a[ke]&&(e._nextDay=!0,e._a[Ye]=0),e._d=(e._useUTC?Je:function(e,a,t,s,n,d,r){var _;return e<100&&0<=e?(_=new Date(e+400,a,t,s,n,d,r),isFinite(_.getFullYear())&&_.setFullYear(e)):_=new Date(e,a,t,s,n,d,r),_}).apply(null,r),n=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Ye]=24),e._w&&void 0!==e._w.d&&e._w.d!==n&&(Y(e).weekdayMismatch=!0)}}var ha=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,La=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ca=/Z|[+-]\d\d(?::?\d\d)?/,Ya=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],ya=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],fa=/^\/?Date\((\-?\d+)/i;function ka(e){var a,t,s,n,d,r,_=e._i,i=ha.exec(_)||La.exec(_);if(i){for(Y(e).iso=!0,a=0,t=Ya.length;at.valueOf():t.valueOf()this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},Mt.isLocal=function(){return!!this.isValid()&&!this._isUTC},Mt.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},Mt.isUtc=Ra,Mt.isUTC=Ra,Mt.zoneAbbr=function(){return this._isUTC?"UTC":""},Mt.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},Mt.dates=t("dates accessor is deprecated. Use date instead.",_t),Mt.months=t("months accessor is deprecated. Use month instead",Ae),Mt.years=t("years accessor is deprecated. Use year instead",ve),Mt.zone=t("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,a){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,a),this):-this.utcOffset()}),Mt.isDSTShifted=t("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!o(this._isDSTShifted))return this._isDSTShifted;var e={};if(k(e,this),(e=va(e))._a){var a=e._isUTC?c(e._a):Ha(e._a);this._isDSTShifted=this.isValid()&&0 11) { + calendar.year += Math.floor(Math.abs(calendar.month)/12); + calendar.month -= 12; + } + return calendar; + }, + + /** + * defaults and localisation + */ + defaults = { + + // bind the picker to a form field + field: null, + + // automatically show/hide the picker on `field` focus (default `true` if `field` is set) + bound: undefined, + + // data-attribute on the input field with an aria assistance tekst (only applied when `bound` is set) + ariaLabel: 'Use the arrow keys to pick a date', + + // position of the datepicker, relative to the field (default to bottom & left) + // ('bottom' & 'left' keywords are not used, 'top' & 'right' are modifier on the bottom/left position) + position: 'bottom left', + + // automatically fit in the viewport even if it means repositioning from the position option + reposition: true, + + // the default output format for `.toString()` and `field` value + format: 'YYYY-MM-DD', + + // the toString function which gets passed a current date object and format + // and returns a string + toString: null, + + // used to create date object from current input string + parse: null, + + // the initial date to view when first opened + defaultDate: null, + + // make the `defaultDate` the initial selected value + setDefaultDate: false, + + // first day of week (0: Sunday, 1: Monday etc) + firstDay: 0, + + // the default flag for moment's strict date parsing + formatStrict: false, + + // the minimum/earliest date that can be selected + minDate: null, + // the maximum/latest date that can be selected + maxDate: null, + + // number of years either side, or array of upper/lower range + yearRange: 10, + + // show week numbers at head of row + showWeekNumber: false, + + // Week picker mode + pickWholeWeek: false, + + // used internally (don't config outside) + minYear: 0, + maxYear: 9999, + minMonth: undefined, + maxMonth: undefined, + + startRange: null, + endRange: null, + + isRTL: false, + + // Additional text to append to the year in the calendar title + yearSuffix: '', + + // Render the month after year in the calendar title + showMonthAfterYear: false, + + // Render days of the calendar grid that fall in the next or previous month + showDaysInNextAndPreviousMonths: false, + + // Allows user to select days that fall in the next or previous month + enableSelectionDaysInNextAndPreviousMonths: false, + + // how many months are visible + numberOfMonths: 1, + + // when numberOfMonths is used, this will help you to choose where the main calendar will be (default `left`, can be set to `right`) + // only used for the first display or when a selected date is not visible + mainCalendar: 'left', + + // Specify a DOM element to render the calendar in + container: undefined, + + // Blur field when date is selected + blurFieldOnSelect : true, + + // internationalization + i18n: { + previousMonth : 'Previous Month', + nextMonth : 'Next Month', + months : ['January','February','March','April','May','June','July','August','September','October','November','December'], + weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], + weekdaysShort : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'] + }, + + // Theme Classname + theme: null, + + // events array + events: [], + + // callback function + onSelect: null, + onOpen: null, + onClose: null, + onDraw: null, + + // Enable keyboard input + keyboardInput: true + }, + + + /** + * templating functions to abstract HTML rendering + */ + renderDayName = function(opts, day, abbr) + { + day += opts.firstDay; + while (day >= 7) { + day -= 7; + } + return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day]; + }, + + renderDay = function(opts) + { + var arr = []; + var ariaSelected = 'false'; + if (opts.isEmpty) { + if (opts.showDaysInNextAndPreviousMonths) { + arr.push('is-outside-current-month'); + + if(!opts.enableSelectionDaysInNextAndPreviousMonths) { + arr.push('is-selection-disabled'); + } + + } else { + return ''; + } + } + if (opts.isDisabled) { + arr.push('is-disabled'); + } + if (opts.isToday) { + arr.push('is-today'); + } + if (opts.isSelected) { + arr.push('is-selected'); + ariaSelected = 'true'; + } + if (opts.hasEvent) { + arr.push('has-event'); + } + if (opts.isInRange) { + arr.push('is-inrange'); + } + if (opts.isStartRange) { + arr.push('is-startrange'); + } + if (opts.isEndRange) { + arr.push('is-endrange'); + } + return '' + + '' + + ''; + }, + + renderWeek = function (d, m, y) { + // Lifted from http://javascript.about.com/library/blweekyear.htm, lightly modified. + var onejan = new Date(y, 0, 1), + weekNum = Math.ceil((((new Date(y, m, d) - onejan) / 86400000) + onejan.getDay()+1)/7); + return '' + weekNum + ''; + }, + + renderRow = function(days, isRTL, pickWholeWeek, isRowSelected) + { + return '' + (isRTL ? days.reverse() : days).join('') + ''; + }, + + renderBody = function(rows) + { + return '' + rows.join('') + ''; + }, + + renderHead = function(opts) + { + var i, arr = []; + if (opts.showWeekNumber) { + arr.push(''); + } + for (i = 0; i < 7; i++) { + arr.push('' + renderDayName(opts, i, true) + ''); + } + return '' + (opts.isRTL ? arr.reverse() : arr).join('') + ''; + }, + + renderTitle = function(instance, c, year, month, refYear, randId) + { + var i, j, arr, + opts = instance._o, + isMinYear = year === opts.minYear, + isMaxYear = year === opts.maxYear, + html = '
      ', + monthHtml, + yearHtml, + prev = true, + next = true; + + for (arr = [], i = 0; i < 12; i++) { + arr.push(''); + } + + monthHtml = '
      ' + opts.i18n.months[month] + '
      '; + + if (isArray(opts.yearRange)) { + i = opts.yearRange[0]; + j = opts.yearRange[1] + 1; + } else { + i = year - opts.yearRange; + j = 1 + year + opts.yearRange; + } + + for (arr = []; i < j && i <= opts.maxYear; i++) { + if (i >= opts.minYear) { + arr.push(''); + } + } + yearHtml = '
      ' + year + opts.yearSuffix + '
      '; + + if (opts.showMonthAfterYear) { + html += yearHtml + monthHtml; + } else { + html += monthHtml + yearHtml; + } + + if (isMinYear && (month === 0 || opts.minMonth >= month)) { + prev = false; + } + + if (isMaxYear && (month === 11 || opts.maxMonth <= month)) { + next = false; + } + + if (c === 0) { + html += ''; + } + if (c === (instance._o.numberOfMonths - 1) ) { + html += ''; + } + + return html += '
      '; + }, + + renderTable = function(opts, data, randId) + { + return '' + renderHead(opts) + renderBody(data) + '
      '; + }, + + + /** + * Pikaday constructor + */ + Pikaday = function(options) + { + var self = this, + opts = self.config(options); + + self._onMouseDown = function(e) + { + if (!self._v) { + return; + } + e = e || window.event; + var target = e.target || e.srcElement; + if (!target) { + return; + } + + if (!hasClass(target, 'is-disabled')) { + if (hasClass(target, 'pika-button') && !hasClass(target, 'is-empty') && !hasClass(target.parentNode, 'is-disabled')) { + self.setDate(new Date(target.getAttribute('data-pika-year'), target.getAttribute('data-pika-month'), target.getAttribute('data-pika-day'))); + if (opts.bound) { + sto(function() { + self.hide(); + if (opts.blurFieldOnSelect && opts.field) { + opts.field.blur(); + } + }, 100); + } + } + else if (hasClass(target, 'pika-prev')) { + self.prevMonth(); + } + else if (hasClass(target, 'pika-next')) { + self.nextMonth(); + } + } + if (!hasClass(target, 'pika-select')) { + // if this is touch event prevent mouse events emulation + if (e.preventDefault) { + e.preventDefault(); + } else { + e.returnValue = false; + return false; + } + } else { + self._c = true; + } + }; + + self._onChange = function(e) + { + e = e || window.event; + var target = e.target || e.srcElement; + if (!target) { + return; + } + if (hasClass(target, 'pika-select-month')) { + self.gotoMonth(target.value); + } + else if (hasClass(target, 'pika-select-year')) { + self.gotoYear(target.value); + } + }; + + self._onKeyChange = function(e) + { + e = e || window.event; + + if (self.isVisible()) { + + switch(e.keyCode){ + case 13: + case 27: + if (opts.field) { + opts.field.blur(); + } + break; + case 37: + e.preventDefault(); + self.adjustDate('subtract', 1); + break; + case 38: + self.adjustDate('subtract', 7); + break; + case 39: + self.adjustDate('add', 1); + break; + case 40: + self.adjustDate('add', 7); + break; + } + } + }; + + self._onInputChange = function(e) + { + var date; + + if (e.firedBy === self) { + return; + } + if (opts.parse) { + date = opts.parse(opts.field.value, opts.format); + } else if (hasMoment) { + date = moment(opts.field.value, opts.format, opts.formatStrict); + date = (date && date.isValid()) ? date.toDate() : null; + } + else { + date = new Date(Date.parse(opts.field.value)); + } + if (isDate(date)) { + self.setDate(date); + } + if (!self._v) { + self.show(); + } + }; + + self._onInputFocus = function() + { + self.show(); + }; + + self._onInputClick = function() + { + self.show(); + }; + + self._onInputBlur = function() + { + // IE allows pika div to gain focus; catch blur the input field + var pEl = document.activeElement; + do { + if (hasClass(pEl, 'pika-single')) { + return; + } + } + while ((pEl = pEl.parentNode)); + + if (!self._c) { + self._b = sto(function() { + self.hide(); + }, 50); + } + self._c = false; + }; + + self._onClick = function(e) + { + e = e || window.event; + var target = e.target || e.srcElement, + pEl = target; + if (!target) { + return; + } + if (!hasEventListeners && hasClass(target, 'pika-select')) { + if (!target.onchange) { + target.setAttribute('onchange', 'return;'); + addEvent(target, 'change', self._onChange); + } + } + do { + if (hasClass(pEl, 'pika-single') || pEl === opts.trigger) { + return; + } + } + while ((pEl = pEl.parentNode)); + if (self._v && target !== opts.trigger && pEl !== opts.trigger) { + self.hide(); + } + }; + + self.el = document.createElement('div'); + self.el.className = 'pika-single' + (opts.isRTL ? ' is-rtl' : '') + (opts.theme ? ' ' + opts.theme : ''); + + addEvent(self.el, 'mousedown', self._onMouseDown, true); + addEvent(self.el, 'touchend', self._onMouseDown, true); + addEvent(self.el, 'change', self._onChange); + + if (opts.keyboardInput) { + addEvent(document, 'keydown', self._onKeyChange); + } + + if (opts.field) { + if (opts.container) { + opts.container.appendChild(self.el); + } else if (opts.bound) { + document.body.appendChild(self.el); + } else { + opts.field.parentNode.insertBefore(self.el, opts.field.nextSibling); + } + addEvent(opts.field, 'change', self._onInputChange); + + if (!opts.defaultDate) { + if (hasMoment && opts.field.value) { + opts.defaultDate = moment(opts.field.value, opts.format).toDate(); + } else { + opts.defaultDate = new Date(Date.parse(opts.field.value)); + } + opts.setDefaultDate = true; + } + } + + var defDate = opts.defaultDate; + + if (isDate(defDate)) { + if (opts.setDefaultDate) { + self.setDate(defDate, true); + } else { + self.gotoDate(defDate); + } + } else { + self.gotoDate(new Date()); + } + + if (opts.bound) { + this.hide(); + self.el.className += ' is-bound'; + addEvent(opts.trigger, 'click', self._onInputClick); + addEvent(opts.trigger, 'focus', self._onInputFocus); + addEvent(opts.trigger, 'blur', self._onInputBlur); + } else { + this.show(); + } + }; + + + /** + * public Pikaday API + */ + Pikaday.prototype = { + + + /** + * configure functionality + */ + config: function(options) + { + if (!this._o) { + this._o = extend({}, defaults, true); + } + + var opts = extend(this._o, options, true); + + opts.isRTL = !!opts.isRTL; + + opts.field = (opts.field && opts.field.nodeName) ? opts.field : null; + + opts.theme = (typeof opts.theme) === 'string' && opts.theme ? opts.theme : null; + + opts.bound = !!(opts.bound !== undefined ? opts.field && opts.bound : opts.field); + + opts.trigger = (opts.trigger && opts.trigger.nodeName) ? opts.trigger : opts.field; + + opts.disableWeekends = !!opts.disableWeekends; + + opts.disableDayFn = (typeof opts.disableDayFn) === 'function' ? opts.disableDayFn : null; + + var nom = parseInt(opts.numberOfMonths, 10) || 1; + opts.numberOfMonths = nom > 4 ? 4 : nom; + + if (!isDate(opts.minDate)) { + opts.minDate = false; + } + if (!isDate(opts.maxDate)) { + opts.maxDate = false; + } + if ((opts.minDate && opts.maxDate) && opts.maxDate < opts.minDate) { + opts.maxDate = opts.minDate = false; + } + if (opts.minDate) { + this.setMinDate(opts.minDate); + } + if (opts.maxDate) { + this.setMaxDate(opts.maxDate); + } + + if (isArray(opts.yearRange)) { + var fallback = new Date().getFullYear() - 10; + opts.yearRange[0] = parseInt(opts.yearRange[0], 10) || fallback; + opts.yearRange[1] = parseInt(opts.yearRange[1], 10) || fallback; + } else { + opts.yearRange = Math.abs(parseInt(opts.yearRange, 10)) || defaults.yearRange; + if (opts.yearRange > 100) { + opts.yearRange = 100; + } + } + + return opts; + }, + + /** + * return a formatted string of the current selection (using Moment.js if available) + */ + toString: function(format) + { + format = format || this._o.format; + if (!isDate(this._d)) { + return ''; + } + if (this._o.toString) { + return this._o.toString(this._d, format); + } + if (hasMoment) { + return moment(this._d).format(format); + } + return this._d.toDateString(); + }, + + /** + * return a Moment.js object of the current selection (if available) + */ + getMoment: function() + { + return hasMoment ? moment(this._d) : null; + }, + + /** + * set the current selection from a Moment.js object (if available) + */ + setMoment: function(date, preventOnSelect) + { + if (hasMoment && moment.isMoment(date)) { + this.setDate(date.toDate(), preventOnSelect); + } + }, + + /** + * return a Date object of the current selection + */ + getDate: function() + { + return isDate(this._d) ? new Date(this._d.getTime()) : null; + }, + + /** + * set the current selection + */ + setDate: function(date, preventOnSelect) + { + if (!date) { + this._d = null; + + if (this._o.field) { + this._o.field.value = ''; + fireEvent(this._o.field, 'change', { firedBy: this }); + } + + return this.draw(); + } + if (typeof date === 'string') { + date = new Date(Date.parse(date)); + } + if (!isDate(date)) { + return; + } + + var min = this._o.minDate, + max = this._o.maxDate; + + if (isDate(min) && date < min) { + date = min; + } else if (isDate(max) && date > max) { + date = max; + } + + this._d = new Date(date.getTime()); + setToStartOfDay(this._d); + this.gotoDate(this._d); + + if (this._o.field) { + this._o.field.value = this.toString(); + fireEvent(this._o.field, 'change', { firedBy: this }); + } + if (!preventOnSelect && typeof this._o.onSelect === 'function') { + this._o.onSelect.call(this, this.getDate()); + } + }, + + /** + * change view to a specific date + */ + gotoDate: function(date) + { + var newCalendar = true; + + if (!isDate(date)) { + return; + } + + if (this.calendars) { + var firstVisibleDate = new Date(this.calendars[0].year, this.calendars[0].month, 1), + lastVisibleDate = new Date(this.calendars[this.calendars.length-1].year, this.calendars[this.calendars.length-1].month, 1), + visibleDate = date.getTime(); + // get the end of the month + lastVisibleDate.setMonth(lastVisibleDate.getMonth()+1); + lastVisibleDate.setDate(lastVisibleDate.getDate()-1); + newCalendar = (visibleDate < firstVisibleDate.getTime() || lastVisibleDate.getTime() < visibleDate); + } + + if (newCalendar) { + this.calendars = [{ + month: date.getMonth(), + year: date.getFullYear() + }]; + if (this._o.mainCalendar === 'right') { + this.calendars[0].month += 1 - this._o.numberOfMonths; + } + } + + this.adjustCalendars(); + }, + + adjustDate: function(sign, days) { + + var day = this.getDate() || new Date(); + var difference = parseInt(days)*24*60*60*1000; + + var newDay; + + if (sign === 'add') { + newDay = new Date(day.valueOf() + difference); + } else if (sign === 'subtract') { + newDay = new Date(day.valueOf() - difference); + } + + this.setDate(newDay); + }, + + adjustCalendars: function() { + this.calendars[0] = adjustCalendar(this.calendars[0]); + for (var c = 1; c < this._o.numberOfMonths; c++) { + this.calendars[c] = adjustCalendar({ + month: this.calendars[0].month + c, + year: this.calendars[0].year + }); + } + this.draw(); + }, + + gotoToday: function() + { + this.gotoDate(new Date()); + }, + + /** + * change view to a specific month (zero-index, e.g. 0: January) + */ + gotoMonth: function(month) + { + if (!isNaN(month)) { + this.calendars[0].month = parseInt(month, 10); + this.adjustCalendars(); + } + }, + + nextMonth: function() + { + this.calendars[0].month++; + this.adjustCalendars(); + }, + + prevMonth: function() + { + this.calendars[0].month--; + this.adjustCalendars(); + }, + + /** + * change view to a specific full year (e.g. "2012") + */ + gotoYear: function(year) + { + if (!isNaN(year)) { + this.calendars[0].year = parseInt(year, 10); + this.adjustCalendars(); + } + }, + + /** + * change the minDate + */ + setMinDate: function(value) + { + if(value instanceof Date) { + setToStartOfDay(value); + this._o.minDate = value; + this._o.minYear = value.getFullYear(); + this._o.minMonth = value.getMonth(); + } else { + this._o.minDate = defaults.minDate; + this._o.minYear = defaults.minYear; + this._o.minMonth = defaults.minMonth; + this._o.startRange = defaults.startRange; + } + + this.draw(); + }, + + /** + * change the maxDate + */ + setMaxDate: function(value) + { + if(value instanceof Date) { + setToStartOfDay(value); + this._o.maxDate = value; + this._o.maxYear = value.getFullYear(); + this._o.maxMonth = value.getMonth(); + } else { + this._o.maxDate = defaults.maxDate; + this._o.maxYear = defaults.maxYear; + this._o.maxMonth = defaults.maxMonth; + this._o.endRange = defaults.endRange; + } + + this.draw(); + }, + + setStartRange: function(value) + { + this._o.startRange = value; + }, + + setEndRange: function(value) + { + this._o.endRange = value; + }, + + /** + * refresh the HTML + */ + draw: function(force) + { + if (!this._v && !force) { + return; + } + var opts = this._o, + minYear = opts.minYear, + maxYear = opts.maxYear, + minMonth = opts.minMonth, + maxMonth = opts.maxMonth, + html = '', + randId; + + if (this._y <= minYear) { + this._y = minYear; + if (!isNaN(minMonth) && this._m < minMonth) { + this._m = minMonth; + } + } + if (this._y >= maxYear) { + this._y = maxYear; + if (!isNaN(maxMonth) && this._m > maxMonth) { + this._m = maxMonth; + } + } + + randId = 'pika-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2); + + for (var c = 0; c < opts.numberOfMonths; c++) { + html += '
      ' + renderTitle(this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year, randId) + this.render(this.calendars[c].year, this.calendars[c].month, randId) + '
      '; + } + + this.el.innerHTML = html; + + if (opts.bound) { + if(opts.field.type !== 'hidden') { + sto(function() { + opts.trigger.focus(); + }, 1); + } + } + + if (typeof this._o.onDraw === 'function') { + this._o.onDraw(this); + } + + if (opts.bound) { + // let the screen reader user know to use arrow keys + opts.field.setAttribute('aria-label', opts.ariaLabel); + } + }, + + adjustPosition: function() + { + var field, pEl, width, height, viewportWidth, viewportHeight, scrollTop, left, top, clientRect, leftAligned, bottomAligned; + + if (this._o.container) return; + + this.el.style.position = 'absolute'; + + field = this._o.trigger; + pEl = field; + width = this.el.offsetWidth; + height = this.el.offsetHeight; + viewportWidth = window.innerWidth || document.documentElement.clientWidth; + viewportHeight = window.innerHeight || document.documentElement.clientHeight; + scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop; + leftAligned = true; + bottomAligned = true; + + if (typeof field.getBoundingClientRect === 'function') { + clientRect = field.getBoundingClientRect(); + left = clientRect.left + window.pageXOffset; + top = clientRect.bottom + window.pageYOffset; + } else { + left = pEl.offsetLeft; + top = pEl.offsetTop + pEl.offsetHeight; + while((pEl = pEl.offsetParent)) { + left += pEl.offsetLeft; + top += pEl.offsetTop; + } + } + + // default position is bottom & left + if ((this._o.reposition && left + width > viewportWidth) || + ( + this._o.position.indexOf('right') > -1 && + left - width + field.offsetWidth > 0 + ) + ) { + left = left - width + field.offsetWidth; + leftAligned = false; + } + if ((this._o.reposition && top + height > viewportHeight + scrollTop) || + ( + this._o.position.indexOf('top') > -1 && + top - height - field.offsetHeight > 0 + ) + ) { + top = top - height - field.offsetHeight; + bottomAligned = false; + } + + this.el.style.left = left + 'px'; + this.el.style.top = top + 'px'; + + addClass(this.el, leftAligned ? 'left-aligned' : 'right-aligned'); + addClass(this.el, bottomAligned ? 'bottom-aligned' : 'top-aligned'); + removeClass(this.el, !leftAligned ? 'left-aligned' : 'right-aligned'); + removeClass(this.el, !bottomAligned ? 'bottom-aligned' : 'top-aligned'); + }, + + /** + * render HTML for a particular month + */ + render: function(year, month, randId) + { + var opts = this._o, + now = new Date(), + days = getDaysInMonth(year, month), + before = new Date(year, month, 1).getDay(), + data = [], + row = []; + setToStartOfDay(now); + if (opts.firstDay > 0) { + before -= opts.firstDay; + if (before < 0) { + before += 7; + } + } + var previousMonth = month === 0 ? 11 : month - 1, + nextMonth = month === 11 ? 0 : month + 1, + yearOfPreviousMonth = month === 0 ? year - 1 : year, + yearOfNextMonth = month === 11 ? year + 1 : year, + daysInPreviousMonth = getDaysInMonth(yearOfPreviousMonth, previousMonth); + var cells = days + before, + after = cells; + while(after > 7) { + after -= 7; + } + cells += 7 - after; + var isWeekSelected = false; + for (var i = 0, r = 0; i < cells; i++) + { + var day = new Date(year, month, 1 + (i - before)), + isSelected = isDate(this._d) ? compareDates(day, this._d) : false, + isToday = compareDates(day, now), + hasEvent = opts.events.indexOf(day.toDateString()) !== -1 ? true : false, + isEmpty = i < before || i >= (days + before), + dayNumber = 1 + (i - before), + monthNumber = month, + yearNumber = year, + isStartRange = opts.startRange && compareDates(opts.startRange, day), + isEndRange = opts.endRange && compareDates(opts.endRange, day), + isInRange = opts.startRange && opts.endRange && opts.startRange < day && day < opts.endRange, + isDisabled = (opts.minDate && day < opts.minDate) || + (opts.maxDate && day > opts.maxDate) || + (opts.disableWeekends && isWeekend(day)) || + (opts.disableDayFn && opts.disableDayFn(day)); + + if (isEmpty) { + if (i < before) { + dayNumber = daysInPreviousMonth + dayNumber; + monthNumber = previousMonth; + yearNumber = yearOfPreviousMonth; + } else { + dayNumber = dayNumber - days; + monthNumber = nextMonth; + yearNumber = yearOfNextMonth; + } + } + + var dayConfig = { + day: dayNumber, + month: monthNumber, + year: yearNumber, + hasEvent: hasEvent, + isSelected: isSelected, + isToday: isToday, + isDisabled: isDisabled, + isEmpty: isEmpty, + isStartRange: isStartRange, + isEndRange: isEndRange, + isInRange: isInRange, + showDaysInNextAndPreviousMonths: opts.showDaysInNextAndPreviousMonths, + enableSelectionDaysInNextAndPreviousMonths: opts.enableSelectionDaysInNextAndPreviousMonths + }; + + if (opts.pickWholeWeek && isSelected) { + isWeekSelected = true; + } + + row.push(renderDay(dayConfig)); + + if (++r === 7) { + if (opts.showWeekNumber) { + row.unshift(renderWeek(i - before, month, year)); + } + data.push(renderRow(row, opts.isRTL, opts.pickWholeWeek, isWeekSelected)); + row = []; + r = 0; + isWeekSelected = false; + } + } + return renderTable(opts, data, randId); + }, + + isVisible: function() + { + return this._v; + }, + + show: function() + { + if (!this.isVisible()) { + this._v = true; + this.draw(); + removeClass(this.el, 'is-hidden'); + if (this._o.bound) { + addEvent(document, 'click', this._onClick); + this.adjustPosition(); + } + if (typeof this._o.onOpen === 'function') { + this._o.onOpen.call(this); + } + } + }, + + hide: function() + { + var v = this._v; + if (v !== false) { + if (this._o.bound) { + removeEvent(document, 'click', this._onClick); + } + this.el.style.position = 'static'; // reset + this.el.style.left = 'auto'; + this.el.style.top = 'auto'; + addClass(this.el, 'is-hidden'); + this._v = false; + if (v !== undefined && typeof this._o.onClose === 'function') { + this._o.onClose.call(this); + } + } + }, + + /** + * GAME OVER + */ + destroy: function() + { + var opts = this._o; + + this.hide(); + removeEvent(this.el, 'mousedown', this._onMouseDown, true); + removeEvent(this.el, 'touchend', this._onMouseDown, true); + removeEvent(this.el, 'change', this._onChange); + if (opts.keyboardInput) { + removeEvent(document, 'keydown', this._onKeyChange); + } + if (opts.field) { + removeEvent(opts.field, 'change', this._onInputChange); + if (opts.bound) { + removeEvent(opts.trigger, 'click', this._onInputClick); + removeEvent(opts.trigger, 'focus', this._onInputFocus); + removeEvent(opts.trigger, 'blur', this._onInputBlur); + } + } + if (this.el.parentNode) { + this.el.parentNode.removeChild(this.el); + } + } + + }; + + return Pikaday; +})); \ No newline at end of file diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/promise-polyfill/dist/polyfill.min.js b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/promise-polyfill/dist/polyfill.min.js new file mode 100644 index 0000000..09fa4d5 --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/promise-polyfill/dist/polyfill.min.js @@ -0,0 +1 @@ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(0,function(){"use strict";function e(e){var n=this.constructor;return this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){return n.reject(t)})})}function n(e){return!(!e||"undefined"==typeof e.length)}function t(){}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],c(e,this)}function r(e,n){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,o._immediateFn(function(){var t=1===e._state?n.onFulfilled:n.onRejected;if(null!==t){var o;try{o=t(e._value)}catch(r){return void f(n.promise,r)}i(n.promise,o)}else(1===e._state?i:f)(n.promise,e._value)})):e._deferreds.push(n)}function i(e,n){try{if(n===e)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if(n instanceof o)return e._state=3,e._value=n,void u(e);if("function"==typeof t)return void c(function(e,n){return function(){e.apply(n,arguments)}}(t,n),e)}e._state=1,e._value=n,u(e)}catch(r){f(e,r)}}function f(e,n){e._state=2,e._value=n,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var n=0,t=e._deferreds.length;t>n;n++)r(e,e._deferreds[n]);e._deferreds=null}function c(e,n){var t=!1;try{e(function(e){t||(t=!0,i(n,e))},function(e){t||(t=!0,f(n,e))})}catch(o){if(t)return;t=!0,f(n,o)}}var a=setTimeout;o.prototype["catch"]=function(e){return this.then(null,e)},o.prototype.then=function(e,n){var o=new this.constructor(t);return r(this,new function(e,n,t){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.promise=t}(e,n,o)),o},o.prototype["finally"]=e,o.all=function(e){return new o(function(t,o){function r(e,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var u=n.then;if("function"==typeof u)return void u.call(n,function(n){r(e,n)},o)}i[e]=n,0==--f&&t(i)}catch(c){o(c)}}if(!n(e))return o(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(e);if(0===i.length)return t([]);for(var f=i.length,u=0;i.length>u;u++)r(u,i[u])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(n){n(e)})},o.reject=function(e){return new o(function(n,t){t(e)})},o.race=function(e){return new o(function(t,r){if(!n(e))return r(new TypeError("Promise.race accepts an array"));for(var i=0,f=e.length;f>i;i++)o.resolve(e[i]).then(t,r)})},o._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){a(e,0)},o._unhandledRejectionFn=function(e){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var l=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"Promise"in l?l.Promise.prototype["finally"]||(l.Promise.prototype["finally"]=e):l.Promise=o}); diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/themes/default/style.css b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/themes/default/style.css new file mode 100644 index 0000000..a37c729 --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/themes/default/style.css @@ -0,0 +1,150 @@ + +.umbraco-forms-form +{ + padding: 10px 0px 10px 0px; +} + +.umbraco-forms-caption +{ + font-size: 2em !important; + line-height: 2em !important; +} + +.umbraco-forms-field +{ + clear: both; +} + +.umbraco-forms-field div label +{ + display: inline; +} + +label.umbraco-forms-label +{ + font-weight: bold; + display: block; + background: transparent !important; +} + +.umbraco-forms-form small +{ + display: block; + float: left; + clear: both; + padding: 5px 5px 5px 200px; +} + + +.umbraco-forms-form fieldset +{ + padding: 1em 1em 0em 0em; + margin: 0 0 1.5em 0; + border: none !Important; +} + +.umbraco-forms-form .umbraco-forms-navigation { + padding: 1em 0em; +} + +.umbraco-forms-form legend +{ + font-weight: bold; + font-size: 1.2em; + line-height: 1.2em; + display: block; +} + +.umbraco-forms-form input.text, .umbraco-forms-form input.title, .umbraco-forms-form textarea, +.umbraco-forms-form select +{ + margin: 0.5em 0; + border: 1px solid #bbb; +} +.umbraco-forms-form input.text:focus, .umbraco-forms-form input.title:focus,.umbraco-forms-form textarea:focus, .umbraco-forms-form select:focus +{ + border: 1px solid #666; +} + +.umbraco-forms-form input.text,.umbraco-forms-form textarea +{ + max-width: 400px !important; + padding: 5px; + display: block; + width: 95%; +} + +.umbraco-forms-form textarea +{ + height: 250px; +} +.umbraco-forms-form input.fileupload +{ + height: auto !important; +} + +.umbraco-forms-form span.checkboxlist, .umbraco-forms-form span.radiobuttonlist, .umbraco-forms-form span.checkbox +{ + display: block; + float: left; + padding: 10px; +} + +.umbraco-forms-form .checkboxlist label { + float: left; + clear: left; +} + +.umbraco-forms-form .checkboxlist input, .umbraco-forms-form .radiobuttonlist input, .umbraco-forms-form .checkbox input +{ + width: auto !important; + height: auto !important; + border: none !important; + display: inline !important; +} + +.umbraco-forms-form .hiddenfield +{ + display:none; +} + +.umbraco-forms-button +{ + margin-right: 10px; + padding: 2px 10px; +} +.umbraco-forms-error-message +{ + padding: .8em; + margin-bottom: .5em; + border: 2px solid #FBC2C4; +} + +.umbraco-forms-error-message +{ + background: #FBE3E4; + color: #8a1f11; +} + +.umbraco-forms-form input.contourError, .umbraco-forms-form textarea.contourError,.umbraco-forms-form input.input-validation-error, +.umbraco-forms-form textarea.input-validation-error +{ + background: #FBE3E4; + border-color: #FBC2C4; +} + +.umbraco-forms-form span.contourError, .umbraco-forms-form span.field-validation-error +{ + color: #8a1f11 !important; + background: transparent !important; +} + +.umbraco-forms-form #recaptcha_widget_div +{ + margin-left: 200px; +} + +.umbraco-forms-form .field-validation-error +{ + padding-left: 5px; +} \ No newline at end of file diff --git a/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/themes/default/umbracoforms.js b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/themes/default/umbracoforms.js new file mode 100644 index 0000000..47d52e4 --- /dev/null +++ b/TestSite-V8.7.3/App_Plugins/UmbracoForms/Assets/themes/default/umbracoforms.js @@ -0,0 +1,567 @@ +(function () { + + + // polyfill for matches and closest + if (!Element.prototype.matches) Element.prototype.matches = Element.prototype.msMatchesSelector; + if (!Element.prototype.closest) Element.prototype.closest = function (selector) { + var el = this; + while (el) { + if (el.matches(selector)) { + return el; + } + el = el.parentElement; + } + }; + + + + //execute init() on document ready + if (document.readyState === "complete" || (document.readyState !== "loading" && !document.documentElement.doScroll)) { + listen(); + } else { + document.addEventListener("DOMContentLoaded", listen); + } + + function listen() { + if (typeof umbracoFormsCollection === "undefined") { + //this will occur if this js file is loaded before the inline scripts, in which case + //we'll listen for the inline scripts to execute a custom event. + document.addEventListener("umbracoFormLoaded", init); + } + else { + initCollection(umbracoFormsCollection); + } + } + + function initCollection(formsCollection) { + configureUmbracoFormsValidation(); + + for (var i = 0; i < formsCollection.length; i++) { + init({ form: formsCollection[i] }); + } + } + + function init(e) { + + var formItem = JSON.parse(decodeURI(e.form)); + + var forms = document.querySelectorAll('.umbraco-forms-form'); + + for( var i = 0; i < forms.length; i++) { + var form = forms[i]; + + dependencyCheck(form); + + var page = form.querySelector('.umbraco-forms-page'); + var conditions = new UmbracoFormsConditions(page, + formItem.fieldSetConditions, + formItem.fieldConditions, + formItem.recordValues); + conditions.watch(); + }; + } + + /** Configures the jquery validation for Umbraco forms */ + function configureUmbracoFormsValidation() { + + if (window.aspnetValidation !== undefined) { + // Asp-net validation setup: + + var validationService = new aspnetValidation.ValidationService(); + + // TODO: equivilant to this: + /* + $.validator.setDefaults({ + ignore: ":hidden" + }); + */ + + function required(value, element, params) { + // Handle single and multiple checkboxes: + if(element.type.toLowerCase() === "checkbox" || element.type.toLowerCase() === "radio") { + var allCheckboxesOfThisName = element.form.querySelectorAll("input[name='"+element.name+"']"); + for (var i=0; i