author | Lennard de Rijk <ljvderijk@gmail.com> |
Sat, 04 Jul 2009 14:19:39 +0200 | |
changeset 2528 | 9de8348890d8 |
parent 2420 | 645f4de26f99 |
child 2749 | 4e2789b8e86d |
permissions | -rw-r--r-- |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
1 |
/* |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
2 |
* jQuery UI 1.6 |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
3 |
* |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
4 |
* Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) |
839
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 = { |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
17 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
18 |
version: "1.6", |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
19 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
20 |
// $.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
|
21 |
plugin: { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
22 |
add: function(module, option, set) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
23 |
var proto = $.ui[module].prototype; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
24 |
for(var i in set) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
25 |
proto.plugins[i] = proto.plugins[i] || []; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
26 |
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
|
27 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
28 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
29 |
call: function(instance, name, args) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
30 |
var set = instance.plugins[name]; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
31 |
if(!set) { return; } |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
32 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
33 |
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
|
34 |
if (instance.options[set[i][0]]) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
35 |
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
|
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 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
41 |
contains: function(a, b) { |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
42 |
var safari2 = $.browser.safari && $.browser.version < 522; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
43 |
if (a.contains && !safari2) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
44 |
return a.contains(b); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
45 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
46 |
if (a.compareDocumentPosition) |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
47 |
return !!(a.compareDocumentPosition(b) & 16); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
48 |
while (b = b.parentNode) |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
49 |
if (b == a) return true; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
50 |
return false; |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
51 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
52 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
53 |
cssCache: {}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
54 |
css: function(name) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
55 |
if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; } |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
56 |
var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body'); |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
57 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
58 |
//if (!$.browser.safari) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
59 |
//tmp.appendTo('body'); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
60 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
61 |
//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
|
62 |
//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
|
63 |
$.ui.cssCache[name] = !!( |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
64 |
(!(/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
|
65 |
!(/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
|
66 |
); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
67 |
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
|
68 |
return $.ui.cssCache[name]; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
69 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
70 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
71 |
hasScroll: function(el, a) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
72 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
73 |
//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
|
74 |
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
|
75 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
76 |
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
|
77 |
has = false; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
78 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
79 |
if (el[scroll] > 0) { return true; } |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
80 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
81 |
// 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
|
82 |
// 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
|
83 |
// set the scroll |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
84 |
el[scroll] = 1; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
85 |
has = (el[scroll] > 0); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
86 |
el[scroll] = 0; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
87 |
return has; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
88 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
89 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
90 |
isOverAxis: function(x, reference, size) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
91 |
//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
|
92 |
return (x > reference) && (x < (reference + size)); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
93 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
94 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
95 |
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
|
96 |
//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
|
97 |
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
|
98 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
99 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
100 |
keyCode: { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
101 |
BACKSPACE: 8, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
102 |
CAPS_LOCK: 20, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
103 |
COMMA: 188, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
104 |
CONTROL: 17, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
105 |
DELETE: 46, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
106 |
DOWN: 40, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
107 |
END: 35, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
108 |
ENTER: 13, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
109 |
ESCAPE: 27, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
110 |
HOME: 36, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
111 |
INSERT: 45, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
112 |
LEFT: 37, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
113 |
NUMPAD_ADD: 107, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
114 |
NUMPAD_DECIMAL: 110, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
115 |
NUMPAD_DIVIDE: 111, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
116 |
NUMPAD_ENTER: 108, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
117 |
NUMPAD_MULTIPLY: 106, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
118 |
NUMPAD_SUBTRACT: 109, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
119 |
PAGE_DOWN: 34, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
120 |
PAGE_UP: 33, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
121 |
PERIOD: 190, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
122 |
RIGHT: 39, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
123 |
SHIFT: 16, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
124 |
SPACE: 32, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
125 |
TAB: 9, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
126 |
UP: 38 |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
127 |
} |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
128 |
|
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
129 |
}; |
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 |
// WAI-ARIA normalization |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
132 |
if (isFF2) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
133 |
var attr = $.attr, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
134 |
removeAttr = $.fn.removeAttr, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
135 |
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
|
136 |
ariaState = /^aria-/, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
137 |
ariaRole = /^wairole:/; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
138 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
139 |
$.attr = function(elem, name, value) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
140 |
var set = value !== undefined; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
141 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
142 |
return (name == 'role' |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
143 |
? (set |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
144 |
? 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
|
145 |
: (attr.apply(this, arguments) || "").replace(ariaRole, "")) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
146 |
: (ariaState.test(name) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
147 |
? (set |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
148 |
? elem.setAttributeNS(ariaNS, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
149 |
name.replace(ariaState, "aaa:"), value) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
150 |
: 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
|
151 |
: attr.apply(this, arguments))); |
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 |
$.fn.removeAttr = function(name) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
155 |
return (ariaState.test(name) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
156 |
? this.each(function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
157 |
this.removeAttributeNS(ariaNS, name.replace(ariaState, "")); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
158 |
}) : removeAttr.call(this, name)); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
159 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
160 |
} |
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 |
//jQuery plugins |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
163 |
$.fn.extend({ |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
164 |
|
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
165 |
remove: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
166 |
// 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
|
167 |
// 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
|
168 |
$("*", this).add(this).each(function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
169 |
$(this).triggerHandler("remove"); |
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 |
return _remove.apply(this, arguments ); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
172 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
173 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
174 |
enableSelection: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
175 |
return this |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
176 |
.attr('unselectable', 'off') |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
177 |
.css('MozUserSelect', '') |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
178 |
.unbind('selectstart.ui'); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
179 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
180 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
181 |
disableSelection: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
182 |
return this |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
183 |
.attr('unselectable', 'on') |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
184 |
.css('MozUserSelect', 'none') |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
185 |
.bind('selectstart.ui', function() { return false; }); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
186 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
187 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
188 |
scrollParent: function() { |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
189 |
|
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
190 |
var scrollParent; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
191 |
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
|
192 |
scrollParent = this.parents().filter(function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
193 |
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
|
194 |
}).eq(0); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
195 |
} else { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
196 |
scrollParent = this.parents().filter(function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
197 |
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
|
198 |
}).eq(0); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
199 |
} |
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 |
return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
202 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
203 |
|
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
204 |
} |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
205 |
|
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
206 |
}); |
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 |
//Additional selectors |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
210 |
$.extend($.expr[':'], { |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
211 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
212 |
data: function(a, i, m) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
213 |
return $.data(a, m[3]); |
839
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 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
216 |
// TODO: add support for object, area |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
217 |
tabbable: function(a, i, m) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
218 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
219 |
var nodeName = a.nodeName.toLowerCase(); |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
220 |
function isVisible(element) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
221 |
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
|
222 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
223 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
224 |
return ( |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
225 |
// in tab order |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
226 |
a.tabIndex >= 0 && |
839
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 |
( // 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
|
229 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
230 |
// anchor tag |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
231 |
('a' == nodeName && a.href) || |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
232 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
233 |
// enabled form element |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
234 |
(/input|select|textarea|button/.test(nodeName) && |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
235 |
'hidden' != a.type && !a.disabled) |
839
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 |
// visible on page |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
239 |
isVisible(a) |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
240 |
); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
241 |
|
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
242 |
} |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
243 |
|
839
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 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
246 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
247 |
// $.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
|
248 |
// 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
|
249 |
function getter(namespace, plugin, method, args) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
250 |
function getMethods(type) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
251 |
var methods = $[namespace][plugin][type] || []; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
252 |
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
|
253 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
254 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
255 |
var methods = getMethods('getter'); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
256 |
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
|
257 |
methods = methods.concat(getMethods('getterSetter')); |
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 |
return ($.inArray(method, methods) != -1); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
260 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
261 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
262 |
$.widget = function(name, prototype) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
263 |
var namespace = name.split(".")[0]; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
264 |
name = name.split(".")[1]; |
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 |
// create plugin method |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
267 |
$.fn[name] = function(options) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
268 |
var isMethodCall = (typeof options == 'string'), |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
269 |
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
|
270 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
271 |
// prevent calls to internal methods |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
272 |
if (isMethodCall && options.substring(0, 1) == '_') { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
273 |
return this; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
274 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
275 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
276 |
// handle getter methods |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
277 |
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
|
278 |
var instance = $.data(this[0], name); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
279 |
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
|
280 |
: undefined); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
281 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
282 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
283 |
// handle initialization and non-getter methods |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
284 |
return this.each(function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
285 |
var instance = $.data(this, name); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
286 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
287 |
// constructor |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
288 |
(!instance && !isMethodCall && |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
289 |
$.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
|
290 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
291 |
// method call |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
292 |
(instance && isMethodCall && $.isFunction(instance[options]) && |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
293 |
instance[options].apply(instance, args)); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
294 |
}); |
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 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
297 |
// create widget constructor |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
298 |
$[namespace] = $[namespace] || {}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
299 |
$[namespace][name] = function(element, options) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
300 |
var self = this; |
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 |
this.widgetName = name; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
303 |
this.widgetEventPrefix = $[namespace][name].eventPrefix || name; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
304 |
this.widgetBaseClass = namespace + '-' + name; |
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 |
this.options = $.extend({}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
307 |
$.widget.defaults, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
308 |
$[namespace][name].defaults, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
309 |
$.metadata && $.metadata.get(element)[name], |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
310 |
options); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
311 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
312 |
this.element = $(element) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
313 |
.bind('setData.' + name, function(event, key, value) { |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
314 |
return self._setData(key, value); |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
315 |
}) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
316 |
.bind('getData.' + name, function(event, key) { |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
317 |
return self._getData(key); |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
318 |
}) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
319 |
.bind('remove', function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
320 |
return self.destroy(); |
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 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
323 |
this._init(); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
324 |
}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
325 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
326 |
// add widget prototype |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
327 |
$[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
|
328 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
329 |
// 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
|
330 |
// and plugin prototype |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
331 |
$[namespace][name].getterSetter = 'option'; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
332 |
}; |
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 |
$.widget.prototype = { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
335 |
_init: function() {}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
336 |
destroy: function() { |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
337 |
this.element.removeData(this.widgetName); |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
338 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
339 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
340 |
option: function(key, value) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
341 |
var options = key, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
342 |
self = this; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
343 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
344 |
if (typeof key == "string") { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
345 |
if (value === undefined) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
346 |
return this._getData(key); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
347 |
} |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
348 |
options = {}; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
349 |
options[key] = value; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
350 |
} |
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 |
$.each(options, function(key, value) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
353 |
self._setData(key, value); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
354 |
}); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
355 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
356 |
_getData: function(key) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
357 |
return this.options[key]; |
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 |
_setData: function(key, value) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
360 |
this.options[key] = value; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
361 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
362 |
if (key == 'disabled') { |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
363 |
this.element[value ? 'addClass' : 'removeClass']( |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
364 |
this.widgetBaseClass + '-disabled'); |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
365 |
} |
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 |
enable: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
369 |
this._setData('disabled', false); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
370 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
371 |
disable: function() { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
372 |
this._setData('disabled', true); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
373 |
}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
374 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
375 |
_trigger: function(type, event, data) { |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
376 |
var eventName = (type == this.widgetEventPrefix |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
377 |
? type : this.widgetEventPrefix + type); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
378 |
event = event || $.event.fix({ type: eventName, target: this.element[0] }); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
379 |
return this.element.triggerHandler(eventName, [event, data], this.options[type]); |
839
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 |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
839
diff
changeset
|
466 |
if(!$.browser.safari) event.preventDefault(); |
839
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
467 |
return true; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
468 |
}, |
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 |
_mouseMove: function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
471 |
// 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
|
472 |
if ($.browser.msie && !event.button) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
473 |
return this._mouseUp(event); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
474 |
} |
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 |
if (this._mouseStarted) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
477 |
this._mouseDrag(event); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
478 |
return event.preventDefault(); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
479 |
} |
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 |
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
|
482 |
this._mouseStarted = |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
483 |
(this._mouseStart(this._mouseDownEvent, event) !== false); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
484 |
(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
|
485 |
} |
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 |
return !this._mouseStarted; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
488 |
}, |
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 |
_mouseUp: function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
491 |
$(document) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
492 |
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
493 |
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
494 |
|
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
495 |
if (this._mouseStarted) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
496 |
this._mouseStarted = false; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
497 |
this._preventClickEvent = true; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
498 |
this._mouseStop(event); |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
499 |
} |
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 |
return false; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
502 |
}, |
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 |
_mouseDistanceMet: function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
505 |
return (Math.max( |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
506 |
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
|
507 |
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
|
508 |
) >= this.options.distance |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
509 |
); |
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 |
_mouseDelayMet: function(event) { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
513 |
return this.mouseDelayMet; |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
514 |
}, |
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 |
// 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
|
517 |
_mouseStart: function(event) {}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
518 |
_mouseDrag: function(event) {}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
519 |
_mouseStop: function(event) {}, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
520 |
_mouseCapture: function(event) { return true; } |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
521 |
}; |
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 |
$.ui.mouse.defaults = { |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
524 |
cancel: null, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
525 |
distance: 1, |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
526 |
delay: 0 |
3e50c012a4a8
Add datetimepicker javascript widget files and css file.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff
changeset
|
527 |
}; |
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 |
})(jQuery); |