A web browser extension that emulates Content Delivery Networks to improve your online privacy. It intercepts traffic, finds supported resources locally, and injects them into the environment. https://www.localcdn.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

37 lines
16 KiB

/*!
DateTime picker for DataTables.net v1.1.0
© SpryMedia Ltd, all rights reserved.
License: MIT datatables.net/license/mit
*/
(function(f){"function"===typeof define&&define.amd?define(["jquery"],function(h){return f(h,window,document)}):"object"===typeof exports?module.exports=function(h,x){h||(h=window);return f(x,h,h.document)}:f(jQuery,window,document)})(function(f,h,x,A){var l,v=function(a,b){"undefined"===typeof l&&(l=h.moment?h.moment:h.dayjs?h.dayjs:h.luxon?h.luxon:null);this.c=f.extend(!0,{},v.defaults,b);b=this.c.classPrefix;var c=this.c.i18n;if(!l&&"YYYY-MM-DD"!==this.c.format)throw"DateTime: Without momentjs, dayjs or luxon only the format 'YYYY-MM-DD' can be used";
"string"===typeof this.c.minDate&&(this.c.minDate=new Date(this.c.minDate));"string"===typeof this.c.maxDate&&(this.c.maxDate=new Date(this.c.maxDate));c=f('<div class="'+b+'"><div class="'+b+'-date"><div class="'+b+'-title"><div class="'+b+'-iconLeft"><button title="'+c.previous+'">'+c.previous+'</button></div><div class="'+b+'-iconRight"><button title="'+c.next+'">'+c.next+'</button></div><div class="'+b+'-label"><span></span><select class="'+b+'-month"></select></div><div class="'+b+'-label"><span></span><select class="'+
b+'-year"></select></div></div><div class="'+b+'-buttons"><a class="'+b+'-clear">'+c.clear+'</a><a class="'+b+'-today">'+c.today+'</a></div><div class="'+b+'-calendar"></div></div><div class="'+b+'-time"><div class="'+b+'-hours"></div><div class="'+b+'-minutes"></div><div class="'+b+'-seconds"></div></div><div class="'+b+'-error"></div></div>');this.dom={container:c,date:c.find("."+b+"-date"),title:c.find("."+b+"-title"),calendar:c.find("."+b+"-calendar"),time:c.find("."+b+"-time"),error:c.find("."+
b+"-error"),buttons:c.find("."+b+"-buttons"),clear:c.find("."+b+"-clear"),today:c.find("."+b+"-today"),input:f(a)};this.s={d:null,display:null,minutesRange:null,secondsRange:null,namespace:"dateime-"+v._instance++,parts:{date:null!==this.c.format.match(/[YMD]|L(?!T)|l/),time:null!==this.c.format.match(/[Hhm]|LT|LTS/),seconds:-1!==this.c.format.indexOf("s"),hours12:null!==this.c.format.match(/[haA]/)}};this.dom.container.append(this.dom.date).append(this.dom.time).append(this.dom.error);this.dom.date.append(this.dom.title).append(this.dom.buttons).append(this.dom.calendar);
this._constructor()};f.extend(v.prototype,{destroy:function(){this._hide(!0);this.dom.container.off().empty();this.dom.input.removeAttr("autocomplete").off(".datetime")},errorMsg:function(a){var b=this.dom.error;a?b.html(a):b.empty();return this},hide:function(){this._hide();return this},max:function(a){this.c.maxDate="string"===typeof a?new Date(a):a;this._optionsTitle();this._setCalander();return this},min:function(a){this.c.minDate="string"===typeof a?new Date(a):a;this._optionsTitle();this._setCalander();
return this},owns:function(a){return 0<f(a).parents().filter(this.dom.container).length},val:function(a,b){if(a===A)return this.s.d;if(a instanceof Date)this.s.d=this._dateToUtc(a);else if(null===a||""===a)this.s.d=null;else if("--now"===a)this.s.d=new Date;else if("string"===typeof a)if(l&&l==h.luxon){var c=l.DateTime.fromFormat(a,this.c.format);this.s.d=c.isValid?c.toJSDate():null}else l?(c=l.utc(a,this.c.format,this.c.locale,this.c.strict),this.s.d=c.isValid()?c.toDate():null):(c=a.match(/(\d{4})\-(\d{2})\-(\d{2})/),
this.s.d=c?new Date(Date.UTC(c[1],c[2]-1,c[3])):null);if(b||b===A)this.s.d?this._writeOutput():this.dom.input.val(a);this.s.display=this.s.d?new Date(this.s.d.toString()):new Date;this.s.display.setUTCDate(1);this._setTitle();this._setCalander();this._setTime();return this},_constructor:function(){var a=this,b=this.c.classPrefix,c=this.dom.input.val(),g=function(){var d=a.dom.input.val();d!==c&&(a.c.onChange.call(a,d,a.s.d,a.dom.input),c=d)};this.s.parts.date||this.dom.date.css("display","none");
this.s.parts.time||this.dom.time.css("display","none");this.s.parts.seconds||(this.dom.time.children("div."+b+"-seconds").remove(),this.dom.time.children("span").eq(1).remove());this.c.buttons.clear||this.dom.clear.css("display","none");this.c.buttons.today||this.dom.today.css("display","none");this._optionsTitle();f(x).on("i18n.dt",function(d,e){e.oLanguage.datetime&&(f.extend(!0,a.c.i18n,e.oLanguage.datetime),this._optionsTitle())});"hidden"===this.dom.input.attr("type")&&(this.dom.container.addClass("inline"),
this.c.attachTo="input",this.val(this.dom.input.val(),!1),this._show());c&&this.val(c,!1);this.dom.input.attr("autocomplete","off").on("focus.datetime click.datetime",function(){a.dom.container.is(":visible")||a.dom.input.is(":disabled")||(a.val(a.dom.input.val(),!1),a._show())}).on("keyup.datetime",function(){a.dom.container.is(":visible")&&a.val(a.dom.input.val(),!1)});this.dom.container.on("change","select",function(){var d=f(this),e=d.val();d.hasClass(b+"-month")?(a._correctMonth(a.s.display,
e),a._setTitle(),a._setCalander()):d.hasClass(b+"-year")?(a.s.display.setUTCFullYear(e),a._setTitle(),a._setCalander()):d.hasClass(b+"-hours")||d.hasClass(b+"-ampm")?(a.s.parts.hours12?(d=1*f(a.dom.container).find("."+b+"-hours").val(),e="pm"===f(a.dom.container).find("."+b+"-ampm").val(),a.s.d.setUTCHours(12!==d||e?e&&12!==d?d+12:d:0)):a.s.d.setUTCHours(e),a._setTime(),a._writeOutput(!0),g()):d.hasClass(b+"-minutes")?(a.s.d.setUTCMinutes(e),a._setTime(),a._writeOutput(!0),g()):d.hasClass(b+"-seconds")&&
(a.s.d.setSeconds(e),a._setTime(),a._writeOutput(!0),g());a.dom.input.focus();a._position()}).on("click",function(d){var e=a.s.d;e=d.target.nodeName.toLowerCase();var n="span"===e?d.target.parentNode:d.target;e=n.nodeName.toLowerCase();if("select"!==e)if(d.stopPropagation(),"a"===e&&(d.preventDefault(),f(n).hasClass(b+"-clear")?(a.s.d=null,a.dom.input.val(""),a._writeOutput(),a._setCalander(),a._setTime(),g()):f(n).hasClass(b+"-today")&&(a.s.display=new Date,a._setTitle(),a._setCalander())),"button"===
e){var m=f(n);d=m.parent();if(d.hasClass("disabled")&&!d.hasClass("range"))m.blur();else if(d.hasClass(b+"-iconLeft"))a.s.display.setUTCMonth(a.s.display.getUTCMonth()-1),a._setTitle(),a._setCalander(),a.dom.input.focus();else if(d.hasClass(b+"-iconRight"))a._correctMonth(a.s.display,a.s.display.getUTCMonth()+1),a._setTitle(),a._setCalander(),a.dom.input.focus();else{if(m.parents("."+b+"-time").length){n=m.data("value");m=m.data("unit");e=a._needValue();if("minutes"===m){if(d.hasClass("disabled")&&
d.hasClass("range")){a.s.minutesRange=n;a._setTime();return}a.s.minutesRange=null}if("seconds"===m){if(d.hasClass("disabled")&&d.hasClass("range")){a.s.secondsRange=n;a._setTime();return}a.s.secondsRange=null}if("am"===n)if(12<=e.getUTCHours())n=e.getUTCHours()-12;else return;else if("pm"===n)if(12>e.getUTCHours())n=e.getUTCHours()+12;else return;e["hours"===m?"setUTCHours":"minutes"===m?"setUTCMinutes":"setSeconds"](n);a._setTime();a._writeOutput(!0)}else e=a._needValue(),e.setUTCDate(1),e.setUTCFullYear(m.data("year")),
e.setUTCMonth(m.data("month")),e.setUTCDate(m.data("day")),a._writeOutput(!0),a.s.parts.time?a._setCalander():setTimeout(function(){a._hide()},10);g()}}else a.dom.input.focus()})},_compareDates:function(a,b){return l&&l==h.luxon?l.DateTime.fromJSDate(a).toISODate()===l.DateTime.fromJSDate(b).toISODate():this._dateToUtcString(a)===this._dateToUtcString(b)},_correctMonth:function(a,b){var c=this._daysInMonth(a.getUTCFullYear(),b),g=a.getUTCDate()>c;a.setUTCMonth(b);g&&(a.setUTCDate(c),a.setUTCMonth(b))},
_daysInMonth:function(a,b){return[31,0!==a%4||0===a%100&&0!==a%400?28:29,31,30,31,30,31,31,30,31,30,31][b]},_dateToUtc:function(a){return new Date(Date.UTC(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds()))},_dateToUtcString:function(a){return l&&l==h.luxon?l.DateTime.fromJSDate(a).toISODate():a.getUTCFullYear()+"-"+this._pad(a.getUTCMonth()+1)+"-"+this._pad(a.getUTCDate())},_hide:function(a){if(a||"hidden"!==this.dom.input.attr("type"))a=this.s.namespace,this.dom.container.detach(),
f(h).off("."+a),f(x).off("keydown."+a),f("div.dataTables_scrollBody").off("scroll."+a),f("div.DTE_Body_Content").off("scroll."+a),f("body").off("click."+a)},_hours24To12:function(a){return 0===a?12:12<a?a-12:a},_htmlDay:function(a){if(a.empty)return'<td class="empty"></td>';var b=["selectable"],c=this.c.classPrefix;a.disabled&&b.push("disabled");a.today&&b.push("now");a.selected&&b.push("selected");return'<td data-day="'+a.day+'" class="'+b.join(" ")+'"><button class="'+c+"-button "+c+'-day" type="button" data-year="'+
a.year+'" data-month="'+a.month+'" data-day="'+a.day+'"><span>'+a.day+"</span></button></td>"},_htmlMonth:function(a,b){var c=this._dateToUtc(new Date),g=this._daysInMonth(a,b),d=(new Date(Date.UTC(a,b,1))).getUTCDay(),e=[],n=[];0<this.c.firstDay&&(d-=this.c.firstDay,0>d&&(d+=7));for(var m=g+d,q=m;7<q;)q-=7;m+=7-q;var t=this.c.minDate;q=this.c.maxDate;t&&(t.setUTCHours(0),t.setUTCMinutes(0),t.setSeconds(0));q&&(q.setUTCHours(23),q.setUTCMinutes(59),q.setSeconds(59));for(var k=0,p=0;k<m;k++){var u=
new Date(Date.UTC(a,b,1+(k-d))),z=this.s.d?this._compareDates(u,this.s.d):!1,r=this._compareDates(u,c),B=k<d||k>=g+d,y=t&&u<t||q&&u>q,w=this.c.disableDays;Array.isArray(w)&&-1!==f.inArray(u.getUTCDay(),w)?y=!0:"function"===typeof w&&!0===w(u)&&(y=!0);n.push(this._htmlDay({day:1+(k-d),month:b,year:a,selected:z,today:r,disabled:y,empty:B}));7===++p&&(this.c.showWeekNumber&&n.unshift(this._htmlWeekOfYear(k-d,b,a)),e.push("<tr>"+n.join("")+"</tr>"),n=[],p=0)}c=this.c.classPrefix;g=c+"-table";this.c.showWeekNumber&&
(g+=" weekNumber");t&&(t=t>=new Date(Date.UTC(a,b,1,0,0,0)),this.dom.title.find("div."+c+"-iconLeft").css("display",t?"none":"block"));q&&(a=q<new Date(Date.UTC(a,b+1,1,0,0,0)),this.dom.title.find("div."+c+"-iconRight").css("display",a?"none":"block"));return'<table class="'+g+'"><thead>'+this._htmlMonthHead()+"</thead><tbody>"+e.join("")+"</tbody></table>"},_htmlMonthHead:function(){var a=[],b=this.c.firstDay,c=this.c.i18n,g=function(e){for(e+=b;7<=e;)e-=7;return c.weekdays[e]};this.c.showWeekNumber&&
a.push("<th></th>");for(var d=0;7>d;d++)a.push("<th>"+g(d)+"</th>");return a.join("")},_htmlWeekOfYear:function(a,b,c){a=new Date(c,b,a,0,0,0,0);a.setDate(a.getDate()+4-(a.getDay()||7));return'<td class="'+this.c.classPrefix+'-week">'+Math.ceil(((a-new Date(c,0,1))/864E5+1)/7)+"</td>"},_needValue:function(){this.s.d||(this.s.d=this._dateToUtc(new Date));return this.s.d},_options:function(a,b,c){c||(c=b);a=this.dom.container.find("select."+this.c.classPrefix+"-"+a);a.empty();for(var g=0,d=b.length;g<
d;g++)a.append('<option value="'+b[g]+'">'+c[g]+"</option>")},_optionSet:function(a,b){var c=this.dom.container.find("select."+this.c.classPrefix+"-"+a);a=c.parent().children("span");c.val(b);b=c.find("option:selected");a.html(0!==b.length?b.text():this.c.i18n.unknown)},_optionsTime:function(a,b,c,g,d){var e=this.c.classPrefix,n=this.dom.container.find("div."+e+"-"+a),m=12===b?function(r){return r}:this._pad;e=this.c.classPrefix;var q=e+"-table",t=this.c.i18n;if(n.length){var k="";var p=10;var u=
function(r,B,y){12===b&&"number"===typeof r&&(12<=c&&(r+=12),12==r?r=0:24==r&&(r=12));var w=c===r||"am"===r&&12>c||"pm"===r&&12<=c?"selected":"";g&&-1===f.inArray(r,g)&&(w+=" disabled");y&&(w+=" "+y);return'<td class="selectable '+w+'"><button class="'+e+"-button "+e+'-day" type="button" data-unit="'+a+'" data-value="'+r+'"><span>'+B+"</span></button></td>"};if(12===b){k+="<tr>";for(d=1;6>=d;d++)k+=u(d,m(d));k+=u("am",t.amPm[0]);k+="</tr><tr>";for(d=7;12>=d;d++)k+=u(d,m(d));k+=u("pm",t.amPm[1]);k+=
"</tr>";p=7}else{if(24===b){var z=0;for(p=0;4>p;p++){k+="<tr>";for(d=0;6>d;d++)k+=u(z,m(z)),z++;k+="</tr>"}}else{k+="<tr>";for(p=0;60>p;p+=10)k+=u(p,m(p),"range");d=null!==d?d:10*Math.floor(c/10);k=k+'</tr></tbody></thead><table class="'+(q+" "+q+'-nospace"><tbody><tr>');for(p=d+1;p<d+10;p++)k+=u(p,m(p));k+="</tr>"}p=6}n.empty().append('<table class="'+q+'"><thead><tr><th colspan="'+p+'">'+t[a]+"</th></tr></thead><tbody>"+k+"</tbody></table>")}},_optionsTitle:function(){var a=this.c.i18n,b=this.c.minDate,
c=this.c.maxDate;b=b?b.getFullYear():null;c=c?c.getFullYear():null;b=null!==b?b:(new Date).getFullYear()-this.c.yearRange;c=null!==c?c:(new Date).getFullYear()+this.c.yearRange;this._options("month",this._range(0,11),a.months);this._options("year",this._range(b,c))},_pad:function(a){return 10>a?"0"+a:a},_position:function(){var a="input"===this.c.attachTo?this.dom.input.position():this.dom.input.offset(),b=this.dom.container,c=this.dom.input.outerHeight();if(b.hasClass("inline"))b.insertAfter(this.dom.input);
else{this.s.parts.date&&this.s.parts.time&&550<f(h).width()?b.addClass("horizontal"):b.removeClass("horizontal");"input"===this.c.attachTo?b.css({top:a.top+c,left:a.left}).insertAfter(this.dom.input):b.css({top:a.top+c,left:a.left}).appendTo("body");var g=b.outerHeight(),d=b.outerWidth(),e=f(h).scrollTop();a.top+c+g-e>f(h).height()&&(c=a.top-g,b.css("top",0>c?0:c));d+a.left>f(h).width()&&(a=f(h).width()-d,"input"===this.c.attachTo&&(a-=f(b).offsetParent().offset().left),b.css("left",0>a?0:a))}},_range:function(a,
b,c){var g=[];for(c||(c=1);a<=b;a+=c)g.push(a);return g},_setCalander:function(){this.s.display&&this.dom.calendar.empty().append(this._htmlMonth(this.s.display.getUTCFullYear(),this.s.display.getUTCMonth()))},_setTitle:function(){this._optionSet("month",this.s.display.getUTCMonth());this._optionSet("year",this.s.display.getUTCFullYear())},_setTime:function(){var a=this,b=this.s.d,c=null;l&&l==h.luxon&&(c=l.DateTime.fromJSDate(b));var g=null!=c?c.hour:b?b.getUTCHours():0,d=function(e){return a.c[e+
"Available"]?a.c[e+"Available"]:a._range(0,59,a.c[e+"Increment"])};this._optionsTime("hours",this.s.parts.hours12?12:24,g,this.c.hoursAvailable);this._optionsTime("minutes",60,null!=c?c.minute:b?b.getUTCMinutes():0,d("minutes"),this.s.minutesRange);this._optionsTime("seconds",60,null!=c?c.second:b?b.getSeconds():0,d("seconds"),this.s.secondsRange)},_show:function(){var a=this,b=this.s.namespace;this._position();f(h).on("scroll."+b+" resize."+b,function(){a._position()});f("div.DTE_Body_Content").on("scroll."+
b,function(){a._position()});f("div.dataTables_scrollBody").on("scroll."+b,function(){a._position()});var c=this.dom.input[0].offsetParent;if(c!==x.body)f(c).on("scroll."+b,function(){a._position()});f(x).on("keydown."+b,function(g){9!==g.keyCode&&27!==g.keyCode&&13!==g.keyCode||a._hide()});setTimeout(function(){f("body").on("click."+b,function(g){f(g.target).parents().filter(a.dom.container).length||g.target===a.dom.input[0]||a._hide()})},10)},_writeOutput:function(a){var b=this.s.d,c="";b&&(c=l&&
l==h.luxon?l.DateTime.fromJSDate(this.s.d).toFormat(this.c.format):l?l.utc(b,A,this.c.locale,this.c.strict).format(this.c.format):b.getUTCFullYear()+"-"+this._pad(b.getUTCMonth()+1)+"-"+this._pad(b.getUTCDate()));this.dom.input.val(c).trigger("change",{write:b});"hidden"===this.dom.input.attr("type")&&this.val(c,!1);a&&this.dom.input.focus()}});v.use=function(a){l=a};v._instance=0;v.defaults={attachTo:"body",buttons:{clear:!1,today:!1},classPrefix:"dt-datetime",disableDays:null,firstDay:1,format:"YYYY-MM-DD",
hoursAvailable:null,i18n:{clear:"Clear",previous:"Previous",next:"Next",months:"January February March April May June July August September October November December".split(" "),weekdays:"Sun Mon Tue Wed Thu Fri Sat".split(" "),amPm:["am","pm"],hours:"Hour",minutes:"Minute",seconds:"Second",unknown:"-",today:"Today"},maxDate:null,minDate:null,minutesAvailable:null,minutesIncrement:1,strict:!0,locale:"en",onChange:function(){},secondsAvailable:null,secondsIncrement:1,showWeekNumber:!1,yearRange:25};
v.version="1.1.0";h.DateTime||(h.DateTime=v);f.fn.dtDateTime=function(a){return this.each(function(){new v(this,a)})};f.fn.dataTable&&(f.fn.dataTable.DateTime=v,f.fn.DataTable.DateTime=v,f.fn.dataTable.Editor&&(f.fn.dataTable.Editor.DateTime=v));return v});