Merge pull request #572 from socheatsok78/master

Add Khmer translation
This commit is contained in:
Valeriy 2017-05-12 09:58:03 +05:00 committed by GitHub
commit 010a78c564
5 changed files with 384 additions and 119 deletions

View File

@ -1,8 +1,10 @@
/*! /*!
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2015 * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2017
* @version 1.3.3 * @version 1.3.4
* *
* Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format. * Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format.
* This library is a standalone javascript library and does not depend on other libraries or plugins like jQuery.
*
* @see http://php.net/manual/en/function.date.php * @see http://php.net/manual/en/function.date.php
* *
* For more JQuery plugins visit http://plugins.krajee.com * For more JQuery plugins visit http://plugins.krajee.com
@ -12,15 +14,16 @@ var DateFormatter;
(function () { (function () {
"use strict"; "use strict";
var _compare, _lpad, _extend, defaultSettings, DAY, HOUR; var _compare, _lpad, _extend, _indexOf, defaultSettings, DAY, HOUR;
DAY = 1000 * 60 * 60 * 24; DAY = 1000 * 60 * 60 * 24;
HOUR = 3600; HOUR = 3600;
_compare = function (str1, str2) { _compare = function (str1, str2) {
return typeof(str1) === 'string' && typeof(str2) === 'string' && str1.toLowerCase() === str2.toLowerCase(); return typeof(str1) === 'string' && typeof(str2) === 'string' && str1.toLowerCase() === str2.toLowerCase();
}; };
_lpad = function (value, length, char) { _lpad = function (value, length, chr) {
var chr = char || '0', val = value.toString(); var val = value.toString();
chr = chr || '0';
return val.length < length ? _lpad(chr + val, length) : val; return val.length < length ? _lpad(chr + val, length) : val;
}; };
_extend = function (out) { _extend = function (out) {
@ -43,6 +46,14 @@ var DateFormatter;
} }
return out; return out;
}; };
_indexOf = function (val, arr) {
for (var i = 0; i < arr.length; i++) {
if (arr[i].toLowerCase() === val.toLowerCase()) {
return i;
}
}
return -1;
};
defaultSettings = { defaultSettings = {
dateSettings: { dateSettings: {
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
@ -77,25 +88,35 @@ var DateFormatter;
DateFormatter.prototype = { DateFormatter.prototype = {
constructor: DateFormatter, constructor: DateFormatter,
getMonth: function (val) {
var self = this, i;
i = _indexOf(val, self.dateSettings.monthsShort) + 1;
if (i === 0) {
i = _indexOf(val, self.dateSettings.months) + 1;
}
return i;
},
parseDate: function (vDate, vFormat) { parseDate: function (vDate, vFormat) {
var self = this, vFormatParts, vDateParts, i, vDateFlag = false, vTimeFlag = false, vDatePart, iDatePart, var self = this, vFormatParts, vDateParts, i, vDateFlag = false, vTimeFlag = false, vDatePart, iDatePart,
vSettings = self.dateSettings, vMonth, vMeriIndex, vMeriOffset, len, mer, vSettings = self.dateSettings, vMonth, vMeriIndex, vMeriOffset, len, mer,
out = {date: null, year: null, month: null, day: null, hour: 0, min: 0, sec: 0}; out = {date: null, year: null, month: null, day: null, hour: 0, min: 0, sec: 0};
if (!vDate) { if (!vDate) {
return undefined; return null;
} }
if (vDate instanceof Date) { if (vDate instanceof Date) {
return vDate; return vDate;
} }
if (typeof vDate === 'number') {
return new Date(vDate);
}
if (vFormat === 'U') { if (vFormat === 'U') {
i = parseInt(vDate); i = parseInt(vDate);
return i ? new Date(i * 1000) : vDate; return i ? new Date(i * 1000) : vDate;
} }
if (typeof vDate !== 'string') { switch (typeof vDate) {
return ''; case 'number':
return new Date(vDate);
case 'string':
break;
default:
return null;
} }
vFormatParts = vFormat.match(self.validParts); vFormatParts = vFormat.match(self.validParts);
if (!vFormatParts || vFormatParts.length === 0) { if (!vFormatParts || vFormatParts.length === 0) {
@ -108,11 +129,11 @@ var DateFormatter;
switch (vFormatParts[i]) { switch (vFormatParts[i]) {
case 'y': case 'y':
case 'Y': case 'Y':
len = vDatePart.length; if (iDatePart) {
if (len === 2) { len = vDatePart.length;
out.year = parseInt((iDatePart < 70 ? '20' : '19') + vDatePart); out.year = len === 2 ? parseInt((iDatePart < 70 ? '20' : '19') + vDatePart) : iDatePart;
} else if (len === 4) { } else {
out.year = iDatePart; return null;
} }
vDateFlag = true; vDateFlag = true;
break; break;
@ -120,18 +141,18 @@ var DateFormatter;
case 'n': case 'n':
case 'M': case 'M':
case 'F': case 'F':
if (isNaN(vDatePart)) { if (isNaN(iDatePart)) {
vMonth = vSettings.monthsShort.indexOf(vDatePart); vMonth = self.getMonth(vDatePart);
if (vMonth > -1) { if (vMonth > 0) {
out.month = vMonth + 1; out.month = vMonth;
} } else {
vMonth = vSettings.months.indexOf(vDatePart); return null;
if (vMonth > -1) {
out.month = vMonth + 1;
} }
} else { } else {
if (iDatePart >= 1 && iDatePart <= 12) { if (iDatePart >= 1 && iDatePart <= 12) {
out.month = iDatePart; out.month = iDatePart;
} else {
return null;
} }
} }
vDateFlag = true; vDateFlag = true;
@ -140,6 +161,8 @@ var DateFormatter;
case 'j': case 'j':
if (iDatePart >= 1 && iDatePart <= 31) { if (iDatePart >= 1 && iDatePart <= 31) {
out.day = iDatePart; out.day = iDatePart;
} else {
return null;
} }
vDateFlag = true; vDateFlag = true;
break; break;
@ -148,16 +171,22 @@ var DateFormatter;
vMeriIndex = (vFormatParts.indexOf('a') > -1) ? vFormatParts.indexOf('a') : vMeriIndex = (vFormatParts.indexOf('a') > -1) ? vFormatParts.indexOf('a') :
(vFormatParts.indexOf('A') > -1) ? vFormatParts.indexOf('A') : -1; (vFormatParts.indexOf('A') > -1) ? vFormatParts.indexOf('A') : -1;
mer = vDateParts[vMeriIndex]; mer = vDateParts[vMeriIndex];
if (vMeriIndex > -1) { if (vMeriIndex !== -1) {
vMeriOffset = _compare(mer, vSettings.meridiem[0]) ? 0 : vMeriOffset = _compare(mer, vSettings.meridiem[0]) ? 0 :
(_compare(mer, vSettings.meridiem[1]) ? 12 : -1); (_compare(mer, vSettings.meridiem[1]) ? 12 : -1);
if (iDatePart >= 1 && iDatePart <= 12 && vMeriOffset > -1) { if (iDatePart >= 1 && iDatePart <= 12 && vMeriOffset !== -1) {
out.hour = iDatePart + vMeriOffset; out.hour = iDatePart % 12 === 0 ? vMeriOffset : iDatePart + vMeriOffset;
} else if (iDatePart >= 0 && iDatePart <= 23) { } else {
out.hour = iDatePart; if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart;
}
}
} else {
if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart;
} else {
return null;
} }
} else if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart;
} }
vTimeFlag = true; vTimeFlag = true;
break; break;
@ -165,18 +194,24 @@ var DateFormatter;
case 'H': case 'H':
if (iDatePart >= 0 && iDatePart <= 23) { if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart; out.hour = iDatePart;
} else {
return null;
} }
vTimeFlag = true; vTimeFlag = true;
break; break;
case 'i': case 'i':
if (iDatePart >= 0 && iDatePart <= 59) { if (iDatePart >= 0 && iDatePart <= 59) {
out.min = iDatePart; out.min = iDatePart;
} else {
return null;
} }
vTimeFlag = true; vTimeFlag = true;
break; break;
case 's': case 's':
if (iDatePart >= 0 && iDatePart <= 59) { if (iDatePart >= 0 && iDatePart <= 59) {
out.sec = iDatePart; out.sec = iDatePart;
} else {
return null;
} }
vTimeFlag = true; vTimeFlag = true;
break; break;
@ -186,7 +221,7 @@ var DateFormatter;
out.date = new Date(out.year, out.month - 1, out.day, out.hour, out.min, out.sec, 0); out.date = new Date(out.year, out.month - 1, out.day, out.hour, out.min, out.sec, 0);
} else { } else {
if (vTimeFlag !== true) { if (vTimeFlag !== true) {
return false; return null;
} }
out.date = new Date(0, 0, 0, out.hour, out.min, out.sec, 0); out.date = new Date(0, 0, 0, out.hour, out.min, out.sec, 0);
} }
@ -196,8 +231,8 @@ var DateFormatter;
if (typeof vDateStr !== 'string') { if (typeof vDateStr !== 'string') {
return vDateStr; return vDateStr;
} }
var self = this, vParts = vDateStr.replace(self.separators, '\0').split('\0'), vPattern = /^[djmn]/g, var self = this, vParts = vDateStr.replace(self.separators, '\0').split('\0'), vPattern = /^[djmn]/g, len,
vFormatParts = vFormat.match(self.validParts), vDate = new Date(), vDigit = 0, vYear, i, iPart, iSec; vFormatParts = vFormat.match(self.validParts), vDate = new Date(), vDigit = 0, vYear, i, n, iPart, iSec;
if (!vPattern.test(vFormatParts[0])) { if (!vPattern.test(vFormatParts[0])) {
return vDateStr; return vDateStr;
@ -207,6 +242,9 @@ var DateFormatter;
vDigit = 2; vDigit = 2;
iPart = vParts[i]; iPart = vParts[i];
iSec = parseInt(iPart.substr(0, 2)); iSec = parseInt(iPart.substr(0, 2));
if (isNaN(iSec)) {
return null;
}
switch (i) { switch (i) {
case 0: case 0:
if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') { if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') {
@ -224,13 +262,13 @@ var DateFormatter;
break; break;
case 2: case 2:
vYear = vDate.getFullYear(); vYear = vDate.getFullYear();
if (iPart.length < 4) { len = iPart.length;
vDate.setFullYear(parseInt(vYear.toString().substr(0, 4 - iPart.length) + iPart)); vDigit = len < 4 ? len : 4;
vDigit = iPart.length; vYear = parseInt(len < 4 ? vYear.toString().substr(0, 4 - len) + iPart : iPart.substr(0, 4));
} else { if (!vYear) {
vDate.setFullYear = parseInt(iPart.substr(0, 4)); return null;
vDigit = 4;
} }
vDate.setFullYear(vYear);
break; break;
case 3: case 3:
vDate.setHours(iSec); vDate.setHours(iSec);
@ -242,14 +280,15 @@ var DateFormatter;
vDate.setSeconds(iSec); vDate.setSeconds(iSec);
break; break;
} }
if (iPart.substr(vDigit).length > 0) { n = iPart.substr(vDigit);
vParts.splice(i + 1, 0, iPart.substr(vDigit)); if (n.length > 0) {
vParts.splice(i + 1, 0, n);
} }
} }
return vDate; return vDate;
}, },
parseFormat: function (vChar, vDate) { parseFormat: function (vChar, vDate) {
var self = this, vSettings = self.dateSettings, fmt, backspace = /\\?(.?)/gi, doFormat = function (t, s) { var self = this, vSettings = self.dateSettings, fmt, backslash = /\\?(.?)/gi, doFormat = function (t, s) {
return fmt[t] ? fmt[t]() : s; return fmt[t] ? fmt[t]() : s;
}; };
fmt = { fmt = {
@ -479,14 +518,6 @@ var DateFormatter;
var str = /\((.*)\)/.exec(String(vDate))[1]; var str = /\((.*)\)/.exec(String(vDate))[1];
return str || 'Coordinated Universal Time'; return str || 'Coordinated Universal Time';
}, },
/**
* Timezone abbreviation: `e.g. EST, MDT, ...`
* @return {string}
*/
T: function () {
var str = (String(vDate).match(self.tzParts) || [""]).pop().replace(self.tzClip, "");
return str || 'UTC';
},
/** /**
* DST observed? `0 or 1` * DST observed? `0 or 1`
* @return {number} * @return {number}
@ -512,6 +543,14 @@ var DateFormatter;
var O = fmt.O(); var O = fmt.O();
return (O.substr(0, 3) + ':' + O.substr(3, 2)); return (O.substr(0, 3) + ':' + O.substr(3, 2));
}, },
/**
* Timezone abbreviation: `e.g. EST, MDT, ...`
* @return {string}
*/
T: function () {
var str = (String(vDate).match(self.tzParts) || [""]).pop().replace(self.tzClip, "");
return str || 'UTC';
},
/** /**
* Timezone offset in seconds: `-43200...50400` * Timezone offset in seconds: `-43200...50400`
* @return {number} * @return {number}
@ -528,14 +567,14 @@ var DateFormatter;
* @return {string} * @return {string}
*/ */
c: function () { c: function () {
return 'Y-m-d\\TH:i:sP'.replace(backspace, doFormat); return 'Y-m-d\\TH:i:sP'.replace(backslash, doFormat);
}, },
/** /**
* RFC 2822 date * RFC 2822 date
* @return {string} * @return {string}
*/ */
r: function () { r: function () {
return 'D, d M Y H:i:s O'.replace(backspace, doFormat); return 'D, d M Y H:i:s O'.replace(backslash, doFormat);
}, },
/** /**
* Seconds since UNIX epoch * Seconds since UNIX epoch
@ -548,23 +587,27 @@ var DateFormatter;
return doFormat(vChar, vChar); return doFormat(vChar, vChar);
}, },
formatDate: function (vDate, vFormat) { formatDate: function (vDate, vFormat) {
var self = this, i, n, len, str, vChar, vDateStr = ''; var self = this, i, n, len, str, vChar, vDateStr = '', BACKSLASH = '\\';
if (typeof vDate === 'string') { if (typeof vDate === 'string') {
vDate = self.parseDate(vDate, vFormat); vDate = self.parseDate(vDate, vFormat);
if (vDate === false) { if (!vDate) {
return false; return null;
} }
} }
if (vDate instanceof Date) { if (vDate instanceof Date) {
len = vFormat.length; len = vFormat.length;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
vChar = vFormat.charAt(i); vChar = vFormat.charAt(i);
if (vChar === 'S') { if (vChar === 'S' || vChar === BACKSLASH) {
continue;
}
if (i > 0 && vFormat.charAt(i - 1) === BACKSLASH) {
vDateStr += vChar;
continue; continue;
} }
str = self.parseFormat(vChar, vDate); str = self.parseFormat(vChar, vDate);
if (i !== (len - 1) && self.intParts.test(vChar) && vFormat.charAt(i + 1) === 'S') { if (i !== (len - 1) && self.intParts.test(vChar) && vFormat.charAt(i + 1) === 'S') {
n = parseInt(str); n = parseInt(str) || 0;
str += self.dateSettings.ordinal(n); str += self.dateSettings.ordinal(n);
} }
vDateStr += str; vDateStr += str;
@ -574,7 +617,8 @@ var DateFormatter;
return ''; return '';
} }
}; };
})();/** })();
/**
* @preserve jQuery DateTimePicker plugin v2.5.4 * @preserve jQuery DateTimePicker plugin v2.5.4
* @homepage http://xdsoft.net/jqplugins/datetimepicker/ * @homepage http://xdsoft.net/jqplugins/datetimepicker/
* @author Chupurnov Valeriy (<chupurnov@gmail.com>) * @author Chupurnov Valeriy (<chupurnov@gmail.com>)
@ -593,9 +637,6 @@ var DateFormatter;
} }
}(function ($) { }(function ($) {
'use strict'; 'use strict';
var currentlyScrollingTimeDiv = false;
var default_options = { var default_options = {
i18n: { i18n: {
ar: { // Arabic ar: { // Arabic
@ -776,6 +817,13 @@ var DateFormatter;
"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör" "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
] ]
}, },
km: { // Khmer
months: [
"មករា​", "កុម្ភៈ", "មិនា​", "មេសា​", "ឧសភា​", "មិថុនា​", "កក្កដា​", "សីហា​", "កញ្ញា​", "តុលា​", "វិច្ឋិកា​", "ធ្នូ​"
],
dayOfWeekShort: ["អាទិ​", "ចន្ទ​", "អង្គារ​", "ពុធ​", "ព្រហ​​", "សុក្រ​", "សៅរ៍"],
dayOfWeek: ["អាទិត្យ​", "ចន្ទ​", "អង្គារ​", "ពុធ​", "ព្រហស្បតិ៍​", "សុក្រ​", "សៅរ៍"]
},
kr: { // Korean kr: { // Korean
months: [ months: [
"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월" "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
@ -1102,8 +1150,12 @@ var DateFormatter;
"კვ", "ორშ", "სამშ", "ოთხ", "ხუთ", "პარ", "შაბ" "კვ", "ორშ", "სამშ", "ოთხ", "ხუთ", "პარ", "შაბ"
], ],
dayOfWeek: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი"] dayOfWeek: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი"]
}, }
}, },
ownerDocument: document,
contentWindow: window,
value: '', value: '',
rtl: false, rtl: false,
@ -1209,12 +1261,14 @@ var DateFormatter;
days: locale.dayOfWeek, days: locale.dayOfWeek,
daysShort: locale.dayOfWeekShort, daysShort: locale.dayOfWeekShort,
months: locale.months, months: locale.months,
monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) }), monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) })
}; };
dateHelper = new DateFormatter({ if (typeof DateFormatter === 'function') {
dateSettings: $.extend({}, dateFormatterOptionsDefault, opts) dateHelper = new DateFormatter({
}); dateSettings: $.extend({}, dateFormatterOptionsDefault, opts)
});
}
}; };
// for locale settings // for locale settings
@ -1275,7 +1329,7 @@ var DateFormatter;
Date.prototype.countDaysInMonth = function () { Date.prototype.countDaysInMonth = function () {
return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate(); return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
}; };
$.fn.xdsoftScroller = function (percent) { $.fn.xdsoftScroller = function (options, percent) {
return this.each(function () { return this.each(function () {
var timeboxparent = $(this), var timeboxparent = $(this),
pointerEventToXY = function (e) { pointerEventToXY = function (e) {
@ -1339,15 +1393,15 @@ var DateFormatter;
h1 = scrollbar[0].offsetHeight; h1 = scrollbar[0].offsetHeight;
if (event.type === 'mousedown' || event.type === 'touchstart') { if (event.type === 'mousedown' || event.type === 'touchstart') {
if (document) { if (options.ownerDocument) {
$(document.body).addClass('xdsoft_noselect'); $(options.ownerDocument.body).addClass('xdsoft_noselect');
} }
$([document.body, window]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() { $([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
$([document.body, window]).off('touchend mouseup.xdsoft_scroller', arguments_callee) $([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
.off('mousemove.xdsoft_scroller', calcOffset) .off('mousemove.xdsoft_scroller', calcOffset)
.removeClass('xdsoft_noselect'); .removeClass('xdsoft_noselect');
}); });
$(document.body).on('mousemove.xdsoft_scroller', calcOffset); $(options.ownerDocument.body).on('mousemove.xdsoft_scroller', calcOffset);
} else { } else {
touchStart = true; touchStart = true;
event.stopPropagation(); event.stopPropagation();
@ -1556,14 +1610,14 @@ var DateFormatter;
} }
} }
select.xdsoftScroller(top / (select.children()[0].offsetHeight - (select[0].clientHeight))); select.xdsoftScroller(options, top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
event.stopPropagation(); event.stopPropagation();
return false; return false;
}); });
month_picker month_picker
.find('.xdsoft_select') .find('.xdsoft_select')
.xdsoftScroller() .xdsoftScroller(options)
.on('touchstart mousedown.xdsoft', function (event) { .on('touchstart mousedown.xdsoft', function (event) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
@ -1725,7 +1779,7 @@ var DateFormatter;
} }
if (!options.timepickerScrollbar) { if (!options.timepickerScrollbar) {
timeboxparent.xdsoftScroller('hide'); timeboxparent.xdsoftScroller(options, 'hide');
} }
if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) { if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) {
@ -1802,10 +1856,10 @@ var DateFormatter;
//scroll_element = timepicker.find('.xdsoft_time_box'); //scroll_element = timepicker.find('.xdsoft_time_box');
timeboxparent.append(timebox); timeboxparent.append(timebox);
timeboxparent.xdsoftScroller(); timeboxparent.xdsoftScroller(options);
datetimepicker.on('afterOpen.xdsoft', function () { datetimepicker.on('afterOpen.xdsoft', function () {
timeboxparent.xdsoftScroller(); timeboxparent.xdsoftScroller(options);
}); });
datetimepicker datetimepicker
@ -2063,10 +2117,10 @@ var DateFormatter;
} }
}(500)); }(500));
$([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee2() { $([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee2() {
clearTimeout(timer); clearTimeout(timer);
stop = true; stop = true;
$([document.body, window]).off('touchend mouseup.xdsoft', arguments_callee2); $([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft', arguments_callee2);
}); });
}); });
@ -2105,10 +2159,10 @@ var DateFormatter;
timer = setTimeout(arguments_callee4, v || period); timer = setTimeout(arguments_callee4, v || period);
} }
}(500)); }(500));
$([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee5() { $([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee5() {
clearTimeout(timer); clearTimeout(timer);
stop = true; stop = true;
$([document.body, window]) $([options.ownerDocument.body, options.contentWindow])
.off('touchend mouseup.xdsoft', arguments_callee5); .off('touchend mouseup.xdsoft', arguments_callee5);
}); });
}); });
@ -2413,13 +2467,8 @@ var DateFormatter;
}); });
timebox timebox
.on('touchmove', 'div', function () { currentlyScrollingTimeDiv = true; })
.on('touchend click.xdsoft', 'div', function (xdevent) { .on('touchend click.xdsoft', 'div', function (xdevent) {
xdevent.stopPropagation(); xdevent.stopPropagation();
if (currentlyScrollingTimeDiv) {
currentlyScrollingTimeDiv = false;
return;
}
var $this = $(this), var $this = $(this),
currentTime = _xdsoft_datetime.currentTime; currentTime = _xdsoft_datetime.currentTime;
@ -2558,11 +2607,11 @@ var DateFormatter;
left = dateInputOffset.left; left = dateInputOffset.left;
position = "absolute"; position = "absolute";
windowWidth = $(window).width(); windowWidth = $(options.contentWindow).width();
windowHeight = $(window).height(); windowHeight = $(options.contentWindow).height();
windowScrollTop = $(window).scrollTop(); windowScrollTop = $(options.contentWindow).scrollTop();
if ((document.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) { if ((options.ownerDocument.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) {
var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth; var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth;
left = left - diff; left = left - diff;
} }
@ -2573,13 +2622,13 @@ var DateFormatter;
if (options.fixed) { if (options.fixed) {
verticalPosition -= windowScrollTop; verticalPosition -= windowScrollTop;
left -= $(window).scrollLeft(); left -= $(options.contentWindow).scrollLeft();
position = "fixed"; position = "fixed";
} else { } else {
dateInputHasFixedAncestor = false; dateInputHasFixedAncestor = false;
forEachAncestorOf(dateInputElem, function (ancestorNode) { forEachAncestorOf(dateInputElem, function (ancestorNode) {
if (window.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') { if (options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') {
dateInputHasFixedAncestor = true; dateInputHasFixedAncestor = true;
return false; return false;
} }
@ -2615,7 +2664,7 @@ var DateFormatter;
forEachAncestorOf(datetimepickerElem, function (ancestorNode) { forEachAncestorOf(datetimepickerElem, function (ancestorNode) {
var ancestorNodePosition; var ancestorNodePosition;
ancestorNodePosition = window.getComputedStyle(ancestorNode).getPropertyValue('position'); ancestorNodePosition = options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position');
if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) { if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) {
left = left - ((windowWidth - ancestorNode.offsetWidth) / 2); left = left - ((windowWidth - ancestorNode.offsetWidth) / 2);
@ -2644,14 +2693,14 @@ var DateFormatter;
if (onShow !== false) { if (onShow !== false) {
datetimepicker.show(); datetimepicker.show();
setPos(); setPos();
$(window) $(options.contentWindow)
.off('resize.xdsoft', setPos) .off('resize.xdsoft', setPos)
.on('resize.xdsoft', setPos); .on('resize.xdsoft', setPos);
if (options.closeOnWithoutClick) { if (options.closeOnWithoutClick) {
$([document.body, window]).on('touchstart mousedown.xdsoft', function arguments_callee6() { $([options.ownerDocument.body, options.contentWindow]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
datetimepicker.trigger('close.xdsoft'); datetimepicker.trigger('close.xdsoft');
$([document.body, window]).off('touchstart mousedown.xdsoft', arguments_callee6); $([options.ownerDocument.body, options.contentWindow]).off('touchstart mousedown.xdsoft', arguments_callee6);
}); });
} }
} }
@ -2725,8 +2774,8 @@ var DateFormatter;
}, },
getCaretPos = function (input) { getCaretPos = function (input) {
try { try {
if (document.selection && document.selection.createRange) { if (options.ownerDocument.selection && options.ownerDocument.selection.createRange) {
var range = document.selection.createRange(); var range = options.ownerDocument.selection.createRange();
return range.getBookmark().charCodeAt(2) - 2; return range.getBookmark().charCodeAt(2) - 2;
} }
if (input.setSelectionRange) { if (input.setSelectionRange) {
@ -2737,7 +2786,7 @@ var DateFormatter;
} }
}, },
setCaretPos = function (node, pos) { setCaretPos = function (node, pos) {
node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node; node = (typeof node === "string" || node instanceof String) ? options.ownerDocument.getElementById(node) : node;
if (!node) { if (!node) {
return false; return false;
} }
@ -2888,14 +2937,14 @@ var DateFormatter;
input input
.data('xdsoft_datetimepicker', null) .data('xdsoft_datetimepicker', null)
.off('.xdsoft'); .off('.xdsoft');
$(window).off('resize.xdsoft'); $(options.contentWindow).off('resize.xdsoft');
$([window, document.body]).off('mousedown.xdsoft touchstart'); $([options.contentWindow, options.ownerDocument.body]).off('mousedown.xdsoft touchstart');
if (input.unmousewheel) { if (input.unmousewheel) {
input.unmousewheel(); input.unmousewheel();
} }
} }
}; };
$(document) $(options.ownerDocument)
.off('keydown.xdsoftctrl keyup.xdsoftctrl') .off('keydown.xdsoftctrl keyup.xdsoftctrl')
.on('keydown.xdsoftctrl', function (e) { .on('keydown.xdsoftctrl', function (e) {
if (e.keyCode === CTRLKEY) { if (e.keyCode === CTRLKEY) {
@ -2969,6 +3018,7 @@ var DateFormatter;
this.style = style; this.style = style;
} }
})); }));
/*! /*!
* jQuery Mousewheel 3.1.13 * jQuery Mousewheel 3.1.13
* *

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -197,6 +197,13 @@
"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör" "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
] ]
}, },
km: { // Khmer
months: [
"មករា​", "កុម្ភៈ", "មិនា​", "មេសា​", "ឧសភា​", "មិថុនា​", "កក្កដា​", "សីហា​", "កញ្ញា​", "តុលា​", "វិច្ឋិកា​", "ធ្នូ​"
],
dayOfWeekShort: ["អាទិ​", "ចន្ទ​", "អង្គារ​", "ពុធ​", "ព្រហ​​", "សុក្រ​", "សៅរ៍"],
dayOfWeek: ["អាទិត្យ​", "ចន្ទ​", "អង្គារ​", "ពុធ​", "ព្រហស្បតិ៍​", "សុក្រ​", "សៅរ៍"]
},
kr: { // Korean kr: { // Korean
months: [ months: [
"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월" "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"

208
yarn.lock Normal file
View File

@ -0,0 +1,208 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
amdefine@>=0.0.4:
version "1.0.1"
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
async@~0.2.6:
version "0.2.10"
resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
camelcase@^2.0.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"
chalk@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
dependencies:
ansi-styles "^2.2.1"
escape-string-regexp "^1.0.2"
has-ansi "^2.0.0"
strip-ansi "^3.0.0"
supports-color "^2.0.0"
cliui@^3.0.3:
version "3.2.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
dependencies:
string-width "^1.0.1"
strip-ansi "^3.0.1"
wrap-ansi "^2.0.0"
code-point-at@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
commander@^2.9.0:
version "2.9.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4"
dependencies:
graceful-readlink ">= 1.0.0"
concat-cli@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/concat-cli/-/concat-cli-4.0.0.tgz#a73a0fb0d18b25804ebe703bcc35922324dbf74d"
dependencies:
chalk "^1.1.1"
concat "^1.0.0"
yargs "^3.30.0"
concat@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/concat/-/concat-1.0.3.tgz#40f3353089d65467695cb1886b45edd637d8cca8"
dependencies:
commander "^2.9.0"
concat@azer/concat:
version "1.0.0"
resolved "https://codeload.github.com/azer/concat/tar.gz/c64c5cbc2e60b0bc1a8f4bceafed661f66f19dcf"
dependencies:
parallel-loop azer/parallel-loop
serial-loop azer/serial-loop
decamelize@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
escape-string-regexp@^1.0.2:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
"graceful-readlink@>= 1.0.0":
version "1.0.1"
resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725"
has-ansi@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
dependencies:
ansi-regex "^2.0.0"
invert-kv@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
is-fullwidth-code-point@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb"
dependencies:
number-is-nan "^1.0.0"
"jquery-mousewheel@>= 3.1.13":
version "3.1.13"
resolved "https://registry.yarnpkg.com/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz#06f0335f16e353a695e7206bf50503cb523a6ee5"
"jquery@>= 1.7.2":
version "3.2.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787"
lcid@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835"
dependencies:
invert-kv "^1.0.0"
number-is-nan@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"
os-locale@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9"
dependencies:
lcid "^1.0.0"
parallel-loop@azer/parallel-loop:
version "0.0.2"
resolved "https://codeload.github.com/azer/parallel-loop/tar.gz/054b0d3fe633483a3a6b94104c8343473208d5fb"
"php-date-formatter@>= 1.3.3":
version "1.3.4"
resolved "https://registry.yarnpkg.com/php-date-formatter/-/php-date-formatter-1.3.4.tgz#09a15ae0766ba0beb1900c27c1ec319ef2e4563e"
serial-loop@azer/serial-loop:
version "0.0.1"
resolved "https://codeload.github.com/azer/serial-loop/tar.gz/99c6271f80f075b7db089a1aadc7178a310a4570"
source-map@0.1.34:
version "0.1.34"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.34.tgz#a7cfe89aec7b1682c3b198d0acfb47d7d090566b"
dependencies:
amdefine ">=0.0.4"
string-width@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
dependencies:
code-point-at "^1.0.0"
is-fullwidth-code-point "^1.0.0"
strip-ansi "^3.0.0"
strip-ansi@^3.0.0, strip-ansi@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
dependencies:
ansi-regex "^2.0.0"
supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
uglify-to-browserify@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
uglifycss@0.0.20:
version "0.0.20"
resolved "https://registry.yarnpkg.com/uglifycss/-/uglifycss-0.0.20.tgz#0f953c3cf989f9ff7447cba24f9999687c9a5910"
uglifyjs@^2.4.10:
version "2.4.10"
resolved "https://registry.yarnpkg.com/uglifyjs/-/uglifyjs-2.4.10.tgz#632927319fa6a3da3fc91f9773ac27bfe6c3ee92"
dependencies:
async "~0.2.6"
source-map "0.1.34"
uglify-to-browserify "~1.0.0"
yargs "~1.3.3"
window-size@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.4.tgz#f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876"
wrap-ansi@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"
dependencies:
string-width "^1.0.1"
strip-ansi "^3.0.1"
y18n@^3.2.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
yargs@^3.30.0:
version "3.32.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995"
dependencies:
camelcase "^2.0.1"
cliui "^3.0.3"
decamelize "^1.1.1"
os-locale "^1.4.0"
string-width "^1.0.1"
window-size "^0.1.4"
y18n "^3.2.0"
yargs@~1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-1.3.3.tgz#054de8b61f22eefdb7207059eaef9d6b83fb931a"