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
@@ -12,283 +12,284 @@
|
|
12
12
|
|
13
13
|
(function ($) {
|
14
14
|
|
15
|
-
|
15
|
+
var action_queue = [], data_cache = {};
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
// Test an object for it's constructor type. Sort of a reverse, discriminatory instanceof
|
18
|
+
function isTypeOf(t, c) {
|
19
|
+
if (t === undefined) {
|
20
|
+
return c === 'undefined';
|
21
|
+
}
|
22
|
+
if (t === null) {
|
23
|
+
return c === 'null';
|
24
|
+
}
|
25
|
+
return t.constructor.toString().match(new RegExp(c, 'i')) !== null;
|
24
26
|
}
|
25
|
-
return t.constructor.toString().match(new RegExp(c, 'i')) !== null;
|
26
|
-
}
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
}
|
37
|
-
|
38
|
-
function is_selector(obj) {
|
39
|
-
// Must be string of at least 2 length
|
40
|
-
if (typeof obj !== "string" || obj.length < 2) {
|
41
|
-
return false;
|
28
|
+
// Parses declarations out of the flat attribute array
|
29
|
+
function extractor(attrs, symbol) {
|
30
|
+
if (!attrs || !attrs[symbol]) {
|
31
|
+
return undefined;
|
32
|
+
}
|
33
|
+
var extract = attrs[symbol];
|
34
|
+
delete attrs[symbol];
|
35
|
+
return extract;
|
42
36
|
}
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
37
|
+
|
38
|
+
function is_selector(obj) {
|
39
|
+
// Must be string of at least 2 length
|
40
|
+
if (typeof obj !== "string" || obj.length < 2) {
|
41
|
+
return false;
|
42
|
+
}
|
43
|
+
// Must start with '.', '#', or '%'
|
44
|
+
var c = obj.charAt(0);
|
45
|
+
if (!(c === '.' || c === '#' || c === '%')) {
|
46
|
+
return false;
|
47
|
+
}
|
48
|
+
return true;
|
47
49
|
}
|
48
|
-
return true;
|
49
|
-
}
|
50
50
|
|
51
51
|
|
52
|
-
|
53
|
-
|
52
|
+
// The workhorse that creates the node.
|
53
|
+
function exec_haml(node, haml) {
|
54
|
+
|
55
|
+
var css, actions, input, selector, classes, ids, tag, newnode, attributes;
|
54
56
|
|
55
|
-
|
57
|
+
// Shallow copy haml so we don't eat our input when we shift the array
|
58
|
+
// Also this turns "arguments" pseudo-arrays to real arrays
|
59
|
+
input = Array.prototype.slice.call(haml, 0);
|
56
60
|
|
57
|
-
|
58
|
-
// Also this turns "arguments" pseudo-arrays to real arrays
|
59
|
-
input = Array.prototype.slice.call(haml, 0);
|
61
|
+
function apply_haml(parent, part) {
|
60
62
|
|
61
|
-
|
63
|
+
// Ignore undefined and null, they only break things.
|
64
|
+
if (part === undefined || part === null) {
|
65
|
+
return;
|
66
|
+
}
|
62
67
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
68
|
+
// Pass dom and jquery nodes through as is
|
69
|
+
if (part.nodeType || part.jquery) {
|
70
|
+
parent.append(part);
|
71
|
+
return;
|
72
|
+
}
|
67
73
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
74
|
+
// Strings and numbers are text nodes
|
75
|
+
if (isTypeOf(part, 'String') && part.length > 0) {
|
76
|
+
// Strip of leading backslash
|
77
|
+
if (part[0] === '\\') {
|
78
|
+
part = part.substr(1);
|
79
|
+
}
|
80
|
+
parent.append(document.createTextNode(part));
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
if (isTypeOf(part, 'Number')) {
|
84
|
+
parent.append(document.createTextNode(part));
|
85
|
+
return;
|
86
|
+
}
|
73
87
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
88
|
+
// Recursivly run arrays
|
89
|
+
if (isTypeOf(part, 'Array') && part.length > 0) {
|
90
|
+
exec_haml(parent, part);
|
91
|
+
return;
|
92
|
+
}
|
79
93
|
}
|
80
|
-
parent.append(document.createTextNode(part));
|
81
|
-
return;
|
82
|
-
}
|
83
|
-
if (isTypeOf(part, 'Number')) {
|
84
|
-
parent.append(document.createTextNode(part));
|
85
|
-
return;
|
86
|
-
}
|
87
|
-
|
88
|
-
// Recursivly run arrays
|
89
|
-
if (isTypeOf(part, 'Array') && part.length > 0) {
|
90
|
-
exec_haml(parent, part);
|
91
|
-
return;
|
92
|
-
}
|
93
|
-
}
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
95
|
+
if (input.length && input.length > 0) {
|
96
|
+
if (is_selector(input[0])) {
|
97
|
+
// Pull the selector off the front
|
98
|
+
// Parse out the selector information
|
99
|
+
// Default tag to div if not specified
|
100
|
+
selector = input.shift();
|
101
|
+
classes = selector.match(/\.[^\.#]+/g);
|
102
|
+
ids = selector.match(/#[^\.#]+/g);
|
103
|
+
tag = selector.match(/^%([^\.#]+)/g);
|
104
|
+
tag = tag ? tag[0].substr(1) : 'div';
|
105
|
+
|
106
|
+
// Create the node
|
107
|
+
newnode = $(document.createElement(tag));
|
108
|
+
|
109
|
+
// Parse the attributes if there are any
|
110
|
+
if (input.length > 0 && isTypeOf(input[0], 'Object') && !input[0].nodeType && !input[0].jquery) {
|
111
|
+
attributes = input.shift();
|
112
|
+
css = extractor(attributes, 'css');
|
113
|
+
actions = extractor(attributes, '$');
|
114
|
+
newnode.attr(attributes);
|
115
|
+
}
|
116
|
+
|
117
|
+
// Add in the ids from the selector
|
118
|
+
if (ids) {
|
119
|
+
$.each(ids, function () {
|
120
|
+
var id, old_id;
|
121
|
+
id = this.substr(1);
|
122
|
+
old_id = newnode.attr('id');
|
123
|
+
if (old_id) {
|
124
|
+
newnode.attr('id', old_id + " " + id);
|
125
|
+
}
|
126
|
+
else {
|
127
|
+
newnode.attr('id', id);
|
128
|
+
}
|
129
|
+
});
|
130
|
+
}
|
131
|
+
|
132
|
+
// Add in the classes from the selector
|
133
|
+
if (classes) {
|
134
|
+
$.each(classes, function () {
|
135
|
+
newnode.addClass(this.substr(1));
|
136
|
+
});
|
137
|
+
}
|
138
|
+
|
139
|
+
// Add in any css from underscore styles
|
140
|
+
if (css) {
|
141
|
+
newnode.css(css);
|
142
|
+
}
|
143
|
+
|
144
|
+
// Move a level deeper in the dom tree
|
145
|
+
node.append(newnode);
|
146
|
+
node = newnode;
|
147
|
+
|
148
|
+
// Process jquery actions as well
|
149
|
+
if (actions) {
|
150
|
+
$.each(actions, function (method) {
|
151
|
+
action_queue.push({node: node, method: method, params: this});
|
152
|
+
});
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
// Add in content with recursive call
|
157
|
+
$.each(input, function () {
|
158
|
+
apply_haml(node, this);
|
159
|
+
});
|
160
|
+
}
|
161
|
+
else {
|
162
|
+
apply_haml(node, input);
|
116
163
|
}
|
164
|
+
}
|
117
165
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
newnode.attr('id', old_id + " " + id);
|
166
|
+
// jQuery events are queued up till we're sure the node exists in the main dom. Once
|
167
|
+
// it's safe, this function is called to actually flush the queue and execute the function calls.
|
168
|
+
function flush_queue() {
|
169
|
+
$.each(action_queue, function () {
|
170
|
+
// $ is a special case that means onload
|
171
|
+
if (this.method === '$') {
|
172
|
+
this.params.apply(this.node, []);
|
126
173
|
}
|
174
|
+
// otherwise call method on the jquery object with given params.
|
127
175
|
else {
|
128
|
-
|
176
|
+
if (!isTypeOf(this.params, 'Array')) {
|
177
|
+
this.params = [this.params];
|
178
|
+
}
|
179
|
+
this.node[this.method].apply(this.node, this.params);
|
129
180
|
}
|
130
|
-
|
131
|
-
|
181
|
+
});
|
182
|
+
action_queue = [];
|
183
|
+
}
|
132
184
|
|
133
|
-
|
134
|
-
|
135
|
-
$.each(classes, function () {
|
136
|
-
newnode.addClass(this.substr(1));
|
137
|
-
});
|
138
|
-
}
|
185
|
+
function real_haml(haml) {
|
186
|
+
var newnode;
|
139
187
|
|
140
|
-
//
|
141
|
-
|
142
|
-
|
143
|
-
}
|
188
|
+
// Build the dom on a non-attached node
|
189
|
+
newnode = $(document.createElement("div"));
|
190
|
+
exec_haml(newnode, haml);
|
144
191
|
|
145
|
-
//
|
146
|
-
|
147
|
-
node = newnode;
|
192
|
+
// Then attach it's children to the page.
|
193
|
+
this.append(newnode.contents());
|
148
194
|
|
149
|
-
//
|
150
|
-
if (
|
151
|
-
|
152
|
-
action_queue.push({node: node, method: method, params: this});
|
153
|
-
});
|
195
|
+
// Flush action queue once we're on the page
|
196
|
+
if (this.closest('body').length > 0) {
|
197
|
+
flush_queue();
|
154
198
|
}
|
155
|
-
}
|
156
199
|
|
157
|
-
|
158
|
-
$.each(input, function () {
|
159
|
-
apply_haml(node, this);
|
160
|
-
});
|
200
|
+
return newnode.contents();
|
161
201
|
}
|
162
|
-
else
|
163
|
-
{
|
164
|
-
apply_haml(node, input);
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
// jQuery events are queued up till we're sure the node exists in the main dom. Once
|
169
|
-
// it's safe, this function is called to actually flush the queue and execute the function calls.
|
170
|
-
function flush_queue() {
|
171
|
-
$.each(action_queue, function () {
|
172
|
-
// $ is a special case that means onload
|
173
|
-
if (this.method === '$') {
|
174
|
-
this.params.apply(this.node, []);
|
175
|
-
}
|
176
|
-
// otherwise call method on the jquery object with given params.
|
177
|
-
else {
|
178
|
-
if (!isTypeOf(this.params, 'Array')) {
|
179
|
-
this.params = [this.params];
|
180
|
-
}
|
181
|
-
this.node[this.method].apply(this.node, this.params);
|
182
|
-
}
|
183
|
-
});
|
184
|
-
action_queue = [];
|
185
|
-
}
|
186
202
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
203
|
+
// Like the original haml, but returns the new nodes instead of the
|
204
|
+
// original matched set.
|
205
|
+
$.fn.insertHaml = function (/* haml1, haml2, ... */) {
|
206
|
+
return real_haml.call(this,
|
207
|
+
Array.prototype.slice.call(arguments, 0)
|
208
|
+
);
|
209
|
+
};
|
210
|
+
|
211
|
+
// Calling haml on a node converts the passed in array to dom children
|
212
|
+
$.fn.haml = function (/* haml1, haml2, ... */) {
|
213
|
+
real_haml.call(this,
|
214
|
+
Array.prototype.slice.call(arguments, 0)
|
215
|
+
);
|
216
|
+
|
217
|
+
// Return "this" to allow for chaining.
|
218
|
+
return this;
|
219
|
+
|
220
|
+
};
|
221
|
+
|
222
|
+
// static helper functions
|
223
|
+
$.haml = {
|
224
|
+
// This is a constructor to create a piece of page that is re-drawable.
|
225
|
+
// The passed in callback is the function that provides the haml input.
|
226
|
+
// Call inject() on the resulting object to place it in the haml document stream
|
227
|
+
// and call update() on the placeholder whenever you want it to redraw itself.
|
228
|
+
placeholder: function (callback) {
|
229
|
+
var children;
|
230
|
+
|
231
|
+
function inject() {
|
232
|
+
// Build the dom on a non-attached node
|
233
|
+
var node = $(document.createElement("div"));
|
234
|
+
node.haml(callback.apply(this, arguments));
|
235
|
+
children = node.contents();
|
236
|
+
return children;
|
237
|
+
}
|
201
238
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
$.fn.haml = function (/* haml1, haml2, ... */) {
|
215
|
-
real_haml.call(this,
|
216
|
-
Array.prototype.slice.call(arguments, 0)
|
217
|
-
);
|
218
|
-
|
219
|
-
// Return "this" to allow for chaining.
|
220
|
-
return this;
|
221
|
-
|
222
|
-
};
|
223
|
-
|
224
|
-
// static helper functions
|
225
|
-
$.haml = {
|
226
|
-
// This is a constructor to create a piece of page that is re-drawable.
|
227
|
-
// The passed in callback is the function that provides the haml input.
|
228
|
-
// Call inject() on the resulting object to place it in the haml document stream
|
229
|
-
// and call update() on the placeholder whenever you want it to redraw itself.
|
230
|
-
placeholder: function (callback) {
|
231
|
-
var children;
|
232
|
-
|
233
|
-
function inject() {
|
234
|
-
// Build the dom on a non-attached node
|
235
|
-
var node = $(document.createElement("div"));
|
236
|
-
node.haml(callback.apply(this, arguments));
|
237
|
-
children = node.contents();
|
238
|
-
return children;
|
239
|
-
}
|
240
|
-
|
241
|
-
// Replace the first child node with the new children and remove other
|
242
|
-
// old children if there are any.
|
243
|
-
function update() {
|
244
|
-
var args = arguments;
|
245
|
-
$.each(children, function (i, child) {
|
246
|
-
if (i === 0) {
|
247
|
-
$(child).replaceWith(inject.apply(this, args));
|
248
|
-
} else {
|
249
|
-
$(child).remove();
|
250
|
-
}
|
251
|
-
});
|
252
|
-
flush_queue();
|
253
|
-
}
|
254
|
-
|
255
|
-
return {
|
256
|
-
inject: inject,
|
257
|
-
update: update
|
258
|
-
};
|
259
|
-
},
|
260
|
-
|
261
|
-
// data_provider is a function that has the form "function (on_data)" where
|
262
|
-
// on_data is of the form "function (data)" so that OnDemand can call
|
263
|
-
// data_provider giving it a callback, and the callback will be called with
|
264
|
-
// the data when it's available.
|
265
|
-
// onDemand returns functions that returns a placeholder. See above for details.
|
266
|
-
onDemand: function (data_provider, loading_message) {
|
267
|
-
var placeholder;
|
268
|
-
|
269
|
-
loading_message = ["%div", {style: "text-align: center; cursor: wait"}, loading_message || "Loading..."];
|
270
|
-
|
271
|
-
return function (renderer/*, param1, param2...*/) {
|
272
|
-
var params = Array.prototype.slice.call(arguments, 1);
|
273
|
-
function render_haml() {
|
274
|
-
var key = Util.stringify(params);
|
275
|
-
if (data_cache[key] !== undefined) {
|
276
|
-
// If data is in data_cache, render directly
|
277
|
-
return renderer(data_cache[key]);
|
278
|
-
} else {
|
279
|
-
// Otherwise put in a placeholder and then replace once the data is known
|
280
|
-
function on_data(data) {
|
281
|
-
data_cache[key] = data;
|
282
|
-
placeholder.update();
|
239
|
+
// Replace the first child node with the new children and remove other
|
240
|
+
// old children if there are any.
|
241
|
+
function update() {
|
242
|
+
var args = arguments;
|
243
|
+
$.each(children, function (i, child) {
|
244
|
+
if (i === 0) {
|
245
|
+
$(child).replaceWith(inject.apply(this, args));
|
246
|
+
} else {
|
247
|
+
$(child).remove();
|
248
|
+
}
|
249
|
+
});
|
250
|
+
flush_queue();
|
283
251
|
}
|
284
|
-
|
285
|
-
return
|
286
|
-
|
252
|
+
|
253
|
+
return {
|
254
|
+
inject: inject,
|
255
|
+
update: update
|
256
|
+
};
|
257
|
+
},
|
258
|
+
|
259
|
+
// data_provider is a function that has the form "function (on_data)" where
|
260
|
+
// on_data is of the form "function (data)" so that OnDemand can call
|
261
|
+
// data_provider giving it a callback, and the callback will be called with
|
262
|
+
// the data when it's available.
|
263
|
+
// onDemand returns functions that returns a placeholder. See above for details.
|
264
|
+
onDemand: function (data_provider, loading_message) {
|
265
|
+
var placeholder;
|
266
|
+
|
267
|
+
loading_message = ["%div", {style: "text-align: center; cursor: wait"}, loading_message || "Loading..."];
|
268
|
+
|
269
|
+
return function (renderer/*, param1, param2...*/) {
|
270
|
+
var params = Array.prototype.slice.call(arguments, 1);
|
271
|
+
|
272
|
+
function render_haml() {
|
273
|
+
var key = Util.stringify(params);
|
274
|
+
if (data_cache[key] !== undefined) {
|
275
|
+
// If data is in data_cache, render directly
|
276
|
+
return renderer(data_cache[key]);
|
277
|
+
} else {
|
278
|
+
// Otherwise put in a placeholder and then replace once the data is known
|
279
|
+
function on_data(data) {
|
280
|
+
data_cache[key] = data;
|
281
|
+
placeholder.update();
|
282
|
+
}
|
283
|
+
|
284
|
+
data_provider.apply(this, [on_data].concat(params));
|
285
|
+
return loading_message;
|
286
|
+
}
|
287
|
+
}
|
288
|
+
|
289
|
+
placeholder = $.haml.placeholder(render_haml);
|
290
|
+
return placeholder;
|
291
|
+
};
|
287
292
|
}
|
288
|
-
|
289
|
-
return placeholder;
|
290
|
-
};
|
291
|
-
}
|
292
|
-
};
|
293
|
+
};
|
293
294
|
|
294
295
|
}(jQuery));
|