author | Lennard de Rijk <ljvderijk@gmail.com> |
Fri, 23 Jan 2009 11:32:53 +0000 | |
changeset 914 | 6ec8dd2a73b3 |
parent 839 | 3e50c012a4a8 |
child 2420 | 645f4de26f99 |
permissions | -rw-r--r-- |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
1 |
/* |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
2 |
* jQuery UI @VERSION |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
3 |
* |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
4 |
* Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
5 |
* Dual licensed under the MIT (MIT-LICENSE.txt) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
6 |
* and GPL (GPL-LICENSE.txt) licenses. |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
7 |
* |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
8 |
* http://docs.jquery.com/UI |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
9 |
*/ |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
10 |
;(function($) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
11 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
12 |
var _remove = $.fn.remove, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
13 |
isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
14 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
15 |
//Helper functions and ui object |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
16 |
$.ui = { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
17 |
version: "@VERSION", |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
18 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
19 |
// $.ui.plugin is deprecated. Use the proxy pattern instead. |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
20 |
plugin: { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
21 |
add: function(module, option, set) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
22 |
var proto = $.ui[module].prototype; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
23 |
for(var i in set) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
24 |
proto.plugins[i] = proto.plugins[i] || []; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
25 |
proto.plugins[i].push([option, set[i]]); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
26 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
27 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
28 |
call: function(instance, name, args) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
29 |
var set = instance.plugins[name]; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
30 |
if(!set) { return; } |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
31 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
32 |
for (var i = 0; i < set.length; i++) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
33 |
if (instance.options[set[i][0]]) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
34 |
set[i][1].apply(instance.element, args); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
35 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
36 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
37 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
38 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
39 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
40 |
contains: function(a, b) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
41 |
return document.compareDocumentPosition |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
42 |
? a.compareDocumentPosition(b) & 16 |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
43 |
: a !== b && a.contains(b); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
44 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
45 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
46 |
cssCache: {}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
47 |
css: function(name) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
48 |
if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; } |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
49 |
var tmp = $('<div class="ui-gen"></div>').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body'); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
50 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
51 |
//if (!$.browser.safari) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
52 |
//tmp.appendTo('body'); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
53 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
54 |
//Opera and Safari set width and height to 0px instead of auto |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
55 |
//Safari returns rgba(0,0,0,0) when bgcolor is not set |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
56 |
$.ui.cssCache[name] = !!( |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
57 |
(!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
58 |
!(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
59 |
); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
60 |
try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
61 |
return $.ui.cssCache[name]; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
62 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
63 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
64 |
hasScroll: function(el, a) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
65 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
66 |
//If overflow is hidden, the element might have extra content, but the user wants to hide it |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
67 |
if ($(el).css('overflow') == 'hidden') { return false; } |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
68 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
69 |
var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
70 |
has = false; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
71 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
72 |
if (el[scroll] > 0) { return true; } |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
73 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
74 |
// TODO: determine which cases actually cause this to happen |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
75 |
// if the element doesn't have the scroll set, see if it's possible to |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
76 |
// set the scroll |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
77 |
el[scroll] = 1; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
78 |
has = (el[scroll] > 0); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
79 |
el[scroll] = 0; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
80 |
return has; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
81 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
82 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
83 |
isOverAxis: function(x, reference, size) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
84 |
//Determines when x coordinate is over "b" element axis |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
85 |
return (x > reference) && (x < (reference + size)); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
86 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
87 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
88 |
isOver: function(y, x, top, left, height, width) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
89 |
//Determines when x, y coordinates is over "b" element |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
90 |
return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
91 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
92 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
93 |
keyCode: { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
94 |
BACKSPACE: 8, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
95 |
CAPS_LOCK: 20, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
96 |
COMMA: 188, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
97 |
CONTROL: 17, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
98 |
DELETE: 46, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
99 |
DOWN: 40, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
100 |
END: 35, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
101 |
ENTER: 13, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
102 |
ESCAPE: 27, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
103 |
HOME: 36, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
104 |
INSERT: 45, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
105 |
LEFT: 37, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
106 |
NUMPAD_ADD: 107, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
107 |
NUMPAD_DECIMAL: 110, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
108 |
NUMPAD_DIVIDE: 111, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
109 |
NUMPAD_ENTER: 108, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
110 |
NUMPAD_MULTIPLY: 106, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
111 |
NUMPAD_SUBTRACT: 109, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
112 |
PAGE_DOWN: 34, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
113 |
PAGE_UP: 33, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
114 |
PERIOD: 190, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
115 |
RIGHT: 39, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
116 |
SHIFT: 16, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
117 |
SPACE: 32, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
118 |
TAB: 9, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
119 |
UP: 38 |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
120 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
121 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
122 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
123 |
// WAI-ARIA normalization |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
124 |
if (isFF2) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
125 |
var attr = $.attr, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
126 |
removeAttr = $.fn.removeAttr, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
127 |
ariaNS = "http://www.w3.org/2005/07/aaa", |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
128 |
ariaState = /^aria-/, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
129 |
ariaRole = /^wairole:/; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
130 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
131 |
$.attr = function(elem, name, value) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
132 |
var set = value !== undefined; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
133 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
134 |
return (name == 'role' |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
135 |
? (set |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
136 |
? attr.call(this, elem, name, "wairole:" + value) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
137 |
: (attr.apply(this, arguments) || "").replace(ariaRole, "")) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
138 |
: (ariaState.test(name) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
139 |
? (set |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
140 |
? elem.setAttributeNS(ariaNS, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
141 |
name.replace(ariaState, "aaa:"), value) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
142 |
: attr.call(this, elem, name.replace(ariaState, "aaa:"))) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
143 |
: attr.apply(this, arguments))); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
144 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
145 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
146 |
$.fn.removeAttr = function(name) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
147 |
return (ariaState.test(name) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
148 |
? this.each(function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
149 |
this.removeAttributeNS(ariaNS, name.replace(ariaState, "")); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
150 |
}) : removeAttr.call(this, name)); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
151 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
152 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
153 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
154 |
//jQuery plugins |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
155 |
$.fn.extend({ |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
156 |
remove: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
157 |
// Safari has a native remove event which actually removes DOM elements, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
158 |
// so we have to use triggerHandler instead of trigger (#3037). |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
159 |
$("*", this).add(this).each(function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
160 |
$(this).triggerHandler("remove"); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
161 |
}); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
162 |
return _remove.apply(this, arguments ); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
163 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
164 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
165 |
enableSelection: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
166 |
return this |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
167 |
.attr('unselectable', 'off') |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
168 |
.css('MozUserSelect', '') |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
169 |
.unbind('selectstart.ui'); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
170 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
171 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
172 |
disableSelection: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
173 |
return this |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
174 |
.attr('unselectable', 'on') |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
175 |
.css('MozUserSelect', 'none') |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
176 |
.bind('selectstart.ui', function() { return false; }); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
177 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
178 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
179 |
scrollParent: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
180 |
var scrollParent; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
181 |
if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
182 |
scrollParent = this.parents().filter(function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
183 |
return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
184 |
}).eq(0); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
185 |
} else { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
186 |
scrollParent = this.parents().filter(function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
187 |
return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
188 |
}).eq(0); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
189 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
190 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
191 |
return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
192 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
193 |
}); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
194 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
195 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
196 |
//Additional selectors |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
197 |
$.extend($.expr[':'], { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
198 |
data: function(elem, i, match) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
199 |
return !!$.data(elem, match[3]); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
200 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
201 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
202 |
// TODO: add support for object, area |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
203 |
tabbable: function(elem) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
204 |
var nodeName = elem.nodeName.toLowerCase(); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
205 |
function isVisible(element) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
206 |
return !($(element).is(':hidden') || $(element).parents(':hidden').length); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
207 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
208 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
209 |
return ( |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
210 |
// in tab order |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
211 |
elem.tabIndex >= 0 && |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
212 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
213 |
( // filter node types that participate in the tab order |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
214 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
215 |
// anchor tag |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
216 |
('a' == nodeName && elem.href) || |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
217 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
218 |
// enabled form element |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
219 |
(/input|select|textarea|button/.test(nodeName) && |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
220 |
'hidden' != elem.type && !elem.disabled) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
221 |
) && |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
222 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
223 |
// visible on page |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
224 |
isVisible(elem) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
225 |
); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
226 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
227 |
}); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
228 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
229 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
230 |
// $.widget is a factory to create jQuery plugins |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
231 |
// taking some boilerplate code out of the plugin code |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
232 |
function getter(namespace, plugin, method, args) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
233 |
function getMethods(type) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
234 |
var methods = $[namespace][plugin][type] || []; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
235 |
return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
236 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
237 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
238 |
var methods = getMethods('getter'); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
239 |
if (args.length == 1 && typeof args[0] == 'string') { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
240 |
methods = methods.concat(getMethods('getterSetter')); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
241 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
242 |
return ($.inArray(method, methods) != -1); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
243 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
244 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
245 |
$.widget = function(name, prototype) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
246 |
var namespace = name.split(".")[0]; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
247 |
name = name.split(".")[1]; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
248 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
249 |
// create plugin method |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
250 |
$.fn[name] = function(options) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
251 |
var isMethodCall = (typeof options == 'string'), |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
252 |
args = Array.prototype.slice.call(arguments, 1); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
253 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
254 |
// prevent calls to internal methods |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
255 |
if (isMethodCall && options.substring(0, 1) == '_') { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
256 |
return this; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
257 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
258 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
259 |
// handle getter methods |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
260 |
if (isMethodCall && getter(namespace, name, options, args)) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
261 |
var instance = $.data(this[0], name); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
262 |
return (instance ? instance[options].apply(instance, args) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
263 |
: undefined); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
264 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
265 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
266 |
// handle initialization and non-getter methods |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
267 |
return this.each(function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
268 |
var instance = $.data(this, name); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
269 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
270 |
// constructor |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
271 |
(!instance && !isMethodCall && |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
272 |
$.data(this, name, new $[namespace][name](this, options))); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
273 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
274 |
// method call |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
275 |
(instance && isMethodCall && $.isFunction(instance[options]) && |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
276 |
instance[options].apply(instance, args)); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
277 |
}); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
278 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
279 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
280 |
// create widget constructor |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
281 |
$[namespace] = $[namespace] || {}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
282 |
$[namespace][name] = function(element, options) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
283 |
var self = this; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
284 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
285 |
this.namespace = namespace; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
286 |
this.widgetName = name; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
287 |
this.widgetEventPrefix = $[namespace][name].eventPrefix || name; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
288 |
this.widgetBaseClass = namespace + '-' + name; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
289 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
290 |
this.options = $.extend({}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
291 |
$.widget.defaults, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
292 |
$[namespace][name].defaults, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
293 |
$.metadata && $.metadata.get(element)[name], |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
294 |
options); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
295 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
296 |
this.element = $(element) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
297 |
.bind('setData.' + name, function(event, key, value) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
298 |
if (event.target == element) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
299 |
return self._setData(key, value); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
300 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
301 |
}) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
302 |
.bind('getData.' + name, function(event, key) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
303 |
if (event.target == element) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
304 |
return self._getData(key); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
305 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
306 |
}) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
307 |
.bind('remove', function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
308 |
return self.destroy(); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
309 |
}); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
310 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
311 |
this._init(); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
312 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
313 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
314 |
// add widget prototype |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
315 |
$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
316 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
317 |
// TODO: merge getter and getterSetter properties from widget prototype |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
318 |
// and plugin prototype |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
319 |
$[namespace][name].getterSetter = 'option'; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
320 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
321 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
322 |
$.widget.prototype = { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
323 |
_init: function() {}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
324 |
destroy: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
325 |
this.element.removeData(this.widgetName) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
326 |
.removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled') |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
327 |
.removeAttr('aria-disabled'); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
328 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
329 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
330 |
option: function(key, value) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
331 |
var options = key, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
332 |
self = this; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
333 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
334 |
if (typeof key == "string") { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
335 |
if (value === undefined) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
336 |
return this._getData(key); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
337 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
338 |
options = {}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
339 |
options[key] = value; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
340 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
341 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
342 |
$.each(options, function(key, value) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
343 |
self._setData(key, value); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
344 |
}); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
345 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
346 |
_getData: function(key) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
347 |
return this.options[key]; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
348 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
349 |
_setData: function(key, value) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
350 |
this.options[key] = value; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
351 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
352 |
if (key == 'disabled') { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
353 |
this.element |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
354 |
[value ? 'addClass' : 'removeClass']( |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
355 |
this.widgetBaseClass + '-disabled' + ' ' + |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
356 |
this.namespace + '-state-disabled') |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
357 |
.attr("aria-disabled", value); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
358 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
359 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
360 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
361 |
enable: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
362 |
this._setData('disabled', false); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
363 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
364 |
disable: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
365 |
this._setData('disabled', true); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
366 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
367 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
368 |
_trigger: function(type, event, data) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
369 |
var callback = this.options[type], |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
370 |
eventName = (type == this.widgetEventPrefix |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
371 |
? type : this.widgetEventPrefix + type); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
372 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
373 |
event = event ? $.event.fix(event) : $.Event(); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
374 |
event.type = eventName; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
375 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
376 |
this.element.trigger(event, data); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
377 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
378 |
return !(callback && callback.call(this.element[0], event, data) === false |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
379 |
|| event.isDefaultPrevented()); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
380 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
381 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
382 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
383 |
$.widget.defaults = { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
384 |
disabled: false |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
385 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
386 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
387 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
388 |
/** Mouse Interaction Plugin **/ |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
389 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
390 |
$.ui.mouse = { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
391 |
_mouseInit: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
392 |
var self = this; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
393 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
394 |
this.element |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
395 |
.bind('mousedown.'+this.widgetName, function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
396 |
return self._mouseDown(event); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
397 |
}) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
398 |
.bind('click.'+this.widgetName, function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
399 |
if(self._preventClickEvent) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
400 |
self._preventClickEvent = false; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
401 |
return false; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
402 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
403 |
}); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
404 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
405 |
// Prevent text selection in IE |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
406 |
if ($.browser.msie) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
407 |
this._mouseUnselectable = this.element.attr('unselectable'); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
408 |
this.element.attr('unselectable', 'on'); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
409 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
410 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
411 |
this.started = false; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
412 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
413 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
414 |
// TODO: make sure destroying one instance of mouse doesn't mess with |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
415 |
// other instances of mouse |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
416 |
_mouseDestroy: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
417 |
this.element.unbind('.'+this.widgetName); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
418 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
419 |
// Restore text selection in IE |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
420 |
($.browser.msie |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
421 |
&& this.element.attr('unselectable', this._mouseUnselectable)); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
422 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
423 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
424 |
_mouseDown: function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
425 |
// we may have missed mouseup (out of window) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
426 |
(this._mouseStarted && this._mouseUp(event)); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
427 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
428 |
this._mouseDownEvent = event; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
429 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
430 |
var self = this, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
431 |
btnIsLeft = (event.which == 1), |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
432 |
elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
433 |
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
434 |
return true; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
435 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
436 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
437 |
this.mouseDelayMet = !this.options.delay; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
438 |
if (!this.mouseDelayMet) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
439 |
this._mouseDelayTimer = setTimeout(function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
440 |
self.mouseDelayMet = true; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
441 |
}, this.options.delay); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
442 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
443 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
444 |
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
445 |
this._mouseStarted = (this._mouseStart(event) !== false); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
446 |
if (!this._mouseStarted) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
447 |
event.preventDefault(); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
448 |
return true; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
449 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
450 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
451 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
452 |
// these delegates are required to keep context |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
453 |
this._mouseMoveDelegate = function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
454 |
return self._mouseMove(event); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
455 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
456 |
this._mouseUpDelegate = function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
457 |
return self._mouseUp(event); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
458 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
459 |
$(document) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
460 |
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
461 |
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
462 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
463 |
// preventDefault() is used to prevent the selection of text here - |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
464 |
// however, in Safari, this causes select boxes not to be selectable |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
465 |
// anymore, so this fix is needed |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
466 |
($.browser.safari || event.preventDefault()); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
467 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
468 |
return true; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
469 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
470 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
471 |
_mouseMove: function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
472 |
// IE mouseup check - mouseup happened when mouse was out of window |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
473 |
if ($.browser.msie && !event.button) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
474 |
return this._mouseUp(event); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
475 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
476 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
477 |
if (this._mouseStarted) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
478 |
this._mouseDrag(event); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
479 |
return event.preventDefault(); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
480 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
481 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
482 |
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
483 |
this._mouseStarted = |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
484 |
(this._mouseStart(this._mouseDownEvent, event) !== false); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
485 |
(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
486 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
487 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
488 |
return !this._mouseStarted; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
489 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
490 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
491 |
_mouseUp: function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
492 |
$(document) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
493 |
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
494 |
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
495 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
496 |
if (this._mouseStarted) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
497 |
this._mouseStarted = false; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
498 |
this._preventClickEvent = true; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
499 |
this._mouseStop(event); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
500 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
501 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
502 |
return false; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
503 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
504 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
505 |
_mouseDistanceMet: function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
506 |
return (Math.max( |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
507 |
Math.abs(this._mouseDownEvent.pageX - event.pageX), |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
508 |
Math.abs(this._mouseDownEvent.pageY - event.pageY) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
509 |
) >= this.options.distance |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
510 |
); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
511 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
512 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
513 |
_mouseDelayMet: function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
514 |
return this.mouseDelayMet; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
515 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
516 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
517 |
// These are placeholder methods, to be overriden by extending plugin |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
518 |
_mouseStart: function(event) {}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
519 |
_mouseDrag: function(event) {}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
520 |
_mouseStop: function(event) {}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
521 |
_mouseCapture: function(event) { return true; } |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
522 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
523 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
524 |
$.ui.mouse.defaults = { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
525 |
cancel: null, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
526 |
distance: 1, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
527 |
delay: 0 |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
528 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
529 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
530 |
})(jQuery); |