|
163 | 163 | /*
|
164 | 164 | * Create a new Timepicker instance
|
165 | 165 | */
|
166 |
| - _newInst: function($input, o) { |
| 166 | + _newInst: function($input, opts) { |
167 | 167 | var tp_inst = new Timepicker(),
|
168 | 168 | inlineSettings = {},
|
169 | 169 | fns = {},
|
|
206 | 206 | };
|
207 | 207 | for (i in overrides) {
|
208 | 208 | if (overrides.hasOwnProperty(i)) {
|
209 |
| - fns[i] = o[i] || null; |
| 209 | + fns[i] = opts[i] || null; |
210 | 210 | }
|
211 | 211 | }
|
212 | 212 |
|
213 |
| - tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, overrides, { |
| 213 | + tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, { |
214 | 214 | evnts:fns,
|
215 | 215 | timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
|
216 | 216 | });
|
|
270 | 270 | tp_inst.ampm = '';
|
271 | 271 | tp_inst.$input = $input;
|
272 | 272 |
|
273 |
| - if (o.altField) { |
274 |
| - tp_inst.$altInput = $(o.altField).css({ |
| 273 | + if (tp_inst._defaults.altField) { |
| 274 | + tp_inst.$altInput = $(tp_inst._defaults.altField).css({ |
275 | 275 | cursor: 'pointer'
|
276 | 276 | }).focus(function() {
|
277 | 277 | $input.trigger("focus");
|
|
1755 | 1755 | * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
|
1756 | 1756 | * it will return false for all objects
|
1757 | 1757 | */
|
1758 |
| - function isEmptyObject(obj) { |
| 1758 | + var isEmptyObject = function(obj) { |
1759 | 1759 | var prop;
|
1760 | 1760 | for (prop in obj) {
|
1761 | 1761 | if (obj.hasOwnProperty(obj)) {
|
|
1768 | 1768 | /*
|
1769 | 1769 | * jQuery extend now ignores nulls!
|
1770 | 1770 | */
|
1771 |
| - function extendRemove(target, props) { |
| 1771 | + var extendRemove = function(target, props) { |
1772 | 1772 | $.extend(target, props);
|
1773 | 1773 | for (var name in props) {
|
1774 | 1774 | if (props[name] === null || props[name] === undefined) {
|
|
1782 | 1782 | * Determine by the time format which units are supported
|
1783 | 1783 | * Returns an object of booleans for each unit
|
1784 | 1784 | */
|
1785 |
| - function detectSupport(timeFormat){ |
| 1785 | + var detectSupport = function(timeFormat){ |
1786 | 1786 | var tf = timeFormat.replace(/\'.*?\'/g,'').toLowerCase(), // removes literals
|
1787 | 1787 | isIn = function(f, t){ // does the format contain the token?
|
1788 | 1788 | return f.indexOf(t) !== -1? true:false;
|
|
1803 | 1803 | * Converts 24 hour format into 12 hour
|
1804 | 1804 | * Returns 12 hour without leading 0
|
1805 | 1805 | */
|
1806 |
| - function convert24to12(hour) { |
| 1806 | + var convert24to12 = function(hour) { |
1807 | 1807 | if (hour > 12) {
|
1808 | 1808 | hour = hour - 12;
|
1809 | 1809 | }
|
|
1820 | 1820 | * Throws exception when date can't be parsed
|
1821 | 1821 | * Returns [dateString, timeString]
|
1822 | 1822 | */
|
1823 |
| - function splitDateTime(dateFormat, dateTimeString, dateSettings, timeSettings) { |
| 1823 | + var splitDateTime = function(dateFormat, dateTimeString, dateSettings, timeSettings) { |
1824 | 1824 | try {
|
1825 | 1825 | // The idea is to get the number separator occurances in datetime and the time format requested (since time has
|
1826 | 1826 | // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
|
|
1868 | 1868 | * date - parsed date without time (type Date)
|
1869 | 1869 | * timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional
|
1870 | 1870 | */
|
1871 |
| - function parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) { |
| 1871 | + var parseDateTimeInternal = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) { |
1872 | 1872 | var date;
|
1873 | 1873 | var splitRes = splitDateTime(dateFormat, dateTimeString, dateSettings, timeSettings);
|
1874 | 1874 | date = $.datepicker._base_parseDate(dateFormat, splitRes[0], dateSettings);
|
|
1893 | 1893 | /*
|
1894 | 1894 | * Internal function to set timezone_select to the local timezone
|
1895 | 1895 | */
|
1896 |
| - function selectLocalTimezone(tp_inst, date) { |
| 1896 | + var selectLocalTimezone = function(tp_inst, date) { |
1897 | 1897 | if (tp_inst && tp_inst.timezone_select) {
|
1898 | 1898 | var now = typeof date !== 'undefined' ? date : new Date();
|
1899 | 1899 | tp_inst.timezone_select.val(now.getTimezoneOffset()*-1);
|
|
0 commit comments