diff options
Diffstat (limited to 'module/web')
-rw-r--r-- | module/web/static/js/default.js | 7 | ||||
-rw-r--r-- | module/web/static/js/libs/Handlebars-1.0rc1.js | 173 | ||||
-rw-r--r-- | module/web/static/js/utils/initHB.js | 7 |
3 files changed, 105 insertions, 82 deletions
diff --git a/module/web/static/js/default.js b/module/web/static/js/default.js index 389ebe9aa..d7c9c4b4a 100644 --- a/module/web/static/js/default.js +++ b/module/web/static/js/default.js @@ -48,9 +48,10 @@ require.config({ } }); -define('default', ['jquery', 'backbone', 'routers/defaultRouter', 'views/headerView', 'views/packageTreeView', - 'utils/animations', 'bootstrap', 'helpers/formatSize'], - function($, Backbone, DefaultRouter, HeaderView, TreeView) { +define('default', ['jquery', 'backbone', 'utils/initHB', + 'routers/defaultRouter', 'views/headerView', 'views/packageTreeView', + 'utils/animations', 'bootstrap'], + function($, Backbone, Handlebars, DefaultRouter, HeaderView, TreeView) { var init = function() { var view = new HeaderView(); diff --git a/module/web/static/js/libs/Handlebars-1.0rc1.js b/module/web/static/js/libs/Handlebars-1.0rc1.js index 2f508987a..991242461 100644 --- a/module/web/static/js/libs/Handlebars-1.0rc1.js +++ b/module/web/static/js/libs/Handlebars-1.0rc1.js @@ -1,7 +1,7 @@ // lib/handlebars/base.js (function () { /*jshint eqnull:true*/ -var Handlebars = {}; +this.Handlebars = {}; (function(Handlebars) { @@ -108,9 +108,8 @@ Handlebars.registerHelper('log', function(context) { Handlebars.log(context); }); -}(Handlebars)); +}(this.Handlebars)); ; -//>>excludeStart('excludeHbsParser', pragmas.excludeHbsParser) // lib/handlebars/compiler/parser.js /* Jison generated parser */ var handlebars = (function(){ @@ -123,91 +122,91 @@ performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { var $0 = $$.length - 1; switch (yystate) { -case 1: return $$[$0-1]; +case 1: return $$[$0-1]; break; -case 2: this.$ = new yy.ProgramNode($$[$0-2], $$[$0]); +case 2: this.$ = new yy.ProgramNode($$[$0-2], $$[$0]); break; -case 3: this.$ = new yy.ProgramNode($$[$0]); +case 3: this.$ = new yy.ProgramNode($$[$0]); break; -case 4: this.$ = new yy.ProgramNode([]); +case 4: this.$ = new yy.ProgramNode([]); break; -case 5: this.$ = [$$[$0]]; +case 5: this.$ = [$$[$0]]; break; -case 6: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; +case 6: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; break; -case 7: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0]); +case 7: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0]); break; -case 8: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0]); +case 8: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0]); break; -case 9: this.$ = $$[$0]; +case 9: this.$ = $$[$0]; break; -case 10: this.$ = $$[$0]; +case 10: this.$ = $$[$0]; break; -case 11: this.$ = new yy.ContentNode($$[$0]); +case 11: this.$ = new yy.ContentNode($$[$0]); break; -case 12: this.$ = new yy.CommentNode($$[$0]); +case 12: this.$ = new yy.CommentNode($$[$0]); break; -case 13: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]); +case 13: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]); break; -case 14: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]); +case 14: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]); break; -case 15: this.$ = $$[$0-1]; +case 15: this.$ = $$[$0-1]; break; -case 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]); +case 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1]); break; -case 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true); +case 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true); break; -case 18: this.$ = new yy.PartialNode($$[$0-1]); +case 18: this.$ = new yy.PartialNode($$[$0-1]); break; -case 19: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1]); +case 19: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1]); break; -case 20: +case 20: break; -case 21: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]]; +case 21: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]]; break; -case 22: this.$ = [[$$[$0-1]].concat($$[$0]), null]; +case 22: this.$ = [[$$[$0-1]].concat($$[$0]), null]; break; -case 23: this.$ = [[$$[$0-1]], $$[$0]]; +case 23: this.$ = [[$$[$0-1]], $$[$0]]; break; -case 24: this.$ = [[$$[$0]], null]; +case 24: this.$ = [[$$[$0]], null]; break; -case 25: this.$ = [[new yy.DataNode($$[$0])], null]; +case 25: this.$ = [[new yy.DataNode($$[$0])], null]; break; -case 26: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; +case 26: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; break; -case 27: this.$ = [$$[$0]]; +case 27: this.$ = [$$[$0]]; break; -case 28: this.$ = $$[$0]; +case 28: this.$ = $$[$0]; break; -case 29: this.$ = new yy.StringNode($$[$0]); +case 29: this.$ = new yy.StringNode($$[$0]); break; -case 30: this.$ = new yy.IntegerNode($$[$0]); +case 30: this.$ = new yy.IntegerNode($$[$0]); break; -case 31: this.$ = new yy.BooleanNode($$[$0]); +case 31: this.$ = new yy.BooleanNode($$[$0]); break; -case 32: this.$ = new yy.DataNode($$[$0]); +case 32: this.$ = new yy.DataNode($$[$0]); break; -case 33: this.$ = new yy.HashNode($$[$0]); +case 33: this.$ = new yy.HashNode($$[$0]); break; -case 34: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; +case 34: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; break; -case 35: this.$ = [$$[$0]]; +case 35: this.$ = [$$[$0]]; break; -case 36: this.$ = [$$[$0-2], $$[$0]]; +case 36: this.$ = [$$[$0-2], $$[$0]]; break; -case 37: this.$ = [$$[$0-2], new yy.StringNode($$[$0])]; +case 37: this.$ = [$$[$0-2], new yy.StringNode($$[$0])]; break; -case 38: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])]; +case 38: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])]; break; -case 39: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])]; +case 39: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])]; break; -case 40: this.$ = [$$[$0-2], new yy.DataNode($$[$0])]; +case 40: this.$ = [$$[$0-2], new yy.DataNode($$[$0])]; break; -case 41: this.$ = new yy.IdNode($$[$0]); +case 41: this.$ = new yy.IdNode($$[$0]); break; -case 42: $$[$0-2].push($$[$0]); this.$ = $$[$0-2]; +case 42: $$[$0-2].push($$[$0]); this.$ = $$[$0-2]; break; -case 43: this.$ = [$$[$0]]; +case 43: this.$ = [$$[$0]]; break; } }, @@ -497,77 +496,96 @@ case 0: if(yy_.yytext.slice(-1) !== "\\") this.begin("mu"); if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1), this.begin("emu"); if(yy_.yytext) return 14; - + break; -case 1: return 14; +case 1: return 14; break; case 2: if(yy_.yytext.slice(-1) !== "\\") this.popState(); if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1); return 14; - + break; -case 3: return 24; +case 3: return 24; break; -case 4: return 16; +case 4: return 16; break; -case 5: return 20; +case 5: return 20; break; -case 6: return 19; +case 6: return 19; break; -case 7: return 19; +case 7: return 19; break; -case 8: return 23; +case 8: return 23; break; -case 9: return 23; +case 9: return 23; break; -case 10: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15; +case 10: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15; break; -case 11: return 22; +case 11: return 22; break; -case 12: return 35; +case 12: return 35; break; -case 13: return 34; +case 13: return 34; break; -case 14: return 34; +case 14: return 34; break; -case 15: return 37; +case 15: return 37; break; -case 16: /*ignore whitespace*/ +case 16: /*ignore whitespace*/ break; -case 17: this.popState(); return 18; +case 17: this.popState(); return 18; break; -case 18: this.popState(); return 18; +case 18: this.popState(); return 18; break; -case 19: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 29; +case 19: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 29; break; -case 20: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 29; +case 20: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 29; break; -case 21: yy_.yytext = yy_.yytext.substr(1); return 27; +case 21: yy_.yytext = yy_.yytext.substr(1); return 27; break; -case 22: return 31; +case 22: return 31; break; -case 23: return 31; +case 23: return 31; break; -case 24: return 30; +case 24: return 30; break; -case 25: return 34; +case 25: return 34; break; -case 26: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 34; +case 26: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 34; break; -case 27: return 'INVALID'; +case 27: return 'INVALID'; break; -case 28: return 5; +case 28: return 5; break; } }; -lexer.rules = [/^(?:[^\x00]*?(?=(<%)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(<%|$)))/, /^(?:<%>)/, /^(?:<%#)/, /^(?:<%\/)/, /^(?:<%\^)/, /^(?:<%\s*else\b)/, /^(?:<%=)/, /^(?:<%&)/, /^(?:<%![\s\S]*?\}\})/, /^(?:<%)/, /^(?:=)/, /^(?:\.(?=[%> ]))/, /^(?:\.\.)/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:=%>)/, /^(?:%>)/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@[a-zA-Z]+)/, /^(?:true(?=[%>\s]))/, /^(?:false(?=[%>\s]))/, /^(?:[0-9]+(?=[%>\s]))/, /^(?:[a-zA-Z0-9_$-]+(?=[%>=}\s\/.]))/, /^(?:\[[^\]]*\])/, /^(?:.)/, /^(?:$)/]; +lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[} ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; lexer.conditions = {"mu":{"rules":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"INITIAL":{"rules":[0,1,28],"inclusive":true}}; return lexer;})() parser.lexer = lexer; function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; return new Parser; })(); +if (typeof require !== 'undefined' && typeof exports !== 'undefined') { +exports.parser = handlebars; +exports.Parser = handlebars.Parser; +exports.parse = function () { return handlebars.parse.apply(handlebars, arguments); } +exports.main = function commonjsMain(args) { + if (!args[1]) + throw new Error('Usage: '+args[0]+' FILE'); + var source, cwd; + if (typeof process !== 'undefined') { + source = require('fs').readFileSync(require('path').resolve(args[1]), "utf8"); + } else { + source = require("file").path(require("file").cwd()).join(args[1]).read({charset: "utf-8"}); + } + return exports.parser.parse(source); +} +if (typeof module !== 'undefined' && require.main === module) { + exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); +} +}; ; // lib/handlebars/compiler/base.js Handlebars.Parser = handlebars; @@ -709,7 +727,6 @@ Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); }; }; })();; -//>>excludeEnd('excludeHbsParser') // lib/handlebars/utils.js Handlebars.Exception = function(message) { var tmp = Error.prototype.constructor.apply(this, arguments); @@ -1809,7 +1826,6 @@ Handlebars.JavaScriptCompiler = function() {}; })(Handlebars.Compiler, Handlebars.JavaScriptCompiler); -//>>excludeStart('excludeHbsParser', pragmas.excludeHbsParser) Handlebars.precompile = function(string, options) { options = options || {}; @@ -1837,7 +1853,6 @@ Handlebars.compile = function(string, options) { return compiled.call(this, context, options); }; }; -//>>excludeEnd('excludeHbsParser') ; // lib/handlebars/runtime.js Handlebars.VM = { diff --git a/module/web/static/js/utils/initHB.js b/module/web/static/js/utils/initHB.js new file mode 100644 index 000000000..d3264e4bc --- /dev/null +++ b/module/web/static/js/utils/initHB.js @@ -0,0 +1,7 @@ +// Loads all helper and set own handlebars rules +define(['handlebars', 'helpers/formatSize'], + function(Handlebars) { + // TODO: create better lexer rules, these are just hacked + Handlebars.Parser.lexer.rules = [/^(?:[^\x00]*?(?=(<%)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(<%|$)))/, /^(?:<%>)/, /^(?:<%#)/, /^(?:<%\/)/, /^(?:<%\^)/, /^(?:<%\s*else\b)/, /^(?:<%=)/, /^(?:<%&)/, /^(?:<%![\s\S]*?\}\})/, /^(?:<%)/, /^(?:=)/, /^(?:\.(?=[%> ]))/, /^(?:\.\.)/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:=%>)/, /^(?:%>)/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@[a-zA-Z]+)/, /^(?:true(?=[%>\s]))/, /^(?:false(?=[%>\s]))/, /^(?:[0-9]+(?=[%>\s]))/, /^(?:[a-zA-Z0-9_$-]+(?=[%>=}\s\/.]))/, /^(?:\[[^\]]*\])/, /^(?:.)/, /^(?:$)/]; + return Handlebars + });
\ No newline at end of file |