rails_admin 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails_admin might be problematic. Click here for more details.
- data/app/assets/javascripts/rails_admin/custom/ui.coffee +1 -0
- data/app/assets/javascripts/rails_admin/jquery.remotipart.fixed.js +72 -0
- data/app/assets/javascripts/rails_admin/jquery.ui.timepicker.js +303 -241
- data/app/assets/javascripts/rails_admin/ra.remote-form.js +5 -6
- data/app/assets/javascripts/rails_admin/ra.widgets.coffee +1 -1
- data/app/assets/javascripts/rails_admin/rails_admin.js +21 -0
- data/app/assets/javascripts/rails_admin/{ui.js.coffee → ui.coffee} +0 -0
- data/app/assets/stylesheets/rails_admin/aristo/jquery-ui-1.8.7.custom.scss +733 -0
- data/app/assets/stylesheets/rails_admin/base/mixins.scss +1 -0
- data/app/assets/stylesheets/rails_admin/base/theming.scss +270 -0
- data/app/assets/stylesheets/rails_admin/base/variables.scss +1 -0
- data/app/assets/stylesheets/rails_admin/custom/{mixins.css.scss → mixins.scss} +0 -0
- data/app/assets/stylesheets/rails_admin/custom/{theming.css.scss → theming.scss} +0 -0
- data/app/assets/stylesheets/rails_admin/custom/{variables.css.scss → variables.scss} +0 -0
- data/app/assets/stylesheets/rails_admin/{jquery.colorpicker.css.scss → jquery.colorpicker.scss} +0 -0
- data/app/assets/stylesheets/rails_admin/{jquery.ui.timepicker.css.scss → jquery.ui.timepicker.scss} +12 -13
- data/app/assets/stylesheets/rails_admin/{ra.calendar-additions.css.scss → ra.calendar-additions.scss} +0 -0
- data/app/assets/stylesheets/rails_admin/{ra.filtering-multiselect.css.scss → ra.filtering-multiselect.scss} +0 -0
- data/app/assets/stylesheets/rails_admin/{ra.widgets.css.scss → ra.widgets.scss} +0 -0
- data/app/assets/stylesheets/rails_admin/{imports.css.scss.erb → rails_admin.scss.erb} +0 -8
- data/app/assets/{javascripts/rails_admin/themes/cerulean/ui.js → stylesheets/rails_admin/themes/cerulean/mixins.scss} +0 -0
- data/app/assets/stylesheets/rails_admin/themes/cerulean/{theming.css.scss → theming.scss} +0 -0
- data/app/assets/stylesheets/rails_admin/themes/cerulean/{variables.css.scss → variables.scss} +0 -0
- data/app/assets/stylesheets/rails_admin/themes/default/{mixins.css.scss → mixins.scss} +0 -0
- data/app/assets/stylesheets/rails_admin/themes/default/{theming.css.scss → theming.scss} +0 -0
- data/app/assets/stylesheets/rails_admin/themes/default/{variables.css.scss → variables.scss} +0 -0
- data/lib/rails_admin/version.rb +1 -1
- metadata +84 -82
- data/app/assets/javascripts/rails_admin/custom/ui.js +0 -12
- data/app/assets/javascripts/rails_admin/rails_admin.js.erb +0 -27
- data/app/assets/javascripts/rails_admin/themes/default/ui.js +0 -12
- data/app/assets/stylesheets/rails_admin/rails_admin.css +0 -4
- data/app/assets/stylesheets/rails_admin/themes/cerulean/mixins.css.scss +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
#= override this file in your application to add custom behaviour
|
@@ -0,0 +1,72 @@
|
|
1
|
+
//= require jquery.iframe-transport.js
|
2
|
+
//= require_self
|
3
|
+
|
4
|
+
|
5
|
+
// This file is frozen in RailsAdmin to cope with https://github.com/JangoSteve/remotipart/pull/50
|
6
|
+
|
7
|
+
(function($) {
|
8
|
+
|
9
|
+
var remotipart;
|
10
|
+
|
11
|
+
$.remotipart = remotipart = {
|
12
|
+
|
13
|
+
setup: function(form) {
|
14
|
+
form
|
15
|
+
// Allow setup part of $.rails.handleRemote to setup remote settings before canceling default remote handler
|
16
|
+
// This is required in order to change the remote settings using the form details
|
17
|
+
.one('ajax:beforeSend.remotipart', function(e, xhr, settings){
|
18
|
+
// Delete the beforeSend bindings, since we're about to re-submit via ajaxSubmit with the beforeSubmit
|
19
|
+
// hook that was just setup and triggered via the default `$.rails.handleRemote`
|
20
|
+
// delete settings.beforeSend;
|
21
|
+
delete settings.beforeSend;
|
22
|
+
|
23
|
+
settings.iframe = true;
|
24
|
+
settings.files = $($.rails.fileInputSelector, form);
|
25
|
+
settings.data = form.serializeArray();
|
26
|
+
settings.processData = false;
|
27
|
+
|
28
|
+
// Modify some settings to integrate JS request with rails helpers and middleware
|
29
|
+
if (settings.dataType === undefined) { settings.dataType = 'script *'; }
|
30
|
+
settings.data.push({name: 'remotipart_submitted', value: true});
|
31
|
+
|
32
|
+
// Allow remotipartSubmit to be cancelled if needed
|
33
|
+
if ($.rails.fire(form, 'ajax:remotipartSubmit', [xhr, settings])) {
|
34
|
+
// Second verse, same as the first
|
35
|
+
$.rails.ajax(settings);
|
36
|
+
}
|
37
|
+
|
38
|
+
//Run cleanup
|
39
|
+
remotipart.teardown(form);
|
40
|
+
|
41
|
+
// Cancel the jQuery UJS request
|
42
|
+
return false;
|
43
|
+
})
|
44
|
+
|
45
|
+
// Keep track that we just set this particular form with Remotipart bindings
|
46
|
+
// Note: The `true` value will get over-written with the `settings.dataType` from the `ajax:beforeSend` handler
|
47
|
+
.data('remotipartSubmitted', true);
|
48
|
+
},
|
49
|
+
|
50
|
+
teardown: function(form) {
|
51
|
+
form
|
52
|
+
.unbind('ajax:beforeSend.remotipart')
|
53
|
+
.removeData('remotipartSubmitted')
|
54
|
+
}
|
55
|
+
};
|
56
|
+
|
57
|
+
$(document).on('ajax:aborted:file', 'form', function(){
|
58
|
+
var form = $(this);
|
59
|
+
|
60
|
+
remotipart.setup(form);
|
61
|
+
|
62
|
+
// If browser does not support submit bubbling, then this live-binding will be called before direct
|
63
|
+
// bindings. Therefore, we should directly call any direct bindings before remotely submitting form.
|
64
|
+
if (!$.support.submitBubbles && $().jquery < '1.7' && $.rails.callFormSubmitBindings(form) === false) return $.rails.stopEverything(e);
|
65
|
+
|
66
|
+
// Manually call jquery-ujs remote call so that it can setup form and settings as usual,
|
67
|
+
// and trigger the `ajax:beforeSend` callback to which remotipart binds functionality.
|
68
|
+
$.rails.handleRemote(form);
|
69
|
+
return false;
|
70
|
+
});
|
71
|
+
|
72
|
+
})(jQuery);
|
@@ -1,59 +1,58 @@
|
|
1
1
|
/*
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
2
|
+
* jQuery UI Timepicker 0.3.1
|
3
|
+
*
|
4
|
+
* Copyright 2010-2011, Francois Gelinas
|
5
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6
|
+
* http://jquery.org/license
|
7
|
+
*
|
8
|
+
* http://fgelinas.com/code/timepicker
|
9
|
+
*
|
10
|
+
* Depends:
|
11
|
+
* jquery.ui.core.js
|
12
|
+
* jquery.ui.position.js (only if position settngs are used)
|
13
|
+
*
|
14
|
+
* Change version 0.1.0 - moved the t-rex up here
|
15
|
+
*
|
16
|
+
____
|
17
|
+
___ .-~. /_"-._
|
18
|
+
`-._~-. / /_ "~o\ :Y
|
19
|
+
\ \ / : \~x. ` ')
|
20
|
+
] Y / | Y< ~-.__j
|
21
|
+
/ ! _.--~T : l l< /.-~
|
22
|
+
/ / ____.--~ . ` l /~\ \<|Y
|
23
|
+
/ / .-~~" /| . ',-~\ \L|
|
24
|
+
/ / / .^ \ Y~Y \.^>/l_ "--'
|
25
|
+
/ Y .-"( . l__ j_j l_/ /~_.-~ .
|
26
|
+
Y l / \ ) ~~~." / `/"~ / \.__/l_
|
27
|
+
| \ _.-" ~-{__ l : l._Z~-.___.--~
|
28
|
+
| ~---~ / ~~"---\_ ' __[>
|
29
|
+
l . _.^ ___ _>-y~
|
30
|
+
\ \ . .-~ .-~ ~>--" /
|
31
|
+
\ ~---" / ./ _.-'
|
32
|
+
"-.,_____.,_ _.--~\ _.-~
|
33
|
+
~~ ( _} -Row
|
34
|
+
`. ~(
|
35
|
+
) \
|
36
|
+
/,`--'~\--'~\
|
37
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
38
|
+
->T-Rex<-
|
39
39
|
*/
|
40
40
|
|
41
|
-
(function (
|
41
|
+
(function ($) {
|
42
42
|
|
43
|
-
$.extend($.ui, { timepicker: { version: "0.
|
43
|
+
$.extend($.ui, { timepicker: { version: "0.3.1"} });
|
44
44
|
|
45
|
-
var PROP_NAME = 'timepicker'
|
46
|
-
|
45
|
+
var PROP_NAME = 'timepicker',
|
46
|
+
tpuuid = new Date().getTime();
|
47
47
|
|
48
48
|
/* Time picker manager.
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
Use the singleton instance of this class, $.timepicker, to interact with the time picker.
|
50
|
+
Settings for (groups of) time pickers are maintained in an instance object,
|
51
|
+
allowing multiple different settings on the same page. */
|
52
52
|
|
53
53
|
function Timepicker() {
|
54
54
|
this.debug = true; // Change this to true to start debugging
|
55
55
|
this._curInst = null; // The current instance in use
|
56
|
-
this._isInline = false; // true if the instance is displayed inline
|
57
56
|
this._disabledInputs = []; // List of time picker inputs that have been disabled
|
58
57
|
this._timepickerShowing = false; // True if the popup picker is showing , false if not
|
59
58
|
this._inDialog = false; // True if showing within a "dialog", false if not
|
@@ -65,61 +64,61 @@
|
|
65
64
|
|
66
65
|
this.regional = []; // Available regional settings, indexed by language code
|
67
66
|
this.regional[''] = { // Default regional settings
|
68
|
-
hourText: 'Hour',
|
69
|
-
minuteText: 'Minute',
|
70
|
-
amPmText: ['AM', 'PM'],
|
71
|
-
closeButtonText: 'Done',
|
72
|
-
nowButtonText: 'Now',
|
73
|
-
deselectButtonText: 'Deselect'
|
67
|
+
hourText: 'Hour', // Display text for hours section
|
68
|
+
minuteText: 'Minute', // Display text for minutes link
|
69
|
+
amPmText: ['AM', 'PM'], // Display text for AM PM
|
70
|
+
closeButtonText: 'Done', // Text for the confirmation button (ok button)
|
71
|
+
nowButtonText: 'Now', // Text for the now button
|
72
|
+
deselectButtonText: 'Deselect' // Text for the deselect button
|
74
73
|
};
|
75
74
|
this._defaults = { // Global defaults for all the time picker instances
|
76
|
-
showOn: 'focus',
|
75
|
+
showOn: 'focus', // 'focus' for popup on focus,
|
77
76
|
// 'button' for trigger button, or 'both' for either (not yet implemented)
|
78
|
-
button: null,
|
79
|
-
showAnim: 'fadeIn',
|
80
|
-
showOptions: {},
|
81
|
-
appendText: '',
|
82
|
-
|
83
|
-
beforeShow: null,
|
84
|
-
onSelect: null,
|
85
|
-
onClose: null,
|
86
|
-
|
87
|
-
timeSeparator: ':',
|
88
|
-
periodSeparator: ' ',
|
89
|
-
showPeriod: false,
|
90
|
-
showPeriodLabels: true,
|
91
|
-
showLeadingZero: true,
|
92
|
-
showMinutesLeadingZero: true,
|
93
|
-
altField: '',
|
94
|
-
defaultTime: 'now',
|
77
|
+
button: null, // 'button' element that will trigger the timepicker
|
78
|
+
showAnim: 'fadeIn', // Name of jQuery animation for popup
|
79
|
+
showOptions: {}, // Options for enhanced animations
|
80
|
+
appendText: '', // Display text following the input box, e.g. showing the format
|
81
|
+
|
82
|
+
beforeShow: null, // Define a callback function executed before the timepicker is shown
|
83
|
+
onSelect: null, // Define a callback function when a hour / minutes is selected
|
84
|
+
onClose: null, // Define a callback function when the timepicker is closed
|
85
|
+
|
86
|
+
timeSeparator: ':', // The character to use to separate hours and minutes.
|
87
|
+
periodSeparator: ' ', // The character to use to separate the time from the time period.
|
88
|
+
showPeriod: false, // Define whether or not to show AM/PM with selected time
|
89
|
+
showPeriodLabels: true, // Show the AM/PM labels on the left of the time picker
|
90
|
+
showLeadingZero: true, // Define whether or not to show a leading zero for hours < 10. [true/false]
|
91
|
+
showMinutesLeadingZero: true, // Define whether or not to show a leading zero for minutes < 10.
|
92
|
+
altField: '', // Selector for an alternate field to store selected time into
|
93
|
+
defaultTime: 'now', // Used as default time when input field is empty or for inline timePicker
|
95
94
|
// (set to 'now' for the current time, '' for no highlighted time)
|
96
|
-
myPosition: 'left top',
|
95
|
+
myPosition: 'left top', // Position of the dialog relative to the input.
|
97
96
|
// see the position utility for more info : http://jqueryui.com/demos/position/
|
98
|
-
atPosition: 'left bottom',
|
97
|
+
atPosition: 'left bottom', // Position of the input element to match
|
99
98
|
// Note : if the position utility is not loaded, the timepicker will attach left top to left bottom
|
100
99
|
//NEW: 2011-02-03
|
101
|
-
onHourShow: null,
|
102
|
-
onMinuteShow: null,
|
100
|
+
onHourShow: null, // callback for enabling / disabling on selectable hours ex : function(hour) { return true; }
|
101
|
+
onMinuteShow: null, // callback for enabling / disabling on time selection ex : function(hour,minute) { return true; }
|
103
102
|
|
104
103
|
hours: {
|
105
|
-
starts: 0,
|
106
|
-
ends: 23
|
104
|
+
starts: 0, // first displayed hour
|
105
|
+
ends: 23 // last displayed hour
|
107
106
|
},
|
108
107
|
minutes: {
|
109
|
-
starts: 0,
|
110
|
-
ends: 55,
|
111
|
-
interval: 5
|
108
|
+
starts: 0, // first displayed minute
|
109
|
+
ends: 55, // last displayed minute
|
110
|
+
interval: 5 // interval of displayed minutes
|
112
111
|
},
|
113
|
-
rows: 4,
|
112
|
+
rows: 4, // number of rows for the input tables, minimum 2, makes more sense if you use multiple of 2
|
114
113
|
// 2011-08-05 0.2.4
|
115
|
-
showHours: true,
|
116
|
-
showMinutes: true,
|
117
|
-
optionalMinutes: false,
|
114
|
+
showHours: true, // display the hours section of the dialog
|
115
|
+
showMinutes: true, // display the minute section of the dialog
|
116
|
+
optionalMinutes: false, // optionally parse inputs of whole hours with minutes omitted
|
118
117
|
|
119
118
|
// buttons
|
120
|
-
showCloseButton: false,
|
121
|
-
showNowButton: false,
|
122
|
-
showDeselectButton: false
|
119
|
+
showCloseButton: false, // shows an OK button to confirm the edit
|
120
|
+
showNowButton: false, // Shows the 'now' button
|
121
|
+
showDeselectButton: false // Shows the deselect time button
|
123
122
|
|
124
123
|
};
|
125
124
|
$.extend(this._defaults, this.regional['']);
|
@@ -142,16 +141,16 @@
|
|
142
141
|
},
|
143
142
|
|
144
143
|
/* Override the default settings for all instances of the time picker.
|
145
|
-
|
146
|
-
|
144
|
+
@param settings object - the new settings to use as defaults (anonymous object)
|
145
|
+
@return the manager object */
|
147
146
|
setDefaults: function (settings) {
|
148
147
|
extendRemove(this._defaults, settings || {});
|
149
148
|
return this;
|
150
149
|
},
|
151
150
|
|
152
151
|
/* Attach the time picker to a jQuery selection.
|
153
|
-
|
154
|
-
|
152
|
+
@param target element - the target input field or division or span
|
153
|
+
@param settings object - the new settings to use for this time picker instance (anonymous) */
|
155
154
|
_attachTimepicker: function (target, settings) {
|
156
155
|
// check for settings on the control itself - in namespace 'time:'
|
157
156
|
var inlineSettings = null;
|
@@ -193,7 +192,7 @@
|
|
193
192
|
id: id, input: target, // associated target
|
194
193
|
inline: inline, // is timepicker inline or not :
|
195
194
|
tpDiv: (!inline ? this.tpDiv : // presentation div
|
196
|
-
$('<div class="' + this._inlineClass + ' ui-timepicker ui-widget
|
195
|
+
$('<div class="' + this._inlineClass + ' ui-timepicker ui-widget ui-helper-clearfix"></div>'))
|
197
196
|
};
|
198
197
|
},
|
199
198
|
|
@@ -229,9 +228,9 @@
|
|
229
228
|
case 13:
|
230
229
|
$.timepicker._updateSelectedValue(inst);
|
231
230
|
$.timepicker._hideTimepicker();
|
232
|
-
|
233
|
-
|
234
|
-
|
231
|
+
|
232
|
+
return false; // don't submit the form
|
233
|
+
break; // select the value on enter
|
235
234
|
case 27: $.timepicker._hideTimepicker();
|
236
235
|
break; // hide on escape
|
237
236
|
default: handled = false;
|
@@ -316,8 +315,8 @@
|
|
316
315
|
},
|
317
316
|
|
318
317
|
/* Pop-up the time picker for a given input field.
|
319
|
-
|
320
|
-
|
318
|
+
@param input element - the input field attached to the time picker or
|
319
|
+
event - if triggered by focus */
|
321
320
|
_showTimepicker: function (input) {
|
322
321
|
input = input.target || input;
|
323
322
|
if (input.nodeName.toLowerCase() != 'input') { input = $('input', input.parentNode)[0]; } // find from button/image trigger
|
@@ -363,7 +362,7 @@
|
|
363
362
|
|
364
363
|
|
365
364
|
// position with the ui position utility, if loaded
|
366
|
-
if ( ( ! inst.inline )
|
365
|
+
if ( ( ! inst.inline ) && ( typeof $.ui.position == 'object' ) ) {
|
367
366
|
inst.tpDiv.position({
|
368
367
|
of: inst.input,
|
369
368
|
my: $.timepicker._get( inst, 'myPosition' ),
|
@@ -385,7 +384,7 @@
|
|
385
384
|
// and adjust position before showing
|
386
385
|
offset = $.timepicker._checkOffset(inst, offset, isFixed);
|
387
386
|
inst.tpDiv.css({ position: ($.timepicker._inDialog && $.blockUI ?
|
388
|
-
|
387
|
+
'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
|
389
388
|
left: offset.left + 'px', top: offset.top + 'px'
|
390
389
|
});
|
391
390
|
if ( ! inst.inline ) {
|
@@ -396,9 +395,9 @@
|
|
396
395
|
$.timepicker._timepickerShowing = true;
|
397
396
|
var borders = $.timepicker._getBorders(inst.tpDiv);
|
398
397
|
inst.tpDiv.find('iframe.ui-timepicker-cover'). // IE6- only
|
399
|
-
|
400
|
-
|
401
|
-
|
398
|
+
css({ left: -borders[0], top: -borders[1],
|
399
|
+
width: inst.tpDiv.outerWidth(), height: inst.tpDiv.outerHeight()
|
400
|
+
});
|
402
401
|
};
|
403
402
|
|
404
403
|
// Fixed the zIndex problem for real (I hope) - FG - v 0.2.9
|
@@ -409,7 +408,7 @@
|
|
409
408
|
inst.tpDiv.show(showAnim, $.timepicker._get(inst, 'showOptions'), duration, postProcess);
|
410
409
|
}
|
411
410
|
else {
|
412
|
-
inst.tpDiv
|
411
|
+
inst.tpDiv.show((showAnim ? duration : null), postProcess);
|
413
412
|
}
|
414
413
|
if (!showAnim || !duration) { postProcess(); }
|
415
414
|
if (inst.input.is(':visible') && !inst.input.is(':disabled')) { inst.input.focus(); }
|
@@ -433,6 +432,16 @@
|
|
433
432
|
}
|
434
433
|
},
|
435
434
|
|
435
|
+
/* Refresh the time picker
|
436
|
+
@param target element - The target input field or inline container element. */
|
437
|
+
_refreshTimepicker: function(target) {
|
438
|
+
var inst = this._getInst(target);
|
439
|
+
if (inst) {
|
440
|
+
this._updateTimepicker(inst);
|
441
|
+
}
|
442
|
+
},
|
443
|
+
|
444
|
+
|
436
445
|
/* Generate the time picker content. */
|
437
446
|
_updateTimepicker: function (inst) {
|
438
447
|
inst.tpDiv.empty().append(this._generateHTML(inst));
|
@@ -444,11 +453,11 @@
|
|
444
453
|
var borders = $.timepicker._getBorders(inst.tpDiv),
|
445
454
|
self = this;
|
446
455
|
inst.tpDiv
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
456
|
+
.find('iframe.ui-timepicker-cover') // IE6- only
|
457
|
+
.css({ left: -borders[0], top: -borders[1],
|
458
|
+
width: inst.tpDiv.outerWidth(), height: inst.tpDiv.outerHeight()
|
459
|
+
})
|
460
|
+
.end()
|
452
461
|
// after the picker html is appended bind the click & double click events (faster in IE this way
|
453
462
|
// then letting the browser interpret the inline events)
|
454
463
|
// the binding for the minute cells also exists in _updateMinuteDisplay
|
@@ -462,26 +471,26 @@
|
|
462
471
|
.bind("click", { fromDoubleClick:false }, $.proxy($.timepicker.selectHours, this))
|
463
472
|
.bind("dblclick", { fromDoubleClick:true }, $.proxy($.timepicker.selectHours, this))
|
464
473
|
.end()
|
465
|
-
|
474
|
+
.find('.ui-timepicker td a')
|
466
475
|
.unbind()
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
.find('.ui-timepicker-now').bind("click",function(e) {
|
476
|
+
.bind('mouseout', function () {
|
477
|
+
$(this).removeClass('ui-state-hover');
|
478
|
+
if (this.className.indexOf('ui-timepicker-prev') != -1) $(this).removeClass('ui-timepicker-prev-hover');
|
479
|
+
if (this.className.indexOf('ui-timepicker-next') != -1) $(this).removeClass('ui-timepicker-next-hover');
|
480
|
+
})
|
481
|
+
.bind('mouseover', function () {
|
482
|
+
if ( ! self._isDisabledTimepicker(inst.inline ? inst.tpDiv.parent()[0] : inst.input[0])) {
|
483
|
+
$(this).parents('.ui-timepicker-calendar').find('a').removeClass('ui-state-hover');
|
484
|
+
$(this).addClass('ui-state-hover');
|
485
|
+
if (this.className.indexOf('ui-timepicker-prev') != -1) $(this).addClass('ui-timepicker-prev-hover');
|
486
|
+
if (this.className.indexOf('ui-timepicker-next') != -1) $(this).addClass('ui-timepicker-next-hover');
|
487
|
+
}
|
488
|
+
})
|
489
|
+
.end()
|
490
|
+
.find('.' + this._dayOverClass + ' a')
|
491
|
+
.trigger('mouseover')
|
492
|
+
.end()
|
493
|
+
.find('.ui-timepicker-now').bind("click", function(e) {
|
485
494
|
$.timepicker.selectNow(e);
|
486
495
|
}).end()
|
487
496
|
.find('.ui-timepicker-deselect').bind("click",function(e) {
|
@@ -521,7 +530,7 @@
|
|
521
530
|
showDeselectButton = this._get(inst, 'showDeselectButton'),
|
522
531
|
deselectButtonText = this._get(inst, 'deselectButtonText'),
|
523
532
|
showButtonPanel = showCloseButton || showNowButton || showDeselectButton;
|
524
|
-
|
533
|
+
|
525
534
|
|
526
535
|
|
527
536
|
// prepare all hours and minutes, makes it easier to distribute by rows
|
@@ -544,7 +553,7 @@
|
|
544
553
|
amRows = Math.floor(amItems / hours.length * rows);
|
545
554
|
pmRows = Math.floor(pmItems / hours.length * rows);
|
546
555
|
|
547
|
-
// assign the extra row to the period that is more
|
556
|
+
// assign the extra row to the period that is more densely populated
|
548
557
|
if (rows != amRows + pmRows) {
|
549
558
|
// Make sure: AM Has Items and either PM Does Not, AM has no rows yet, or AM is more dense
|
550
559
|
if (amItems && (!pmItems || !amRows || (pmRows && amItems / amRows >= pmItems / pmRows))) {
|
@@ -555,7 +564,14 @@
|
|
555
564
|
}
|
556
565
|
amFirstRow = Math.min(amRows, 1);
|
557
566
|
pmFirstRow = amRows + 1;
|
558
|
-
|
567
|
+
|
568
|
+
if (amRows == 0) {
|
569
|
+
hoursPerRow = Math.ceil(pmItems / pmRows);
|
570
|
+
} else if (pmRows == 0) {
|
571
|
+
hoursPerRow = Math.ceil(amItems / amRows);
|
572
|
+
} else {
|
573
|
+
hoursPerRow = Math.ceil(Math.max(amItems / amRows, pmItems / pmRows));
|
574
|
+
}
|
559
575
|
}
|
560
576
|
|
561
577
|
|
@@ -589,8 +605,8 @@
|
|
589
605
|
}
|
590
606
|
html += '</tr>';
|
591
607
|
}
|
592
|
-
html += '</
|
593
|
-
'</td>';
|
608
|
+
html += '</table>' + // Close the hours cells table
|
609
|
+
'</td>'; // Close the Hour td
|
594
610
|
}
|
595
611
|
|
596
612
|
if (showMinutes) {
|
@@ -598,7 +614,7 @@
|
|
598
614
|
html += this._generateHTMLMinutes(inst);
|
599
615
|
html += '</td>';
|
600
616
|
}
|
601
|
-
|
617
|
+
|
602
618
|
html += '</tr>';
|
603
619
|
|
604
620
|
|
@@ -623,16 +639,11 @@
|
|
623
639
|
html += buttonPanel + '</div></td></tr>';
|
624
640
|
}
|
625
641
|
html += '</table>';
|
626
|
-
|
627
|
-
/* IE6 IFRAME FIX (taken from datepicker 1.5.3, fixed in 0.1.2 */
|
628
|
-
html += ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
|
629
|
-
'<iframe src="javascript:false;" class="ui-timepicker-cover" frameborder="0"></iframe>' : '');
|
630
|
-
|
631
642
|
return html;
|
632
643
|
},
|
633
644
|
|
634
645
|
/* Special function that update the minutes selection in currently visible timepicker
|
635
|
-
|
646
|
+
* called on hour selection when onMinuteShow is defined */
|
636
647
|
_updateMinuteDisplay: function (inst) {
|
637
648
|
var newHtml = this._generateHTMLMinutes(inst);
|
638
649
|
inst.tpDiv.find('td.ui-timepicker-minutes').html(newHtml);
|
@@ -640,17 +651,17 @@
|
|
640
651
|
// after the picker html is appended bind the click & double click events (faster in IE this way
|
641
652
|
// then letting the browser interpret the inline events)
|
642
653
|
// yes I know, duplicate code, sorry
|
643
|
-
/*
|
644
|
-
|
645
|
-
|
654
|
+
/* .find('.ui-timepicker-minute-cell')
|
655
|
+
.bind("click", { fromDoubleClick:false }, $.proxy($.timepicker.selectMinutes, this))
|
656
|
+
.bind("dblclick", { fromDoubleClick:true }, $.proxy($.timepicker.selectMinutes, this));
|
646
657
|
*/
|
647
658
|
|
648
659
|
},
|
649
660
|
|
650
661
|
/*
|
651
|
-
|
652
|
-
|
653
|
-
|
662
|
+
* Generate the minutes table
|
663
|
+
* This is separated from the _generateHTML function because is can be called separately (when hours changes)
|
664
|
+
*/
|
654
665
|
_generateHTMLMinutes: function (inst) {
|
655
666
|
|
656
667
|
var m, row, html = '',
|
@@ -675,8 +686,8 @@
|
|
675
686
|
minutesPerRow = Math.round(minutes.length / rows + 0.49); // always round up
|
676
687
|
|
677
688
|
/*
|
678
|
-
|
679
|
-
|
689
|
+
* The minutes table
|
690
|
+
*/
|
680
691
|
// if currently selected minute is not enabled, we have a problem and need to select a new minute.
|
681
692
|
if (onMinuteShow &&
|
682
693
|
(onMinuteShow.apply((inst.input ? inst.input[0] : null), [inst.hours , inst.minutes]) == false) ) {
|
@@ -696,7 +707,7 @@
|
|
696
707
|
minuteLabel +
|
697
708
|
'</div>' +
|
698
709
|
'<table class="ui-timepicker">';
|
699
|
-
|
710
|
+
|
700
711
|
minuteCounter = 0;
|
701
712
|
for (row = 1; row <= rows; row++) {
|
702
713
|
html += '<tr>';
|
@@ -733,7 +744,7 @@
|
|
733
744
|
|
734
745
|
var html = "";
|
735
746
|
var enabled = true;
|
736
|
-
var onHourShow = this._get(inst, 'onHourShow');
|
747
|
+
var onHourShow = this._get(inst, 'onHourShow'); //custom callback
|
737
748
|
|
738
749
|
if (hour == undefined) {
|
739
750
|
html = '<td><span class="ui-state-default ui-state-disabled"> </span></td>';
|
@@ -741,7 +752,7 @@
|
|
741
752
|
}
|
742
753
|
|
743
754
|
if (onHourShow) {
|
744
|
-
|
755
|
+
enabled = onHourShow.apply((inst.input ? inst.input[0] : null), [hour]);
|
745
756
|
}
|
746
757
|
|
747
758
|
if (enabled) {
|
@@ -753,26 +764,26 @@
|
|
753
764
|
'</a></td>';
|
754
765
|
}
|
755
766
|
else {
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
767
|
+
html =
|
768
|
+
'<td>' +
|
769
|
+
'<span class="ui-state-default ui-state-disabled ' +
|
770
|
+
(hour == inst.hours ? ' ui-state-active ' : ' ') +
|
771
|
+
'">' +
|
772
|
+
displayHour.toString() +
|
773
|
+
'</span>' +
|
774
|
+
'</td>';
|
764
775
|
}
|
765
776
|
return html;
|
766
777
|
},
|
767
778
|
|
768
779
|
/* Generate the content of a "Hour" cell */
|
769
780
|
_generateHTMLMinuteCell: function (inst, minute, displayText) {
|
770
|
-
|
781
|
+
var html = "";
|
771
782
|
var enabled = true;
|
772
783
|
var onMinuteShow = this._get(inst, 'onMinuteShow'); //custom callback
|
773
784
|
if (onMinuteShow) {
|
774
|
-
|
775
|
-
|
785
|
+
//NEW: 2011-02-03 we should give the hour as a parameter as well!
|
786
|
+
enabled = onMinuteShow.apply((inst.input ? inst.input[0] : null), [inst.hours,minute]); //trigger callback
|
776
787
|
}
|
777
788
|
|
778
789
|
if (minute == undefined) {
|
@@ -781,32 +792,52 @@
|
|
781
792
|
}
|
782
793
|
|
783
794
|
if (enabled) {
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
795
|
+
html = '<td class="ui-timepicker-minute-cell" data-timepicker-instance-id="#' + inst.id.replace(/\\\\/g,"\\") + '" data-minute="' + minute.toString() + '" >' +
|
796
|
+
'<a class="ui-state-default ' +
|
797
|
+
(minute == inst.minutes ? 'ui-state-active' : '') +
|
798
|
+
'" >' +
|
799
|
+
displayText +
|
800
|
+
'</a></td>';
|
790
801
|
}
|
791
802
|
else {
|
792
803
|
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
804
|
+
html = '<td>' +
|
805
|
+
'<span class="ui-state-default ui-state-disabled" >' +
|
806
|
+
displayText +
|
807
|
+
'</span>' +
|
797
808
|
'</td>';
|
798
809
|
}
|
799
810
|
return html;
|
800
811
|
},
|
801
812
|
|
802
813
|
|
814
|
+
/* Detach a timepicker from its control.
|
815
|
+
@param target element - the target input field or division or span */
|
816
|
+
_destroyTimepicker: function(target) {
|
817
|
+
var $target = $(target);
|
818
|
+
var inst = $.data(target, PROP_NAME);
|
819
|
+
if (!$target.hasClass(this.markerClassName)) {
|
820
|
+
return;
|
821
|
+
}
|
822
|
+
var nodeName = target.nodeName.toLowerCase();
|
823
|
+
$.removeData(target, PROP_NAME);
|
824
|
+
if (nodeName == 'input') {
|
825
|
+
inst.append.remove();
|
826
|
+
inst.trigger.remove();
|
827
|
+
$target.removeClass(this.markerClassName)
|
828
|
+
.unbind('focus.timepicker', this._showTimepicker)
|
829
|
+
.unbind('click.timepicker', this._adjustZIndex);
|
830
|
+
} else if (nodeName == 'div' || nodeName == 'span')
|
831
|
+
$target.removeClass(this.markerClassName).empty();
|
832
|
+
},
|
833
|
+
|
803
834
|
/* Enable the date picker to a jQuery selection.
|
804
|
-
|
835
|
+
@param target element - the target input field or division or span */
|
805
836
|
_enableTimepicker: function(target) {
|
806
837
|
var $target = $(target),
|
807
838
|
target_id = $target.attr('id'),
|
808
839
|
inst = $.data(target, PROP_NAME);
|
809
|
-
|
840
|
+
|
810
841
|
if (!$target.hasClass(this.markerClassName)) {
|
811
842
|
return;
|
812
843
|
}
|
@@ -830,7 +861,7 @@
|
|
830
861
|
},
|
831
862
|
|
832
863
|
/* Disable the time picker to a jQuery selection.
|
833
|
-
|
864
|
+
@param target element - the target input field or division or span */
|
834
865
|
_disableTimepicker: function(target) {
|
835
866
|
var $target = $(target);
|
836
867
|
var inst = $.data(target, PROP_NAME);
|
@@ -862,8 +893,8 @@
|
|
862
893
|
},
|
863
894
|
|
864
895
|
/* Is the first field in a jQuery collection disabled as a timepicker?
|
865
|
-
|
866
|
-
|
896
|
+
@param target_id element - the target input field or division or span
|
897
|
+
@return boolean - true if disabled, false if enabled */
|
867
898
|
_isDisabledTimepicker: function (target_id) {
|
868
899
|
if ( ! target_id) { return false; }
|
869
900
|
for (var i = 0; i < this._disabledInputs.length; i++) {
|
@@ -887,9 +918,9 @@
|
|
887
918
|
|
888
919
|
// now check if datepicker is showing outside window viewport - move to a better place if so.
|
889
920
|
offset.left -= Math.min(offset.left, (offset.left + tpWidth > viewWidth && viewWidth > tpWidth) ?
|
890
|
-
|
921
|
+
Math.abs(offset.left + tpWidth - viewWidth) : 0);
|
891
922
|
offset.top -= Math.min(offset.top, (offset.top + tpHeight > viewHeight && viewHeight > tpHeight) ?
|
892
|
-
|
923
|
+
Math.abs(tpHeight + inputHeight) : 0);
|
893
924
|
|
894
925
|
return offset;
|
895
926
|
},
|
@@ -906,14 +937,14 @@
|
|
906
937
|
},
|
907
938
|
|
908
939
|
/* Retrieve the size of left and top borders for an element.
|
909
|
-
|
910
|
-
|
940
|
+
@param elem (jQuery object) the element of interest
|
941
|
+
@return (number[2]) the left and top borders */
|
911
942
|
_getBorders: function (elem) {
|
912
943
|
var convert = function (value) {
|
913
944
|
return { thin: 1, medium: 2, thick: 3}[value] || value;
|
914
945
|
};
|
915
946
|
return [parseFloat(convert(elem.css('border-left-width'))),
|
916
|
-
|
947
|
+
parseFloat(convert(elem.css('border-top-width')))];
|
917
948
|
},
|
918
949
|
|
919
950
|
|
@@ -922,15 +953,15 @@
|
|
922
953
|
if (!$.timepicker._curInst) { return; }
|
923
954
|
var $target = $(event.target);
|
924
955
|
if ($target[0].id != $.timepicker._mainDivId &&
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
956
|
+
$target.parents('#' + $.timepicker._mainDivId).length == 0 &&
|
957
|
+
!$target.hasClass($.timepicker.markerClassName) &&
|
958
|
+
!$target.hasClass($.timepicker._triggerClass) &&
|
959
|
+
$.timepicker._timepickerShowing && !($.timepicker._inDialog && $.blockUI))
|
929
960
|
$.timepicker._hideTimepicker();
|
930
961
|
},
|
931
962
|
|
932
963
|
/* Hide the time picker from view.
|
933
|
-
|
964
|
+
@param input element - the input field attached to the time picker */
|
934
965
|
_hideTimepicker: function (input) {
|
935
966
|
var inst = this._curInst;
|
936
967
|
if (!inst || (input && inst != $.data(input, PROP_NAME))) { return; }
|
@@ -946,16 +977,12 @@
|
|
946
977
|
}
|
947
978
|
else {
|
948
979
|
inst.tpDiv[(showAnim == 'slideDown' ? 'slideUp' :
|
949
|
-
|
980
|
+
(showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
|
950
981
|
}
|
951
982
|
if (!showAnim) { postProcess(); }
|
952
|
-
|
953
|
-
if (onClose) {
|
954
|
-
onClose.apply(
|
955
|
-
(inst.input ? inst.input[0] : null),
|
956
|
-
[(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback
|
957
|
-
}
|
983
|
+
|
958
984
|
this._timepickerShowing = false;
|
985
|
+
|
959
986
|
this._lastInput = null;
|
960
987
|
if (this._inDialog) {
|
961
988
|
this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
|
@@ -965,6 +992,14 @@
|
|
965
992
|
}
|
966
993
|
}
|
967
994
|
this._inDialog = false;
|
995
|
+
|
996
|
+
var onClose = this._get(inst, 'onClose');
|
997
|
+
if (onClose) {
|
998
|
+
onClose.apply(
|
999
|
+
(inst.input ? inst.input[0] : null),
|
1000
|
+
[(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback
|
1001
|
+
}
|
1002
|
+
|
968
1003
|
}
|
969
1004
|
},
|
970
1005
|
|
@@ -976,9 +1011,9 @@
|
|
976
1011
|
},
|
977
1012
|
|
978
1013
|
/* Retrieve the instance data for the target control.
|
979
|
-
|
980
|
-
|
981
|
-
|
1014
|
+
@param target element - the target input field or division or span
|
1015
|
+
@return object - the associated instance data
|
1016
|
+
@throws error if a jQuery problem getting data */
|
982
1017
|
_getInst: function (target) {
|
983
1018
|
try {
|
984
1019
|
return $.data(target, PROP_NAME);
|
@@ -991,7 +1026,7 @@
|
|
991
1026
|
/* Get a setting value, defaulting if necessary. */
|
992
1027
|
_get: function (inst, name) {
|
993
1028
|
return inst.settings[name] !== undefined ?
|
994
|
-
|
1029
|
+
inst.settings[name] : this._defaults[name];
|
995
1030
|
},
|
996
1031
|
|
997
1032
|
/* Parse existing time and initialise time picker. */
|
@@ -1022,13 +1057,13 @@
|
|
1022
1057
|
},
|
1023
1058
|
|
1024
1059
|
/* Update or retrieve the settings for an existing time picker.
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1060
|
+
@param target element - the target input field or division or span
|
1061
|
+
@param name object - the new settings to update or
|
1062
|
+
string - the name of the setting to change or retrieve,
|
1063
|
+
when retrieving also 'all' for all instance settings or
|
1064
|
+
'defaults' for all global defaults
|
1065
|
+
@param value any - the new value for the setting
|
1066
|
+
(omit if above is an object or to retrieve a value) */
|
1032
1067
|
_optionTimepicker: function(target, name, value) {
|
1033
1068
|
var inst = this._getInst(target);
|
1034
1069
|
if (arguments.length == 2 && typeof name == 'string') {
|
@@ -1052,26 +1087,31 @@
|
|
1052
1087
|
|
1053
1088
|
|
1054
1089
|
/* Set the time for a jQuery selection.
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1090
|
+
@param target element - the target input field or division or span
|
1091
|
+
@param time String - the new time */
|
1092
|
+
_setTimeTimepicker: function(target, time) {
|
1093
|
+
var inst = this._getInst(target);
|
1094
|
+
if (inst) {
|
1095
|
+
this._setTime(inst, time);
|
1096
|
+
this._updateTimepicker(inst);
|
1097
|
+
this._updateAlternate(inst, time);
|
1098
|
+
}
|
1099
|
+
},
|
1065
1100
|
|
1066
1101
|
/* Set the time directly. */
|
1067
1102
|
_setTime: function(inst, time, noChange) {
|
1068
1103
|
var origHours = inst.hours;
|
1069
1104
|
var origMinutes = inst.minutes;
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1105
|
+
if (time instanceof Date) {
|
1106
|
+
inst.hours = time.getHours();
|
1107
|
+
inst.minutes = time.getMinutes();
|
1108
|
+
} else {
|
1109
|
+
var time = this.parseTime(inst, time);
|
1110
|
+
inst.hours = time.hours;
|
1111
|
+
inst.minutes = time.minutes;
|
1112
|
+
}
|
1073
1113
|
|
1074
|
-
if ((origHours != inst.hours || origMinutes != inst.
|
1114
|
+
if ((origHours != inst.hours || origMinutes != inst.minutes) && !noChange) {
|
1075
1115
|
inst.input.trigger('change');
|
1076
1116
|
}
|
1077
1117
|
this._updateTimepicker(inst);
|
@@ -1089,12 +1129,15 @@
|
|
1089
1129
|
},
|
1090
1130
|
|
1091
1131
|
/*
|
1092
|
-
|
1093
|
-
|
1132
|
+
* Parse a time string into hours and minutes
|
1133
|
+
*/
|
1094
1134
|
parseTime: function (inst, timeVal) {
|
1095
1135
|
var retVal = new Object();
|
1096
1136
|
retVal.hours = -1;
|
1097
1137
|
retVal.minutes = -1;
|
1138
|
+
|
1139
|
+
if(!timeVal)
|
1140
|
+
return '';
|
1098
1141
|
|
1099
1142
|
var timeSeparator = this._get(inst, 'timeSeparator'),
|
1100
1143
|
amPmText = this._get(inst, 'amPmText'),
|
@@ -1128,16 +1171,14 @@
|
|
1128
1171
|
retVal.hours = 0;
|
1129
1172
|
}
|
1130
1173
|
}
|
1131
|
-
|
1174
|
+
|
1132
1175
|
return retVal;
|
1133
1176
|
},
|
1134
1177
|
|
1135
|
-
selectNow: function(
|
1136
|
-
|
1137
|
-
var id = $(e.target).attr("data-timepicker-instance-id"),
|
1178
|
+
selectNow: function(event) {
|
1179
|
+
var id = $(event.target).attr("data-timepicker-instance-id"),
|
1138
1180
|
$target = $(id),
|
1139
1181
|
inst = this._getInst($target[0]);
|
1140
|
-
|
1141
1182
|
//if (!inst || (input && inst != $.data(input, PROP_NAME))) { return; }
|
1142
1183
|
var currentTime = new Date();
|
1143
1184
|
inst.hours = currentTime.getHours();
|
@@ -1147,8 +1188,8 @@
|
|
1147
1188
|
this._hideTimepicker();
|
1148
1189
|
},
|
1149
1190
|
|
1150
|
-
deselectTime: function(
|
1151
|
-
var id = $(
|
1191
|
+
deselectTime: function(event) {
|
1192
|
+
var id = $(event.target).attr("data-timepicker-instance-id"),
|
1152
1193
|
$target = $(id),
|
1153
1194
|
inst = this._getInst($target[0]);
|
1154
1195
|
inst.hours = -1;
|
@@ -1231,7 +1272,7 @@
|
|
1231
1272
|
this._updateAlternate(inst, newTime);
|
1232
1273
|
return newTime;
|
1233
1274
|
},
|
1234
|
-
|
1275
|
+
|
1235
1276
|
/* this function process selected time and return it parsed according to instance options */
|
1236
1277
|
_getParsedTime: function(inst) {
|
1237
1278
|
|
@@ -1239,8 +1280,10 @@
|
|
1239
1280
|
return '';
|
1240
1281
|
}
|
1241
1282
|
|
1242
|
-
|
1243
|
-
if ((inst.
|
1283
|
+
// default to 0 AM if hours is not valid
|
1284
|
+
if ((inst.hours < inst.hours.starts) || (inst.hours > inst.hours.ends )) { inst.hours = 0; }
|
1285
|
+
// default to 0 minutes if minute is not valid
|
1286
|
+
if ((inst.minutes < inst.minutes.starts) || (inst.minutes > inst.minutes.ends)) { inst.minutes = 0; }
|
1244
1287
|
|
1245
1288
|
var period = "",
|
1246
1289
|
showPeriod = (this._get(inst, 'showPeriod') == true),
|
@@ -1254,6 +1297,10 @@
|
|
1254
1297
|
displayHours = selectedHours ? selectedHours : 0,
|
1255
1298
|
parsedTime = '';
|
1256
1299
|
|
1300
|
+
// fix some display problem when hours or minutes are not selected yet
|
1301
|
+
if (displayHours == -1) { displayHours = 0 }
|
1302
|
+
if (selectedMinutes == -1) { selectedMinutes = 0 }
|
1303
|
+
|
1257
1304
|
if (showPeriod) {
|
1258
1305
|
if (inst.hours == 0) {
|
1259
1306
|
displayHours = 12;
|
@@ -1287,10 +1334,10 @@
|
|
1287
1334
|
if (showHours) {
|
1288
1335
|
if (period.length > 0) { parsedTime += this._get(inst, 'periodSeparator') + period; }
|
1289
1336
|
}
|
1290
|
-
|
1337
|
+
|
1291
1338
|
return parsedTime;
|
1292
1339
|
},
|
1293
|
-
|
1340
|
+
|
1294
1341
|
/* Update any alternate field to synchronise with the main field. */
|
1295
1342
|
_updateAlternate: function(inst, newTime) {
|
1296
1343
|
var altField = this._get(inst, 'altField');
|
@@ -1301,6 +1348,19 @@
|
|
1301
1348
|
}
|
1302
1349
|
},
|
1303
1350
|
|
1351
|
+
_getTimeAsDateTimepicker: function(input) {
|
1352
|
+
var inst = this._getInst(input);
|
1353
|
+
if (inst.hours == -1 && inst.minutes == -1) {
|
1354
|
+
return '';
|
1355
|
+
}
|
1356
|
+
|
1357
|
+
// default to 0 AM if hours is not valid
|
1358
|
+
if ((inst.hours < inst.hours.starts) || (inst.hours > inst.hours.ends )) { inst.hours = 0; }
|
1359
|
+
// default to 0 minutes if minute is not valid
|
1360
|
+
if ((inst.minutes < inst.minutes.starts) || (inst.minutes > inst.minutes.ends)) { inst.minutes = 0; }
|
1361
|
+
|
1362
|
+
return new Date(0, 0, 0, inst.hours, inst.minutes, 0);
|
1363
|
+
},
|
1304
1364
|
/* This might look unused but it's called by the $.fn.timepicker function with param getTime */
|
1305
1365
|
/* added v 0.2.3 - gitHub issue #5 - Thanks edanuff */
|
1306
1366
|
_getTimeTimepicker : function(input) {
|
@@ -1323,30 +1383,32 @@
|
|
1323
1383
|
|
1324
1384
|
|
1325
1385
|
/* Invoke the timepicker functionality.
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1386
|
+
@param options string - a command, optionally followed by additional parameters or
|
1387
|
+
Object - settings for attaching new timepicker functionality
|
1388
|
+
@return jQuery object */
|
1329
1389
|
$.fn.timepicker = function (options) {
|
1330
1390
|
|
1331
1391
|
/* Initialise the time picker. */
|
1332
1392
|
if (!$.timepicker.initialized) {
|
1333
1393
|
$(document).mousedown($.timepicker._checkExternalClick).
|
1334
|
-
|
1394
|
+
find('body').append($.timepicker.tpDiv);
|
1335
1395
|
$.timepicker.initialized = true;
|
1336
1396
|
}
|
1337
1397
|
|
1398
|
+
|
1399
|
+
|
1338
1400
|
var otherArgs = Array.prototype.slice.call(arguments, 1);
|
1339
|
-
if (typeof options == 'string' && (options == 'getTime' || options == 'getHour' || options == 'getMinute' ))
|
1401
|
+
if (typeof options == 'string' && (options == 'getTime' || options == 'getTimeAsDate' || options == 'getHour' || options == 'getMinute' ))
|
1340
1402
|
return $.timepicker['_' + options + 'Timepicker'].
|
1341
|
-
|
1403
|
+
apply($.timepicker, [this[0]].concat(otherArgs));
|
1342
1404
|
if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
|
1343
1405
|
return $.timepicker['_' + options + 'Timepicker'].
|
1344
1406
|
apply($.timepicker, [this[0]].concat(otherArgs));
|
1345
1407
|
return this.each(function () {
|
1346
1408
|
typeof options == 'string' ?
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1409
|
+
$.timepicker['_' + options + 'Timepicker'].
|
1410
|
+
apply($.timepicker, [this].concat(otherArgs)) :
|
1411
|
+
$.timepicker._attachTimepicker(this, options);
|
1350
1412
|
});
|
1351
1413
|
};
|
1352
1414
|
|
@@ -1362,10 +1424,10 @@
|
|
1362
1424
|
$.timepicker = new Timepicker(); // singleton instance
|
1363
1425
|
$.timepicker.initialized = false;
|
1364
1426
|
$.timepicker.uuid = new Date().getTime();
|
1365
|
-
$.timepicker.version = "0.
|
1427
|
+
$.timepicker.version = "0.3.1";
|
1366
1428
|
|
1367
1429
|
// Workaround for #4055
|
1368
1430
|
// Add another global to avoid noConflict issues with inline event handlers
|
1369
1431
|
window['TP_jQuery_' + tpuuid] = $;
|
1370
1432
|
|
1371
|
-
})(jQuery);
|
1433
|
+
})(jQuery);
|