jquery-datetimepicker-rails 2.2.4.0 → 2.2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/jquery.datetimepicker.js +141 -122
- data/lib/jquery/datetimepicker/rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccee0a7d3cc7b0be6c01339b51ae8f59d4560b74
|
4
|
+
data.tar.gz: c6da45fc0f309ae358c10e9e743470c89b6ac09e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28b9e8156a93b712a6031ad0fb8afbcc7c9f400307f273013a0a336ae9dc19e046d3471a4b4eb908250914b5c2339b9b63b2f3b7ddb272b68aa37567b4666f33
|
7
|
+
data.tar.gz: b6fce68bc792facf08f754240f3a7cfacd8ddb6ac88344dde0547c9d48337d4c483169fb8d8f2f3ce5efd4e8df9596a38d528fec9898bbd53fce8c5918cda484
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @preserve jQuery DateTimePicker plugin v2.2.
|
2
|
+
* @preserve jQuery DateTimePicker plugin v2.2.5
|
3
3
|
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
4
4
|
* (c) 2014, Chupurnov Valeriy.
|
5
5
|
*/
|
@@ -127,6 +127,14 @@
|
|
127
127
|
"Søn", "Man", "Tir", "ons", "Tor", "Fre", "lør"
|
128
128
|
]
|
129
129
|
},
|
130
|
+
ja:{ // Japanese
|
131
|
+
months: [
|
132
|
+
"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"
|
133
|
+
],
|
134
|
+
dayOfWeek: [
|
135
|
+
"日", "月", "火", "水", "木", "金", "土"
|
136
|
+
]
|
137
|
+
}
|
130
138
|
},
|
131
139
|
value:'',
|
132
140
|
lang: 'en',
|
@@ -141,7 +149,7 @@
|
|
141
149
|
|
142
150
|
step:60,
|
143
151
|
|
144
|
-
closeOnDateSelect:
|
152
|
+
closeOnDateSelect:false,
|
145
153
|
closeOnWithoutClick:true,
|
146
154
|
|
147
155
|
timepicker:true,
|
@@ -806,142 +814,150 @@
|
|
806
814
|
});
|
807
815
|
});
|
808
816
|
|
817
|
+
var xchangeTimer = 0;
|
809
818
|
// base handler - generating a calendar and timepicker
|
810
819
|
datetimepicker
|
811
820
|
.on('xchange.xdsoft',function( event ) {
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
821
|
+
clearTimeout(xchangeTimer);
|
822
|
+
xchangeTimer = setTimeout(function(){
|
823
|
+
var table = '',
|
824
|
+
start = new Date(_xdsoft_datetime.currentTime.getFullYear(),_xdsoft_datetime.currentTime.getMonth(),1, 12, 0, 0),
|
825
|
+
i = 0,
|
826
|
+
today = _xdsoft_datetime.now();
|
827
|
+
|
828
|
+
console.log('fire xchange.xdsoft',_xdsoft_datetime.currentTime); // remove
|
829
|
+
|
830
|
+
while( start.getDay()!=options.dayOfWeekStart )
|
831
|
+
start.setDate(start.getDate()-1);
|
822
832
|
|
823
|
-
|
824
|
-
|
825
|
-
table+='<th>'+options.i18n[options.lang].dayOfWeek[(j+options.dayOfWeekStart)>6?0:j+options.dayOfWeekStart]+'</th>';
|
826
|
-
}
|
833
|
+
//generate calendar
|
834
|
+
table+='<table><thead><tr>';
|
827
835
|
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
if( options.maxDate!==false ) {
|
833
|
-
maxDate = _xdsoft_datetime.strtodate(options.maxDate);
|
834
|
-
maxDate = new Date(maxDate.getFullYear(),maxDate.getMonth(),maxDate.getDate(),23,59,59,999);
|
835
|
-
}
|
836
|
-
|
837
|
-
if( options.minDate!==false ) {
|
838
|
-
minDate = _xdsoft_datetime.strtodate(options.minDate);
|
839
|
-
minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
|
840
|
-
}
|
841
|
-
|
842
|
-
var d,y,m,classes = [];
|
843
|
-
|
844
|
-
while( i<_xdsoft_datetime.currentTime.getDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ) {
|
845
|
-
classes = [];
|
846
|
-
i++;
|
836
|
+
// days
|
837
|
+
for(var j = 0; j<7; j++) {
|
838
|
+
table+='<th>'+options.i18n[options.lang].dayOfWeek[(j+options.dayOfWeekStart)>6?0:j+options.dayOfWeekStart]+'</th>';
|
839
|
+
}
|
847
840
|
|
848
|
-
|
841
|
+
table+='</tr></thead>';
|
842
|
+
table+='<tbody><tr>';
|
843
|
+
var maxDate = false, minDate = false;
|
844
|
+
|
845
|
+
if( options.maxDate!==false ) {
|
846
|
+
maxDate = _xdsoft_datetime.strtodate(options.maxDate);
|
847
|
+
maxDate = new Date(maxDate.getFullYear(),maxDate.getMonth(),maxDate.getDate(),23,59,59,999);
|
848
|
+
}
|
849
|
+
|
850
|
+
if( options.minDate!==false ) {
|
851
|
+
minDate = _xdsoft_datetime.strtodate(options.minDate);
|
852
|
+
minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
|
853
|
+
}
|
854
|
+
|
855
|
+
var d,y,m,classes = [];
|
856
|
+
|
857
|
+
while( i<_xdsoft_datetime.currentTime.getDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ) {
|
858
|
+
classes = [];
|
859
|
+
i++;
|
849
860
|
|
850
|
-
|
861
|
+
d = start.getDate(); y = start.getFullYear(); m = start.getMonth();
|
851
862
|
|
852
|
-
|
853
|
-
classes.push('xdsoft_disabled');
|
854
|
-
}
|
863
|
+
classes.push('xdsoft_date');
|
855
864
|
|
856
|
-
|
865
|
+
if( ( maxDate!==false && start > maxDate )||( minDate!==false && start < minDate ) ){
|
866
|
+
classes.push('xdsoft_disabled');
|
867
|
+
}
|
857
868
|
|
858
|
-
|
859
|
-
|
860
|
-
|
869
|
+
if( _xdsoft_datetime.currentTime.getMonth()!=m ){
|
870
|
+
classes.push('xdsoft_other_month');
|
871
|
+
}
|
861
872
|
|
862
|
-
|
863
|
-
|
864
|
-
|
873
|
+
if( (options.defaultSelect||datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat('d.m.Y')==start.dateFormat('d.m.Y') ) {
|
874
|
+
classes.push('xdsoft_current');
|
875
|
+
}
|
865
876
|
|
866
|
-
|
867
|
-
|
868
|
-
|
877
|
+
if( today.dateFormat('d.m.Y')==start.dateFormat('d.m.Y') ) {
|
878
|
+
classes.push('xdsoft_today');
|
879
|
+
}
|
869
880
|
|
870
|
-
|
871
|
-
'
|
872
|
-
|
881
|
+
if( start.getDay()==0||start.getDay()==6||~options.weekends.indexOf(start.dateFormat('d.m.Y')) ) {
|
882
|
+
classes.push('xdsoft_weekend');
|
883
|
+
}
|
873
884
|
|
874
|
-
|
875
|
-
|
876
|
-
|
885
|
+
table+='<td data-date="'+d+'" data-month="'+m+'" data-year="'+y+'"'+' class="xdsoft_date xdsoft_day_of_week'+start.getDay()+' '+ classes.join(' ')+'">'+
|
886
|
+
'<div>'+d+'</div>'+
|
887
|
+
'</td>';
|
877
888
|
|
878
|
-
|
879
|
-
|
880
|
-
table+='</tbody></table>';
|
881
|
-
|
882
|
-
calendar.html(table);
|
883
|
-
|
884
|
-
mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[_xdsoft_datetime.currentTime.getMonth()]);
|
885
|
-
mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
|
886
|
-
|
887
|
-
// generate timebox
|
888
|
-
var time = '',
|
889
|
-
h = '',
|
890
|
-
m ='',
|
891
|
-
line_time = function line_time( h,m ) {
|
892
|
-
var now = _xdsoft_datetime.now();
|
893
|
-
now.setHours(h);
|
894
|
-
h = parseInt(now.getHours());
|
895
|
-
now.setMinutes(m);
|
896
|
-
m = parseInt(now.getMinutes());
|
897
|
-
|
898
|
-
classes = [];
|
899
|
-
if( (options.maxTime!==false&&_xdsoft_datetime.strtotime(options.maxTime).getTime()<now.getTime())||(options.minTime!==false&&_xdsoft_datetime.strtotime(options.minTime).getTime()>now.getTime()))
|
900
|
-
classes.push('xdsoft_disabled');
|
901
|
-
if( (options.initTime||options.defaultSelect||datetimepicker.data('changed')) && parseInt(_xdsoft_datetime.currentTime.getHours())==parseInt(h)&&(options.step>59||Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m))) {
|
902
|
-
if( options.defaultSelect||datetimepicker.data('changed')) {
|
903
|
-
classes.push('xdsoft_current');
|
904
|
-
} else if( options.initTime ) {
|
905
|
-
classes.push('xdsoft_init_time');
|
889
|
+
if( start.getDay()==options.dayOfWeekStartPrev ) {
|
890
|
+
table+='</tr>';
|
906
891
|
}
|
907
|
-
}
|
908
|
-
if( parseInt(today.getHours())==parseInt(h)&&parseInt(today.getMinutes())==parseInt(m))
|
909
|
-
classes.push('xdsoft_today');
|
910
|
-
time+= '<div class="xdsoft_time '+classes.join(' ')+'" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'</div>';
|
911
|
-
};
|
912
892
|
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
893
|
+
start.setDate(d+1);
|
894
|
+
}
|
895
|
+
table+='</tbody></table>';
|
896
|
+
|
897
|
+
calendar.html(table);
|
898
|
+
|
899
|
+
mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[_xdsoft_datetime.currentTime.getMonth()]);
|
900
|
+
mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
|
901
|
+
|
902
|
+
// generate timebox
|
903
|
+
var time = '',
|
904
|
+
h = '',
|
905
|
+
m ='',
|
906
|
+
line_time = function line_time( h,m ) {
|
907
|
+
var now = _xdsoft_datetime.now();
|
908
|
+
now.setHours(h);
|
909
|
+
h = parseInt(now.getHours());
|
910
|
+
now.setMinutes(m);
|
911
|
+
m = parseInt(now.getMinutes());
|
912
|
+
|
913
|
+
classes = [];
|
914
|
+
if( (options.maxTime!==false&&_xdsoft_datetime.strtotime(options.maxTime).getTime()<now.getTime())||(options.minTime!==false&&_xdsoft_datetime.strtotime(options.minTime).getTime()>now.getTime()))
|
915
|
+
classes.push('xdsoft_disabled');
|
916
|
+
if( (options.initTime||options.defaultSelect||datetimepicker.data('changed')) && parseInt(_xdsoft_datetime.currentTime.getHours())==parseInt(h)&&(options.step>59||Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m))) {
|
917
|
+
if( options.defaultSelect||datetimepicker.data('changed')) {
|
918
|
+
classes.push('xdsoft_current');
|
919
|
+
} else if( options.initTime ) {
|
920
|
+
classes.push('xdsoft_init_time');
|
921
|
+
}
|
922
|
+
}
|
923
|
+
if( parseInt(today.getHours())==parseInt(h)&&parseInt(today.getMinutes())==parseInt(m))
|
924
|
+
classes.push('xdsoft_today');
|
925
|
+
time+= '<div class="xdsoft_time '+classes.join(' ')+'" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'</div>';
|
926
|
+
};
|
927
|
+
|
928
|
+
if( !options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length ) {
|
929
|
+
for( var i=0,j=0;i<(options.hours12?12:24);i++ ) {
|
930
|
+
for( j=0;j<60;j+=options.step ) {
|
931
|
+
h = (i<10?'0':'')+i;
|
932
|
+
m = (j<10?'0':'')+j;
|
933
|
+
line_time( h,m );
|
934
|
+
}
|
935
|
+
}
|
936
|
+
}else{
|
937
|
+
for( var i=0;i<options.allowTimes.length;i++ ) {
|
938
|
+
h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
|
939
|
+
m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
|
940
|
+
line_time( h,m );
|
941
|
+
}
|
919
942
|
}
|
920
|
-
}
|
921
|
-
}else{
|
922
|
-
for( var i=0;i<options.allowTimes.length;i++ ) {
|
923
|
-
h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
|
924
|
-
m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
|
925
|
-
line_time( h,m );
|
926
|
-
}
|
927
|
-
}
|
928
943
|
|
929
|
-
|
944
|
+
timebox.html(time);
|
930
945
|
|
931
|
-
|
932
|
-
|
946
|
+
var opt = '',
|
947
|
+
i = 0;
|
933
948
|
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
949
|
+
for( i = parseInt(options.yearStart,10)+options.yearOffset;i<= parseInt(options.yearEnd,10)+options.yearOffset;i++ ) {
|
950
|
+
opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getFullYear()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+i+'</div>';
|
951
|
+
}
|
952
|
+
yearselect.children().eq(0)
|
953
|
+
.html(opt);
|
939
954
|
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
955
|
+
for( i = 0,opt = '';i<= 11;i++ ) {
|
956
|
+
opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getMonth()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+options.i18n[options.lang].months[i]+'</div>';
|
957
|
+
}
|
958
|
+
monthselect.children().eq(0).html(opt);
|
959
|
+
$(this).trigger('generate.xdsoft');
|
960
|
+
},10);
|
945
961
|
event.stopPropagation();
|
946
962
|
})
|
947
963
|
.on('afterOpen.xdsoft',function() {
|
@@ -966,17 +982,20 @@
|
|
966
982
|
});
|
967
983
|
|
968
984
|
var timerclick = 0;
|
985
|
+
|
969
986
|
calendar
|
970
|
-
.on('click.xdsoft','td',function() {
|
987
|
+
.on('click.xdsoft', 'td', function (xdevent) {
|
988
|
+
xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
|
971
989
|
timerclick++;
|
972
990
|
var $this = $(this),
|
973
991
|
currentTime = _xdsoft_datetime.currentTime;
|
974
992
|
if( $this.hasClass('xdsoft_disabled') )
|
975
993
|
return false;
|
976
994
|
|
977
|
-
currentTime.setFullYear( $this.data('year') );
|
978
|
-
currentTime.setMonth( $this.data('month') );
|
979
995
|
currentTime.setDate( $this.data('date') );
|
996
|
+
currentTime.setMonth( $this.data('month') );
|
997
|
+
currentTime.setFullYear( $this.data('year') );
|
998
|
+
|
980
999
|
datetimepicker.trigger('select.xdsoft',[currentTime]);
|
981
1000
|
|
982
1001
|
input.val( _xdsoft_datetime.str() );
|
@@ -997,7 +1016,8 @@
|
|
997
1016
|
});
|
998
1017
|
|
999
1018
|
timebox
|
1000
|
-
.on('click.xdsoft','div',function() {
|
1019
|
+
.on('click.xdsoft', 'div', function (xdevent) {
|
1020
|
+
xdevent.stopPropagation(); // NAJ: Prevents closing of Pop-ups, Modals and Flyouts
|
1001
1021
|
var $this = $(this),
|
1002
1022
|
currentTime = _xdsoft_datetime.currentTime;
|
1003
1023
|
if( $this.hasClass('xdsoft_disabled') )
|
@@ -1252,8 +1272,7 @@
|
|
1252
1272
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
1253
1273
|
* details.
|
1254
1274
|
*/
|
1255
|
-
Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(
|
1256
|
-
//https://github.com/brandonaaron/jquery-mousewheel/blob/master/jquery.mousewheel.js
|
1275
|
+
Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(a){if(a=='unixtime')return parseInt(this.getTime()/1000);if(Date.formatFunctions[a]==null){Date.createNewFormat(a)}var b=Date.formatFunctions[a];return this[b]()};Date.createNewFormat=function(a){var b="format"+Date.formatFunctions.count++;Date.formatFunctions[a]=b;var c="Date.prototype."+b+" = function() {return ";var d=false;var e='';for(var i=0;i<a.length;++i){e=a.charAt(i);if(!d&&e=="\\"){d=true}else if(d){d=false;c+="'"+String.escape(e)+"' + "}else{c+=Date.getFormatCode(e)}}eval(c.substring(0,c.length-3)+";}")};Date.getFormatCode=function(a){switch(a){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(a)+"' + "}};Date.parseDate=function(a,b){if(b=='unixtime')return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0);if(Date.parseFunctions[b]==null){Date.createParser(b)}var c=Date.parseFunctions[b];return Date[c](a)};Date.createParser=function(a){var b="parse"+Date.parseFunctions.count++;var c=Date.parseRegexes.length;var d=1;Date.parseFunctions[a]=b;var e="Date."+b+" = function(input) {\n"+"var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n"+"var d = new Date();\n"+"y = d.getFullYear();\n"+"m = d.getMonth();\n"+"d = d.getDate();\n"+"var results = input.match(Date.parseRegexes["+c+"]);\n"+"if (results && results.length > 0) {";var f="";var g=false;var h='';for(var i=0;i<a.length;++i){h=a.charAt(i);if(!g&&h=="\\"){g=true}else if(g){g=false;f+=String.escape(h)}else{obj=Date.formatCodeToRegex(h,d);d+=obj.g;f+=obj.s;if(obj.g&&obj.c){e+=obj.c}}}e+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"+"{return new Date(y, m, d, h, i, s);}\n"+"else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"+"{return new Date(y, m, d, h, i);}\n"+"else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n"+"{return new Date(y, m, d, h);}\n"+"else if (y > 0 && m >= 0 && d > 0)\n"+"{return new Date(y, m, d);}\n"+"else if (y > 0 && m >= 0)\n"+"{return new Date(y, m);}\n"+"else if (y > 0)\n"+"{return new Date(y);}\n"+"}return null;}";Date.parseRegexes[c]=new RegExp("^"+f+"$");eval(e)};Date.formatCodeToRegex=function(a,b){switch(a){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+b+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:0,c:null,s:"(?:\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+b+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+b+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+b+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+b+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+b+"], 10);\n"+"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+b+"] == 'am') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+b+"] == 'AM') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+b+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+b+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+b+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(a)}}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0")};Date.prototype.getDayOfYear=function(){var a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var i=0;i<this.getMonth();++i){a+=Date.daysInMonth[i]}return a+this.getDate()};Date.prototype.getWeekOfYear=function(){var a=this.getDayOfYear()+(4-this.getDay());var b=new Date(this.getFullYear(),0,1);var c=(7-b.getDay()+4);return String.leftPad(Math.ceil((a-c)/7)+1,2,"0")};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return((a&3)==0&&(a%100||(a%400==0&&a)))};Date.prototype.getFirstDayOfMonth=function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a};Date.prototype.getLastDayOfMonth=function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()]};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};String.escape=function(a){return a.replace(/('|\\)/g,"\\$1")};String.leftPad=function(a,b,c){var d=new String(a);if(c==null){c=" "}while(d.length<b){d=c+d}return d};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};//https://github.com/brandonaaron/jquery-mousewheel/blob/master/jquery.mousewheel.js
|
1257
1276
|
/*
|
1258
1277
|
* Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
|
1259
1278
|
*
|