simple_form_extension 1.3.8 → 1.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c2f9eca67627bf92f6fbfd5d90eee53656fded94
|
|
4
|
+
data.tar.gz: 1cc1a4705ce5eb37f29cb00a753f4b5e219c7a8c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0036bcfe117ca497817ae4d4f64427999c50a2accdca33db850880aeb6b17e0c5a811b95fdf4e00d0cea638a8b8287f8ec9a77848385ffb02a115d3c0747e0d3
|
|
7
|
+
data.tar.gz: 07be85c41d1393d8abfd3e8f05c173c694d597ba5a564f73a2466817eb91bcf611ee2eaa8b805ec03e33c934bda192870ce47b0ccde2e03af6d7c7141b302a61
|
|
@@ -4,18 +4,7 @@
|
|
|
4
4
|
* (c) 2014, Chupurnov Valeriy.
|
|
5
5
|
*/
|
|
6
6
|
/*global document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/
|
|
7
|
-
|
|
8
|
-
if ( typeof define === 'function' && define.amd ) {
|
|
9
|
-
// AMD. Register as an anonymous module.
|
|
10
|
-
define(['jquery', 'jquery-mousewheel', 'date-functions'], factory);
|
|
11
|
-
} else if (typeof exports === 'object') {
|
|
12
|
-
// Node/CommonJS style for Browserify
|
|
13
|
-
module.exports = factory;
|
|
14
|
-
} else {
|
|
15
|
-
// Browser globals
|
|
16
|
-
factory(jQuery);
|
|
17
|
-
}
|
|
18
|
-
}(function ($) {
|
|
7
|
+
(function ($) {
|
|
19
8
|
'use strict';
|
|
20
9
|
var default_options = {
|
|
21
10
|
i18n: {
|
|
@@ -592,7 +581,7 @@
|
|
|
592
581
|
enterLikeTab: true,
|
|
593
582
|
showApplyButton: false
|
|
594
583
|
};
|
|
595
|
-
|
|
584
|
+
|
|
596
585
|
var globalLocaleDefault = 'en',
|
|
597
586
|
globalLocale = 'en';
|
|
598
587
|
// for locale settings
|
|
@@ -604,7 +593,7 @@
|
|
|
604
593
|
Date.dayNames = default_options.i18n[globalLocale].dayOfWeek;
|
|
605
594
|
}
|
|
606
595
|
};
|
|
607
|
-
|
|
596
|
+
|
|
608
597
|
// fix for ie8
|
|
609
598
|
if (!window.getComputedStyle) {
|
|
610
599
|
window.getComputedStyle = function (el, pseudo) {
|
|
@@ -700,12 +689,12 @@
|
|
|
700
689
|
startTopScroll = parseInt(scroller.css('margin-top'), 10);
|
|
701
690
|
h1 = scrollbar[0].offsetHeight;
|
|
702
691
|
|
|
703
|
-
if (event.type === 'mousedown'
|
|
692
|
+
if (event.type === 'mousedown') {
|
|
704
693
|
if (document) {
|
|
705
694
|
$(document.body).addClass('xdsoft_noselect');
|
|
706
695
|
}
|
|
707
|
-
$([document.body, window]).on('
|
|
708
|
-
$([document.body, window]).off('
|
|
696
|
+
$([document.body, window]).on('mouseup.xdsoft_scroller', function arguments_callee() {
|
|
697
|
+
$([document.body, window]).off('mouseup.xdsoft_scroller', arguments_callee)
|
|
709
698
|
.off('mousemove.xdsoft_scroller', calcOffset)
|
|
710
699
|
.removeClass('xdsoft_noselect');
|
|
711
700
|
});
|
|
@@ -792,7 +781,7 @@
|
|
|
792
781
|
timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
|
|
793
782
|
});
|
|
794
783
|
};
|
|
795
|
-
|
|
784
|
+
|
|
796
785
|
$.fn.datetimepicker = function (opt) {
|
|
797
786
|
var KEY0 = 48,
|
|
798
787
|
KEY9 = 57,
|
|
@@ -823,7 +812,7 @@
|
|
|
823
812
|
|
|
824
813
|
lazyInit = function (input) {
|
|
825
814
|
input
|
|
826
|
-
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft
|
|
815
|
+
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function initOnActionCallback(event) {
|
|
827
816
|
if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
|
|
828
817
|
return;
|
|
829
818
|
}
|
|
@@ -834,7 +823,7 @@
|
|
|
834
823
|
createDateTimePicker(input);
|
|
835
824
|
}
|
|
836
825
|
input
|
|
837
|
-
.off('open.xdsoft focusin.xdsoft mousedown.xdsoft
|
|
826
|
+
.off('open.xdsoft focusin.xdsoft mousedown.xdsoft', initOnActionCallback)
|
|
838
827
|
.trigger('open.xdsoft');
|
|
839
828
|
}, 100);
|
|
840
829
|
});
|
|
@@ -893,7 +882,7 @@
|
|
|
893
882
|
|
|
894
883
|
mounth_picker
|
|
895
884
|
.find('.xdsoft_month,.xdsoft_year')
|
|
896
|
-
.on('
|
|
885
|
+
.on('mousedown.xdsoft', function (event) {
|
|
897
886
|
var select = $(this).find('.xdsoft_select').eq(0),
|
|
898
887
|
val = 0,
|
|
899
888
|
top = 0,
|
|
@@ -925,11 +914,12 @@
|
|
|
925
914
|
mounth_picker
|
|
926
915
|
.find('.xdsoft_select')
|
|
927
916
|
.xdsoftScroller()
|
|
928
|
-
.on('
|
|
917
|
+
.on('mousedown.xdsoft', function (event) {
|
|
929
918
|
event.stopPropagation();
|
|
930
919
|
event.preventDefault();
|
|
931
920
|
})
|
|
932
|
-
.on('
|
|
921
|
+
.on('mousedown.xdsoft', '.xdsoft_option', function (event) {
|
|
922
|
+
|
|
933
923
|
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
|
|
934
924
|
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
|
|
935
925
|
}
|
|
@@ -951,7 +941,7 @@
|
|
|
951
941
|
}
|
|
952
942
|
});
|
|
953
943
|
|
|
954
|
-
datetimepicker.setOptions = function (_options) {
|
|
944
|
+
datetimepicker.setOptions = function (_options) {
|
|
955
945
|
var highlightedDates = {},
|
|
956
946
|
getCaretPos = function (input) {
|
|
957
947
|
try {
|
|
@@ -1248,7 +1238,7 @@
|
|
|
1248
1238
|
|
|
1249
1239
|
datetimepicker
|
|
1250
1240
|
.data('options', options)
|
|
1251
|
-
.on('
|
|
1241
|
+
.on('mousedown.xdsoft', function (event) {
|
|
1252
1242
|
event.stopPropagation();
|
|
1253
1243
|
event.preventDefault();
|
|
1254
1244
|
yearselect.hide();
|
|
@@ -1448,7 +1438,7 @@
|
|
|
1448
1438
|
|
|
1449
1439
|
_xdsoft_datetime = new XDSoft_datetime();
|
|
1450
1440
|
|
|
1451
|
-
applyButton.on('
|
|
1441
|
+
applyButton.on('click', function (e) {//pathbrite
|
|
1452
1442
|
e.preventDefault();
|
|
1453
1443
|
datetimepicker.data('changed', true);
|
|
1454
1444
|
_xdsoft_datetime.setCurrentTime(getCurrentValue());
|
|
@@ -1457,7 +1447,7 @@
|
|
|
1457
1447
|
});
|
|
1458
1448
|
mounth_picker
|
|
1459
1449
|
.find('.xdsoft_today_button')
|
|
1460
|
-
.on('
|
|
1450
|
+
.on('mousedown.xdsoft', function () {
|
|
1461
1451
|
datetimepicker.data('changed', true);
|
|
1462
1452
|
_xdsoft_datetime.setCurrentTime(0);
|
|
1463
1453
|
datetimepicker.trigger('afterOpen.xdsoft');
|
|
@@ -1480,7 +1470,7 @@
|
|
|
1480
1470
|
});
|
|
1481
1471
|
mounth_picker
|
|
1482
1472
|
.find('.xdsoft_prev,.xdsoft_next')
|
|
1483
|
-
.on('
|
|
1473
|
+
.on('mousedown.xdsoft', function () {
|
|
1484
1474
|
var $this = $(this),
|
|
1485
1475
|
timer = 0,
|
|
1486
1476
|
stop = false;
|
|
@@ -1498,16 +1488,16 @@
|
|
|
1498
1488
|
}
|
|
1499
1489
|
}(500));
|
|
1500
1490
|
|
|
1501
|
-
$([document.body, window]).on('
|
|
1491
|
+
$([document.body, window]).on('mouseup.xdsoft', function arguments_callee2() {
|
|
1502
1492
|
clearTimeout(timer);
|
|
1503
1493
|
stop = true;
|
|
1504
|
-
$([document.body, window]).off('
|
|
1494
|
+
$([document.body, window]).off('mouseup.xdsoft', arguments_callee2);
|
|
1505
1495
|
});
|
|
1506
1496
|
});
|
|
1507
1497
|
|
|
1508
1498
|
timepicker
|
|
1509
1499
|
.find('.xdsoft_prev,.xdsoft_next')
|
|
1510
|
-
.on('
|
|
1500
|
+
.on('mousedown.xdsoft', function () {
|
|
1511
1501
|
var $this = $(this),
|
|
1512
1502
|
timer = 0,
|
|
1513
1503
|
stop = false,
|
|
@@ -1527,11 +1517,11 @@
|
|
|
1527
1517
|
timer = setTimeout(arguments_callee4, v || period);
|
|
1528
1518
|
}
|
|
1529
1519
|
}(500));
|
|
1530
|
-
$([document.body, window]).on('
|
|
1520
|
+
$([document.body, window]).on('mouseup.xdsoft', function arguments_callee5() {
|
|
1531
1521
|
clearTimeout(timer);
|
|
1532
1522
|
stop = true;
|
|
1533
1523
|
$([document.body, window])
|
|
1534
|
-
.off('
|
|
1524
|
+
.off('mouseup.xdsoft', arguments_callee5);
|
|
1535
1525
|
});
|
|
1536
1526
|
});
|
|
1537
1527
|
|
|
@@ -1681,10 +1671,8 @@
|
|
|
1681
1671
|
time = '';
|
|
1682
1672
|
h = '';
|
|
1683
1673
|
m = '';
|
|
1684
|
-
|
|
1685
1674
|
line_time = function line_time(h, m) {
|
|
1686
|
-
var now = _xdsoft_datetime.now(), optionDateTime, current_time
|
|
1687
|
-
isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length;
|
|
1675
|
+
var now = _xdsoft_datetime.now(), optionDateTime, current_time;
|
|
1688
1676
|
now.setHours(h);
|
|
1689
1677
|
h = parseInt(now.getHours(), 10);
|
|
1690
1678
|
now.setMinutes(m);
|
|
@@ -1702,12 +1690,9 @@
|
|
|
1702
1690
|
|
|
1703
1691
|
current_time = new Date(_xdsoft_datetime.currentTime);
|
|
1704
1692
|
current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
|
|
1705
|
-
|
|
1706
|
-
if (!isALlowTimesInit) {
|
|
1707
|
-
current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
|
|
1708
|
-
}
|
|
1693
|
+
current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
|
|
1709
1694
|
|
|
1710
|
-
if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && (
|
|
1695
|
+
if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && (options.step > 59 || current_time.getMinutes() === parseInt(m, 10))) {
|
|
1711
1696
|
if (options.defaultSelect || datetimepicker.data('changed')) {
|
|
1712
1697
|
classes.push('xdsoft_current');
|
|
1713
1698
|
} else if (options.initTime) {
|
|
@@ -1780,7 +1765,7 @@
|
|
|
1780
1765
|
|
|
1781
1766
|
timerclick = 0;
|
|
1782
1767
|
calendar
|
|
1783
|
-
.on('
|
|
1768
|
+
.on('click.xdsoft', 'td', function (xdevent) {
|
|
1784
1769
|
xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
|
|
1785
1770
|
timerclick += 1;
|
|
1786
1771
|
var $this = $(this),
|
|
@@ -1820,7 +1805,7 @@
|
|
|
1820
1805
|
});
|
|
1821
1806
|
|
|
1822
1807
|
timebox
|
|
1823
|
-
.on('
|
|
1808
|
+
.on('click.xdsoft', 'div', function (xdevent) {
|
|
1824
1809
|
xdevent.stopPropagation();
|
|
1825
1810
|
var $this = $(this),
|
|
1826
1811
|
currentTime = _xdsoft_datetime.currentTime;
|
|
@@ -1961,9 +1946,9 @@
|
|
|
1961
1946
|
.on('resize.xdsoft', setPos);
|
|
1962
1947
|
|
|
1963
1948
|
if (options.closeOnWithoutClick) {
|
|
1964
|
-
$([document.body, window]).on('
|
|
1949
|
+
$([document.body, window]).on('mousedown.xdsoft', function arguments_callee6() {
|
|
1965
1950
|
datetimepicker.trigger('close.xdsoft');
|
|
1966
|
-
$([document.body, window]).off('
|
|
1951
|
+
$([document.body, window]).off('mousedown.xdsoft', arguments_callee6);
|
|
1967
1952
|
});
|
|
1968
1953
|
}
|
|
1969
1954
|
}
|
|
@@ -2029,7 +2014,7 @@
|
|
|
2029
2014
|
|
|
2030
2015
|
input
|
|
2031
2016
|
.data('xdsoft_datetimepicker', datetimepicker)
|
|
2032
|
-
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft
|
|
2017
|
+
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function (event) {
|
|
2033
2018
|
if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
|
|
2034
2019
|
return;
|
|
2035
2020
|
}
|
|
@@ -2069,7 +2054,7 @@
|
|
|
2069
2054
|
.data('xdsoft_datetimepicker', null)
|
|
2070
2055
|
.off('.xdsoft');
|
|
2071
2056
|
$(window).off('resize.xdsoft');
|
|
2072
|
-
$([window, document.body]).off('mousedown.xdsoft
|
|
2057
|
+
$([window, document.body]).off('mousedown.xdsoft');
|
|
2073
2058
|
if (input.unmousewheel) {
|
|
2074
2059
|
input.unmousewheel();
|
|
2075
2060
|
}
|
|
@@ -2133,12 +2118,39 @@
|
|
|
2133
2118
|
});
|
|
2134
2119
|
};
|
|
2135
2120
|
$.fn.datetimepicker.defaults = default_options;
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2121
|
+
}(jQuery));
|
|
2122
|
+
|
|
2123
|
+
function HighlightedDate(date, desc, style) {
|
|
2124
|
+
"use strict";
|
|
2125
|
+
this.date = date;
|
|
2126
|
+
this.desc = desc;
|
|
2127
|
+
this.style = style;
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
(function () {
|
|
2131
|
+
|
|
2132
|
+
/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
|
|
2133
|
+
* Licensed under the MIT License (LICENSE.txt).
|
|
2134
|
+
*
|
|
2135
|
+
* Version: 3.1.12
|
|
2136
|
+
*
|
|
2137
|
+
* Requires: jQuery 1.2.2+
|
|
2138
|
+
*/
|
|
2139
|
+
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
|
|
2140
|
+
|
|
2141
|
+
// Parse and Format Library
|
|
2142
|
+
//http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/
|
|
2143
|
+
/*
|
|
2144
|
+
* Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
|
|
2145
|
+
*
|
|
2146
|
+
* This program is free software; you can redistribute it and/or modify it
|
|
2147
|
+
* under the terms of the GNU Lesser General Public License as published by the
|
|
2148
|
+
* Free Software Foundation, version 2.1.
|
|
2149
|
+
*
|
|
2150
|
+
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
2151
|
+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
2152
|
+
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
2153
|
+
* details.
|
|
2154
|
+
*/
|
|
2155
|
+
Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000);}if(Date.formatFunctions[b]==null){Date.createNewFormat(b);}var a=Date.formatFunctions[b];return this[a]();};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var codePrefix="Date.prototype."+funcName+" = function() {return ";var code="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;code+="'"+String.escape(ch)+"' + ";}else{code+=Date.getFormatCode(ch);}}}if(code.length==0){code="\"\"";}else{code=code.substring(0,code.length-3);}eval(codePrefix+code+";}");};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,c){if(c=="unixtime"){return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0);}if(Date.parseFunctions[c]==null){Date.createParser(c);}var b=Date.parseFunctions[c];return Date[b](a);};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {";var regex="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;regex+=String.escape(ch);}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c;}}}}code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$",'i');eval(code);};Date.formatCodeToRegex=function(b,a){switch(b){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["+a+"], 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:1,c:"z = parseInt(results["+a+"], 10);\n",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["+a+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"]], 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["+a+"], 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["+a+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+a+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+a+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+a+"] == 'AM') {\nif (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["+a+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+a+"], 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(b)};}};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 b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b];}return a+this.getDate();};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay());var a=new Date(this.getFullYear(),0,1);var c=(7-a.getDay()+4);return String.leftPad(Math.ceil((b-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(d,b,c){var a=new String(d);if(c==null){c=" ";}while(a.length<b){a=c+a;}return a;};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"};
|
|
2156
|
+
}());
|