/*! * jQuery Cookie Plugin v1.3.1 * https://github.com/carhartl/jquery-cookie * * Copyright 2013 Klaus Hartl * Released under the MIT license */ (function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else{factory(jQuery);}}(function($){var pluses=/\+/g;function raw(s){return s;} function decoded(s){return decodeURIComponent(s.replace(pluses,' '));} function converted(s){if(s.indexOf('"')===0){s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,'\\');} try{return config.json?JSON.parse(s):s;}catch(er){}} var config=$.cookie=function(key,value,options){if(value!==undefined){options=$.extend({},config.defaults,options);if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days);} value=config.json?JSON.stringify(value):String(value);return(document.cookie=[config.raw?key:encodeURIComponent(key),'=',config.raw?value:encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));} var decode=config.raw?raw:decoded;var cookies=document.cookie.split('; ');var result=key?undefined:{};for(var i=0,l=cookies.length;i=112&&k<=123;}};$document=$(document);nextUid=(function(){var counter=1;return function(){return counter++;};}());function indexOf(value,array){var i=0,l=array.length,v;if(typeof value==="undefined"){return-1;} if(value.constructor===String){for(;i=0)notify(e);});} function killEvent(event){event.preventDefault();event.stopPropagation();} function killEventImmediately(event){event.preventDefault();event.stopImmediatePropagation();} function measureTextWidth(e){if(!sizer){var style=e[0].currentStyle||window.getComputedStyle(e[0],null);sizer=$("
").css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:style.fontSize,fontFamily:style.fontFamily,fontStyle:style.fontStyle,fontWeight:style.fontWeight,letterSpacing:style.letterSpacing,textTransform:style.textTransform,whiteSpace:"nowrap"});$("body").append(sizer);} sizer.text(e.val());return sizer.width();} function markMatch(text,term,markup){var match=text.toUpperCase().indexOf(term.toUpperCase()),tl=term.length;if(match<0){markup.push(text);return;} markup.push(text.substring(0,match));markup.push("");markup.push(text.substring(match,match+tl));markup.push("");markup.push(text.substring(match+tl,text.length));} function ajax(options){var timeout,requestSequence=0,handler=null,quietMillis=options.quietMillis||100;return function(query){window.clearTimeout(timeout);timeout=window.setTimeout(function(){requestSequence+=1;var requestNumber=requestSequence,data=options.data,transport=options.transport||$.ajax,traditional=options.traditional||false,type=options.type||'GET';data=data.call(this,query.term,query.page,query.context);if(null!==handler){handler.abort();} handler=transport.call(null,{url:options.url,dataType:options.dataType,data:data,type:type,traditional:traditional,success:function(data){if(requestNumber=0)break;} if(index<0)break;token=input.substring(0,index);input=input.substring(index+separator.length);if(token.length>0){token=opts.createSearchChoice(token,selection);if(token!==undefined&&token!==null&&opts.id(token)!==undefined&&opts.id(token)!==null){dupe=false;for(i=0,l=selection.length;i0){target=$("#"+attr);target=target.data("select2");if(target!==undefined){target.focus();e.preventDefault();}}});});function clazz(SuperClass,methods){var constructor=function(){};constructor.prototype=new SuperClass;constructor.prototype.constructor=constructor;constructor.prototype.parent=SuperClass.prototype;constructor.prototype=$.extend(constructor.prototype,methods);return constructor;} AbstractSelect2=clazz(Object,{bind:function(func){var self=this;return function(){func.apply(self,arguments);};},init:function(opts){var results,search,resultsSelector=".select2-results";this.opts=opts=this.prepareOpts(opts);this.id=opts.id;if(opts.element.data("select2")!==undefined&&opts.element.data("select2")!==null){this.destroy();} this.enabled=true;this.container=this.createContainer();this.containerId="s2id_"+(opts.element.attr("id")||"autogen"+nextUid());this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,'\\$1');this.container.attr("id",this.containerId);this.body=thunk(function(){return opts.element.closest("body");});if(opts.element.attr("class")!==undefined){this.container.addClass(opts.element.attr("class").replace(/validate\[[\S ]+] ?/,''));} this.container.css(evaluate(opts.containerCss));this.container.addClass(evaluate(opts.containerCssClass));this.opts.element.data("select2",this).hide().before(this.container);this.container.data("select2",this);this.dropdown=this.container.find(".select2-drop");this.dropdown.addClass(evaluate(opts.dropdownCssClass));this.dropdown.data("select2",this);this.results=results=this.container.find(resultsSelector);this.search=search=this.container.find("input.select2-input");search.attr("tabIndex",this.opts.element.attr("tabIndex"));this.resultsPage=0;this.context=null;this.initContainer();this.initContainerWidth();installFilteredMouseMove(this.results);this.dropdown.delegate(resultsSelector,"mousemove-filtered",this.bind(this.highlightUnderEvent));installDebouncedScroll(80,this.results);this.dropdown.delegate(resultsSelector,"scroll-debounced",this.bind(this.loadMoreIfNeeded));if($.fn.mousewheel){results.mousewheel(function(e,delta,deltaX,deltaY){var top=results.scrollTop(),height;if(deltaY>0&&top-deltaY<=0){results.scrollTop(0);killEvent(e);}else if(deltaY<0&&results.get(0).scrollHeight-results.scrollTop()+deltaY<=results.height()){results.scrollTop(results.get(0).scrollHeight-results.height());killEvent(e);}});} installKeyUpChangeEvent(search);search.bind("keyup-change",this.bind(this.updateResults));search.bind("focus",function(){search.addClass("select2-focused");if(search.val()===" ")search.val("");});search.bind("blur",function(){search.removeClass("select2-focused");});this.dropdown.delegate(resultsSelector,"mouseup",this.bind(function(e){if($(e.target).closest(".select2-result-selectable:not(.select2-disabled)").length>0){this.highlightUnderEvent(e);this.selectHighlighted(e);}else{this.focusSearch();} killEvent(e);}));this.dropdown.bind("click mouseup mousedown",function(e){e.stopPropagation();});if($.isFunction(this.opts.initSelection)){this.initSelection();this.monitorSource();} if(opts.element.is(":disabled")||opts.element.is("[readonly='readonly']"))this.disable();},destroy:function(){var select2=this.opts.element.data("select2");if(select2!==undefined){select2.container.remove();select2.dropdown.remove();select2.opts.element.removeData("select2").unbind(".select2").show();}},prepareOpts:function(opts){var element,select,idKey,ajaxUrl;element=opts.element;if(element.get(0).tagName.toLowerCase()==="select"){this.select=select=opts.element;} if(select){$.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in opts){throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a "," ","
    ","
",""].join(""));return container;},opening:function(){this.search.show();this.parent.opening.apply(this,arguments);this.dropdown.removeClass("select2-offscreen");},close:function(){if(!this.opened())return;this.parent.close.apply(this,arguments);this.dropdown.removeAttr("style").addClass("select2-offscreen").insertAfter(this.selection).show();},focus:function(){this.close();this.selection.focus();},isFocused:function(){return this.selection[0]===document.activeElement;},cancel:function(){this.parent.cancel.apply(this,arguments);this.selection.focus();},initContainer:function(){var selection,container=this.container,dropdown=this.dropdown,clickingInside=false;this.selection=selection=container.find(".select2-choice");this.search.bind("keydown",this.bind(function(e){if(!this.enabled)return;if(e.which===KEY.PAGE_UP||e.which===KEY.PAGE_DOWN){killEvent(e);return;} if(this.opened()){switch(e.which){case KEY.UP:case KEY.DOWN:this.moveHighlight((e.which===KEY.UP)?-1:1);killEvent(e);return;case KEY.TAB:case KEY.ENTER:this.selectHighlighted();killEvent(e);return;case KEY.ESC:this.cancel(e);killEvent(e);return;}}else{if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC){return;} if(this.opts.openOnEnter===false&&e.which===KEY.ENTER){return;} this.open();if(e.which===KEY.ENTER){return;}}}));this.search.bind("focus",this.bind(function(){this.selection.attr("tabIndex","-1");}));this.search.bind("blur",this.bind(function(){if(!this.opened())this.container.removeClass("select2-container-active");window.setTimeout(this.bind(function(){this.selection.attr("tabIndex",this.opts.element.attr("tabIndex"));}),10);}));selection.delegate("abbr","mousedown",this.bind(function(e){if(!this.enabled)return;this.clear();killEventImmediately(e);this.close();this.triggerChange();this.selection.focus();}));selection.bind("mousedown",this.bind(function(e){clickingInside=true;if(this.opened()){this.close();this.selection.focus();}else if(this.enabled){this.open();} clickingInside=false;}));dropdown.bind("mousedown",this.bind(function(){this.search.focus();}));selection.bind("focus",this.bind(function(){if(this.container.hasClass("select2-container-disabled"))return false;this.container.addClass("select2-container-active");this.search.attr("tabIndex","-1");}));selection.bind("blur",this.bind(function(){if(!this.opened()){this.container.removeClass("select2-container-active");} window.setTimeout(this.bind(function(){this.search.attr("tabIndex",this.opts.element.attr("tabIndex"));}),10);}));selection.bind("keydown",this.bind(function(e){if(!this.enabled)return;if(e.which==KEY.DOWN||e.which==KEY.UP||(e.which==KEY.ENTER&&this.opts.openOnEnter)){this.open();killEvent(e);return;} if(e.which==KEY.DELETE||e.which==KEY.BACKSPACE){if(this.opts.allowClear){this.clear();} killEvent(e);return;}}));selection.bind("keypress",this.bind(function(e){var key=String.fromCharCode(e.which);this.search.val(key);this.open();}));this.setPlaceholder();this.search.bind("focus",this.bind(function(){this.container.addClass("select2-container-active");}));},clear:function(){this.opts.element.val("");this.selection.find("span").empty();this.selection.removeData("select2-data");this.setPlaceholder();},initSelection:function(){var selected;if(this.opts.element.val()===""){this.close();this.setPlaceholder();}else{var self=this;this.opts.initSelection.call(null,this.opts.element,function(selected){if(selected!==undefined&&selected!==null){self.updateSelection(selected);self.close();self.setPlaceholder();}});}},prepareOpts:function(){var opts=this.parent.prepareOpts.apply(this,arguments);if(opts.element.get(0).tagName.toLowerCase()==="select"){opts.initSelection=function(element,callback){var selected=element.find(":selected");if($.isFunction(callback)) callback({id:selected.attr("value"),text:selected.text()});};} return opts;},setPlaceholder:function(){var placeholder=this.getPlaceholder();if(this.opts.element.val()===""&&placeholder!==undefined){if(this.select&&this.select.find("option:first").text()!=="")return;this.selection.find("span").html(this.opts.escapeMarkup(placeholder));this.selection.addClass("select2-default");this.selection.find("abbr").hide();}},postprocessResults:function(data,initial){var selected=0,self=this,showSearchInput=true;this.results.find(".select2-result-selectable").each2(function(i,elm){if(equal(self.id(elm.data("select2-data")),self.opts.element.val())){selected=i;return false;}});this.highlight(selected);if(initial===true){showSearchInput=this.showSearchInput=countResults(data.results)>=this.opts.minimumResultsForSearch;this.dropdown.find(".select2-search")[showSearchInput?"removeClass":"addClass"]("select2-search-hidden");$(this.dropdown,this.container)[showSearchInput?"addClass":"removeClass"]("select2-with-searchbox");}},onSelect:function(data){var old=this.opts.element.val();this.opts.element.val(this.id(data));this.updateSelection(data);this.close();this.selection.focus();if(!equal(old,this.id(data))){this.triggerChange();}},updateSelection:function(data){var container=this.selection.find("span"),formatted;this.selection.data("select2-data",data);container.empty();formatted=this.opts.formatSelection(data,container);if(formatted!==undefined){container.append(this.opts.escapeMarkup(formatted));} this.selection.removeClass("select2-default");if(this.opts.allowClear&&this.getPlaceholder()!==undefined){this.selection.find("abbr").show();}},val:function(){var val,data=null,self=this;if(arguments.length===0){return this.opts.element.val();} val=arguments[0];if(this.select){this.select.val(val).find(":selected").each2(function(i,elm){data={id:elm.attr("value"),text:elm.text()};return false;});this.updateSelection(data);this.setPlaceholder();}else{if(this.opts.initSelection===undefined){throw new Error("cannot call val() if initSelection() is not defined");} if(!val){this.clear();return;} this.opts.element.val(val);this.opts.initSelection(this.opts.element,function(data){self.opts.element.val(!data?"":self.id(data));self.updateSelection(data);self.setPlaceholder();});}},clearSearch:function(){this.search.val("");},data:function(value){var data;if(arguments.length===0){data=this.selection.data("select2-data");if(data==undefined)data=null;return data;}else{if(!value||value===""){this.clear();}else{this.opts.element.val(!value?"":this.id(value));this.updateSelection(value);}}}});MultiSelect2=clazz(AbstractSelect2,{createContainer:function(){var container=$("
",{"class":"select2-container select2-container-multi"}).html(["
    ","
  • "," ","
  • ","
",""].join(""));return container;},prepareOpts:function(){var opts=this.parent.prepareOpts.apply(this,arguments);if(opts.element.get(0).tagName.toLowerCase()==="select"){opts.initSelection=function(element,callback){var data=[];element.find(":selected").each2(function(i,elm){data.push({id:elm.attr("value"),text:elm.text()});});if($.isFunction(callback)) callback(data);};} return opts;},initContainer:function(){var selector=".select2-choices",selection;this.searchContainer=this.container.find(".select2-search-field");this.selection=selection=this.container.find(selector);this.search.bind("keydown",this.bind(function(e){if(!this.enabled)return;if(e.which===KEY.BACKSPACE&&this.search.val()===""){this.close();var choices,selected=selection.find(".select2-search-choice-focus");if(selected.length>0){this.unselect(selected.first());this.search.width(10);killEvent(e);return;} choices=selection.find(".select2-search-choice");if(choices.length>0){choices.last().addClass("select2-search-choice-focus");}}else{selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");} if(this.opened()){switch(e.which){case KEY.UP:case KEY.DOWN:this.moveHighlight((e.which===KEY.UP)?-1:1);killEvent(e);return;case KEY.ENTER:case KEY.TAB:this.selectHighlighted();killEvent(e);return;case KEY.ESC:this.cancel(e);killEvent(e);return;}} if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.BACKSPACE||e.which===KEY.ESC){return;} if(this.opts.openOnEnter===false&&e.which===KEY.ENTER){return;} this.open();if(e.which===KEY.PAGE_UP||e.which===KEY.PAGE_DOWN){killEvent(e);}}));this.search.bind("keyup",this.bind(this.resizeSearch));this.search.bind("blur",this.bind(function(e){this.container.removeClass("select2-container-active");this.search.removeClass("select2-focused");this.clearSearch();e.stopImmediatePropagation();}));this.container.delegate(selector,"mousedown",this.bind(function(e){if(!this.enabled)return;if($(e.target).closest(".select2-search-choice").length>0){return;} this.clearPlaceholder();this.open();this.focusSearch();e.preventDefault();}));this.container.delegate(selector,"focus",this.bind(function(){if(!this.enabled)return;this.container.addClass("select2-container-active");this.dropdown.addClass("select2-drop-active");this.clearPlaceholder();}));this.clearSearch();},enable:function(){if(this.enabled)return;this.parent.enable.apply(this,arguments);this.search.removeAttr("disabled");},disable:function(){if(!this.enabled)return;this.parent.disable.apply(this,arguments);this.search.attr("disabled",true);},initSelection:function(){var data;if(this.opts.element.val()===""){this.updateSelection([]);this.close();this.clearSearch();} if(this.select||this.opts.element.val()!==""){var self=this;this.opts.initSelection.call(null,this.opts.element,function(data){if(data!==undefined&&data!==null){self.updateSelection(data);self.close();self.clearSearch();}});}},clearSearch:function(){var placeholder=this.getPlaceholder();if(placeholder!==undefined&&this.getVal().length===0&&this.search.hasClass("select2-focused")===false){this.search.val(placeholder).addClass("select2-default");this.resizeSearch();}else{this.search.val(" ").width(10);}},clearPlaceholder:function(){if(this.search.hasClass("select2-default")){this.search.val("").removeClass("select2-default");}else{if(this.search.val()===" ")this.search.val("");}},opening:function(){this.parent.opening.apply(this,arguments);this.clearPlaceholder();this.resizeSearch();this.focusSearch();},close:function(){if(!this.opened())return;this.parent.close.apply(this,arguments);},focus:function(){this.close();this.search.focus();},isFocused:function(){return this.search.hasClass("select2-focused");},updateSelection:function(data){var ids=[],filtered=[],self=this;$(data).each(function(){if(indexOf(self.id(this),ids)<0){ids.push(self.id(this));filtered.push(this);}});data=filtered;this.selection.find(".select2-search-choice").remove();$(data).each(function(){self.addSelectedChoice(this);});self.postprocessResults();},tokenize:function(){var input=this.search.val();input=this.opts.tokenizer(input,this.data(),this.bind(this.onSelect),this.opts);if(input!=null&&input!=undefined){this.search.val(input);if(input.length>0){this.open();}}},add:function(data){if(data instanceof Array){for(var i=0;i0){this.search.width(10);this.resizeSearch();this.positionDropdown();}else{this.close();}} this.triggerChange({added:data});this.focusSearch();},cancel:function(){this.close();this.focusSearch();},addSelectedChoice:function(data){data.disabled=data.disabled||false;var choice=$("
  • "+"
    "+ (data.disabled?"":" ")+"
  • "),id=this.id(data),val=this.getVal(),formatted;formatted=this.opts.formatSelection(data,choice);choice.find("div").replaceWith("
    "+this.opts.escapeMarkup(formatted)+"
    ");if(!data.disabled){choice.find(".select2-search-choice-close").bind("mousedown",killEvent).bind("click dblclick",this.bind(function(e){if(!this.enabled)return;$(e.target).closest(".select2-search-choice").fadeOut('fast',this.bind(function(){this.unselect($(e.target));this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");this.close();this.focusSearch();})).dequeue();killEvent(e);})).bind("focus",this.bind(function(){if(!this.enabled)return;this.container.addClass("select2-container-active");this.dropdown.addClass("select2-drop-active");}));} choice.data("select2-data",data);choice.insertBefore(this.searchContainer);val.push(id);this.setVal(val);},unselect:function(selected){var val=this.getVal(),data,index;selected=selected.closest(".select2-search-choice");if(selected.length===0){throw"Invalid argument: "+selected+". Must be .select2-search-choice";} data=selected.data("select2-data");index=indexOf(this.id(data),val);if(index>=0){val.splice(index,1);this.setVal(val);if(this.select)this.postprocessResults();} selected.remove();this.triggerChange({removed:data});},postprocessResults:function(){var val=this.getVal(),choices=this.results.find(".select2-result-selectable"),compound=this.results.find(".select2-result-with-children"),self=this;choices.each2(function(i,choice){var id=self.id(choice.data("select2-data"));if(indexOf(id,val)>=0){choice.addClass("select2-disabled").removeClass("select2-result-selectable");}else{choice.removeClass("select2-disabled").addClass("select2-result-selectable");}});compound.each2(function(i,e){if(e.find(".select2-result-selectable").length==0){e.addClass("select2-disabled");}else{e.removeClass("select2-disabled");}});choices.each2(function(i,choice){if(!choice.hasClass("select2-disabled")&&choice.hasClass("select2-result-selectable")){self.highlight(0);return false;}});},resizeSearch:function(){var minimumWidth,left,maxWidth,containerLeft,searchWidth,sideBorderPadding=getSideBorderPadding(this.search);minimumWidth=measureTextWidth(this.search)+10;left=this.search.offset().left;maxWidth=this.selection.width();containerLeft=this.selection.offset().left;searchWidth=maxWidth-(left-containerLeft)-sideBorderPadding;if(searchWidth. Attach to instead.");} this.search.width(0);this.searchContainer.hide();},onSortEnd:function(){var val=[],self=this;this.searchContainer.show();this.searchContainer.appendTo(this.searchContainer.parent());this.resizeSearch();this.selection.find(".select2-search-choice").each(function(){val.push(self.opts.id($(this).data("select2-data")));});this.setVal(val);this.triggerChange();},data:function(values){var self=this,ids;if(arguments.length===0){return this.selection.find(".select2-search-choice").map(function(){return $(this).data("select2-data");}).get();}else{if(!values){values=[];} ids=$.map(values,function(e){return self.opts.id(e)});this.setVal(ids);this.updateSelection(values);this.clearSearch();}}});$.fn.select2=function(){var args=Array.prototype.slice.call(arguments,0),opts,select2,value,multiple,allowedMethods=["val","destroy","opened","open","close","focus","isFocused","container","onSortStart","onSortEnd","enable","disable","positionDropdown","data","add"];this.each(function(){if(args.length===0||typeof(args[0])==="object"){opts=args.length===0?{}:$.extend({},args[0]);opts.element=$(this);if(opts.element.get(0).tagName.toLowerCase()==="select"){multiple=opts.element.attr("multiple");}else{multiple=opts.multiple||false;if("tags"in opts){opts.multiple=multiple=true;}} select2=multiple?new MultiSelect2():new SingleSelect2();select2.init(opts);}else if(typeof(args[0])==="string"){if(indexOf(args[0],allowedMethods)<0){throw"Unknown method: "+args[0];} value=undefined;select2=$(this).data("select2");if(select2===undefined)return;if(args[0]==="container"){value=select2.container;}else{value=select2[args[0]].apply(select2,args.slice(1));} if(value!==undefined){return false;}}else{throw"Invalid arguments to select2 plugin: "+args;}});return(value===undefined)?this:value;};$.fn.select2.defaults={width:"copy",closeOnSelect:true,openOnEnter:true,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(result,container,query){var markup=[];markMatch(result.text,query.term,markup);return markup.join("");},formatSelection:function(data,container){return data?data.text:undefined;},formatResultCssClass:function(data){return undefined;},formatNoMatches:function(){return"No matches found";},formatInputTooShort:function(input,min){return"Please enter "+(min-input.length)+" more characters";},formatSelectionTooBig:function(limit){return"You can only select "+limit+" item"+(limit==1?"":"s");},formatLoadMore:function(pageNumber){return"Loading more results...";},formatSearching:function(){return"Searching...";},minimumResultsForSearch:0,minimumInputLength:0,maximumSelectionSize:0,id:function(e){return e.id;},matcher:function(term,text){return text.toUpperCase().indexOf(term.toUpperCase())>=0;},separator:",",tokenSeparators:[],tokenizer:defaultTokenizer,escapeMarkup:function(markup){if(markup&&typeof(markup)==="string"){return markup.replace(/&/g,"&");} return markup;},blurOnChange:false};window.Select2={query:{ajax:ajax,local:local,tags:tags},util:{debounce:debounce,markMatch:markMatch},"class":{"abstract":AbstractSelect2,"single":SingleSelect2,"multi":MultiSelect2}};}(jQuery));;(function($){var $window=$(window);function UTCDate(){return new Date(Date.UTC.apply(Date,arguments));} function UTCToday(){var today=new Date();return UTCDate(today.getUTCFullYear(),today.getUTCMonth(),today.getUTCDate());} var Datepicker=function(element,options){var that=this;this._process_options(options);this.element=$(element);this.isInline=false;this.isInput=this.element.is('input');this.component=this.element.is('.date')?this.element.find('.add-on, .btn'):false;this.hasInput=this.component&&this.element.find('input').length;if(this.component&&this.component.length===0) this.component=false;this.picker=$(DPGlobal.template);this._buildEvents();this._attachEvents();if(this.isInline){this.picker.addClass('datepicker-inline').appendTo(this.element);}else{this.picker.addClass('datepicker-dropdown dropdown-menu');} if(this.o.rtl){this.picker.addClass('datepicker-rtl');this.picker.find('.prev i, .next i').toggleClass('icon-arrow-left icon-arrow-right');} this.viewMode=this.o.startView;if(this.o.calendarWeeks) this.picker.find('tfoot th.today').attr('colspan',function(i,val){return parseInt(val)+1;});this._allow_update=false;this.setStartDate(this._o.startDate);this.setEndDate(this._o.endDate);this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);this.fillDow();this.fillMonths();this._allow_update=true;this.update();this.showMode();if(this.isInline){this.show();}};Datepicker.prototype={constructor:Datepicker,_process_options:function(opts){this._o=$.extend({},this._o,opts);var o=this.o=$.extend({},this._o);var lang=o.language;if(!dates[lang]){lang=lang.split('-')[0];if(!dates[lang]) lang=defaults.language;} o.language=lang;switch(o.startView){case 2:case'decade':o.startView=2;break;case 1:case'year':o.startView=1;break;default:o.startView=0;} switch(o.minViewMode){case 1:case'months':o.minViewMode=1;break;case 2:case'years':o.minViewMode=2;break;default:o.minViewMode=0;} o.startView=Math.max(o.startView,o.minViewMode);o.weekStart%=7;o.weekEnd=((o.weekStart+6)%7);var format=DPGlobal.parseFormat(o.format);if(o.startDate!==-Infinity){if(!!o.startDate){if(o.startDate instanceof Date) o.startDate=this._local_to_utc(this._zero_time(o.startDate));else o.startDate=DPGlobal.parseDate(o.startDate,format,o.language);}else{o.startDate=-Infinity;}} if(o.endDate!==Infinity){if(!!o.endDate){if(o.endDate instanceof Date) o.endDate=this._local_to_utc(this._zero_time(o.endDate));else o.endDate=DPGlobal.parseDate(o.endDate,format,o.language);}else{o.endDate=Infinity;}} o.daysOfWeekDisabled=o.daysOfWeekDisabled||[];if(!$.isArray(o.daysOfWeekDisabled)) o.daysOfWeekDisabled=o.daysOfWeekDisabled.split(/[,\s]*/);o.daysOfWeekDisabled=$.map(o.daysOfWeekDisabled,function(d){return parseInt(d,10);});var plc=String(o.orientation).toLowerCase().split(/\s+/g),_plc=o.orientation.toLowerCase();plc=$.grep(plc,function(word){return(/^auto|left|right|top|bottom$/).test(word);});o.orientation={x:'auto',y:'auto'};if(!_plc||_plc==='auto');else if(plc.length===1){switch(plc[0]){case'top':case'bottom':o.orientation.y=plc[0];break;case'left':case'right':o.orientation.x=plc[0];break;}} else{_plc=$.grep(plc,function(word){return(/^left|right$/).test(word);});o.orientation.x=_plc[0]||'auto';_plc=$.grep(plc,function(word){return(/^top|bottom$/).test(word);});o.orientation.y=_plc[0]||'auto';}},_events:[],_secondaryEvents:[],_applyEvents:function(evs){for(var i=0,el,ev;iwindowWidth) left=windowWidth-calendarWidth-visualPadding;} var yorient=this.o.orientation.y,top_overflow,bottom_overflow;if(yorient==='auto'){top_overflow=-scrollTop+offset.top-calendarHeight;bottom_overflow=scrollTop+windowHeight-(offset.top+height+calendarHeight);if(Math.max(top_overflow,bottom_overflow)===bottom_overflow) yorient='top';else yorient='bottom';} this.picker.addClass('datepicker-orient-'+yorient);if(yorient==='top') top+=height;else top-=calendarHeight+parseInt(this.picker.css('padding-top'));this.picker.css({top:top,left:left,zIndex:zIndex});},_allow_update:true,update:function(){if(!this._allow_update)return;var oldDate=new Date(this.date),date,fromArgs=false;if(arguments&&arguments.length&&(typeof arguments[0]==='string'||arguments[0]instanceof Date)){date=arguments[0];if(date instanceof Date) date=this._local_to_utc(date);fromArgs=true;}else{date=this.isInput?this.element.val():this.element.data('date')||this.element.find('input').val();delete this.element.data().date;} this.date=DPGlobal.parseDate(date,this.o.format,this.o.language);if(fromArgs){this.setValue();}else if(date){if(oldDate.getTime()!==this.date.getTime()) this._trigger('changeDate');}else{this._trigger('clearDate');} if(this.datethis.o.endDate){this.viewDate=new Date(this.o.endDate);this.date=new Date(this.o.endDate);}else{this.viewDate=new Date(this.date);this.date=new Date(this.date);} this.fill();},fillDow:function(){var dowCnt=this.o.weekStart,html='';if(this.o.calendarWeeks){var cell=' ';html+=cell;this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);} while(dowCnt'+dates[this.o.language].daysMin[(dowCnt++)%7]+'';} html+='';this.picker.find('.datepicker-days thead').append(html);},fillMonths:function(){var html='',i=0;while(i<12){html+=''+dates[this.o.language].monthsShort[i++]+'';} this.picker.find('.datepicker-months td').html(html);},setRange:function(range){if(!range||!range.length) delete this.range;else this.range=$.map(range,function(d){return d.valueOf();});this.fill();},getClassNames:function(date){var cls=[],year=this.viewDate.getUTCFullYear(),month=this.viewDate.getUTCMonth(),currentDate=this.date.valueOf(),today=new Date();if(date.getUTCFullYear()year||(date.getUTCFullYear()==year&&date.getUTCMonth()>month)){cls.push('new');} if(this.o.todayHighlight&&date.getUTCFullYear()==today.getFullYear()&&date.getUTCMonth()==today.getMonth()&&date.getUTCDate()==today.getDate()){cls.push('today');} if(currentDate&&date.valueOf()==currentDate){cls.push('active');} if(date.valueOf()this.o.endDate||$.inArray(date.getUTCDay(),this.o.daysOfWeekDisabled)!==-1){cls.push('disabled');} if(this.range){if(date>this.range[0]&&date');if(this.o.calendarWeeks){var ws=new Date(+prevMonth+(this.o.weekStart-prevMonth.getUTCDay()-7)%7*864e5),th=new Date(+ws+(7+4-ws.getUTCDay())%7*864e5),yth=new Date(+(yth=UTCDate(th.getUTCFullYear(),0,1))+(7+4-yth.getUTCDay())%7*864e5),calWeek=(th-yth)/864e5/7+1;html.push(''+calWeek+'');}} clsName=this.getClassNames(prevMonth);clsName.push('day');if(this.o.beforeShowDay!==$.noop){var before=this.o.beforeShowDay(this._utc_to_local(prevMonth));if(before===undefined) before={};else if(typeof(before)==='boolean') before={enabled:before};else if(typeof(before)==='string') before={classes:before};if(before.enabled===false) clsName.push('disabled');if(before.classes) clsName=clsName.concat(before.classes.split(/\s+/));if(before.tooltip) tooltip=before.tooltip;} clsName=$.unique(clsName);html.push(''+prevMonth.getUTCDate()+'');if(prevMonth.getUTCDay()==this.o.weekEnd){html.push('');} prevMonth.setUTCDate(prevMonth.getUTCDate()+1);} this.picker.find('.datepicker-days tbody').empty().append(html.join(''));var currentYear=this.date&&this.date.getUTCFullYear();var months=this.picker.find('.datepicker-months').find('th:eq(1)').text(year).end().find('span').removeClass('active');if(currentYear&¤tYear==year){months.eq(this.date.getUTCMonth()).addClass('active');} if(yearendYear){months.addClass('disabled');} if(year==startYear){months.slice(0,startMonth).addClass('disabled');} if(year==endYear){months.slice(endMonth+1).addClass('disabled');} html='';year=parseInt(year/10,10)*10;var yearCont=this.picker.find('.datepicker-years').find('th:eq(1)').text(year+'-'+(year+9)).end().find('td');year-=1;for(var i=-1;i<11;i++){html+=''+year+'';year+=1;} yearCont.html(html);},updateNavArrows:function(){if(!this._allow_update)return;var d=new Date(this.viewDate),year=d.getUTCFullYear(),month=d.getUTCMonth();switch(this.viewMode){case 0:if(this.o.startDate!==-Infinity&&year<=this.o.startDate.getUTCFullYear()&&month<=this.o.startDate.getUTCMonth()){this.picker.find('.prev').css({visibility:'hidden'});}else{this.picker.find('.prev').css({visibility:'visible'});} if(this.o.endDate!==Infinity&&year>=this.o.endDate.getUTCFullYear()&&month>=this.o.endDate.getUTCMonth()){this.picker.find('.next').css({visibility:'hidden'});}else{this.picker.find('.next').css({visibility:'visible'});} break;case 1:case 2:if(this.o.startDate!==-Infinity&&year<=this.o.startDate.getUTCFullYear()){this.picker.find('.prev').css({visibility:'hidden'});}else{this.picker.find('.prev').css({visibility:'visible'});} if(this.o.endDate!==Infinity&&year>=this.o.endDate.getUTCFullYear()){this.picker.find('.next').css({visibility:'hidden'});}else{this.picker.find('.next').css({visibility:'visible'});} break;}},click:function(e){e.preventDefault();var target=$(e.target).closest('span, td, th');if(target.length==1){switch(target[0].nodeName.toLowerCase()){case'th':switch(target[0].className){case'datepicker-switch':this.showMode(1);break;case'prev':case'next':var dir=DPGlobal.modes[this.viewMode].navStep*(target[0].className=='prev'?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,dir);this._trigger('changeMonth',this.viewDate);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,dir);if(this.viewMode===1) this._trigger('changeYear',this.viewDate);break;} this.fill();break;case'today':var date=new Date();date=UTCDate(date.getFullYear(),date.getMonth(),date.getDate(),0,0,0);this.showMode(-2);var which=this.o.todayBtn=='linked'?null:'view';this._setDate(date,which);break;case'clear':var element;if(this.isInput) element=this.element;else if(this.component) element=this.element.find('input');if(element) element.val("").change();this._trigger('changeDate');this.update();if(this.o.autoclose) this.hide();break;} break;case'span':if(!target.is('.disabled')){this.viewDate.setUTCDate(1);if(target.is('.month')){var day=1;var month=target.parent().find('span').index(target);var year=this.viewDate.getUTCFullYear();this.viewDate.setUTCMonth(month);this._trigger('changeMonth',this.viewDate);if(this.o.minViewMode===1){this._setDate(UTCDate(year,month,day,0,0,0,0));}}else{var year=parseInt(target.text(),10)||0;var day=1;var month=0;this.viewDate.setUTCFullYear(year);this._trigger('changeYear',this.viewDate);if(this.o.minViewMode===2){this._setDate(UTCDate(year,month,day,0,0,0,0));}} this.showMode(-1);this.fill();} break;case'td':if(target.is('.day')&&!target.is('.disabled')){var day=parseInt(target.text(),10)||1;var year=this.viewDate.getUTCFullYear(),month=this.viewDate.getUTCMonth();if(target.is('.old')){if(month===0){month=11;year-=1;}else{month-=1;}}else if(target.is('.new')){if(month==11){month=0;year+=1;}else{month+=1;}} this._setDate(UTCDate(year,month,day,0,0,0,0));} break;}}},_setDate:function(date,which){if(!which||which=='date') this.date=new Date(date);if(!which||which=='view') this.viewDate=new Date(date);this.fill();this.setValue();this._trigger('changeDate');var element;if(this.isInput){element=this.element;}else if(this.component){element=this.element.find('input');} if(element){element.change();} if(this.o.autoclose&&(!which||which=='date')){this.hide();}},moveMonth:function(date,dir){if(!dir)return date;var new_date=new Date(date.valueOf()),day=new_date.getUTCDate(),month=new_date.getUTCMonth(),mag=Math.abs(dir),new_month,test;dir=dir>0?1:-1;if(mag==1){test=dir==-1?function(){return new_date.getUTCMonth()==month;}:function(){return new_date.getUTCMonth()!=new_month;};new_month=month+dir;new_date.setUTCMonth(new_month);if(new_month<0||new_month>11) new_month=(new_month+12)%12;}else{for(var i=0;i=this.o.startDate&&date<=this.o.endDate;},keydown:function(e){if(this.picker.is(':not(:visible)')){if(e.keyCode==27) this.show();return;} var dateChanged=false,dir,day,month,newDate,newViewDate;switch(e.keyCode){case 27:this.hide();e.preventDefault();break;case 37:case 39:if(!this.o.keyboardNavigation)break;dir=e.keyCode==37?-1:1;if(e.ctrlKey){newDate=this.moveYear(this.date,dir);newViewDate=this.moveYear(this.viewDate,dir);this._trigger('changeYear',this.viewDate);}else if(e.shiftKey){newDate=this.moveMonth(this.date,dir);newViewDate=this.moveMonth(this.viewDate,dir);this._trigger('changeMonth',this.viewDate);}else{newDate=new Date(this.date);newDate.setUTCDate(this.date.getUTCDate()+dir);newViewDate=new Date(this.viewDate);newViewDate.setUTCDate(this.viewDate.getUTCDate()+dir);} if(this.dateWithinRange(newDate)){this.date=newDate;this.viewDate=newViewDate;this.setValue();this.update();e.preventDefault();dateChanged=true;} break;case 38:case 40:if(!this.o.keyboardNavigation)break;dir=e.keyCode==38?-1:1;if(e.ctrlKey){newDate=this.moveYear(this.date,dir);newViewDate=this.moveYear(this.viewDate,dir);this._trigger('changeYear',this.viewDate);}else if(e.shiftKey){newDate=this.moveMonth(this.date,dir);newViewDate=this.moveMonth(this.viewDate,dir);this._trigger('changeMonth',this.viewDate);}else{newDate=new Date(this.date);newDate.setUTCDate(this.date.getUTCDate()+dir*7);newViewDate=new Date(this.viewDate);newViewDate.setUTCDate(this.viewDate.getUTCDate()+dir*7);} if(this.dateWithinRange(newDate)){this.date=newDate;this.viewDate=newViewDate;this.setValue();this.update();e.preventDefault();dateChanged=true;} break;case 13:this.hide();e.preventDefault();break;case 9:this.hide();break;} if(dateChanged){this._trigger('changeDate');var element;if(this.isInput){element=this.element;}else if(this.component){element=this.element.find('input');} if(element){element.change();}}},showMode:function(dir){if(dir){this.viewMode=Math.max(this.o.minViewMode,Math.min(2,this.viewMode+dir));} this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).css('display','block');this.updateNavArrows();}};var DateRangePicker=function(element,options){this.element=$(element);this.inputs=$.map(options.inputs,function(i){return i.jquery?i[0]:i;});delete options.inputs;$(this.inputs).datepicker(options).bind('changeDate',$.proxy(this.dateUpdated,this));this.pickers=$.map(this.inputs,function(i){return $(i).data('datepicker');});this.updateDates();};DateRangePicker.prototype={updateDates:function(){this.dates=$.map(this.pickers,function(i){return i.date;});this.updateRanges();},updateRanges:function(){var range=$.map(this.dates,function(d){return d.valueOf();});$.each(this.pickers,function(i,p){p.setRange(range);});},dateUpdated:function(e){var dp=$(e.target).data('datepicker'),new_date=dp.getUTCDate(),i=$.inArray(e.target,this.inputs),l=this.inputs.length;if(i==-1)return;if(new_date=0&&new_datethis.dates[i]){while(ithis.dates[i]){this.pickers[i++].setUTCDate(new_date);}} this.updateDates();},remove:function(){$.map(this.pickers,function(p){p.remove();});delete this.element.data().datepicker;}};function opts_from_el(el,prefix){var data=$(el).data(),out={},inkey,replace=new RegExp('^'+prefix.toLowerCase()+'([A-Z])'),prefix=new RegExp('^'+prefix.toLowerCase());for(var key in data) if(prefix.test(key)){inkey=key.replace(replace,function(_,a){return a.toLowerCase();});out[inkey]=data[key];} return out;} function opts_from_locale(lang){var out={};if(!dates[lang]){lang=lang.split('-')[0] if(!dates[lang]) return;} var d=dates[lang];$.each(locale_opts,function(i,k){if(k in d) out[k]=d[k];});return out;} var old=$.fn.datepicker;$.fn.datepicker=function(option){var args=Array.apply(null,arguments);args.shift();var internal_return,this_return;this.each(function(){var $this=$(this),data=$this.data('datepicker'),options=typeof option=='object'&&option;if(!data){var elopts=opts_from_el(this,'date'),xopts=$.extend({},defaults,elopts,options),locopts=opts_from_locale(xopts.language),opts=$.extend({},defaults,locopts,elopts,options);if($this.is('.input-daterange')||opts.inputs){var ropts={inputs:opts.inputs||$this.find('input').toArray()};$this.data('datepicker',(data=new DateRangePicker(this,$.extend(opts,ropts))));} else{$this.data('datepicker',(data=new Datepicker(this,opts)));}} if(typeof option=='string'&&typeof data[option]=='function'){internal_return=data[option].apply(data,args);if(internal_return!==undefined) return false;}});if(internal_return!==undefined) return internal_return;else return this;};var defaults=$.fn.datepicker.defaults={autoclose:false,beforeShowDay:$.noop,calendarWeeks:false,clearBtn:false,daysOfWeekDisabled:[],endDate:Infinity,forceParse:true,format:'mm/dd/yyyy',keyboardNavigation:true,language:'en',minViewMode:0,orientation:"auto",rtl:false,startDate:-Infinity,startView:0,todayBtn:false,todayHighlight:false,weekStart:0};var locale_opts=$.fn.datepicker.locale_opts=['format','rtl','weekStart'];$.fn.datepicker.Constructor=Datepicker;var dates=$.fn.datepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear"}};var DPGlobal={modes:[{clsName:'days',navFnc:'Month',navStep:1},{clsName:'months',navFnc:'FullYear',navStep:1},{clsName:'years',navFnc:'FullYear',navStep:10}],isLeapYear:function(year){return(((year%4===0)&&(year%100!==0))||(year%400===0));},getDaysInMonth:function(year,month){return[31,(DPGlobal.isLeapYear(year)?29:28),31,30,31,30,31,31,30,31,30,31][month];},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(format){var separators=format.replace(this.validParts,'\0').split('\0'),parts=format.match(this.validParts);if(!separators||!separators.length||!parts||parts.length===0){throw new Error("Invalid date format.");} return{separators:separators,parts:parts};},parseDate:function(date,format,language){if(date instanceof Date)return date;if(typeof format==='string') format=DPGlobal.parseFormat(format);if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){var part_re=/([\-+]\d+)([dmwy])/,parts=date.match(/([\-+]\d+)([dmwy])/g),part,dir;date=new Date();for(var i=0;i'+''+'«'+''+'»'+''+'',contTemplate:'',footTemplate:''};DPGlobal.template='
    '+'
    '+''+ DPGlobal.headTemplate+''+ DPGlobal.footTemplate+'
    '+'
    '+'
    '+''+ DPGlobal.headTemplate+ DPGlobal.contTemplate+ DPGlobal.footTemplate+'
    '+'
    '+'
    '+''+ DPGlobal.headTemplate+ DPGlobal.contTemplate+ DPGlobal.footTemplate+'
    '+'
    '+'
    ';$.fn.datepicker.DPGlobal=DPGlobal;$.fn.datepicker.noConflict=function(){$.fn.datepicker=old;return this;};$(document).on('focus.datepicker.data-api click.datepicker.data-api','[data-provide="datepicker"]',function(e){var $this=$(this);if($this.data('datepicker'))return;e.preventDefault();$this.datepicker('show');});$(function(){$('[data-provide="datepicker-inline"]').datepicker();});}(window.jQuery));;!function($){"use strict";var Timepicker=function(element,options){this.$element=$(element);this.options=$.extend({},$.fn.timepicker.defaults,options,this.$element.data());this.minuteStep=this.options.minuteStep||this.minuteStep;this.secondStep=this.options.secondStep||this.secondStep;this.showMeridian=this.options.showMeridian||this.showMeridian;this.showSeconds=this.options.showSeconds||this.showSeconds;this.showInputs=this.options.showInputs||this.showInputs;this.disableFocus=this.options.disableFocus||this.disableFocus;this.template=this.options.template||this.template;this.modalBackdrop=this.options.modalBackdrop||this.modalBackdrop;this.defaultTime=this.options.defaultTime||this.defaultTime;this.open=false;this.init();};Timepicker.prototype={constructor:Timepicker,init:function(){if(this.$element.parent().hasClass('input-append')){this.$element.parent('.input-append').find('.add-on').on('click',$.proxy(this.showWidget,this));this.$element.on({focus:$.proxy(this.highlightUnit,this),click:$.proxy(this.highlightUnit,this),keypress:$.proxy(this.elementKeypress,this),blur:$.proxy(this.blurElement,this)});}else{if(this.template){this.$element.on({focus:$.proxy(this.showWidget,this),click:$.proxy(this.showWidget,this),blur:$.proxy(this.blurElement,this)});}else{this.$element.on({focus:$.proxy(this.highlightUnit,this),click:$.proxy(this.highlightUnit,this),keypress:$.proxy(this.elementKeypress,this),blur:$.proxy(this.blurElement,this)});}} this.$widget=$(this.getTemplate()).appendTo('body');this.$widget.on('click',$.proxy(this.widgetClick,this));if(this.showInputs){this.$widget.find('input').on({click:function(){this.select();},keypress:$.proxy(this.widgetKeypress,this),change:$.proxy(this.updateFromWidgetInputs,this)});} this.setDefaultTime(this.defaultTime);},showWidget:function(e){e.stopPropagation();e.preventDefault();if(this.open){return;} this.$element.trigger('show');if(this.disableFocus){this.$element.blur();} var pos=$.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});this.updateFromElementVal();$('html').trigger('click.timepicker.data-api').one('click.timepicker.data-api',$.proxy(this.hideWidget,this));if(this.template==='modal'){this.$widget.modal('show').on('hidden',$.proxy(this.hideWidget,this));}else{this.$widget.css({top:pos.top+pos.height,left:pos.left}) if(!this.open){this.$widget.addClass('open');}} this.open=true;this.$element.trigger('shown');},hideWidget:function(){this.$element.trigger('hide');if(this.template==='modal'){this.$widget.modal('hide');}else{this.$widget.removeClass('open');} this.open=false;this.$element.trigger('hidden');},widgetClick:function(e){e.stopPropagation();e.preventDefault();var action=$(e.target).closest('a').data('action');if(action){this[action]();this.update();}},widgetKeypress:function(e){var input=$(e.target).closest('input').attr('name');switch(e.keyCode){case 9:if(this.showMeridian){if(input=='meridian'){this.hideWidget();}}else{if(this.showSeconds){if(input=='second'){this.hideWidget();}}else{if(input=='minute'){this.hideWidget();}}} break;case 27:this.hideWidget();break;case 38:switch(input){case'hour':this.incrementHour();break;case'minute':this.incrementMinute();break;case'second':this.incrementSecond();break;case'meridian':this.toggleMeridian();break;} this.update();break;case 40:switch(input){case'hour':this.decrementHour();break;case'minute':this.decrementMinute();break;case'second':this.decrementSecond();break;case'meridian':this.toggleMeridian();break;} this.update();break;}},elementKeypress:function(e){var input=this.$element.get(0);switch(e.keyCode){case 0:break;case 9:this.updateFromElementVal();if(this.showMeridian){if(this.highlightedUnit!='meridian'){e.preventDefault();this.highlightNextUnit();}}else{if(this.showSeconds){if(this.highlightedUnit!='second'){e.preventDefault();this.highlightNextUnit();}}else{if(this.highlightedUnit!='minute'){e.preventDefault();this.highlightNextUnit();}}} break;case 27:this.updateFromElementVal();break;case 37:this.updateFromElementVal();this.highlightPrevUnit();break;case 38:switch(this.highlightedUnit){case'hour':this.incrementHour();break;case'minute':this.incrementMinute();break;case'second':this.incrementSecond();break;case'meridian':this.toggleMeridian();break;} this.updateElement();break;case 39:this.updateFromElementVal();this.highlightNextUnit();break;case 40:switch(this.highlightedUnit){case'hour':this.decrementHour();break;case'minute':this.decrementMinute();break;case'second':this.decrementSecond();break;case'meridian':this.toggleMeridian();break;} this.updateElement();break;} if(e.keyCode!==0&&e.keyCode!==8&&e.keyCode!==9&&e.keyCode!==46){e.preventDefault();}},setValues:function(time){if(this.showMeridian){var arr=time.split(' ');var timeArray=arr[0].split(':');this.meridian=arr[1];}else{var timeArray=time.split(':');} this.hour=parseInt(timeArray[0],10);this.minute=parseInt(timeArray[1],10);this.second=parseInt(timeArray[2],10);if(isNaN(this.hour)){this.hour=0;} if(isNaN(this.minute)){this.minute=0;} if(this.showMeridian){if(this.hour>12){this.hour=12;}else if(this.hour<1){this.hour=1;} if(this.meridian=='am'||this.meridian=='a'){this.meridian='AM';}else if(this.meridian=='pm'||this.meridian=='p'){this.meridian='PM';} if(this.meridian!='AM'&&this.meridian!='PM'){this.meridian='AM';}}else{if(this.hour>=24){this.hour=23;}else if(this.hour<0){this.hour=0;}} if(this.minute<0){this.minute=0;}else if(this.minute>=60){this.minute=59;} if(this.showSeconds){if(isNaN(this.second)){this.second=0;}else if(this.second<0){this.second=0;}else if(this.second>=60){this.second=59;}} this.updateElement();this.updateWidget();},setMeridian:function(meridian){if(meridian=='a'||meridian=='am'||meridian=='AM'){this.meridian='AM';}else if(meridian=='p'||meridian=='pm'||meridian=='PM'){this.meridian='PM';}else{this.updateWidget();} this.updateElement();},setDefaultTime:function(defaultTime){if(defaultTime){if(defaultTime==='current'){var dTime=new Date();var hours=dTime.getHours();var minutes=Math.floor(dTime.getMinutes()/this.minuteStep)*this.minuteStep;var seconds=Math.floor(dTime.getSeconds()/this.secondStep)*this.secondStep;var meridian="AM";if(this.showMeridian){if(hours===0){hours=12;}else if(hours>=12){if(hours>12){hours=hours-12;} meridian="PM";}else{meridian="AM";}} this.hour=hours;this.minute=minutes;this.second=seconds;this.meridian=meridian;}else if(defaultTime==='value'){this.setValues(this.$element.val());}else{this.setValues(defaultTime);} this.update();}else{this.hour=0;this.minute=0;this.second=0;}},formatTime:function(hour,minute,second,meridian){hour=hour<10?'0'+hour:hour;minute=minute<10?'0'+minute:minute;second=second<10?'0'+second:second;return hour+':'+minute+(this.showSeconds?':'+second:'')+(this.showMeridian?' '+meridian:'');},getTime:function(){return this.formatTime(this.hour,this.minute,this.second,this.meridian);},setTime:function(time){this.setValues(time);this.update();},update:function(){this.updateElement();this.updateWidget();},blurElement:function(){this.highlightedUnit=undefined;this.updateFromElementVal();},updateElement:function(){var time=this.getTime();this.$element.val(time).change();switch(this.highlightedUnit){case'hour':this.highlightHour();break;case'minute':this.highlightMinute();break;case'second':this.highlightSecond();break;case'meridian':this.highlightMeridian();break;}},updateWidget:function(){if(this.showInputs){this.$widget.find('input.bootstrap-timepicker-hour').val(this.hour<10?'0'+this.hour:this.hour);this.$widget.find('input.bootstrap-timepicker-minute').val(this.minute<10?'0'+this.minute:this.minute);if(this.showSeconds){this.$widget.find('input.bootstrap-timepicker-second').val(this.second<10?'0'+this.second:this.second);} if(this.showMeridian){this.$widget.find('input.bootstrap-timepicker-meridian').val(this.meridian);}}else{this.$widget.find('span.bootstrap-timepicker-hour').text(this.hour);this.$widget.find('span.bootstrap-timepicker-minute').text(this.minute<10?'0'+this.minute:this.minute);if(this.showSeconds){this.$widget.find('span.bootstrap-timepicker-second').text(this.second<10?'0'+this.second:this.second);} if(this.showMeridian){this.$widget.find('span.bootstrap-timepicker-meridian').text(this.meridian);}}},updateFromElementVal:function(e){var time=this.$element.val();if(time){this.setValues(time);this.updateWidget();}},updateFromWidgetInputs:function(){var time=$('input.bootstrap-timepicker-hour',this.$widget).val()+':'+ $('input.bootstrap-timepicker-minute',this.$widget).val()+ (this.showSeconds?':'+$('input.bootstrap-timepicker-second',this.$widget).val():'')+ (this.showMeridian?' '+$('input.bootstrap-timepicker-meridian',this.$widget).val():'');this.setValues(time);},getCursorPosition:function(){var input=this.$element.get(0);if('selectionStart'in input){return input.selectionStart;}else if(document.selection){input.focus();var sel=document.selection.createRange();var selLen=document.selection.createRange().text.length;sel.moveStart('character',-input.value.length);return sel.text.length-selLen;}},highlightUnit:function(){var input=this.$element.get(0);this.position=this.getCursorPosition();if(this.position>=0&&this.position<=2){this.highlightHour();}else if(this.position>=3&&this.position<=5){this.highlightMinute();}else if(this.position>=6&&this.position<=8){if(this.showSeconds){this.highlightSecond();}else{this.highlightMeridian();}}else if(this.position>=9&&this.position<=11){this.highlightMeridian();}},highlightNextUnit:function(){switch(this.highlightedUnit){case'hour':this.highlightMinute();break;case'minute':if(this.showSeconds){this.highlightSecond();}else{this.highlightMeridian();} break;case'second':this.highlightMeridian();break;case'meridian':this.highlightHour();break;}},highlightPrevUnit:function(){switch(this.highlightedUnit){case'hour':this.highlightMeridian();break;case'minute':this.highlightHour();break;case'second':this.highlightMinute();break;case'meridian':if(this.showSeconds){this.highlightSecond();}else{this.highlightMinute();} break;}},highlightHour:function(){this.highlightedUnit='hour';this.$element.get(0).setSelectionRange(0,2);},highlightMinute:function(){this.highlightedUnit='minute';this.$element.get(0).setSelectionRange(3,5);},highlightSecond:function(){this.highlightedUnit='second';this.$element.get(0).setSelectionRange(6,8);},highlightMeridian:function(){this.highlightedUnit='meridian';if(this.showSeconds){this.$element.get(0).setSelectionRange(9,11);}else{this.$element.get(0).setSelectionRange(6,8);}},incrementHour:function(){if(this.showMeridian){if(this.hour===11){this.toggleMeridian();}else if(this.hour===12){return this.hour=1;}} if(this.hour===23){return this.hour=0;} this.hour=this.hour+1;},decrementHour:function(){if(this.showMeridian){if(this.hour===1){return this.hour=12;} else if(this.hour===12){this.toggleMeridian();}} if(this.hour===0){return this.hour=23;} this.hour=this.hour-1;},incrementMinute:function(){var newVal=this.minute+this.minuteStep-(this.minute%this.minuteStep);if(newVal>59){this.incrementHour();this.minute=newVal-60;}else{this.minute=newVal;}},decrementMinute:function(){var newVal=this.minute-this.minuteStep;if(newVal<0){this.decrementHour();this.minute=newVal+60;}else{this.minute=newVal;}},incrementSecond:function(){var newVal=this.second+this.secondStep-(this.second%this.secondStep);if(newVal>59){this.incrementMinute();this.second=newVal-60;}else{this.second=newVal;}},decrementSecond:function(){var newVal=this.second-this.secondStep;if(newVal<0){this.decrementMinute();this.second=newVal+60;}else{this.second=newVal;}},toggleMeridian:function(){this.meridian=this.meridian==='AM'?'PM':'AM';this.update();},getTemplate:function(){if(this.options.templates[this.options.template]){return this.options.templates[this.options.template];} if(this.showInputs){var hourTemplate='';var minuteTemplate='';var secondTemplate='';var meridianTemplate='';}else{var hourTemplate='';var minuteTemplate='';var secondTemplate='';var meridianTemplate='';} var templateContent=''+''+''+''+''+ (this.showSeconds?''+'':'')+ (this.showMeridian?''+'':'')+''+''+' '+''+' '+ (this.showSeconds?''+'':'')+ (this.showMeridian?''+'':'')+''+''+''+''+''+ (this.showSeconds?''+'':'')+ (this.showMeridian?''+'':'')+''+'
       
    '+hourTemplate+':'+minuteTemplate+':'+secondTemplate+' '+meridianTemplate+'
      
    ';var template;switch(this.options.template){case'modal':template='';break;case'dropdown':template='';break;} return template;}};$.fn.timepicker=function(option){return this.each(function(){var $this=$(this),data=$this.data('timepicker'),options=typeof option=='object'&&option;if(!data){$this.data('timepicker',(data=new Timepicker(this,options)));} if(typeof option=='string'){data[option]();}})} $.fn.timepicker.defaults={minuteStep:15,secondStep:15,disableFocus:false,defaultTime:'current',showSeconds:false,showInputs:true,showMeridian:true,template:'dropdown',modalBackdrop:false,templates:{}} $.fn.timepicker.Constructor=Timepicker}(window.jQuery);;!function($){'use strict';var Validator=function(options){this.messages={defaultMessage:"This value seems to be invalid.",type:{email:"This value should be a valid email.",url:"This value should be a valid url.",urlstrict:"This value should be a valid url.",number:"This value should be a valid number.",digits:"This value should be digits.",dateIso:"This value should be a valid date (YYYY-MM-DD).",alphanum:"This value should be alphanumeric.",phone:"This value should be a valid phone number."},notnull:"This value should not be null.",notblank:"This value should not be blank.",required:"This value is required.",regexp:"This value seems to be invalid.",min:"This value should be greater than or equal to %s.",max:"This value should be lower than or equal to %s.",range:"This value should be between %s and %s.",minlength:"This value is too short. It should have %s characters or more.",maxlength:"This value is too long. It should have %s characters or less.",rangelength:"This value length is invalid. It should be between %s and %s characters long.",mincheck:"You must select at least %s choices.",maxcheck:"You must select %s choices or less.",rangecheck:"You must select between %s and %s choices.",equalto:"This value should be the same."},this.init(options);};Validator.prototype={constructor:Validator,validators:{notnull:function(val){return val.length>0;},notblank:function(val){return'string'===typeof val&&''!==val.replace(/^\s+/g,'').replace(/\s+$/g,'');},required:function(val){if('object'===typeof val){for(var i in val){if(this.required(val[i])){return true;}} return false;} return this.notnull(val)&&this.notblank(val);},type:function(val,type){var regExp;switch(type){case'number':regExp=/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/;break;case'digits':regExp=/^\d+$/;break;case'alphanum':regExp=/^\w+$/;break;case'email':regExp=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;break;case'url':val=new RegExp('(https?|s?ftp|git)','i').test(val)?val:'https://'+val;case'urlstrict':regExp=/^(https?|s?ftp|git):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;break;case'dateIso':regExp=/^(\d{4})\D?(0[1-9]|1[0-2])\D?([12]\d|0[1-9]|3[01])$/;break;case'phone':regExp=/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/;break;default:return false;} return''!==val?regExp.test(val):false;},regexp:function(val,regExp,self){return new RegExp(regExp,self.options.regexpFlag||'').test(val);},minlength:function(val,min){return val.length>=min;},maxlength:function(val,max){return val.length<=max;},rangelength:function(val,arrayRange){return this.minlength(val,arrayRange[0])&&this.maxlength(val,arrayRange[1]);},min:function(val,min){return Number(val)>=min;},max:function(val,max){return Number(val)<=max;},range:function(val,arrayRange){return val>=arrayRange[0]&&val<=arrayRange[1];},equalto:function(val,elem,self){self.options.validateIfUnchanged=true;return val===$(elem).val();},remote:function(val,url,self){var result=null,data={},dataType={};data[self.$element.attr('name')]=val;if('undefined'!==typeof self.options.remoteDatatype){dataType={dataType:self.options.remoteDatatype};} var manage=function(isConstraintValid,message){if('undefined'!==typeof message&&'undefined'!==typeof self.Validator.messages.remote&&message!==self.Validator.messages.remote){$(self.ulError+' .remote').remove();} self.updtConstraint({name:'remote',valid:isConstraintValid},message);self.manageValidationResult();};var handleResponse=function(response){if('object'===typeof response){return response;} try{response=$.parseJSON(response);}catch(err){} return response;} var manageErrorMessage=function(response){return'object'===typeof response&&null!==response?('undefined'!==typeof response.error?response.error:('undefined'!==typeof response.message?response.message:null)):null;} $.ajax($.extend({},{url:url,data:data,type:self.options.remoteMethod||'GET',success:function(response){response=handleResponse(response);manage(1===response||true===response||('object'===typeof response&&null!==response&&'undefined'!==typeof response.success),manageErrorMessage(response));},error:function(response){response=handleResponse(response);manage(false,manageErrorMessage(response));}},dataType));return result;},mincheck:function(obj,val){return this.minlength(obj,val);},maxcheck:function(obj,val){return this.maxlength(obj,val);},rangecheck:function(obj,arrayRange){return this.rangelength(obj,arrayRange);}},init:function(options){var customValidators=options.validators,customMessages=options.messages;var key;for(key in customValidators){this.addValidator(key,customValidators[key]);} for(key in customMessages){this.addMessage(key,customMessages[key]);}},formatMesssage:function(message,args){if('object'===typeof args){for(var i in args){message=this.formatMesssage(message,args[i]);} return message;} return'string'===typeof message?message.replace(new RegExp('%s','i'),args):'';},addValidator:function(name,fn){this.validators[name]=fn;},addMessage:function(key,message,type){if('undefined'!==typeof type&&true===type){this.messages.type[key]=message;return;} if('type'===key){for(var i in message){this.messages.type[i]=message[i];} return;} this.messages[key]=message;}};var ParsleyField=function(element,options,type){this.options=options;this.Validator=new Validator(options);if(type==='ParsleyFieldMultiple'){return this;} this.init(element,type||'ParsleyField');};ParsleyField.prototype={constructor:ParsleyField,init:function(element,type){this.type=type;this.valid=true;this.element=element;this.validatedOnce=false;this.$element=$(element);this.val=this.$element.val();this.isRequired=false;this.constraints={};if('undefined'===typeof this.isRadioOrCheckbox){this.isRadioOrCheckbox=false;this.hash=this.generateHash();this.errorClassHandler=this.options.errors.classHandler(element,this.isRadioOrCheckbox)||this.$element;} this.ulErrorManagement();this.bindHtml5Constraints();this.addConstraints();if(this.hasConstraints()){this.bindValidationEvents();}},setParent:function(elem){this.$parent=$(elem);},getParent:function(){return this.$parent;},bindHtml5Constraints:function(){if(this.$element.hasClass('required')||this.$element.prop('required')){this.options.required=true;} if('undefined'!==typeof this.$element.attr('type')&&new RegExp(this.$element.attr('type'),'i').test('email url number range')){this.options.type=this.$element.attr('type');if(new RegExp(this.options.type,'i').test('number range')){this.options.type='number';if('undefined'!==typeof this.$element.attr('min')&&this.$element.attr('min').length){this.options.min=this.$element.attr('min');} if('undefined'!==typeof this.$element.attr('max')&&this.$element.attr('max').length){this.options.max=this.$element.attr('max');}}} if('string'===typeof this.$element.attr('pattern')&&this.$element.attr('pattern').length){this.options.regexp=this.$element.attr('pattern');}},addConstraints:function(){for(var constraint in this.options){var addConstraint={};addConstraint[constraint]=this.options[constraint];this.addConstraint(addConstraint,true);}},addConstraint:function(constraint,doNotUpdateValidationEvents){for(var name in constraint){name=name.toLowerCase();if('function'===typeof this.Validator.validators[name]){this.constraints[name]={name:name,requirements:constraint[name],valid:null} if(name==='required'){this.isRequired=true;} this.addCustomConstraintMessage(name);}} if('undefined'===typeof doNotUpdateValidationEvents){this.bindValidationEvents();}},updateConstraint:function(constraint,message){for(var name in constraint){this.updtConstraint({name:name,requirements:constraint[name],valid:null},message);}},updtConstraint:function(constraint,message){this.constraints[constraint.name]=$.extend(true,this.constraints[constraint.name],constraint);if('string'===typeof message){this.Validator.messages[constraint.name]=message;} this.bindValidationEvents();},removeConstraint:function(constraintName){var constraintName=constraintName.toLowerCase();delete this.constraints[constraintName];if(constraintName==='required'){this.isRequired=false;} if(!this.hasConstraints()){if('ParsleyForm'===typeof this.getParent()){this.getParent().removeItem(this.$element);return;} this.destroy();return;} this.bindValidationEvents();},addCustomConstraintMessage:function(constraint){var customMessage=constraint +('type'===constraint&&'undefined'!==typeof this.options[constraint]?this.options[constraint].charAt(0).toUpperCase()+this.options[constraint].substr(1):'') +'Message';if('undefined'!==typeof this.options[customMessage]){this.Validator.addMessage('type'===constraint?this.options[constraint]:constraint,this.options[customMessage],'type'===constraint);}},bindValidationEvents:function(){this.valid=null;this.$element.addClass('parsley-validated');this.$element.off('.'+this.type);if(this.options.remote&&!new RegExp('change','i').test(this.options.trigger)){this.options.trigger=!this.options.trigger?'change':' change';} var triggers=(!this.options.trigger?'':this.options.trigger) +(new RegExp('key','i').test(this.options.trigger)?'':' keyup');if(this.$element.is('select')){triggers+=new RegExp('change','i').test(triggers)?'':' change';} triggers=triggers.replace(/^\s+/g,'').replace(/\s+$/g,'');this.$element.on((triggers+' ').split(' ').join('.'+this.type+' '),false,$.proxy(this.eventValidation,this));},generateHash:function(){return'parsley-'+(Math.random()+'').substring(2);},getHash:function(){return this.hash;},getVal:function(){return this.$element.data('value')||this.$element.val();},eventValidation:function(event){var val=this.getVal();if(event.type==='keyup'&&!/keyup/i.test(this.options.trigger)&&!this.validatedOnce){return true;} if(event.type==='change'&&!/change/i.test(this.options.trigger)&&!this.validatedOnce){return true;} if(!this.isRadioOrCheckbox&&val.length0){return;}else if(this.isRequired&&'required'!==constraint.name&&(null===this.getVal()||0===this.getVal().length)){return;} var constraintName=constraint.name,liClass=false!==this.options.errorMessage?'custom-error-message':constraintName,liError={},message=false!==this.options.errorMessage?this.options.errorMessage:(constraint.name==='type'?this.Validator.messages[constraintName][constraint.requirements]:('undefined'===typeof this.Validator.messages[constraintName]?this.Validator.messages.defaultMessage:this.Validator.formatMesssage(this.Validator.messages[constraintName],constraint.requirements)));if(!$(this.ulError+' .'+liClass).length){liError[liClass]=message;this.addError(liError);}},manageErrorContainer:function(){var errorContainer=this.options.errorContainer||this.options.errors.container(this.element,this.isRadioOrCheckbox),ulTemplate=this.options.animate?this.ulTemplate.show():this.ulTemplate;if('undefined'!==typeof errorContainer){$(errorContainer).append(ulTemplate);return;} if(this.$element.parent().find('label.sub_label').length>0){ulTemplate.addClass('for_sub_label');this.$element.parent().find('label.sub_label').after(ulTemplate);return;} if(this.$element.parent().hasClass('select2-container')){this.$element.parent().after(ulTemplate);}else{!this.isRadioOrCheckbox?this.$element.after(ulTemplate):this.$element.parent().after(ulTemplate);}},addListener:function(object){for(var listener in object){this.options.listeners[listener]=object[listener];}},destroy:function(){this.$element.removeClass('parsley-validated');this.reset().$element.off('.'+this.type).removeData(this.type);}};var ParsleyFieldMultiple=function(element,options,type){this.initMultiple(element,options);this.inherit(element,options);this.Validator=new Validator(options);this.init(element,type||'ParsleyFieldMultiple');};ParsleyFieldMultiple.prototype={constructor:ParsleyFieldMultiple,initMultiple:function(element,options){this.element=element;this.$element=$(element);this.group=options.group||false;this.hash=this.getName();this.siblings=this.group?'[data-group="'+this.group+'"]':'input[name="'+this.$element.attr('name')+'"]';this.isRadioOrCheckbox=true;this.isRadio=this.$element.is('input[type=radio]');this.isCheckbox=this.$element.is('input[type=checkbox]');this.errorClassHandler=options.errors.classHandler(element,this.isRadioOrCheckbox)||this.$element.parent();},inherit:function(element,options){var clone=new ParsleyField(element,options,'ParsleyFieldMultiple');for(var property in clone){if('undefined'===typeof this[property]){this[property]=clone[property];}}},getName:function(){if(this.group){return'parsley-'+this.group;} if('undefined'===typeof this.$element.attr('name')){throw"A radio / checkbox input must have a data-group attribute or a name to be Parsley validated !";} return'parsley-'+this.$element.attr('name').replace(/(:|\.|\[|\])/g,'');},getVal:function(){if(this.isRadio){return $(this.siblings+':checked').val()||'';} if(this.isCheckbox){var values=[];$(this.siblings+':checked').each(function(){values.push($(this).val());});return values;}},bindValidationEvents:function(){this.valid=null;this.$element.addClass('parsley-validated');this.$element.off('.'+this.type);var self=this,triggers=(!this.options.trigger?'':this.options.trigger) +(new RegExp('change','i').test(this.options.trigger)?'':' change');triggers=triggers.replace(/^\s+/g,'').replace(/\s+$/g,'');$(this.siblings).each(function(){$(this).on(triggers.split(' ').join('.'+self.type+' '),false,$.proxy(self.eventValidation,self));})}};var ParsleyForm=function(element,options,type){this.init(element,options,type||'parsleyForm');};ParsleyForm.prototype={constructor:ParsleyForm,init:function(element,options,type){this.type=type;this.items=[];this.$element=$(element);this.options=options;var self=this;this.$element.find(options.inputs).each(function(){self.addItem(this);});this.$element.on('submit.'+this.type,false,$.proxy(this.validate,this));},addListener:function(object){for(var listener in object){if(new RegExp('Field').test(listener)){for(var item=0;item',errorElem:'
  • '},listeners:{onFieldValidate:function(elem,ParsleyForm){return false;},onFormSubmit:function(isFormValid,event,ParsleyForm){},onFieldError:function(elem,constraints,ParsleyField){},onFieldSuccess:function(elem,constraints,ParsleyField){}}};$(window).on('load',function(){$('[data-validate="parsley"]').each(function(){$(this).parsley();});});}(window.jQuery||window.Zepto);;window.ParsleyConfig=window.ParsleyConfig||{};(function($){window.ParsleyConfig=$.extend(true,{},window.ParsleyConfig,{validators:{minwords:function(val,nbWords){val=val.replace(/(^\s*)|(\s*$)/gi,"");val=val.replace(/[ ]{2,}/gi," ");val=val.replace(/\n /,"\n");val=val.split(' ').length;return val>=nbWords;},maxwords:function(val,nbWords){val=val.replace(/(^\s*)|(\s*$)/gi,"");val=val.replace(/[ ]{2,}/gi," ");val=val.replace(/\n /,"\n");val=val.split(' ').length;return val<=nbWords;},rangewords:function(val,obj){val=val.replace(/(^\s*)|(\s*$)/gi,"");val=val.replace(/[ ]{2,}/gi," ");val=val.replace(/\n /,"\n");val=val.split(' ').length;return val>=obj[0]&&val<=obj[1];},greaterthan:function(val,elem,self){self.options.validateIfUnchanged=true;return new Number(val)>new Number($(elem).val());},lessthan:function(val,elem,self){self.options.validateIfUnchanged=true;return new Number(val)":">",'"':'"',"'":'''};function escapeHTML(string){return String(string).replace(/&(?!\w+;)|[<>"']/g,function(s){return escapeMap[s]||s;});} function debug(e,template,line,file){file=file||"