compass-jquery-plugin 0.3.2.3 → 0.3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. data/README.md +54 -37
  2. data/VERSION.yml +1 -1
  3. data/lib/handle_attributes.rb +4 -4
  4. data/lib/handle_js_files.rb +5 -5
  5. data/lib/jqtouch_theme.rb +2 -2
  6. data/lib/jquery/dynatree.rb +2 -2
  7. data/lib/jquery/emulators.rb +1 -1
  8. data/lib/jquery/flash_messages.rb +6 -6
  9. data/lib/jquery/graphics.rb +5 -0
  10. data/lib/jquery/gridify/assertions.rb +1 -1
  11. data/lib/jquery/gridify/grid.rb +76 -59
  12. data/lib/jquery/gridify/grid_column.rb +73 -67
  13. data/lib/jquery/gridify/grid_finder.rb +79 -79
  14. data/lib/jquery/gridify/grid_options.rb +154 -149
  15. data/lib/jquery/gridify/grid_view.rb +143 -143
  16. data/lib/jquery/gridify.rb +25 -25
  17. data/lib/jquery/ical/calendar.rb +2 -2
  18. data/lib/jquery/ical/event.rb +48 -44
  19. data/lib/jquery/ical/helpers/ui_event_helper.rb +3 -3
  20. data/lib/jquery/jqgrid/jqgrid.rb +58 -58
  21. data/lib/jquery/jqgrid.rb +1 -1
  22. data/lib/jquery/jqtouch.rb +1 -1
  23. data/lib/jquery/jquery.rb +117 -117
  24. data/lib/jquery/jquery_auto_complete.rb +9 -9
  25. data/lib/jquery/jquery_json_response.rb +12 -12
  26. data/lib/jquery/jquery_selector_assertions.rb +55 -53
  27. data/lib/jquery/jstree.rb +2 -2
  28. data/lib/jquery/mobile.rb +1 -1
  29. data/lib/jquery/ribbon.rb +2 -2
  30. data/lib/jquery/secret_sauce/controller/ui_dialog_controls.rb +5 -5
  31. data/lib/jquery/secret_sauce/controller/ui_grid_controls.rb +5 -5
  32. data/lib/jquery/secret_sauce/helpers/ui_dialog_helper.rb +1 -1
  33. data/lib/jquery/secret_sauce/helpers/ui_form_helper.rb +39 -39
  34. data/lib/jquery/secret_sauce/helpers/ui_grid_helper.rb +74 -74
  35. data/lib/jquery/secret_sauce/model/find_for_grid.rb +21 -21
  36. data/lib/jquery/secret_sauce.rb +1 -1
  37. data/lib/jquery/tools.rb +1 -1
  38. data/lib/jquery_mobile_theme.rb +2 -2
  39. data/lib/jquery_ui_theme.rb +12 -12
  40. data/templates/dynatree/config/initializers/dynatree.rb +3 -3
  41. data/templates/dynatree/jquery/dynatree/aero.scss +16 -16
  42. data/templates/dynatree/jquery/dynatree/aqua.scss +16 -16
  43. data/templates/dynatree/jquery/dynatree/crystal.scss +16 -16
  44. data/templates/dynatree/jquery/dynatree/xp.scss +17 -17
  45. data/templates/dynatree/jquery.dynatree.js +2926 -2912
  46. data/templates/emulators/config/initializers/emulators.rb +6 -6
  47. data/templates/graphics/config/initializers/graphics.rb +5 -0
  48. data/templates/graphics/jquery/ganttView.scss +89 -0
  49. data/templates/graphics/jquery.ganttView.js +1669 -0
  50. data/templates/graphics/jquery.ganttView.min.js +70 -0
  51. data/templates/{jquery → graphics}/jquery.sparkline.js +466 -438
  52. data/templates/{jquery → graphics}/jquery.sparkline.min.js +0 -0
  53. data/templates/graphics/manifest.rb +9 -0
  54. data/templates/jqgrid/config/initializers/jqgrid.rb +1 -1
  55. data/templates/jqgrid/i18n/jqgrid/locale-ar.js +131 -125
  56. data/templates/jqgrid/i18n/jqgrid/locale-bg.js +135 -131
  57. data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +135 -131
  58. data/templates/jqgrid/i18n/jqgrid/locale-cat.js +132 -126
  59. data/templates/jqgrid/i18n/jqgrid/locale-cn.js +137 -131
  60. data/templates/jqgrid/i18n/jqgrid/locale-cs.js +133 -127
  61. data/templates/jqgrid/i18n/jqgrid/locale-da.js +132 -126
  62. data/templates/jqgrid/i18n/jqgrid/locale-de.js +138 -132
  63. data/templates/jqgrid/i18n/jqgrid/locale-el.js +131 -125
  64. data/templates/jqgrid/i18n/jqgrid/locale-en.js +133 -127
  65. data/templates/jqgrid/i18n/jqgrid/locale-es.js +133 -127
  66. data/templates/jqgrid/i18n/jqgrid/locale-fa.js +19 -16
  67. data/templates/jqgrid/i18n/jqgrid/locale-fi.js +132 -126
  68. data/templates/jqgrid/i18n/jqgrid/locale-fr.js +131 -125
  69. data/templates/jqgrid/i18n/jqgrid/locale-gl.js +131 -125
  70. data/templates/jqgrid/i18n/jqgrid/locale-he.js +132 -126
  71. data/templates/jqgrid/i18n/jqgrid/locale-hu.js +133 -127
  72. data/templates/jqgrid/i18n/jqgrid/locale-is.js +131 -125
  73. data/templates/jqgrid/i18n/jqgrid/locale-it.js +8 -1
  74. data/templates/jqgrid/i18n/jqgrid/locale-ja.js +139 -136
  75. data/templates/jqgrid/i18n/jqgrid/locale-nl.js +4 -1
  76. data/templates/jqgrid/i18n/jqgrid/locale-no.js +14 -1
  77. data/templates/jqgrid/i18n/jqgrid/locale-pl.js +132 -126
  78. data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +132 -126
  79. data/templates/jqgrid/i18n/jqgrid/locale-pt.js +130 -124
  80. data/templates/jqgrid/i18n/jqgrid/locale-ro.js +144 -138
  81. data/templates/jqgrid/i18n/jqgrid/locale-ru.js +132 -126
  82. data/templates/jqgrid/i18n/jqgrid/locale-sk.js +132 -126
  83. data/templates/jqgrid/i18n/jqgrid/locale-sr.js +133 -127
  84. data/templates/jqgrid/i18n/jqgrid/locale-sv.js +132 -126
  85. data/templates/jqgrid/i18n/jqgrid/locale-tr.js +131 -125
  86. data/templates/jqgrid/i18n/jqgrid/locale-ua.js +132 -126
  87. data/templates/jqgrid/jquery.jqGrid.js +12735 -10444
  88. data/templates/jqgrid/jquery.jqGrid.min.js +477 -469
  89. data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +12 -10
  90. data/templates/jqtouch/config/initializers/jqtouch.rb +3 -3
  91. data/templates/jqtouch/jquery/touch/jqtouch.scss +1 -1
  92. data/templates/jqtouch/jquery.jqtouch.js +10025 -10043
  93. data/templates/jquery/config/initializers/jquery.rb +2 -4
  94. data/templates/jquery/history.adapter.jquery.js +71 -0
  95. data/templates/jquery/history.adapter.jquery.min.js +4 -0
  96. data/templates/jquery/history.html4.js +690 -0
  97. data/templates/jquery/history.html4.min.js +21 -0
  98. data/templates/jquery/history.js +1297 -0
  99. data/templates/jquery/history.min.js +29 -0
  100. data/templates/jquery/i18n/jquery.ui/datepicker-af.js +20 -20
  101. data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.js +19 -19
  102. data/templates/jquery/i18n/jquery.ui/datepicker-ar.js +19 -19
  103. data/templates/jquery/i18n/jquery.ui/datepicker-az.js +19 -19
  104. data/templates/jquery/i18n/jquery.ui/datepicker-bg.js +8 -8
  105. data/templates/jquery/i18n/jquery.ui/datepicker-bs.js +20 -20
  106. data/templates/jquery/i18n/jquery.ui/datepicker-ca.js +20 -20
  107. data/templates/jquery/i18n/jquery.ui/datepicker-cs.js +20 -20
  108. data/templates/jquery/i18n/jquery.ui/datepicker-da.js +14 -14
  109. data/templates/jquery/i18n/jquery.ui/datepicker-de.js +20 -20
  110. data/templates/jquery/i18n/jquery.ui/datepicker-el.js +20 -20
  111. data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.js +20 -20
  112. data/templates/jquery/i18n/jquery.ui/datepicker-en-GB.js +20 -20
  113. data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.js +20 -20
  114. data/templates/jquery/i18n/jquery.ui/datepicker-eo.js +20 -20
  115. data/templates/jquery/i18n/jquery.ui/datepicker-es.js +20 -20
  116. data/templates/jquery/i18n/jquery.ui/datepicker-et.js +20 -20
  117. data/templates/jquery/i18n/jquery.ui/datepicker-eu.js +20 -20
  118. data/templates/jquery/i18n/jquery.ui/datepicker-fa.js +18 -18
  119. data/templates/jquery/i18n/jquery.ui/datepicker-fi.js +15 -15
  120. data/templates/jquery/i18n/jquery.ui/datepicker-fo.js +20 -20
  121. data/templates/jquery/i18n/jquery.ui/datepicker-fr-CH.js +20 -20
  122. data/templates/jquery/i18n/jquery.ui/datepicker-fr.js +22 -22
  123. data/templates/jquery/i18n/jquery.ui/datepicker-gl.js +20 -20
  124. data/templates/jquery/i18n/jquery.ui/datepicker-he.js +20 -20
  125. data/templates/jquery/i18n/jquery.ui/datepicker-hr.js +20 -20
  126. data/templates/jquery/i18n/jquery.ui/datepicker-hu.js +20 -20
  127. data/templates/jquery/i18n/jquery.ui/datepicker-hu.min.js +1 -1
  128. data/templates/jquery/i18n/jquery.ui/datepicker-hy.js +20 -20
  129. data/templates/jquery/i18n/jquery.ui/datepicker-id.js +20 -20
  130. data/templates/jquery/i18n/jquery.ui/datepicker-is.js +20 -20
  131. data/templates/jquery/i18n/jquery.ui/datepicker-it.js +20 -20
  132. data/templates/jquery/i18n/jquery.ui/datepicker-ja.js +20 -20
  133. data/templates/jquery/i18n/jquery.ui/datepicker-ko.js +20 -20
  134. data/templates/jquery/i18n/jquery.ui/datepicker-kz.js +20 -20
  135. data/templates/jquery/i18n/jquery.ui/datepicker-lt.js +20 -20
  136. data/templates/jquery/i18n/jquery.ui/datepicker-lv.js +20 -20
  137. data/templates/jquery/i18n/jquery.ui/datepicker-ml.js +20 -20
  138. data/templates/jquery/i18n/jquery.ui/datepicker-ms.js +20 -20
  139. data/templates/jquery/i18n/jquery.ui/datepicker-nl.js +20 -20
  140. data/templates/jquery/i18n/jquery.ui/datepicker-no.js +16 -16
  141. data/templates/jquery/i18n/jquery.ui/datepicker-no.min.js +2 -2
  142. data/templates/jquery/i18n/jquery.ui/datepicker-pl.js +20 -20
  143. data/templates/jquery/i18n/jquery.ui/datepicker-pt-BR.js +20 -20
  144. data/templates/jquery/i18n/jquery.ui/datepicker-pt.js +20 -20
  145. data/templates/jquery/i18n/jquery.ui/datepicker-rm.js +18 -18
  146. data/templates/jquery/i18n/jquery.ui/datepicker-ro.js +20 -20
  147. data/templates/jquery/i18n/jquery.ui/datepicker-ru.js +20 -20
  148. data/templates/jquery/i18n/jquery.ui/datepicker-sk.js +20 -20
  149. data/templates/jquery/i18n/jquery.ui/datepicker-sl.js +20 -20
  150. data/templates/jquery/i18n/jquery.ui/datepicker-sq.js +20 -20
  151. data/templates/jquery/i18n/jquery.ui/datepicker-sr-SR.js +20 -20
  152. data/templates/jquery/i18n/jquery.ui/datepicker-sr.js +20 -20
  153. data/templates/jquery/i18n/jquery.ui/datepicker-sv.js +14 -14
  154. data/templates/jquery/i18n/jquery.ui/datepicker-ta.js +20 -20
  155. data/templates/jquery/i18n/jquery.ui/datepicker-th.js +20 -20
  156. data/templates/jquery/i18n/jquery.ui/datepicker-tr.js +20 -20
  157. data/templates/jquery/i18n/jquery.ui/datepicker-uk.js +20 -20
  158. data/templates/jquery/i18n/jquery.ui/datepicker-vi.js +20 -20
  159. data/templates/jquery/i18n/jquery.ui/datepicker-zh-CN.js +20 -20
  160. data/templates/jquery/i18n/jquery.ui/datepicker-zh-HK.js +20 -20
  161. data/templates/jquery/i18n/jquery.ui/datepicker-zh-TW.js +20 -20
  162. data/templates/jquery/{partials → jquery/ui}/_flash_messages.scss +0 -0
  163. data/templates/jquery/jquery/ui/_theme.scss +14 -13
  164. data/templates/jquery/jquery/ui/contextMenu/configure.png +0 -0
  165. data/templates/jquery/jquery/ui/contextMenu/copy.png +0 -0
  166. data/templates/jquery/jquery/ui/contextMenu/cut.png +0 -0
  167. data/templates/jquery/jquery/ui/contextMenu/delete.png +0 -0
  168. data/templates/jquery/jquery/ui/contextMenu/edit.png +0 -0
  169. data/templates/jquery/jquery/ui/contextMenu/exit.png +0 -0
  170. data/templates/jquery/jquery/ui/contextMenu/new.png +0 -0
  171. data/templates/jquery/jquery/ui/contextMenu/paste.png +0 -0
  172. data/templates/jquery/jquery/ui/contextMenu/rename.png +0 -0
  173. data/templates/jquery/jquery/ui/contextMenu/show.png +0 -0
  174. data/templates/jquery/jquery/ui/contextMenu/trash.png +0 -0
  175. data/templates/jquery/jquery/ui/contextMenu.scss +16 -10
  176. data/templates/jquery/jquery-ui.js +11839 -23066
  177. data/templates/jquery/jquery-ui.min.js +401 -795
  178. data/templates/jquery/jquery.bgiframe.js +27 -25
  179. data/templates/jquery/jquery.contextMenu.js +209 -196
  180. data/templates/jquery/jquery.cookie.js +3 -1
  181. data/templates/jquery/jquery.dotimeout.js +236 -228
  182. data/templates/jquery/jquery.dst.js +154 -151
  183. data/templates/jquery/jquery.farbtastic.js +293 -293
  184. data/templates/jquery/jquery.flashMessages.js +26 -0
  185. data/templates/jquery/jquery.flashMessages.min.js +1 -0
  186. data/templates/jquery/jquery.form.js +803 -786
  187. data/templates/jquery/jquery.haml.js +248 -247
  188. data/templates/jquery/jquery.hotkeys.js +89 -89
  189. data/templates/jquery/jquery.js +8141 -8106
  190. data/templates/jquery/jquery.layout.js +2451 -2415
  191. data/templates/jquery/jquery.min.js +167 -166
  192. data/templates/jquery/jquery.mousewheel.js +62 -54
  193. data/templates/jquery/jquery.offline.js +171 -171
  194. data/templates/jquery/jquery.pngFix.js +76 -76
  195. data/templates/jquery/jquery.replacetext.js +83 -83
  196. data/templates/jquery/jquery.themeswitchertool.js +202 -177
  197. data/templates/jquery/jquery.tmpl.js +478 -473
  198. data/templates/jquery/jquery.tmplPlus.js +82 -81
  199. data/templates/jquery/jrails.js +178 -175
  200. data/templates/jquery/json.js +77 -7
  201. data/templates/jquery/json2.js +480 -0
  202. data/templates/jquery/json2.min.js +7 -0
  203. data/templates/jquery/lib/tasks/haml.rake +2 -2
  204. data/templates/jquery/manifest.rb +21 -17
  205. data/templates/jstree/jquery.jstree.js +5967 -4536
  206. data/templates/mobile/config/initializers/mobile.rb +1 -1
  207. data/templates/mobile/jquery/mobile/_base.scss +944 -927
  208. data/templates/mobile/jquery/mobile/default.scss +61 -48
  209. data/templates/mobile/jquery/mobile/valencia.scss +56 -42
  210. data/templates/mobile/jquery.mobile.js +4461 -4347
  211. data/templates/mobile/jquery.mobile.min.js +11 -2
  212. data/templates/mobile/lib/tasks/jquery.mobile.rake +12 -12
  213. data/templates/ribbon/config/initializers/ribbon.rb +2 -2
  214. data/templates/ribbon/jquery.ribbon.js +50 -29
  215. data/templates/secret_sauce/secret_sauce.js +8 -8
  216. data/templates/tools/flowplayer.js +945 -1
  217. data/templates/tools/jquery.tools.js +4645 -4335
  218. data/templates/tools/jquery.tools.min.js +37 -37
  219. data/templates/tools/lib/tasks/jquery.tools.rake +4 -4
  220. data/templates/tools/swfobject.js +813 -773
  221. metadata +33 -21
  222. data/templates/jquery/haml.js +0 -506
  223. data/templates/jquery/haml.min.js +0 -5
  224. data/templates/jquery/jquery/ui/contextMenu/door.png +0 -0
  225. data/templates/jquery/jquery/ui/contextMenu/page_white_copy.png +0 -0
  226. data/templates/jquery/jquery/ui/contextMenu/page_white_delete.png +0 -0
  227. data/templates/jquery/jquery/ui/contextMenu/page_white_edit.png +0 -0
  228. data/templates/jquery/jquery/ui/contextMenu/page_white_new.png +0 -0
  229. data/templates/jquery/jquery/ui/contextMenu/page_white_paste.png +0 -0
  230. data/templates/jquery/jquery.compat-1.3.js +0 -291
  231. data/templates/jquery/jquery.compat-1.3.min.js +0 -6
  232. data/templates/jquery/jquery.flash_messages.js +0 -5
  233. data/templates/jquery/jquery.flash_messages.min.js +0 -1
  234. data/templates/jquery/jquery.history.js +0 -194
  235. data/templates/jquery/jquery.history.min.js +0 -5
@@ -1,154 +1,157 @@
1
1
  /* DSt:
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(){var a = {
32
-
33
- version: 0.002005,
34
-
35
- get: function (key) {
36
- var value = localStorage.getItem(key);
37
- if (value === undefined || value === null)
38
- value = 'null';
39
- else
40
- value = value.toString();
41
- return JSON.parse(value);
42
- },
43
-
44
- set: function (key, value) {
45
- return localStorage.setItem(key, JSON.stringify(value));
46
- },
47
-
48
-
49
- store: function (elt) {
50
- if (typeof(elt) == 'string') elt = document.getElementById(elt);
51
- if (!elt || elt.name == '') return this; // bail on nameless/missing elt
52
-
53
- var key = a._form_elt_key(elt);
54
-
55
- if (elt.type == 'checkbox') {
56
- a.set(key, elt.checked ? 1 : 0);
57
- }
58
- else if (elt.type == 'radio') {
59
- a.set(key, a._radio_value(elt));
60
- }
61
- else {
62
- a.set(key, elt.value || '');
63
- }
64
-
65
- return this;
66
- },
67
-
68
- recall: function (elt) {
69
- if (typeof(elt) == 'string') elt = document.getElementById(elt);
70
- if (!elt || elt.name == '') return this; // bail on nameless/missing elt
71
-
72
- var key = a._form_elt_key(elt);
73
- var stored_value = a.get(key);
74
-
75
- if (elt.type == 'checkbox') {
76
- elt.checked = !!stored_value;
77
- }
78
- else if (elt.type == 'radio') {
79
- if (elt.value == stored_value) elt.checked = true;
80
- }
81
- else {
82
- elt.value = stored_value || '';
83
- }
84
-
85
- return this;
86
- },
87
-
88
- // returns a key string, based on form name and form element name
89
- _form_elt_key: function (form_elt) {
90
- return '_form_' + form_elt.form.name + '_field_' + form_elt.name;
91
- },
92
-
93
- // returns the selected value of a group of radio buttons, or null
94
- // if none are selected
95
- _radio_value: function (radio_elt) {
96
- if (typeof(radio_elt)=='string')
97
- radio_elt=document.getElementById(radio_elt);
98
-
99
- var radios = radio_elt.form.elements[radio_elt.name];
100
- var nradios = radios.length;
101
- var value = null;
102
- for (var i=0; i<nradios; i++) {
103
- if (radios[i].checked) value = radios[i].value;
104
- }
105
- return value;
106
- },
107
-
108
-
109
-
110
- recall_form: function (form) {
111
- return a._apply_fn_to_form_inputs(form, a.recall);
112
- },
113
-
114
- store_form: function (form) {
115
- return a._apply_fn_to_form_inputs(form, a.store);
116
- },
117
-
118
- _apply_fn_to_form_inputs: function (form, fn) {
119
- if (typeof(form)=='string') form=document.getElementById(form);
120
- var nelts = form.elements.length;
121
- for (var i=0; i<nelts; i++) {
122
- var node = form.elements[i];
123
- if (node.tagName == 'TEXTAREA' ||
124
- node.tagName == 'INPUT' &&
125
- node.type != 'file' &&
126
- node.type != 'button' &&
127
- node.type != 'image' &&
128
- node.type != 'password' &&
129
- node.type != 'submit' &&
130
- node.type != 'reset' ) { fn(node); }
131
- }
132
- return this;
133
- },
134
-
135
-
136
-
137
- // _storage_types() returns a string containing every supported
138
- // storage mechanism
139
- _storage_types: function () {
140
- var st = '';
141
- for (var i in window) {
142
- if (i=='sessionStorage' || i=='globalStorage' ||
143
- i=='localStorage' || i=='openDatabase' ) {
144
- st += st ? (' '+i) : i;
145
- }
146
- }
147
- return st;
148
- },
149
-
150
- javascript_accepts_trailing_comma: false
151
- };
152
- return a;
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
- $.farbtastic(this, callback);
22
- return this;
21
+ $.farbtastic(this, callback);
22
+ return this;
23
23
  };
24
24
 
25
25
  jQuery.farbtastic = function (container, callback) {
26
- var container = $(container).get(0);
27
- return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback));
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
- // 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 + "')"
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
- // Reset color
67
- fb.color = null;
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
- // Bind callback or elements
70
- if (typeof callback == 'function') {
71
- fb.callback = callback;
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
- 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
- }
82
+ fb.updateValue = function (event) {
83
+ if (this.value && this.value != fb.color) {
84
+ fb.setColor(this.value);
85
+ }
79
86
  }
80
- return this;
81
- }
82
- fb.updateValue = function (event) {
83
- if (this.value && this.value != fb.color) {
84
- fb.setColor(this.value);
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
- * 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();
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
- return this;
100
- }
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;
111
- }
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;
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
- 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
- }
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
- // Subtract distance to middle
167
- return { x: x - fb.width / 2, y: y - fb.width / 2 };
168
- }
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;
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
- // 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;
187
- }
188
-
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]]);
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
- 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]);
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
- return false;
208
- }
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;
218
- }
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;
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
- * 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;
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
- 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);
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
- 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];
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
- 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)];
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
- 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;
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
- // Install mousedown handler (the others are set on the document on-demand)
336
- $('*', e).mousedown(fb.mousedown);
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
- fb.setColor('#000000');
339
+ fb.setColor('#000000');
340
340
 
341
- // Set linked elements/callback
342
- if (callback) {
343
- fb.linkTo(callback);
344
- }
341
+ // Set linked elements/callback
342
+ if (callback) {
343
+ fb.linkTo(callback);
344
+ }
345
345
  }