html5forms-rails 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/CHANGELOG.md +5 -0
  2. data/Gemfile +11 -0
  3. data/README.md +208 -0
  4. data/Rakefile +49 -0
  5. data/VERSION +1 -0
  6. data/demos/html5-form-demo.html +79 -0
  7. data/html5forms-rails.gemspec +142 -0
  8. data/lib/html5forms.rb +6 -0
  9. data/vendor/assets/images/colorpicker/blank.gif +0 -0
  10. data/vendor/assets/images/colorpicker/colorpicker_background.png +0 -0
  11. data/vendor/assets/images/colorpicker/colorpicker_hex.png +0 -0
  12. data/vendor/assets/images/colorpicker/colorpicker_hsb_b.png +0 -0
  13. data/vendor/assets/images/colorpicker/colorpicker_hsb_h.png +0 -0
  14. data/vendor/assets/images/colorpicker/colorpicker_hsb_s.png +0 -0
  15. data/vendor/assets/images/colorpicker/colorpicker_indic.gif +0 -0
  16. data/vendor/assets/images/colorpicker/colorpicker_overlay.png +0 -0
  17. data/vendor/assets/images/colorpicker/colorpicker_rgb_b.png +0 -0
  18. data/vendor/assets/images/colorpicker/colorpicker_rgb_g.png +0 -0
  19. data/vendor/assets/images/colorpicker/colorpicker_rgb_r.png +0 -0
  20. data/vendor/assets/images/colorpicker/colorpicker_select.gif +0 -0
  21. data/vendor/assets/images/colorpicker/colorpicker_submit.png +0 -0
  22. data/vendor/assets/images/colorpicker/custom_background.png +0 -0
  23. data/vendor/assets/images/colorpicker/custom_hex.png +0 -0
  24. data/vendor/assets/images/colorpicker/custom_hsb_b.png +0 -0
  25. data/vendor/assets/images/colorpicker/custom_hsb_h.png +0 -0
  26. data/vendor/assets/images/colorpicker/custom_hsb_s.png +0 -0
  27. data/vendor/assets/images/colorpicker/custom_indic.gif +0 -0
  28. data/vendor/assets/images/colorpicker/custom_rgb_b.png +0 -0
  29. data/vendor/assets/images/colorpicker/custom_rgb_g.png +0 -0
  30. data/vendor/assets/images/colorpicker/custom_rgb_r.png +0 -0
  31. data/vendor/assets/images/colorpicker/custom_submit.png +0 -0
  32. data/vendor/assets/images/colorpicker/select.png +0 -0
  33. data/vendor/assets/images/colorpicker/select2.png +0 -0
  34. data/vendor/assets/images/colorpicker/slider.png +0 -0
  35. data/vendor/assets/images/h5f/form_validation.png +0 -0
  36. data/vendor/assets/images/html5form-shim/asterisk.png +0 -0
  37. data/vendor/assets/images/html5form-shim/down.png +0 -0
  38. data/vendor/assets/images/html5form-shim/fail.png +0 -0
  39. data/vendor/assets/images/html5form-shim/ok.png +0 -0
  40. data/vendor/assets/images/html5forms/jscolor/arrow.gif +0 -0
  41. data/vendor/assets/images/html5forms/jscolor/cross.gif +0 -0
  42. data/vendor/assets/images/html5forms/jscolor/hs.png +0 -0
  43. data/vendor/assets/images/html5forms/jscolor/hv.png +0 -0
  44. data/vendor/assets/images/html5forms/slider/slider-1.png +0 -0
  45. data/vendor/assets/images/html5forms/slider/slider-disabled-1.png +0 -0
  46. data/vendor/assets/images/html5forms/slider/slider-disabled.png +0 -0
  47. data/vendor/assets/images/html5forms/slider/slider.png +0 -0
  48. data/vendor/assets/javascripts/colorpicker.js +484 -0
  49. data/vendor/assets/javascripts/colorpicker.min.js +9 -0
  50. data/vendor/assets/javascripts/h5f.js +328 -0
  51. data/vendor/assets/javascripts/h5f.min.js +4 -0
  52. data/vendor/assets/javascripts/html5forms/EventHelpers.min.js +15 -0
  53. data/vendor/assets/javascripts/html5forms/autocomplete.min.js +1 -0
  54. data/vendor/assets/javascripts/html5forms/cssQuery-p.min.js +6 -0
  55. data/vendor/assets/javascripts/html5forms/dev/EventHelpers.js +486 -0
  56. data/vendor/assets/javascripts/html5forms/dev/autocomplete.js +387 -0
  57. data/vendor/assets/javascripts/html5forms/dev/cssQuery-p.js +6 -0
  58. data/vendor/assets/javascripts/html5forms/dev/html5.js +121 -0
  59. data/vendor/assets/javascripts/html5forms/dev/html5Forms.js +892 -0
  60. data/vendor/assets/javascripts/html5forms/dev/html5Widgets.js +1417 -0
  61. data/vendor/assets/javascripts/html5forms/dev/jscolor.js +840 -0
  62. data/vendor/assets/javascripts/html5forms/dev/slider.js +797 -0
  63. data/vendor/assets/javascripts/html5forms/dev/timer.js +137 -0
  64. data/vendor/assets/javascripts/html5forms/dev/visibleIf.js +1100 -0
  65. data/vendor/assets/javascripts/html5forms/html5.min.js +2 -0
  66. data/vendor/assets/javascripts/html5forms/html5Forms.min.js +1 -0
  67. data/vendor/assets/javascripts/html5forms/html5Widgets.min.js +20 -0
  68. data/vendor/assets/javascripts/html5forms/jscolor.min.js +10 -0
  69. data/vendor/assets/javascripts/html5forms/slider.min.js +25 -0
  70. data/vendor/assets/javascripts/html5forms/timer.min.js +1 -0
  71. data/vendor/assets/javascripts/html5forms/visibleIf.min.js +19 -0
  72. data/vendor/assets/javascripts/html5forms.fallback.js +115 -0
  73. data/vendor/assets/javascripts/html5forms.fallback.min.js +11 -0
  74. data/vendor/assets/javascripts/jquery.html5form-shim.js +402 -0
  75. data/vendor/assets/javascripts/jquery.html5form.min.js +4 -0
  76. data/vendor/assets/javascripts/jquery.placehold.min.js +7 -0
  77. data/vendor/assets/javascripts/ui.spinner.js +649 -0
  78. data/vendor/assets/javascripts/ui.spinner.min.js +7 -0
  79. data/vendor/assets/javascripts/webforms2/webforms2-msie.js +1 -0
  80. data/vendor/assets/javascripts/webforms2/webforms2-p.js +14 -0
  81. data/vendor/assets/javascripts/webforms2/webforms2.js +14 -0
  82. data/vendor/assets/javascripts/webforms2/webforms2_src.js +3195 -0
  83. data/vendor/assets/stylesheets/colorpicker.css +161 -0
  84. data/vendor/assets/stylesheets/h5f.css +86 -0
  85. data/vendor/assets/stylesheets/html5form-shim.css +109 -0
  86. data/vendor/assets/stylesheets/html5forms/number.css +35 -0
  87. data/vendor/assets/stylesheets/html5forms/slider.css +169 -0
  88. data/vendor/assets/stylesheets/html5forms/slider_ie.css +41 -0
  89. data/vendor/assets/stylesheets/html5forms/visibleIf.css +23 -0
  90. data/vendor/assets/stylesheets/html5forms.layout.css +116 -0
  91. data/vendor/assets/stylesheets/ui.spinner.css +3 -0
  92. data/vendor/assets/stylesheets/webforms2.css +42 -0
  93. metadata +221 -0
@@ -0,0 +1,387 @@
1
+ var autocomplete = new function () {
2
+ var me = this;
3
+
4
+ var inputNodes;
5
+ var listContainerNode;
6
+ var bodyNode;
7
+ var minLength;
8
+ var req;
9
+ var currentLookupString = "";
10
+ var currentFocusedInputNode = null;
11
+ var numberCurrentValues;
12
+
13
+ var lastLookupString ="", lastLookupValues;
14
+
15
+ me.values = null;
16
+ me.x = -1;
17
+ me.y = -1;
18
+
19
+ me.init = function () {
20
+
21
+ if (EventHelpers.hasPageLoadHappened(arguments)) return;
22
+
23
+ bodyNode = document.getElementsByTagName('body')[0];
24
+ minLength = config.getIntegerValue('autocomplete.values.minLength', 0);
25
+ createListContainerNode();
26
+ setInitialEvents();
27
+ }
28
+
29
+ function createListContainerNode () {
30
+
31
+
32
+ listContainerNode = document.createElement('div');
33
+
34
+ listContainerNode.style.display = 'none';
35
+ listContainerNode.style.position= 'absolute';
36
+ listContainerNode.id = 'autocomplete-selection'
37
+
38
+
39
+ bodyNode.appendChild(listContainerNode);
40
+
41
+ }
42
+
43
+ function setInitialEvents () {
44
+ inputNodes = CSSHelpers.getElementsByClassName(document,
45
+ 'autocomplete_input');
46
+
47
+ for (var i=0; i<inputNodes.length; i++) {
48
+
49
+ EventHelpers.addEvent(inputNodes[i], 'keyup', keyUpEvent);
50
+ EventHelpers.addEvent(inputNodes[i], 'keypress', keyPressEvent);
51
+ formNode = DOMHelpers.getAncestorByTagName(inputNodes[i], 'form');
52
+ turnOffNativeAutocomplete(formNode);
53
+ }
54
+
55
+ EventHelpers.addEvent(bodyNode, 'click', hideAutocompleteBox);
56
+ EventHelpers.addEvent(document, 'click', hideAutocompleteBox)
57
+ }
58
+
59
+ function keyUpEvent(e) {
60
+ var key = EventHelpers.getKey(e);
61
+ currentFocusedInputNode = EventHelpers.getEventTarget(e);
62
+ switch (key) {
63
+ case CharCode.DOWN:
64
+ moveFocusOnListEvent(e);
65
+ break;
66
+ case CharCode.ESC:
67
+ break;
68
+ case CharCode.ENTER:
69
+ EventHelpers.preventDefault(e);
70
+ break;
71
+ default:
72
+ getListEvent(e);
73
+ }
74
+
75
+ //getListEvent(e);
76
+ }
77
+
78
+ function keyPressEvent(e) {
79
+ var key = EventHelpers.getKey(e);
80
+ switch (key) {
81
+ case CharCode.DOWN:
82
+ moveFocusOnListEvent(e);
83
+ EventHelpers.preventDefault(e);
84
+ break;
85
+ case CharCode.ENTER:
86
+ EventHelpers.preventDefault(e);
87
+ break;
88
+ }
89
+
90
+ }
91
+
92
+ function moveFocusOnListEvent(e) {
93
+ activeInputNode = EventHelpers.getEventTarget(e);
94
+
95
+ activeInputNode.blur();
96
+
97
+ var listNode = getListNode();
98
+
99
+
100
+ // jslog.debug(listNode.nodeName)
101
+ var listItemNodes = getListItemNodes();
102
+ var firstListItemNode;
103
+
104
+
105
+
106
+
107
+ if (listItemNodes.length > 0) {
108
+ firstListItemNode = listItemNodes[0]
109
+ } else {
110
+ firstListItemNode = listItemNodes;
111
+ }
112
+
113
+ jslog.debug('firstListItemNode: ' + firstListItemNode.nodeName)
114
+
115
+ if (firstListItemNode) {
116
+
117
+ switch (firstListItemNode.nodeName) {
118
+ case "OPTION":
119
+
120
+ //listNode.focus();
121
+ //jslog.debug(DebugHelpers.getProperties(firstListItemNode));
122
+ firstListItemNode.selected = 'selected';
123
+ replaceValue(firstListItemNode);
124
+ listNode.focus();
125
+
126
+
127
+
128
+ break;
129
+ }
130
+
131
+ //firstListItemNode.focus();
132
+ }
133
+
134
+
135
+
136
+
137
+
138
+ //jslog.debug('listNode properties: ' + DebugHelpers.getProperties(listNode))
139
+
140
+ }
141
+
142
+
143
+
144
+ function getListEvent(e) {
145
+ activeInputNode = EventHelpers.getEventTarget(e);
146
+ currentLookupString=activeInputNode.value;
147
+
148
+ if (currentLookupString.length < minLength) {
149
+ listContainerNode.innerHTML = "";
150
+ return;
151
+ }
152
+
153
+
154
+
155
+ me.x = CSSHelpers.getAbsoluteLeft(activeInputNode);
156
+ me.y = CSSHelpers.getAbsoluteTop(activeInputNode)
157
+ + CSSHelpers.getHeight(activeInputNode);
158
+
159
+
160
+ var id=activeInputNode.name.replace(/ /g, '_' );
161
+
162
+
163
+ var URL = config.getScriptedValue('autocomplete.urls.' + id,
164
+ {
165
+ inputID: id,
166
+ inputValue: currentLookupString
167
+ });
168
+
169
+ listContainerNode.innerHTML = config.getValue('autocomplete.templates.pleaseWait');
170
+ showAutocompleteBox();
171
+
172
+
173
+ /*
174
+ * if this is not the old request with a few letters tacked on,
175
+ * do an httpRequest to this. Otherwise, do call setValues().
176
+ */
177
+
178
+ if (lastLookupString != "" && currentLookupString.toLowerCase().indexOf(lastLookupString.toLowerCase()) == 0) {
179
+ showDropDown(lastLookupValues);
180
+ } else {
181
+ if (req) {
182
+ req.abort();
183
+ }
184
+ req = XMLHelpers.getXMLHttpRequest(URL, getListRequest);
185
+
186
+ }
187
+
188
+
189
+ }
190
+
191
+ function getListRequest() {
192
+ if (!req) {
193
+ //DebugHelpers.log("XMLHttpRequest was null: exiting");
194
+ return;
195
+ }
196
+
197
+
198
+
199
+ if (req.readyState == ReadyState.COMPLETED) {
200
+ // only if "OK"
201
+
202
+ if (req.status == HttpCode.OK) {
203
+ var values = req.responseText.split('\n');
204
+ showDropDown(values);
205
+ lastLookupString=currentLookupString;
206
+ lastLookupValues=values;
207
+ }
208
+ }
209
+ }
210
+
211
+ function showDropDown(values) {
212
+ removeAutocompleteBoxEvents();
213
+ me.setValues(values);
214
+ jslog.debug(numberCurrentValues)
215
+ if (numberCurrentValues == 0) {
216
+ hideAutocompleteBox();
217
+ } else {
218
+ jslog.debug('not zeri')
219
+ setAutocompleteBoxEvents();
220
+ showAutocompleteBox();
221
+ }
222
+ }
223
+
224
+ me.setValues = function (values) {
225
+ me.values = values;
226
+
227
+ var lastElement = me.values.pop();
228
+
229
+ if (lastElement.trim() != "") {
230
+ me.values.push(lastElement)
231
+ }
232
+
233
+
234
+ if (me.values.length == 0) {
235
+ listContainerNode.innerHTML = "";
236
+ }
237
+ else {
238
+
239
+ var valuesHTMLSb = new StringBuffer();
240
+ numberCurrentValues = 0;
241
+ for (var i = 0; i < me.values.length; i++) {
242
+ var value = me.values[i].trim();
243
+
244
+ if (value != "" && value.toLowerCase().indexOf(currentLookupString.toLowerCase()) == 0 ) {
245
+ numberCurrentValues++;
246
+ valuesHTMLSb.append(config.getScriptedValue('autocomplete.templates.listItem', {
247
+ listItem: me.values[i]
248
+ }))
249
+ }
250
+ }
251
+
252
+ listContainerNode.innerHTML = config.getScriptedValue('autocomplete.templates.list', {
253
+ listItemsHTML: valuesHTMLSb.toString()
254
+ });
255
+ }
256
+ }
257
+
258
+ function selectKeyEvent (e) {
259
+ var key = EventHelpers.getKey(e);
260
+
261
+
262
+ switch(key){
263
+ case CharCode.ESC:
264
+ case CharCode.ENTER:
265
+ hideAutocompleteBox(e);
266
+ currentFocusedInputNode.focus();
267
+
268
+ break;
269
+ case CharCode.TAB:
270
+ focusOnInputField(e);
271
+ break;
272
+ case CharCode.BACKSPACE:
273
+ currentFocusedInputNode.value = "";
274
+ hideAutocompleteBox(e);
275
+ currentFocusedInputNode.focus();
276
+ // prevents browser from going back a page.
277
+ EventHelpers.preventDefault(e);
278
+ break;
279
+ }
280
+ }
281
+
282
+ function focusOnInputField(e) {
283
+ currentFocusedInputNode.focus();
284
+ if (BrowserDetect.browser == "Explorer") {
285
+ EventHelpers.preventDefault(e);
286
+ }
287
+ }
288
+
289
+ function showAutocompleteBox () {
290
+ CSSHelpers.moveTo(listContainerNode, me.x, me.y)
291
+ listContainerNode.style.display = 'block';
292
+ }
293
+
294
+ function hideAutocompleteBox(e) {
295
+ listContainerNode.style.display = 'none';
296
+ removeAutocompleteBoxEvents();
297
+ listContainerNode.innerHTML = '';
298
+ }
299
+
300
+ function getListItemNodes () {
301
+ var valueNodes = cssQuery(
302
+ config.getValue('autocomplete.selectors.listItem'),
303
+ listContainerNode
304
+ );
305
+
306
+ return valueNodes;
307
+ }
308
+
309
+ function getListNode () {
310
+ var listNodes = cssQuery(
311
+ config.getValue('autocomplete.selectors.list'),
312
+ listContainerNode
313
+ );
314
+
315
+ if (listNodes && listNodes.length > 0) {
316
+ return listNodes[0];
317
+ }
318
+ else {
319
+ return null;
320
+ }
321
+
322
+ }
323
+
324
+ function setAutocompleteBoxEvents() {
325
+ var valueNodes = getListItemNodes();
326
+
327
+ var listNode = getListNode();
328
+
329
+ if (listNode) {
330
+ EventHelpers.addEvent(listNode, 'change', replaceValueEvent);
331
+ EventHelpers.addEvent(listNode, 'blur', hideAutocompleteBox);
332
+ EventHelpers.addEvent(listNode, 'keyup', selectKeyEvent);
333
+ EventHelpers.addEvent(listNode, 'keydown', selectKeyEvent);
334
+ EventHelpers.addEvent(listNode, 'blur', focusOnInputField);
335
+ }
336
+
337
+ if (valueNodes) {
338
+ for (var i = 0; i < valueNodes.length; i++) {
339
+
340
+ EventHelpers.addEvent(valueNodes[i], 'click', replaceValueEvent);
341
+
342
+ }
343
+ }
344
+ }
345
+
346
+ function removeAutocompleteBoxEvents() {
347
+
348
+
349
+ var valueNodes = getListItemNodes();
350
+
351
+ var listNode = getListNode();
352
+
353
+ if (listNode) {
354
+ EventHelpers.removeEvent(listNode, 'change', replaceValueEvent);
355
+ EventHelpers.removeEvent(listNode, 'blur', hideAutocompleteBox);
356
+ }
357
+
358
+ if (valueNodes) {
359
+ for (var i = 0; i < valueNodes.length; i++) {
360
+ EventHelpers.removeEvent(valueNodes[i], 'click', replaceValueEvent);
361
+
362
+ }
363
+ }
364
+ }
365
+
366
+ function replaceValueEvent(e){
367
+ var valueNode = EventHelpers.getEventTarget(e);
368
+ replaceValue(valueNode)
369
+ }
370
+
371
+ function replaceValue(valueNode) {
372
+ var value = valueNode.value;
373
+ jslog.debug(valueNode.value);
374
+ if (!value) {
375
+ value = valueNode.innerHTML;
376
+ }
377
+
378
+ activeInputNode.value = value;
379
+
380
+ }
381
+
382
+ function turnOffNativeAutocomplete(formNode) {
383
+ formNode.setAttribute('autocomplete', 'off');
384
+ }
385
+ }
386
+
387
+ EventHelpers.addPageLoadEvent('autocomplete.init');
@@ -0,0 +1,6 @@
1
+ /*
2
+ cssQuery, version 2.0.2 (2005-08-19)
3
+ Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
4
+ License: http://creativecommons.org/licenses/LGPL/2.1/
5
+ */
6
+ eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 x=6(){7 1D="2.0.2";7 C=/\\s*,\\s*/;7 x=6(s,A){33{7 m=[];7 u=1z.32.2c&&!A;7 b=(A)?(A.31==22)?A:[A]:[1g];7 1E=18(s).1l(C),i;9(i=0;i<1E.y;i++){s=1y(1E[i]);8(U&&s.Z(0,3).2b("")==" *#"){s=s.Z(2);A=24([],b,s[1])}1A A=b;7 j=0,t,f,a,c="";H(j<s.y){t=s[j++];f=s[j++];c+=t+f;a="";8(s[j]=="("){H(s[j++]!=")")a+=s[j];a=a.Z(0,-1);c+="("+a+")"}A=(u&&V[c])?V[c]:21(A,t,f,a);8(u)V[c]=A}m=m.30(A)}2a x.2d;5 m}2Z(e){x.2d=e;5[]}};x.1Z=6(){5"6 x() {\\n [1D "+1D+"]\\n}"};7 V={};x.2c=L;x.2Y=6(s){8(s){s=1y(s).2b("");2a V[s]}1A V={}};7 29={};7 19=L;x.15=6(n,s){8(19)1i("s="+1U(s));29[n]=12 s()};x.2X=6(c){5 c?1i(c):o};7 D={};7 h={};7 q={P:/\\[([\\w-]+(\\|[\\w-]+)?)\\s*(\\W?=)?\\s*([^\\]]*)\\]/};7 T=[];D[" "]=6(r,f,t,n){7 e,i,j;9(i=0;i<f.y;i++){7 s=X(f[i],t,n);9(j=0;(e=s[j]);j++){8(M(e)&&14(e,n))r.z(e)}}};D["#"]=6(r,f,i){7 e,j;9(j=0;(e=f[j]);j++)8(e.B==i)r.z(e)};D["."]=6(r,f,c){c=12 1t("(^|\\\\s)"+c+"(\\\\s|$)");7 e,i;9(i=0;(e=f[i]);i++)8(c.l(e.1V))r.z(e)};D[":"]=6(r,f,p,a){7 t=h[p],e,i;8(t)9(i=0;(e=f[i]);i++)8(t(e,a))r.z(e)};h["2W"]=6(e){7 d=Q(e);8(d.1C)9(7 i=0;i<d.1C.y;i++){8(d.1C[i]==e)5 K}};h["2V"]=6(e){};7 M=6(e){5(e&&e.1c==1&&e.1f!="!")?e:23};7 16=6(e){H(e&&(e=e.2U)&&!M(e))28;5 e};7 G=6(e){H(e&&(e=e.2T)&&!M(e))28;5 e};7 1r=6(e){5 M(e.27)||G(e.27)};7 1P=6(e){5 M(e.26)||16(e.26)};7 1o=6(e){7 c=[];e=1r(e);H(e){c.z(e);e=G(e)}5 c};7 U=K;7 1h=6(e){7 d=Q(e);5(2S d.25=="2R")?/\\.1J$/i.l(d.2Q):2P(d.25=="2O 2N")};7 Q=6(e){5 e.2M||e.1g};7 X=6(e,t){5(t=="*"&&e.1B)?e.1B:e.X(t)};7 17=6(e,t,n){8(t=="*")5 M(e);8(!14(e,n))5 L;8(!1h(e))t=t.2L();5 e.1f==t};7 14=6(e,n){5!n||(n=="*")||(e.2K==n)};7 1e=6(e){5 e.1G};6 24(r,f,B){7 m,i,j;9(i=0;i<f.y;i++){8(m=f[i].1B.2J(B)){8(m.B==B)r.z(m);1A 8(m.y!=23){9(j=0;j<m.y;j++){8(m[j].B==B)r.z(m[j])}}}}5 r};8(![].z)22.2I.z=6(){9(7 i=0;i<1z.y;i++){o[o.y]=1z[i]}5 o.y};7 N=/\\|/;6 21(A,t,f,a){8(N.l(f)){f=f.1l(N);a=f[0];f=f[1]}7 r=[];8(D[t]){D[t](r,A,f,a)}5 r};7 S=/^[^\\s>+~]/;7 20=/[\\s#.:>+~()@]|[^\\s#.:>+~()@]+/g;6 1y(s){8(S.l(s))s=" "+s;5 s.P(20)||[]};7 W=/\\s*([\\s>+~(),]|^|$)\\s*/g;7 I=/([\\s>+~,]|[^(]\\+|^)([#.:@])/g;7 18=6(s){5 s.O(W,"$1").O(I,"$1*$2")};7 1u={1Z:6(){5"\'"},P:/^(\'[^\']*\')|("[^"]*")$/,l:6(s){5 o.P.l(s)},1S:6(s){5 o.l(s)?s:o+s+o},1Y:6(s){5 o.l(s)?s.Z(1,-1):s}};7 1s=6(t){5 1u.1Y(t)};7 E=/([\\/()[\\]?{}|*+-])/g;6 R(s){5 s.O(E,"\\\\$1")};x.15("1j-2H",6(){D[">"]=6(r,f,t,n){7 e,i,j;9(i=0;i<f.y;i++){7 s=1o(f[i]);9(j=0;(e=s[j]);j++)8(17(e,t,n))r.z(e)}};D["+"]=6(r,f,t,n){9(7 i=0;i<f.y;i++){7 e=G(f[i]);8(e&&17(e,t,n))r.z(e)}};D["@"]=6(r,f,a){7 t=T[a].l;7 e,i;9(i=0;(e=f[i]);i++)8(t(e))r.z(e)};h["2G-10"]=6(e){5!16(e)};h["1x"]=6(e,c){c=12 1t("^"+c,"i");H(e&&!e.13("1x"))e=e.1n;5 e&&c.l(e.13("1x"))};q.1X=/\\\\:/g;q.1w="@";q.J={};q.O=6(m,a,n,c,v){7 k=o.1w+m;8(!T[k]){a=o.1W(a,c||"",v||"");T[k]=a;T.z(a)}5 T[k].B};q.1Q=6(s){s=s.O(o.1X,"|");7 m;H(m=s.P(o.P)){7 r=o.O(m[0],m[1],m[2],m[3],m[4]);s=s.O(o.P,r)}5 s};q.1W=6(p,t,v){7 a={};a.B=o.1w+T.y;a.2F=p;t=o.J[t];t=t?t(o.13(p),1s(v)):L;a.l=12 2E("e","5 "+t);5 a};q.13=6(n){1d(n.2D()){F"B":5"e.B";F"2C":5"e.1V";F"9":5"e.2B";F"1T":8(U){5"1U((e.2A.P(/1T=\\\\1v?([^\\\\s\\\\1v]*)\\\\1v?/)||[])[1]||\'\')"}}5"e.13(\'"+n.O(N,":")+"\')"};q.J[""]=6(a){5 a};q.J["="]=6(a,v){5 a+"=="+1u.1S(v)};q.J["~="]=6(a,v){5"/(^| )"+R(v)+"( |$)/.l("+a+")"};q.J["|="]=6(a,v){5"/^"+R(v)+"(-|$)/.l("+a+")"};7 1R=18;18=6(s){5 1R(q.1Q(s))}});x.15("1j-2z",6(){D["~"]=6(r,f,t,n){7 e,i;9(i=0;(e=f[i]);i++){H(e=G(e)){8(17(e,t,n))r.z(e)}}};h["2y"]=6(e,t){t=12 1t(R(1s(t)));5 t.l(1e(e))};h["2x"]=6(e){5 e==Q(e).1H};h["2w"]=6(e){7 n,i;9(i=0;(n=e.1F[i]);i++){8(M(n)||n.1c==3)5 L}5 K};h["1N-10"]=6(e){5!G(e)};h["2v-10"]=6(e){e=e.1n;5 1r(e)==1P(e)};h["2u"]=6(e,s){7 n=x(s,Q(e));9(7 i=0;i<n.y;i++){8(n[i]==e)5 L}5 K};h["1O-10"]=6(e,a){5 1p(e,a,16)};h["1O-1N-10"]=6(e,a){5 1p(e,a,G)};h["2t"]=6(e){5 e.B==2s.2r.Z(1)};h["1M"]=6(e){5 e.1M};h["2q"]=6(e){5 e.1q===L};h["1q"]=6(e){5 e.1q};h["1L"]=6(e){5 e.1L};q.J["^="]=6(a,v){5"/^"+R(v)+"/.l("+a+")"};q.J["$="]=6(a,v){5"/"+R(v)+"$/.l("+a+")"};q.J["*="]=6(a,v){5"/"+R(v)+"/.l("+a+")"};6 1p(e,a,t){1d(a){F"n":5 K;F"2p":a="2n";1a;F"2o":a="2n+1"}7 1m=1o(e.1n);6 1k(i){7 i=(t==G)?1m.y-i:i-1;5 1m[i]==e};8(!Y(a))5 1k(a);a=a.1l("n");7 m=1K(a[0]);7 s=1K(a[1]);8((Y(m)||m==1)&&s==0)5 K;8(m==0&&!Y(s))5 1k(s);8(Y(s))s=0;7 c=1;H(e=t(e))c++;8(Y(m)||m==1)5(t==G)?(c<=s):(s>=c);5(c%m)==s}});x.15("1j-2m",6(){U=1i("L;/*@2l@8(@\\2k)U=K@2j@*/");8(!U){X=6(e,t,n){5 n?e.2i("*",t):e.X(t)};14=6(e,n){5!n||(n=="*")||(e.2h==n)};1h=1g.1I?6(e){5/1J/i.l(Q(e).1I)}:6(e){5 Q(e).1H.1f!="2g"};1e=6(e){5 e.2f||e.1G||1b(e)};6 1b(e){7 t="",n,i;9(i=0;(n=e.1F[i]);i++){1d(n.1c){F 11:F 1:t+=1b(n);1a;F 3:t+=n.2e;1a}}5 t}}});19=K;5 x}();',62,190,'|||||return|function|var|if|for||||||||pseudoClasses||||test|||this||AttributeSelector|||||||cssQuery|length|push|fr|id||selectors||case|nextElementSibling|while||tests|true|false|thisElement||replace|match|getDocument|regEscape||attributeSelectors|isMSIE|cache||getElementsByTagName|isNaN|slice|child||new|getAttribute|compareNamespace|addModule|previousElementSibling|compareTagName|parseSelector|loaded|break|_0|nodeType|switch|getTextContent|tagName|document|isXML|eval|css|_1|split|ch|parentNode|childElements|nthChild|disabled|firstElementChild|getText|RegExp|Quote|x22|PREFIX|lang|_2|arguments|else|all|links|version|se|childNodes|innerText|documentElement|contentType|xml|parseInt|indeterminate|checked|last|nth|lastElementChild|parse|_3|add|href|String|className|create|NS_IE|remove|toString|ST|select|Array|null|_4|mimeType|lastChild|firstChild|continue|modules|delete|join|caching|error|nodeValue|textContent|HTML|prefix|getElementsByTagNameNS|end|x5fwin32|cc_on|standard||odd|even|enabled|hash|location|target|not|only|empty|root|contains|level3|outerHTML|htmlFor|class|toLowerCase|Function|name|first|level2|prototype|item|scopeName|toUpperCase|ownerDocument|Document|XML|Boolean|URL|unknown|typeof|nextSibling|previousSibling|visited|link|valueOf|clearCache|catch|concat|constructor|callee|try'.split('|'),0,{}))
@@ -0,0 +1,121 @@
1
+ // For discussion and comments, see: http://remysharp.com/2009/01/07/html5-enabling-script/
2
+ (function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})()
3
+
4
+ var html5 = new function () {
5
+ var me = this;
6
+
7
+ /**
8
+ * Given an HTML or XML object, find the an attribute by name.
9
+ *
10
+ * @param {Object} obj - a DOM object.
11
+ * @param {String} attrName - the name of an attribute inside the DOM object.
12
+ * @return {Object} - the attribute object or null if there isn't one.
13
+ */
14
+ me.getAttributeByName = function (obj, attrName) {
15
+ var i;
16
+
17
+ var attributes = obj.attributes;
18
+ for (i=0; i<attributes.length; i++) {
19
+ var attr = attributes[i]
20
+ if (attr.nodeName == attrName && attr.specified) {
21
+ return attr;
22
+ }
23
+ }
24
+ return null;
25
+ }
26
+
27
+ /**
28
+ * Given an HTML or XML object, find the value of an attribute.
29
+ *
30
+ * @param {Object} obj - a DOM object.
31
+ * @param {String} attrName - the name of an attribute inside the DOM object.
32
+ * @return {String} - the value of the attribute.
33
+ */
34
+ me.getAttributeValue = function (obj, attrName) {
35
+ var attr = me.getAttributeByName(obj, attrName);
36
+
37
+ if (attr != null) {
38
+ return attr.nodeValue;
39
+ } else {
40
+ return null;
41
+ }
42
+ }
43
+
44
+
45
+
46
+ /**
47
+ * Given an HTML or XML object, set the value of an attribute.
48
+ *
49
+ * @param {Object} obj - a DOM object.
50
+ * @param {String} attrName - the name of an attribute inside the DOM object.
51
+ * @param {String} attrValue - the value of the attribute.
52
+ */
53
+ me.setAttributeValue = function (obj, attrName, attrValue) {
54
+ var attr = me.getAttributeByName(obj, attrName);
55
+
56
+ if (attr != null) {
57
+ attr.nodeValue = attrValue;
58
+ } else {
59
+ return;
60
+ }
61
+ }
62
+
63
+ me.getDefinedAttributes = function (obj) {
64
+
65
+ var attrs = obj.attributes;
66
+ var r = new Array();
67
+
68
+ for (var i=0; i<attrs.length; i++) {
69
+ attr = attrs[i];
70
+ if (attr.specified) {
71
+ r[attr.name] = attr.value;
72
+
73
+ }
74
+ }
75
+
76
+ return r;
77
+ }
78
+
79
+ /*
80
+ * HTML5 dataset
81
+ */
82
+ me.getDataset = function (obj) {
83
+ var r = new Array();
84
+
85
+ var attributes = me.getDefinedAttributes(obj);
86
+ //jslog.debug('entered')
87
+ for (var i=0; i<attributes.length; i++) {
88
+ var attr = attributes[i];
89
+
90
+ if (attr.indexOf('data-') == 0) {
91
+ //jslog.debug('adding ' + name)
92
+ var name = attr.substring(5);
93
+ //jslog.debug('adding ' + name)
94
+ r[name] = attr.value;
95
+ }
96
+ }
97
+
98
+ //jslog.debug('dataset = ' + DebugHelpers.getProperties(r))
99
+ return r;
100
+ }
101
+
102
+ me.getDatasetItem = function (obj, name) {
103
+ var r = me.getAttributeValue(obj, 'data-' + name);
104
+
105
+ if (!r) {
106
+ r = me.getAttributeValue(obj, 'data-' + name.toLowerCase())
107
+ }
108
+ return r;
109
+ }
110
+
111
+ me.setDatasetItem = function (obj, name, value) {
112
+ var attrName = 'data-' + name.toLowerCase();
113
+
114
+ var val = me.setAttributeValue(obj, attrName, value);
115
+
116
+ if (me.getAttributeValue(obj, attrName) == null) {
117
+ obj[attrName] = value;
118
+
119
+ }
120
+ }
121
+ }