jazz-jss 0.0.1
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.
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/bin/jazz +9 -0
- data/dist/hashchange/jquery.ba-hashchange.js +390 -0
- data/dist/jazz/lib/controller.js +17 -0
- data/dist/jazz/lib/db.js +41 -0
- data/dist/jazz/lib/helper.js +55 -0
- data/dist/jazz/lib/model.js +122 -0
- data/dist/jazz/lib/route.js +73 -0
- data/dist/jazz/lib/view.js +1 -0
- data/dist/jazz/main.js +76 -0
- data/dist/jquery/jquery.js +9266 -0
- data/dist/mustache/mustache.js +324 -0
- data/dist/require/order.js +180 -0
- data/dist/require/require.js +31 -0
- data/dist/underscore/underscore.js +27 -0
- data/lib/jazz/app_detector.rb +41 -0
- data/lib/jazz/app_generator.rb +37 -0
- data/lib/jazz/cli.rb +14 -0
- data/lib/jazz/controller_generator.rb +27 -0
- data/lib/jazz/model_generator.rb +27 -0
- data/lib/jazz/scaffold_generator.rb +43 -0
- data/lib/jazz.rb +11 -0
- data/templates/app_root/app/assets/javascripts/application.js +0 -0
- data/templates/app_root/app/assets/stylesheets/application.css +0 -0
- data/templates/app_root/config/glue.js +7 -0
- data/templates/app_root/config/routes.js +4 -0
- data/templates/application.js +4 -0
- data/templates/controller.js +19 -0
- data/templates/db.js +14 -0
- data/templates/index.html +9 -0
- data/templates/model.js +9 -0
- data/templates/scaffold_controller.js +18 -0
- metadata +185 -0
@@ -0,0 +1,324 @@
|
|
1
|
+
/*
|
2
|
+
mustache.js — Logic-less templates in JavaScript
|
3
|
+
|
4
|
+
See http://mustache.github.com/ for more info.
|
5
|
+
*/
|
6
|
+
|
7
|
+
var Mustache = function() {
|
8
|
+
var Renderer = function() {};
|
9
|
+
|
10
|
+
Renderer.prototype = {
|
11
|
+
otag: "{{",
|
12
|
+
ctag: "}}",
|
13
|
+
pragmas: {},
|
14
|
+
buffer: [],
|
15
|
+
pragmas_implemented: {
|
16
|
+
"IMPLICIT-ITERATOR": true
|
17
|
+
},
|
18
|
+
context: {},
|
19
|
+
|
20
|
+
render: function(template, context, partials, in_recursion) {
|
21
|
+
// reset buffer & set context
|
22
|
+
if(!in_recursion) {
|
23
|
+
this.context = context;
|
24
|
+
this.buffer = []; // TODO: make this non-lazy
|
25
|
+
}
|
26
|
+
|
27
|
+
// fail fast
|
28
|
+
if(!this.includes("", template)) {
|
29
|
+
if(in_recursion) {
|
30
|
+
return template;
|
31
|
+
} else {
|
32
|
+
this.send(template);
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
template = this.render_pragmas(template);
|
38
|
+
var html = this.render_section(template, context, partials);
|
39
|
+
if(in_recursion) {
|
40
|
+
return this.render_tags(html, context, partials, in_recursion);
|
41
|
+
}
|
42
|
+
|
43
|
+
this.render_tags(html, context, partials, in_recursion);
|
44
|
+
},
|
45
|
+
|
46
|
+
/*
|
47
|
+
Sends parsed lines
|
48
|
+
*/
|
49
|
+
send: function(line) {
|
50
|
+
if(line != "") {
|
51
|
+
this.buffer.push(line);
|
52
|
+
}
|
53
|
+
},
|
54
|
+
|
55
|
+
/*
|
56
|
+
Looks for %PRAGMAS
|
57
|
+
*/
|
58
|
+
render_pragmas: function(template) {
|
59
|
+
// no pragmas
|
60
|
+
if(!this.includes("%", template)) {
|
61
|
+
return template;
|
62
|
+
}
|
63
|
+
|
64
|
+
var that = this;
|
65
|
+
var regex = new RegExp(this.otag + "%([\\w-]+) ?([\\w]+=[\\w]+)?" +
|
66
|
+
this.ctag);
|
67
|
+
return template.replace(regex, function(match, pragma, options) {
|
68
|
+
if(!that.pragmas_implemented[pragma]) {
|
69
|
+
throw({message:
|
70
|
+
"This implementation of mustache doesn't understand the '" +
|
71
|
+
pragma + "' pragma"});
|
72
|
+
}
|
73
|
+
that.pragmas[pragma] = {};
|
74
|
+
if(options) {
|
75
|
+
var opts = options.split("=");
|
76
|
+
that.pragmas[pragma][opts[0]] = opts[1];
|
77
|
+
}
|
78
|
+
return "";
|
79
|
+
// ignore unknown pragmas silently
|
80
|
+
});
|
81
|
+
},
|
82
|
+
|
83
|
+
/*
|
84
|
+
Tries to find a partial in the curent scope and render it
|
85
|
+
*/
|
86
|
+
render_partial: function(name, context, partials) {
|
87
|
+
name = this.trim(name);
|
88
|
+
if(!partials || partials[name] === undefined) {
|
89
|
+
throw({message: "unknown_partial '" + name + "'"});
|
90
|
+
}
|
91
|
+
if(typeof(context[name]) != "object") {
|
92
|
+
return this.render(partials[name], context, partials, true);
|
93
|
+
}
|
94
|
+
return this.render(partials[name], context[name], partials, true);
|
95
|
+
},
|
96
|
+
|
97
|
+
/*
|
98
|
+
Renders inverted (^) and normal (#) sections
|
99
|
+
*/
|
100
|
+
render_section: function(template, context, partials) {
|
101
|
+
if(!this.includes("#", template) && !this.includes("^", template)) {
|
102
|
+
return template;
|
103
|
+
}
|
104
|
+
|
105
|
+
var that = this;
|
106
|
+
// CSW - Added "+?" so it finds the tighest bound, not the widest
|
107
|
+
var regex = new RegExp(this.otag + "(\\^|\\#)\\s*(.+)\\s*" + this.ctag +
|
108
|
+
"\n*([\\s\\S]+?)" + this.otag + "\\/\\s*\\2\\s*" + this.ctag +
|
109
|
+
"\\s*", "mg");
|
110
|
+
|
111
|
+
// for each {{#foo}}{{/foo}} section do...
|
112
|
+
return template.replace(regex, function(match, type, name, content) {
|
113
|
+
var value = that.find(name, context);
|
114
|
+
if(type == "^") { // inverted section
|
115
|
+
if(!value || that.is_array(value) && value.length === 0) {
|
116
|
+
// false or empty list, render it
|
117
|
+
return that.render(content, context, partials, true);
|
118
|
+
} else {
|
119
|
+
return "";
|
120
|
+
}
|
121
|
+
} else if(type == "#") { // normal section
|
122
|
+
if(that.is_array(value)) { // Enumerable, Let's loop!
|
123
|
+
return that.map(value, function(row) {
|
124
|
+
return that.render(content, that.create_context(row),
|
125
|
+
partials, true);
|
126
|
+
}).join("");
|
127
|
+
} else if(that.is_object(value)) { // Object, Use it as subcontext!
|
128
|
+
return that.render(content, that.create_context(value),
|
129
|
+
partials, true);
|
130
|
+
} else if(typeof value === "function") {
|
131
|
+
// higher order section
|
132
|
+
return value.call(context, content, function(text) {
|
133
|
+
return that.render(text, context, partials, true);
|
134
|
+
});
|
135
|
+
} else if(value) { // boolean section
|
136
|
+
return that.render(content, context, partials, true);
|
137
|
+
} else {
|
138
|
+
return "";
|
139
|
+
}
|
140
|
+
}
|
141
|
+
});
|
142
|
+
},
|
143
|
+
|
144
|
+
/*
|
145
|
+
Replace {{foo}} and friends with values from our view
|
146
|
+
*/
|
147
|
+
render_tags: function(template, context, partials, in_recursion) {
|
148
|
+
// tit for tat
|
149
|
+
var that = this;
|
150
|
+
|
151
|
+
var new_regex = function() {
|
152
|
+
return new RegExp(that.otag + "(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?" +
|
153
|
+
that.ctag + "+", "g");
|
154
|
+
};
|
155
|
+
|
156
|
+
var regex = new_regex();
|
157
|
+
var tag_replace_callback = function(match, operator, name) {
|
158
|
+
switch(operator) {
|
159
|
+
case "!": // ignore comments
|
160
|
+
return "";
|
161
|
+
case "=": // set new delimiters, rebuild the replace regexp
|
162
|
+
that.set_delimiters(name);
|
163
|
+
regex = new_regex();
|
164
|
+
return "";
|
165
|
+
case ">": // render partial
|
166
|
+
return that.render_partial(name, context, partials);
|
167
|
+
case "{": // the triple mustache is unescaped
|
168
|
+
return that.find(name, context);
|
169
|
+
default: // escape the value
|
170
|
+
return that.escape(that.find(name, context));
|
171
|
+
}
|
172
|
+
};
|
173
|
+
var lines = template.split("\n");
|
174
|
+
for(var i = 0; i < lines.length; i++) {
|
175
|
+
lines[i] = lines[i].replace(regex, tag_replace_callback, this);
|
176
|
+
if(!in_recursion) {
|
177
|
+
this.send(lines[i]);
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
if(in_recursion) {
|
182
|
+
return lines.join("\n");
|
183
|
+
}
|
184
|
+
},
|
185
|
+
|
186
|
+
set_delimiters: function(delimiters) {
|
187
|
+
var dels = delimiters.split(" ");
|
188
|
+
this.otag = this.escape_regex(dels[0]);
|
189
|
+
this.ctag = this.escape_regex(dels[1]);
|
190
|
+
},
|
191
|
+
|
192
|
+
escape_regex: function(text) {
|
193
|
+
// thank you Simon Willison
|
194
|
+
if(!arguments.callee.sRE) {
|
195
|
+
var specials = [
|
196
|
+
'/', '.', '*', '+', '?', '|',
|
197
|
+
'(', ')', '[', ']', '{', '}', '\\'
|
198
|
+
];
|
199
|
+
arguments.callee.sRE = new RegExp(
|
200
|
+
'(\\' + specials.join('|\\') + ')', 'g'
|
201
|
+
);
|
202
|
+
}
|
203
|
+
return text.replace(arguments.callee.sRE, '\\$1');
|
204
|
+
},
|
205
|
+
|
206
|
+
/*
|
207
|
+
find `name` in current `context`. That is find me a value
|
208
|
+
from the view object
|
209
|
+
*/
|
210
|
+
find: function(name, context) {
|
211
|
+
name = this.trim(name);
|
212
|
+
|
213
|
+
// Checks whether a value is thruthy or false or 0
|
214
|
+
function is_kinda_truthy(bool) {
|
215
|
+
return bool === false || bool === 0 || bool;
|
216
|
+
}
|
217
|
+
|
218
|
+
var value;
|
219
|
+
if(is_kinda_truthy(context[name])) {
|
220
|
+
value = context[name];
|
221
|
+
} else if(is_kinda_truthy(this.context[name])) {
|
222
|
+
value = this.context[name];
|
223
|
+
}
|
224
|
+
|
225
|
+
if(typeof value === "function") {
|
226
|
+
return value.apply(context);
|
227
|
+
}
|
228
|
+
if(value !== undefined) {
|
229
|
+
return value;
|
230
|
+
}
|
231
|
+
// silently ignore unkown variables
|
232
|
+
return "";
|
233
|
+
},
|
234
|
+
|
235
|
+
// Utility methods
|
236
|
+
|
237
|
+
/* includes tag */
|
238
|
+
includes: function(needle, haystack) {
|
239
|
+
return haystack.indexOf(this.otag + needle) != -1;
|
240
|
+
},
|
241
|
+
|
242
|
+
/*
|
243
|
+
Does away with nasty characters
|
244
|
+
*/
|
245
|
+
escape: function(s) {
|
246
|
+
s = String(s === null ? "" : s);
|
247
|
+
return s.replace(/&(?!\w+;)|["<>\\]/g, function(s) {
|
248
|
+
switch(s) {
|
249
|
+
case "&": return "&";
|
250
|
+
case "\\": return "\\\\";
|
251
|
+
case '"': return '\"';
|
252
|
+
case "<": return "<";
|
253
|
+
case ">": return ">";
|
254
|
+
default: return s;
|
255
|
+
}
|
256
|
+
});
|
257
|
+
},
|
258
|
+
|
259
|
+
// by @langalex, support for arrays of strings
|
260
|
+
create_context: function(_context) {
|
261
|
+
if(this.is_object(_context)) {
|
262
|
+
return _context;
|
263
|
+
} else {
|
264
|
+
var iterator = ".";
|
265
|
+
if(this.pragmas["IMPLICIT-ITERATOR"]) {
|
266
|
+
iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator;
|
267
|
+
}
|
268
|
+
var ctx = {};
|
269
|
+
ctx[iterator] = _context;
|
270
|
+
return ctx;
|
271
|
+
}
|
272
|
+
},
|
273
|
+
|
274
|
+
is_object: function(a) {
|
275
|
+
return a && typeof a == "object";
|
276
|
+
},
|
277
|
+
|
278
|
+
is_array: function(a) {
|
279
|
+
return Object.prototype.toString.call(a) === '[object Array]';
|
280
|
+
},
|
281
|
+
|
282
|
+
/*
|
283
|
+
Gets rid of leading and trailing whitespace
|
284
|
+
*/
|
285
|
+
trim: function(s) {
|
286
|
+
return s.replace(/^\s*|\s*$/g, "");
|
287
|
+
},
|
288
|
+
|
289
|
+
/*
|
290
|
+
Why, why, why? Because IE. Cry, cry cry.
|
291
|
+
*/
|
292
|
+
map: function(array, fn) {
|
293
|
+
if (typeof array.map == "function") {
|
294
|
+
return array.map(fn);
|
295
|
+
} else {
|
296
|
+
var r = [];
|
297
|
+
var l = array.length;
|
298
|
+
for(var i = 0; i < l; i++) {
|
299
|
+
r.push(fn(array[i]));
|
300
|
+
}
|
301
|
+
return r;
|
302
|
+
}
|
303
|
+
}
|
304
|
+
};
|
305
|
+
|
306
|
+
return({
|
307
|
+
name: "mustache.js",
|
308
|
+
version: "0.3.0",
|
309
|
+
|
310
|
+
/*
|
311
|
+
Turns a template and view into HTML
|
312
|
+
*/
|
313
|
+
to_html: function(template, view, partials, send_fun) {
|
314
|
+
var renderer = new Renderer();
|
315
|
+
if(send_fun) {
|
316
|
+
renderer.send = send_fun;
|
317
|
+
}
|
318
|
+
renderer.render(template, view, partials);
|
319
|
+
if(!send_fun) {
|
320
|
+
return renderer.buffer.join("\n");
|
321
|
+
}
|
322
|
+
}
|
323
|
+
});
|
324
|
+
}();
|
@@ -0,0 +1,180 @@
|
|
1
|
+
/**
|
2
|
+
* @license RequireJS order 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
3
|
+
* Available via the MIT or new BSD license.
|
4
|
+
* see: http://github.com/jrburke/requirejs for details
|
5
|
+
*/
|
6
|
+
/*jslint nomen: false, plusplus: false, strict: false */
|
7
|
+
/*global require: false, define: false, window: false, document: false,
|
8
|
+
setTimeout: false */
|
9
|
+
|
10
|
+
//Specify that requirejs optimizer should wrap this code in a closure that
|
11
|
+
//maps the namespaced requirejs API to non-namespaced local variables.
|
12
|
+
/*requirejs namespace: true */
|
13
|
+
|
14
|
+
(function () {
|
15
|
+
|
16
|
+
//Sadly necessary browser inference due to differences in the way
|
17
|
+
//that browsers load and execute dynamically inserted javascript
|
18
|
+
//and whether the script/cache method works when ordered execution is
|
19
|
+
//desired. Currently, Gecko and Opera do not load/fire onload for scripts with
|
20
|
+
//type="script/cache" but they execute injected scripts in order
|
21
|
+
//unless the 'async' flag is present.
|
22
|
+
//However, this is all changing in latest browsers implementing HTML5
|
23
|
+
//spec. With compliant browsers .async true by default, and
|
24
|
+
//if false, then it will execute in order. Favor that test first for forward
|
25
|
+
//compatibility.
|
26
|
+
var testScript = typeof document !== "undefined" &&
|
27
|
+
typeof window !== "undefined" &&
|
28
|
+
document.createElement("script"),
|
29
|
+
|
30
|
+
supportsInOrderExecution = testScript && (testScript.async ||
|
31
|
+
((window.opera &&
|
32
|
+
Object.prototype.toString.call(window.opera) === "[object Opera]") ||
|
33
|
+
//If Firefox 2 does not have to be supported, then
|
34
|
+
//a better check may be:
|
35
|
+
//('mozIsLocallyAvailable' in window.navigator)
|
36
|
+
("MozAppearance" in document.documentElement.style))),
|
37
|
+
|
38
|
+
//This test is true for IE browsers, which will load scripts but only
|
39
|
+
//execute them once the script is added to the DOM.
|
40
|
+
supportsLoadSeparateFromExecute = testScript &&
|
41
|
+
testScript.readyState === 'uninitialized',
|
42
|
+
|
43
|
+
readyRegExp = /^(complete|loaded)$/,
|
44
|
+
cacheWaiting = [],
|
45
|
+
cached = {},
|
46
|
+
scriptNodes = {},
|
47
|
+
scriptWaiting = [];
|
48
|
+
|
49
|
+
//Done with the test script.
|
50
|
+
testScript = null;
|
51
|
+
|
52
|
+
//Callback used by the type="script/cache" callback that indicates a script
|
53
|
+
//has finished downloading.
|
54
|
+
function scriptCacheCallback(evt) {
|
55
|
+
var node = evt.currentTarget || evt.srcElement, i,
|
56
|
+
moduleName, resource;
|
57
|
+
|
58
|
+
if (evt.type === "load" || readyRegExp.test(node.readyState)) {
|
59
|
+
//Pull out the name of the module and the context.
|
60
|
+
moduleName = node.getAttribute("data-requiremodule");
|
61
|
+
|
62
|
+
//Mark this cache request as loaded
|
63
|
+
cached[moduleName] = true;
|
64
|
+
|
65
|
+
//Find out how many ordered modules have loaded
|
66
|
+
for (i = 0; (resource = cacheWaiting[i]); i++) {
|
67
|
+
if (cached[resource.name]) {
|
68
|
+
resource.req([resource.name], resource.onLoad);
|
69
|
+
} else {
|
70
|
+
//Something in the ordered list is not loaded,
|
71
|
+
//so wait.
|
72
|
+
break;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
//If just loaded some items, remove them from cacheWaiting.
|
77
|
+
if (i > 0) {
|
78
|
+
cacheWaiting.splice(0, i);
|
79
|
+
}
|
80
|
+
|
81
|
+
//Remove this script tag from the DOM
|
82
|
+
//Use a setTimeout for cleanup because some older IE versions vomit
|
83
|
+
//if removing a script node while it is being evaluated.
|
84
|
+
setTimeout(function () {
|
85
|
+
node.parentNode.removeChild(node);
|
86
|
+
}, 15);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Used for the IE case, where fetching is done by creating script element
|
92
|
+
* but not attaching it to the DOM. This function will be called when that
|
93
|
+
* happens so it can be determined when the node can be attached to the
|
94
|
+
* DOM to trigger its execution.
|
95
|
+
*/
|
96
|
+
function onFetchOnly(node) {
|
97
|
+
var i, loadedNode, resourceName;
|
98
|
+
|
99
|
+
//Mark this script as loaded.
|
100
|
+
node.setAttribute('data-orderloaded', 'loaded');
|
101
|
+
|
102
|
+
//Cycle through waiting scripts. If the matching node for them
|
103
|
+
//is loaded, and is in the right order, add it to the DOM
|
104
|
+
//to execute the script.
|
105
|
+
for (i = 0; (resourceName = scriptWaiting[i]); i++) {
|
106
|
+
loadedNode = scriptNodes[resourceName];
|
107
|
+
if (loadedNode &&
|
108
|
+
loadedNode.getAttribute('data-orderloaded') === 'loaded') {
|
109
|
+
delete scriptNodes[resourceName];
|
110
|
+
require.addScriptToDom(loadedNode);
|
111
|
+
} else {
|
112
|
+
break;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
//If just loaded some items, remove them from waiting.
|
117
|
+
if (i > 0) {
|
118
|
+
scriptWaiting.splice(0, i);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
define({
|
123
|
+
version: '1.0.0',
|
124
|
+
|
125
|
+
load: function (name, req, onLoad, config) {
|
126
|
+
var url = req.nameToUrl(name, null),
|
127
|
+
node, context;
|
128
|
+
|
129
|
+
//Make sure the async attribute is not set for any pathway involving
|
130
|
+
//this script.
|
131
|
+
require.s.skipAsync[url] = true;
|
132
|
+
if (supportsInOrderExecution || config.isBuild) {
|
133
|
+
//Just a normal script tag append, but without async attribute
|
134
|
+
//on the script.
|
135
|
+
req([name], onLoad);
|
136
|
+
} else if (supportsLoadSeparateFromExecute) {
|
137
|
+
//Just fetch the URL, but do not execute it yet. The
|
138
|
+
//non-standards IE case. Really not so nice because it is
|
139
|
+
//assuming and touching requrejs internals. OK though since
|
140
|
+
//ordered execution should go away after a long while.
|
141
|
+
context = require.s.contexts._;
|
142
|
+
|
143
|
+
if (!context.urlFetched[url] && !context.loaded[name]) {
|
144
|
+
//Indicate the script is being fetched.
|
145
|
+
context.urlFetched[url] = true;
|
146
|
+
|
147
|
+
//Stuff from require.load
|
148
|
+
require.resourcesReady(false);
|
149
|
+
context.scriptCount += 1;
|
150
|
+
|
151
|
+
//Fetch the script now, remember it.
|
152
|
+
node = require.attach(url, context, name, null, null, onFetchOnly);
|
153
|
+
scriptNodes[name] = node;
|
154
|
+
scriptWaiting.push(name);
|
155
|
+
}
|
156
|
+
|
157
|
+
//Do a normal require for it, once it loads, use it as return
|
158
|
+
//value.
|
159
|
+
req([name], onLoad);
|
160
|
+
} else {
|
161
|
+
//Credit to LABjs author Kyle Simpson for finding that scripts
|
162
|
+
//with type="script/cache" allow scripts to be downloaded into
|
163
|
+
//browser cache but not executed. Use that
|
164
|
+
//so that subsequent addition of a real type="text/javascript"
|
165
|
+
//tag will cause the scripts to be executed immediately in the
|
166
|
+
//correct order.
|
167
|
+
if (req.specified(name)) {
|
168
|
+
req([name], onLoad);
|
169
|
+
} else {
|
170
|
+
cacheWaiting.push({
|
171
|
+
name: name,
|
172
|
+
req: req,
|
173
|
+
onLoad: onLoad
|
174
|
+
});
|
175
|
+
require.attach(url, null, name, scriptCacheCallback, "script/cache");
|
176
|
+
}
|
177
|
+
}
|
178
|
+
}
|
179
|
+
});
|
180
|
+
}());
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/*
|
2
|
+
RequireJS 0.27.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
3
|
+
Available via the MIT or new BSD license.
|
4
|
+
see: http://github.com/jrburke/requirejs for details
|
5
|
+
*/
|
6
|
+
var requirejs,require,define;
|
7
|
+
(function(){function J(a){return M.call(a)==="[object Function]"}function E(a){return M.call(a)==="[object Array]"}function Z(a,c,i){for(var j in c)if(!(j in K)&&(!(j in a)||i))a[j]=c[j];return d}function N(a,c,d){a=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+a);if(d)a.originalError=d;return a}function $(a,c,d){var j,k,q;for(j=0;q=c[j];j++){q=typeof q==="string"?{name:q}:q;k=q.location;if(d&&(!k||k.indexOf("/")!==0&&k.indexOf(":")===-1))k=d+"/"+(k||q.name);a[q.name]={name:q.name,location:k||
|
8
|
+
q.name,main:(q.main||"main").replace(da,"").replace(aa,"")}}}function V(a,c){a.holdReady?a.holdReady(c):c?a.readyWait+=1:a.ready(!0)}function ea(a){function c(b,h){var e,s;if(b&&b.charAt(0)==="."&&h){p.pkgs[h]?h=[h]:(h=h.split("/"),h=h.slice(0,h.length-1));e=b=h.concat(b.split("/"));var a;for(s=0;a=e[s];s++)if(a===".")e.splice(s,1),s-=1;else if(a==="..")if(s===1&&(e[2]===".."||e[0]===".."))break;else s>0&&(e.splice(s-1,2),s-=2);s=p.pkgs[e=b[0]];b=b.join("/");s&&b===e+"/"+s.main&&(b=e)}return b}function i(b,
|
9
|
+
h){var e=b?b.indexOf("!"):-1,a=null,d=h?h.name:null,f=b,l,i;e!==-1&&(a=b.substring(0,e),b=b.substring(e+1,b.length));a&&(a=c(a,d));b&&(a?l=(e=n[a])&&e.normalize?e.normalize(b,function(b){return c(b,d)}):c(b,d):(l=c(b,d),i=E[l],i||(i=g.nameToUrl(l,null,h),E[l]=i)));return{prefix:a,name:l,parentMap:h,url:i,originalName:f,fullName:a?a+"!"+(l||""):l}}function j(){var b=!0,h=p.priorityWait,e,a;if(h){for(a=0;e=h[a];a++)if(!t[e]){b=!1;break}b&&delete p.priorityWait}return b}function k(b,h,e){return function(){var a=
|
10
|
+
ga.call(arguments,0),c;if(e&&J(c=a[a.length-1]))c.__requireJsBuild=!0;a.push(h);return b.apply(null,a)}}function q(b,h){var e=k(g.require,b,h);Z(e,{nameToUrl:k(g.nameToUrl,b),toUrl:k(g.toUrl,b),defined:k(g.requireDefined,b),specified:k(g.requireSpecified,b),isBrowser:d.isBrowser});return e}function o(b){var h,e,a;a=b.callback;var c=b.map,f=c.fullName,l=b.deps,fa=b.listeners;if(a&&J(a)){if(p.catchError.define)try{e=d.execCb(f,b.callback,l,n[f])}catch(j){h=j}else e=d.execCb(f,b.callback,l,n[f]);if(f)b.cjsModule&&
|
11
|
+
b.cjsModule.exports!==void 0?e=n[f]=b.cjsModule.exports:e===void 0&&b.usingExports?e=n[f]:(n[f]=e,F[f]&&(Q[f]=!0))}else f&&(e=n[f]=a,F[f]&&(Q[f]=!0));if(C[b.id])delete C[b.id],b.isDone=!0,g.waitCount-=1,g.waitCount===0&&(I=[]);delete R[f];if(d.onResourceLoad&&!b.placeholder)d.onResourceLoad(g,c,b.depArray);if(h)return e=(f?i(f).url:"")||h.fileName||h.sourceURL,a=h.moduleTree,h=N("defineerror",'Error evaluating module "'+f+'" at location "'+e+'":\n'+h+"\nfileName:"+e+"\nlineNumber: "+(h.lineNumber||
|
12
|
+
h.line),h),h.moduleName=f,h.moduleTree=a,d.onError(h);for(h=0;a=fa[h];h++)a(e)}function r(b,h){return function(a){b.depDone[h]||(b.depDone[h]=!0,b.deps[h]=a,b.depCount-=1,b.depCount||o(b))}}function v(b,h){var a=h.map,c=a.fullName,i=a.name,f=L[b]||(L[b]=n[b]),l;if(!h.loading)h.loading=!0,l=function(b){h.callback=function(){return b};o(h);t[h.id]=!0},l.fromText=function(b,a){var h=O;t[b]=!1;g.scriptCount+=1;g.fake[b]=!0;h&&(O=!1);d.exec(a);h&&(O=!0);g.completeLoad(b)},c in n?l(n[c]):f.load(i,q(a.parentMap,
|
13
|
+
!0),l,p)}function w(b){C[b.id]||(C[b.id]=b,I.push(b),g.waitCount+=1)}function B(b){this.listeners.push(b)}function u(b,h){var a=b.fullName,c=b.prefix,d=c?L[c]||(L[c]=n[c]):null,f,l;a&&(f=R[a]);if(!f&&(l=!0,f={id:(c&&!d?M++ +"__p@:":"")+(a||"__r@"+M++),map:b,depCount:0,depDone:[],depCallbacks:[],deps:[],listeners:[],add:B},y[f.id]=!0,a&&(!c||L[c])))R[a]=f;c&&!d?(a=u(i(c),!0),a.add(function(){var a=i(b.originalName,b.parentMap),a=u(a,!0);f.placeholder=!0;a.add(function(b){f.callback=function(){return b};
|
14
|
+
o(f)})})):l&&h&&(t[f.id]=!1,g.paused.push(f),w(f));return f}function x(b,a,e,c){var b=i(b,c),d=b.name,f=b.fullName,l=u(b),j=l.id,k=l.deps,m;if(f){if(f in n||t[j]===!0||f==="jquery"&&p.jQuery&&p.jQuery!==e().fn.jquery)return;y[j]=!0;t[j]=!0;f==="jquery"&&e&&S(e())}l.depArray=a;l.callback=e;for(e=0;e<a.length;e++)if(j=a[e])j=i(j,d?b:c),m=j.fullName,a[e]=m,m==="require"?k[e]=q(b):m==="exports"?(k[e]=n[f]={},l.usingExports=!0):m==="module"?l.cjsModule=k[e]={id:d,uri:d?g.nameToUrl(d,null,c):void 0,exports:n[f]}:
|
15
|
+
m in n&&!(m in C)&&(!(f in F)||f in F&&Q[m])?k[e]=n[m]:(f in F&&(F[m]=!0,delete n[m],T[j.url]=!1),l.depCount+=1,l.depCallbacks[e]=r(l,e),u(j,!0).add(l.depCallbacks[e]));l.depCount?w(l):o(l)}function m(b){x.apply(null,b)}function z(b,a){if(!b.isDone){var e=b.map.fullName,c=b.depArray,d,f,g,j;if(e){if(a[e])return n[e];a[e]=!0}if(c)for(d=0;d<c.length;d++)if(f=c[d])if((g=i(f).prefix)&&(j=C[g])&&z(j,a),(g=C[f])&&!g.isDone&&t[f])f=z(g,a),b.depCallbacks[d](f);return e?n[e]:void 0}}function A(){var b=p.waitSeconds*
|
16
|
+
1E3,a=b&&g.startTime+b<(new Date).getTime(),b="",e=!1,c=!1,i;if(!(g.pausedCount>0)){if(p.priorityWait)if(j())D();else return;for(i in t)if(!(i in K)&&(e=!0,!t[i]))if(a)b+=i+" ";else{c=!0;break}if(e||g.waitCount){if(a&&b)return i=N("timeout","Load timeout for modules: "+b),i.requireType="timeout",i.requireModules=b,d.onError(i);if(c||g.scriptCount){if((G||ba)&&!W)W=setTimeout(function(){W=0;A()},50)}else{if(g.waitCount){for(H=0;b=I[H];H++)z(b,{});g.paused.length&&D();X<5&&(X+=1,A())}X=0;d.checkReadyState()}}}}
|
17
|
+
var g,D,p={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},catchError:{}},P=[],y={require:!0,exports:!0,module:!0},E={},n={},t={},C={},I=[],T={},M=0,R={},L={},F={},Q={},Y=0;S=function(b){if(!g.jQuery&&(b=b||(typeof jQuery!=="undefined"?jQuery:null))&&!(p.jQuery&&b.fn.jquery!==p.jQuery)&&("holdReady"in b||"readyWait"in b))if(g.jQuery=b,m(["jquery",[],function(){return jQuery}]),g.scriptCount)V(b,!0),g.jQueryIncremented=!0};D=function(){var b,a,c,i,k,f;Y+=1;if(g.scriptCount<=0)g.scriptCount=0;for(;P.length;)if(b=
|
18
|
+
P.shift(),b[0]===null)return d.onError(N("mismatch","Mismatched anonymous define() module: "+b[b.length-1]));else m(b);if(!p.priorityWait||j())for(;g.paused.length;){k=g.paused;g.pausedCount+=k.length;g.paused=[];for(i=0;b=k[i];i++)a=b.map,c=a.url,f=a.fullName,a.prefix?v(a.prefix,b):!T[c]&&!t[f]&&(d.load(g,f,c),T[c]=!0);g.startTime=(new Date).getTime();g.pausedCount-=k.length}Y===1&&A();Y-=1};g={contextName:a,config:p,defQueue:P,waiting:C,waitCount:0,specified:y,loaded:t,urlMap:E,urlFetched:T,scriptCount:0,
|
19
|
+
defined:n,paused:[],pausedCount:0,plugins:L,needFullExec:F,fake:{},fullExec:Q,managerCallbacks:R,makeModuleMap:i,normalize:c,configure:function(b){var a,c,d;b.baseUrl&&b.baseUrl.charAt(b.baseUrl.length-1)!=="/"&&(b.baseUrl+="/");a=p.paths;d=p.pkgs;Z(p,b,!0);if(b.paths){for(c in b.paths)c in K||(a[c]=b.paths[c]);p.paths=a}if((a=b.packagePaths)||b.packages){if(a)for(c in a)c in K||$(d,a[c],c);b.packages&&$(d,b.packages);p.pkgs=d}if(b.priority)c=g.requireWait,g.requireWait=!1,g.takeGlobalQueue(),D(),
|
20
|
+
g.require(b.priority),D(),g.requireWait=c,p.priorityWait=b.priority;if(b.deps||b.callback)g.require(b.deps||[],b.callback)},requireDefined:function(b,a){return i(b,a).fullName in n},requireSpecified:function(b,a){return i(b,a).fullName in y},require:function(b,c,e){if(typeof b==="string"){if(J(c))return d.onError(N("requireargs","Invalid require call"));if(d.get)return d.get(g,b,c);c=i(b,c);b=c.fullName;return!(b in n)?d.onError(N("notloaded","Module name '"+c.fullName+"' has not been loaded yet for context: "+
|
21
|
+
a)):n[b]}(b&&b.length||c)&&x(null,b,c,e);if(!g.requireWait)for(;!g.scriptCount&&g.paused.length;)g.takeGlobalQueue(),D();return g.require},takeGlobalQueue:function(){U.length&&(ha.apply(g.defQueue,[g.defQueue.length-1,0].concat(U)),U=[])},completeLoad:function(b){var a;for(g.takeGlobalQueue();P.length;)if(a=P.shift(),a[0]===null){a[0]=b;break}else if(a[0]===b)break;else m(a),a=null;a?m(a):m([b,[],b==="jquery"&&typeof jQuery!=="undefined"?function(){return jQuery}:null]);S();d.isAsync&&(g.scriptCount-=
|
22
|
+
1);D();d.isAsync||(g.scriptCount-=1)},toUrl:function(b,a){var c=b.lastIndexOf("."),d=null;c!==-1&&(d=b.substring(c,b.length),b=b.substring(0,c));return g.nameToUrl(b,d,a)},nameToUrl:function(b,a,e){var i,j,f,l,k=g.config,b=c(b,e&&e.fullName);if(d.jsExtRegExp.test(b))a=b+(a?a:"");else{i=k.paths;j=k.pkgs;e=b.split("/");for(l=e.length;l>0;l--)if(f=e.slice(0,l).join("/"),i[f]){e.splice(0,l,i[f]);break}else if(f=j[f]){b=b===f.name?f.location+"/"+f.main:f.location;e.splice(0,l,b);break}a=e.join("/")+(a||
|
23
|
+
".js");a=(a.charAt(0)==="/"||a.match(/^\w+:/)?"":k.baseUrl)+a}return k.urlArgs?a+((a.indexOf("?")===-1?"?":"&")+k.urlArgs):a}};g.jQueryCheck=S;g.resume=D;return g}function ia(){var a,c,d;if(m&&m.readyState==="interactive")return m;a=document.getElementsByTagName("script");for(c=a.length-1;c>-1&&(d=a[c]);c--)if(d.readyState==="interactive")return m=d;return null}var ja=/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,ka=/require\(\s*["']([^'"\s]+)["']\s*\)/g,da=/^\.\//,aa=/\.js$/,M=Object.prototype.toString,r=Array.prototype,
|
24
|
+
ga=r.slice,ha=r.splice,G=!!(typeof window!=="undefined"&&navigator&&document),ba=!G&&typeof importScripts!=="undefined",la=G&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,ca=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",K={},u={},U=[],m=null,X=0,O=!1,d,r={},I,w,x,y,v,z,A,H,B,S,W;if(typeof define==="undefined"){if(typeof requirejs!=="undefined")if(J(requirejs))return;else r=requirejs,requirejs=void 0;typeof require!=="undefined"&&!J(require)&&(r=require,
|
25
|
+
require=void 0);d=requirejs=function(a,c,d){var j="_",k;!E(a)&&typeof a!=="string"&&(k=a,E(c)?(a=c,c=d):a=[]);if(k&&k.context)j=k.context;d=u[j]||(u[j]=ea(j));k&&d.configure(k);return d.require(a,c)};d.config=function(a){return d(a)};require||(require=d);d.toUrl=function(a){return u._.toUrl(a)};d.version="0.27.0";d.jsExtRegExp=/^\/|:|\?|\.js$/;w=d.s={contexts:u,skipAsync:{}};if(d.isAsync=d.isBrowser=G)if(x=w.head=document.getElementsByTagName("head")[0],y=document.getElementsByTagName("base")[0])x=
|
26
|
+
w.head=y.parentNode;d.onError=function(a){throw a;};d.load=function(a,c,i){d.resourcesReady(!1);a.scriptCount+=1;d.attach(i,a,c);if(a.jQuery&&!a.jQueryIncremented)V(a.jQuery,!0),a.jQueryIncremented=!0};define=function(a,c,d){var j,k;typeof a!=="string"&&(d=c,c=a,a=null);E(c)||(d=c,c=[]);!a&&!c.length&&J(d)&&d.length&&(d.toString().replace(ja,"").replace(ka,function(a,d){c.push(d)}),c=(d.length===1?["require"]:["require","exports","module"]).concat(c));if(O&&(j=I||ia()))a||(a=j.getAttribute("data-requiremodule")),
|
27
|
+
k=u[j.getAttribute("data-requirecontext")];(k?k.defQueue:U).push([a,c,d])};define.amd={multiversion:!0,plugins:!0,jQuery:!0};d.exec=function(a){return eval(a)};d.execCb=function(a,c,d,j){return c.apply(j,d)};d.addScriptToDom=function(a){I=a;y?x.insertBefore(a,y):x.appendChild(a);I=null};d.onScriptLoad=function(a){var c=a.currentTarget||a.srcElement,i;if(a.type==="load"||c&&la.test(c.readyState))m=null,a=c.getAttribute("data-requirecontext"),i=c.getAttribute("data-requiremodule"),u[a].completeLoad(i),
|
28
|
+
c.detachEvent&&!ca?c.detachEvent("onreadystatechange",d.onScriptLoad):c.removeEventListener("load",d.onScriptLoad,!1)};d.attach=function(a,c,i,j,k,m){var o;if(G)return j=j||d.onScriptLoad,o=c&&c.config&&c.config.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),o.type=k||"text/javascript",o.charset="utf-8",o.async=!w.skipAsync[a],c&&o.setAttribute("data-requirecontext",c.contextName),o.setAttribute("data-requiremodule",i),o.attachEvent&&
|
29
|
+
!ca?(O=!0,m?o.onreadystatechange=function(){if(o.readyState==="loaded")o.onreadystatechange=null,o.attachEvent("onreadystatechange",j),m(o)}:o.attachEvent("onreadystatechange",j)):o.addEventListener("load",j,!1),o.src=a,m||d.addScriptToDom(o),o;else ba&&(importScripts(a),c.completeLoad(i));return null};if(G){v=document.getElementsByTagName("script");for(H=v.length-1;H>-1&&(z=v[H]);H--){if(!x)x=z.parentNode;if(A=z.getAttribute("data-main")){if(!r.baseUrl)v=A.split("/"),z=v.pop(),v=v.length?v.join("/")+
|
30
|
+
"/":"./",r.baseUrl=v,A=z.replace(aa,"");r.deps=r.deps?r.deps.concat(A):[A];break}}}d.checkReadyState=function(){var a=w.contexts,c;for(c in a)if(!(c in K)&&a[c].waitCount)return;d.resourcesReady(!0)};d.resourcesReady=function(a){var c,i;d.resourcesDone=a;if(d.resourcesDone)for(i in a=w.contexts,a)if(!(i in K)&&(c=a[i],c.jQueryIncremented))V(c.jQuery,!1),c.jQueryIncremented=!1};d.pageLoaded=function(){if(document.readyState!=="complete")document.readyState="complete"};if(G&&document.addEventListener&&
|
31
|
+
!document.readyState)document.readyState="loading",window.addEventListener("load",d.pageLoaded,!1);d(r);if(d.isAsync&&typeof setTimeout!=="undefined")B=w.contexts[r.context||"_"],B.requireWait=!0,setTimeout(function(){B.requireWait=!1;B.takeGlobalQueue();B.jQueryCheck();B.scriptCount||B.resume();d.checkReadyState()},0)}})();
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// Underscore.js 1.1.7
|
2
|
+
// (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.
|
3
|
+
// Underscore is freely distributable under the MIT license.
|
4
|
+
// Portions of Underscore are inspired or borrowed from Prototype,
|
5
|
+
// Oliver Steele's Functional, and John Resig's Micro-Templating.
|
6
|
+
// For all details and documentation:
|
7
|
+
// http://documentcloud.github.com/underscore
|
8
|
+
(function(){var p=this,C=p._,m={},i=Array.prototype,n=Object.prototype,f=i.slice,D=i.unshift,E=n.toString,l=n.hasOwnProperty,s=i.forEach,t=i.map,u=i.reduce,v=i.reduceRight,w=i.filter,x=i.every,y=i.some,o=i.indexOf,z=i.lastIndexOf;n=Array.isArray;var F=Object.keys,q=Function.prototype.bind,b=function(a){return new j(a)};typeof module!=="undefined"&&module.exports?(module.exports=b,b._=b):p._=b;b.VERSION="1.1.7";var h=b.each=b.forEach=function(a,c,b){if(a!=null)if(s&&a.forEach===s)a.forEach(c,b);else if(a.length===
|
9
|
+
+a.length)for(var e=0,k=a.length;e<k;e++){if(e in a&&c.call(b,a[e],e,a)===m)break}else for(e in a)if(l.call(a,e)&&c.call(b,a[e],e,a)===m)break};b.map=function(a,c,b){var e=[];if(a==null)return e;if(t&&a.map===t)return a.map(c,b);h(a,function(a,g,G){e[e.length]=c.call(b,a,g,G)});return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var k=d!==void 0;a==null&&(a=[]);if(u&&a.reduce===u)return e&&(c=b.bind(c,e)),k?a.reduce(c,d):a.reduce(c);h(a,function(a,b,f){k?d=c.call(e,d,a,b,f):(d=a,k=!0)});if(!k)throw new TypeError("Reduce of empty array with no initial value");
|
10
|
+
return d};b.reduceRight=b.foldr=function(a,c,d,e){a==null&&(a=[]);if(v&&a.reduceRight===v)return e&&(c=b.bind(c,e)),d!==void 0?a.reduceRight(c,d):a.reduceRight(c);a=(b.isArray(a)?a.slice():b.toArray(a)).reverse();return b.reduce(a,c,d,e)};b.find=b.detect=function(a,c,b){var e;A(a,function(a,g,f){if(c.call(b,a,g,f))return e=a,!0});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(w&&a.filter===w)return a.filter(c,b);h(a,function(a,g,f){c.call(b,a,g,f)&&(e[e.length]=a)});return e};
|
11
|
+
b.reject=function(a,c,b){var e=[];if(a==null)return e;h(a,function(a,g,f){c.call(b,a,g,f)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=!0;if(a==null)return e;if(x&&a.every===x)return a.every(c,b);h(a,function(a,g,f){if(!(e=e&&c.call(b,a,g,f)))return m});return e};var A=b.some=b.any=function(a,c,d){c=c||b.identity;var e=!1;if(a==null)return e;if(y&&a.some===y)return a.some(c,d);h(a,function(a,b,f){if(e|=c.call(d,a,b,f))return m});return!!e};b.include=b.contains=function(a,c){var b=
|
12
|
+
!1;if(a==null)return b;if(o&&a.indexOf===o)return a.indexOf(c)!=-1;A(a,function(a){if(b=a===c)return!0});return b};b.invoke=function(a,c){var d=f.call(arguments,2);return b.map(a,function(a){return(c.call?c||a:a[c]).apply(a,d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);var e={computed:-Infinity};h(a,function(a,b,f){b=c?c.call(d,a,b,f):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,
|
13
|
+
c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};h(a,function(a,b,f){b=c?c.call(d,a,b,f):a;b<e.computed&&(e={value:a,computed:b})});return e.value};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,f){return{value:a,criteria:c.call(d,a,b,f)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,b){var d={};h(a,function(a,f){var g=b(a,f);(d[g]||(d[g]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||
|
14
|
+
(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(b.isArray(a))return f.call(a);if(b.isArguments(a))return f.call(a);return b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?f.call(a,0,b):a[0]};b.rest=b.tail=function(a,b,d){return f.call(a,b==null||d?1:b)};b.last=function(a){return a[a.length-1]};b.compact=function(a){return b.filter(a,
|
15
|
+
function(a){return!!a})};b.flatten=function(a){return b.reduce(a,function(a,d){if(b.isArray(d))return a.concat(b.flatten(d));a[a.length]=d;return a},[])};b.without=function(a){return b.difference(a,f.call(arguments,1))};b.uniq=b.unique=function(a,c){return b.reduce(a,function(a,e,f){if(0==f||(c===!0?b.last(a)!=e:!b.include(a,e)))a[a.length]=e;return a},[])};b.union=function(){return b.uniq(b.flatten(arguments))};b.intersection=b.intersect=function(a){var c=f.call(arguments,1);return b.filter(b.uniq(a),
|
16
|
+
function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a,c){return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=f.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(o&&a.indexOf===o)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,
|
17
|
+
b){if(a==null)return-1;if(z&&a.lastIndexOf===z)return a.lastIndexOf(b);for(var d=a.length;d--;)if(a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);d=arguments[2]||1;for(var e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g};b.bind=function(a,b){if(a.bind===q&&q)return q.apply(a,f.call(arguments,1));var d=f.call(arguments,2);return function(){return a.apply(b,d.concat(f.call(arguments)))}};b.bindAll=function(a){var c=f.call(arguments,1);
|
18
|
+
c.length==0&&(c=b.functions(a));h(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var b=c.apply(this,arguments);return l.call(d,b)?d[b]:d[b]=a.apply(this,arguments)}};b.delay=function(a,b){var d=f.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(f.call(arguments,1)))};var B=function(a,b,d){var e;return function(){var f=this,g=arguments,h=function(){e=null;
|
19
|
+
a.apply(f,g)};d&&clearTimeout(e);if(d||!e)e=setTimeout(h,b)}};b.throttle=function(a,b){return B(a,b,!1)};b.debounce=function(a,b){return B(a,b,!0)};b.once=function(a){var b=!1,d;return function(){if(b)return d;b=!0;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(f.call(arguments));return b.apply(this,d)}};b.compose=function(){var a=f.call(arguments);return function(){for(var b=f.call(arguments),d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=
|
20
|
+
function(a,b){return function(){if(--a<1)return b.apply(this,arguments)}};b.keys=F||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)l.call(a,d)&&(b[b.length]=d);return b};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){h(f.call(arguments,1),function(b){for(var d in b)b[d]!==void 0&&(a[d]=b[d])});return a};b.defaults=function(a){h(f.call(arguments,
|
21
|
+
1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,c){if(a===c)return!0;var d=typeof a;if(d!=typeof c)return!1;if(a==c)return!0;if(!a&&c||a&&!c)return!1;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual)return a.isEqual(c);if(c.isEqual)return c.isEqual(a);if(b.isDate(a)&&b.isDate(c))return a.getTime()===c.getTime();if(b.isNaN(a)&&b.isNaN(c))return!1;
|
22
|
+
if(b.isRegExp(a)&&b.isRegExp(c))return a.source===c.source&&a.global===c.global&&a.ignoreCase===c.ignoreCase&&a.multiline===c.multiline;if(d!=="object")return!1;if(a.length&&a.length!==c.length)return!1;d=b.keys(a);var e=b.keys(c);if(d.length!=e.length)return!1;for(var f in a)if(!(f in c)||!b.isEqual(a[f],c[f]))return!1;return!0};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(l.call(a,c))return!1;return!0};b.isElement=function(a){return!!(a&&a.nodeType==
|
23
|
+
1)};b.isArray=n||function(a){return E.call(a)==="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return!(!a||!l.call(a,"callee"))};b.isFunction=function(a){return!(!a||!a.constructor||!a.call||!a.apply)};b.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};b.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===!0||a===!1};b.isDate=function(a){return!(!a||!a.getTimezoneOffset||
|
24
|
+
!a.setUTCFullYear)};b.isRegExp=function(a){return!(!a||!a.test||!a.exec||!(a.ignoreCase||a.ignoreCase===!1))};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.noConflict=function(){p._=C;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.mixin=function(a){h(b.functions(a),function(c){H(c,b[c]=a[c])})};var I=0;b.uniqueId=function(a){var b=I++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g};
|
25
|
+
b.template=function(a,c){var d=b.templateSettings;d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(d.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";d=new Function("obj",d);return c?d(c):d};
|
26
|
+
var j=function(a){this._wrapped=a};b.prototype=j.prototype;var r=function(a,c){return c?b(a).chain():a},H=function(a,c){j.prototype[a]=function(){var a=f.call(arguments);D.call(a,this._wrapped);return r(c.apply(b,a),this._chain)}};b.mixin(b);h(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=i[a];j.prototype[a]=function(){b.apply(this._wrapped,arguments);return r(this._wrapped,this._chain)}});h(["concat","join","slice"],function(a){var b=i[a];j.prototype[a]=function(){return r(b.apply(this._wrapped,
|
27
|
+
arguments),this._chain)}});j.prototype.chain=function(){this._chain=!0;return this};j.prototype.value=function(){return this._wrapped}})();
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Jazz
|
2
|
+
|
3
|
+
module AppDetector
|
4
|
+
|
5
|
+
def new_app_path
|
6
|
+
@new_app_path ||= if rack_app?
|
7
|
+
$stdout.puts "public folder detected, installing to public/javascripts"
|
8
|
+
'public/javascripts'
|
9
|
+
else
|
10
|
+
name
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def app_path
|
15
|
+
@app_path ||= if rack_app?
|
16
|
+
$stdout.puts "public folder detected, installing to public/javascripts"
|
17
|
+
'public/javascripts'
|
18
|
+
else
|
19
|
+
'.'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def public_path
|
24
|
+
@public_path ||= if rack_app?
|
25
|
+
'public'
|
26
|
+
else
|
27
|
+
'.'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def prefix
|
32
|
+
'/public/' if rack_app?
|
33
|
+
end
|
34
|
+
|
35
|
+
def rack_app?
|
36
|
+
File.exists?('public')
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|