LocalCDN-Firefox-Chrome-Brave/resources/twix.js/0.3.0/twix.min.jsm

1 line
9.8 KiB
JavaScript
Raw Normal View History

2022-06-28 08:25:05 +02:00
(function(){var t,n,r,e=[].slice,a=[].indexOf||function(t){for(var n=0,r=this.length;r>n;n++)if(n in this&&this[n]===t)return n;return-1};t="undefined"!=typeof module&&null!==module&&null!=module.exports,n="function"==typeof define,r=function(n){var r,o;if(null==n)throw"Can't find moment";return o=["en"],r=function(){function r(t,r,e){this.start=n(t),this.end=n(r),this.allDay=e||!1}return r._extend=function(){var t,n,r,a,o,i;for(n=arguments[0],a=arguments.length>=2?e.call(arguments,1):[],o=0,i=a.length;i>o;o++){r=a[o];for(t in r)r[t]!==void 0&&(n[t]=r[t])}return n},r.defaults={twentyFourHour:!1,allDaySimple:{fn:function(t){return function(){return t.allDay}},slot:0,pre:" "},dayOfWeek:{fn:function(t){return function(n){return n.format(t.weekdayFormat)}},slot:1,pre:" "},allDayMonth:{fn:function(t){return function(n){return n.format(""+t.monthFormat+" "+t.dayFormat)}},slot:2,pre:" "},month:{fn:function(t){return function(n){return n.format(t.monthFormat)}},slot:2,pre:" "},date:{fn:function(t){return function(n){return n.format(t.dayFormat)}},slot:3,pre:" "},year:{fn:function(t){return function(n){return n.format(t.yearFormat)}},slot:4,pre:", "},time:{fn:function(t){return function(n){var r;return r=0===n.minutes()&&t.implicitMinutes&&!t.twentyFourHour?n.format(t.hourFormat):n.format(""+t.hourFormat+":"+t.minuteFormat),t.groupMeridiems||t.twentyFourHour||(t.spaceBeforeMeridiem&&(r+=" "),r+=n.format(t.meridiemFormat)),r}},slot:5,pre:", "},meridiem:{fn:function(t){return function(n){return n.format(t.meridiemFormat)}},slot:6,pre:function(t){return t.spaceBeforeMeridiem?" ":""}}},r.registerLang=function(t,e){return n.lang(t,{twix:r._extend({},r.defaults,e)})},r.prototype.isSame=function(t){return this.start.isSame(this.end,t)},r.prototype.length=function(t){return this._trueEnd().add(1,"millisecond").diff(this._trueStart(),t)},r.prototype.count=function(t){var n,r;return r=this.start.clone().startOf(t),n=this.end.clone().startOf(t),n.diff(r,t)+1},r.prototype.countInner=function(t){var n,r,e;return e=this._inner(t),r=e[0],n=e[1],r>=n?0:n.diff(r,t)},r.prototype.iterate=function(t,n){var r,e,a,o=this;return a=this.start.clone().startOf(t),r=this.end.clone().startOf(t),e=function(){return r>=a&&(!n||a.valueOf()!==r.valueOf()||o.end.hours()>n||o.allDay)},this._iterateHelper(t,a,e)},r.prototype.iterateInner=function(t){var n,r,e,a;return a=this._inner(t),e=a[0],n=a[1],r=function(){return n>e},this._iterateHelper(t,e,r)},r.prototype.humanizeLength=function(){return this.allDay?this.isSame("day")?"all day":this.start.from(this.end.clone().add(1,"day"),!0):this.start.from(this.end,!0)},r.prototype.asDuration=function(){var t;return t=this.end.diff(this.start),n.duration(t)},r.prototype.isPast=function(){return this.allDay?this.end.clone().endOf("day")<n():this.end<n()},r.prototype.isFuture=function(){return this.allDay?this.start.clone().startOf("day")>n():this.start>n()},r.prototype.isCurrent=function(){return!this.isPast()&&!this.isFuture()},r.prototype.contains=function(t){return t=n(t),t>=this._trueStart()&&this._trueEnd()>=t},r.prototype.overlaps=function(t){return this._trueEnd().isAfter(t._trueStart())&&this._trueStart().isBefore(t._trueEnd())},r.prototype.engulfs=function(t){return this._trueStart()<=t._trueStart()&&this._trueEnd()>=t._trueEnd()},r.prototype.union=function(t){var n,e,a;return n=this.allDay&&t.allDay,n?(a=this.start<t.start?this.start:t.start,e=this.end>t.end?this.end:t.end):(a=this._trueStart()<t._trueStart()?this._trueStart():t._trueStart(),e=this._trueEnd()>t._trueEnd()?this._trueEnd():t._trueEnd()),new r(a,e,n)},r.prototype.intersection=function(t){var e,a,o,i;return i=this.start>t.start?this.start:t.start,this.allDay?(a=n(this.end),a.add(1,"day"),a.subtract(1,"millisecond"),o=t.allDay?t.end>a?this.end:t.end:t.end>a?a:t.end):o=this.end<t.end?this.end:t.end,e=this.allDay&&t.allDay,new r(i,o,e)},r.prototype.isValid=function(){return this._trueStart()<=this._trueEnd()},r.prototype.equals=function(t){return t instanceof r&&this.allDay===t.allDay&&this.start.valueOf()===t.start.valueOf()&&this.end.valueOf()===t.e