diff --git a/plugins/fabrik_element/jdate/jdate-min.js b/plugins/fabrik_element/jdate/jdate-min.js index 339b1471478..abc39ccd95a 100644 --- a/plugins/fabrik_element/jdate/jdate-min.js +++ b/plugins/fabrik_element/jdate/jdate-min.js @@ -1,3 +1,3 @@ /*! Fabrik */ -define(["jquery","fab/element"],function(jQuery,FbElement){return window.FbJDateTime=new Class({Extends:FbElement,options:{dateTimeFormat:"",locale:"en-GB",allowedDates:[],allowedClasses:[],calendarSetup:{eventName:"click",ifFormat:"%Y/%m/%d",daFormat:"%Y/%m/%d",singleClick:!0,align:"Tl",range:[1900,2999],showsTime:!1,timeFormat:"24",electric:!0,step:2,cache:!1,showOthers:!1,advanced:!1}},initialize:function(t,e){if(this.setPlugin("fabrikdate"),!this.parent(t,e))return!1;Locale.use(this.options.locale),this.hour="0",this.minute="00",this.buttonBg="#ffffff",this.buttonBgSelected="#88dd33",this.startElement=t,this.setUpDone=!1,this.setUp()},setUp:function(){this.options.editable&&(this.watchButtons(),!1===this.options.typing?this.disableTyping():this.getDateField().addEvent("blur",function(t){var e,i=this.getDateField().value;""!==i?(e=this.options.advanced?Date.parseExact(i,Date.normalizeFormat(this.options.calendarSetup.ifFormat)):Date.parseDate(i,this.options.calendarSetup.ifFormat),this.update(e),Fabrik.fireEvent("fabrik.date.select",this),this.element.fireEvent("change",new Event.Mock(this.element,"change"))):this.options.value=""}.bind(this)),this.getDateField().onchange=function(){"clear"===jQuery(event.target).data("action")?this.update(""):this.calSelect()}.bind(this),Fabrik.addEvent("fabrik.form.submit.failed",function(t,e){this.afterAjaxValidation()}.bind(this)),Fabrik.addEvent("fabrik.form.page.change.end",function(t,e){this.afterAjaxValidation()}.bind(this)))},attachedToForm:function(){this.parent()},getCalendarImg:function(){return this.element.getElement(".calendarbutton")},getJCal:function(){return this.cal=JoomlaCalendar.getCalObject(this.getDateField())._joomlaCalendar,this.cal},onsubmit:function(t){var e=this.getValue();""!==e&&this.options.editable&&(this.getDateField().value=e),this.parent(t)},afterAjaxValidation:function(){this.update(this.getValue(),[])},_disabledShowCalTime:function(t,e){"null"!==typeOf(e)&&this.getJCal()&&this.cal.show()},disableTyping:function(){"null"!==typeOf(this.element)?(this.element.setProperty("readonly","readonly"),this.element.getElements(".fabrikinput").each(function(e){e.addEvent("focus",function(t){this._disabledShowCalTime(e,t)}.bind(this)),e.addEvent("click",function(t){this._disabledShowCalTime(e,t)}.bind(this))}.bind(this))):fconsole(element+": not date element container - is this a custom template with a missing $element->containerClass div/li surrounding the element?")},getValue:function(){var t;if(!this.options.editable)return this.options.value;if(this.getElement(),this.getJCal()){var e=this.getDateField().value;if(""===e)return"";var i=new RegExp("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}");if(null!==e.match(i))return e;t=this.cal.date}else{if(""===this.options.value||null===this.options.value||"0000-00-00 00:00:00"===this.options.value)return"";t=new Date.parse(this.options.value)}return t.format("db")},watchButtons:function(){JoomlaCalendar.getCalObject(this.getDateField())._joomlaCalendar||JoomlaCalendar.init(JoomlaCalendar.getCalObject(this.getDateField()))},addNewEventAux:function(action,js){"change"===action?Fabrik.addEvent("fabrik.date.select",function(w){if(w.baseElementId===this.baseElementId){var e="fabrik.date.select";"function"===typeOf(js)?js.delay(0,this,this):eval(js)}}.bind(this)):this.element.getElements("input").each(function(i){i.addEvent(action,function(e){"event"===typeOf(e)&&e.stop(),"function"===typeOf(js)?js.delay(0,this,this):eval(js)})}.bind(this))},update:function(t,e){if(e=e||["change"],this.getElement(),"invalid date"!==t){var i;if("string"===typeOf(t)){if(""===t)return this._getSubElements().each(function(t){t.value=""}),this.cal&&(this.cal.date=new Date),void(this.options.editable||"null"!==typeOf(this.element)&&this.element.set("html",t));i=this.options.advanced?Date.parseExact(t,Date.normalizeFormat("%Y-%m-%d %H:%M:%S")):Date.parseDate(t,"%Y-%m-%d %H:%M")}else i=t;var a=this.options.calendarSetup.ifFormat;if(0containerClass div/li surrounding the element?")},getValue:function(){var t;if(!this.options.editable)return this.options.value;if(this.getElement(),this.getJCal()){var e=this.getDateField().value;if(""===e)return"";var i=new RegExp("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}");if(null!==e.match(i))return e;t=this.cal.date}else{if(""===this.options.value||null===this.options.value||"0000-00-00 00:00:00"===this.options.value)return"";t=new Date.parse(this.options.value)}return t.format("db")},watchButtons:function(){JoomlaCalendar.getCalObject(this.getDateField())._joomlaCalendar||JoomlaCalendar.init(JoomlaCalendar.getCalObject(this.getDateField()))},addNewEventAux:function(action,js){"change"===action?Fabrik.addEvent("fabrik.date.select",function(w){if(w.baseElementId===this.baseElementId){var e="fabrik.date.select";"function"===typeOf(js)?js.delay(0,this,this):eval(js)}}.bind(this)):this.element.getElements("input").each(function(i){i.addEvent(action,function(e){"event"===typeOf(e)&&e.stop(),"function"===typeOf(js)?js.delay(0,this,this):eval(js)})}.bind(this))},update:function(t,e){if(e=e||["change"],this.getElement(),"invalid date"!==t){var i;if("string"===typeOf(t)){if(""===t)return this._getSubElements().each(function(t){t.value=""}),this.cal&&(this.cal.date=new Date),void(this.options.editable||"null"!==typeOf(this.element)&&this.element.set("html",t));i=this.options.advanced?Date.parseExact(t,Date.normalizeFormat("%Y-%m-%d %H:%M:%S")):Date.parseDate(t,"%Y-%m-%d %H:%M")}else i=t;var a=this.options.calendarSetup.ifFormat;if(0