compass-jquery-plugin 0.3.2.3 → 0.3.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +54 -37
- data/VERSION.yml +1 -1
- data/lib/handle_attributes.rb +4 -4
- data/lib/handle_js_files.rb +5 -5
- data/lib/jqtouch_theme.rb +2 -2
- data/lib/jquery/dynatree.rb +2 -2
- data/lib/jquery/emulators.rb +1 -1
- data/lib/jquery/flash_messages.rb +6 -6
- data/lib/jquery/graphics.rb +5 -0
- data/lib/jquery/gridify/assertions.rb +1 -1
- data/lib/jquery/gridify/grid.rb +76 -59
- data/lib/jquery/gridify/grid_column.rb +73 -67
- data/lib/jquery/gridify/grid_finder.rb +79 -79
- data/lib/jquery/gridify/grid_options.rb +154 -149
- data/lib/jquery/gridify/grid_view.rb +143 -143
- data/lib/jquery/gridify.rb +25 -25
- data/lib/jquery/ical/calendar.rb +2 -2
- data/lib/jquery/ical/event.rb +48 -44
- data/lib/jquery/ical/helpers/ui_event_helper.rb +3 -3
- data/lib/jquery/jqgrid/jqgrid.rb +58 -58
- data/lib/jquery/jqgrid.rb +1 -1
- data/lib/jquery/jqtouch.rb +1 -1
- data/lib/jquery/jquery.rb +117 -117
- data/lib/jquery/jquery_auto_complete.rb +9 -9
- data/lib/jquery/jquery_json_response.rb +12 -12
- data/lib/jquery/jquery_selector_assertions.rb +55 -53
- data/lib/jquery/jstree.rb +2 -2
- data/lib/jquery/mobile.rb +1 -1
- data/lib/jquery/ribbon.rb +2 -2
- data/lib/jquery/secret_sauce/controller/ui_dialog_controls.rb +5 -5
- data/lib/jquery/secret_sauce/controller/ui_grid_controls.rb +5 -5
- data/lib/jquery/secret_sauce/helpers/ui_dialog_helper.rb +1 -1
- data/lib/jquery/secret_sauce/helpers/ui_form_helper.rb +39 -39
- data/lib/jquery/secret_sauce/helpers/ui_grid_helper.rb +74 -74
- data/lib/jquery/secret_sauce/model/find_for_grid.rb +21 -21
- data/lib/jquery/secret_sauce.rb +1 -1
- data/lib/jquery/tools.rb +1 -1
- data/lib/jquery_mobile_theme.rb +2 -2
- data/lib/jquery_ui_theme.rb +12 -12
- data/templates/dynatree/config/initializers/dynatree.rb +3 -3
- data/templates/dynatree/jquery/dynatree/aero.scss +16 -16
- data/templates/dynatree/jquery/dynatree/aqua.scss +16 -16
- data/templates/dynatree/jquery/dynatree/crystal.scss +16 -16
- data/templates/dynatree/jquery/dynatree/xp.scss +17 -17
- data/templates/dynatree/jquery.dynatree.js +2926 -2912
- data/templates/emulators/config/initializers/emulators.rb +6 -6
- data/templates/graphics/config/initializers/graphics.rb +5 -0
- data/templates/graphics/jquery/ganttView.scss +89 -0
- data/templates/graphics/jquery.ganttView.js +1669 -0
- data/templates/graphics/jquery.ganttView.min.js +70 -0
- data/templates/{jquery → graphics}/jquery.sparkline.js +466 -438
- data/templates/{jquery → graphics}/jquery.sparkline.min.js +0 -0
- data/templates/graphics/manifest.rb +9 -0
- data/templates/jqgrid/config/initializers/jqgrid.rb +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ar.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-bg.js +135 -131
- data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +135 -131
- data/templates/jqgrid/i18n/jqgrid/locale-cat.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-cn.js +137 -131
- data/templates/jqgrid/i18n/jqgrid/locale-cs.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-da.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-de.js +138 -132
- data/templates/jqgrid/i18n/jqgrid/locale-el.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-en.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-es.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-fa.js +19 -16
- data/templates/jqgrid/i18n/jqgrid/locale-fi.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-fr.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-gl.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-he.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-hu.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-is.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-it.js +8 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ja.js +139 -136
- data/templates/jqgrid/i18n/jqgrid/locale-nl.js +4 -1
- data/templates/jqgrid/i18n/jqgrid/locale-no.js +14 -1
- data/templates/jqgrid/i18n/jqgrid/locale-pl.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-pt.js +130 -124
- data/templates/jqgrid/i18n/jqgrid/locale-ro.js +144 -138
- data/templates/jqgrid/i18n/jqgrid/locale-ru.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-sk.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-sr.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-sv.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-tr.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-ua.js +132 -126
- data/templates/jqgrid/jquery.jqGrid.js +12735 -10444
- data/templates/jqgrid/jquery.jqGrid.min.js +477 -469
- data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +12 -10
- data/templates/jqtouch/config/initializers/jqtouch.rb +3 -3
- data/templates/jqtouch/jquery/touch/jqtouch.scss +1 -1
- data/templates/jqtouch/jquery.jqtouch.js +10025 -10043
- data/templates/jquery/config/initializers/jquery.rb +2 -4
- data/templates/jquery/history.adapter.jquery.js +71 -0
- data/templates/jquery/history.adapter.jquery.min.js +4 -0
- data/templates/jquery/history.html4.js +690 -0
- data/templates/jquery/history.html4.min.js +21 -0
- data/templates/jquery/history.js +1297 -0
- data/templates/jquery/history.min.js +29 -0
- data/templates/jquery/i18n/jquery.ui/datepicker-af.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-ar.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-az.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-bg.js +8 -8
- data/templates/jquery/i18n/jquery.ui/datepicker-bs.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ca.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-cs.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-da.js +14 -14
- data/templates/jquery/i18n/jquery.ui/datepicker-de.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-el.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-GB.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-eo.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-es.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-et.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-eu.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fa.js +18 -18
- data/templates/jquery/i18n/jquery.ui/datepicker-fi.js +15 -15
- data/templates/jquery/i18n/jquery.ui/datepicker-fo.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fr-CH.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fr.js +22 -22
- data/templates/jquery/i18n/jquery.ui/datepicker-gl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-he.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hu.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hu.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-hy.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-id.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-is.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-it.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ja.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ko.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-kz.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-lt.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-lv.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ml.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ms.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-nl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-no.js +16 -16
- data/templates/jquery/i18n/jquery.ui/datepicker-no.min.js +2 -2
- data/templates/jquery/i18n/jquery.ui/datepicker-pl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-pt-BR.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-pt.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-rm.js +18 -18
- data/templates/jquery/i18n/jquery.ui/datepicker-ro.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ru.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sk.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sq.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sr-SR.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sv.js +14 -14
- data/templates/jquery/i18n/jquery.ui/datepicker-ta.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-th.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-tr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-uk.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-vi.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-CN.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-HK.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-TW.js +20 -20
- data/templates/jquery/{partials → jquery/ui}/_flash_messages.scss +0 -0
- data/templates/jquery/jquery/ui/_theme.scss +14 -13
- data/templates/jquery/jquery/ui/contextMenu/configure.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/copy.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/cut.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/delete.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/edit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/exit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/new.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/paste.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/rename.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/show.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/trash.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu.scss +16 -10
- data/templates/jquery/jquery-ui.js +11839 -23066
- data/templates/jquery/jquery-ui.min.js +401 -795
- data/templates/jquery/jquery.bgiframe.js +27 -25
- data/templates/jquery/jquery.contextMenu.js +209 -196
- data/templates/jquery/jquery.cookie.js +3 -1
- data/templates/jquery/jquery.dotimeout.js +236 -228
- data/templates/jquery/jquery.dst.js +154 -151
- data/templates/jquery/jquery.farbtastic.js +293 -293
- data/templates/jquery/jquery.flashMessages.js +26 -0
- data/templates/jquery/jquery.flashMessages.min.js +1 -0
- data/templates/jquery/jquery.form.js +803 -786
- data/templates/jquery/jquery.haml.js +248 -247
- data/templates/jquery/jquery.hotkeys.js +89 -89
- data/templates/jquery/jquery.js +8141 -8106
- data/templates/jquery/jquery.layout.js +2451 -2415
- data/templates/jquery/jquery.min.js +167 -166
- data/templates/jquery/jquery.mousewheel.js +62 -54
- data/templates/jquery/jquery.offline.js +171 -171
- data/templates/jquery/jquery.pngFix.js +76 -76
- data/templates/jquery/jquery.replacetext.js +83 -83
- data/templates/jquery/jquery.themeswitchertool.js +202 -177
- data/templates/jquery/jquery.tmpl.js +478 -473
- data/templates/jquery/jquery.tmplPlus.js +82 -81
- data/templates/jquery/jrails.js +178 -175
- data/templates/jquery/json.js +77 -7
- data/templates/jquery/json2.js +480 -0
- data/templates/jquery/json2.min.js +7 -0
- data/templates/jquery/lib/tasks/haml.rake +2 -2
- data/templates/jquery/manifest.rb +21 -17
- data/templates/jstree/jquery.jstree.js +5967 -4536
- data/templates/mobile/config/initializers/mobile.rb +1 -1
- data/templates/mobile/jquery/mobile/_base.scss +944 -927
- data/templates/mobile/jquery/mobile/default.scss +61 -48
- data/templates/mobile/jquery/mobile/valencia.scss +56 -42
- data/templates/mobile/jquery.mobile.js +4461 -4347
- data/templates/mobile/jquery.mobile.min.js +11 -2
- data/templates/mobile/lib/tasks/jquery.mobile.rake +12 -12
- data/templates/ribbon/config/initializers/ribbon.rb +2 -2
- data/templates/ribbon/jquery.ribbon.js +50 -29
- data/templates/secret_sauce/secret_sauce.js +8 -8
- data/templates/tools/flowplayer.js +945 -1
- data/templates/tools/jquery.tools.js +4645 -4335
- data/templates/tools/jquery.tools.min.js +37 -37
- data/templates/tools/lib/tasks/jquery.tools.rake +4 -4
- data/templates/tools/swfobject.js +813 -773
- metadata +33 -21
- data/templates/jquery/haml.js +0 -506
- data/templates/jquery/haml.min.js +0 -5
- data/templates/jquery/jquery/ui/contextMenu/door.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_copy.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_delete.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_edit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_new.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_paste.png +0 -0
- data/templates/jquery/jquery.compat-1.3.js +0 -291
- data/templates/jquery/jquery.compat-1.3.min.js +0 -6
- data/templates/jquery/jquery.flash_messages.js +0 -5
- data/templates/jquery/jquery.flash_messages.min.js +0 -1
- data/templates/jquery/jquery.history.js +0 -194
- data/templates/jquery/jquery.history.min.js +0 -5
@@ -1,154 +1,157 @@
|
|
1
1
|
/* DSt:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
*/
|
30
|
-
|
31
|
-
jQuery.DSt = (function()
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
}
|
152
|
-
|
2
|
+
a simple, agnostic DOM Storage library.
|
3
|
+
http://github.com/gamache/DSt
|
4
|
+
|
5
|
+
AUTHORSHIP:
|
6
|
+
copyright 2010 pete gamache gamache!@#$!@#gmail.com
|
7
|
+
licensed under the MIT License and/or the GPL version 2
|
8
|
+
|
9
|
+
SYNOPSIS:
|
10
|
+
DSt uses the localStorage mechanism to provide per-site, persistent
|
11
|
+
storage of JSON-encodable data.
|
12
|
+
|
13
|
+
USAGE:
|
14
|
+
|
15
|
+
DSt.set(key, value); // sets stored value for given key
|
16
|
+
var value = DSt.get(key); // returns stored value for given key
|
17
|
+
|
18
|
+
DSt.store(input_elt); // stores value of a form input element
|
19
|
+
DSt.recall(input_elt); // recalls stored value of a form input elt
|
20
|
+
|
21
|
+
DSt.store_form(form_elt); // runs DSt.store(elt) on each form input
|
22
|
+
DSt.populate_form(form_elt); // runs DSt.recall(elt) on each form input
|
23
|
+
|
24
|
+
Element IDs may always be given in place of the elements themselves.
|
25
|
+
Values handled by DSt.get/DSt.set can be anything JSON-encodable.
|
26
|
+
|
27
|
+
You may use jQuery.DSt or $.DSt instead of DST if you're using
|
28
|
+
jquery.dst.js.
|
29
|
+
*/
|
30
|
+
|
31
|
+
jQuery.DSt = (function() {
|
32
|
+
var a = {
|
33
|
+
|
34
|
+
version: 0.002005,
|
35
|
+
|
36
|
+
get: function (key) {
|
37
|
+
var value = localStorage.getItem(key);
|
38
|
+
if (value === undefined || value === null)
|
39
|
+
value = 'null';
|
40
|
+
else
|
41
|
+
value = value.toString();
|
42
|
+
return JSON.parse(value);
|
43
|
+
},
|
44
|
+
|
45
|
+
set: function (key, value) {
|
46
|
+
return localStorage.setItem(key, JSON.stringify(value));
|
47
|
+
},
|
48
|
+
|
49
|
+
|
50
|
+
store: function (elt) {
|
51
|
+
if (typeof(elt) == 'string') elt = document.getElementById(elt);
|
52
|
+
if (!elt || elt.name == '') return this; // bail on nameless/missing elt
|
53
|
+
|
54
|
+
var key = a._form_elt_key(elt);
|
55
|
+
|
56
|
+
if (elt.type == 'checkbox') {
|
57
|
+
a.set(key, elt.checked ? 1 : 0);
|
58
|
+
}
|
59
|
+
else if (elt.type == 'radio') {
|
60
|
+
a.set(key, a._radio_value(elt));
|
61
|
+
}
|
62
|
+
else {
|
63
|
+
a.set(key, elt.value || '');
|
64
|
+
}
|
65
|
+
|
66
|
+
return this;
|
67
|
+
},
|
68
|
+
|
69
|
+
recall: function (elt) {
|
70
|
+
if (typeof(elt) == 'string') elt = document.getElementById(elt);
|
71
|
+
if (!elt || elt.name == '') return this; // bail on nameless/missing elt
|
72
|
+
|
73
|
+
var key = a._form_elt_key(elt);
|
74
|
+
var stored_value = a.get(key);
|
75
|
+
|
76
|
+
if (elt.type == 'checkbox') {
|
77
|
+
elt.checked = !!stored_value;
|
78
|
+
}
|
79
|
+
else if (elt.type == 'radio') {
|
80
|
+
if (elt.value == stored_value) elt.checked = true;
|
81
|
+
}
|
82
|
+
else {
|
83
|
+
elt.value = stored_value || '';
|
84
|
+
}
|
85
|
+
|
86
|
+
return this;
|
87
|
+
},
|
88
|
+
|
89
|
+
// returns a key string, based on form name and form element name
|
90
|
+
_form_elt_key: function (form_elt) {
|
91
|
+
return '_form_' + form_elt.form.name + '_field_' + form_elt.name;
|
92
|
+
},
|
93
|
+
|
94
|
+
// returns the selected value of a group of radio buttons, or null
|
95
|
+
// if none are selected
|
96
|
+
_radio_value: function (radio_elt) {
|
97
|
+
if (typeof(radio_elt) == 'string')
|
98
|
+
radio_elt = document.getElementById(radio_elt);
|
99
|
+
|
100
|
+
var radios = radio_elt.form.elements[radio_elt.name];
|
101
|
+
var nradios = radios.length;
|
102
|
+
var value = null;
|
103
|
+
for (var i = 0; i < nradios; i++) {
|
104
|
+
if (radios[i].checked) value = radios[i].value;
|
105
|
+
}
|
106
|
+
return value;
|
107
|
+
},
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
recall_form: function (form) {
|
112
|
+
return a._apply_fn_to_form_inputs(form, a.recall);
|
113
|
+
},
|
114
|
+
|
115
|
+
store_form: function (form) {
|
116
|
+
return a._apply_fn_to_form_inputs(form, a.store);
|
117
|
+
},
|
118
|
+
|
119
|
+
_apply_fn_to_form_inputs: function (form, fn) {
|
120
|
+
if (typeof(form) == 'string') form = document.getElementById(form);
|
121
|
+
var nelts = form.elements.length;
|
122
|
+
for (var i = 0; i < nelts; i++) {
|
123
|
+
var node = form.elements[i];
|
124
|
+
if (node.tagName == 'TEXTAREA' ||
|
125
|
+
node.tagName == 'INPUT' &&
|
126
|
+
node.type != 'file' &&
|
127
|
+
node.type != 'button' &&
|
128
|
+
node.type != 'image' &&
|
129
|
+
node.type != 'password' &&
|
130
|
+
node.type != 'submit' &&
|
131
|
+
node.type != 'reset') {
|
132
|
+
fn(node);
|
133
|
+
}
|
134
|
+
}
|
135
|
+
return this;
|
136
|
+
},
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
// _storage_types() returns a string containing every supported
|
141
|
+
// storage mechanism
|
142
|
+
_storage_types: function () {
|
143
|
+
var st = '';
|
144
|
+
for (var i in window) {
|
145
|
+
if (i == 'sessionStorage' || i == 'globalStorage' ||
|
146
|
+
i == 'localStorage' || i == 'openDatabase') {
|
147
|
+
st += st ? (' ' + i) : i;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
return st;
|
151
|
+
},
|
152
|
+
|
153
|
+
javascript_accepts_trailing_comma: false
|
154
|
+
};
|
155
|
+
return a;
|
153
156
|
})();
|
154
157
|
|
@@ -18,328 +18,328 @@
|
|
18
18
|
*/
|
19
19
|
|
20
20
|
jQuery.fn.farbtastic = function (callback) {
|
21
|
-
|
22
|
-
|
21
|
+
$.farbtastic(this, callback);
|
22
|
+
return this;
|
23
23
|
};
|
24
24
|
|
25
25
|
jQuery.farbtastic = function (container, callback) {
|
26
|
-
|
27
|
-
|
26
|
+
var container = $(container).get(0);
|
27
|
+
return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback));
|
28
28
|
}
|
29
29
|
|
30
30
|
jQuery._farbtastic = function (container, callback) {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
31
|
+
// Store farbtastic object
|
32
|
+
var fb = this;
|
33
|
+
|
34
|
+
// Insert markup
|
35
|
+
$(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
|
36
|
+
var e = $('.farbtastic', container);
|
37
|
+
fb.wheel = $('.wheel', container).get(0);
|
38
|
+
// Dimensions
|
39
|
+
fb.radius = 84;
|
40
|
+
fb.square = 100;
|
41
|
+
fb.width = 194;
|
42
|
+
|
43
|
+
// Fix background PNGs in IE6
|
44
|
+
if (navigator.appVersion.match(/MSIE [0-6]\./)) {
|
45
|
+
$('*', e).each(function () {
|
46
|
+
if (this.currentStyle.backgroundImage != 'none') {
|
47
|
+
var image = this.currentStyle.backgroundImage;
|
48
|
+
image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
|
49
|
+
$(this).css({
|
50
|
+
'backgroundImage': 'none',
|
51
|
+
'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
|
52
|
+
});
|
53
|
+
}
|
52
54
|
});
|
53
|
-
}
|
54
|
-
});
|
55
|
-
}
|
56
|
-
|
57
|
-
/**
|
58
|
-
* Link to the given element(s) or callback.
|
59
|
-
*/
|
60
|
-
fb.linkTo = function (callback) {
|
61
|
-
// Unbind previous nodes
|
62
|
-
if (typeof fb.callback == 'object') {
|
63
|
-
$(fb.callback).unbind('keyup', fb.updateValue);
|
64
55
|
}
|
65
56
|
|
66
|
-
|
67
|
-
|
57
|
+
/**
|
58
|
+
* Link to the given element(s) or callback.
|
59
|
+
*/
|
60
|
+
fb.linkTo = function (callback) {
|
61
|
+
// Unbind previous nodes
|
62
|
+
if (typeof fb.callback == 'object') {
|
63
|
+
$(fb.callback).unbind('keyup', fb.updateValue);
|
64
|
+
}
|
65
|
+
|
66
|
+
// Reset color
|
67
|
+
fb.color = null;
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
// Bind callback or elements
|
70
|
+
if (typeof callback == 'function') {
|
71
|
+
fb.callback = callback;
|
72
|
+
}
|
73
|
+
else if (typeof callback == 'object' || typeof callback == 'string') {
|
74
|
+
fb.callback = $(callback);
|
75
|
+
fb.callback.bind('keyup', fb.updateValue);
|
76
|
+
if (fb.callback.get(0).value) {
|
77
|
+
fb.setColor(fb.callback.get(0).value);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
return this;
|
72
81
|
}
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
fb.setColor(fb.callback.get(0).value);
|
78
|
-
}
|
82
|
+
fb.updateValue = function (event) {
|
83
|
+
if (this.value && this.value != fb.color) {
|
84
|
+
fb.setColor(this.value);
|
85
|
+
}
|
79
86
|
}
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Change color with HTML syntax #123456
|
90
|
+
*/
|
91
|
+
fb.setColor = function (color) {
|
92
|
+
var unpack = fb.unpack(color);
|
93
|
+
if (fb.color != color && unpack) {
|
94
|
+
fb.color = color;
|
95
|
+
fb.rgb = unpack;
|
96
|
+
fb.hsl = fb.RGBToHSL(fb.rgb);
|
97
|
+
fb.updateDisplay();
|
98
|
+
}
|
99
|
+
return this;
|
85
100
|
}
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
fb.hsl = fb.RGBToHSL(fb.rgb);
|
97
|
-
fb.updateDisplay();
|
101
|
+
|
102
|
+
/**
|
103
|
+
* Change color with HSL triplet [0..1, 0..1, 0..1]
|
104
|
+
*/
|
105
|
+
fb.setHSL = function (hsl) {
|
106
|
+
fb.hsl = hsl;
|
107
|
+
fb.rgb = fb.HSLToRGB(hsl);
|
108
|
+
fb.color = fb.pack(fb.rgb);
|
109
|
+
fb.updateDisplay();
|
110
|
+
return this;
|
98
111
|
}
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
fb.
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
112
|
+
|
113
|
+
/////////////////////////////////////////////////////
|
114
|
+
|
115
|
+
/**
|
116
|
+
* Retrieve the coordinates of the given event relative to the center
|
117
|
+
* of the widget.
|
118
|
+
*/
|
119
|
+
fb.widgetCoords = function (event) {
|
120
|
+
var x, y;
|
121
|
+
var el = event.target || event.srcElement;
|
122
|
+
var reference = fb.wheel;
|
123
|
+
|
124
|
+
if (typeof event.offsetX != 'undefined') {
|
125
|
+
// Use offset coordinates and find common offsetParent
|
126
|
+
var pos = { x: event.offsetX, y: event.offsetY };
|
127
|
+
|
128
|
+
// Send the coordinates upwards through the offsetParent chain.
|
129
|
+
var e = el;
|
130
|
+
while (e) {
|
131
|
+
e.mouseX = pos.x;
|
132
|
+
e.mouseY = pos.y;
|
133
|
+
pos.x += e.offsetLeft;
|
134
|
+
pos.y += e.offsetTop;
|
135
|
+
e = e.offsetParent;
|
136
|
+
}
|
137
|
+
|
138
|
+
// Look for the coordinates starting from the wheel widget.
|
139
|
+
var e = reference;
|
140
|
+
var offset = { x: 0, y: 0 }
|
141
|
+
while (e) {
|
142
|
+
if (typeof e.mouseX != 'undefined') {
|
143
|
+
x = e.mouseX - offset.x;
|
144
|
+
y = e.mouseY - offset.y;
|
145
|
+
break;
|
146
|
+
}
|
147
|
+
offset.x += e.offsetLeft;
|
148
|
+
offset.y += e.offsetTop;
|
149
|
+
e = e.offsetParent;
|
150
|
+
}
|
151
|
+
|
152
|
+
// Reset stored coordinates
|
153
|
+
e = el;
|
154
|
+
while (e) {
|
155
|
+
e.mouseX = undefined;
|
156
|
+
e.mouseY = undefined;
|
157
|
+
e = e.offsetParent;
|
158
|
+
}
|
146
159
|
}
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
e.mouseX = undefined;
|
156
|
-
e.mouseY = undefined;
|
157
|
-
e = e.offsetParent;
|
158
|
-
}
|
159
|
-
}
|
160
|
-
else {
|
161
|
-
// Use absolute coordinates
|
162
|
-
var pos = fb.absolutePosition(reference);
|
163
|
-
x = (event.pageX || 0*(event.clientX + $('html').get(0).scrollLeft)) - pos.x;
|
164
|
-
y = (event.pageY || 0*(event.clientY + $('html').get(0).scrollTop)) - pos.y;
|
160
|
+
else {
|
161
|
+
// Use absolute coordinates
|
162
|
+
var pos = fb.absolutePosition(reference);
|
163
|
+
x = (event.pageX || 0 * (event.clientX + $('html').get(0).scrollLeft)) - pos.x;
|
164
|
+
y = (event.pageY || 0 * (event.clientY + $('html').get(0).scrollTop)) - pos.y;
|
165
|
+
}
|
166
|
+
// Subtract distance to middle
|
167
|
+
return { x: x - fb.width / 2, y: y - fb.width / 2 };
|
165
168
|
}
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
169
|
+
|
170
|
+
/**
|
171
|
+
* Mousedown handler
|
172
|
+
*/
|
173
|
+
fb.mousedown = function (event) {
|
174
|
+
// Capture mouse
|
175
|
+
if (!document.dragging) {
|
176
|
+
$(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
|
177
|
+
document.dragging = true;
|
178
|
+
}
|
179
|
+
|
180
|
+
// Check which area is being dragged
|
181
|
+
var pos = fb.widgetCoords(event);
|
182
|
+
fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;
|
183
|
+
|
184
|
+
// Process
|
185
|
+
fb.mousemove(event);
|
186
|
+
return false;
|
178
187
|
}
|
179
188
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
if (hue < 0) hue += 1;
|
200
|
-
fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
|
189
|
+
/**
|
190
|
+
* Mousemove handler
|
191
|
+
*/
|
192
|
+
fb.mousemove = function (event) {
|
193
|
+
// Get coordinates relative to color picker center
|
194
|
+
var pos = fb.widgetCoords(event);
|
195
|
+
|
196
|
+
// Set new HSL parameters
|
197
|
+
if (fb.circleDrag) {
|
198
|
+
var hue = Math.atan2(pos.x, -pos.y) / 6.28;
|
199
|
+
if (hue < 0) hue += 1;
|
200
|
+
fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
|
201
|
+
}
|
202
|
+
else {
|
203
|
+
var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
|
204
|
+
var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
|
205
|
+
fb.setHSL([fb.hsl[0], sat, lum]);
|
206
|
+
}
|
207
|
+
return false;
|
201
208
|
}
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
209
|
+
|
210
|
+
/**
|
211
|
+
* Mouseup handler
|
212
|
+
*/
|
213
|
+
fb.mouseup = function () {
|
214
|
+
// Uncapture mouse
|
215
|
+
$(document).unbind('mousemove', fb.mousemove);
|
216
|
+
$(document).unbind('mouseup', fb.mouseup);
|
217
|
+
document.dragging = false;
|
206
218
|
}
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
|
245
|
-
});
|
246
|
-
|
247
|
-
// Change linked value
|
248
|
-
$(fb.callback).each(function() {
|
249
|
-
if (this.value && this.value != fb.color) {
|
250
|
-
this.value = fb.color;
|
219
|
+
|
220
|
+
/**
|
221
|
+
* Update the markers and styles
|
222
|
+
*/
|
223
|
+
fb.updateDisplay = function () {
|
224
|
+
// Markers
|
225
|
+
var angle = fb.hsl[0] * 6.28;
|
226
|
+
$('.h-marker', e).css({
|
227
|
+
left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px',
|
228
|
+
top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'
|
229
|
+
});
|
230
|
+
|
231
|
+
$('.sl-marker', e).css({
|
232
|
+
left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px',
|
233
|
+
top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'
|
234
|
+
});
|
235
|
+
|
236
|
+
// Saturation/Luminance gradient
|
237
|
+
$('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));
|
238
|
+
|
239
|
+
// Linked elements or callback
|
240
|
+
if (typeof fb.callback == 'object') {
|
241
|
+
// Set background/foreground color
|
242
|
+
$(fb.callback).css({
|
243
|
+
backgroundColor: fb.color,
|
244
|
+
color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
|
245
|
+
});
|
246
|
+
|
247
|
+
// Change linked value
|
248
|
+
$(fb.callback).each(function() {
|
249
|
+
if (this.value && this.value != fb.color) {
|
250
|
+
this.value = fb.color;
|
251
|
+
}
|
252
|
+
});
|
253
|
+
}
|
254
|
+
else if (typeof fb.callback == 'function') {
|
255
|
+
fb.callback.call(fb, fb.color);
|
251
256
|
}
|
252
|
-
});
|
253
|
-
}
|
254
|
-
else if (typeof fb.callback == 'function') {
|
255
|
-
fb.callback.call(fb, fb.color);
|
256
257
|
}
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
258
|
+
|
259
|
+
/**
|
260
|
+
* Get absolute position of element
|
261
|
+
*/
|
262
|
+
fb.absolutePosition = function (el) {
|
263
|
+
var r = { x: el.offsetLeft, y: el.offsetTop };
|
264
|
+
// Resolve relative to offsetParent
|
265
|
+
if (el.offsetParent) {
|
266
|
+
var tmp = fb.absolutePosition(el.offsetParent);
|
267
|
+
r.x += tmp.x;
|
268
|
+
r.y += tmp.y;
|
269
|
+
}
|
270
|
+
return r;
|
271
|
+
};
|
272
|
+
|
273
|
+
/* Various color utility functions */
|
274
|
+
fb.pack = function (rgb) {
|
275
|
+
var r = Math.round(rgb[0] * 255);
|
276
|
+
var g = Math.round(rgb[1] * 255);
|
277
|
+
var b = Math.round(rgb[2] * 255);
|
278
|
+
return '#' + (r < 16 ? '0' : '') + r.toString(16) +
|
279
|
+
(g < 16 ? '0' : '') + g.toString(16) +
|
280
|
+
(b < 16 ? '0' : '') + b.toString(16);
|
269
281
|
}
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
fb.unpack = function (color) {
|
284
|
-
if (color.length == 7) {
|
285
|
-
return [parseInt('0x' + color.substring(1, 3)) / 255,
|
286
|
-
parseInt('0x' + color.substring(3, 5)) / 255,
|
287
|
-
parseInt('0x' + color.substring(5, 7)) / 255];
|
282
|
+
|
283
|
+
fb.unpack = function (color) {
|
284
|
+
if (color.length == 7) {
|
285
|
+
return [parseInt('0x' + color.substring(1, 3)) / 255,
|
286
|
+
parseInt('0x' + color.substring(3, 5)) / 255,
|
287
|
+
parseInt('0x' + color.substring(5, 7)) / 255];
|
288
|
+
}
|
289
|
+
else if (color.length == 4) {
|
290
|
+
return [parseInt('0x' + color.substring(1, 2)) / 15,
|
291
|
+
parseInt('0x' + color.substring(2, 3)) / 15,
|
292
|
+
parseInt('0x' + color.substring(3, 4)) / 15];
|
293
|
+
}
|
288
294
|
}
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
295
|
+
|
296
|
+
fb.HSLToRGB = function (hsl) {
|
297
|
+
var m1, m2, r, g, b;
|
298
|
+
var h = hsl[0], s = hsl[1], l = hsl[2];
|
299
|
+
m2 = (l <= 0.5) ? l * (s + 1) : l + s - l * s;
|
300
|
+
m1 = l * 2 - m2;
|
301
|
+
return [this.hueToRGB(m1, m2, h + 0.33333),
|
302
|
+
this.hueToRGB(m1, m2, h),
|
303
|
+
this.hueToRGB(m1, m2, h - 0.33333)];
|
293
304
|
}
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
return [this.hueToRGB(m1, m2, h+0.33333),
|
302
|
-
this.hueToRGB(m1, m2, h),
|
303
|
-
this.hueToRGB(m1, m2, h-0.33333)];
|
304
|
-
}
|
305
|
-
|
306
|
-
fb.hueToRGB = function (m1, m2, h) {
|
307
|
-
h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
|
308
|
-
if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
|
309
|
-
if (h * 2 < 1) return m2;
|
310
|
-
if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
|
311
|
-
return m1;
|
312
|
-
}
|
313
|
-
|
314
|
-
fb.RGBToHSL = function (rgb) {
|
315
|
-
var min, max, delta, h, s, l;
|
316
|
-
var r = rgb[0], g = rgb[1], b = rgb[2];
|
317
|
-
min = Math.min(r, Math.min(g, b));
|
318
|
-
max = Math.max(r, Math.max(g, b));
|
319
|
-
delta = max - min;
|
320
|
-
l = (min + max) / 2;
|
321
|
-
s = 0;
|
322
|
-
if (l > 0 && l < 1) {
|
323
|
-
s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
|
305
|
+
|
306
|
+
fb.hueToRGB = function (m1, m2, h) {
|
307
|
+
h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
|
308
|
+
if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
|
309
|
+
if (h * 2 < 1) return m2;
|
310
|
+
if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
|
311
|
+
return m1;
|
324
312
|
}
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
313
|
+
|
314
|
+
fb.RGBToHSL = function (rgb) {
|
315
|
+
var min, max, delta, h, s, l;
|
316
|
+
var r = rgb[0], g = rgb[1], b = rgb[2];
|
317
|
+
min = Math.min(r, Math.min(g, b));
|
318
|
+
max = Math.max(r, Math.max(g, b));
|
319
|
+
delta = max - min;
|
320
|
+
l = (min + max) / 2;
|
321
|
+
s = 0;
|
322
|
+
if (l > 0 && l < 1) {
|
323
|
+
s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
|
324
|
+
}
|
325
|
+
h = 0;
|
326
|
+
if (delta > 0) {
|
327
|
+
if (max == r && max != g) h += (g - b) / delta;
|
328
|
+
if (max == g && max != b) h += (2 + (b - r) / delta);
|
329
|
+
if (max == b && max != r) h += (4 + (r - g) / delta);
|
330
|
+
h /= 6;
|
331
|
+
}
|
332
|
+
return [h, s, l];
|
331
333
|
}
|
332
|
-
return [h, s, l];
|
333
|
-
}
|
334
334
|
|
335
|
-
|
336
|
-
|
335
|
+
// Install mousedown handler (the others are set on the document on-demand)
|
336
|
+
$('*', e).mousedown(fb.mousedown);
|
337
337
|
|
338
338
|
// Init color
|
339
|
-
|
339
|
+
fb.setColor('#000000');
|
340
340
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
341
|
+
// Set linked elements/callback
|
342
|
+
if (callback) {
|
343
|
+
fb.linkTo(callback);
|
344
|
+
}
|
345
345
|
}
|