-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.html5.fallback.min.js
1 lines (1 loc) · 7.72 KB
/
bootstrap.html5.fallback.min.js
1
!function(e){function t(e){function t(e){return"string"==typeof e?e:"number"==typeof e?""+e:JSON.stringify(e)}function a(e,a){return e=e.replace(/{[0-9a-zA-Z-_. ]+}/g,function(e){return e=e.replace(/^{([^}]*)}$/,"$1"),t(a[e])})}function r(e,t,r){return a(m.dates.calendars.gregorian.dateTimeFormats[e],[r,t])}var n,i,o,d,c,s,m,u,l;switch(u=mvcct.enhancer,s=u.Globalize(),l=s.locale().attributes.language,m=s.cldr.get("main/"+l),!0){case"skeleton"in e:o=e.skeleton,i=m.dates.calendars.gregorian.dateTimeFormats.availableFormats[o],i||(d=o.split(/[^hHKkmsSAzZOvVXx]/).slice(-1)[0],n=o.split(/[^GyYuUrQqMLlwWdDFgEec]/)[0],c=/(MMMM|LLLL).*[Ec]/.test(n)?"full":/MMMM/g.test(n)?"long":/MMM/g.test(n)||/LLL/g.test(n)?"medium":"short",i=r(c,m.dates.calendars.gregorian.dateTimeFormats.availableFormats[n],m.dates.calendars.gregorian.dateTimeFormats.availableFormats[d]));break;case"date"in e:case"time"in e:i=m.dates.calendars.gregorian["date"in e?"dateFormats":"timeFormats"][e.date||e.time];break;case"datetime"in e:i=r(e.datetime,m.dates.calendars.gregorian.dateFormats[e.datetime],m.dates.calendars.gregorian.timeFormats[e.datetime]);break;case"raw"in e:i=e.raw;break;default:i=null}return i}function a(t){var a=mvcct.enhancer,r=a.Globalize();t=t||r.locale().attributes.language;var n=t.length>2?t.substring(3):t.toUpperCase(),i=r.cldr.get("main/"+t),d=r.cldr.get("supplemental"),c=i.dates.calendars.gregorian.months.format,s=i.dates.calendars.gregorian.days.format,m=i.dates.calendars.gregorian.dayPeriods.format.abbreviated,u=r(t).messageFormatter,l={days:[s.wide.sun,s.wide.mon,s.wide.tue,s.wide.wed,s.wide.thu,s.wide.fri,s.wide.sat,s.wide.sun],daysShort:[s.abbreviated.sun,s.abbreviated.mon,s.abbreviated.tue,s.abbreviated.wed,s.abbreviated.thu,s.abbreviated.fri,s.abbreviated.sat,s.abbreviated.sun],daysMin:[s.narrow.sun,s.narrow.mon,s.narrow.tue,s.narrow.wed,s.narrow.thu,s.narrow.fri,s.narrow.sat,s.narrow.sun],months:[c.wide[1],c.wide[2],c.wide[3],c.wide[4],c.wide[5],c.wide[6],c.wide[7],c.wide[8],c.wide[9],c.wide[10],c.wide[11],c.wide[12]],monthsShort:[c.abbreviated[1],c.abbreviated[2],c.abbreviated[3],c.abbreviated[4],c.abbreviated[5],c.abbreviated[6],c.abbreviated[7],c.abbreviated[8],c.abbreviated[9],c.abbreviated[10],c.abbreviated[11],c.abbreviated[12]],meridiem:[m.am,m.pm],weekStart:o[d.weekData.firstDay[n]],today:i.dates.fields.day["relative-type-0"],rtl:"right-to-left"==i.layout.orientation.characterOrder,clear:u?u("generic/clear"):void 0};e.fn.datetimepicker.dates=e.fn.datetimepicker.dates||{},e.fn.datetimepicker.dates[t]=l}function r(e,t,a,r){var n=e.html5FallbackWidgets||{};n=n[t]||{},"function"==typeof n&&(n=n(a,r)||{});var i={};for(var o in n)i[o]=n[o];return i}function n(e){var t,a,r,n="";for(x=0;x<e.length;x++)c=e.charAt(x),a=x+1<e.length?e.charAt(x+1):null,r=x+2<e.length?e.charAt(x+2):null,nextNextNext=x+3<e.length?e.charAt(x+3):null,"m"==c?n+="i":"H"==c?n+="h":"h"==c?n+="H":"y"==c?n+=c!=t&&c!=a?"yy":c!=t&&c==a&&c==r&&c!=nextNextNext?"yy":c:"M"==c?c!=t&&c!=r?(n+="m",c==a&&(n+="m",x++)):c==t&&c==a&&(n+=c):n+="a"==c?"P":c,t=c;return n}function i(i){var o=mvcct.enhancer,c=o.Globalize(),s=c.locale().attributes.language,m=i.editFormats||{};for(var u in d)m[u]=void 0===m[u]?d[u]:m[u],m[u]=n(t(m[u]));var l=i.browserSupport=i.browserSupport||{};l.fallbackHtml5=!0;var v=l.fallbacks=l.fallbacks||{};v.number=v.number||{},v.number.type=2,v.range=v.range||{},v.range.type=3,v.color=v.color||{},v.color.type=3,v.date=v.date||{},v.date.type=2,v.time=v.time||{},v.time.type=2,v.datetime=v.datetime||{},v.datetime.type=2,v.week=v.week||{},v.week.type=2,v.month=v.month||{},v.month.type=2,a();var p=l.handlers=l.handlers||{},b=p.enhance=p.enhance||{};null!==b.date&&(b.date=function(t,a){var n=r(i,"date",t,a);n.zIndex||(n.zIndex=1e6),n.language=s,n.startView=2,"undefined"==typeof n.autoclose&&(n.autoclose=!0),n.minView=2,n.format=m.dateFormat,n.forceParse=0,n.startDate=o.parse("date",a.getAttribute("min"),!0),n.endDate=o.parse("date",a.getAttribute("max"),!0),e(t).datetimepicker(n).on("changeDate",function(){var a=document.createEvent("Event");a.initEvent("blur",!1,!0),t.dispatchEvent(a),e(t).blur()}).on("show",function(){e(t).datetimepicker("update",o.parse("date",t.value))})}),null!==b.week&&(b.week=function(t,a){var n=r(i,"week",t,a);n.zIndex||(n.zIndex=1e6),n.language=s,n.startView=2,"undefined"==typeof n.autoclose&&(n.autoclose=!0),n.minView=2,n.format=m.weekFormat,n.forceParse=0,n.startDate=o.parse("week",a.getAttribute("min"),!0),n.endDate=o.parse("week",a.getAttribute("max"),!0),e(t).datetimepicker(n).on("changeDate",function(){var a=document.createEvent("Event");a.initEvent("blur",!1,!0),t.dispatchEvent(a),e(t).blur()}).on("show",function(){e(t).datetimepicker("update",o.parse("week",t.value))})}),null!==b.month&&(b.month=function(t,a){var n=r(i,"month",t,a);n.zIndex||(n.zIndex=1e6),n.language=s,n.startView=3,"undefined"==typeof n.autoclose&&(n.autoclose=!0),n.minView=3,n.format=m.monthFormat,n.forceParse=0,n.startDate=o.parse("month",a.getAttribute("min"),!0),n.endDate=o.parse("month",a.getAttribute("max"),!0),e(t).datetimepicker(n).on("changeDate",function(){var a=document.createEvent("Event");a.initEvent("blur",!1,!0),t.dispatchEvent(a),e(t).blur()}).on("show",function(){e(t).datetimepicker("update",o.parse("month",t.value))})}),null!==b.time&&(b.time=function(t,a){var n=r(i,"time",t,a);n.zIndex||(n.zIndex=1e6),n.language=s,n.startView=n.maxView=1,"undefined"==typeof n.autoclose&&(n.autoclose=!0),n.minView=0,n.format=m.timeFormat,n.forceParse=0,n.startDate=o.parse("time",a.getAttribute("min"),!0),n.endDate=o.parse("time",a.getAttribute("max"),!0),e(t).datetimepicker(n).on("changeDate",function(){var a=document.createEvent("Event");a.initEvent("blur",!1,!0),t.dispatchEvent(a),e(t).blur()}).on("show",function(){e(t).datetimepicker("update",o.parse("time",t.value))})}),null!==b.datetime&&(b.datetime=function(t,a){var n=r(i,"datetime",t,a);n.zIndex||(n.zIndex=1e6),n.language=s,n.startView=2,"undefined"==typeof n.autoclose&&(n.autoclose=!0),n.format=m.datetimeFormat,n.forceParse=0,n.startDate=o.parse("datetime",a.getAttribute("min"),!0),n.endDate=o.parse("datetime",a.getAttribute("max"),!0),e(t).datetimepicker(n).on("changeDate",function(){var a=document.createEvent("Event");a.initEvent("blur",!1,!0),t.dispatchEvent(a),e(t).blur()}).on("show",function(){e(t).datetimepicker("update",o.parse("datetime",t.value))})});var g=e.fn.bootstrapSlider?"bootstrapSlider":"slider",f=mvcct.enhancer.Globalize().numberFormatter();null!==b.range&&(b.range=function(t,a){var n=r(i,"range",t,a);n.min=o.parse("range",a.getAttribute("min"),!0),n.max=o.parse("range",a.getAttribute("max"),!0),n.step=o.parse("range",a.getAttribute("step"),!0),n.formatter||(n.formatter=function(e){return f(e)}),n.value=o.parse("range",t.value),e(t)[g](n).on("slideStop",function(){var a=document.createEvent("Event");a.initEvent("_enhancer.dependency.main",!1,!0),t.dispatchEvent(a),e(t).blur()}),t.addEventListener("_enhancer.dependency.main",function(){setTimeout(function(){e(t)[g]("setValue",o.parse("range",t.value))},0)})}),null!==b.color&&(b.color=function(t,a){var n=r(i,"range",t,a);"undefined"==typeof n.format&&(n.format="hex");var o;if(n.makeComponent){var d=e(t);o=e('<div class="input-group colorpicker-component"><span class="input-group-addon"><i></i></span></div>').insertAfter(d),d.remove(),o.prepend(d)}else o=e(t);o.colorpicker(n).on("showPicker",function(){o.colorpicker("setValue",t.value)})})}var o={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},d={dateFormat:{date:"short"},timeFormat:{skeleton:"Hms"},timeFormat1:{skeleton:"Hms"},datetimeFormat:{datetime:"short"},datetimeFormat1:{datetime:"short"},monthFormat:{date:"short"},weekFormat:{date:"short"}},s=mvcct.enhancer.addBasicInput;mvcct.enhancer.addBasicInput=function(e){s(e),mvcct.enhancer.register(null,!1,null,"html5 bootstrap/widgets fallback",i,"html5-input")}}(jQuery);