luca 0.9.4 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +41 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/README.md +5 -0
- data/Rakefile +4 -0
- data/assets/javascripts/dependencies/underscore-min.js +5 -31
- data/assets/javascripts/luca-templates.js +1 -0
- data/assets/javascripts/luca-ui-base.coffee +1 -1
- data/assets/javascripts/luca-ui-development-tools.coffee +1 -1
- data/assets/javascripts/luca-ui-full.js +1 -1
- data/assets/javascripts/luca-ui-spec.coffee +1 -1
- data/assets/javascripts/luca-ui.js +3 -0
- data/assets/javascripts/luca/index.coffee +1 -0
- data/lib/generators/luca/application/application_generator.rb +71 -0
- data/lib/generators/luca/application/templates/controller.rb +6 -0
- data/lib/generators/luca/application/templates/index.html.erb +7 -0
- data/lib/generators/luca/application/templates/index.html.haml +6 -0
- data/lib/generators/luca/application/templates/javascripts/application.js +28 -0
- data/lib/generators/luca/application/templates/javascripts/application.js.coffee +20 -0
- data/lib/generators/luca/application/templates/javascripts/config.js +15 -0
- data/lib/generators/luca/application/templates/javascripts/config.js.coffee +9 -0
- data/lib/generators/luca/application/templates/javascripts/dependencies.js +5 -0
- data/lib/generators/luca/application/templates/javascripts/dependencies.js.coffee +5 -0
- data/lib/generators/luca/application/templates/javascripts/index.js +9 -0
- data/lib/generators/luca/application/templates/javascripts/index.js.coffee +9 -0
- data/lib/generators/luca/application/templates/javascripts/main.js +8 -0
- data/lib/generators/luca/application/templates/javascripts/main.js.coffee +3 -0
- data/lib/generators/luca/application/templates/javascripts/main.jst.ejs +1 -0
- data/lib/generators/luca/application/templates/javascripts/router.js +12 -0
- data/lib/generators/luca/application/templates/javascripts/router.js.coffee +7 -0
- data/lib/luca/rails/version.rb +1 -1
- data/lib/luca/template.rb +1 -1
- data/spec/components/collection_view_spec.coffee +37 -0
- data/spec/components/multi_collection_view_spec.coffee +5 -0
- data/spec/components/table_view_spec.coffee +17 -0
- data/spec/core/container_spec.coffee +112 -5
- data/spec/core/model_spec.coffee +21 -3
- data/spec/define_spec.coffee +19 -0
- data/spec/mixin_spec.coffee +49 -0
- data/src/components/application.coffee +33 -19
- data/src/components/collection_view.coffee +109 -38
- data/src/components/fields/checkbox_field.coffee +2 -2
- data/src/components/fields/file_upload_field.coffee +0 -3
- data/src/components/fields/hidden_field.coffee +0 -3
- data/src/components/fields/label_field.coffee +1 -4
- data/src/components/fields/select_field.coffee +6 -6
- data/src/components/fields/text_area_field.coffee +1 -0
- data/src/components/fields/text_field.coffee +4 -0
- data/src/components/fields/type_ahead_field.coffee +5 -9
- data/src/components/form_view.coffee +2 -0
- data/src/components/index.coffee +1 -0
- data/src/components/multi_collection_view.coffee +94 -0
- data/src/components/pagination_control.coffee +100 -0
- data/src/components/table_view.coffee +62 -0
- data/src/containers/card_view.coffee +44 -11
- data/src/containers/panel_toolbar.coffee +88 -82
- data/src/containers/tab_view.coffee +3 -3
- data/src/containers/viewport.coffee +10 -4
- data/src/core/collection.coffee +11 -4
- data/src/core/container.coffee +189 -113
- data/src/core/field.coffee +13 -10
- data/src/core/model.coffee +23 -27
- data/src/core/registry.coffee +48 -35
- data/src/core/view.coffee +60 -140
- data/src/define.coffee +91 -19
- data/src/framework.coffee +10 -8
- data/src/index.coffee +23 -0
- data/src/managers/collection_manager.coffee +24 -8
- data/src/modules/application_event_bindings.coffee +19 -0
- data/src/modules/collection_event_bindings.coffee +26 -0
- data/src/modules/deferrable.coffee +3 -1
- data/src/modules/dom_helpers.coffee +49 -0
- data/src/modules/enhanced_properties.coffee +23 -0
- data/src/modules/filterable.coffee +60 -0
- data/src/modules/grid_layout.coffee +15 -0
- data/src/modules/{load_mask.coffee → loadmaskable.coffee} +10 -4
- data/src/modules/modal_view.coffee +38 -0
- data/src/modules/paginatable.coffee +79 -0
- data/src/modules/state_model.coffee +16 -0
- data/src/modules/templating.coffee +8 -0
- data/src/plugins/events.coffee +30 -2
- data/src/templates/components/bootstrap_form_controls.jst.ejs +10 -0
- data/src/templates/components/collection_loader_view.jst.ejs +6 -0
- data/src/templates/components/form_alert.jst.ejs +4 -0
- data/src/templates/components/grid_view.jst.ejs +11 -0
- data/src/templates/components/grid_view_empty_text.jst.ejs +3 -0
- data/src/templates/components/load_mask.jst.ejs +5 -0
- data/src/templates/components/nav_bar.jst.ejs +4 -0
- data/src/templates/components/pagination.jst.ejs +10 -0
- data/src/templates/containers/basic.jst.ejs +1 -0
- data/src/templates/containers/tab_selector_container.jst.ejs +12 -0
- data/src/templates/containers/tab_view.jst.ejs +2 -0
- data/src/templates/containers/toolbar_wrapper.jst.ejs +1 -0
- data/src/templates/fields/button_field.jst.ejs +2 -0
- data/src/templates/fields/button_field_link.jst.ejs +6 -0
- data/src/templates/fields/checkbox_array.jst.ejs +4 -0
- data/src/templates/fields/checkbox_array_item.jst.ejs +3 -0
- data/src/templates/fields/checkbox_field.jst.ejs +10 -0
- data/src/templates/fields/file_upload_field.jst.ejs +10 -0
- data/src/templates/fields/hidden_field.jst.ejs +1 -0
- data/src/templates/fields/select_field.jst.ejs +11 -0
- data/src/templates/fields/text_area_field.jst.ejs +11 -0
- data/src/templates/fields/text_field.jst.ejs +16 -0
- data/src/templates/table_view.jst.ejs +4 -0
- data/src/tools/console.coffee +51 -21
- data/src/util.coffee +17 -4
- data/vendor/assets/javascripts/luca-ui-base.js +3288 -613
- data/vendor/assets/javascripts/luca-ui-development-tools.js +49 -21
- data/vendor/assets/javascripts/luca-ui-development-tools.min.js +1 -1
- data/vendor/assets/javascripts/luca-ui-full.js +1704 -554
- data/vendor/assets/javascripts/luca-ui-full.min.js +7 -6
- data/vendor/assets/javascripts/luca-ui-spec.js +1783 -830
- data/vendor/assets/javascripts/luca-ui-templates.js +92 -0
- data/vendor/assets/javascripts/luca-ui.js +1694 -523
- data/vendor/assets/javascripts/luca-ui.min.js +4 -4
- metadata +69 -31
- data/assets/javascripts/luca-ui.coffee +0 -3
- data/src/luca.coffee +0 -22
- data/src/templates/components/bootstrap_form_controls.luca +0 -7
- data/src/templates/components/collection_loader_view.luca +0 -5
- data/src/templates/components/form_alert +0 -0
- data/src/templates/components/form_alert.luca +0 -3
- data/src/templates/components/grid_view.luca +0 -7
- data/src/templates/components/grid_view_empty_text.luca +0 -3
- data/src/templates/components/load_mask.luca +0 -3
- data/src/templates/components/nav_bar.luca +0 -2
- data/src/templates/containers/basic.luca +0 -1
- data/src/templates/containers/tab_selector_container.luca +0 -8
- data/src/templates/containers/tab_view.luca +0 -2
- data/src/templates/containers/toolbar_wrapper.luca +0 -1
- data/src/templates/fields/button_field.luca +0 -2
- data/src/templates/fields/button_field_link.luca +0 -5
- data/src/templates/fields/checkbox_array.luca +0 -4
- data/src/templates/fields/checkbox_array_item.luca +0 -4
- data/src/templates/fields/checkbox_field.luca +0 -9
- data/src/templates/fields/file_upload_field.luca +0 -8
- data/src/templates/fields/hidden_field.luca +0 -1
- data/src/templates/fields/select_field.luca +0 -8
- data/src/templates/fields/text_area_field.luca +0 -8
- data/src/templates/fields/text_field.luca +0 -17
- data/src/templates/sample/contents.luca +0 -1
- data/src/templates/sample/welcome.luca +0 -1
- data/vendor/assets/javascripts/luca-spec-dependencies.js +0 -6135
- data/vendor/assets/javascripts/luca-ui-development-dependencies.js +0 -12845
@@ -18295,20 +18295,18 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18295
18295
|
|
18296
18296
|
}).call(this);
|
18297
18297
|
(function() {
|
18298
|
-
var
|
18298
|
+
var developmentConsole, _base;
|
18299
18299
|
|
18300
|
-
|
18301
|
-
|
18302
|
-
|
18303
|
-
theme: "monokai",
|
18304
|
-
mode: "javascript"
|
18305
|
-
};
|
18300
|
+
developmentConsole = Luca.register("Luca.tools.DevelopmentConsole");
|
18301
|
+
|
18302
|
+
developmentConsole["extends"]("Luca.core.Container");
|
18306
18303
|
|
18307
|
-
|
18304
|
+
developmentConsole.defines({
|
18308
18305
|
className: "luca-ui-console",
|
18309
18306
|
name: "console",
|
18310
18307
|
history: [],
|
18311
18308
|
historyIndex: 0,
|
18309
|
+
width: 1000,
|
18312
18310
|
componentEvents: {
|
18313
18311
|
"code_input key:keyup": "historyUp",
|
18314
18312
|
"code_input key:keydown": "historyDown",
|
@@ -18319,7 +18317,8 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18319
18317
|
},
|
18320
18318
|
components: [
|
18321
18319
|
{
|
18322
|
-
|
18320
|
+
type: "code_mirror_field",
|
18321
|
+
getter: "getCodeMirror",
|
18323
18322
|
additionalClassNames: "clearfix",
|
18324
18323
|
name: "code_output",
|
18325
18324
|
readOnly: true,
|
@@ -18328,8 +18327,9 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18328
18327
|
lineWrapping: true,
|
18329
18328
|
gutter: false
|
18330
18329
|
}, {
|
18331
|
-
|
18330
|
+
type: "text_field",
|
18332
18331
|
name: "code_input",
|
18332
|
+
getter: "getInput",
|
18333
18333
|
lineNumbers: false,
|
18334
18334
|
height: '30px',
|
18335
18335
|
maxHeight: '30px',
|
@@ -18358,10 +18358,14 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18358
18358
|
}
|
18359
18359
|
],
|
18360
18360
|
afterRender: function() {
|
18361
|
+
var marginLeft;
|
18361
18362
|
this.$container().modal({
|
18362
18363
|
backdrop: false
|
18363
18364
|
});
|
18364
|
-
|
18365
|
+
if (this.width != null) {
|
18366
|
+
marginLeft = parseInt(this.width) * 0.5 * -1;
|
18367
|
+
return this.$container().css("width", this.width).css('margin-left', parseInt(marginLeft));
|
18368
|
+
}
|
18365
18369
|
},
|
18366
18370
|
show: function(options) {
|
18367
18371
|
if (options == null) options = {};
|
@@ -18385,8 +18389,8 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18385
18389
|
var currentValue;
|
18386
18390
|
this.historyIndex -= 1;
|
18387
18391
|
if (this.historyIndex < 0) this.historyIndex = 0;
|
18388
|
-
currentValue =
|
18389
|
-
return
|
18392
|
+
currentValue = this.getInput().getValue();
|
18393
|
+
return this.getInput().setValue(this.history[this.historyIndex] || currentValue);
|
18390
18394
|
},
|
18391
18395
|
historyDown: function() {
|
18392
18396
|
var currentValue;
|
@@ -18394,13 +18398,13 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18394
18398
|
if (this.historyIndex > this.history.length - 1) {
|
18395
18399
|
this.historyIndex = this.history.length - 1;
|
18396
18400
|
}
|
18397
|
-
currentValue =
|
18398
|
-
return
|
18401
|
+
currentValue = this.getInput().getValue();
|
18402
|
+
return this.getInput().setValue(this.history[this.historyIndex] || currentValue);
|
18399
18403
|
},
|
18400
18404
|
append: function(code, result, skipFormatting) {
|
18401
18405
|
var current, output, payload, source;
|
18402
18406
|
if (skipFormatting == null) skipFormatting = false;
|
18403
|
-
output =
|
18407
|
+
output = this.getCodeMirror();
|
18404
18408
|
current = output.getValue();
|
18405
18409
|
if (code != null) source = "// " + code;
|
18406
18410
|
payload = skipFormatting || code.match(/^console\.log/) ? [current, result] : [current, source, result];
|
@@ -18410,7 +18414,10 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18410
18414
|
onSuccess: function(result, js, coffee) {
|
18411
18415
|
var dump;
|
18412
18416
|
this.saveHistory(coffee);
|
18413
|
-
dump =
|
18417
|
+
dump = "";
|
18418
|
+
if (_.isArray(result) || _.isObject(result) || _.isString(result) || _.isNumber(result)) {
|
18419
|
+
dump = JSON.stringify(result, null, "\t");
|
18420
|
+
}
|
18414
18421
|
dump || (dump = typeof result.toString === "function" ? result.toString() : void 0);
|
18415
18422
|
return this.append(js, dump || "undefined");
|
18416
18423
|
},
|
@@ -18421,7 +18428,7 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18421
18428
|
var dev, evaluator, output, result;
|
18422
18429
|
if (!((code != null ? code.length : void 0) > 0)) return;
|
18423
18430
|
raw = _.string.strip(raw);
|
18424
|
-
output =
|
18431
|
+
output = this.getCodeMirror();
|
18425
18432
|
dev = this;
|
18426
18433
|
evaluator = function() {
|
18427
18434
|
var console, log, old_console, result;
|
@@ -18449,6 +18456,11 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18449
18456
|
};
|
18450
18457
|
try {
|
18451
18458
|
result = evaluator.call(this.getContext());
|
18459
|
+
if (Luca.isComponent(result)) {
|
18460
|
+
result = Luca.util.inspectComponent(result);
|
18461
|
+
} else if (Luca.isComponentPrototype(result)) {
|
18462
|
+
result = Luca.util.inspectComponentPrototype(result);
|
18463
|
+
}
|
18452
18464
|
if (!raw.match(/^console\.log/)) return this.onSuccess(result, code, raw);
|
18453
18465
|
} catch (error) {
|
18454
18466
|
return this.onError(error, code, raw);
|
@@ -18458,7 +18470,7 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18458
18470
|
var compile, compiled, dev, raw;
|
18459
18471
|
dev = this;
|
18460
18472
|
compile = _.bind(Luca.tools.CoffeeEditor.prototype.compile, this);
|
18461
|
-
raw =
|
18473
|
+
raw = this.getInput().getValue();
|
18462
18474
|
return compiled = compile(raw, function(compiled) {
|
18463
18475
|
return dev.evaluateCode(compiled, raw);
|
18464
18476
|
});
|
@@ -18467,6 +18479,21 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18467
18479
|
|
18468
18480
|
(_base = Luca.util).launchers || (_base.launchers = {});
|
18469
18481
|
|
18482
|
+
Luca.util.inspectComponentPrototype = function(componentPrototype) {
|
18483
|
+
var liveInstances;
|
18484
|
+
return liveInstances = Luca.registry.findInstancesByClass(componentPrototype);
|
18485
|
+
};
|
18486
|
+
|
18487
|
+
Luca.util.inspectComponent = function(component) {
|
18488
|
+
if (_.isString(component)) component = Luca(component);
|
18489
|
+
return {
|
18490
|
+
name: component.name,
|
18491
|
+
instanceOf: component.displayName,
|
18492
|
+
subclassOf: component._superClass().prototype.displayName,
|
18493
|
+
inheritsFrom: Luca.parentClasses(component)
|
18494
|
+
};
|
18495
|
+
};
|
18496
|
+
|
18470
18497
|
Luca.util.launchers.developmentConsole = function(name) {
|
18471
18498
|
var _this = this;
|
18472
18499
|
if (name == null) name = "luca-development-console";
|
@@ -18474,13 +18501,14 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/css"))
|
|
18474
18501
|
var console;
|
18475
18502
|
_this.$el.append(Backbone.View.prototype.make("div", {
|
18476
18503
|
id: "" + name + "-wrapper",
|
18477
|
-
"class": "modal fade"
|
18504
|
+
"class": "modal fade large"
|
18478
18505
|
}));
|
18479
18506
|
console = new Luca.tools.DevelopmentConsole({
|
18480
18507
|
name: name,
|
18481
18508
|
container: "#" + name + "-wrapper"
|
18482
18509
|
});
|
18483
|
-
|
18510
|
+
console.render();
|
18511
|
+
return console.getCodeMirror().setHeight(602);
|
18484
18512
|
});
|
18485
18513
|
return this._lucaDevConsole.show();
|
18486
18514
|
};
|
@@ -12,4 +12,4 @@
|
|
12
12
|
(a):void 0},b.prototype.makeReturn=function(a){var b,c,d,e,g;e=this.cases;for(c=0,d=e.length;c<d;c++)b=e[c],b[1].makeReturn(a);return a&&(this.otherwise||(this.otherwise=new f([new A("void 0")]))),(g=this.otherwise)!=null&&g.makeReturn(a),this},b.prototype.compileNode=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;i=a.indent+R,j=a.indent=i+R,d=this.tab+("switch ("+(((o=this.subject)!=null?o.compile(a,y):void 0)||!1)+") {\n"),p=this.cases;for(h=k=0,m=p.length;k<m;h=++k){q=p[h],f=q[0],b=q[1],r=bb([f]);for(l=0,n=r.length;l<n;l++)e=r[l],this.subject||(e=e.invert()),d+=i+("case "+e.compile(a,y)+":\n");if(c=b.compile(a,z))d+=c+"\n";if(h===this.cases.length-1&&!this.otherwise)break;g=this.lastNonComment(b.expressions);if(g instanceof K||g instanceof A&&g.jumps()&&g.value!=="debugger")continue;d+=j+"break;\n"}return this.otherwise&&this.otherwise.expressions.length&&(d+=i+("default:\n"+this.otherwise.compile(a,z)+"\n")),d+this.tab+"}"},b}(e),a.If=r=function(a){function b(a,b,c){this.body=b,c==null&&(c={}),this.condition=c.type==="unless"?a.invert():a,this.elseBody=null,this.isChain=!1,this.soak=c.soak}return lb(b,a),b.name="If",b.prototype.children=["condition","body","elseBody"],b.prototype.bodyNode=function(){var a;return(a=this.body)!=null?a.unwrap():void 0},b.prototype.elseBodyNode=function(){var a;return(a=this.elseBody)!=null?a.unwrap():void 0},b.prototype.addElse=function(a){return this.isChain?this.elseBodyNode().addElse(a):(this.isChain=a instanceof b,this.elseBody=this.ensureBlock(a)),this},b.prototype.isStatement=function(a){var b;return(a!=null?a.level:void 0)===z||this.bodyNode().isStatement(a)||((b=this.elseBodyNode())!=null?b.isStatement(a):void 0)},b.prototype.jumps=function(a){var b;return this.body.jumps(a)||((b=this.elseBody)!=null?b.jumps(a):void 0)},b.prototype.compileNode=function(a){return this.isStatement(a)?this.compileStatement(a):this.compileExpression(a)},b.prototype.makeReturn=function(a){return a&&(this.elseBody||(this.elseBody=new f([new A("void 0")]))),this.body&&(this.body=new f([this.body.makeReturn(a)])),this.elseBody&&(this.elseBody=new f([this.elseBody.makeReturn(a)])),this},b.prototype.ensureBlock=function(a){return a instanceof f?a:new f([a])},b.prototype.compileStatement=function(a){var c,d,e,f,g,h,i;return e=$(a,"chainChild"),g=$(a,"isExistentialEquals"),g?(new b(this.condition.invert(),this.elseBodyNode(),{type:"if"})).compile(a):(f=this.condition.compile(a,y),a.indent+=R,c=this.ensureBlock(this.body),d=c.compile(a),1===((i=c.expressions)!=null?i.length:void 0)&&!this.elseBody&&!e&&d&&f&&-1===d.indexOf("\n")&&80>f.length+d.length?""+this.tab+"if ("+f+") "+d.replace(/^\s+/,""):(d&&(d="\n"+d+"\n"+this.tab),h="if ("+f+") {"+d+"}",e||(h=this.tab+h),this.elseBody?h+" else "+(this.isChain?(a.indent=this.tab,a.chainChild=!0,this.elseBody.unwrap().compile(a,z)):"{\n"+this.elseBody.compile(a,z)+"\n"+this.tab+"}"):h))},b.prototype.compileExpression=function(a){var b,c,d,e;return e=this.condition.compile(a,v),c=this.bodyNode().compile(a,w),b=this.elseBodyNode()?this.elseBodyNode().compile(a,w):"void 0",d=""+e+" ? "+c+" : "+b,a.level>=v?"("+d+")":d},b.prototype.unfoldSoak=function(){return this.soak&&this},b}(e),i={wrap:function(a,c,d){var e,h,i,k,l;if(a.jumps())return a;i=new j([],f.wrap([a])),e=[];if((k=a.contains(this.literalArgs))||a.contains(this.literalThis))l=new A(k?"apply":"call"),e=[new A("this")],k&&e.push(new A("arguments")),i=new W(i,[new b(l)]);return i.noReturn=d,h=new g(i,e),c?f.wrap([h]):h},literalArgs:function(a){return a instanceof A&&a.value==="arguments"&&!a.asKey},literalThis:function(a){return a instanceof A&&a.value==="this"&&!a.asKey||a instanceof j&&a.bound}},gb=function(a,b,c){var d;if(!!(d=b[c].unfoldSoak(a)))return b[c]=d.body,d.body=new W(b),d},V={"extends":function(){return"function(child, parent) { for (var key in parent) { if ("+hb("hasProp")+".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }"},bind:function(){return"function(fn, me){ return function(){ return fn.apply(me, arguments); }; }"},indexOf:function(){return"[].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }"},hasProp:function(){return"{}.hasOwnProperty"},slice:function(){return"[].slice"}},z=1,y=2,w=3,v=4,x=5,u=6,R=" ",p="[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*",o=RegExp("^"+p+"$"),L=/^[+-]?\d+$/,B=RegExp("^(?:("+p+")\\.prototype(?:\\.("+p+")|\\[(\"(?:[^\\\\\"\\r\\n]|\\\\.)*\"|'(?:[^\\\\'\\r\\n]|\\\\.)*')\\]|\\[(0x[\\da-fA-F]+|\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\]))|("+p+")$"),q=/^['"]/,hb=function(a){var b;return b="__"+a,N.root.assign(b,V[a]()),b},eb=function(a,b){return a=a.replace(/\n/g,"$&"+b),a.replace(/\s+$/,"")}}).call(this)},require["./coffee-script"]=new function(){var a=this;(function(){var b,c,d,e,f,g,h,i,j,k={}.hasOwnProperty;e=require("fs"),h=require("path"),j=require("./lexer"),b=j.Lexer,c=j.RESERVED,g=require("./parser").parser,i=require("vm"),require.extensions?require.extensions[".coffee"]=function(a,b){var c;return c=d(e.readFileSync(b,"utf8"),{filename:b}),a._compile(c,b)}:require.registerExtension&&require.registerExtension(".coffee",function(a){return d(a)}),a.VERSION="1.2.1-pre",a.RESERVED=c,a.helpers=require("./helpers"),a.compile=d=function(b,c){var d,e,h;c==null&&(c={}),h=a.helpers.merge;try{e=g.parse(f.tokenize(b)).compile(c);if(!c.header)return e}catch(i){throw c.filename&&(i.message="In "+c.filename+", "+i.message),i}return d="Generated by CoffeeScript "+this.VERSION,"// "+d+"\n"+e},a.tokens=function(a,b){return f.tokenize(a,b)},a.nodes=function(a,b){return typeof a=="string"?g.parse(f.tokenize(a,b)):g.parse(a)},a.run=function(a,b){var c;return b==null&&(b={}),c=require.main,c.filename=process.argv[1]=b.filename?e.realpathSync(b.filename):".",c.moduleCache&&(c.moduleCache={}),c.paths=require("module")._nodeModulePaths(h.dirname(b.filename)),h.extname(c.filename)!==".coffee"||require.extensions?c._compile(d(a,b),c.filename):c._compile(a,c.filename)},a.eval=function(a,b){var c,e,f,g,j,l,m,n,o,p,q,r,s,t;b==null&&(b={});if(!!(a=a.trim())){e=i.Script;if(e){if(b.sandbox!=null){if(b.sandbox instanceof e.createContext().constructor)m=b.sandbox;else{m=e.createContext(),r=b.sandbox;for(g in r){if(!k.call(r,g))continue;n=r[g],m[g]=n}}m.global=m.root=m.GLOBAL=m}else m=global;m.__filename=b.filename||"eval",m.__dirname=h.dirname(m.__filename);if(m===global&&!m.module&&!m.require){c=require("module"),m.module=q=new c(b.modulename||"eval"),m.require=t=function(a){return c._load(a,q,!0)},q.filename=m.__filename,s=Object.getOwnPropertyNames(require);for(o=0,p=s.length;o<p;o++)l=s[o],l!=="paths"&&(t[l]=require[l]);t.paths=q.paths=c._nodeModulePaths(process.cwd()),t.resolve=function(a){return c._resolveFilename(a,q)}}}j={};for(g in b){if(!k.call(b,g))continue;n=b[g],j[g]=n}return j.bare=!0,f=d(a,j),m===global?i.runInThisContext(f):i.runInContext(f,m)}},f=new b,g.lexer={lex:function(){var a,b;return b=this.tokens[this.pos++]||[""],a=b[0],this.yytext=b[1],this.yylineno=b[2],a},setInput:function(a){return this.tokens=a,this.pos=0},upcomingInput:function(){return""}},g.yy=require("./nodes")}).call(this)},require["./browser"]=new function(){var exports=this;(function(){var CoffeeScript,runScripts;CoffeeScript=require("./coffee-script"),CoffeeScript.require=require,CoffeeScript.eval=function(code,options){return options==null&&(options={}),options.bare==null&&(options.bare=!0),eval(CoffeeScript.compile(code,options))},CoffeeScript.run=function(a,b){return b==null&&(b={}),b.bare=!0,Function(CoffeeScript.compile(a,b))()},typeof window!="undefined"&&window!==null&&(CoffeeScript.load=function(a,b){var c;return c=new(window.ActiveXObject||XMLHttpRequest)("Microsoft.XMLHTTP"),c.open("GET",a,!0),"overrideMimeType"in c&&c.overrideMimeType("text/plain"),c.onreadystatechange=function(){var d;if(c.readyState===4){if((d=c.status)!==0&&d!==200)throw new Error("Could not load "+a);CoffeeScript.run(c.responseText);if(b)return b()}},c.send(null)},runScripts=function(){var a,b,c,d,e,f;return f=document.getElementsByTagName("script"),a=function(){var a,b,c;c=[];for(a=0,b=f.length;a<b;a++)e=f[a],e.type==="text/coffeescript"&&c.push(e);return c}(),c=0,d=a.length,(b=function(){var d;d=a[c++];if((d!=null?d.type:void 0)==="text/coffeescript")return d.src?CoffeeScript.load(d.src,b):(CoffeeScript.run(d.innerHTML),b())})(),null},window.addEventListener?addEventListener("DOMContentLoaded",runScripts,!1):attachEvent("onload",runScripts))}).call(this)},require["./coffee-script"]}();typeof define=="function"&&define.amd?define(function(){return CoffeeScript}):root.CoffeeScript=CoffeeScript})(this);var CodeMirror=function(){function a(d,e){function Zb(a){return a>=0&&a<ub.size}function _b(a){return v(ub,a)}function ac(a,b){Lb=!0;var c=b-a.height;for(var d=a;d;d=d.parent)d.height+=c}function bc(a){var b={line:0,ch:0};rc(b,{line:ub.size-1,ch:_b(ub.size-1).text.length},hb(a),b,b),Fb=!0}function cc(){var a=[];return ub.iter(0,ub.size,function(b){a.push(b.text)}),a.join("\n")}function dc(a){function l(a){var b=Md(a,!0);if(b&&!_(b,g)){wb||pc(),g=b,Tc(d,b),Fb=!1;var c=Mc();if(b.line>=c.to||b.line<c.from)h=setTimeout(Zd(function(){l(a)}),150)}}function m(a){clearTimeout(h);var b=Md(a);b&&Tc(d,b),C(a),Ic(),Fb=!0,n(),j()}Sc(H(a,"shiftKey"));for(var b=F(a);b!=A;b=b.parentNode)if(b.parentNode==W&&b!=X)return;for(var b=F(a);b!=A;b=b.parentNode)if(b.parentNode==db)return f.onGutterClick&&f.onGutterClick($b,fb(db.childNodes,b)+Pb,a),C(a);var d=Md(a);switch(G(a)){case 3:L&&!c&&Nd(a);return;case 2:d&&Wc(d.line,d.ch,!0),setTimeout(Ic,20);return}if(!d){F(a)==U&&C(a);return}wb||pc();var e=+(new Date);if(Ab&&Ab.time>e-400&&_(Ab.pos,d))return C(a),setTimeout(Ic,20),dd(d.line);if(zb&&zb.time>e-400&&_(zb.pos,d))return Ab={time:e,pos:d},C(a),cd(d);zb={time:e,pos:d};var g=d,h;if(f.dragDrop&&T&&!f.readOnly&&!_(xb.from,xb.to)&&!ab(d,xb.from)&&!ab(xb.to,d)){P&&(kb.draggable=!0);function i(b){P&&(kb.draggable=!1),Cb=!1,j(),k(),Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10&&(C(b),Wc(d.line,d.ch,!0),Ic())}var j=I(document,"mouseup",Zd(i),!0),k=I(U,"drop",Zd(i),!0);Cb=!0,kb.dragDrop&&kb.dragDrop();return}C(a),Wc(d.line,d.ch,!0);var n=I(document,"mousemove",Zd(function(a){clearTimeout(h),C(a),!M&&!G(a)?m(a):l(a)}),!0),j=I(document,"mouseup",Zd(m),!0)}function ec(a){for(var b=F(a);b!=A;b=b.parentNode)if(b.parentNode==db)return C(a);var c=Md(a);if(!c)return;Ab={time:+(new Date),pos:c},C(a),cd(c)}function fc(a){if(f.onDragEvent&&f.onDragEvent($b,B(a)))return;a.preventDefault();var b=Md(a,!0),c=a.dataTransfer.files;if(!b||f.readOnly)return;if(c&&c.length&&window.FileReader&&window.File){function d(a,c){var d=new FileReader;d.onload=function(){g[c]=d.result,++h==e&&(b=Yc(b),Zd(function(){var a=xc(g.join(""),b,b);Tc(b,a)})())},d.readAsText(a)}var e=c.length,g=Array(e),h=0;for(var i=0;i<e;++i)d(c[i],i)}else try{var g=a.dataTransfer.getData("Text");g&&$d(function(){var a=xb.from,c=xb.to;Tc(b,b),Cb&&xc("",a,c),yc(g),Ic()})}catch(a){}}function gc(a){var b=Bc();a.dataTransfer.setData("Text",b);if(L||Q){var c=document.createElement("img");c.scr="data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs=",a.dataTransfer.setDragImage(c,0,0)}}function hc(a,b){if(typeof a=="string"){a=h[a];if(!a)return!1}var c=yb;try{f.readOnly&&(Eb=!0),b&&(yb=null),a($b)}catch(d){if(d!=K)throw d;return!1}finally{yb=c,Eb=!1}return!0}function ic(a){function h(){g=!0}var b=j(f.keyMap),c=b.auto;clearTimeout(lc),c&&!l(a)&&(lc=setTimeout(function(){j(f.keyMap)==b&&(f.keyMap=c.call?c.call(null,$b):c)},50));var d=jb[H(a,"keyCode")],e=!1;if(d==null||a.altGraphKey)return!1;H(a,"altKey")&&(d="Alt-"+d),H(a,"ctrlKey")&&(d="Ctrl-"+d),H(a,"metaKey")&&(d="Cmd-"+d);var g=!1;return H(a,"shiftKey")?e=k("Shift-"+d,f.extraKeys,f.keyMap,function(a){return hc(a,!0)},h)||k(d,f.extraKeys,f.keyMap,function(a){if(typeof a=="string"&&/^go[A-Z]/.test(a))return hc(a)},h):e=k(d,f.extraKeys,f.keyMap,hc,h),g&&(e=!1),e&&(C(a),Od(),M&&(a.oldKeyCode=a.keyCode,a.keyCode=0)),e}function jc(a,b){var c=k("'"+b+"'",f.extraKeys,f.keyMap,function(a){return hc(a,!0)});return c&&(C(a),Od()),c}function mc(a){wb||pc(),M&&a.keyCode==27&&(a.returnValue=!1),Cc&&Gc()&&(Cc=!1);if(f.onKeyEvent&&f.onKeyEvent($b,B(a)))return;var b=H(a,"keyCode");Sc(b==16||H(a,"shiftKey"));var d=ic(a);window.opera&&(kc=d?b:null,!d&&b==88&&H(a,c?"metaKey":"ctrlKey")&&yc(""))}function nc(a){Cc&&Gc();if(f.onKeyEvent&&f.onKeyEvent($b,B(a)))return;var b=H(a,"keyCode"),c=H(a,"charCode");if(window.opera&&b==kc){kc=null,C(a);return}if((window.opera&&(!a.which||a.which<10)||S)&&ic(a))return;var d=String.fromCharCode(c==null?b:c);f.electricChars&&tb.electricChars&&f.smartIndent&&!f.readOnly&&tb.electricChars.indexOf(d)>-1&&setTimeout(Zd(function(){fd(xb.to.line,"smart")}),75);if(jc(a,d))return;Ec()}function oc(a){if(f.onKeyEvent&&f.onKeyEvent($b,B(a)))return;H(a,"keyCode")==16&&(yb=null)}function pc(){if(f.readOnly=="nocursor")return;wb||(f.onFocus&&f.onFocus($b),wb=!0,A.className.search(/\bCodeMirror-focused\b/)==-1&&(A.className+=" CodeMirror-focused"),Kb||Hc(!0)),Dc(),Od()}function qc(){wb&&(f.onBlur&&f.onBlur($b),wb=!1,Sb&&Zd(function(){Sb&&(Sb(),Sb=null)})(),A.className=A.className.replace(" CodeMirror-focused","")),clearInterval(sb),setTimeout(function(){wb||(yb=null)},150)}function rc(a,b,c,d,e){if(Eb)return;if(Wb){var g=[];ub.iter(a.line,b.line+1,function(a){g.push(a.text)}),Wb.addChange(a.line,c.length,g);while(Wb.done.length>f.undoDepth)Wb.done.shift()}vc(a,b,c,d,e)}function sc(a,b){if(!a.length)return;var c=a.pop(),d=[];for(var e=c.length-1;e>=0;e-=1){var f=c[e],g=[],h=f.start+f.added;ub.iter(f.start,h,function(a){g.push(a.text)}),d.push({start:f.start,added:f.old.length,old:g});var i=Yc({line:f.start+f.old.length-1,ch:eb(g[g.length-1],f.old[f.old.length-1])});vc({line:f.start,ch:0},{line:h-1,ch:_b(h-1).text.length},f.old,i,i)}Fb=!0,b.push(d)}function tc(){sc(Wb.done,Wb.undone)}function uc(){sc(Wb.undone,Wb.done)}function vc(a,b,c,d,e){function y(a){return a<=Math.min(b.line,b.line+s)?a:a+s}if(Eb)return;var g=!1,h=Tb.length;f.lineWrapping||ub.iter(a.line,b.line+1,function(a){if(!a.hidden&&a.text.length==h)return g=!0,!0});if(a.line!=b.line||c.length>1)Lb=!0;var i=b.line-a.line,j=_b(a.line),k=_b(b.line);if(a.ch==0&&b.ch==0&&c[c.length-1]==""){var l=[],m=null;a.line?(m=_b(a.line-1),m.fixMarkEnds(k)):k.fixMarkStarts();for(var n=0,o=c.length-1;n<o;++n)l.push(r.inheritMarks(c[n],m));i&&ub.remove(a.line,i,Mb),l.length&&ub.insert(a.line,l)}else if(j==k)if(c.length==1)j.replace(a.ch,b.ch,c[0]);else{k=j.split(b.ch,c[c.length-1]),j.replace(a.ch,null,c[0]),j.fixMarkEnds(k);var l=[];for(var n=1,o=c.length-1;n<o;++n)l.push(r.inheritMarks(c[n],j));l.push(k),ub.insert(a.line+1,l)}else if(c.length==1)j.replace(a.ch,null,c[0]),k.replace(null,b.ch,""),j.append(k),ub.remove(a.line+1,i,Mb);else{var l=[];j.replace(a.ch,null,c[0]),k.replace(null,b.ch,c[c.length-1]),j.fixMarkEnds(k);for(var n=1,o=c.length-1;n<o;++n)l.push(r.inheritMarks(c[n],j));i>1&&ub.remove(a.line+1,i-1,Mb),ub.insert(a.line+1,l)}if(f.lineWrapping){var p=Math.max(5,U.clientWidth/Jd()-3);ub.iter(a.line,a.line+c.length,function(a){if(a.hidden)return;var b=Math.ceil(a.text.length/p)||1;b!=a.height&&ac(a,b)})}else ub.iter(a.line,a.line+c.length,function(a){var b=a.text;!a.hidden&&b.length>h&&(Tb=b,h=b.length,Ub=null,g=!1)}),g&&(Nb=!0);var q=[],s=c.length-i-1;for(var n=0,t=vb.length;n<t;++n){var u=vb[n];u<a.line?q.push(u):u>b.line&&q.push(u+s)}var v=a.line+Math.min(c.length,500);Td(a.line,v),q.push(v),vb=q,Vd(100),Hb.push({from:a.line,to:b.line+1,diff:s});var w={from:a,to:b,text:c};if(Ib){for(var x=Ib;x.next;x=x.next);x.next=w}else Ib=w;Uc(d,e,y(xb.from.line),y(xb.to.line)),U.clientHeight&&(W.style.height=ub.height*Gd()+2*Kd()+"px")}function wc(){var a=0;Tb="",Ub=null,ub.iter(0,ub.size,function(b){var c=b.text;!b.hidden&&c.length>a&&(a=c.length,Tb=c)}),Nb=!1}function xc(a,b,c){function d(d){if(ab(d,b))return d;if(!ab(c,d))return e;var f=d.line+a.length-(c.line-b.line)-1,g=d.ch;return d.line==c.line&&(g+=a[a.length-1].length-(c.ch-(c.line==b.line?b.ch:0))),{line:f,ch:g}}b=Yc(b),c?c=Yc(c):c=b,a=hb(a);var e;return zc(a,b,c,function(a){return e=a,{from:d(xb.from),to:d(xb.to)}}),e}function yc(a,b){zc(hb(a),xb.from,xb.to,function(a){return b=="end"?{from:a,to:a}:b=="start"?{from:xb.from,to:xb.from}:{from:xb.from,to:a}})}function zc(a,b,c,d){var e=a.length==1?a[0].length+b.ch:a[a.length-1].length,f=d({line:b.line+a.length-1,ch:e});rc(b,c,a,f.from,f.to)}function Ac(a,b){var c=a.line,d=b.line;if(c==d)return _b(c).text.slice(a.ch,b.ch);var e=[_b(c).text.slice(a.ch)];return ub.iter(c+1,d,function(a){e.push(a.text)}),e.push(_b(d).text.slice(0,b.ch)),e.join("\n")}function Bc(){return Ac(xb.from,xb.to)}function Dc(){if(Cc)return;qb.set(f.pollInterval,function(){Wd(),Gc(),wb&&Dc(),Xd()})}function Ec(){function b(){Wd();var c=Gc();!c&&!a?(a=!0,qb.set(60,b)):(Cc=!1,Dc()),Xd()}var a=!1;Cc=!0,qb.set(20,b)}function Gc(){if(Kb||!wb||ib(R)||f.readOnly)return!1;var a=R.value;if(a==Fc)return!1;yb=null;var b=0,c=Math.min(Fc.length,a.length);while(b<c&&Fc[b]==a[b])++b;return b<Fc.length?xb.from={line:xb.from.line,ch:xb.from.ch-(Fc.length-b)}:Db&&_(xb.from,xb.to)&&(xb.to={line:xb.to.line,ch:Math.min(_b(xb.to.line).text.length,xb.to.ch+(a.length-b))}),yc(a.slice(b),"end"),a.length>1e3?R.value=Fc="":Fc=a,!0}function Hc(a){_(xb.from,xb.to)?a&&(Fc=R.value=""):(Fc="",R.value=Bc(),$(R))}function Ic(){f.readOnly!="nocursor"&&R.focus()}function Jc(){if(!mb.getBoundingClientRect)return;var a=mb.getBoundingClientRect();if(M&&a.top==a.bottom)return;var b=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(a.top<0||a.bottom>b)&&mb.scrollIntoView()}function Kc(){var a=Ad(xb.inverted?xb.from:xb.to),b=f.lineWrapping?Math.min(a.x,kb.offsetWidth):a.x;return Lc(b,a.y,b,a.yBot)}function Lc(a,b,c,d){var e=Ld(),g=Kd();b+=g,d+=g,a+=e,c+=e;var h=U.clientHeight,i=U.scrollTop,j=!1,k=!0;b<i?(U.scrollTop=Math.max(0,b),j=!0):d>i+h&&(U.scrollTop=d-h,j=!0);var l=U.clientWidth,m=U.scrollLeft,n=f.fixedGutter?cb.clientWidth:0,o=a<n+e+10;return a<m+n||o?(o&&(a=0),U.scrollLeft=Math.max(0,a-10-n),j=!0):c>l+m-3&&(U.scrollLeft=c+10-l,j=!0,c>W.clientWidth&&(k=!1)),j&&f.onScroll&&f.onScroll($b),k}function Mc(){var a=Gd(),b=U.scrollTop-Kd(),c=Math.max(0,Math.floor(b/a)),d=Math.ceil((b+U.clientHeight)/a);return{from:x(ub,c),to:x(ub,d)}}function Nc(a,b){function n(){Ub=U.clientWidth;var a=ob.firstChild,b=!1;return ub.iter(Pb,Qb,function(c){if(!c.hidden){var d=Math.round(a.offsetHeight/k)||1;c.height!=d&&(ac(c,d),Lb=b=!0)}a=a.nextSibling}),b&&(W.style.height=ub.height*k+2*Kd()+"px"),b}if(!U.clientWidth){Pb=Qb=Ob=0;return}var c=Mc();if(a!==!0&&a.length==0&&c.from>Pb&&c.to<Qb)return;var d=Math.max(c.from-100,0),e=Math.min(ub.size,c.to+100);Pb<d&&d-Pb<20&&(d=Pb),Qb>e&&Qb-e<20&&(e=Math.min(ub.size,Qb));var g=a===!0?[]:Oc([{from:Pb,to:Qb,domStart:0}],a),h=0;for(var i=0;i<g.length;++i){var j=g[i];j.from<d&&(j.domStart+=d-j.from,j.from=d),j.to>e&&(j.to=e),j.from>=j.to?g.splice(i--,1):h+=j.to-j.from}if(h==e-d&&d==Pb&&e==Qb)return;g.sort(function(a,b){return a.domStart-b.domStart});var k=Gd(),l=cb.style.display;ob.style.display="none",Pc(d,e,g),ob.style.display=cb.style.display="";var m=d!=Pb||e!=Qb||Rb!=U.clientHeight+k;m&&(Rb=U.clientHeight+k),Pb=d,Qb=e,Ob=y(ub,d),X.style.top=Ob*k+"px",U.clientHeight&&(W.style.height=ub.height*k+2*Kd()+"px");if(ob.childNodes.length!=Qb-Pb)throw new Error("BAD PATCH! "+JSON.stringify(g)+" size="+(Qb-Pb)+" nodes="+ob.childNodes.length);return f.lineWrapping?n():(Ub==null&&(Ub=wd(Tb)),Ub>U.clientWidth?(kb.style.width=Ub+"px",W.style.width="",W.style.width=U.scrollWidth+"px"):kb.style.width=W.style.width=""),cb.style.display=l,(m||Lb)&&Qc()&&f.lineWrapping&&n()&&Qc(),Rc(),!b&&f.onUpdate&&f.onUpdate($b),!0}function Oc(a,b){for(var c=0,d=b.length||0;c<d;++c){var e=b[c],f=[],g=e.diff||0;for(var h=0,i=a.length;h<i;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g,domStart:j.domStart}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from,domStart:j.domStart}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g,domStart:j.domStart+(e.to-j.from)}))}a=f}return a}function Pc(a,b,c){if(!c.length)ob.innerHTML="";else{function d(a){var b=a.nextSibling;return a.parentNode.removeChild(a),b}var e=0,f=ob.firstChild,g;for(var h=0;h<c.length;++h){var i=c[h];while(i.domStart>e)f=d(f),e++;for(var j=0,k=i.to-i.from;j<k;++j)f=f.nextSibling,e++}while(f)f=d(f)}var l=c.shift(),f=ob.firstChild,j=a,m=document.createElement("div");ub.iter(a,b,function(a){l&&l.to==j&&(l=c.shift());if(!l||l.from>j){if(a.hidden)var b=m.innerHTML="<pre></pre>";else{var b="<pre"+(a.className?' class="'+a.className+'"':"")+">"+a.getHTML(jd)+"</pre>";a.bgClassName&&(b='<div style="position: relative"><pre class="'+a.bgClassName+'" style="position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2"> </pre>'+b+"</div>")}m.innerHTML=b,ob.insertBefore(m.firstChild,f)}else f=f.nextSibling;++j})}function Qc(){if(!f.gutter&&!f.lineNumbers)return;var a=X.offsetHeight,b=U.clientHeight;cb.style.height=(a-b<2?b:a)+"px";var c=[],d=Pb,e;ub.iter(Pb,Math.max(Qb,Pb+1),function(a){if(a.hidden)c.push("<pre></pre>");else{var b=a.gutterMarker,g=f.lineNumbers?d+f.firstLineNumber:null;b&&b.text?g=b.text.replace("%N%",g!=null?g:""):g==null&&(g=" "),c.push(b&&b.style?'<pre class="'+b.style+'">':"<pre>",g);for(var h=1;h<a.height;++h)c.push("<br/> ");c.push("</pre>"),b||(e=d)}++d}),cb.style.display="none",db.innerHTML=c.join("");if(e!=null){var g=db.childNodes[e-Pb],h=String(ub.size).length,i=Z(g),j="";while(i.length+j.length<h)j+=" ";j&&g.insertBefore(document.createTextNode(j),g.firstChild)}cb.style.display="";var k=Math.abs((parseInt(kb.style.marginLeft)||0)-cb.offsetWidth)>2;return kb.style.marginLeft=cb.offsetWidth+"px",Lb=!1,k}function Rc(){var a=_(xb.from,xb.to),b=Ad(xb.from,!0),c=a?b:Ad(xb.to,!0),d=xb.inverted?b:c,e=Gd(),g=Y(A),h=Y(ob);D.style.top=Math.max(0,Math.min(U.offsetHeight,d.y+h.top-g.top))+"px",D.style.left=Math.max(0,Math.min(U.offsetWidth,d.x+h.left-g.left))+"px";if(a)mb.style.top=d.y+"px",mb.style.left=(f.lineWrapping?Math.min(d.x,kb.offsetWidth):d.x)+"px",mb.style.display="",nb.style.display="none";else{var i=b.y==c.y,j="",k=kb.clientWidth||kb.offsetWidth,l=kb.clientHeight||kb.offsetHeight;function m(a,b,c,d){var e=O?"width: "+(c?k-c-a:k)+"px":"right: "+c+"px";j+='<div class="CodeMirror-selected" style="position: absolute; left: '+a+"px; top: "+b+"px; "+e+"; height: "+d+'px"></div>'}if(xb.from.ch&&b.y>=0){var n=i?k-c.x:0;m(b.x,b.y,n,e)}var o=Math.max(0,b.y+(xb.from.ch?e:0)),p=Math.min(c.y,l)-o;p>.2*e&&m(0,o,0,p),(!i||!xb.from.ch)&&c.y<l-.5*e&&m(0,c.y,k-c.x,e),nb.innerHTML=j,mb.style.display="none",nb.style.display=""}}function Sc(a){a?yb=yb||(xb.inverted?xb.to:xb.from):yb=null}function Tc(a,b){var c=yb&&Yc(yb);c&&(ab(c,a)?a=c:ab(b,c)&&(b=c)),Uc(a,b),Gb=!0}function Uc(a,b,c,d){ad=null,c==null&&(c=xb.from.line,d=xb.to.line);if(_(xb.from,a)&&_(xb.to,b))return;if(ab(b,a)){var e=b;b=a,a=e}if(a.line!=c){var g=Vc(a,c,xb.from.ch);g?a=g:ud(a.line,!1)}b.line!=d&&(b=Vc(b,d,xb.to.ch)),_(a,b)?xb.inverted=!1:_(a,xb.to)?xb.inverted=!1:_(b,xb.from)&&(xb.inverted=!0);if(f.autoClearEmptyLines&&_(xb.from,xb.to)){var h=xb.inverted?a:b;if(h.line!=xb.from.line&&xb.from.line<ub.size){var i=_b(xb.from.line);/^\s+$/.test(i.text)&&setTimeout(Zd(function(){if(i.parent&&/^\s+$/.test(i.text)){var a=w(i);xc("",{line:a,ch:0},{line:a,ch:i.text.length})}},10))}}xb.from=a,xb.to=b,Jb=!0}function Vc(a,b,c){function d(b){var d=a.line+b,e=b==1?ub.size:-1;while(d!=e){var g=_b(d);if(!g.hidden){var h=a.ch;if(f||h>c||h>g.text.length)h=g.text.length;return{line:d,ch:h}}d+=b}}var e=_b(a.line),f=a.ch==e.text.length&&a.ch!=c;return e.hidden?a.line>=b?d(1)||d(-1):d(-1)||d(1):a}function Wc(a,b,c){var d=Yc({line:a,ch:b||0});(c?Tc:Uc)(d,d)}function Xc(a){return Math.max(0,Math.min(a,ub.size-1))}function Yc(a){if(a.line<0)return{line:0,ch:0};if(a.line>=ub.size)return{line:ub.size-1,ch:_b(ub.size-1).text.length};var b=a.ch,c=_b(a.line).text.length;return b==null||b>c?{line:a.line,ch:c}:b<0?{line:a.line,ch:0}:a}function Zc(a,b){function g(){for(var b=d+a,c=a<0?-1:ub.size;b!=c;b+=a){var e=_b(b);if(!e.hidden)return d=b,f=e,!0}}function h(b){if(e==(a<0?0:f.text.length)){if(!!b||!g())return!1;e=a<0?f.text.length:0}else e+=a;return!0}var c=xb.inverted?xb.from:xb.to,d=c.line,e=c.ch,f=_b(d);if(b=="char")h();else if(b=="column")h(!0);else if(b=="word"){var i=!1;for(;;){if(a<0&&!h())break;if(gb(f.text.charAt(e)))i=!0;else if(i){a<0&&(a=1,h());break}if(a>0&&!h())break}}return{line:d,ch:e}}function $c(a,b){var c=a<0?xb.from:xb.to;if(yb||_(xb.from,xb.to))c=Zc(a,b);Wc(c.line,c.ch,!0)}function _c(a,b){_(xb.from,xb.to)?a<0?xc("",Zc(a,b),xb.to):xc("",xb.from,Zc(a,b)):xc("",xb.from,xb.to),Gb=!0}function bd(a,b){var c=0,d=Ad(xb.inverted?xb.from:xb.to,!0);ad!=null&&(d.x=ad),b=="page"?c=Math.min(U.clientHeight,window.innerHeight||document.documentElement.clientHeight):b=="line"&&(c=Gd());var e=Bd(d.x,d.y+c*a+2);b=="page"&&(U.scrollTop+=Ad(e,!0).y-d.y),Wc(e.line,e.ch,!0),ad=d.x}function cd(a){var b=_b(a.line).text,c=a.ch,d=a.ch;while(c>0&&gb(b.charAt(c-1)))--c;while(d<b.length&&gb(b.charAt(d)))++d;Tc({line:a.line,ch:c},{line:a.line,ch:d})}function dd(a){Tc({line:a,ch:0},Yc({line:a+1,ch:0}))}function ed(a){if(_(xb.from,xb.to))return fd(xb.from.line,a);var b=xb.to.line-(xb.to.ch?0:1);for(var c=xb.from.line;c<=b;++c)fd(c,a)}function fd(a,b){b||(b="add");if(b=="smart")if(!tb.indent)b="prev";else var c=Sd(a);var d=_b(a),e=d.indentation(f.tabSize),g=d.text.match(/^\s*/)[0],h;b=="prev"?a?h=_b(a-1).indentation(f.tabSize):h=0:b=="smart"?h=tb.indent(c,d.text.slice(g.length),d.text):b=="add"?h=e+f.indentUnit:b=="subtract"&&(h=e-f.indentUnit),h=Math.max(0,h);var i=h-e;if(!i){if(xb.from.line!=a&&xb.to.line!=a)return;var j=g}else{var j="",k=0;if(f.indentWithTabs)for(var l=Math.floor(h/f.tabSize);l;--l)k+=f.tabSize,j+=" ";while(k<h)++k,j+=" "}xc(j,{line:a,ch:0},{line:a,ch:g.length})}function gd(){tb=a.getMode(f,f.mode),ub.iter(0,ub.size,function(a){a.stateAfter=null}),vb=[0],Vd()}function hd(){var a=f.gutter||f.lineNumbers;cb.style.display=a?"":"none",a?Lb=!0:ob.parentNode.style.marginLeft=0}function id(a,b){if(f.lineWrapping){A.className+=" CodeMirror-wrap";var c=U.clientWidth/Jd()-3;ub.iter(0,ub.size,function(a){if(a.hidden)return;var b=Math.ceil(a.text.length/c)||1;b!=1&&ac(a,b)}),kb.style.width=W.style.width=""}else A.className=A.className.replace(" CodeMirror-wrap",""),Ub=null,Tb="",ub.iter(0,ub.size,function(a){a.height!=1&&!a.hidden&&ac(a,1),a.text.length>Tb.length&&(Tb=a.text)});Hb.push({from:0,to:ub.size})}function jd(a){var b=f.tabSize-a%f.tabSize,c=Vb[b];if(c)return c;for(var d='<span class="cm-tab">',e=0;e<b;++e)d+=" ";return Vb[b]={html:d+"</span>",width:b}}function kd(){U.className=U.className.replace(/\s*cm-s-\S+/g,"")+f.theme.replace(/(^|\s)\s*/g," cm-s-")}function ld(){var a=i[f.keyMap].style;A.className=A.className.replace(/\s*cm-keymap-\S+/g,"")+(a?" cm-keymap-"+a:"")}function md(){this.set=[]}function nd(a,b,c){function e(a,b,c,e){_b(a).addMark(new p(b,c,e,d))}a=Yc(a),b=Yc(b);var d=new md;if(!ab(a,b))return d;if(a.line==b.line)e(a.line,a.ch,b.ch,c);else{e(a.line,a.ch,null,c);for(var f=a.line+1,g=b.line;f<g;++f)e(f,null,null,c);e(b.line,null,b.ch,c)}return Hb.push({from:a.line,to:b.line+1}),d}function od(a){a=Yc(a);var b=new q(a.ch);return _b(a.line).addMark(b),b}function pd(a){a=Yc(a);var b=[],c=_b(a.line).marked;if(!c)return b;for(var d=0,e=c.length;d<e;++d){var f=c[d];(f.from==null||f.from<=a.ch)&&(f.to==null||f.to>=a.ch)&&b.push(f.marker||f)}return b}function qd(a,b,c){return typeof a=="number"&&(a=_b(Xc(a))),a.gutterMarker={text:b,style:c},Lb=!0,a}function rd(a){typeof a=="number"&&(a=_b(Xc(a))),a.gutterMarker=null,Lb=!0}function sd(a,b){var c=a,d=a;return typeof a=="number"?d=_b(Xc(a)):c=w(a),c==null?null:b(d,c)?(Hb.push({from:c,to:c+1}),d):null}function td(a,b,c){return sd(a,function(a){if(a.className!=b||a.bgClassName!=c)return a.className=b,a.bgClassName=c,!0})}function ud(a,b){return sd(a,function(a,c){if(a.hidden!=b){a.hidden=b;if(!f.lineWrapping){var d=a.text;b&&d.length==Tb.length?Nb=!0:!b&&d.length>Tb.length&&(Tb=d,Ub=null,Nb=!1)}ac(a,b?0:1);var e=xb.from.line,g=xb.to.line;if(b&&(e==c||g==c)){var h=e==c?Vc({line:e,ch:0},e,0):xb.from,i=g==c?Vc({line:g,ch:0},g,0):xb.to;if(!i)return;Uc(h,i)}return Lb=!0}})}function vd(a){if(typeof a=="number"){if(!Zb(a))return null;var b=a;a=_b(a);if(!a)return null}else{var b=w(a);if(b==null)return null}var c=a.gutterMarker;return{line:b,handle:a,text:a.text,markerText:c&&c.text,markerClass:c&&c.style,lineClass:a.className,bgClass:a.bgClassName}}function wd(a){return lb.innerHTML="<pre><span>x</span></pre>",lb.firstChild.firstChild.firstChild.nodeValue=a,lb.firstChild.firstChild.offsetWidth||10}function xd(a,b){function e(a){return zd(c,a).left}if(b<=0)return 0;var c=_b(a),d=c.text,f=0,g=0,h=d.length,i,j=Math.min(h,Math.ceil(b/Jd()));for(;;){var k=e(j);if(!(k<=b&&j<h)){i=k,h=j;break}j=Math.min(h,Math.ceil(j*1.2))}if(b>i)return h;j=Math.floor(h*.8),k=e(j),k<b&&(f=j,g=k);for(;;){if(h-f<=1)return i-b>b-g?f:h;var l=Math.ceil((f+h)/2),m=e(l);m>b?(h=l,i=m):(f=l,g=m)}}function zd(a,b){if(b==0)return{top:0,left:0};var c=f.lineWrapping&&b<a.text.length&&V.test(a.text.slice(b-1,b+1));lb.innerHTML="<pre>"+a.getHTML(jd,b,yd,c)+"</pre>";var d=document.getElementById(yd),e=d.offsetTop,g=d.offsetLeft;if(M&&e==0&&g==0){var h=document.createElement("span");h.innerHTML="x",d.parentNode.insertBefore(h,d.nextSibling),e=h.offsetTop}return{top:e,left:g}}function Ad(a,b){var c,d=Gd(),e=d*(y(ub,a.line)-(b?Ob:0));if(a.ch==0)c=0;else{var g=zd(_b(a.line),a.ch);c=g.left,f.lineWrapping&&(e+=Math.max(0,g.top))}return{x:c,y:e,yBot:e+d}}function Bd(a,b){function l(a){var b=zd(h,a);if(j){var d=Math.round(b.top/c);return Math.max(0,b.left+(d-k)*U.clientWidth)}return b.left}b<0&&(b=0);var c=Gd(),d=Jd(),e=Ob+Math.floor(b/c),g=x(ub,e);if(g>=ub.size)return{line:ub.size-1,ch:_b(ub.size-1).text.length};var h=_b(g),i=h.text,j=f.lineWrapping,k=j?e-y(ub,g):0;if(a<=0&&k==0)return{line:g,ch:0};var m=0,n=0,o=i.length,p,q=Math.min(o,Math.ceil((a+k*U.clientWidth*.9)/d));for(;;){var r=l(q);if(!(r<=a&&q<o)){p=r,o=q;break}q=Math.min(o,Math.ceil(q*1.2))}if(a>p)return{line:g,ch:o};q=Math.floor(o*.8),r=l(q),r<a&&(m=q,n=r);for(;;){if(o-m<=1)return{line:g,ch:p-a>a-n?m:o};var s=Math.ceil((m+o)/2),t=l(s);t>a?(o=s,p=t):(m=s,n=t)}}function Cd(a){var b=Ad(a,!0),c=Y(kb);return{x:c.left+b.x,y:c.top+b.y,yBot:c.top+b.yBot}}function Gd(){if(Fd==null){Fd="<pre>";for(var a=0;a<49;++a)Fd+="x<br/>";Fd+="x</pre>"}var b=ob.clientHeight;return b==Ed?Dd:(Ed=b,lb.innerHTML=Fd,Dd=lb.firstChild.offsetHeight/50||1,lb.innerHTML="",Dd)}function Jd(){return U.clientWidth==Id?Hd:(Id=U.clientWidth,Hd=wd("x"))}function Kd(){return kb.offsetTop}function Ld(){return kb.offsetLeft}function Md(a,b){var c=Y(U,!0),d,e;try{d=a.clientX,e=a.clientY}catch(a){return null}if(!b&&(d-c.left>U.clientWidth||e-c.top>U.clientHeight))return null;var f=Y(kb,!0);return Bd(d-f.left,e-f.top)}function Nd(a){function f(){var a=hb(R.value).join("\n");a!=e&&Zd(yc)(a,"end"),D.style.position="relative",R.style.cssText=d,N&&(U.scrollTop=c),Kb=!1,Hc(!0),Dc()}var b=Md(a),c=U.scrollTop;if(!b||window.opera)return;(_(xb.from,xb.to)||ab(b,xb.from)||!ab(b,xb.to))&&Zd(Wc)(b.line,b.ch);var d=R.style.cssText;D.style.position="absolute",R.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(a.clientY-5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: white; "+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",Kb=!0;var e=R.value=Bc();Ic(),$(R);if(L){E(a);var g=I(window,"mouseup",function(){g(),setTimeout(f,20)},!0)}else setTimeout(f,50)}function Od(){clearInterval(sb);var a=!0;mb.style.visibility="",sb=setInterval(function(){mb.style.visibility=(a=!a)?"":"hidden"},650)}function Qd(a){function p(a,b,c){if(!a.text)return;var d=a.styles,e=g?0:a.text.length-1,f;for(var i=g?0:d.length-2,j=g?d.length:-2;i!=j;i+=2*h){var k=d[i];if(d[i+1]!=null&&d[i+1]!=m){e+=h*k.length;continue}for(var l=g?0:k.length-1,p=g?k.length:-1;l!=p;l+=h,e+=h)if(e>=b&&e<c&&o.test(f=k.charAt(l))){var q=Pd[f];if(q.charAt(1)==">"==g)n.push(f);else{if(n.pop()!=q.charAt(0))return{pos:e,match:!1};if(!n.length)return{pos:e,match:!0}}}}}var b=xb.inverted?xb.from:xb.to,c=_b(b.line),d=b.ch-1,e=d>=0&&Pd[c.text.charAt(d)]||Pd[c.text.charAt(++d)];if(!e)return;var f=e.charAt(0),g=e.charAt(1)==">",h=g?1:-1,i=c.styles;for(var j=d+1,k=0,l=i.length;k<l;k+=2)if((j-=i[k].length)<=0){var m=i[k+1];break}
|
13
13
|
var n=[c.text.charAt(d)],o=/[(){}[\]]/;for(var k=b.line,l=g?Math.min(k+100,ub.size):Math.max(-1,k-100);k!=l;k+=h){var c=_b(k),q=k==b.line,r=p(c,q&&g?d+1:0,q&&!g?d:c.text.length);if(r)break}r||(r={pos:null,match:!1});var m=r.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",s=nd({line:b.line,ch:d},{line:b.line,ch:d+1},m),t=r.pos!=null&&nd({line:k,ch:r.pos},{line:k,ch:r.pos+1},m),u=Zd(function(){s.clear(),t&&t.clear()});a?setTimeout(u,800):Sb=u}function Rd(a){var b,c;for(var d=a,e=a-40;d>e;--d){if(d==0)return 0;var g=_b(d-1);if(g.stateAfter)return d;var h=g.indentation(f.tabSize);if(c==null||b>h)c=d-1,b=h}return c}function Sd(a){var b=Rd(a),c=b&&_b(b-1).stateAfter;return c?c=m(tb,c):c=n(tb),ub.iter(b,a,function(a){a.highlight(tb,c,f.tabSize),a.stateAfter=m(tb,c)}),b<a&&Hb.push({from:b,to:a}),a<ub.size&&!_b(a).stateAfter&&vb.push(a),c}function Td(a,b){var c=Sd(a);ub.iter(a,b,function(a){a.highlight(tb,c,f.tabSize),a.stateAfter=m(tb,c)})}function Ud(){var a=+(new Date)+f.workTime,b=vb.length;while(vb.length){if(!_b(Pb).stateAfter)var c=Pb;else var c=vb.pop();if(c>=ub.size)continue;var d=Rd(c),e=d&&_b(d-1).stateAfter;e?e=m(tb,e):e=n(tb);var g=0,h=tb.compareStates,i=!1,j=d,k=!1;ub.iter(j,ub.size,function(b){var d=b.stateAfter;if(+(new Date)>a)return vb.push(j),Vd(f.workDelay),i&&Hb.push({from:c,to:j+1}),k=!0;var l=b.highlight(tb,e,f.tabSize);l&&(i=!0),b.stateAfter=m(tb,e);var n=null;if(h){var o=d&&h(d,e);o!=K&&(n=!!o)}n==null&&(l!==!1||!d?g=0:++g>3&&(!tb.indent||tb.indent(d,"")==tb.indent(e,""))&&(n=!0));if(n)return!0;++j});if(k)return;i&&Hb.push({from:c,to:j+1})}b&&f.onHighlightComplete&&f.onHighlightComplete($b)}function Vd(a){if(!vb.length)return;rb.set(a,Zd(Ud))}function Wd(){Fb=Gb=Ib=null,Hb=[],Jb=!1,Mb=[]}function Xd(){var a=!1,b;Nb&&wc(),Jb&&(a=!Kc()),Hb.length?b=Nc(Hb,!0):(Jb&&Rc(),Lb&&Qc()),a&&Kc(),Jb&&(Jc(),Od()),wb&&!Kb&&(Fb===!0||Fb!==!1&&Jb)&&Hc(Gb),Jb&&f.matchBrackets&&setTimeout(Zd(function(){Sb&&(Sb(),Sb=null),_(xb.from,xb.to)&&Qd(!1)}),20);var c=Ib,d=Mb;Jb&&f.onCursorActivity&&f.onCursorActivity($b),c&&f.onChange&&$b&&f.onChange($b,c);for(var e=0;e<d.length;++e)d[e]($b);b&&f.onUpdate&&f.onUpdate($b)}function Zd(a){return function(){Yd++||Wd();try{var b=a.apply(this,arguments)}finally{--Yd||Xd()}return b}}function $d(a){Wb.startCompound();try{return a()}finally{Wb.endCompound()}}var f={},o=a.defaults;for(var s in o)o.hasOwnProperty(s)&&(f[s]=(e&&e.hasOwnProperty(s)?e:o)[s]);var A=document.createElement("div");A.className="CodeMirror"+(f.lineWrapping?" CodeMirror-wrap":""),A.innerHTML='<div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll" tabindex="-1"><div style="position: relative"><div style="position: relative"><div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div style="position: relative; z-index: 0"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;"></div><pre class="CodeMirror-cursor"> </pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div>',d.appendChild?d.appendChild(A):d(A);var D=A.firstChild,R=D.firstChild,U=A.lastChild,W=U.firstChild,X=W.firstChild,cb=X.firstChild,db=cb.firstChild,kb=cb.nextSibling.firstChild,lb=kb.firstChild,mb=lb.nextSibling,nb=mb.nextSibling,ob=nb.nextSibling;kd(),ld(),b&&(R.style.width="0px"),P||(kb.draggable=!0),kb.style.outline="none",f.tabindex!=null&&(R.tabIndex=f.tabindex),f.autofocus&&Ic(),!f.gutter&&!f.lineNumbers&&(cb.style.display="none"),S&&(D.style.height="1px",D.style.position="absolute");try{wd("x")}catch(pb){throw pb.message.match(/runtime/i)&&(pb=new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)")),pb}var qb=new J,rb=new J,sb,tb,ub=new u([new t([new r("")])]),vb,wb;gd();var xb={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},yb,zb,Ab,Bb=0,Cb,Db=!1,Eb=!1,Fb,Gb,Hb,Ib,Jb,Kb,Lb,Mb,Nb,Ob=0,Pb=0,Qb=0,Rb=0,Sb,Tb="",Ub,Vb={};Zd(function(){bc(f.value||""),Fb=!1})();var Wb=new z;I(U,"mousedown",Zd(dc)),I(U,"dblclick",Zd(ec)),I(kb,"selectstart",C),L||I(U,"contextmenu",Nd),I(U,"scroll",function(){Bb=U.scrollTop,Nc([]),f.fixedGutter&&(cb.style.left=U.scrollLeft+"px"),f.onScroll&&f.onScroll($b)}),I(window,"resize",function(){Nc(!0)}),I(R,"keyup",Zd(oc)),I(R,"input",Ec),I(R,"keydown",Zd(mc)),I(R,"keypress",Zd(nc)),I(R,"focus",pc),I(R,"blur",qc);if(f.dragDrop){I(kb,"dragstart",gc);function Xb(a){if(f.onDragEvent&&f.onDragEvent($b,B(a)))return;E(a)}I(U,"dragenter",Xb),I(U,"dragover",Xb),I(U,"drop",Zd(fc))}I(U,"paste",function(){Ic(),Ec()}),I(R,"paste",Ec),I(R,"cut",Zd(function(){f.readOnly||yc("")})),S&&I(W,"mouseup",function(){document.activeElement==R&&R.blur(),Ic()});var Yb;try{Yb=document.activeElement==R}catch(pb){}Yb||f.autofocus?setTimeout(pc,20):qc();var $b=A.CodeMirror={getValue:cc,setValue:Zd(bc),getSelection:Bc,replaceSelection:Zd(yc),focus:function(){window.focus(),Ic(),pc(),Ec()},setOption:function(a,b){var c=f[a];f[a]=b,a=="mode"||a=="indentUnit"?gd():a=="readOnly"&&b=="nocursor"?(qc(),R.blur()):a=="readOnly"&&!b?Hc(!0):a=="theme"?kd():a=="lineWrapping"&&c!=b?Zd(id)():a=="tabSize"?Nc(!0):a=="keyMap"&&ld();if(a=="lineNumbers"||a=="gutter"||a=="firstLineNumber"||a=="theme")hd(),Nc(!0)},getOption:function(a){return f[a]},undo:Zd(tc),redo:Zd(uc),indentLine:Zd(function(a,b){typeof b!="string"&&(b==null?b=f.smartIndent?"smart":"prev":b=b?"add":"subtract"),Zb(a)&&fd(a,b)}),indentSelection:Zd(ed),historySize:function(){return{undo:Wb.done.length,redo:Wb.undone.length}},clearHistory:function(){Wb=new z},matchBrackets:Zd(function(){Qd(!0)}),getTokenAt:Zd(function(a){return a=Yc(a),_b(a.line).getTokenAt(tb,Sd(a.line),a.ch)}),getStateAfter:function(a){return a=Xc(a==null?ub.size-1:a),Sd(a+1)},cursorCoords:function(a,b){return a==null&&(a=xb.inverted),this.charCoords(a?xb.from:xb.to,b)},charCoords:function(a,b){return a=Yc(a),b=="local"?Ad(a,!1):b=="div"?Ad(a,!0):Cd(a)},coordsChar:function(a){var b=Y(kb);return Bd(a.x-b.left,a.y-b.top)},markText:Zd(nd),setBookmark:od,findMarksAt:pd,setMarker:Zd(qd),clearMarker:Zd(rd),setLineClass:Zd(td),hideLine:Zd(function(a){return ud(a,!0)}),showLine:Zd(function(a){return ud(a,!1)}),onDeleteLine:function(a,b){if(typeof a=="number"){if(!Zb(a))return null;a=_b(a)}return(a.handlers||(a.handlers=[])).push(b),a},lineInfo:vd,addWidget:function(a,b,c,d,e){a=Ad(Yc(a));var f=a.yBot,g=a.x;b.style.position="absolute",W.appendChild(b);if(d=="over")f=a.y;else if(d=="near"){var h=Math.max(U.offsetHeight,ub.height*Gd()),i=Math.max(W.clientWidth,kb.clientWidth)-Ld();a.yBot+b.offsetHeight>h&&a.y>b.offsetHeight&&(f=a.y-b.offsetHeight),g+b.offsetWidth>i&&(g=i-b.offsetWidth)}b.style.top=f+Kd()+"px",b.style.left=b.style.right="",e=="right"?(g=W.clientWidth-b.offsetWidth,b.style.right="0px"):(e=="left"?g=0:e=="middle"&&(g=(W.clientWidth-b.offsetWidth)/2),b.style.left=g+Ld()+"px"),c&&Lc(g,f,g+b.offsetWidth,f+b.offsetHeight)},lineCount:function(){return ub.size},clipPos:Yc,getCursor:function(a){return a==null&&(a=xb.inverted),bb(a?xb.from:xb.to)},somethingSelected:function(){return!_(xb.from,xb.to)},setCursor:Zd(function(a,b,c){b==null&&typeof a.line=="number"?Wc(a.line,a.ch,c):Wc(a,b,c)}),setSelection:Zd(function(a,b,c){(c?Tc:Uc)(Yc(a),Yc(b||a))}),getLine:function(a){if(Zb(a))return _b(a).text},getLineHandle:function(a){if(Zb(a))return _b(a)},setLine:Zd(function(a,b){Zb(a)&&xc(b,{line:a,ch:0},{line:a,ch:_b(a).text.length})}),removeLine:Zd(function(a){Zb(a)&&xc("",{line:a,ch:0},Yc({line:a+1,ch:0}))}),replaceRange:Zd(xc),getRange:function(a,b){return Ac(Yc(a),Yc(b))},triggerOnKeyDown:Zd(mc),execCommand:function(a){return h[a]($b)},moveH:Zd($c),deleteH:Zd(_c),moveV:Zd(bd),toggleOverwrite:function(){Db?(Db=!1,mb.className=mb.className.replace(" CodeMirror-overwrite","")):(Db=!0,mb.className+=" CodeMirror-overwrite")},posFromIndex:function(a){var b=0,c;return ub.iter(0,ub.size,function(d){var e=d.text.length+1;if(e>a)return c=a,!0;a-=e,++b}),Yc({line:b,ch:c})},indexFromPos:function(a){if(a.line<0||a.ch<0)return 0;var b=a.ch;return ub.iter(0,a.line,function(a){b+=a.text.length+1}),b},scrollTo:function(a,b){a!=null&&(U.scrollLeft=a),b!=null&&(U.scrollTop=b),Nc([])},operation:function(a){return Zd(a)()},compoundChange:function(a){return $d(a)},refresh:function(){Nc(!0),U.scrollHeight>Bb&&(U.scrollTop=Bb)},getInputField:function(){return R},getWrapperElement:function(){return A},getScrollerElement:function(){return U},getGutterElement:function(){return cb}},kc=null,lc,Cc=!1,Fc="",ad=null;md.prototype.clear=Zd(function(){var a=Infinity,b=-Infinity;for(var c=0,d=this.set.length;c<d;++c){var e=this.set[c],f=e.marked;if(!f||!e.parent)continue;var g=w(e);a=Math.min(a,g),b=Math.max(b,g);for(var h=0;h<f.length;++h)f[h].marker==this&&f.splice(h--,1)}a!=Infinity&&Hb.push({from:a,to:b+1})}),md.prototype.find=function(){var a,b;for(var c=0,d=this.set.length;c<d;++c){var e=this.set[c],f=e.marked;for(var g=0;g<f.length;++g){var h=f[g];if(h.marker==this)if(h.from!=null||h.to!=null){var i=w(e);i!=null&&(h.from!=null&&(a={line:i,ch:h.from}),h.to!=null&&(b={line:i,ch:h.to}))}}}return{from:a,to:b}};var yd="CodeMirror-temp-"+Math.floor(Math.random()*16777215).toString(16),Dd,Ed,Fd,Hd,Id=0,Pd={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},Yd=0;for(var _d in g)g.propertyIsEnumerable(_d)&&!$b.propertyIsEnumerable(_d)&&($b[_d]=g[_d]);return $b}function j(a){return typeof a=="string"?i[a]:a}function k(a,b,c,d,e){function f(b){b=j(b);var c=b[a];if(c!=null&&d(c))return!0;if(b.nofallthrough)return e&&e(),!0;var g=b.fallthrough;if(g==null)return!1;if(Object.prototype.toString.call(g)!="[object Array]")return f(g);for(var h=0,i=g.length;h<i;++h)if(f(g[h]))return!0;return!1}return b&&f(b)?!0:f(c)}function l(a){var b=jb[H(a,"keyCode")];return b=="Ctrl"||b=="Alt"||b=="Shift"||b=="Mod"}function m(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function n(a,b,c){return a.startState?a.startState(b,c):!0}function o(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8}function p(a,b,c,d){this.from=a,this.to=b,this.style=c,this.marker=d}function q(a){this.from=a,this.to=a,this.line=null}function r(a,b){this.styles=b||[a,null],this.text=a,this.height=1,this.marked=this.gutterMarker=this.className=this.bgClassName=this.handlers=null,this.stateAfter=this.parent=this.hidden=null}function s(a,b,c,d){for(var e=0,f=0,g=0;f<b;e+=2){var h=c[e],i=f+h.length;g==0?(i>a&&d.push(h.slice(a-f,Math.min(h.length,b-f)),c[e+1]),i>=a&&(g=1)):g==1&&(i>b?d.push(h.slice(0,b-f),c[e+1]):d.push(h,c[e+1])),f=i}}function t(a){this.lines=a,this.parent=null;for(var b=0,c=a.length,d=0;b<c;++b)a[b].parent=this,d+=a[b].height;this.height=d}function u(a){this.children=a;var b=0,c=0;for(var d=0,e=a.length;d<e;++d){var f=a[d];b+=f.chunkSize(),c+=f.height,f.parent=this}this.size=b,this.height=c,this.parent=null}function v(a,b){while(!a.lines)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(b<e){a=d;break}b-=e}return a.lines[b]}function w(a){if(a.parent==null)return null;var b=a.parent,c=fb(b.lines,a);for(var d=b.parent;d;b=d,d=d.parent)for(var e=0,f=d.children.length;;++e){if(d.children[e]==b)break;c+=d.children[e].chunkSize()}return c}function x(a,b){var c=0;a:do{for(var d=0,e=a.children.length;d<e;++d){var f=a.children[d],g=f.height;if(b<g){a=f;continue a}b-=g,c+=f.chunkSize()}return c}while(!a.lines);for(var d=0,e=a.lines.length;d<e;++d){var h=a.lines[d],i=h.height;if(b<i)break;b-=i}return c+d}function y(a,b){var c=0;a:do{for(var d=0,e=a.children.length;d<e;++d){var f=a.children[d],g=f.chunkSize();if(b<g){a=f;continue a}b-=g,c+=f.height}return c}while(!a.lines);for(var d=0;d<b;++d)c+=a.lines[d].height;return c}function z(){this.time=0,this.done=[],this.undone=[],this.compound=0,this.closed=!1}function A(){E(this)}function B(a){return a.stop||(a.stop=A),a}function C(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function D(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function E(a){C(a),D(a)}function F(a){return a.target||a.srcElement}function G(a){if(a.which)return a.which;if(a.button&1)return 1;if(a.button&2)return 3;if(a.button&4)return 2}function H(a,b){var c=a.override&&a.override.hasOwnProperty(b);return c?a.override[b]:a[b]}function I(a,b,c,d){if(typeof a.addEventListener=="function"){a.addEventListener(b,c,!1);if(d)return function(){a.removeEventListener(b,c,!1)}}else{var e=function(a){c(a||window.event)};a.attachEvent("on"+b,e);if(d)return function(){a.detachEvent("on"+b,e)}}}function J(){this.id=null}function W(a,b,c){b==null&&(b=a.search(/[^\s\u00a0]/),b==-1&&(b=a.length));for(var d=0,e=0;d<b;++d)a.charAt(d)==" "?e+=c-e%c:++e;return e}function X(a){return a.currentStyle?a.currentStyle:window.getComputedStyle(a,null)}function Y(a,b){var c=a.ownerDocument.body,d=0,e=0,f=!1;for(var g=a;g;g=g.offsetParent){var h=g.offsetLeft,i=g.offsetTop;g==c?(d+=Math.abs(h),e+=Math.abs(i)):(d+=h,e+=i),b&&X(g).position=="fixed"&&(f=!0)}var j=b&&!f?null:c;for(var g=a.parentNode;g!=j;g=g.parentNode)g.scrollLeft!=null&&(d-=g.scrollLeft,e-=g.scrollTop);return{left:d,top:e}}function Z(a){return a.textContent||a.innerText||a.nodeValue||""}function $(a){b?(a.selectionStart=0,a.selectionEnd=a.value.length):a.select()}function _(a,b){return a.line==b.line&&a.ch==b.ch}function ab(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function bb(a){return{line:a.line,ch:a.ch}}function db(a){return cb.textContent=a,cb.innerHTML}function eb(a,b){if(!b)return 0;if(!a)return b.length;for(var c=a.length,d=b.length;c>=0&&d>=0;--c,--d)if(a.charAt(c)!=b.charAt(d))break;return d+1}function fb(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;++c)if(a[c]==b)return c;return-1}function gb(a){return/\w/.test(a)||a.toUpperCase()!=a.toLowerCase()}a.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,smartIndent:!0,tabSize:4,keyMap:"default",extraKeys:null,electricChars:!0,autoClearEmptyLines:!1,onKeyEvent:null,onDragEvent:null,lineWrapping:!1,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,dragDrop:!0,onChange:null,onCursorActivity:null,onGutterClick:null,onHighlightComplete:null,onUpdate:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,workTime:100,workDelay:200,pollInterval:100,undoDepth:40,tabindex:null,autofocus:null};var b=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),c=b||/Mac/.test(navigator.platform),d=/Win/.test(navigator.platform),e=a.modes={},f=a.mimeModes={};a.defineMode=function(b,c){!a.defaults.mode&&b!="null"&&(a.defaults.mode=b);if(arguments.length>2){c.dependencies=[];for(var d=2;d<arguments.length;++d)c.dependencies.push(arguments[d])}e[b]=c},a.defineMIME=function(a,b){f[a]=b},a.resolveMode=function(b){if(typeof b=="string"&&f.hasOwnProperty(b))b=f[b];else if(typeof b=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(b))return a.resolveMode("application/xml");return typeof b=="string"?{name:b}:b||{name:"null"}},a.getMode=function(b,c){var c=a.resolveMode(c),d=e[c.name];return d?d(b,c):a.getMode(b,"text/plain")},a.listModes=function(){var a=[];for(var b in e)e.propertyIsEnumerable(b)&&a.push(b);return a},a.listMIMEs=function(){var a=[];for(var b in f)f.propertyIsEnumerable(b)&&a.push({mime:b,mode:f[b]});return a};var g=a.extensions={};a.defineExtension=function(a,b){g[a]=b};var h=a.commands={selectAll:function(a){a.setSelection({line:0,ch:0},{line:a.lineCount()-1})},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),d=!_(b,c);!d&&a.getLine(b.line).length==b.ch?a.replaceRange("",b,{line:b.line+1,ch:0}):a.replaceRange("",b,d?c:{line:b.line})},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",{line:b,ch:0},{line:b})},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.setCursor(0,0,!0)},goDocEnd:function(a){a.setSelection({line:a.lineCount()-1},null,!0)},goLineStart:function(a){a.setCursor(a.getCursor().line,0,!0)},goLineStartSmart:function(a){var b=a.getCursor(),c=a.getLine(b.line),d=Math.max(0,c.search(/\S/));a.setCursor(b.line,b.ch<=d&&b.ch?0:d,!0)},goLineEnd:function(a){a.setSelection({line:a.getCursor().line},null,!0)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goWordRight:function(a){a.moveH(1,"word")},delCharLeft:function(a){a.deleteH(-1,"char")},delCharRight:function(a){a.deleteH(1,"char")},delWordLeft:function(a){a.deleteH(-1,"word")},delWordRight:function(a){a.deleteH(1,"word")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection(" ","end")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.replaceSelection(" ","end")},transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);b.ch>0&&b.ch<c.length-1&&a.replaceRange(c.charAt(b.ch)+c.charAt(b.ch-1),{line:b.line,ch:b.ch-1},{line:b.line,ch:b.ch+1})},newlineAndIndent:function(a){a.replaceSelection("\n","end"),a.indentLine(a.getCursor().line)},toggleOverwrite:function(a){a.toggleOverwrite()}},i=a.keyMap={};i.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharRight",Backspace:"delCharLeft",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},i.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goWordLeft","Ctrl-Right":"goWordRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordLeft","Ctrl-Delete":"delWordRight","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"},i.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goWordLeft","Alt-Right":"goWordRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordLeft","Ctrl-Alt-Backspace":"delWordRight","Alt-Delete":"delWordRight","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore",fallthrough:["basic","emacsy"]},i["default"]=c?i.macDefault:i.pcDefault,i.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageUp","Shift-Ctrl-V":"goPageDown","Ctrl-D":"delCharRight","Ctrl-H":"delCharLeft","Alt-D":"delWordRight","Alt-Backspace":"delWordLeft","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},a.fromTextArea=function(b,c){function d(){b.value=h.getValue()}c||(c={}),c.value=b.value,!c.tabindex&&b.tabindex&&(c.tabindex=b.tabindex),c.autofocus==null&&b.getAttribute("autofocus")!=null&&(c.autofocus=!0);if(b.form){var e=I(b.form,"submit",d,!0);if(typeof b.form.submit=="function"){var f=b.form.submit;function g(){d(),b.form.submit=f,b.form.submit(),b.form.submit=g}b.form.submit=g}}b.style.display="none";var h=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);return h.save=d,h.getTextArea=function(){return b},h.toTextArea=function(){d(),b.parentNode.removeChild(h.getWrapperElement()),b.style.display="",b.form&&(e(),typeof b.form.submit=="function"&&(b.form.submit=f))},h},a.copyState=m,a.startState=n,o.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if(typeof a=="string")var c=b==a;else var c=b&&(a.test?a.test(b):a(b));if(c)return++this.pos,b},eatWhile:function(a){var b=this.pos;while(this.eat(a));return this.pos>b},eatSpace:function(){var a=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return W(this.string,this.start,this.tabSize)},indentation:function(){return W(this.string,null,this.tabSize)},match:function(a,b,c){if(typeof a!="string"){var e=this.string.slice(this.pos).match(a);return e&&b!==!1&&(this.pos+=e[0].length),e}function d(a){return c?a.toLowerCase():a}if(d(this.string).indexOf(d(a),this.pos)==this.pos)return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)}},a.StringStream=o,p.prototype={attach:function(a){this.marker.set.push(a)},detach:function(a){var b=fb(this.marker.set,a);b>-1&&this.marker.set.splice(b,1)},split:function(a,b){if(this.to<=a&&this.to!=null)return null;var c=this.from<a||this.from==null?null:this.from-a+b,d=this.to==null?null:this.to-a+b;return new p(c,d,this.style,this.marker)},dup:function(){return new p(null,null,this.style,this.marker)},clipTo:function(a,b,c,d,e){a&&d>this.from&&(d<this.to||this.to==null)?this.from=null:this.from!=null&&this.from>=b&&(this.from=Math.max(d,this.from)+e),c&&(b<this.to||this.to==null)&&(b>this.from||this.from==null)?this.to=null:this.to!=null&&this.to>b&&(this.to=d<this.to?this.to+e:b)},isDead:function(){return this.from!=null&&this.to!=null&&this.from>=this.to},sameSet:function(a){return this.marker==a.marker}},q.prototype={attach:function(a){this.line=a},detach:function(a){this.line==a&&(this.line=null)},split:function(a,b){if(a<this.from)return this.from=this.to=this.from-a+b,this},isDead:function(){return this.from>this.to},clipTo:function(a,b,c,d,e){(a||b<this.from)&&(c||d>this.to)?(this.from=0,this.to=-1):this.from>b&&(this.from=this.to=Math.max(d,this.from)+e)},sameSet:function(a){return!1},find:function(){return!this.line||!this.line.parent?null:{line:w(this.line),ch:this.from}},clear:function(){if(this.line){var a=fb(this.line.marked,this);a!=-1&&this.line.marked.splice(a,1),this.line=null}}},r.inheritMarks=function(a,b){var c=new r(a),d=b&&b.marked;if(d)for(var e=0;e<d.length;++e)if(d[e].to==null&&d[e].style){var f=c.marked||(c.marked=[]),g=d[e],h=g.dup();f.push(h),h.attach(c)}return c},r.prototype={replace:function(a,b,c){var d=[],e=this.marked,f=b==null?this.text.length:b;s(0,a,this.styles,d),c&&d.push(c,null),s(f,this.text.length,this.styles,d),this.styles=d,this.text=this.text.slice(0,a)+c+this.text.slice(f),this.stateAfter=null;if(e){var g=c.length-(f-a);for(var h=0;h<e.length;++h){var i=e[h];i.clipTo(a==null,a||0,b==null,f,g),i.isDead()&&(i.detach(this),e.splice(h--,1))}}},split:function(a,b){var c=[b,null],d=this.marked;s(a,this.text.length,this.styles,c);var e=new r(b+this.text.slice(a),c);if(d)for(var f=0;f<d.length;++f){var g=d[f],h=g.split(a,b.length);h&&(e.marked||(e.marked=[]),e.marked.push(h),h.attach(e),h==g&&d.splice(f--,1))}return e},append:function(a){var b=this.text.length,c=a.marked,d=this.marked;this.text+=a.text,s(0,a.text.length,a.styles,this.styles);if(d)for(var e=0;e<d.length;++e)d[e].to==null&&(d[e].to=b);if(c&&c.length){d||(this.marked=d=[]);a:for(var e=0;e<c.length;++e){var f=c[e];if(!f.from)for(var g=0;g<d.length;++g){var h=d[g];if(h.to==b&&h.sameSet(f)){h.to=f.to==null?null:f.to+b,h.isDead()&&(h.detach(this),c.splice(e--,1));continue a}}d.push(f),f.attach(this),f.from+=b,f.to!=null&&(f.to+=b)}}},fixMarkEnds:function(a){var b=this.marked,c=a.marked;if(!b)return;for(var d=0;d<b.length;++d){var e=b[d],f=e.to==null;if(f&&c)for(var g=0;g<c.length;++g)if(c[g].sameSet(e)){f=!1;break}f&&(e.to=this.text.length)}},fixMarkStarts:function(){var a=this.marked;if(!a)return;for(var b=0;b<a.length;++b)a[b].from==null&&(a[b].from=0)},addMark:function(a){a.attach(this),this.marked==null&&(this.marked=[]),this.marked.push(a),this.marked.sort(function(a,b){return(a.from||0)-(b.from||0)})},highlight:function(a,b,c){var d=new o(this.text,c),e=this.styles,f=0,g=!1,h=e[0],i;this.text==""&&a.blankLine&&a.blankLine(b);while(!d.eol()){var j=a.token(d,b),k=this.text.slice(d.start,d.pos);d.start=d.pos,f&&e[f-1]==j?e[f-2]+=k:k&&(!g&&(e[f+1]!=j||f&&e[f-2]!=i)&&(g=!0),e[f++]=k,e[f++]=j,i=h,h=e[f]);if(d.pos>5e3){e[f++]=this.text.slice(d.pos),e[f++]=null;break}}return e.length!=f&&(e.length=f,g=!0),f&&e[f-2]!=i&&(g=!0),g||(e.length<5&&this.text.length<10?null:!1)},getTokenAt:function(a,b,c){var d=this.text,e=new o(d);while(e.pos<c&&!e.eol()){e.start=e.pos;var f=a.token(e,b)}return{start:e.start,end:e.pos,string:e.current(),className:f||null,state:b}},indentation:function(a){return W(this.text,null,a)},getHTML:function(a,b,c,d){function h(b,c){if(!b)return;f&&M&&b.charAt(0)==" "&&(b=" "+b.slice(1)),f=!1;if(b.indexOf(" ")==-1){g+=b.length;var d=db(b)}else{var d="";for(var h=0;;){var i=b.indexOf(" ",h);if(i==-1){d+=db(b.slice(h)),g+=b.length-h;break}g+=i-h;var j=a(g);d+=db(b.slice(h,i))+j.html,g+=j.width,h=i+1}}c?e.push('<span class="',c,'">',d,"</span>"):e.push(d)}function p(a){return a?"cm-"+a.replace(/ +/g," cm-"):null}var e=[],f=!0,g=0,i=h;if(b!=null){var j=0,k='<span id="'+c+'">';i=function(a,c){var f=a.length;if(b>=j&&b<j+f){b>j&&(h(a.slice(0,b-j),c),d&&e.push("<wbr>")),e.push(k);var g=b-j;h(window.opera?a.slice(g,g+1):a.slice(g),c),e.push("</span>"),window.opera&&h(a.slice(g+1),c),b--,j+=f}else j+=f,h(a,c),j==b&&j==o?e.push(k+" </span>"):j>b+10&&/\s/.test(a)&&(i=function(){})}}var l=this.styles,m=this.text,n=this.marked,o=m.length;if(!m&&b==null)i(" ");else if(!n||!n.length)for(var q=0,r=0;r<o;q+=2){var s=l[q],t=l[q+1],u=s.length;r+u>o&&(s=s.slice(0,o-r)),r+=u,i(s,p(t))}else{var v=0,q=0,w="",t,x=0,y=n[0].from||0,z=[],A=0;function B(){var a;while(A<n.length&&((a=n[A]).from==v||a.from==null))a.style!=null&&z.push(a),++A;y=A<n.length?n[A].from:Infinity;for(var b=0;b<z.length;++b){var c=z[b].to||Infinity;c==v?z.splice(b--,1):y=Math.min(c,y)}}var C=0;while(v<o){y==v&&B();var D=Math.min(o,y);for(;;){if(w){var E=v+w.length,F=t;for(var G=0;G<z.length;++G)F=(F?F+" ":"")+z[G].style;i(E>D?w.slice(0,D-v):w,F);if(E>=D){w=w.slice(D-v),v=D;break}v=E}w=l[q++],t=p(l[q++])}}}return e.join("")},cleanUp:function(){this.parent=null;if(this.marked)for(var a=0,b=this.marked.length;a<b;++a)this.marked[a].detach(this)}},t.prototype={chunkSize:function(){return this.lines.length},remove:function(a,b,c){for(var d=a,e=a+b;d<e;++d){var f=this.lines[d];this.height-=f.height,f.cleanUp();if(f.handlers)for(var g=0;g<f.handlers.length;++g)c.push(f.handlers[g])}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertHeight:function(a,b,c){this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0,e=b.length;d<e;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;a<d;++a)if(c(this.lines[a]))return!0}},u.prototype={chunkSize:function(){return this.size},remove:function(a,b,c){this.size-=b;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){var g=Math.min(b,f-a),h=e.height;e.remove(a,g,c),this.height-=h-e.height,f==g&&(this.children.splice(d--,1),e.parent=null);if((b-=g)==0)break;a=0}else a-=f}if(this.size-b<25){var i=[];this.collapse(i),this.children=[new t(i)],this.children[0].parent=this}},collapse:function(a){for(var b=0,c=this.children.length;b<c;++b)this.children[b].collapse(a)},insert:function(a,b){var c=0;for(var d=0,e=b.length;d<e;++d)c+=b[d].height;this.insertHeight(a,b,c)},insertHeight:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0,e=this.children.length;d<e;++d){var f=this.children[d],g=f.chunkSize();if(a<=g){f.insertHeight(a,b,c);if(f.lines&&f.lines.length>50){while(f.lines.length>50){var h=f.lines.splice(f.lines.length-25,25),i=new t(h);f.height-=i.height,this.children.splice(d+1,0,i),i.parent=this}this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(this.children.length<=10)return;var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new u(b);if(!a.parent){var d=new u(a.children);d.parent=a,a.children=[d,c],a=d}else{a.size-=c.size,a.height-=c.height;var e=fb(a.parent.children,a);a.parent.children.splice(e+1,0,c)}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()},iter:function(a,b,c){this.iterN(a,b-a,c)},iterN:function(a,b,c){for(var d=0,e=this.children.length;d<e;++d){var f=this.children[d],g=f.chunkSize();if(a<g){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if((b-=h)==0)break;a=0}else a-=g}}},z.prototype={addChange:function(a,b,c){this.undone.length=0;var d=+(new Date),e=this.done[this.done.length-1],f=e&&e[e.length-1],g=d-this.time;if(this.compound&&e&&!this.closed)e.push({start:a,added:b,old:c});else if(g>400||!f||this.closed||f.start>a+c.length||f.start+f.added<a)this.done.push([{start:a,added:b,old:c}]),this.closed=!1;else{var h=Math.max(0,f.start-a),i=Math.max(0,a+c.length-(f.start+f.added));for(var j=h;j>0;--j)f.old.unshift(c[j-1]);for(var j=i;j>0;--j)f.old.push(c[c.length-j]);h&&(f.start=a),f.added+=b-(c.length-h-i)}this.time=d},startCompound:function(){this.compound++||(this.closed=!0)},endCompound:function(){--this.compound||(this.closed=!0)}},a.e_stop=E,a.e_preventDefault=C,a.e_stopPropagation=D,a.connect=I,J.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}};var K=a.Pass={toString:function(){return"CodeMirror.Pass"}},L=/gecko\/\d{7}/i.test(navigator.userAgent),M=/MSIE \d/.test(navigator.userAgent),N=/MSIE [1-8]\b/.test(navigator.userAgent),O=M&&document.documentMode==5,P=/WebKit\//.test(navigator.userAgent),Q=/Chrome\//.test(navigator.userAgent),R=/Apple Computer/.test(navigator.vendor),S=/KHTML\//.test(navigator.userAgent),T=function(){if(N)return!1;var a=document.createElement("div");return"draggable"in a||"dragDrop"in a}(),U=function(){var a=document.createElement("textarea");return a.value="foo\nbar",a.value.indexOf("\r")>-1?"\r\n":"\n"}(),V=/^$/;L?V=/$'/:R?V=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:Q&&(V=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/),document.documentElement.getBoundingClientRect!=null&&(Y=function(a,b){try{var c=a.getBoundingClientRect();c={top:c.top,left:c.left}}catch(d){c={top:0,left:0}}if(!b)if(window.pageYOffset==null){var e=document.documentElement||document.body.parentNode;e.scrollTop==null&&(e=document.body),c.top+=e.scrollTop,c.left+=e.scrollLeft}else c.top+=window.pageYOffset,c.left+=window.pageXOffset;return c});var cb=document.createElement("pre");db("a")=="\na"?db=function(a){return cb.textContent=a,cb.innerHTML.slice(1)}:db(" ")!=" "&&(db=function(a){return cb.innerHTML="",cb.appendChild(document.createTextNode(a)),cb.innerHTML}),a.htmlEscape=db;var hb="\n\nb".split(/\n/).length!=3?function(a){var b=0,c,d=[];while((c=a.indexOf("\n",b))>-1)d.push(a.slice(b,a.charAt(c-1)=="\r"?c-1:c)),b=c+1;return d.push(a.slice(b)),d}:function(a){return a.split(/\r?\n/)};a.splitLines=hb;var ib=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return!b||b.parentElement()!=a?!1:b.compareEndPoints("StartToEnd",b)!=0};a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null");var jb={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};return a.keyNames=jb,function(){for(var a=0;a<10;a++)jb[a+48]=String(a);for(var a=65;a<=90;a++)jb[a]=String.fromCharCode(a);for(var a=1;a<=12;a++)jb[a+111]=jb[a+63235]="F"+a}(),a}();CodeMirror.defineMode("coffeescript",function(
|
14
14
|
a){function c(a){return new RegExp("^(("+a.join(")|(")+"))\\b")}function r(a,c){if(a.sol()){var k=c.scopes[0].offset;if(a.eatSpace()){var l=a.indentation();return l>k?"indent":l<k?"dedent":null}k>0&&v(a,c)}if(a.eatSpace())return null;var p=a.peek();if(a.match("####"))return a.skipToEnd(),"comment";if(a.match("###"))return c.tokenize=t,c.tokenize(a,c);if(p==="#")return a.skipToEnd(),"comment";if(a.match(/^-?[0-9\.]/,!1)){var r=!1;a.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(r=!0),a.match(/^-?\d+\.\d*/)&&(r=!0),a.match(/^-?\.\d+/)&&(r=!0);if(r)return a.peek()=="."&&a.backUp(1),"number";var u=!1;a.match(/^-?0x[0-9a-f]+/i)&&(u=!0),a.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(u=!0),a.match(/^-?0(?![\dx])/i)&&(u=!0);if(u)return"number"}if(a.match(n))return c.tokenize=s(a.current(),"string"),c.tokenize(a,c);if(a.match(o)){if(a.current()!="/"||a.match(/^.*\//,!1))return c.tokenize=s(a.current(),"string-2"),c.tokenize(a,c);a.backUp(1)}return a.match(h)||a.match(g)?"punctuation":a.match(f)||a.match(d)||a.match(j)?"operator":a.match(e)?"punctuation":a.match(q)?"atom":a.match(m)?"keyword":a.match(i)?"variable":(a.next(),b)}function s(c,d){var e=c.length==1;return function(g,h){while(!g.eol()){g.eatWhile(/[^'"\/\\]/);if(g.eat("\\")){g.next();if(e&&g.eol())return d}else{if(g.match(c))return h.tokenize=r,d;g.eat(/['"\/]/)}}return e&&(a.mode.singleLineStringErrors?d=b:h.tokenize=r),d}}function t(a,b){while(!a.eol()){a.eatWhile(/[^#]/);if(a.match("###")){b.tokenize=r;break}a.eatWhile("#")}return"comment"}function u(b,c,d){d=d||"coffee";var e=0;if(d==="coffee"){for(var f=0;f<c.scopes.length;f++)if(c.scopes[f].type==="coffee"){e=c.scopes[f].offset+a.indentUnit;break}}else e=b.column()+b.current().length;c.scopes.unshift({offset:e,type:d})}function v(a,b){if(b.scopes.length==1)return;if(b.scopes[0].type==="coffee"){var c=a.indentation(),d=-1;for(var e=0;e<b.scopes.length;++e)if(c===b.scopes[e].offset){d=e;break}if(d===-1)return!0;while(b.scopes[0].offset!==c)b.scopes.shift();return!1}return b.scopes.shift(),!1}function w(a,c){var d=c.tokenize(a,c),e=a.current();if(e===".")return d=c.tokenize(a,c),e=a.current(),d==="variable"?"variable":b;if(e==="@")return a.eat("@"),"keyword";e==="return"&&(c.dedent+=1),((e==="->"||e==="=>")&&!c.lambda&&c.scopes[0].type=="coffee"&&a.peek()===""||d==="indent")&&u(a,c);var f="[({".indexOf(e);return f!==-1&&u(a,c,"])}".slice(f,f+1)),k.exec(e)&&u(a,c),e=="then"&&v(a,c),d==="dedent"&&v(a,c)?b:(f="])}".indexOf(e),f!==-1&&v(a,c)?b:(c.dedent>0&&a.eol()&&c.scopes[0].type=="coffee"&&(c.scopes.length>1&&c.scopes.shift(),c.dedent-=1),d))}var b="error",d=new RegExp("^[\\+\\-\\*/%&|\\^~<>!?]"),e=new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"),f=new RegExp("^((->)|(=>)|(\\+\\+)|(\\+\\=)|(\\-\\-)|(\\-\\=)|(\\*\\*)|(\\*\\=)|(\\/\\/)|(\\/\\=)|(==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//))"),g=new RegExp("^((\\.\\.)|(\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"),h=new RegExp("^((\\.\\.\\.)|(//=)|(>>=)|(<<=)|(\\*\\*=))"),i=new RegExp("^[_A-Za-z$][_A-Za-z$0-9]*"),j=c(["and","or","not","is","isnt","in","instanceof","typeof"]),k=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],l=["break","by","continue","debugger","delete","do","in","of","new","return","then","this","throw","when","until"],m=c(k.concat(l));k=c(k);var n=new RegExp("^('{3}|\"{3}|['\"])"),o=new RegExp("^(/{3}|/)"),p=["Infinity","NaN","undefined","null","true","false","on","off","yes","no"],q=c(p),x={startState:function(a){return{tokenize:r,scopes:[{offset:a||0,type:"coffee"}],lastToken:null,lambda:!1,dedent:0}},token:function(a,b){var c=w(a,b);return b.lastToken={style:c,content:a.current()},a.eol()&&a.lambda&&(b.lambda=!1),c},indent:function(a,b){return a.tokenize!=r?0:a.scopes[0].offset}};return x}),CodeMirror.defineMIME("text/x-coffeescript","coffeescript"),CodeMirror.defineMode("javascript",function(a,b){function g(a,b,c){return b.tokenize=c,c(a,b)}function h(a,b){var c=!1,d;while((d=a.next())!=null){if(d==b&&!c)return!1;c=!c&&d=="\\"}return c}function k(a,b,c){return i=a,j=c,b}function l(a,b){var c=a.next();if(c=='"'||c=="'")return g(a,b,m(c));if(/[\[\]{}\(\),;\:\.]/.test(c))return k(c);if(c=="0"&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),k("number","number");if(/\d/.test(c))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),k("number","number");if(c=="/")return a.eat("*")?g(a,b,n):a.eat("/")?(a.skipToEnd(),k("comment","comment")):b.reAllowed?(h(a,"/"),a.eatWhile(/[gimy]/),k("regexp","string-2")):(a.eatWhile(f),k("operator",null,a.current()));if(c=="#")return a.skipToEnd(),k("error","error");if(f.test(c))return a.eatWhile(f),k("operator",null,a.current());a.eatWhile(/[\w\$_]/);var d=a.current(),i=e.propertyIsEnumerable(d)&&e[d];return i&&b.kwAllowed?k(i.type,i.style,d):k("variable","variable",d)}function m(a){return function(b,c){return h(b,a)||(c.tokenize=l),k("string","string")}}function n(a,b){var c=!1,d;while(d=a.next()){if(d=="/"&&c){b.tokenize=l;break}c=d=="*"}return k("comment","comment")}function p(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,d!=null&&(this.align=d)}function q(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0}function r(a,b,c,e,f){var g=a.cc;s.state=a,s.stream=f,s.marked=null,s.cc=g,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);for(;;){var h=g.length?g.pop():d?D:C;if(h(c,e)){while(g.length&&g[g.length-1].lex)g.pop()();return s.marked?s.marked:c=="variable"&&q(a,e)?"variable-2":b}}}function t(){for(var a=arguments.length-1;a>=0;a--)s.cc.push(arguments[a])}function u(){return t.apply(null,arguments),!0}function v(a){var b=s.state;if(b.context){s.marked="def";for(var c=b.localVars;c;c=c.next)if(c.name==a)return;b.localVars={name:a,next:b.localVars}}}function x(){s.state.context||(s.state.localVars=w),s.state.context={prev:s.state.context,vars:s.state.localVars}}function y(){s.state.localVars=s.state.context.vars,s.state.context=s.state.context.prev}function z(a,b){var c=function(){var c=s.state;c.lexical=new p(c.indented,s.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function A(){var a=s.state;a.lexical.prev&&(a.lexical.type==")"&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function B(a){return function(c){return c==a?u():a==";"?t():u(arguments.callee)}}function C(a){return a=="var"?u(z("vardef"),L,B(";"),A):a=="keyword a"?u(z("form"),D,C,A):a=="keyword b"?u(z("form"),C,A):a=="{"?u(z("}"),K,A):a==";"?u():a=="function"?u(R):a=="for"?u(z("form"),B("("),z(")"),N,B(")"),A,C,A):a=="variable"?u(z("stat"),G):a=="switch"?u(z("form"),D,z("}","switch"),B("{"),K,A,A):a=="case"?u(D,B(":")):a=="default"?u(B(":")):a=="catch"?u(z("form"),x,B("("),S,B(")"),C,A,y):t(z("stat"),D,B(";"),A)}function D(a){return o.hasOwnProperty(a)?u(F):a=="function"?u(R):a=="keyword c"?u(E):a=="("?u(z(")"),E,B(")"),A,F):a=="operator"?u(D):a=="["?u(z("]"),J(D,"]"),A,F):a=="{"?u(z("}"),J(I,"}"),A,F):u()}function E(a){return a.match(/[;\}\)\],]/)?t():t(D)}function F(a,b){if(a=="operator"&&/\+\+|--/.test(b))return u(F);if(a=="operator"||a==":")return u(D);if(a==";")return;if(a=="(")return u(z(")"),J(D,")"),A,F);if(a==".")return u(H,F);if(a=="[")return u(z("]"),D,B("]"),A,F)}function G(a){return a==":"?u(A,C):t(F,B(";"),A)}function H(a){if(a=="variable")return s.marked="property",u()}function I(a){a=="variable"&&(s.marked="property");if(o.hasOwnProperty(a))return u(B(":"),D)}function J(a,b){function c(d){return d==","?u(a,c):d==b?u():u(B(b))}return function(e){return e==b?u():t(a,c)}}function K(a){return a=="}"?u():t(C,K)}function L(a,b){return a=="variable"?(v(b),u(M)):u()}function M(a,b){if(b=="=")return u(D,M);if(a==",")return u(L)}function N(a){return a=="var"?u(L,P):a==";"?t(P):a=="variable"?u(O):t(P)}function O(a,b){return b=="in"?u(D):u(F,P)}function P(a,b){return a==";"?u(Q):b=="in"?u(D):u(D,B(";"),Q)}function Q(a){a!=")"&&u(D)}function R(a,b){if(a=="variable")return v(b),u(R);if(a=="(")return u(z(")"),x,J(S,")"),A,C,y)}function S(a,b){if(a=="variable")return v(b),u()}var c=a.indentUnit,d=b.json,e=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"};return{"if":b,"while":b,"with":b,"else":c,"do":c,"try":c,"finally":c,"return":d,"break":d,"continue":d,"new":d,"delete":d,"throw":d,"var":a("var"),"const":a("var"),let:a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":f,"false":f,"null":f,"undefined":f,NaN:f,Infinity:f}}(),f=/[+\-*&%=<>!?|]/,i,j,o={atom:!0,number:!0,variable:!0,string:!0,regexp:!0},s={state:null,column:null,marked:null,cc:null},w={name:"this",next:{name:"arguments"}};return A.lex=!0,{startState:function(a){return{tokenize:l,reAllowed:!0,kwAllowed:!0,cc:[],lexical:new p((a||0)-c,0,"block",!1),localVars:b.localVars,context:b.localVars&&{vars:b.localVars},indented:0}},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation());if(a.eatSpace())return null;var c=b.tokenize(a,b);return i=="comment"?c:(b.reAllowed=i=="operator"||i=="keyword c"||!!i.match(/^[\[{}\(,;:]$/),b.kwAllowed=i!=".",r(b,c,i,j,a))},indent:function(a,b){if(a.tokenize!=l)return 0;var d=b&&b.charAt(0),e=a.lexical;e.type=="stat"&&d=="}"&&(e=e.prev);var f=e.type,g=d==f;return f=="vardef"?e.indented+4:f=="form"&&d=="{"?e.indented:f=="stat"||f=="form"?e.indented+c:e.info=="switch"&&!g?e.indented+(/^(?:case|default)\b/.test(b)?c:2*c):e.align?e.column+(g?0:1):e.indented+(g?0:c)},electricChars:":{}"}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMode("xml",function(a,b){function h(a,b){function c(c){return b.tokenize=c,c(a,b)}var d=a.next();if(d=="<"){if(a.eat("!"))return a.eat("[")?a.match("CDATA[")?c(k("atom","]]>")):null:a.match("--")?c(k("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),c(l(1))):null;if(a.eat("?"))return a.eatWhile(/[\w\._\-]/),b.tokenize=k("meta","?>"),"meta";g=a.eat("/")?"closeTag":"openTag",a.eatSpace(),f="";var e;while(e=a.eat(/[^\s\u00a0=<>\"\'\/?]/))f+=e;return b.tokenize=i,"tag"}if(d=="&"){var h;return a.eat("#")?a.eat("x")?h=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):h=a.eatWhile(/[\d]/)&&a.eat(";"):h=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),h?"atom":"error"}return a.eatWhile(/[^&<]/),null}function i(a,b){var c=a.next();return c==">"||c=="/"&&a.eat(">")?(b.tokenize=h,g=c==">"?"endTag":"selfcloseTag","tag"):c=="="?(g="equals",null):/[\'\"]/.test(c)?(b.tokenize=j(c),b.tokenize(a,b)):(a.eatWhile(/[^\s\u00a0=<>\"\'\/?]/),"word")}function j(a){return function(b,c){while(!b.eol())if(b.next()==a){c.tokenize=i;break}return"string"}}function k(a,b){return function(c,d){while(!c.eol()){if(c.match(b)){d.tokenize=h;break}c.next()}return a}}function l(a){return function(b,c){var d;while((d=b.next())!=null){if(d=="<")return c.tokenize=l(a+1),c.tokenize(b,c);if(d==">"){if(a==1){c.tokenize=h;break}return c.tokenize=l(a-1),c.tokenize(b,c)}}return"meta"}}function o(){for(var a=arguments.length-1;a>=0;a--)m.cc.push(arguments[a])}function p(){return o.apply(null,arguments),!0}function q(a,b){var c=d.doNotIndent.hasOwnProperty(a)||m.context&&m.context.noIndent;m.context={prev:m.context,tagName:a,indent:m.indented,startOfLine:b,noIndent:c}}function r(){m.context&&(m.context=m.context.prev)}function s(a){if(a=="openTag")return m.tagName=f,p(w,t(m.startOfLine));if(a=="closeTag"){var b=!1;return m.context?m.context.tagName!=f&&(d.implicitlyClosed.hasOwnProperty(m.context.tagName.toLowerCase())&&r(),b=!m.context||m.context.tagName!=f):b=!0,b&&(n="error"),p(u(b))}return p()}function t(a){return function(b){return b=="selfcloseTag"||b=="endTag"&&d.autoSelfClosers.hasOwnProperty(m.tagName.toLowerCase())?(v(m.tagName.toLowerCase()),p()):b=="endTag"?(v(m.tagName.toLowerCase()),q(m.tagName,a),p()):p()}}function u(a){return function(b){return a&&(n="error"),b=="endTag"?(r(),p()):(n="error",p(arguments.callee))}}function v(a){var b;for(;;){if(!m.context)return;b=m.context.tagName.toLowerCase();if(!d.contextGrabbers.hasOwnProperty(b)||!d.contextGrabbers[b].hasOwnProperty(a))return;r()}}function w(a){return a=="word"?(n="attribute",p(x,w)):a=="endTag"||a=="selfcloseTag"?o():(n="error",p(w))}function x(a){return a=="equals"?p(y,w):(d.allowMissing||(n="error"),a=="endTag"||a=="selfcloseTag"?o():p())}function y(a){return a=="string"?p(z):a=="word"&&d.allowUnquoted?(n="string",p()):(n="error",a=="endTag"||a=="selfCloseTag"?o():p())}function z(a){return a=="string"?p(z):o()}var c=a.indentUnit,d=b.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!1}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1},e=b.alignCDATA,f,g,m,n;return{startState:function(){return{tokenize:h,cc:[],indented:0,startOfLine:!0,tagName:null,context:null}},token:function(a,b){a.sol()&&(b.startOfLine=!0,b.indented=a.indentation());if(a.eatSpace())return null;n=g=f=null;var c=b.tokenize(a,b);b.type=g;if((c||g)&&c!="comment"){m=b;for(;;){var d=b.cc.pop()||s;if(d(g||c))break}}return b.startOfLine=!1,n||c},indent:function(a,b,d){var f=a.context;if(a.tokenize!=i&&a.tokenize!=h||f&&f.noIndent)return d?d.match(/^(\s*)/)[0].length:0;if(e&&/<!\[CDATA\[/.test(b))return 0;f&&/^<\//.test(b)&&(f=f.prev);while(f&&!f.startOfLine)f=f.prev;return f?f.indent+c:0},compareStates:function(a,b){if(a.indented!=b.indented||a.tokenize!=b.tokenize)return!1;for(var c=a.context,d=b.context;;c=c.prev,d=d.prev){if(!c||!d)return c==d;if(c.tagName!=d.tagName)return!1}},electricChars:"/"}}),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.mimeModes.hasOwnProperty("text/html")||CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0}),CodeMirror.defineMode("htmlmixed",function(a,b){function f(a,b){var f=c.token(a,b.htmlState);return f=="tag"&&a.current()==">"&&b.htmlState.context&&(/^script$/i.test(b.htmlState.context.tagName)?(b.token=h,b.localState=d.startState(c.indent(b.htmlState,"")),b.mode="javascript"):/^style$/i.test(b.htmlState.context.tagName)&&(b.token=i,b.localState=e.startState(c.indent(b.htmlState,"")),b.mode="css")),f}function g(a,b,c){var d=a.current(),e=d.search(b);return e>-1&&a.backUp(d.length-e),c}function h(a,b){return a.match(/^<\/\s*script\s*>/i,!1)?(b.token=f,b.localState=null,b.mode="html",f(a,b)):g(a,/<\/\s*script\s*>/,d.token(a,b.localState))}function i(a,b){return a.match(/^<\/\s*style\s*>/i,!1)?(b.token=f,b.localState=null,b.mode="html",f(a,b)):g(a,/<\/\s*style\s*>/,e.token(a,b.localState))}var c=CodeMirror.getMode(a,{name:"xml",htmlMode:!0}),d=CodeMirror.getMode(a,"javascript"),e=CodeMirror.getMode(a,"css");return{startState:function(){var a=c.startState();return{token:f,localState:null,mode:"html",htmlState:a}},copyState:function(a){if(a.localState)var b=CodeMirror.copyState(a.token==i?e:d,a.localState);return{token:a.token,localState:b,mode:a.mode,htmlState:CodeMirror.copyState(c,a.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(a,b){return a.token==f||/^\s*<\//.test(b)?c.indent(a.htmlState,b):a.token==h?d.indent(a.localState,b):e.indent(a.localState,b)},compareStates:function(a,b){return a.mode!=b.mode?!1:a.localState?CodeMirror.Pass:c.compareStates(a.htmlState,b.htmlState)},electricChars:"/{}:"}},"xml","javascript","css"),CodeMirror.defineMIME("text/html","htmlmixed"),CodeMirror.defineMode("css",function(a){function d(a,b){return c=b,a}function e(a,b){var c=a.next();if(c=="@")return a.eatWhile(/[\w\\\-]/),d("meta",a.current());if(c=="/"&&a.eat("*"))return b.tokenize=f,f(a,b);if(c=="<"&&a.eat("!"))return b.tokenize=g,g(a,b);if(c!="=")return c!="~"&&c!="|"||!a.eat("=")?c=='"'||c=="'"?(b.tokenize=h(c),b.tokenize(a,b)):c=="#"?(a.eatWhile(/[\w\\\-]/),d("atom","hash")):c=="!"?(a.match(/^\s*\w*/),d("keyword","important")):/\d/.test(c)?(a.eatWhile(/[\w.%]/),d("number","unit")):/[,.+>*\/]/.test(c)?d(null,"select-op"):/[;{}:\[\]]/.test(c)?d(null,c):(a.eatWhile(/[\w\\\-]/),d("variable","variable")):d(null,"compare");d(null,"compare")}function f(a,b){var c=!1,f;while((f=a.next())!=null){if(c&&f=="/"){b.tokenize=e;break}c=f=="*"}return d("comment","comment")}function g(a,b){var c=0,f;while((f=a.next())!=null){if(c>=2&&f==">"){b.tokenize=e;break}c=f=="-"?c+1:0}return d("comment","comment")}function h(a){return function(b,c){var f=!1,g;while((g=b.next())!=null){if(g==a&&!f)break;f=!f&&g=="\\"}return f||(c.tokenize=e),d("string","string")}}var b=a.indentUnit,c;return{startState:function(a){return{tokenize:e,baseIndent:a||0,stack:[]}},token:function(a,b){if(a.eatSpace())return null;var d=b.tokenize(a,b),e=b.stack[b.stack.length-1];if(c=="hash"&&e!="rule")d="string-2";else if(d=="variable")if(e=="rule")d="number";else if(!e||e=="@media{")d="tag";return e=="rule"&&/^[\{\};]$/.test(c)&&b.stack.pop(),c=="{"?e=="@media"?b.stack[b.stack.length-1]="@media{":b.stack.push("{"):c=="}"?b.stack.pop():c=="@media"?b.stack.push("@media"):e=="{"&&c!="comment"&&b.stack.push("rule"),d},indent:function(a,c){var d=a.stack.length;return/^\}/.test(c)&&(d-=a.stack[a.stack.length-1]=="rule"?2:1),a.baseIndent+d*b},electricChars:"}"}}),CodeMirror.defineMIME("text/css","css"),CodeMirror.defineMode("css",function(a){function d(a,b){return c=b,a}function f(a){for(var b=0;b<e.length;b++)if(a===e[b])return!0}function g(a,b){var c=a.next();if(c=="@")return a.eatWhile(/[\w\-]/),d("meta",a.current());if(c=="/"&&a.eat("*"))return b.tokenize=i,i(a,b);if(c=="<"&&a.eat("!"))return b.tokenize=j,j(a,b);if(c!="=")return c!="~"&&c!="|"||!a.eat("=")?c=='"'||c=="'"?(b.tokenize=k(c),b.tokenize(a,b)):c=="/"?a.eat("/")?(b.tokenize=h,h(a,b)):(a.eatWhile(/[\a-zA-Z0-9\-_.\s]/),/\/|\)|#/.test(a.peek()||a.eol()||a.eatSpace()&&a.peek()==")")?d("string","string"):d("number","unit")):c=="!"?(a.match(/^\s*\w*/),d("keyword","important")):/\d/.test(c)?(a.eatWhile(/[\w.%]/),d("number","unit")):/[,+<>*\/]/.test(c)?d(null,"select-op"):/[;{}:\[\]()]/.test(c)?c==":"?(a.eatWhile(/[active|hover|link|visited]/),a.current().match(/active|hover|link|visited/)?d("tag","tag"):d(null,c)):d(null,c):c=="."?(a.eatWhile(/[\a-zA-Z0-9\-_]/),d("tag","tag")):c=="#"?(a.eatWhile(/[A-Za-z0-9]/),a.current().length===4||a.current().length===7?a.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,false)!=null?a.current().substring(1)!=a.current().match(/[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/,false)?d("atom","tag"):(a.eatSpace(),/[\/<>.(){!$%^&*_\-\\?=+\|#'~`]/.test(a.peek())?d("atom","tag"):a.peek()=="}"?d("number","unit"):/[a-zA-Z\\]/.test(a.peek())?d("atom","tag"):a.eol()?d("atom","tag"):d("number","unit")):(a.eatWhile(/[\w\\\-]/),d("atom","tag")):(a.eatWhile(/[\w\\\-]/),d("atom","tag"))):c=="&"?(a.eatWhile(/[\w\-]/),d(null,c)):(a.eatWhile(/[\w\\\-_%.{]/),a.current().match(/http|https/)!=null?(a.eatWhile(/[\w\\\-_%.{:\/]/),d("string","string")):a.peek()=="<"||a.peek()==">"?d("tag","tag"):a.peek().match(/\(/)!=null?d(null,c):a.peek()=="/"&&b.stack[b.stack.length-1]!=undefined?d("string","string"):a.current().match(/\-\d|\-.\d/)?d("number","unit"):f(a.current())?d("tag","tag"):/\/|[\s\)]/.test(a.peek()||a.eol()||a.eatSpace()&&a.peek()=="/")&&a.current().indexOf(".")!==-1?a.current().substring(a.current().length-1,a.current().length)=="{"?(a.backUp(1),d("tag","tag")):a.eatSpace()&&a.peek().match(/[{<>.a-zA-Z]/)!=null||a.eol()?d("tag","tag"):d("string","string"):a.eol()?(a.current().substring(a.current().length-1,a.current().length)=="{"&&a.backUp(1),d("tag","tag")):d("variable","variable")):d(null,"compare");d(null,"compare")}function h(a,b){return a.skipToEnd(),b.tokenize=g,d("comment","comment")}function i(a,b){var c=!1,e;while((e=a.next())!=null){if(c&&e=="/"){b.tokenize=g;break}c=e=="*"}return d("comment","comment")}function j(a,b){var c=0,e;while((e=a.next())!=null){if(c>=2&&e==">"){b.tokenize=g;break}c=e=="-"?c+1:0}return d("comment","comment")}function k(a){return function(b,c){var e=!1,f;while((f=b.next())!=null){if(f==a&&!e)break;e=!e&&f=="\\"}return e||(c.tokenize=g),d("string","string")}}var b=a.indentUnit,c,e=["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","keygen","kbd","label","legend","li","link","map","mark","menu","meta","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strike","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr"];return{startState:function(a){return{tokenize:g,baseIndent:a||0,stack:[]}},token:function(a,b){if(a.eatSpace())return null;var d=b.tokenize(a,b),e=b.stack[b.stack.length-1];if(c=="hash"&&e=="rule")d="atom";else if(d=="variable")if(e=="rule")d=null;else if(!e||e=="@media{")d=a.current()=="when"?"variable":a.string.match(/#/g)!=undefined?null:/[\s,|\s\)]/.test(a.peek())?"tag":null;return e=="rule"&&/^[\{\};]$/.test(c)&&b.stack.pop(),c=="{"?e=="@media"?b.stack[b.stack.length-1]="@media{":b.stack.push("{"):c=="}"?b.stack.pop():c=="@media"?b.stack.push("@media"):e=="{"&&c!="comment"&&b.stack.push("rule"),d},indent:function(a,c){var d=a.stack.length;return/^\}/.test(c)&&(d-=a.stack[a.stack.length-1]=="rule"?2:1),a.baseIndent+d*b},electricChars:"}"}}),CodeMirror.defineMIME("text/x-less","less"),CodeMirror.mimeModes.hasOwnProperty("text/css")||CodeMirror.defineMIME("text/css","less"),function(){function f(){c=""}function g(a){c+=a}function h(b){return function(c){a+=b}}function i(){var b=parseInt(a);return a="",b||1}function j(a){for(var b=0,c=i();b<c;++b)a(b,b==c-1)}function k(a){return typeof a=="string"&&(a=CodeMirror.commands[a]),function(b){j(function(){a(b)})}}function l(a,b){for(var c in a)a.hasOwnProperty(c)&&b(c,a[c])}function m(a,b){for(var c in a)b(a[c])}function n(a){return a.slice(0,6)=="Shift-"?a.slice(0,1):a=="Space"?" ":a.length==3&&a[0]=="'"&&a[2]=="'"?a[1]:a.toLowerCase()}function p(a){if(a==" ")return"Space";var b=o.indexOf(a);return b!=-1?"'"+a+"'":a.toLowerCase()==a?a.toUpperCase():"Shift-"+a.toUpperCase()}function s(a,b,c,d){var e=0,f=-1;c>0&&(e=a.length,f=0);var g=e,h=e;a:for(;b!=e;b+=c)for(var i=0;i<d.length;++i)if(d[i].test(a.charAt(b+f))){g=b;for(;b!=e;b+=c)if(!d[i].test(a.charAt(b+f)))break;h=b;break a}return{from:Math.min(g,h),to:Math.max(g,h)}}function t(a,b,c,d){var e=a.getCursor(),f=e.ch,g=a.getLine(e.line),h;for(;;){h=s(g,f,c,b),f=h[d=="end"?"to":"from"];if(f!=e.ch||h.from==h.to)break;f=h[c<0?"from":"to"]}a.setCursor(e.line,h[d=="end"?"to":"from"],!0)}function u(a){var b=a.getCursor(),c=b.ch,d=a.getLine(b.line);CodeMirror.commands.goLineEnd(a),b.line!=a.lineCount()&&(CodeMirror.commands.goLineEnd(a),a.replaceSelection(" ","end"),CodeMirror.commands.delCharRight(a))}function v(a,b){var c=e[b];if(c===undefined)return;var d=a.getCursor().line,f=c>d?d:c,h=c>d?c:d;a.setCursor(f);for(var i=f;i<=h;i++)g("\n"+a.getLine(f)),a.removeLine(f)}function w(a,b){var c=e[b];if(c===undefined)return;var d=a.getCursor().line,f=c>d?d:c,h=c>d?c:d;for(var i=f;i<=h;i++)g("\n"+a.getLine(i));a.setCursor(f)}function x(a){var b=a.getCursor(),c=a.getLine(b.line).search(/\S/);a.setCursor(b.line,c==-1?line.length:c,!0)}function y(a,b,c){var d=a.getCursor(),e=a.getLine(d.line),f,g=n(b),h=c;return h.forward?(f=e.indexOf(g,d.ch+1),f!=-1&&h.inclusive&&(f+=1)):(f=e.lastIndexOf(g,d.ch),f!=-1&&!h.inclusive&&(f+=1)),f}function z(a,b,c){var d=y(a,b,c),e=a.getCursor();d!=-1&&a.setCursor({line:e.line,ch:d})}function A(a,b,c){var d=y(a,b,c),e=a.getCursor();d!==-1&&(c.forward?a.replaceRange("",{line:e.line,ch:e.ch},{line:e.line,ch:d}):a.replaceRange("",{line:e.line,ch:d},{line:e.line,ch:e.ch}))}function B(a){a||console.log("call enterInsertMode with 'cm' as an argument"),i(),a.setOption("keyMap","vim-insert")}function D(b){b[0]=function(b){a.length>0?h("0")(b):CodeMirror.commands.goLineStart(b)};for(var c=1;c<10;++c)b[c]=h(c)}function F(a){CodeMirror.keyMap["vim-prefix-m"][a]=function(b){e[a]=b.getCursor().line},CodeMirror.keyMap["vim-prefix-d'"][a]=function(b){v(b,a)},CodeMirror.keyMap["vim-prefix-y'"][a]=function(b){w(b,a)},CodeMirror.keyMap["vim-prefix-r"][a]=function(b){var c=b.getCursor();b.replaceRange(n(a),{line:c.line,ch:c.ch},{line:c.line,ch:c.ch+1}),CodeMirror.commands.goColumnLeft(b)},l(E,function(b,c){CodeMirror.keyMap["vim-prefix-"+b][a]=function(b){z(b,a,c)},CodeMirror.keyMap["vim-prefix-d"+b][a]=function(b){A(b,a,c)},CodeMirror.keyMap["vim-prefix-c"+b][a]=function(b){A(b,a,c),B(b)}})}var a="",b="f",c="",d=0,e=[],o="~`!@#$%^&*()_-+=[{}]\\|/?.,<>:;\"'1234567890",q=[/\w/,/[^\w\s]/],r=[/\S/],C=CodeMirror.keyMap.vim={"'|'":function(a){a.setCursor(a.getCursor().line,i()-1,!0)},"'^'":function(a){i(),x(a)},A:function(a){a.setCursor(a.getCursor().line,a.getCursor().ch+1,!0),B(a)},"Shift-A":function(a){CodeMirror.commands.goLineEnd(a),B(a)},I:function(a){B(a)},"Shift-I":function(a){x(a),B(a)},O:function(a){CodeMirror.commands.goLineEnd(a),CodeMirror.commands.newlineAndIndent(a),B(a)},"Shift-O":function(a){CodeMirror.commands.goLineStart(a),a.replaceSelection("\n","start"),a.indentLine(a.getCursor().line),B(a)},G:function(a){a.setOption("keyMap","vim-prefix-g")},"Shift-D":function(a){f(),e["Shift-D"]=a.getCursor(!1).line,a.setCursor(a.getCursor(!0).line),v(a,"Shift-D"),e=[]},S:function(a){k(function(a){CodeMirror.commands.delCharRight(a)})(a),B(a)},M:function(a){a.setOption("keyMap","vim-prefix-m"),e=[]},Y:function(a){a.setOption("keyMap","vim-prefix-y"),f(),d=0},"Shift-Y":function(a){f(),e["Shift-D"]=a.getCursor(!1).line,a.setCursor(a.getCursor(!0).line),w(a,"Shift-D"),e=[]},"/":function(a){var c=CodeMirror.commands.find;c&&c(a),b="f"},"'?'":function(a){var c=CodeMirror.commands.find;c&&(c(a),CodeMirror.commands.findPrev(a),b="r")},N:function(a){var c=CodeMirror.commands.findNext;c&&(b!="r"?c(a):CodeMirror.commands.findPrev(a))},"Shift-N":function(a){var c=CodeMirror.commands.findNext;c&&(b!="r"?CodeMirror.commands.findPrev(a):c.findNext(a))},"Shift-G":function(b){a==""?b.setCursor(b.lineCount()):b.setCursor(parseInt(a)-1),i(),CodeMirror.commands.goLineStart(b)},"'$'":function(a){k("goLineEnd")(a),a.getCursor().ch&&CodeMirror.commands.goColumnLeft(a)},nofallthrough:!0,style:"fat-cursor"};m(["d","t","T","f","F","c","r"],function(a){CodeMirror.keyMap.vim[p(a)]=function(b){b.setOption("keyMap","vim-prefix-"+a),f()}}),D(CodeMirror.keyMap.vim),l({H:"goColumnLeft",L:"goColumnRight",J:"goLineDown",K:"goLineUp",Left:"goColumnLeft",Right:"goColumnRight",Down:"goLineDown",Up:"goLineUp",Backspace:"goCharLeft",Space:"goCharRight",B:function(a){t(a,q,-1,"end")},E:function(a){t(a,q,1,"end")},W:function(a){t(a,q,1,"start")},"Shift-B":function(a){t(a,r,-1,"end")},"Shift-E":function(a){t(a,r,1,"end")},"Shift-W":function(a){t(a,r,1,"start")},X:function(a){CodeMirror.commands.delCharRight(a)},P:function(a){var b=a.getCursor().line;c!=""&&(CodeMirror.commands.goLineEnd(a),a.replaceSelection(c,"end")),a.setCursor(b+1)},"Shift-X":function(a){CodeMirror.commands.delCharLeft(a)},"Shift-J":function(a){u(a)},"Shift-P":function(a){var b=a.getCursor().line;c!=""&&(CodeMirror.commands.goLineUp(a),CodeMirror.commands.goLineEnd(a),a.replaceSelection(c,"end")),a.setCursor(b+1)},"'~'":function(a){var b=a.getCursor(),c=a.getRange({line:b.line,ch:b.ch},{line:b.line,ch:b.ch+1});c=c!=c.toLowerCase()?c.toLowerCase():c.toUpperCase(),a.replaceRange(c,{line:b.line,ch:b.ch},{line:b.line,ch:b.ch+1}),a.setCursor(b.line,b.ch+1)},"Ctrl-B":function(a){CodeMirror.commands.goPageUp(a)},"Ctrl-F":function(a){CodeMirror.commands.goPageDown(a)},"Ctrl-P":"goLineUp","Ctrl-N":"goLineDown",U:"undo","Ctrl-R":"redo"},function(a,b){C[a]=k(b)}),m(["vim-prefix-d'","vim-prefix-y'","vim-prefix-df","vim-prefix-dF","vim-prefix-dt","vim-prefix-dT","vim-prefix-c","vim-prefix-cf","vim-prefix-cF","vim-prefix-ct","vim-prefix-cT","vim-prefix-","vim-prefix-f","vim-prefix-F","vim-prefix-t","vim-prefix-T","vim-prefix-r","vim-prefix-m"],function(a){CodeMirror.keyMap[a]={auto:"vim",nofallthrough:!0}}),CodeMirror.keyMap["vim-prefix-g"]={E:k(function(a){t(a,q,-1,"start")}),"Shift-E":k(function(a){t(a,r,-1,"start")}),G:function(a){a.setCursor({line:0,ch:a.getCursor().ch})},auto:"vim",nofallthrough:!0,style:"fat-cursor"},CodeMirror.keyMap["vim-prefix-d"]={D:k(function(a){g("\n"+a.getLine(a.getCursor().line)),a.removeLine(a.getCursor().line)}),"'":function(a){a.setOption("keyMap","vim-prefix-d'"),f()},E:k("delWordRight"),B:k("delWordLeft"),auto:"vim",nofallthrough:!0,style:"fat-cursor"},D(CodeMirror.keyMap["vim-prefix-d"]),CodeMirror.keyMap["vim-prefix-c"]={E:function(a){k("delWordRight")(a),B(a)},B:function(a){k("delWordLeft")(a),B(a)},C:function(a){j(function(b,c){CodeMirror.commands.deleteLine(a),b&&(CodeMirror.commands.delCharRight(a),c&&CodeMirror.commands.deleteLine(a))}),B(a)},auto:"vim",nofallthrough:!0,style:"fat-cursor"},m(["vim-prefix-d","vim-prefix-c","vim-prefix-"],function(a){m(["f","F","T","t"],function(b){CodeMirror.keyMap[a][p(b)]=function(c){c.setOption("keyMap",a+b),f()}})});var E={t:{inclusive:!1,forward:!0},f:{inclusive:!0,forward:!0},T:{inclusive:!1,forward:!1},F:{inclusive:!0,forward:!1}};for(var G=65;G<91;G++){var H=String.fromCharCode(G);F(p(H)),F(p(H.toLowerCase()))}m(o,function(a){F(p(a))}),F("Space"),CodeMirror.keyMap["vim-prefix-y"]={Y:k(function(a){g("\n"+a.getLine(a.getCursor().line+d)),d++}),"'":function(a){a.setOption("keyMap","vim-prefix-y'"),f()},auto:"vim",nofallthrough:!0,style:"fat-cursor"},CodeMirror.keyMap["vim-insert"]={Esc:function(a){a.setCursor(a.getCursor().line,a.getCursor().ch-1,!0),a.setOption("keyMap","vim")},"Ctrl-N":"autocomplete","Ctrl-P":"autocomplete",fallthrough:["default"]}}(),function(){_.def("Luca.tools.ApplicationInspector")["extends"]("Luca.core.Container")["with"]({name:"application_inspector"})}.call(this),function(){var a,b;a=Luca.Model.extend({defaults:{_current:"default",_namespace:"default",_compiled:[]},initialize:function(a){return this.attributes=a!=null?a:{},Luca.Model.prototype.initialize.apply(this,arguments),this.fetch({silent:!0})},requireCompilation:function(){return this.get("_compiled")},bufferKeys:function(){var a,b,c,d;if(this.bufferNames!=null)return this.bufferNames;c=this.attributes,d=[];for(a in c)b=c[a],a.match(/_/)||d.push(a);return d},namespacedBuffer:function(a){return""+this.get("_namespace")+":"+a},bufferValues:function(){return _(this.attributes).pick(this.bufferKeys())},fetch:function(a){var b=this;return a==null&&(a={}),a.silent||(a.silent=!0),_(this.bufferKeys()).each(function(c){var d;d=typeof localStorage!="undefined"&&localStorage!==null?localStorage.getItem(b.namespacedBuffer(c)):void 0;if(d!=null)return b.set(c,d,{silent:a.silent===!0})}),this},persist:function(){var a=this;return _(this.bufferKeys()).each(function(b){var c;return c=a.get(b),typeof localStorage!="undefined"&&localStorage!==null?localStorage.setItem(a.namespacedBuffer(b),c):void 0}),this},currentContent:function(){var a;return a=this.get("_current"),this.get(a)}}),b={coffeescript:function(a){return CoffeeScript.compile(a,{bare:!0})},"default":function(a){return a}},_.def("Luca.tools.CodeEditor")["extends"]("Luca.components.Panel")["with"]({name:"code_editor",id:"editor_container",autoBindEventHandlers:!0,bodyClassName:"codemirror-wrapper",defaultValue:"",compilationEnabled:!1,bufferNamespace:"luca:code",namespace:function(a,b){var c;return b==null&&(b={}),a!=null&&(this.bufferNamespace=a,(c=this.buffers)!=null&&c.set("_namespace",a,{silent:b.silent===!0})),this.bufferNamespace},initialize:function(a){return this.options=a,this._super("initialize",this,arguments),_.bindAll(this,"onCompiledCodeChange","onBufferChange","onEditorChange"
|
15
|
-
,"stripTabs"),this.mode||(this.mode="coffeescript"),this.theme||(this.theme="monokai"),this.keyMap||(this.keyMap="vim"),this.lineWrapping||(this.lineWrapping=!0),this.compiler=b[this.mode]||b["default"],this.setupBuffers()},setWrap:function(a){return this.lineWrapping=a,this.editor.setOption("lineWrapping",this.lineWrapping)},setMode:function(a){return this.mode=a,this.editor.setOption("mode",this.mode),this},setKeyMap:function(a){return this.keyMap=a,this.editor.setOption("keyMap",this.keyMap),this},setTheme:function(a){return this.theme=a,this.editor.setOption("theme",this.theme),this},setupBuffers:function(){var b,c,d=this;return b=_.extend(this.currentBuffers||{},{_compiled:this.compiledBuffers,_namespace:this.namespace()}),this.buffers=new a(b),c=this,_(this.buffers.bufferKeys()).each(function(a){return d.buffers.bind("change:"+a,function(){return d.onBufferChange.apply(d,arguments)})}),_(this.buffers.requireCompilation()).each(function(a){return d.buffers.bind("change:compiled_"+a,d.onCompiledCodeChange)}),this.buffers.bind("change:_current",function(a,b){return c.trigger("buffer:change"),c.editor.setValue(d.buffers.currentContent()||"")}),this.monitorChanges=!0},currentBuffer:function(){return this.buffers.get("_current")},loadBuffer:function(a,b){return b==null&&(b=!0),b&&this.saveBuffer(),this.buffers.set("_current",a)},saveBuffer:function(){return localStorage.setItem(this.buffers.namespacedBuffer(this.currentBuffer()),this.editor.getValue()),this.buffers.set(this.currentBuffer(),this.editor.getValue())},getBuffer:function(a,b){var c,d;return b==null&&(b=!1),a||(a=this.currentBuffer()),c=this.buffers.get(a),b!==!0?c:(d=this.buffers.get("compiled_"+a),_.string.isBlank(d)&&(d=this.compileCode(c,a)),d)},editorOptions:function(){return{mode:this.mode,theme:this.theme,keyMap:this.keyMap,lineNumbers:!0,gutter:!0,autofocus:!0,onChange:this.onEditorChange,onKeyEvent:this.stripTabs,passDelay:50,autoClearEmptyLines:!0,smartIndent:!1,tabSize:2,electricChars:!1}},beforeRender:function(){var a,b;return(b=Luca.components.Panel.prototype.beforeRender)!=null&&b.apply(this,arguments),a={"min-height":this.minHeight,background:"#272822",color:"#f8f8f2"},this.$bodyEl().css(a),this.$html("<textarea></textarea>")},afterRender:function(){var a=this;return _.defer(function(){return a.editor=window.CodeMirror.fromTextArea(a.$("textarea")[0],a.editorOptions()),a.restore(),a.enableTabStripping=!0})},save:function(){return this.saveBuffer()},restore:function(){return this.editor.setValue(""),this.editor.refresh()},replaceTabWithSpace:function(){},stripTabs:function(a,b){var c,d;return(b!=null?b.keyCode:void 0)===9&&(d=this.editor.cursorCoords(),c=this.getValue().replace(/\t/g," "),this.setValue(c),this.editor.setCursor(d)),!1},onEditorChange:function(){if(this.monitorChanges)return this.save()},onBufferChange:function(a,b,c){var d,e=this;return d=a.previousAttributes(),_(this.buffers.bufferKeys()).each(function(a){var b;if(d[a]!==e.buffers.get(a)){if(!_(e.buffers.requireCompilation()).include(a))return e.trigger("code:change:"+a,e.buffers.get(a)),e.buffers.persist(a);b=e.compileCode(e.buffers.get(a),a);if(b.success===!0)return e.buffers.persist(a),e.buffers.set("compiled_"+a,b.compiled,{silent:!0})}}),this.buffers.change()},onCompiledCodeChange:function(a,b,c){var d,e,f,g,h;e=_(a.changedAttributes()).keys(),this.trigger("code:change",e),h=[];for(f=0,g=e.length;f<g;f++)d=e[f],h.push(this.trigger("code:change:"+d,d));return h},compileCode:function(a,b){var c,d;b||(b=this.currentBuffer()),a||(a=this.getBuffer(b,!1)),c="",d={success:!0,compiled:""};try{c=this.compiler.call(this,a),this.trigger("compile:success",a,c),d.compiled=c}catch(e){this.trigger("compile:error",e,a),d.success=!1,d.compiled=this.buffers.get("compiled_"+b)}return d},getCompiledCode:function(a){return a=this.getBuffer(a),_.string.strip(this.compileCode(a))},getValue:function(){return this.editor.getValue()},setValue:function(a){return a=a.replace(/\t/g," "),this.editor.setValue(a)}})}.call(this),function(){var a;a={readOnly:!1,lineNumbers:!0,gutter:!0,autofocus:!1,passDelay:50,autoClearEmptyLines:!0,smartIndent:!1,tabSize:2,electricChars:!1},Luca.define("Luca.tools.CodeMirrorField")["extends"]("Luca.components.Panel")["with"]({bodyClassName:"codemirror-wrapper",preProcessors:[],postProcessors:[],codemirrorOptions:function(){var b,c,d=this;return c=_.clone(a),b={mode:this.mode||"coffeescript",theme:this.theme||"monokai",keyMap:this.keyMap||"basic",lineNumbers:this.lineNumbers!=null?this.lineNumbers:a.lineNumbers,readOnly:this.readOnly!=null?this.readOnly:a.readOnly,gutter:this.gutter!=null?this.gutter:a.gutter,lineWrapping:this.lineWrapping===!0,onChange:function(){var a;return d.trigger("editor:change",d),(a=d.onEditorChange)!=null?a.call(d):void 0}},this.onKeyEvent!=null&&(b.onKeyEvent=_.bind(this.onKeyEvent,this)),_.extend(c,b)},getCodeMirror:function(){return this.instance},getValue:function(a){var b;return a==null&&(a=!0),b=this.getCodeMirror().getValue()},setValue:function(a,b){return a==null&&(a=""),b==null&&(b=!0),this.getCodeMirror().setValue(a)},afterRender:function(){return this.instance=CodeMirror(this.$bodyEl()[0],this.codemirrorOptions()),this.setMaxHeight(),this.setHeight()},setMaxHeight:function(a,b){a==null&&(a=void 0),b==null&&(b=!0),a||(a=this.maxHeight);if(a==null)return;this.$(".CodeMirror-scroll").css("max-height",a);if(b===!0)return this.$(".CodeMirror-scroll").css("height",a)},setHeight:function(a){a==null&&(a=void 0);if(a!=null)return this.$(".CodeMirror-scroll").css("height",a)}})}.call(this),function(){_.def("Luca.tools.CoffeeEditor")["extends"]("Luca.tools.CodeMirrorField")["with"]({name:"coffeescript_editor",autoCompile:!0,compileOptions:{bare:!0},hooks:["editor:change"],initialize:function(a){var b;return this.options=a,Luca.tools.CodeMirrorField.prototype.initialize.apply(this,arguments),_.bindAll(this,"editorChange","toggleSource"),b=this,this.state=new Luca.Model({currentMode:"coffeescript",coffeescript:"",javascript:""}),this.state.bind("change:coffeescript",function(a){var c;return b.trigger("change:coffeescript"),c=a.get("coffeescript"),b.compile(c,function(b){return a.set("javascript",b)})}),this.state.bind("change:javascript",function(a){var c;return(c=b.onJavascriptChange)!=null?c.call(b,a.get("javascript")):void 0}),this.state.bind("change:currentMode",function(a){return a.get("currentMode")==="javascript"?b.setValue(a.get("javascript")):b.setValue(a.get("coffeescript"))})},compile:function(a,b){var c,d;d={},a||(a=this.getValue());try{return c=CoffeeScript.compile(a,this.compileOptions),b!=null&&b.call(this,c),d={success:!0,compiled:c}}catch(e){return this.trigger("compile:error",e,a),d={success:!1,compiled:"",message:e.message}}},toggleMode:function(){if(this.currentMode()==="coffeescript")return this.state.set("currentMode","javascript");if(this.currentMode()==="javascript")return this.state.set("currentMode","coffeescript")},currentMode:function(){return this.state.get("currentMode")},getCoffeescript:function(){return this.state.get("coffeescript")},getJavascript:function(a){var b,c;a==null&&(a=!1),b=this.state.get("javascript");if(a===!0||(b!=null?b.length:void 0)===0)c=this.compile(this.getCoffeescript()),b=c!=null?c.compiled:void 0;return b},editorChange:function(){if(this.autoCompile===!0)return this.state.set(this.currentMode(),this.getValue())}})}.call(this),function(){_.def("Luca.tools.CollectionInspector")["extends"]("Luca.View")["with"]({name:"collection_inspector",className:"collection-inspector"})}.call(this),function(){_.def("Luca.app.Components")["extends"]("Luca.Collection")["with"]({cachedMethods:["namespaces","classes","roots","views","collections","models"],cache_key:"luca_components",name:"components",initialize:function(){return this.model=Luca.app.Component,Luca.Collection.prototype.initialize.apply(this,arguments)},url:function(){return"/luca/source-map.js"},collections:function(){return this.select(function(a){return Luca.isCollectionPrototype(a.definition())})},modelClasses:function(){return this.select(function(a){return Luca.isModelPrototype(a.definition())})},views:function(){return this.select(function(a){return Luca.isViewPrototype(a.definition())})},classes:function(){return _.uniq(this.pluck("className"))},roots:function(){return _.uniq(this.invoke("root"))},namespaces:function(){return _.uniq(this.invoke("namespace"))},asTree:function(){var a,b,c,d;return a=this.classes(),b=this.namespaces(),c=this.roots(),d=_(c).inject(function(a,c){var d;return a[c]||(a[c]={}),d=new RegExp("^"+c),a[c]=_(b).select(function(a){return d.exec(a)&&_(b).include(a)&&a.split(".").length===2}),a},{}),_(d).inject(function(a,b,c){return a[c]={},_(b).each(function(b){return a[c][b]={}}),a},{})}})}.call(this),function(){_.def("Luca.app.Instances")["extends"]("Luca.Collection")["with"]({name:"instances",refresh:function(a){var b;return a==null&&(a={}),b=_(Luca.registry.instances()).map(function(a){return{cid:a.cid,name:a.name,ctype:a.ctype,displayName:a.displayName||a.prototype.displayName,object:a}}),this.reset(b,a)},initialize:function(a,b){return a==null&&(a=[]),this.options=b!=null?b:{},this.model=Luca.app.Instance,Luca.Collection.prototype.initialize.apply(this,arguments)}})}.call(this),function(){var ComponentPicker,bufferNames,compiledBuffers,defaults;defaults={},defaults.setup="# the setup tab contains code which is run every time\n# prior to the 'implementation' run",defaults.component="# the component tab is where you handle the definition of the component\n# that you are trying to test. it will render its output into the\n# output panel of the code tester\n#\n# example definition:\n#\n# _.def('MyComponent').extends('Luca.View').with\n# bodyTemplate: 'sample/welcome'",defaults.teardown="# the teardown tab is where you undo / cleanup any of the operations\n# from setup / implementation",defaults.implementation="# the implementation tab is where you specify options for your component.\n#\n# NOTE: the component tester uses whatever is returned from evalulating\n# the code in this tab. if it responds to render(), it will append\n# render().el to the output panel. if it is an object, then we will attempt\n# to create an instance of the component you defined with the object as",defaults.style="/*\n * customize the styles that effect this component\n * note, all styles here will be scoped to only effect\n * the output panel :)\n*/",defaults.html="",bufferNames=["setup","implementation","component","style","html"],compiledBuffers=["setup","implementation","component"],ComponentPicker=Luca.fields.TypeAheadField.extend({name:"component_picker",label:"Choose a component to edit",initialize:function(){return this.collection=new Luca.collections.Components,this.collection.fetch(),this._super("initialize",this,arguments)},getSource:function(){return this.collection.classes()},change_handler:function(){var a,b,c=this;return b=this.getValue(),a=this.collection.find(function(a){return a.get("className")===b}),a.fetch({success:function(a,b){if((b!=null?b.source.length:void 0)>0)return c.trigger("component:fetched",b.source,b.className)}}),this.hide()},createWrapper:function(){return this.make("div",{"class":"component-picker span4 well",style:"position: absolute; z-index:12000"})},show:function(){return this.$el.parent().show()},hide:function(){return this.$el.parent().hide()},toggle:function(){return this.$el.parent().toggle()}}),_.def("Luca.tools.ComponentTester")["extends"]("Luca.core.Container")["with"]({id:"component_tester",name:"component_tester",autoEvaluateCode:!0,currentSize:1,sizes:[{icon:"resize-full",value:function(){return $(window).height()*.3}},{icon:"resize-small",value:function(){return $(window).height()*.6}}],components:[{ctype:"card_view",name:"component_detail",activeCard:0,components:[{ctype:"panel",name:"component_tester_output",bodyTemplate:"component_tester/help"}]},{ctype:"code_editor",name:"ctester_edit",className:"font-large fixed-height",minHeight:"350px",currentBuffers:defaults,compiledBuffers:["component","setup","implementation"],topToolbar:{buttons:[{icon:"resize-full",align:"right",description:"change the size of the component tester editor",eventId:"toggle:size"},{icon:"pause",align:"right",description:"Toggle auto-evaluation of test script on code change",eventId:"click:autoeval"},{icon:"plus",description:"add a new component to test",eventId:"click:add"},{icon:"folder-open",description:"open an existing component's definition",eventId:"click:open"}]},bottomToolbar:{buttons:[{group:!0,wrapper:"span4",buttons:[{label:"View Javascript",description:"Switch between compiled JS and Coffeescript",eventId:"toggle:mode"}]},{group:!0,wrapper:"span6 offset4",buttons:[{label:"Component",eventId:"edit:component",description:"Edit the component itself"},{label:"Setup",eventId:"edit:setup",description:"Edit the setup for your component test"},{label:"Implementation",eventId:"edit:implementation",description:"Implement your component"},{label:"Markup",eventId:"edit:markup",description:"Edit the HTML produced by the component"},{label:"CSS",eventId:"edit:style",description:"Edit CSS"}]},{group:!0,align:"right",buttons:[{icon:"question-sign",align:"right",eventId:"click:help",description:"Help"},{icon:"cog",align:"right",eventId:"click:settings",description:"component tester settings"},{icon:"eye-close",align:"right",eventId:"click:hide",description:"hide the tester controls"},{icon:"heart",eventId:"click:console",description:"Coffeescript Console",align:"right"}]}]}}],debugMode:!0,componentEvents:{"ctester_edit click:autoeval":"toggleAutoeval","ctester_edit click:refresh":"refreshCode","ctester_edit click:hide":"toggleControls","ctester_edit click:settings":"toggleSettings","ctester_edit click:add":"addComponent","ctester_edit click:open":"openComponent","ctester_edit click:help":"showHelp","ctester_edit click:console":"toggleConsole","ctester_edit eval:error":"onError","ctester_edit eval:success":"onSuccess","ctester_edit edit:setup":"editSetup","ctester_edit edit:teardown":"editTeardown","ctester_edit edit:component":"editComponent","ctester_edit edit:style":"editStyle","ctester_edit edit:markup":"editMarkup","ctester_edit edit:implementation":"editImplementation","ctester_edit toggle:keymap":"toggleKeymap","ctester_edit toggle:mode":"toggleMode","ctester_edit code:change:html":"onMarkupChange","ctester_edit code:change:style":"onStyleChange","ctester_edit toggle:size":"toggleSize"},initialize:function(){var a,b,c;Luca.core.Container.prototype.initialize.apply(this,arguments),c=this.componentEvents;for(a in c)b=c[a],this[b]=_.bind(this[b],this);return this.defer("editComponent").until("after:render")},afterRender:function(){var a,b=this;return a=_.idleMedium(function(){if(b.autoEvaluateCode===!0)return b.applyTestRun()},500),this.getEditor().bind("code:change",a)},getEditor:function(){return Luca("ctester_edit")},getDetail:function(){return Luca("component_detail")},getOutput:function(){return this.getDetail().findComponentByName("component_tester_output")},onError:function(a,b){return console.log("Error in "+b,a,a.message,a.stack)},onSuccess:function(a,b){var c;b==="component"&&(this.componentDefinition=a);if(b==="implementation"){Luca.isBackboneView(a)?c=a:_.isObject(a)&&a.ctype!=null?c=Luca(a):_.isObject(a)&&_.isFunction(this.componentDefinition)&&(c=new this.componentDefinition(a));if(Luca.isBackboneView(c))return this.getOutput().$html(c.render().el)}},applyTestRun:function(){var a,b,c,d;this.getOutput().$html(""),c=this.getTestRun(),d=[];for(a in c)b=c[a],d.push(this.evaluateCode(b,a));return d},toggleConsole:function(a){var b;return this.developmentConsole=Luca("coffeescript-console",function(){return new Luca.tools.DevelopmentConsole({name:"coffeescript-console"})}),this.consoleContainerAppended||(b=this.make("div",{id:"devtools-console-wrapper","class":"devtools-console-container modal",style:"width:900px;height:650px;"},this.developmentConsole.el),$("body").append(b),this.consoleContainerAppended=!0,this.developmentConsole.render()),$("#devtools-console-wrapper").modal({backdrop:!1,show:!0})},toggleAutoeval:function(a){var b,c;return this.autoEvaluateCode=this.autoEvaluateCode!==!0,!this.started&&this.autoEvaluateCode===!0&&(this.started=!0,this.applyTestRun()),c=a.children("i").eq(0),b=this.autoEvaluateCode?"icon-pause":"icon-play",c.removeClass(),c.addClass(b),this},showEditor:function(a){return this.getEditor().$(".toolbar-container.top").toggle(a),this.getEditor().$(".codemirror-wrapper").toggle(a),this.trigger("controls:toggled")},toggleKeymap:function(a){var b;return b=this.getEditor().keyMap==="vim"?"basic":"vim",this.getEditor().setKeyMap(b),a.html(_.string.capitalize(b))},toggleMode:function(a){var b;return b=this.getEditor().mode==="coffeescript"?"javascript":"coffeescript",this.getEditor().setMode(b),a.html(_.string.capitalize(b==="coffeescript"?"View Javascript":"View Coffeescript")),this.editBuffer(this.currentBufferName,b==="javascript")},toggleSize:function(a){var b,c,d,e;return c=this.currentSize++%this.sizes.length,e=this.sizes[c].value(),d=this.sizes[c].icon,a!=null&&(b=a.children("i").eq(0),b.removeClass().addClass("icon-"+d)),this.$(".codemirror-wrapper").css("height",""+parseInt(e)+"px"),this.getEditor().refresh()},toggleControls:function(a){var b=this;return this.bind("controls:toggled",function(){var c,d;return d=a.children("i").eq(0),d.removeClass(),c=b.getEditor().$(".toolbar-container.top").is(":visible")?"icon-eye-close":"icon-eye-open",d.addClass(c)}),this.showEditor(),this},toggleSettings:function(){return this},setValue:function(a,b){var c;return b==null&&(b="component"),c=this.getEditor().editor.getOption("mode")==="javascript",this.editBuffer(b,c,!1).getEditor().setValue(a)},editBuffer:function(a,b,c){var d;return this.currentBufferName=a,b==null&&(b=!1),c==null&&(c=!0),this.showEditor(!0),this.highlight(this.currentBufferName),d=b?"compiled_"+this.currentBufferName:this.currentBufferName,this.getEditor().loadBuffer(d,c),this},editMarkup:function(){return this.getEditor().setMode("htmlmixed"),this.getEditor().setWrap(!0),this.editBuffer("html").setValue(this.getOutput().$html(),"html")},editStyle:function(){return this.getEditor().setMode("css"),this.editBuffer("style")},editComponent:function(){return this.getEditor().setMode("coffeescript"),this.editBuffer("component")},editTeardown:function(){return this.getEditor().setMode("coffeescript"),this.editBuffer("teardown")},editSetup:function(){return this.getEditor().setMode("coffeescript"),this.editBuffer("setup")},editImplementation:function(){return this.getEditor().setMode("coffeescript"),this.editBuffer("implementation")},getTestRun:function(){var a,b,c,d,e,f;b=this.getEditor(),c={},f=["component","setup","implementation"];for(d=0,e=f.length;d<e;d++)a=f[d],c[a]=b.getBuffer(a,!0);return c},getContext:function(){return Luca.util.resolve(this.context||(this.context="window"))},evaluateCode:function(code,bufferId,compile){var compiled,evaluator,result;compile==null&&(compile=!1),code||(code=this.getEditor().getValue()),compiled=compile===!0?this.getEditor().compileCode(code):code,evaluator=function(){return eval(compiled)};try{return result=evaluator.call(this.getContext()),this.onSuccess(result,bufferId,code)}catch(error){return this.onError(error,bufferId,code)}},onMarkupChange:function(){if(this.autoEvaluateCode===!0)return this.getOutput().$html(this.getEditor().getValue())},onStyleChange:function(){var a,b,c;if(this.autoEvaluateCode===!0){$("#component-tester-stylesheet").remove(),a=(c=this.getEditor())!=null?c.getValue():void 0;if(a)return b=this.make("style",{type:"text/css",id:"component-tester-stylesheet"}),$("head").append(b),$(b).append(a)}},showHelp:function(){return this.getOutput().$html(Luca.template("component_tester/help",this))},addComponent:function(a){},openComponent:function(a){var b=this;this.componentPicker||(this.componentPicker=new ComponentPicker),this.componentPicker.bind("component:fetched",function(a,c){return b.setEditorNamespace(c).setValue(a,"component")});if(!this.getEditor().$(".component-picker").length>0){this.getEditor().$(".codemirror-wrapper").before(this.componentPicker.createWrapper()),this.getEditor().$(".component-picker").html(this.componentPicker.render().el),this.componentPicker.show();return}return this.componentPicker.toggle()},highlight:function(a){return this.$("a.btn[data-eventid='edit:"+a+"']").siblings().css("font-weight","normal"),this.$("a.btn[data-eventid='edit:"+a+"']").css("font-weight","bold")},setEditorNamespace:function(a){return this.getEditor().namespace(a),this.getEditor().buffers.fetch(),this}})}.call(this),function(){var codeMirrorOptions,_base;codeMirrorOptions={readOnly:!0,autoFocus:!1,theme:"monokai",mode:"javascript"},Luca.define("Luca.tools.DevelopmentConsole")["extends"]("Luca.core.Container")["with"]({className:"luca-ui-console",name:"console",history:[],historyIndex:0,componentEvents:{"code_input key:keyup":"historyUp","code_input key:keydown":"historyDown","code_input key:enter":"runCommand"},compileOptions:{bare:!0},components:[{ctype:"code_mirror_field",additionalClassNames:"clearfix",name:"code_output",readOnly:!0,lineNumbers:!1,mode:"javascript",lineWrapping:!0,gutter:!1},{ctype:"text_field",name:"code_input",lineNumbers:!1,height:"30px",maxHeight:"30px",gutter:!1,autoBindEventHandlers:!0,hideLabel:!0,prepend:"Coffee>",events:{"keypress input":"onKeyEvent","keydown input":"onKeyEvent"},onKeyEvent:function(a){a.type==="keypress"&&a.keyCode===Luca.keys.ENTER&&this.trigger("key:enter",this.getValue()),a.type==="keydown"&&a.keyCode===Luca.keys.KEYUP&&this.trigger("key:keyup");if(a.type==="keydown"&&a.keyCode===Luca.keys.KEYDOWN)return this.trigger("key:keydown")},afterRender:function(){return this.$("input").focus()}}],afterRender:function(){return this.$container().modal({backdrop:!1}),this.$container.css},show:function(a){return a==null&&(a={}),this.$container().modal("show"),this},getContext:function(){return window},initialize:function(){return this._super("initialize",this,arguments),_.bindAll(this,"historyUp","historyDown","onSuccess","onError","runCommand")},saveHistory:function(a){return(a!=null?a.length:void 0)>0&&this.history.push(a),this.historyIndex=0},historyUp:function(){var a;return this.historyIndex-=1,this.historyIndex<0&&(this.historyIndex=0),a=Luca("code_input").getValue(),Luca("code_input").setValue(this.history[this.historyIndex]||a)},historyDown:function(){var a;return this.historyIndex+=1,this.historyIndex>this.history.length-1&&(this.historyIndex=this.history.length-1),a=Luca("code_input").getValue(),Luca("code_input").setValue(this.history[this.historyIndex]||a)},append:function(a,b,c){var d,e,f,g;return c==null&&(c=!1),e=Luca("code_output"),d=e.getValue(),a!=null&&(g="// "+a),f=c||a.match(/^console\.log/)?[d,b]:[d,g,b],e.setValue(_.compact(f).join("\n")),e.getCodeMirror().scrollTo(0,9e4)},onSuccess:function(a,b,c){var d;return this.saveHistory(c),d=JSON.stringify(a,null," "),d||(d=typeof a.toString=="function"?a.toString():void 0),this.append(b,d||"undefined")},onError:function(a,b,c){return this.append(b,"// ERROR: "+a.message)},evaluateCode:function(code,raw){var dev,evaluator,output,result;if(!((code!=null?code.length:void 0)>0))return;raw=_.string.strip(raw),output=Luca("code_output"),dev=this,evaluator=function(){var console,log,old_console,result;old_console=window.console,console={log:function(){var a,b,c,d;d=[];for(b=0,c=arguments.length;b<c;b++)a=arguments[b],d.push(dev.append(void 0,a,!0));return d}},log=console.log;try{result=eval(code)}catch(error){throw window.console=old_console,error}return window.console=old_console,result};try{result=evaluator.call(this.getContext());if(!raw.match(/^console\.log/))return this.onSuccess(result,code,raw)}catch(error){return this.onError(error,code,raw)}},runCommand:function(){var a,b,c,d;return c=this,a=_.bind(Luca.tools.CoffeeEditor.prototype.compile,this),d=Luca("code_input").getValue(),b=a(d,function(a){return c.evaluateCode(a,d)})}}),(_base=Luca.util).launchers||(_base.launchers={}),Luca.util.launchers.developmentConsole=function(a){var b=this;return a==null&&(a="luca-development-console"),this._lucaDevConsole=Luca(a,function(){var c;return b.$el.append(Backbone.View.prototype.make("div",{id:""+a+"-wrapper","class":"modal fade"})),c=new Luca.tools.DevelopmentConsole({name:a,container:"#"+a+"-wrapper"}),c.render()}),this._lucaDevConsole.show()}}.call(this),function(){_.def("Luca.app.Component")["extends"]("Luca.Model")["with"]({root:function(){return this.get("className").split(".")[0]},className:function(){return this.get("className")},instances:function(){return Luca.registry.findInstancesByClassName(this.className())},definitionPrototype:function(){var a;return(a=this.definition())!=null?a.prototype:void 0},parentClasses:function(){return Luca.parentClasses(this.className())},definition:function(){return Luca.util.resolve(this.className())},namespace:function(){var a;return this.get("className")==null?"":(a=this.get("className").split("."),a.pop(),a.join("."))}})}.call(this),function(){_.def("Luca.app.Instance")["extends"]("Luca.Model")["with"]({version:1})}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["component_tester/help"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<h1>Component Tester</h1>\n<p>This is a tool that enables you to build and test Luca components in an isolated sandbox environment. The editor is currently enabled with vim keybindings</p>\n<h3>Setup</h3>\n<p>This is where you setup any data requirements needed for the test to work. This is run every time before the implementation code is ran.</p>\n<h3>Teardown</h3>\n<p>This is where you clean up after the tests. This will be run every time after the implementation code is ran.</p>\n<h3>Definitions</h3>\n<p>This is where you define the component you will be testing. This is usually the code you will be shipping once you have completed testing.</p>\n<h3>Implementation</h3>\n<p>This is where you create an instance of the component and specify any of the necessary configuration settings. The component will be rendered into the output panel of the component tester.</p>\n");return __p.join("")}}.call(this),function(){}.call(this);
|
15
|
+
,"stripTabs"),this.mode||(this.mode="coffeescript"),this.theme||(this.theme="monokai"),this.keyMap||(this.keyMap="vim"),this.lineWrapping||(this.lineWrapping=!0),this.compiler=b[this.mode]||b["default"],this.setupBuffers()},setWrap:function(a){return this.lineWrapping=a,this.editor.setOption("lineWrapping",this.lineWrapping)},setMode:function(a){return this.mode=a,this.editor.setOption("mode",this.mode),this},setKeyMap:function(a){return this.keyMap=a,this.editor.setOption("keyMap",this.keyMap),this},setTheme:function(a){return this.theme=a,this.editor.setOption("theme",this.theme),this},setupBuffers:function(){var b,c,d=this;return b=_.extend(this.currentBuffers||{},{_compiled:this.compiledBuffers,_namespace:this.namespace()}),this.buffers=new a(b),c=this,_(this.buffers.bufferKeys()).each(function(a){return d.buffers.bind("change:"+a,function(){return d.onBufferChange.apply(d,arguments)})}),_(this.buffers.requireCompilation()).each(function(a){return d.buffers.bind("change:compiled_"+a,d.onCompiledCodeChange)}),this.buffers.bind("change:_current",function(a,b){return c.trigger("buffer:change"),c.editor.setValue(d.buffers.currentContent()||"")}),this.monitorChanges=!0},currentBuffer:function(){return this.buffers.get("_current")},loadBuffer:function(a,b){return b==null&&(b=!0),b&&this.saveBuffer(),this.buffers.set("_current",a)},saveBuffer:function(){return localStorage.setItem(this.buffers.namespacedBuffer(this.currentBuffer()),this.editor.getValue()),this.buffers.set(this.currentBuffer(),this.editor.getValue())},getBuffer:function(a,b){var c,d;return b==null&&(b=!1),a||(a=this.currentBuffer()),c=this.buffers.get(a),b!==!0?c:(d=this.buffers.get("compiled_"+a),_.string.isBlank(d)&&(d=this.compileCode(c,a)),d)},editorOptions:function(){return{mode:this.mode,theme:this.theme,keyMap:this.keyMap,lineNumbers:!0,gutter:!0,autofocus:!0,onChange:this.onEditorChange,onKeyEvent:this.stripTabs,passDelay:50,autoClearEmptyLines:!0,smartIndent:!1,tabSize:2,electricChars:!1}},beforeRender:function(){var a,b;return(b=Luca.components.Panel.prototype.beforeRender)!=null&&b.apply(this,arguments),a={"min-height":this.minHeight,background:"#272822",color:"#f8f8f2"},this.$bodyEl().css(a),this.$html("<textarea></textarea>")},afterRender:function(){var a=this;return _.defer(function(){return a.editor=window.CodeMirror.fromTextArea(a.$("textarea")[0],a.editorOptions()),a.restore(),a.enableTabStripping=!0})},save:function(){return this.saveBuffer()},restore:function(){return this.editor.setValue(""),this.editor.refresh()},replaceTabWithSpace:function(){},stripTabs:function(a,b){var c,d;return(b!=null?b.keyCode:void 0)===9&&(d=this.editor.cursorCoords(),c=this.getValue().replace(/\t/g," "),this.setValue(c),this.editor.setCursor(d)),!1},onEditorChange:function(){if(this.monitorChanges)return this.save()},onBufferChange:function(a,b,c){var d,e=this;return d=a.previousAttributes(),_(this.buffers.bufferKeys()).each(function(a){var b;if(d[a]!==e.buffers.get(a)){if(!_(e.buffers.requireCompilation()).include(a))return e.trigger("code:change:"+a,e.buffers.get(a)),e.buffers.persist(a);b=e.compileCode(e.buffers.get(a),a);if(b.success===!0)return e.buffers.persist(a),e.buffers.set("compiled_"+a,b.compiled,{silent:!0})}}),this.buffers.change()},onCompiledCodeChange:function(a,b,c){var d,e,f,g,h;e=_(a.changedAttributes()).keys(),this.trigger("code:change",e),h=[];for(f=0,g=e.length;f<g;f++)d=e[f],h.push(this.trigger("code:change:"+d,d));return h},compileCode:function(a,b){var c,d;b||(b=this.currentBuffer()),a||(a=this.getBuffer(b,!1)),c="",d={success:!0,compiled:""};try{c=this.compiler.call(this,a),this.trigger("compile:success",a,c),d.compiled=c}catch(e){this.trigger("compile:error",e,a),d.success=!1,d.compiled=this.buffers.get("compiled_"+b)}return d},getCompiledCode:function(a){return a=this.getBuffer(a),_.string.strip(this.compileCode(a))},getValue:function(){return this.editor.getValue()},setValue:function(a){return a=a.replace(/\t/g," "),this.editor.setValue(a)}})}.call(this),function(){var a;a={readOnly:!1,lineNumbers:!0,gutter:!0,autofocus:!1,passDelay:50,autoClearEmptyLines:!0,smartIndent:!1,tabSize:2,electricChars:!1},Luca.define("Luca.tools.CodeMirrorField")["extends"]("Luca.components.Panel")["with"]({bodyClassName:"codemirror-wrapper",preProcessors:[],postProcessors:[],codemirrorOptions:function(){var b,c,d=this;return c=_.clone(a),b={mode:this.mode||"coffeescript",theme:this.theme||"monokai",keyMap:this.keyMap||"basic",lineNumbers:this.lineNumbers!=null?this.lineNumbers:a.lineNumbers,readOnly:this.readOnly!=null?this.readOnly:a.readOnly,gutter:this.gutter!=null?this.gutter:a.gutter,lineWrapping:this.lineWrapping===!0,onChange:function(){var a;return d.trigger("editor:change",d),(a=d.onEditorChange)!=null?a.call(d):void 0}},this.onKeyEvent!=null&&(b.onKeyEvent=_.bind(this.onKeyEvent,this)),_.extend(c,b)},getCodeMirror:function(){return this.instance},getValue:function(a){var b;return a==null&&(a=!0),b=this.getCodeMirror().getValue()},setValue:function(a,b){return a==null&&(a=""),b==null&&(b=!0),this.getCodeMirror().setValue(a)},afterRender:function(){return this.instance=CodeMirror(this.$bodyEl()[0],this.codemirrorOptions()),this.setMaxHeight(),this.setHeight()},setMaxHeight:function(a,b){a==null&&(a=void 0),b==null&&(b=!0),a||(a=this.maxHeight);if(a==null)return;this.$(".CodeMirror-scroll").css("max-height",a);if(b===!0)return this.$(".CodeMirror-scroll").css("height",a)},setHeight:function(a){a==null&&(a=void 0);if(a!=null)return this.$(".CodeMirror-scroll").css("height",a)}})}.call(this),function(){_.def("Luca.tools.CoffeeEditor")["extends"]("Luca.tools.CodeMirrorField")["with"]({name:"coffeescript_editor",autoCompile:!0,compileOptions:{bare:!0},hooks:["editor:change"],initialize:function(a){var b;return this.options=a,Luca.tools.CodeMirrorField.prototype.initialize.apply(this,arguments),_.bindAll(this,"editorChange","toggleSource"),b=this,this.state=new Luca.Model({currentMode:"coffeescript",coffeescript:"",javascript:""}),this.state.bind("change:coffeescript",function(a){var c;return b.trigger("change:coffeescript"),c=a.get("coffeescript"),b.compile(c,function(b){return a.set("javascript",b)})}),this.state.bind("change:javascript",function(a){var c;return(c=b.onJavascriptChange)!=null?c.call(b,a.get("javascript")):void 0}),this.state.bind("change:currentMode",function(a){return a.get("currentMode")==="javascript"?b.setValue(a.get("javascript")):b.setValue(a.get("coffeescript"))})},compile:function(a,b){var c,d;d={},a||(a=this.getValue());try{return c=CoffeeScript.compile(a,this.compileOptions),b!=null&&b.call(this,c),d={success:!0,compiled:c}}catch(e){return this.trigger("compile:error",e,a),d={success:!1,compiled:"",message:e.message}}},toggleMode:function(){if(this.currentMode()==="coffeescript")return this.state.set("currentMode","javascript");if(this.currentMode()==="javascript")return this.state.set("currentMode","coffeescript")},currentMode:function(){return this.state.get("currentMode")},getCoffeescript:function(){return this.state.get("coffeescript")},getJavascript:function(a){var b,c;a==null&&(a=!1),b=this.state.get("javascript");if(a===!0||(b!=null?b.length:void 0)===0)c=this.compile(this.getCoffeescript()),b=c!=null?c.compiled:void 0;return b},editorChange:function(){if(this.autoCompile===!0)return this.state.set(this.currentMode(),this.getValue())}})}.call(this),function(){_.def("Luca.tools.CollectionInspector")["extends"]("Luca.View")["with"]({name:"collection_inspector",className:"collection-inspector"})}.call(this),function(){_.def("Luca.app.Components")["extends"]("Luca.Collection")["with"]({cachedMethods:["namespaces","classes","roots","views","collections","models"],cache_key:"luca_components",name:"components",initialize:function(){return this.model=Luca.app.Component,Luca.Collection.prototype.initialize.apply(this,arguments)},url:function(){return"/luca/source-map.js"},collections:function(){return this.select(function(a){return Luca.isCollectionPrototype(a.definition())})},modelClasses:function(){return this.select(function(a){return Luca.isModelPrototype(a.definition())})},views:function(){return this.select(function(a){return Luca.isViewPrototype(a.definition())})},classes:function(){return _.uniq(this.pluck("className"))},roots:function(){return _.uniq(this.invoke("root"))},namespaces:function(){return _.uniq(this.invoke("namespace"))},asTree:function(){var a,b,c,d;return a=this.classes(),b=this.namespaces(),c=this.roots(),d=_(c).inject(function(a,c){var d;return a[c]||(a[c]={}),d=new RegExp("^"+c),a[c]=_(b).select(function(a){return d.exec(a)&&_(b).include(a)&&a.split(".").length===2}),a},{}),_(d).inject(function(a,b,c){return a[c]={},_(b).each(function(b){return a[c][b]={}}),a},{})}})}.call(this),function(){_.def("Luca.app.Instances")["extends"]("Luca.Collection")["with"]({name:"instances",refresh:function(a){var b;return a==null&&(a={}),b=_(Luca.registry.instances()).map(function(a){return{cid:a.cid,name:a.name,ctype:a.ctype,displayName:a.displayName||a.prototype.displayName,object:a}}),this.reset(b,a)},initialize:function(a,b){return a==null&&(a=[]),this.options=b!=null?b:{},this.model=Luca.app.Instance,Luca.Collection.prototype.initialize.apply(this,arguments)}})}.call(this),function(){var ComponentPicker,bufferNames,compiledBuffers,defaults;defaults={},defaults.setup="# the setup tab contains code which is run every time\n# prior to the 'implementation' run",defaults.component="# the component tab is where you handle the definition of the component\n# that you are trying to test. it will render its output into the\n# output panel of the code tester\n#\n# example definition:\n#\n# _.def('MyComponent').extends('Luca.View').with\n# bodyTemplate: 'sample/welcome'",defaults.teardown="# the teardown tab is where you undo / cleanup any of the operations\n# from setup / implementation",defaults.implementation="# the implementation tab is where you specify options for your component.\n#\n# NOTE: the component tester uses whatever is returned from evalulating\n# the code in this tab. if it responds to render(), it will append\n# render().el to the output panel. if it is an object, then we will attempt\n# to create an instance of the component you defined with the object as",defaults.style="/*\n * customize the styles that effect this component\n * note, all styles here will be scoped to only effect\n * the output panel :)\n*/",defaults.html="",bufferNames=["setup","implementation","component","style","html"],compiledBuffers=["setup","implementation","component"],ComponentPicker=Luca.fields.TypeAheadField.extend({name:"component_picker",label:"Choose a component to edit",initialize:function(){return this.collection=new Luca.collections.Components,this.collection.fetch(),this._super("initialize",this,arguments)},getSource:function(){return this.collection.classes()},change_handler:function(){var a,b,c=this;return b=this.getValue(),a=this.collection.find(function(a){return a.get("className")===b}),a.fetch({success:function(a,b){if((b!=null?b.source.length:void 0)>0)return c.trigger("component:fetched",b.source,b.className)}}),this.hide()},createWrapper:function(){return this.make("div",{"class":"component-picker span4 well",style:"position: absolute; z-index:12000"})},show:function(){return this.$el.parent().show()},hide:function(){return this.$el.parent().hide()},toggle:function(){return this.$el.parent().toggle()}}),_.def("Luca.tools.ComponentTester")["extends"]("Luca.core.Container")["with"]({id:"component_tester",name:"component_tester",autoEvaluateCode:!0,currentSize:1,sizes:[{icon:"resize-full",value:function(){return $(window).height()*.3}},{icon:"resize-small",value:function(){return $(window).height()*.6}}],components:[{ctype:"card_view",name:"component_detail",activeCard:0,components:[{ctype:"panel",name:"component_tester_output",bodyTemplate:"component_tester/help"}]},{ctype:"code_editor",name:"ctester_edit",className:"font-large fixed-height",minHeight:"350px",currentBuffers:defaults,compiledBuffers:["component","setup","implementation"],topToolbar:{buttons:[{icon:"resize-full",align:"right",description:"change the size of the component tester editor",eventId:"toggle:size"},{icon:"pause",align:"right",description:"Toggle auto-evaluation of test script on code change",eventId:"click:autoeval"},{icon:"plus",description:"add a new component to test",eventId:"click:add"},{icon:"folder-open",description:"open an existing component's definition",eventId:"click:open"}]},bottomToolbar:{buttons:[{group:!0,wrapper:"span4",buttons:[{label:"View Javascript",description:"Switch between compiled JS and Coffeescript",eventId:"toggle:mode"}]},{group:!0,wrapper:"span6 offset4",buttons:[{label:"Component",eventId:"edit:component",description:"Edit the component itself"},{label:"Setup",eventId:"edit:setup",description:"Edit the setup for your component test"},{label:"Implementation",eventId:"edit:implementation",description:"Implement your component"},{label:"Markup",eventId:"edit:markup",description:"Edit the HTML produced by the component"},{label:"CSS",eventId:"edit:style",description:"Edit CSS"}]},{group:!0,align:"right",buttons:[{icon:"question-sign",align:"right",eventId:"click:help",description:"Help"},{icon:"cog",align:"right",eventId:"click:settings",description:"component tester settings"},{icon:"eye-close",align:"right",eventId:"click:hide",description:"hide the tester controls"},{icon:"heart",eventId:"click:console",description:"Coffeescript Console",align:"right"}]}]}}],debugMode:!0,componentEvents:{"ctester_edit click:autoeval":"toggleAutoeval","ctester_edit click:refresh":"refreshCode","ctester_edit click:hide":"toggleControls","ctester_edit click:settings":"toggleSettings","ctester_edit click:add":"addComponent","ctester_edit click:open":"openComponent","ctester_edit click:help":"showHelp","ctester_edit click:console":"toggleConsole","ctester_edit eval:error":"onError","ctester_edit eval:success":"onSuccess","ctester_edit edit:setup":"editSetup","ctester_edit edit:teardown":"editTeardown","ctester_edit edit:component":"editComponent","ctester_edit edit:style":"editStyle","ctester_edit edit:markup":"editMarkup","ctester_edit edit:implementation":"editImplementation","ctester_edit toggle:keymap":"toggleKeymap","ctester_edit toggle:mode":"toggleMode","ctester_edit code:change:html":"onMarkupChange","ctester_edit code:change:style":"onStyleChange","ctester_edit toggle:size":"toggleSize"},initialize:function(){var a,b,c;Luca.core.Container.prototype.initialize.apply(this,arguments),c=this.componentEvents;for(a in c)b=c[a],this[b]=_.bind(this[b],this);return this.defer("editComponent").until("after:render")},afterRender:function(){var a,b=this;return a=_.idleMedium(function(){if(b.autoEvaluateCode===!0)return b.applyTestRun()},500),this.getEditor().bind("code:change",a)},getEditor:function(){return Luca("ctester_edit")},getDetail:function(){return Luca("component_detail")},getOutput:function(){return this.getDetail().findComponentByName("component_tester_output")},onError:function(a,b){return console.log("Error in "+b,a,a.message,a.stack)},onSuccess:function(a,b){var c;b==="component"&&(this.componentDefinition=a);if(b==="implementation"){Luca.isBackboneView(a)?c=a:_.isObject(a)&&a.ctype!=null?c=Luca(a):_.isObject(a)&&_.isFunction(this.componentDefinition)&&(c=new this.componentDefinition(a));if(Luca.isBackboneView(c))return this.getOutput().$html(c.render().el)}},applyTestRun:function(){var a,b,c,d;this.getOutput().$html(""),c=this.getTestRun(),d=[];for(a in c)b=c[a],d.push(this.evaluateCode(b,a));return d},toggleConsole:function(a){var b;return this.developmentConsole=Luca("coffeescript-console",function(){return new Luca.tools.DevelopmentConsole({name:"coffeescript-console"})}),this.consoleContainerAppended||(b=this.make("div",{id:"devtools-console-wrapper","class":"devtools-console-container modal",style:"width:900px;height:650px;"},this.developmentConsole.el),$("body").append(b),this.consoleContainerAppended=!0,this.developmentConsole.render()),$("#devtools-console-wrapper").modal({backdrop:!1,show:!0})},toggleAutoeval:function(a){var b,c;return this.autoEvaluateCode=this.autoEvaluateCode!==!0,!this.started&&this.autoEvaluateCode===!0&&(this.started=!0,this.applyTestRun()),c=a.children("i").eq(0),b=this.autoEvaluateCode?"icon-pause":"icon-play",c.removeClass(),c.addClass(b),this},showEditor:function(a){return this.getEditor().$(".toolbar-container.top").toggle(a),this.getEditor().$(".codemirror-wrapper").toggle(a),this.trigger("controls:toggled")},toggleKeymap:function(a){var b;return b=this.getEditor().keyMap==="vim"?"basic":"vim",this.getEditor().setKeyMap(b),a.html(_.string.capitalize(b))},toggleMode:function(a){var b;return b=this.getEditor().mode==="coffeescript"?"javascript":"coffeescript",this.getEditor().setMode(b),a.html(_.string.capitalize(b==="coffeescript"?"View Javascript":"View Coffeescript")),this.editBuffer(this.currentBufferName,b==="javascript")},toggleSize:function(a){var b,c,d,e;return c=this.currentSize++%this.sizes.length,e=this.sizes[c].value(),d=this.sizes[c].icon,a!=null&&(b=a.children("i").eq(0),b.removeClass().addClass("icon-"+d)),this.$(".codemirror-wrapper").css("height",""+parseInt(e)+"px"),this.getEditor().refresh()},toggleControls:function(a){var b=this;return this.bind("controls:toggled",function(){var c,d;return d=a.children("i").eq(0),d.removeClass(),c=b.getEditor().$(".toolbar-container.top").is(":visible")?"icon-eye-close":"icon-eye-open",d.addClass(c)}),this.showEditor(),this},toggleSettings:function(){return this},setValue:function(a,b){var c;return b==null&&(b="component"),c=this.getEditor().editor.getOption("mode")==="javascript",this.editBuffer(b,c,!1).getEditor().setValue(a)},editBuffer:function(a,b,c){var d;return this.currentBufferName=a,b==null&&(b=!1),c==null&&(c=!0),this.showEditor(!0),this.highlight(this.currentBufferName),d=b?"compiled_"+this.currentBufferName:this.currentBufferName,this.getEditor().loadBuffer(d,c),this},editMarkup:function(){return this.getEditor().setMode("htmlmixed"),this.getEditor().setWrap(!0),this.editBuffer("html").setValue(this.getOutput().$html(),"html")},editStyle:function(){return this.getEditor().setMode("css"),this.editBuffer("style")},editComponent:function(){return this.getEditor().setMode("coffeescript"),this.editBuffer("component")},editTeardown:function(){return this.getEditor().setMode("coffeescript"),this.editBuffer("teardown")},editSetup:function(){return this.getEditor().setMode("coffeescript"),this.editBuffer("setup")},editImplementation:function(){return this.getEditor().setMode("coffeescript"),this.editBuffer("implementation")},getTestRun:function(){var a,b,c,d,e,f;b=this.getEditor(),c={},f=["component","setup","implementation"];for(d=0,e=f.length;d<e;d++)a=f[d],c[a]=b.getBuffer(a,!0);return c},getContext:function(){return Luca.util.resolve(this.context||(this.context="window"))},evaluateCode:function(code,bufferId,compile){var compiled,evaluator,result;compile==null&&(compile=!1),code||(code=this.getEditor().getValue()),compiled=compile===!0?this.getEditor().compileCode(code):code,evaluator=function(){return eval(compiled)};try{return result=evaluator.call(this.getContext()),this.onSuccess(result,bufferId,code)}catch(error){return this.onError(error,bufferId,code)}},onMarkupChange:function(){if(this.autoEvaluateCode===!0)return this.getOutput().$html(this.getEditor().getValue())},onStyleChange:function(){var a,b,c;if(this.autoEvaluateCode===!0){$("#component-tester-stylesheet").remove(),a=(c=this.getEditor())!=null?c.getValue():void 0;if(a)return b=this.make("style",{type:"text/css",id:"component-tester-stylesheet"}),$("head").append(b),$(b).append(a)}},showHelp:function(){return this.getOutput().$html(Luca.template("component_tester/help",this))},addComponent:function(a){},openComponent:function(a){var b=this;this.componentPicker||(this.componentPicker=new ComponentPicker),this.componentPicker.bind("component:fetched",function(a,c){return b.setEditorNamespace(c).setValue(a,"component")});if(!this.getEditor().$(".component-picker").length>0){this.getEditor().$(".codemirror-wrapper").before(this.componentPicker.createWrapper()),this.getEditor().$(".component-picker").html(this.componentPicker.render().el),this.componentPicker.show();return}return this.componentPicker.toggle()},highlight:function(a){return this.$("a.btn[data-eventid='edit:"+a+"']").siblings().css("font-weight","normal"),this.$("a.btn[data-eventid='edit:"+a+"']").css("font-weight","bold")},setEditorNamespace:function(a){return this.getEditor().namespace(a),this.getEditor().buffers.fetch(),this}})}.call(this),function(){var developmentConsole,_base;developmentConsole=Luca.register("Luca.tools.DevelopmentConsole"),developmentConsole["extends"]("Luca.core.Container"),developmentConsole.defines({className:"luca-ui-console",name:"console",history:[],historyIndex:0,width:1e3,componentEvents:{"code_input key:keyup":"historyUp","code_input key:keydown":"historyDown","code_input key:enter":"runCommand"},compileOptions:{bare:!0},components:[{type:"code_mirror_field",getter:"getCodeMirror",additionalClassNames:"clearfix",name:"code_output",readOnly:!0,lineNumbers:!1,mode:"javascript",lineWrapping:!0,gutter:!1},{type:"text_field",name:"code_input",getter:"getInput",lineNumbers:!1,height:"30px",maxHeight:"30px",gutter:!1,autoBindEventHandlers:!0,hideLabel:!0,prepend:"Coffee>",events:{"keypress input":"onKeyEvent","keydown input":"onKeyEvent"},onKeyEvent:function(a){a.type==="keypress"&&a.keyCode===Luca.keys.ENTER&&this.trigger("key:enter",this.getValue()),a.type==="keydown"&&a.keyCode===Luca.keys.KEYUP&&this.trigger("key:keyup");if(a.type==="keydown"&&a.keyCode===Luca.keys.KEYDOWN)return this.trigger("key:keydown")},afterRender:function(){return this.$("input").focus()}}],afterRender:function(){var a;this.$container().modal({backdrop:!1});if(this.width!=null)return a=parseInt(this.width)*.5*-1,this.$container().css("width",this.width).css("margin-left",parseInt(a))},show:function(a){return a==null&&(a={}),this.$container().modal("show"),this},getContext:function(){return window},initialize:function(){return this._super("initialize",this,arguments),_.bindAll(this,"historyUp","historyDown","onSuccess","onError","runCommand")},saveHistory:function(a){return(a!=null?a.length:void 0)>0&&this.history.push(a),this.historyIndex=0},historyUp:function(){var a;return this.historyIndex-=1,this.historyIndex<0&&(this.historyIndex=0),a=this.getInput().getValue(),this.getInput().setValue(this.history[this.historyIndex]||a)},historyDown:function(){var a;return this.historyIndex+=1,this.historyIndex>this.history.length-1&&(this.historyIndex=this.history.length-1),a=this.getInput().getValue(),this.getInput().setValue(this.history[this.historyIndex]||a)},append:function(a,b,c){var d,e,f,g;return c==null&&(c=!1),e=this.getCodeMirror(),d=e.getValue(),a!=null&&(g="// "+a),f=c||a.match(/^console\.log/)?[d,b]:[d,g,b],e.setValue(_.compact(f).join("\n")),e.getCodeMirror().scrollTo(0,9e4)},onSuccess:function(a,b,c){var d;this.saveHistory(c),d="";if(_.isArray(a)||_.isObject(a)||_.isString(a)||_.isNumber(a))d=JSON.stringify(a,null," ");return d||(d=typeof a.toString=="function"?a.toString():void 0),this.append(b,d||"undefined")},onError:function(a,b,c){return this.append(b,"// ERROR: "+a.message)},evaluateCode:function(code,raw){var dev,evaluator,output,result;if(!((code!=null?code.length:void 0)>0))return;raw=_.string.strip(raw),output=this.getCodeMirror(),dev=this,evaluator=function(){var console,log,old_console,result;old_console=window.console,console={log:function(){var a,b,c,d;d=[];for(b=0,c=arguments.length;b<c;b++)a=arguments[b],d.push(dev.append(void 0,a,!0));return d}},log=console.log;try{result=eval(code)}catch(error){throw window.console=old_console,error}return window.console=old_console,result};try{result=evaluator.call(this.getContext()),Luca.isComponent(result)?result=Luca.util.inspectComponent(result):Luca.isComponentPrototype(result)&&(result=Luca.util.inspectComponentPrototype(result));if(!raw.match(/^console\.log/))return this.onSuccess(result,code,raw)}catch(error){return this.onError(error,code,raw)}},runCommand:function(){var a,b,c,d;return c=this,a=_.bind(Luca.tools.CoffeeEditor.prototype.compile,this),d=this.getInput().getValue(),b=a(d,function(a){return c.evaluateCode(a,d)})}}),(_base=Luca.util).launchers||(_base.launchers={}),Luca.util.inspectComponentPrototype=function(a){var b;return b=Luca.registry.findInstancesByClass(a)},Luca.util.inspectComponent=function(a){return _.isString(a)&&(a=Luca(a)),{name:a.name,instanceOf:a.displayName,subclassOf:a._superClass().prototype.displayName,inheritsFrom:Luca.parentClasses(a)}},Luca.util.launchers.developmentConsole=function(a){var b=this;return a==null&&(a="luca-development-console"),this._lucaDevConsole=Luca(a,function(){var c;return b.$el.append(Backbone.View.prototype.make("div",{id:""+a+"-wrapper","class":"modal fade large"})),c=new Luca.tools.DevelopmentConsole({name:a,container:"#"+a+"-wrapper"}),c.render(),c.getCodeMirror().setHeight(602)}),this._lucaDevConsole.show()}}.call(this),function(){_.def("Luca.app.Component")["extends"]("Luca.Model")["with"]({root:function(){return this.get("className").split(".")[0]},className:function(){return this.get("className")},instances:function(){return Luca.registry.findInstancesByClassName(this.className())},definitionPrototype:function(){var a;return(a=this.definition())!=null?a.prototype:void 0},parentClasses:function(){return Luca.parentClasses(this.className())},definition:function(){return Luca.util.resolve(this.className())},namespace:function(){var a;return this.get("className")==null?"":(a=this.get("className").split("."),a.pop(),a.join("."))}})}.call(this),function(){_.def("Luca.app.Instance")["extends"]("Luca.Model")["with"]({version:1})}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["component_tester/help"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<h1>Component Tester</h1>\n<p>This is a tool that enables you to build and test Luca components in an isolated sandbox environment. The editor is currently enabled with vim keybindings</p>\n<h3>Setup</h3>\n<p>This is where you setup any data requirements needed for the test to work. This is run every time before the implementation code is ran.</p>\n<h3>Teardown</h3>\n<p>This is where you clean up after the tests. This will be run every time after the implementation code is ran.</p>\n<h3>Definitions</h3>\n<p>This is where you define the component you will be testing. This is usually the code you will be shipping once you have completed testing.</p>\n<h3>Implementation</h3>\n<p>This is where you create an instance of the component and specify any of the necessary configuration settings. The component will be rendered into the output panel of the component tester.</p>\n");return __p.join("")}}.call(this),function(){}.call(this);
|
@@ -3,37 +3,11 @@
|
|
3
3
|
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
|
4
4
|
f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
|
5
5
|
{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
|
6
|
-
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
//
|
10
|
-
// Oliver Steele's Functional, and John Resig's Micro-Templating.
|
11
|
-
// For all details and documentation:
|
12
|
-
// http://documentcloud.github.com/underscore
|
13
|
-
(function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
|
14
|
-
c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,
|
15
|
-
h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each=
|
16
|
-
b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(e in a&&c.call(d,a[e],e,a)===n)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===n)break};b.map=b.collect=function(a,c,b){var e=[];if(a==null)return e;if(x&&a.map===x)return a.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});if(a.length===+a.length)e.length=a.length;return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==
|
17
|
-
null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=
|
18
|
-
function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e=
|
19
|
-
e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
|
20
|
-
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);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&(e={value:a,computed:b})});
|
21
|
-
return e.value};b.shuffle=function(a){var b=[],d;j(a,function(a,f){f==0?b[0]=a:(d=Math.floor(Math.random()*(f+1)),b[f]=b[d],b[d]=a)});return b};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,g){return{value:a,criteria:c.call(d,a,b,g)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,
|
22
|
-
c,d){d||(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){return!a?[]:a.toArray?a.toArray():b.isArray(a)?i.call(a):b.isArguments(a)?i.call(a):b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){return i.call(a,0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){return b!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length-1]};b.rest=
|
23
|
-
b.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a,c){return b.reduce(a,function(a,e){if(b.isArray(e))return a.concat(c?e:b.flatten(e));a[a.length]=e;return a},[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,h){if(0==h||(c===true?b.last(d)!=g:!b.include(d,g)))d[d.length]=g,e[e.length]=a[h];return d},[]);
|
24
|
-
return e};b.union=function(){return b.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.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,
|
25
|
-
d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(p&&a.indexOf===p)return a.indexOf(c);for(d=0,e=a.length;d<e;d++)if(d in a&&a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(D&&a.lastIndexOf===D)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);for(var d=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g};
|
26
|
-
var F=function(){};b.bind=function(a,c){var d,e;if(a.bind===s&&s)return s.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments)));F.prototype=a.prototype;var b=new F,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,
|
27
|
-
c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i=b.debounce(function(){h=g=false},c);return function(){d=this;e=arguments;var b;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);i()},c));g?h=true:
|
28
|
-
a.apply(d,e);i();g=true}};b.debounce=function(a,b){var d;return function(){var e=this,f=arguments;clearTimeout(d);d=setTimeout(function(){d=null;a.apply(e,f)},b)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0));return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};
|
29
|
-
b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};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){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments,
|
30
|
-
1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};
|
31
|
-
b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};
|
32
|
-
b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;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.escape=function(a){return(""+a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a),
|
33
|
-
function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};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.escape||t,function(a,b){return"',_.escape("+
|
34
|
-
u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]=
|
35
|
-
function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=
|
36
|
-
true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
|
6
|
+
// Underscore.js 1.4.2
|
7
|
+
// http://underscorejs.org
|
8
|
+
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
9
|
+
// Underscore may be freely distributed under the MIT license.
|
10
|
+
(function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=r.unshift,l=i.toString,c=i.hasOwnProperty,h=r.forEach,p=r.map,d=r.reduce,v=r.reduceRight,m=r.filter,g=r.every,y=r.some,b=r.indexOf,w=r.lastIndexOf,E=Array.isArray,S=Object.keys,x=s.bind,T=function(e){if(e instanceof T)return e;if(!(this instanceof T))return new T(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=T),exports._=T):e._=T,T.VERSION="1.4.2";var N=T.each=T.forEach=function(e,t,r){if(e==null)return;if(h&&e.forEach===h)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(T.has(e,o)&&t.call(r,e[o],o,e)===n)return};T.map=T.collect=function(e,t,n){var r=[];return e==null?r:p&&e.map===p?e.map(t,n):(N(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)},T.reduce=T.foldl=T.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduce===d)return r&&(t=T.bind(t,r)),i?e.reduce(t,n):e.reduce(t);N(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},T.reduceRight=T.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(v&&e.reduceRight===v)return r&&(t=T.bind(t,r)),arguments.length>2?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=T.keys(e);s=o.length}N(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},T.find=T.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},T.filter=T.select=function(e,t,n){var r=[];return e==null?r:m&&e.filter===m?e.filter(t,n):(N(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},T.reject=function(e,t,n){var r=[];return e==null?r:(N(e,function(e,i,s){t.call(n,e,i,s)||(r[r.length]=e)}),r)},T.every=T.all=function(e,t,r){t||(t=T.identity);var i=!0;return e==null?i:g&&e.every===g?e.every(t,r):(N(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=T.some=T.any=function(e,t,r){t||(t=T.identity);var i=!1;return e==null?i:y&&e.some===y?e.some(t,r):(N(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};T.contains=T.include=function(e,t){var n=!1;return e==null?n:b&&e.indexOf===b?e.indexOf(t)!=-1:(n=C(e,function(e){return e===t}),n)},T.invoke=function(e,t){var n=u.call(arguments,2);return T.map(e,function(e){return(T.isFunction(t)?t:e[t]).apply(e,n)})},T.pluck=function(e,t){return T.map(e,function(e){return e[t]})},T.where=function(e,t){return T.isEmpty(t)?[]:T.filter(e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},T.max=function(e,t,n){if(!t&&T.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&T.isEmpty(e))return-Infinity;var r={computed:-Infinity};return N(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},T.min=function(e,t,n){if(!t&&T.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&T.isEmpty(e))return Infinity;var r={computed:Infinity};return N(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},T.shuffle=function(e){var t,n=0,r=[];return N(e,function(e){t=T.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return T.isFunction(e)?e:function(t){return t[e]}};T.sortBy=function(e,t,n){var r=k(t);return T.pluck(T.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,n,r){var i={},s=k(t);return N(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};T.groupBy=function(e,t,n){return L(e,t,n,function(e,t,n){(T.has(e,t)?e[t]:e[t]=[]).push(n)})},T.countBy=function(e,t,n){return L(e,t,n,function(e,t,n){T.has(e,t)||(e[t]=0),e[t]++})},T.sortedIndex=function(e,t,n,r){n=n==null?T.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},T.toArray=function(e){return e?e.length===+e.length?u.call(e):T.values(e):[]},T.size=function(e){return e.length===+e.length?e.length:T.keys(e).length},T.first=T.head=T.take=function(e,t,n){return t!=null&&!n?u.call(e,0,t):e[0]},T.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},T.last=function(e,t,n){return t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},T.rest=T.tail=T.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},T.compact=function(e){return T.filter(e,function(e){return!!e})};var A=function(e,t,n){return N(e,function(e){T.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};T.flatten=function(e,t){return A(e,t,[])},T.without=function(e){return T.difference(e,u.call(arguments,1))},T.uniq=T.unique=function(e,t,n,r){var i=n?T.map(e,n,r):e,s=[],o=[];return N(i,function(n,r){if(t?!r||o[o.length-1]!==n:!T.contains(o,n))o.push(n),s.push(e[r])}),s},T.union=function(){return T.uniq(a.apply(r,arguments))},T.intersection=function(e){var t=u.call(arguments,1);return T.filter(T.uniq(e),function(e){return T.every(t,function(t){return T.indexOf(t,e)>=0})})},T.difference=function(e){var t=a.apply(r,u.call(arguments,1));return T.filter(e,function(e){return!T.contains(t,e)})},T.zip=function(){var e=u.call(arguments),t=T.max(T.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=T.pluck(e,""+r);return n},T.object=function(e,t){var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},T.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=T.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(b&&e.indexOf===b)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},T.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(w&&e.lastIndexOf===w)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},T.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var O=function(){};T.bind=function(t,n){var r,i;if(t.bind===x&&x)return x.apply(t,u.call(arguments,1));if(!T.isFunction(t))throw new TypeError;return i=u.call(arguments,2),r=function(){if(this instanceof r){O.prototype=t.prototype;var e=new O,s=t.apply(e,i.concat(u.call(arguments)));return Object(s)===s?s:e}return t.apply(n,i.concat(u.call(arguments)))}},T.bindAll=function(e){var t=u.call(arguments,1);return t.length==0&&(t=T.functions(e)),N(t,function(t){e[t]=T.bind(e[t],e)}),e},T.memoize=function(e,t){var n={};return t||(t=T.identity),function(){var r=t.apply(this,arguments);return T.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},T.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},T.defer=function(e){return T.delay.apply(T,[e,1].concat(u.call(arguments,1)))},T.throttle=function(e,t){var n,r,i,s,o,u,a=T.debounce(function(){o=s=!1},t);return function(){n=this,r=arguments;var f=function(){i=null,o&&(u=e.apply(n,r)),a()};return i||(i=setTimeout(f,t)),s?o=!0:(s=!0,u=e.apply(n,r)),a(),u}},T.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},T.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},T.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},T.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},T.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},T.keys=S||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)T.has(e,n)&&(t[t.length]=n);return t},T.values=function(e){var t=[];for(var n in e)T.has(e,n)&&t.push(e[n]);return t},T.pairs=function(e){var t=[];for(var n in e)T.has(e,n)&&t.push([n,e[n]]);return t},T.invert=function(e){var t={};for(var n in e)T.has(e,n)&&(t[e[n]]=n);return t},T.functions=T.methods=function(e){var t=[];for(var n in e)T.isFunction(e[n])&&t.push(n);return t.sort()},T.extend=function(e){return N(u.call(arguments,1),function(t){for(var n in t)e[n]=t[n]}),e},T.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return N(n,function(n){n in e&&(t[n]=e[n])}),t},T.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)T.contains(n,i)||(t[i]=e[i]);return t},T.defaults=function(e){return N(u.call(arguments,1),function(t){for(var n in t)e[n]==null&&(e[n]=t[n])}),e},T.clone=function(e){return T.isObject(e)?T.isArray(e)?e.slice():T.extend({},e):e},T.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof T&&(e=e._wrapped),t instanceof T&&(t=t._wrapped);var i=l.call(e);if(i!=l.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if(i=="[object Array]"){o=e.length,u=o==t.length;if(u)while(o--)if(!(u=M(e[o],t[o],n,r)))break}else{var a=e.constructor,f=t.constructor;if(a!==f&&!(T.isFunction(a)&&a instanceof a&&T.isFunction(f)&&f instanceof f))return!1;for(var c in e)if(T.has(e,c)){o++;if(!(u=T.has(t,c)&&M(e[c],t[c],n,r)))break}if(u){for(c in t)if(T.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};T.isEqual=function(e,t){return M(e,t,[],[])},T.isEmpty=function(e){if(e==null)return!0;if(T.isArray(e)||T.isString(e))return e.length===0;for(var t in e)if(T.has(e,t))return!1;return!0},T.isElement=function(e){return!!e&&e.nodeType===1},T.isArray=E||function(e){return l.call(e)=="[object Array]"},T.isObject=function(e){return e===Object(e)},N(["Arguments","Function","String","Number","Date","RegExp"],function(e){T["is"+e]=function(t){return l.call(t)=="[object "+e+"]"}}),T.isArguments(arguments)||(T.isArguments=function(e){return!!e&&!!T.has(e,"callee")}),typeof /./!="function"&&(T.isFunction=function(e){return typeof e=="function"}),T.isFinite=function(e){return T.isNumber(e)&&isFinite(e)},T.isNaN=function(e){return T.isNumber(e)&&e!=+e},T.isBoolean=function(e){return e===!0||e===!1||l.call(e)=="[object Boolean]"},T.isNull=function(e){return e===null},T.isUndefined=function(e){return e===void 0},T.has=function(e,t){return c.call(e,t)},T.noConflict=function(){return e._=t,this},T.identity=function(e){return e},T.times=function(e,t,n){for(var r=0;r<e;r++)t.call(n,r)},T.random=function(e,t){return t==null&&(t=e,e=0),e+(0|Math.random()*(t-e+1))};var _={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};_.unescape=T.invert(_.escape);var D={escape:new RegExp("["+T.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+T.keys(_.unescape).join("|")+")","g")};T.each(["escape","unescape"],function(e){T[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),T.result=function(e,t){if(e==null)return null;var n=e[t];return T.isFunction(n)?n.call(e):n},T.mixin=function(e){N(T.functions(e),function(t){var n=T[t]=e[t];T.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(T,e))}})};var P=0;T.uniqueId=function(e){var t=P++;return e?e+t:t},T.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;T.template=function(e,t,n){n=T.defaults({},n,T.templateSettings);var r=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),i=0,s="__p+='";e.replace(r,function(t,n,r,o,u){s+=e.slice(i,u).replace(j,function(e){return"\\"+B[e]}),s+=n?"'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?"'+\n((__t=("+r+"))==null?'':__t)+\n'":o?"';\n"+o+"\n__p+='":"",i=u+t.length}),s+="';\n",n.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var o=new Function(n.variable||"obj","_",s)}catch(u){throw u.source=s,u}if(t)return o(t,T);var a=function(e){return o.call(this,e,T)};return a.source="function("+(n.variable||"obj")+"){\n"+s+"}",a},T.chain=function(e){return T(e).chain()};var F=function(e){return this._chain?T(e).chain():e};T.mixin(T),N(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];T.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),N(["concat","join","slice"],function(e){var t=r[e];T.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),T.extend(T.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this);
|
37
11
|
(function(k){var o=String.prototype.trim,l=function(a,b){for(var c=[];b>0;c[--b]=a);return c.join("")},d=function(a){return function(){for(var b=Array.prototype.slice.call(arguments),c=0;c<b.length;c++)b[c]=b[c]==null?"":""+b[c];return a.apply(null,b)}},m=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}var b=function(){b.cache.hasOwnProperty(arguments[0])||(b.cache[arguments[0]]=b.parse(arguments[0]));return b.format.call(null,b.cache[arguments[0]],arguments)};
|
38
12
|
b.format=function(b,n){var e=1,d=b.length,f="",j=[],h,i,g,k;for(h=0;h<d;h++)if(f=a(b[h]),f==="string")j.push(b[h]);else if(f==="array"){g=b[h];if(g[2]){f=n[e];for(i=0;i<g[2].length;i++){if(!f.hasOwnProperty(g[2][i]))throw m('[_.sprintf] property "%s" does not exist',g[2][i]);f=f[g[2][i]]}}else f=g[1]?n[g[1]]:n[e++];if(/[^s]/.test(g[8])&&a(f)!="number")throw m("[_.sprintf] expecting number but found %s",a(f));switch(g[8]){case "b":f=f.toString(2);break;case "c":f=String.fromCharCode(f);break;case "d":f=
|
39
13
|
parseInt(f,10);break;case "e":f=g[7]?f.toExponential(g[7]):f.toExponential();break;case "f":f=g[7]?parseFloat(f).toFixed(g[7]):parseFloat(f);break;case "o":f=f.toString(8);break;case "s":f=(f=String(f))&&g[7]?f.substring(0,g[7]):f;break;case "u":f=Math.abs(f);break;case "x":f=f.toString(16);break;case "X":f=f.toString(16).toUpperCase()}f=/[def]/.test(g[8])&&g[3]&&f>=0?"+"+f:f;i=g[4]?g[4]=="0"?"0":g[4].charAt(1):" ";k=g[6]-String(f).length;i=g[6]?l(i,k):"";j.push(g[5]?f+i:i+f)}return j.join("")};b.cache=
|
@@ -121,7 +95,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
121
95
|
};
|
122
96
|
|
123
97
|
_.extend(Luca, {
|
124
|
-
VERSION: "0.9.
|
98
|
+
VERSION: "0.9.6",
|
125
99
|
core: {},
|
126
100
|
containers: {},
|
127
101
|
components: {},
|
@@ -129,18 +103,21 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
129
103
|
util: {},
|
130
104
|
fields: {},
|
131
105
|
registry: {},
|
132
|
-
options: {}
|
106
|
+
options: {},
|
107
|
+
config: {}
|
133
108
|
});
|
134
109
|
|
135
110
|
_.extend(Luca, Backbone.Events);
|
136
111
|
|
137
|
-
Luca.autoRegister = true;
|
112
|
+
Luca.autoRegister = Luca.config.autoRegister = true;
|
113
|
+
|
114
|
+
Luca.developmentMode = Luca.config.developmentMode = false;
|
138
115
|
|
139
|
-
Luca.
|
116
|
+
Luca.enableGlobalObserver = Luca.config.enableGlobalObserver = false;
|
140
117
|
|
141
|
-
Luca.
|
118
|
+
Luca.enableBootstrap = Luca.config.enableBootstrap = true;
|
142
119
|
|
143
|
-
Luca.
|
120
|
+
Luca.config.enhancedViewProperties = true;
|
144
121
|
|
145
122
|
Luca.keys = {
|
146
123
|
ENTER: 13,
|
@@ -158,8 +135,8 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
158
135
|
return memo;
|
159
136
|
}, {});
|
160
137
|
|
161
|
-
Luca.find = function() {
|
162
|
-
return;
|
138
|
+
Luca.find = function(el) {
|
139
|
+
return Luca($(el).data('luca-id'));
|
163
140
|
};
|
164
141
|
|
165
142
|
Luca.supportsEvents = Luca.supportsBackboneEvents = function(obj) {
|
@@ -331,17 +308,133 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
331
308
|
|
332
309
|
}).call(this);
|
333
310
|
(function() {
|
334
|
-
|
311
|
+
this.JST || (this.JST = {});
|
312
|
+
this.JST["luca-src/templates/components/bootstrap_form_controls"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class="btn-group form-actions">\n <a class="btn btn-primary submit-button">\n <i class="icon icon-ok icon-white"></i>\n Save Changes\n </a>\n <a class="btn reset-button cancel-button">\n <i class="icon icon-remove"></i>\n Cancel\n </a>\n</div>\n');}return __p.join('');};
|
313
|
+
}).call(this);
|
314
|
+
(function() {
|
315
|
+
this.JST || (this.JST = {});
|
316
|
+
this.JST["luca-src/templates/components/collection_loader_view"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div id="progress-modal" class="modal" style="display: none">\n <div class="progress progress-info progress-striped active">\n <div class="bar" style="width:0%;"></div>\n </div>\n <div class="message">Initializing...</div>\n</div>\n');}return __p.join('');};
|
317
|
+
}).call(this);
|
318
|
+
(function() {
|
319
|
+
this.JST || (this.JST = {});
|
320
|
+
this.JST["luca-src/templates/components/form_alert"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class="', className ,'">\n <a class="close" href="#" data-dismiss="alert">x</a>\n ', message ,'\n</div>\n');}return __p.join('');};
|
321
|
+
}).call(this);
|
322
|
+
(function() {
|
323
|
+
this.JST || (this.JST = {});
|
324
|
+
this.JST["luca-src/templates/components/grid_view"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class="luca-ui-g-view-wrapper">\n <div class="g-view-header"></div>\n <div class="luca-ui-g-view-body">\n <table class="luca-ui-g-view scrollable-table" width="100%" cellpadding=0 cellspacing=0>\n <thead class="fixed"></thead>\n <tbody class="scrollable"></tbody>\n <tfoot></tfoot>\n </table>\n </div>\n <div class="luca-ui-g-view-header"></div>\n</div>\n');}return __p.join('');};
|
325
|
+
}).call(this);
|
326
|
+
(function() {
|
327
|
+
this.JST || (this.JST = {});
|
328
|
+
this.JST["luca-src/templates/components/grid_view_empty_text"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class="empty-text empty-text-wrapper">\n <p>', text ,'</p>\n</div>\n');}return __p.join('');};
|
329
|
+
}).call(this);
|
330
|
+
(function() {
|
331
|
+
this.JST || (this.JST = {});
|
332
|
+
this.JST["luca-src/templates/components/load_mask"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class="load-mask">\n <div class="progress progress-striped active">\n <div class="bar" style="width:0%"></div>\n </div>\n</div>\n');}return __p.join('');};
|
333
|
+
}).call(this);
|
334
|
+
(function() {
|
335
|
+
this.JST || (this.JST = {});
|
336
|
+
this.JST["luca-src/templates/components/nav_bar"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class="navbar-inner">\n <div class="luca-ui-navbar-body container">\n </div>\n</div>\n');}return __p.join('');};
|
337
|
+
}).call(this);
|
338
|
+
(function() {
|
339
|
+
this.JST || (this.JST = {});
|
340
|
+
this.JST["luca-src/templates/components/pagination"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class="pagination">\n <a class="btn previous">\n <i class="icon icon-chevron-left"></i>\n </a>\n <div class="pagination-group">\n </div>\n <a class="btn next">\n <i class="icon icon-chevron-right"></i>\n </a>\n</div>\n');}return __p.join('');};
|
341
|
+
}).call(this);
|
342
|
+
(function() {
|
343
|
+
this.JST || (this.JST = {});
|
344
|
+
this.JST["luca-src/templates/containers/basic"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div id="', id ,'" class="', classes ,'" style="', style ,'"></div>\n');}return __p.join('');};
|
345
|
+
}).call(this);
|
346
|
+
(function() {
|
347
|
+
this.JST || (this.JST = {});
|
348
|
+
this.JST["luca-src/templates/containers/tab_selector_container"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div id="', cid ,'-tab-selector" class="tab-selector-container">\n <ul id="', cid ,'-tabs-nav" class="nav nav-tabs">\n '); for(var i = 0; i < components.length; i++ ) { __p.push('\n '); var component = components[i];__p.push('\n <li class="tab-selector" data-target="', i ,'">\n <a data-target="', i ,'">\n ', component.title ,'\n </a>\n </li>\n '); } __p.push('\n </ul>\n</div>\n');}return __p.join('');};
|
349
|
+
}).call(this);
|
350
|
+
(function() {
|
351
|
+
this.JST || (this.JST = {});
|
352
|
+
this.JST["luca-src/templates/containers/tab_view"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<ul id="', cid ,'-tabs-selector" class="nav ', navClass ,'"></ul>\n<div id="', cid ,'-tab-view-content" class="tab-content"></div>\n');}return __p.join('');};
|
353
|
+
}).call(this);
|
354
|
+
(function() {
|
355
|
+
this.JST || (this.JST = {});
|
356
|
+
this.JST["luca-src/templates/containers/toolbar_wrapper"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class="luca-ui-toolbar-wrapper" id="', id ,'"></div>\n');}return __p.join('');};
|
357
|
+
}).call(this);
|
358
|
+
(function() {
|
359
|
+
this.JST || (this.JST = {});
|
360
|
+
this.JST["luca-src/templates/fields/button_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label> </label>\n<input style="', inputStyles ,'" class="btn ', input_class ,'" value="', input_value ,'" type="', input_type ,'" id="<%= input_id" />\n');}return __p.join('');};
|
361
|
+
}).call(this);
|
362
|
+
(function() {
|
363
|
+
this.JST || (this.JST = {});
|
364
|
+
this.JST["luca-src/templates/fields/button_field_link"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<a class="btn ', input_class ,'">\n '); if(icon_class.length) { __p.push('\n <i class="', icon_class ,'"></i>\n ', input_value ,'\n '); } __p.push('\n</a>\n');}return __p.join('');};
|
365
|
+
}).call(this);
|
366
|
+
(function() {
|
367
|
+
this.JST || (this.JST = {});
|
368
|
+
this.JST["luca-src/templates/fields/checkbox_array"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class="control-group">\n <label for="', input_id ,'"><%= label =>\n <div class="controls"><div>\n</div>\n');}return __p.join('');};
|
369
|
+
}).call(this);
|
370
|
+
(function() {
|
371
|
+
this.JST || (this.JST = {});
|
372
|
+
this.JST["luca-src/templates/fields/checkbox_array_item"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for="', input_id ,'">\n <input id="', input_id ,'" type="checkbox" name="', input_name ,'" value="', value ,'" />\n</label>\n');}return __p.join('');};
|
373
|
+
}).call(this);
|
374
|
+
(function() {
|
375
|
+
this.JST || (this.JST = {});
|
376
|
+
this.JST["luca-src/templates/fields/checkbox_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for="', input_id ,'">\n ', label ,'\n <input type="checkbox" name="', input_name ,'" value="', input_value ,'" style="', inputStyles ,'" />\n</label>\n\n'); if(helperText) { __p.push('\n<p class="helper-text help-block">\n ', helperText ,'\n</p>\n'); } __p.push('\n');}return __p.join('');};
|
377
|
+
}).call(this);
|
378
|
+
(function() {
|
379
|
+
this.JST || (this.JST = {});
|
380
|
+
this.JST["luca-src/templates/fields/file_upload_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for="', input_id ,'">\n ', label ,'\n <input type="file" name="', input_name ,'" value="', input_value ,'" style="', inputStyles ,'" />\n</label>\n\n'); if(helperText) { __p.push('\n<p class="helper-text help-block">\n ', helperText ,'\n</p>\n'); } __p.push('\n');}return __p.join('');};
|
381
|
+
}).call(this);
|
382
|
+
(function() {
|
383
|
+
this.JST || (this.JST = {});
|
384
|
+
this.JST["luca-src/templates/fields/hidden_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(' <input type="hidden" name="', input_name ,'" value="', input_value ,'" style="', inputStyles ,'" />\n');}return __p.join('');};
|
385
|
+
}).call(this);
|
386
|
+
(function() {
|
387
|
+
this.JST || (this.JST = {});
|
388
|
+
this.JST["luca-src/templates/fields/select_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for="', input_id ,'">\n ', label ,'\n</label>\n<div class="controls">\n <select name="', input_name ,'" value="', input_value ,'" style="', inputStyles ,'" ></select>\n '); if(helperText) { __p.push('\n <p class="helper-text help-block">\n ', helperText ,'\n </p>\n '); } __p.push('\n</div>\n');}return __p.join('');};
|
389
|
+
}).call(this);
|
390
|
+
(function() {
|
391
|
+
this.JST || (this.JST = {});
|
392
|
+
this.JST["luca-src/templates/fields/text_area_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for="', input_id ,'">\n ', label ,'\n</label>\n<div class="controls">\n <textarea name="', input_name ,'" style="', inputStyles ,'" >', input_value ,'</textarea>\n '); if(helperText) { __p.push('\n <p class="helper-text help-block">\n ', helperText ,'\n </p>\n '); } __p.push('\n</div>\n');}return __p.join('');};
|
393
|
+
}).call(this);
|
394
|
+
(function() {
|
395
|
+
this.JST || (this.JST = {});
|
396
|
+
this.JST["luca-src/templates/fields/text_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(''); if(typeof(label)!=="undefined" && (typeof(hideLabel) !== "undefined" && !hideLabel) || (typeof(hideLabel)==="undefined")) {__p.push('\n<label class="control-label" for="', input_id ,'">', label ,'</label>\n'); } __p.push('\n\n<div class="controls">\n'); if( typeof(addOn) !== "undefined" ) { __p.push('\n <span class="add-on">', addOn ,'</span>\n'); } __p.push('\n<input type="text" name="', input_name ,'" style="', inputStyles ,'" value="', input_value ,'" />\n'); if(helperText) { __p.push('\n<p class="helper-text help-block">\n ', helperText ,'\n</p>\n'); } __p.push('\n\n</div>\n');}return __p.join('');};
|
397
|
+
}).call(this);
|
398
|
+
(function() {
|
399
|
+
this.JST || (this.JST = {});
|
400
|
+
this.JST["luca-src/templates/table_view"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<thead></thead>\n<tbody class="table-body"></tbody>\n<tfoot></tfoot>\n<caption></caption>\n');}return __p.join('');};
|
401
|
+
}).call(this);
|
402
|
+
(function() {
|
403
|
+
var currentNamespace,
|
404
|
+
__slice = Array.prototype.slice;
|
335
405
|
|
336
406
|
Luca.util.resolve = function(accessor, source_object) {
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
407
|
+
var resolved;
|
408
|
+
try {
|
409
|
+
source_object || (source_object = window || global);
|
410
|
+
resolved = _(accessor.split(/\./)).inject(function(obj, key) {
|
411
|
+
return obj = obj != null ? obj[key] : void 0;
|
412
|
+
}, source_object);
|
413
|
+
} catch (e) {
|
414
|
+
console.log("Error resolving", accessor, source_object);
|
415
|
+
throw e;
|
416
|
+
}
|
417
|
+
return resolved;
|
341
418
|
};
|
342
419
|
|
343
420
|
Luca.util.nestedValue = Luca.util.resolve;
|
344
421
|
|
422
|
+
Luca.util.argumentsLogger = function(prompt) {
|
423
|
+
return function() {
|
424
|
+
return console.log(prompt, arguments);
|
425
|
+
};
|
426
|
+
};
|
427
|
+
|
428
|
+
Luca.util.read = function() {
|
429
|
+
var args, property;
|
430
|
+
property = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
431
|
+
if (_.isFunction(property)) {
|
432
|
+
return property.apply(this, args);
|
433
|
+
} else {
|
434
|
+
return property;
|
435
|
+
}
|
436
|
+
};
|
437
|
+
|
345
438
|
Luca.util.classify = function(string) {
|
346
439
|
if (string == null) string = "";
|
347
440
|
return _.string.camelize(_.string.capitalize(string));
|
@@ -488,13 +581,13 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
488
581
|
|
489
582
|
}).call(this);
|
490
583
|
(function() {
|
491
|
-
var DeferredBindingProxy
|
584
|
+
var DeferredBindingProxy,
|
585
|
+
__slice = Array.prototype.slice;
|
492
586
|
|
493
587
|
DeferredBindingProxy = (function() {
|
494
588
|
|
495
589
|
function DeferredBindingProxy(object, operation, wrapWithUnderscore) {
|
496
|
-
var fn
|
497
|
-
_this = this;
|
590
|
+
var fn;
|
498
591
|
this.object = object;
|
499
592
|
if (wrapWithUnderscore == null) wrapWithUnderscore = true;
|
500
593
|
if (_.isFunction(operation)) {
|
@@ -506,11 +599,11 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
506
599
|
throw "Must pass a function or a string representing one";
|
507
600
|
}
|
508
601
|
if (wrapWithUnderscore === true) {
|
509
|
-
this.fn = function() {
|
602
|
+
this.fn = _.bind(function() {
|
510
603
|
return _.defer(fn);
|
511
|
-
};
|
604
|
+
}, this.object);
|
512
605
|
} else {
|
513
|
-
this.fn = fn;
|
606
|
+
this.fn = _.bind(fn, this.object);
|
514
607
|
}
|
515
608
|
this;
|
516
609
|
}
|
@@ -544,15 +637,80 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
544
637
|
}
|
545
638
|
};
|
546
639
|
|
640
|
+
Luca.EventsExt = {
|
641
|
+
waitUntil: function(trigger, context) {
|
642
|
+
return this.waitFor.call(this, trigger, context);
|
643
|
+
},
|
644
|
+
waitFor: function(trigger, context) {
|
645
|
+
var proxy, self;
|
646
|
+
self = this;
|
647
|
+
return proxy = {
|
648
|
+
on: function(target) {
|
649
|
+
return target.waitFor.call(target, trigger, context);
|
650
|
+
},
|
651
|
+
and: function() {
|
652
|
+
var fn, runList, _i, _len, _results;
|
653
|
+
runList = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
654
|
+
_results = [];
|
655
|
+
for (_i = 0, _len = runList.length; _i < _len; _i++) {
|
656
|
+
fn = runList[_i];
|
657
|
+
fn = _.isFunction(fn) ? fn : self[fn];
|
658
|
+
_results.push(self.once(trigger, fn, context));
|
659
|
+
}
|
660
|
+
return _results;
|
661
|
+
},
|
662
|
+
andThen: function() {
|
663
|
+
return self.and.apply(self, arguments);
|
664
|
+
}
|
665
|
+
};
|
666
|
+
},
|
667
|
+
relayEvent: function(trigger) {
|
668
|
+
var _this = this;
|
669
|
+
return {
|
670
|
+
on: function() {
|
671
|
+
var components;
|
672
|
+
components = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
673
|
+
return {
|
674
|
+
to: function() {
|
675
|
+
var component, target, targets, _i, _len, _results;
|
676
|
+
targets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
677
|
+
_results = [];
|
678
|
+
for (_i = 0, _len = targets.length; _i < _len; _i++) {
|
679
|
+
target = targets[_i];
|
680
|
+
_results.push((function() {
|
681
|
+
var _j, _len2, _results2,
|
682
|
+
_this = this;
|
683
|
+
_results2 = [];
|
684
|
+
for (_j = 0, _len2 = components.length; _j < _len2; _j++) {
|
685
|
+
component = components[_j];
|
686
|
+
_results2.push(component.on(trigger, function() {
|
687
|
+
var args;
|
688
|
+
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
689
|
+
args.unshift(trigger);
|
690
|
+
return target.trigger.apply(target, args);
|
691
|
+
}));
|
692
|
+
}
|
693
|
+
return _results2;
|
694
|
+
}).call(_this));
|
695
|
+
}
|
696
|
+
return _results;
|
697
|
+
}
|
698
|
+
};
|
699
|
+
}
|
700
|
+
};
|
701
|
+
}
|
702
|
+
};
|
703
|
+
|
547
704
|
}).call(this);
|
548
705
|
(function() {
|
549
|
-
var DefineProxy
|
550
|
-
|
551
|
-
Luca.define = function(componentName) {
|
552
|
-
return new DefineProxy(componentName);
|
553
|
-
};
|
706
|
+
var DefineProxy,
|
707
|
+
__slice = Array.prototype.slice;
|
554
708
|
|
555
|
-
|
709
|
+
_.mixin({
|
710
|
+
def: Luca.component = Luca.define = Luca.register = function(componentName) {
|
711
|
+
return new DefineProxy(componentName);
|
712
|
+
}
|
713
|
+
});
|
556
714
|
|
557
715
|
DefineProxy = (function() {
|
558
716
|
|
@@ -560,6 +718,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
560
718
|
var parts;
|
561
719
|
this.namespace = Luca.util.namespace();
|
562
720
|
this.componentId = this.componentName = componentName;
|
721
|
+
this.superClassName = 'Luca.View';
|
563
722
|
if (componentName.match(/\./)) {
|
564
723
|
this.namespaced = true;
|
565
724
|
parts = componentName.split('.');
|
@@ -589,19 +748,58 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
589
748
|
return this;
|
590
749
|
};
|
591
750
|
|
592
|
-
DefineProxy.prototype.
|
593
|
-
|
751
|
+
DefineProxy.prototype.triggers = function() {
|
752
|
+
var hook, hooks, _i, _len;
|
753
|
+
hooks = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
754
|
+
_.defaults(this.properties || (this.properties = {}), {
|
755
|
+
hooks: []
|
756
|
+
});
|
757
|
+
for (_i = 0, _len = hooks.length; _i < _len; _i++) {
|
758
|
+
hook = hooks[_i];
|
759
|
+
this.properties.hooks.push(hook);
|
760
|
+
}
|
761
|
+
this.properties.hooks = _.uniq(this.properties.hooks);
|
594
762
|
return this;
|
595
763
|
};
|
596
764
|
|
597
|
-
DefineProxy.prototype
|
765
|
+
DefineProxy.prototype.includes = function() {
|
766
|
+
var include, includes, _i, _len;
|
767
|
+
includes = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
768
|
+
_.defaults(this.properties || (this.properties = {}), {
|
769
|
+
include: []
|
770
|
+
});
|
771
|
+
for (_i = 0, _len = includes.length; _i < _len; _i++) {
|
772
|
+
include = includes[_i];
|
773
|
+
this.properties.include.push(include);
|
774
|
+
}
|
775
|
+
this.properties.include = _.uniq(this.properties.include);
|
776
|
+
return this;
|
777
|
+
};
|
778
|
+
|
779
|
+
DefineProxy.prototype.mixesIn = function() {
|
780
|
+
var mixin, mixins, _i, _len;
|
781
|
+
mixins = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
782
|
+
_.defaults(this.properties || (this.properties = {}), {
|
783
|
+
mixins: []
|
784
|
+
});
|
785
|
+
for (_i = 0, _len = mixins.length; _i < _len; _i++) {
|
786
|
+
mixin = mixins[_i];
|
787
|
+
this.properties.mixins.push(mixin);
|
788
|
+
}
|
789
|
+
this.properties.mixins = _.uniq(this.properties.mixins);
|
790
|
+
return this;
|
791
|
+
};
|
792
|
+
|
793
|
+
DefineProxy.prototype.defaultProperties = function(properties) {
|
598
794
|
var at, componentType, _base;
|
795
|
+
if (properties == null) properties = {};
|
796
|
+
_.defaults((this.properties || (this.properties = {})), properties);
|
599
797
|
at = this.namespaced ? Luca.util.resolve(this.namespace, window || global) : window || global;
|
600
798
|
if (this.namespaced && !(at != null)) {
|
601
799
|
eval("(window||global)." + this.namespace + " = {}");
|
602
800
|
at = Luca.util.resolve(this.namespace, window || global);
|
603
801
|
}
|
604
|
-
at[this.componentId] = Luca.extend(this.superClassName, this.componentName, properties);
|
802
|
+
at[this.componentId] = Luca.extend(this.superClassName, this.componentName, this.properties);
|
605
803
|
if (Luca.autoRegister === true) {
|
606
804
|
if (Luca.isViewPrototype(at[this.componentId])) componentType = "view";
|
607
805
|
if (Luca.isCollectionPrototype(at[this.componentId])) {
|
@@ -610,7 +808,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
610
808
|
componentType = "collection";
|
611
809
|
}
|
612
810
|
if (Luca.isModelPrototype(at[this.componentId])) componentType = "model";
|
613
|
-
Luca.
|
811
|
+
Luca.registerComponent(_.string.underscored(this.componentId), this.componentName, componentType);
|
614
812
|
}
|
615
813
|
return at[this.componentId];
|
616
814
|
};
|
@@ -619,12 +817,19 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
619
817
|
|
620
818
|
})();
|
621
819
|
|
820
|
+
DefineProxy.prototype.behavesAs = DefineProxy.prototype.uses = DefineProxy.prototype.mixesIn;
|
821
|
+
|
822
|
+
DefineProxy.prototype.defines = DefineProxy.prototype.defaults = DefineProxy.prototype.exports = DefineProxy.prototype.defaultProperties;
|
823
|
+
|
824
|
+
DefineProxy.prototype.defaultsTo = DefineProxy.prototype.enhance = DefineProxy.prototype["with"] = DefineProxy.prototype.defaultProperties;
|
825
|
+
|
622
826
|
Luca.extend = function(superClassName, childName, properties) {
|
623
|
-
var definition,
|
827
|
+
var definition, include, superClass, _i, _len, _ref;
|
624
828
|
if (properties == null) properties = {};
|
625
829
|
superClass = Luca.util.resolve(superClassName, window || global);
|
830
|
+
superClass.__initializers || (superClass.__initializers = []);
|
626
831
|
if (!_.isFunction(superClass != null ? superClass.extend : void 0)) {
|
627
|
-
throw "" + superClassName + " is not a valid component to extend from";
|
832
|
+
throw "Error defining " + childName + ". " + superClassName + " is not a valid component to extend from";
|
628
833
|
}
|
629
834
|
properties.displayName = childName;
|
630
835
|
properties._superClass = function() {
|
@@ -633,48 +838,128 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
633
838
|
};
|
634
839
|
properties._super = function(method, context, args) {
|
635
840
|
var _ref;
|
841
|
+
if (context == null) context = this;
|
842
|
+
if (args == null) args = [];
|
636
843
|
return (_ref = this._superClass().prototype[method]) != null ? _ref.apply(context, args) : void 0;
|
637
844
|
};
|
638
845
|
definition = superClass.extend(properties);
|
639
846
|
if (_.isArray(properties != null ? properties.include : void 0)) {
|
640
847
|
_ref = properties.include;
|
641
848
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
642
|
-
|
643
|
-
if (_.isString(
|
644
|
-
_.extend(definition.prototype,
|
849
|
+
include = _ref[_i];
|
850
|
+
if (_.isString(include)) include = Luca.util.resolve(include);
|
851
|
+
_.extend(definition.prototype, include);
|
645
852
|
}
|
646
853
|
}
|
647
854
|
return definition;
|
648
855
|
};
|
649
856
|
|
650
|
-
|
651
|
-
|
652
|
-
|
857
|
+
Luca.mixin = function(mixinName) {
|
858
|
+
var namespace, resolved;
|
859
|
+
namespace = _(Luca.mixin.namespaces).detect(function(space) {
|
860
|
+
var _ref;
|
861
|
+
return ((_ref = Luca.util.resolve(space)) != null ? _ref[mixinName] : void 0) != null;
|
862
|
+
});
|
863
|
+
namespace || (namespace = "Luca.modules");
|
864
|
+
resolved = Luca.util.resolve(namespace)[mixinName];
|
865
|
+
if (resolved == null) {
|
866
|
+
console.log("Could not find " + mixinName + " in ", Luca.mixin.namespaces);
|
867
|
+
}
|
868
|
+
return resolved;
|
869
|
+
};
|
870
|
+
|
871
|
+
Luca.mixin.namespaces = ["Luca.modules"];
|
872
|
+
|
873
|
+
Luca.mixin.namespace = function(namespace) {
|
874
|
+
Luca.mixin.namespaces.push(namespace);
|
875
|
+
return Luca.mixin.namespaces = _(Luca.mixin.namespaces).uniq();
|
876
|
+
};
|
877
|
+
|
878
|
+
Luca.decorate = function(componentPrototype) {
|
879
|
+
if (_.isString(componentPrototype)) {
|
880
|
+
componentPrototype = Luca.util.resolve(componentPrototype).prototype;
|
881
|
+
}
|
882
|
+
return {
|
883
|
+
"with": function(mixin) {
|
884
|
+
var mixinDefinition, mixinPrivates, sanitized, superclassMixins, _ref;
|
885
|
+
mixinDefinition = Luca.mixin(mixin);
|
886
|
+
mixinPrivates = _(mixinDefinition).chain().keys().select(function(key) {
|
887
|
+
return ("" + key).match(/^__/);
|
888
|
+
});
|
889
|
+
sanitized = _(mixinDefinition).omit(mixinPrivates.value());
|
890
|
+
_.extend(componentPrototype, sanitized);
|
891
|
+
if (mixinDefinition != null) {
|
892
|
+
if ((_ref = mixinDefinition.__included) != null) {
|
893
|
+
_ref.call(mixinDefinition, mixin);
|
894
|
+
}
|
895
|
+
}
|
896
|
+
superclassMixins = componentPrototype._superClass().prototype.mixins;
|
897
|
+
componentPrototype.mixins || (componentPrototype.mixins = []);
|
898
|
+
componentPrototype.mixins.push(mixin);
|
899
|
+
componentPrototype.mixins = componentPrototype.mixins.concat(superclassMixins);
|
900
|
+
componentPrototype.mixins = _(componentPrototype.mixins).chain().uniq().compact().value();
|
901
|
+
return componentPrototype;
|
902
|
+
}
|
903
|
+
};
|
904
|
+
};
|
905
|
+
|
906
|
+
}).call(this);
|
907
|
+
(function() {
|
908
|
+
|
909
|
+
Luca.modules.ApplicationEventBindings = {
|
910
|
+
__initializer: function() {
|
911
|
+
var app, eventTrigger, handler, _len, _ref, _ref2, _results;
|
912
|
+
if (_.isEmpty(this.applicationEvents)) return;
|
913
|
+
app = this.app;
|
914
|
+
if (_.isString(app) || _.isUndefined(app)) {
|
915
|
+
app = (_ref = Luca.Application) != null ? typeof _ref.get === "function" ? _ref.get(app) : void 0 : void 0;
|
916
|
+
}
|
917
|
+
if (!Luca.supportsEvents(app)) {
|
918
|
+
throw "Error binding to the application object on " + (this.name || this.cid);
|
919
|
+
}
|
920
|
+
_ref2 = this.applicationEvents;
|
921
|
+
_results = [];
|
922
|
+
for (handler = 0, _len = _ref2.length; handler < _len; handler++) {
|
923
|
+
eventTrigger = _ref2[handler];
|
924
|
+
if (_.isString(handler)) handler = this[handler];
|
925
|
+
if (!_.isFunction(handler)) {
|
926
|
+
throw "Error registering application event " + eventTrigger + " on " + (this.name || this.cid);
|
927
|
+
}
|
928
|
+
_results.push(app.on(eventTrigger, handler));
|
929
|
+
}
|
930
|
+
return _results;
|
931
|
+
}
|
932
|
+
};
|
933
|
+
|
934
|
+
}).call(this);
|
935
|
+
(function() {
|
936
|
+
|
937
|
+
Luca.modules.CollectionEventBindings = {
|
938
|
+
__initializer: function() {
|
939
|
+
var collection, eventTrigger, handler, key, manager, signature, _ref, _ref2, _results;
|
940
|
+
if (_.isEmpty(this.collectionEvents)) return;
|
941
|
+
manager = this.collectionManager || Luca.CollectionManager.get();
|
942
|
+
_ref = this.collectionEvents;
|
943
|
+
_results = [];
|
944
|
+
for (signature in _ref) {
|
945
|
+
handler = _ref[signature];
|
946
|
+
_ref2 = signature.split(" "), key = _ref2[0], eventTrigger = _ref2[1];
|
947
|
+
collection = manager.getOrCreate(key);
|
948
|
+
if (!collection) throw "Could not find collection specified by " + key;
|
949
|
+
if (_.isString(handler)) handler = this[handler];
|
950
|
+
if (!_.isFunction(handler)) throw "invalid collectionEvents configuration";
|
951
|
+
try {
|
952
|
+
_results.push(collection.on(eventTrigger, handler, collection));
|
953
|
+
} catch (e) {
|
954
|
+
console.log("Error Binding To Collection in registerCollectionEvents", this);
|
955
|
+
throw e;
|
956
|
+
}
|
957
|
+
}
|
958
|
+
return _results;
|
959
|
+
}
|
960
|
+
};
|
653
961
|
|
654
962
|
}).call(this);
|
655
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["components/bootstrap_form_controls"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class=\'form-actions\'>\n <a class=\'btn btn-primary submit-button\'>\n <i class=\'icon-ok icon-white\'></i>\n Save Changes\n </a>\n <a class=\'btn reset-button cancel-button\'>\n <i class=\'icon-remove\'></i>\n Cancel\n </a>\n</div>\n');}return __p.join('');}; }).call(this);
|
656
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["components/collection_loader_view"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class=\'modal\' id=\'progress-model\' style=\'display: none;\'>\n <div class=\'progress progress-info progress-striped active\'>\n <div class=\'bar\' style=\'width: 0%;\'></div>\n </div>\n <div class=\'message\'>\n Initializing...\n </div>\n</div>\n');}return __p.join('');}; }).call(this);
|
657
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["components/form_alert"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class=\'', className ,'\'>\n <a class=\'close\' data-dismiss=\'alert\' href=\'#\'>x</a>\n ', message ,'\n</div>\n');}return __p.join('');}; }).call(this);
|
658
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["components/grid_view"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class=\'luca-ui-g-view-wrapper\'>\n <div class=\'g-view-header\'></div>\n <div class=\'luca-ui-g-view-body\'>\n <table cellpadding=\'0\' cellspacing=\'0\' class=\'luca-ui-g-view scrollable-table\' width=\'100%\'>\n <thead class=\'fixed\'></thead>\n <tbody class=\'scrollable\'></tbody>\n </table>\n </div>\n <div class=\'luca-ui-g-view-footer\'></div>\n</div>\n');}return __p.join('');}; }).call(this);
|
659
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["components/grid_view_empty_text"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class=\'empty-text-wrapper\'>\n <p>\n ', text ,'\n </p>\n</div>\n');}return __p.join('');}; }).call(this);
|
660
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["components/load_mask"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class=\'load-mask\'>\n <div class=\'progress progress-striped active\'>\n <div class=\'bar\' style=\'width:1%\'></div>\n </div>\n</div>\n');}return __p.join('');}; }).call(this);
|
661
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["components/nav_bar"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class=\'navbar-inner\'>\n <div class=\'luca-ui-navbar-body container\'></div>\n</div>\n');}return __p.join('');}; }).call(this);
|
662
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["containers/basic"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class=\'', classes ,'\' id=\'', id ,'\' style=\'', style ,'\'></div>\n');}return __p.join('');}; }).call(this);
|
663
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["containers/tab_selector_container"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class=\'tab-selector-container\' id=\'', cid ,'-tab-selector\'>\n <ul class=\'nav nav-tabs\' id=\'', cid ,'-tabs-nav\'>\n '); for(var i = 0; i < components.length; i++ ) { __p.push('\n '); var component = components[i];__p.push('\n <li class=\'tab-selector\' data-target=\'', i ,'\'>\n <a data-target=\'', i ,'\'>\n ', component.title ,'\n </a>\n </li>\n '); } __p.push('\n </ul>\n</div>\n');}return __p.join('');}; }).call(this);
|
664
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["containers/tab_view"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<ul class=\'nav ', navClass ,'\' id=\'', cid ,'-tabs-selector\'></ul>\n<div class=\'tab-content\' id=\'', cid ,'-tab-view-content\'></div>\n');}return __p.join('');}; }).call(this);
|
665
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["containers/toolbar_wrapper"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class=\'luca-ui-toolbar-wrapper\' id=\'', id ,'\'></div>\n');}return __p.join('');}; }).call(this);
|
666
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["fields/button_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label> </label>\n<input class=\'btn ', input_class ,'\' id=\'', input_id ,'\' style=\'', inputStyles ,'\' type=\'', input_type ,'\' value=\'', input_value ,'\' />\n');}return __p.join('');}; }).call(this);
|
667
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["fields/button_field_link"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<a class=\'btn ', input_class ,'\'>\n '); if(icon_class.length) { __p.push('\n <i class=\'', icon_class ,'\'></i>\n '); } __p.push('\n ', input_value ,'\n</a>\n');}return __p.join('');}; }).call(this);
|
668
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["fields/checkbox_array"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<div class=\'control-group\'>\n <label for=\'', input_id ,'\'>\n ', label ,'\n </label>\n <div class=\'controls\'></div>\n</div>\n');}return __p.join('');}; }).call(this);
|
669
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["fields/checkbox_array_item"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for=\'', input_id ,'\'>\n <input id=\'', input_id ,'\' name=\'', input_name ,'\' type=\'checkbox\' value=\'', value ,'\' />\n ', label ,'\n</label>\n');}return __p.join('');}; }).call(this);
|
670
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["fields/checkbox_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for=\'', input_id ,'\'>\n ', label ,'\n <input name=\'', input_name ,'\' style=\'', inputStyles ,'\' type=\'checkbox\' value=\'', input_value ,'\' />\n</label>\n'); if(helperText) { __p.push('\n<p class=\'helper-text help-block\'>\n ', helperText ,'\n</p>\n'); } __p.push('\n');}return __p.join('');}; }).call(this);
|
671
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["fields/file_upload_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for=\'', input_id ,'\'>\n ', label ,'\n</label>\n<input id=\'', input_id ,'\' name=\'', input_name ,'\' style=\'', inputStyles ,'\' type=\'file\' />\n'); if(helperText) { __p.push('\n<p class=\'helper-text help-block\'>\n ', helperText ,'\n</p>\n'); } __p.push('\n');}return __p.join('');}; }).call(this);
|
672
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["fields/hidden_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<input id=\'', input_id ,'\' name=\'', input_name ,'\' type=\'hidden\' value=\'', input_value ,'\' />\n');}return __p.join('');}; }).call(this);
|
673
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["fields/select_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for=\'', input_id ,'\'>\n ', label ,'\n</label>\n<div class=\'controls\'>\n <select id=\'', input_id ,'\' name=\'', input_name ,'\' style=\'', inputStyles ,'\'></select>\n '); if(helperText) { __p.push('\n <p class=\'helper-text help-block\'>\n ', helperText ,'\n </p>\n '); } __p.push('\n</div>\n');}return __p.join('');}; }).call(this);
|
674
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["fields/text_area_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<label for=\'', input_id ,'\'>\n ', label ,'\n</label>\n<textarea class=\'', input_class ,'\' id=\'', input_id ,'\' name=\'', input_name ,'\' style=\'', inputStyles ,'\'></textarea>\n'); if(helperText) { __p.push('\n<p class=\'helper-text help-block\'>\n ', helperText ,'\n</p>\n'); } __p.push('\n');}return __p.join('');}; }).call(this);
|
675
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["fields/text_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(''); if(typeof(label)!=="undefined" && (typeof(hideLabel) !== "undefined" && !hideLabel) || (typeof(hideLabel)==="undefined")) {__p.push('\n<label class=\'control-label\' for=\'', input_id ,'\'>\n ', label ,'\n</label>\n'); } __p.push('\n<div class=\'controls\'>\n '); if( typeof(addOn) !== "undefined" ) { __p.push('\n <span class=\'add-on\'>\n ', addOn ,'\n </span>\n '); } __p.push('\n <input class=\'', input_class ,'\' id=\'', input_id ,'\' name=\'', input_name ,'\' placeholder=\'', placeHolder ,'\' style=\'', inputStyles ,'\' type=\'text\' />\n '); if(helperText) { __p.push('\n <p class=\'helper-text help-block\'>\n ', helperText ,'\n </p>\n '); } __p.push('\n</div>\n');}return __p.join('');}; }).call(this);
|
676
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["sample/contents"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<p>Sample Contents</p>\n');}return __p.join('');}; }).call(this);
|
677
|
-
(function() {Luca.templates || (Luca.templates = {}); Luca.templates["sample/welcome"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('welcome.luca\n');}return __p.join('');}; }).call(this);
|
678
963
|
(function() {
|
679
964
|
|
680
965
|
Luca.modules.Deferrable = {
|
@@ -695,13 +980,202 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
695
980
|
}
|
696
981
|
};
|
697
982
|
|
983
|
+
}).call(this);
|
984
|
+
(function() {
|
985
|
+
|
986
|
+
Luca.modules.DomHelpers = {
|
987
|
+
__initializer: function() {
|
988
|
+
var additional, additionalClasses, _i, _len, _results;
|
989
|
+
additionalClasses = _(this.additionalClassNames || []).clone();
|
990
|
+
if (this.wrapperClass != null) this.$wrap(this.wrapperClass);
|
991
|
+
if (_.isString(additionalClasses)) {
|
992
|
+
additionalClasses = additionalClasses.split(" ");
|
993
|
+
}
|
994
|
+
if (this.gridSpan) additionalClasses.push("span" + this.gridSpan);
|
995
|
+
if (this.gridOffset) additionalClasses.push("offset" + this.gridOffset);
|
996
|
+
if (this.gridRowFluid) additionalClasses.push("row-fluid");
|
997
|
+
if (this.gridRow) additionalClasses.push("row");
|
998
|
+
if (additionalClasses == null) return;
|
999
|
+
_results = [];
|
1000
|
+
for (_i = 0, _len = additionalClasses.length; _i < _len; _i++) {
|
1001
|
+
additional = additionalClasses[_i];
|
1002
|
+
_results.push(this.$el.addClass(additional));
|
1003
|
+
}
|
1004
|
+
return _results;
|
1005
|
+
},
|
1006
|
+
$wrap: function(wrapper) {
|
1007
|
+
if (_.isString(wrapper) && !wrapper.match(/[<>]/)) {
|
1008
|
+
wrapper = this.make("div", {
|
1009
|
+
"class": wrapper
|
1010
|
+
});
|
1011
|
+
}
|
1012
|
+
return this.$el.wrap(wrapper);
|
1013
|
+
},
|
1014
|
+
$template: function(template, variables) {
|
1015
|
+
if (variables == null) variables = {};
|
1016
|
+
return this.$el.html(Luca.template(template, variables));
|
1017
|
+
},
|
1018
|
+
$html: function(content) {
|
1019
|
+
return this.$el.html(content);
|
1020
|
+
},
|
1021
|
+
$append: function(content) {
|
1022
|
+
return this.$el.append(content);
|
1023
|
+
},
|
1024
|
+
$attach: function() {
|
1025
|
+
return this.$container().append(this.el);
|
1026
|
+
},
|
1027
|
+
$bodyEl: function() {
|
1028
|
+
return this.$el;
|
1029
|
+
},
|
1030
|
+
$container: function() {
|
1031
|
+
return $(this.container);
|
1032
|
+
}
|
1033
|
+
};
|
1034
|
+
|
1035
|
+
}).call(this);
|
1036
|
+
(function() {
|
1037
|
+
|
1038
|
+
Luca.modules.EnhancedProperties = {
|
1039
|
+
__initializer: function() {
|
1040
|
+
if (Luca.config.enhancedViewProperties !== true) return;
|
1041
|
+
if (_.isString(this.collection) && Luca.CollectionManager.get()) {
|
1042
|
+
this.collection = Luca.CollectionManager.get().getOrCreate(this.collection);
|
1043
|
+
}
|
1044
|
+
if (this.template != null) this.$template(this.template, this);
|
1045
|
+
if (_.isString(this.collectionManager)) {
|
1046
|
+
return this.collectionManager = Luca.CollectionManager.get(this.collectionManager);
|
1047
|
+
}
|
1048
|
+
}
|
1049
|
+
};
|
1050
|
+
|
1051
|
+
}).call(this);
|
1052
|
+
(function() {
|
1053
|
+
var FilterModel,
|
1054
|
+
__hasProp = Object.prototype.hasOwnProperty,
|
1055
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
1056
|
+
|
1057
|
+
Luca.modules.Filterable = {
|
1058
|
+
__included: function(component, module) {
|
1059
|
+
return _.extend(Luca.Collection.prototype, {
|
1060
|
+
__filters: {}
|
1061
|
+
});
|
1062
|
+
},
|
1063
|
+
__initializer: function(component, module) {
|
1064
|
+
var filter,
|
1065
|
+
_this = this;
|
1066
|
+
if (this.filterable === false || !Luca.isBackboneCollection(this.collection)) {
|
1067
|
+
return;
|
1068
|
+
}
|
1069
|
+
this.getCollection || (this.getCollection = function() {
|
1070
|
+
return this.collection;
|
1071
|
+
});
|
1072
|
+
filter = this.getFilterState();
|
1073
|
+
filter.on("change", function(state) {
|
1074
|
+
_this.trigger("collection:change:filter", state, _this.getCollection());
|
1075
|
+
return _this.trigger("refresh");
|
1076
|
+
});
|
1077
|
+
if (this.getQuery != null) {
|
1078
|
+
this.getQuery = _.compose(this.getQuery, function(query) {
|
1079
|
+
var obj;
|
1080
|
+
if (query == null) query = {};
|
1081
|
+
obj = _.clone(query);
|
1082
|
+
return _.extend(obj, filter.toQuery());
|
1083
|
+
});
|
1084
|
+
} else {
|
1085
|
+
this.getQuery = function() {
|
1086
|
+
return filter.toQuery();
|
1087
|
+
};
|
1088
|
+
}
|
1089
|
+
if (this.getQueryOptions != null) {
|
1090
|
+
return this.getQueryOptions = _.compose(this.getQueryOptions, function(options) {
|
1091
|
+
var obj;
|
1092
|
+
if (options == null) options = {};
|
1093
|
+
obj = _.clone(options);
|
1094
|
+
return _.extend(obj, filter.toOptions());
|
1095
|
+
});
|
1096
|
+
} else {
|
1097
|
+
return this.getQueryOptions = function() {
|
1098
|
+
return filter.toOptions();
|
1099
|
+
};
|
1100
|
+
}
|
1101
|
+
},
|
1102
|
+
getFilterState: function() {
|
1103
|
+
var _base, _name;
|
1104
|
+
return (_base = this.collection.__filters)[_name = this.cid] || (_base[_name] = new FilterModel(this.filterable));
|
1105
|
+
},
|
1106
|
+
setSortBy: function(sortBy, options) {
|
1107
|
+
if (options == null) options = {};
|
1108
|
+
return this.getFilterState().setOption('sortBy', sortBy, options);
|
1109
|
+
},
|
1110
|
+
applyFilter: function(query, options) {
|
1111
|
+
var silent;
|
1112
|
+
if (query == null) query = {};
|
1113
|
+
if (options == null) options = {};
|
1114
|
+
options = _.defaults(options, this.getQueryOptions());
|
1115
|
+
query = _.defaults(query, this.getQuery());
|
1116
|
+
silent = _(options)["delete"]('silent') === true;
|
1117
|
+
return this.getFilterState().set({
|
1118
|
+
query: query,
|
1119
|
+
options: options
|
1120
|
+
}, {
|
1121
|
+
silent: silent
|
1122
|
+
});
|
1123
|
+
}
|
1124
|
+
};
|
1125
|
+
|
1126
|
+
FilterModel = (function(_super) {
|
1127
|
+
|
1128
|
+
__extends(FilterModel, _super);
|
1129
|
+
|
1130
|
+
function FilterModel() {
|
1131
|
+
FilterModel.__super__.constructor.apply(this, arguments);
|
1132
|
+
}
|
1133
|
+
|
1134
|
+
FilterModel.prototype.setOption = function(option, value, options) {
|
1135
|
+
var payload;
|
1136
|
+
payload = {};
|
1137
|
+
payload[option] = value;
|
1138
|
+
return this.set('options', _.extend(this.toOptions(), payload), options);
|
1139
|
+
};
|
1140
|
+
|
1141
|
+
FilterModel.prototype.setQueryOption = function(option, value, options) {
|
1142
|
+
var payload;
|
1143
|
+
payload = {};
|
1144
|
+
payload[option] = value;
|
1145
|
+
return this.set('query', _.extend(this.toQuery(), payload), options);
|
1146
|
+
};
|
1147
|
+
|
1148
|
+
FilterModel.prototype.toOptions = function() {
|
1149
|
+
return this.toJSON().options;
|
1150
|
+
};
|
1151
|
+
|
1152
|
+
FilterModel.prototype.toQuery = function() {
|
1153
|
+
return this.toJSON().query;
|
1154
|
+
};
|
1155
|
+
|
1156
|
+
return FilterModel;
|
1157
|
+
|
1158
|
+
})(Backbone.Model);
|
1159
|
+
|
1160
|
+
}).call(this);
|
1161
|
+
(function() {
|
1162
|
+
|
1163
|
+
Luca.modules.GridLayout = {
|
1164
|
+
_initializer: function() {
|
1165
|
+
if (this.gridSpan) this.$el.addClass("span" + this.gridSpan);
|
1166
|
+
if (this.gridOffset) this.$el.addClass("offset" + this.gridOffset);
|
1167
|
+
if (this.gridRowFluid) this.$el.addClass("row-fluid");
|
1168
|
+
if (this.gridRow) return this.$el.addClass("row");
|
1169
|
+
}
|
1170
|
+
};
|
1171
|
+
|
698
1172
|
}).call(this);
|
699
1173
|
(function() {
|
700
1174
|
|
701
1175
|
Luca.modules.LoadMaskable = {
|
702
|
-
|
1176
|
+
__initializer: function() {
|
703
1177
|
var _this = this;
|
704
|
-
|
1178
|
+
if (this.loadMask !== true) return;
|
705
1179
|
if (this.loadMask === true) {
|
706
1180
|
this.defer(function() {
|
707
1181
|
_this.$el.addClass('with-mask');
|
@@ -710,10 +1184,16 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
710
1184
|
return _this.$('.load-mask').hide();
|
711
1185
|
}
|
712
1186
|
}).until("after:render");
|
713
|
-
this.on(this.loadmaskEnableEvent || "enable:loadmask", this.applyLoadMask);
|
714
|
-
return this.on(this.loadmaskDisableEvent || "disable:loadmask", this.applyLoadMask);
|
1187
|
+
this.on(this.loadmaskEnableEvent || "enable:loadmask", this.applyLoadMask, this);
|
1188
|
+
return this.on(this.loadmaskDisableEvent || "disable:loadmask", this.applyLoadMask, this);
|
715
1189
|
}
|
716
1190
|
},
|
1191
|
+
showLoadMask: function() {
|
1192
|
+
return this.trigger("enable:loadmask");
|
1193
|
+
},
|
1194
|
+
hideLoadMask: function() {
|
1195
|
+
return this.trigger("disable:loadmask");
|
1196
|
+
},
|
717
1197
|
loadMaskTarget: function() {
|
718
1198
|
if (this.loadMaskEl != null) {
|
719
1199
|
return this.$(this.loadMaskEl);
|
@@ -837,7 +1317,193 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
837
1317
|
|
838
1318
|
}).call(this);
|
839
1319
|
(function() {
|
840
|
-
var
|
1320
|
+
var applyModalConfig;
|
1321
|
+
|
1322
|
+
Luca.modules.ModalView = {
|
1323
|
+
closeOnEscape: true,
|
1324
|
+
showOnInitialize: false,
|
1325
|
+
backdrop: false,
|
1326
|
+
__initializer: function() {
|
1327
|
+
this.$el.addClass("modal");
|
1328
|
+
this.on("before:render", applyModalConfig, this);
|
1329
|
+
return this;
|
1330
|
+
},
|
1331
|
+
container: function() {
|
1332
|
+
return $('body');
|
1333
|
+
},
|
1334
|
+
toggle: function() {
|
1335
|
+
return this.$el.modal('toggle');
|
1336
|
+
},
|
1337
|
+
show: function() {
|
1338
|
+
return this.$el.modal('show');
|
1339
|
+
},
|
1340
|
+
hide: function() {
|
1341
|
+
return this.$el.modal('hide');
|
1342
|
+
}
|
1343
|
+
};
|
1344
|
+
|
1345
|
+
applyModalConfig = function() {
|
1346
|
+
this.$el.addClass('modal');
|
1347
|
+
if (this.fade === true) this.$el.addClass('fade');
|
1348
|
+
$('body').append(this.$el);
|
1349
|
+
this.$el.modal({
|
1350
|
+
backdrop: this.backdrop === true,
|
1351
|
+
keyboard: this.closeOnEscape === true,
|
1352
|
+
show: this.showOnInitialize === true
|
1353
|
+
});
|
1354
|
+
return this;
|
1355
|
+
};
|
1356
|
+
|
1357
|
+
}).call(this);
|
1358
|
+
(function() {
|
1359
|
+
|
1360
|
+
Luca.modules.Paginatable = {
|
1361
|
+
paginatorViewClass: 'Luca.components.PaginationControl',
|
1362
|
+
paginationSelector: ".toolbar.bottom",
|
1363
|
+
__included: function() {
|
1364
|
+
return _.extend(Luca.Collection.prototype, {
|
1365
|
+
__paginators: {}
|
1366
|
+
});
|
1367
|
+
},
|
1368
|
+
__initializer: function() {
|
1369
|
+
var collection, old, paginationState,
|
1370
|
+
_this = this;
|
1371
|
+
if (this.paginatable === false || !Luca.isBackboneCollection(this.collection)) {
|
1372
|
+
return;
|
1373
|
+
}
|
1374
|
+
_.bindAll(this, "paginationControl");
|
1375
|
+
this.getCollection || (this.getCollection = function() {
|
1376
|
+
return this.collection;
|
1377
|
+
});
|
1378
|
+
collection = this.getCollection();
|
1379
|
+
paginationState = this.getPaginationState();
|
1380
|
+
paginationState.on("change", function(state) {
|
1381
|
+
_this.trigger("collection:change:pagination", state, collection);
|
1382
|
+
return _this.trigger("refresh");
|
1383
|
+
});
|
1384
|
+
this.on("after:refresh", function(models, query, options) {
|
1385
|
+
return _.defer(function() {
|
1386
|
+
return _this.updatePagination.call(_this, models, query, options);
|
1387
|
+
});
|
1388
|
+
});
|
1389
|
+
this.on("after:render", function() {
|
1390
|
+
return _this.paginationControl().refresh();
|
1391
|
+
});
|
1392
|
+
if (old = this.getQueryOptions) {
|
1393
|
+
return this.getQueryOptions = function() {
|
1394
|
+
return _.extend(old(), paginationState.toJSON());
|
1395
|
+
};
|
1396
|
+
} else {
|
1397
|
+
return this.getQueryOptions = function() {
|
1398
|
+
return paginationState.toJSON();
|
1399
|
+
};
|
1400
|
+
}
|
1401
|
+
},
|
1402
|
+
getPaginationState: function() {
|
1403
|
+
var _base, _name;
|
1404
|
+
return (_base = this.collection.__paginators)[_name = this.cid] || (_base[_name] = this.paginationControl().state);
|
1405
|
+
},
|
1406
|
+
paginationContainer: function() {
|
1407
|
+
return this.$(">" + this.paginationSelector);
|
1408
|
+
},
|
1409
|
+
setCurrentPage: function(page, options) {
|
1410
|
+
if (page == null) page = 1;
|
1411
|
+
if (options == null) options = {};
|
1412
|
+
return this.getPaginationState().set('page', page, options);
|
1413
|
+
},
|
1414
|
+
setLimit: function(limit, options) {
|
1415
|
+
if (limit == null) limit = 0;
|
1416
|
+
if (options == null) options = {};
|
1417
|
+
return this.getPaginationState().set('limit', limit, options);
|
1418
|
+
},
|
1419
|
+
updatePagination: function(models, query, options) {
|
1420
|
+
var itemCount, paginator, totalCount, _ref;
|
1421
|
+
if (models == null) models = [];
|
1422
|
+
if (query == null) query = {};
|
1423
|
+
if (options == null) options = {};
|
1424
|
+
_.defaults(options, this.getQueryOptions(), {
|
1425
|
+
limit: 0
|
1426
|
+
});
|
1427
|
+
paginator = this.paginationControl();
|
1428
|
+
itemCount = (models != null ? models.length : void 0) || 0;
|
1429
|
+
totalCount = (_ref = this.getCollection()) != null ? _ref.length : void 0;
|
1430
|
+
if (itemCount === 0 || totalCount <= options.limit) {
|
1431
|
+
paginator.$el.hide();
|
1432
|
+
} else {
|
1433
|
+
paginator.$el.show();
|
1434
|
+
}
|
1435
|
+
return paginator.state.set({
|
1436
|
+
page: options.page,
|
1437
|
+
limit: options.limit
|
1438
|
+
});
|
1439
|
+
},
|
1440
|
+
paginationControl: function() {
|
1441
|
+
if (this.paginator != null) return this.paginator;
|
1442
|
+
_.defaults(this.paginatable || (this.paginatable = {}), {
|
1443
|
+
page: 1,
|
1444
|
+
limit: 20
|
1445
|
+
});
|
1446
|
+
this.paginator = Luca.util.lazyComponent({
|
1447
|
+
type: "pagination_control",
|
1448
|
+
collection: this.getCollection(),
|
1449
|
+
defaultState: this.paginatable
|
1450
|
+
});
|
1451
|
+
return this.paginator;
|
1452
|
+
},
|
1453
|
+
renderPaginationControl: function() {
|
1454
|
+
this.paginationControl();
|
1455
|
+
return this.paginationContainer().append(this.paginationControl().render().$el);
|
1456
|
+
}
|
1457
|
+
};
|
1458
|
+
|
1459
|
+
}).call(this);
|
1460
|
+
(function() {
|
1461
|
+
|
1462
|
+
Luca.modules.StateModel = {
|
1463
|
+
__initializer: function() {
|
1464
|
+
var _this = this;
|
1465
|
+
if (this.stateful !== true) return;
|
1466
|
+
if ((this.state != null) && !Luca.isBackboneModel(this.state)) return;
|
1467
|
+
this.state = new Backbone.Model(this.defaultState || {});
|
1468
|
+
this.set || (this.set = function() {
|
1469
|
+
return _this.state.set.apply(_this.state, arguments);
|
1470
|
+
});
|
1471
|
+
this.get || (this.get = function() {
|
1472
|
+
return _this.state.get.apply(_this.state, arguments);
|
1473
|
+
});
|
1474
|
+
return this.state.on("change", function(state) {
|
1475
|
+
var changed, previousValues, value, _len, _ref, _results;
|
1476
|
+
_this.trigger("state:change", state);
|
1477
|
+
previousValues = state.previousAttributes();
|
1478
|
+
_ref = state.changedAttributes;
|
1479
|
+
_results = [];
|
1480
|
+
for (value = 0, _len = _ref.length; value < _len; value++) {
|
1481
|
+
changed = _ref[value];
|
1482
|
+
_results.push(_this.trigger("state:change:" + changed, value, state.previous(changed)));
|
1483
|
+
}
|
1484
|
+
return _results;
|
1485
|
+
});
|
1486
|
+
}
|
1487
|
+
};
|
1488
|
+
|
1489
|
+
}).call(this);
|
1490
|
+
(function() {
|
1491
|
+
|
1492
|
+
Luca.modules.Templating = {
|
1493
|
+
__initializer: function() {
|
1494
|
+
var template, templateContent, templateVars;
|
1495
|
+
templateVars = Luca.util.read.call(this, this.bodyTemplateVars) || {};
|
1496
|
+
if (template = this.bodyTemplate) {
|
1497
|
+
this.$el.empty();
|
1498
|
+
templateContent = Luca.template(template, templateVars);
|
1499
|
+
return Luca.View.prototype.$html.call(this, templateContent);
|
1500
|
+
}
|
1501
|
+
}
|
1502
|
+
};
|
1503
|
+
|
1504
|
+
}).call(this);
|
1505
|
+
(function() {
|
1506
|
+
var componentCacheStore, registry;
|
841
1507
|
|
842
1508
|
registry = {
|
843
1509
|
classes: {},
|
@@ -846,21 +1512,38 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
846
1512
|
namespaces: ['Luca.containers', 'Luca.components']
|
847
1513
|
};
|
848
1514
|
|
849
|
-
|
1515
|
+
componentCacheStore = {
|
850
1516
|
cid_index: {},
|
851
1517
|
name_index: {}
|
852
1518
|
};
|
853
1519
|
|
854
|
-
Luca.
|
1520
|
+
Luca.config.defaultComponentClass = Luca.defaultComponentClass = 'Luca.View';
|
1521
|
+
|
1522
|
+
Luca.config.defaultComponentType = Luca.defaultComponentType = 'view';
|
855
1523
|
|
856
|
-
Luca.
|
1524
|
+
Luca.registry.aliases = {
|
1525
|
+
grid: "grid_view",
|
1526
|
+
form: "form_view",
|
1527
|
+
text: "text_field",
|
1528
|
+
button: "button_field",
|
1529
|
+
select: "select_field",
|
1530
|
+
card: "card_view",
|
1531
|
+
paged: "card_view",
|
1532
|
+
wizard: "card_view",
|
1533
|
+
collection: "collection_view",
|
1534
|
+
list: "collection_view",
|
1535
|
+
multi: "collection_multi_view",
|
1536
|
+
table: "table_view"
|
1537
|
+
};
|
1538
|
+
|
1539
|
+
Luca.registerComponent = function(component, prototypeName, componentType) {
|
857
1540
|
if (componentType == null) componentType = "view";
|
858
1541
|
Luca.trigger("component:registered", component, prototypeName);
|
859
1542
|
switch (componentType) {
|
860
1543
|
case "model":
|
861
1544
|
return registry.model_classes[component] = prototypeName;
|
862
1545
|
case "collection":
|
863
|
-
return registry.
|
1546
|
+
return registry.collection_classes[component] = prototypeName;
|
864
1547
|
default:
|
865
1548
|
return registry.classes[component] = prototypeName;
|
866
1549
|
}
|
@@ -877,10 +1560,10 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
877
1560
|
return instance != null ? (_ref = instance.refreshCode) != null ? _ref.call(instance, prototypeDefinition) : void 0 : void 0;
|
878
1561
|
});
|
879
1562
|
}
|
880
|
-
return Luca.
|
1563
|
+
return Luca.registerComponent(component, prototypeName);
|
881
1564
|
};
|
882
1565
|
|
883
|
-
Luca.registry.addNamespace = function(identifier) {
|
1566
|
+
Luca.registry.addNamespace = Luca.registry.namespace = function(identifier) {
|
884
1567
|
registry.namespaces.push(identifier);
|
885
1568
|
return registry.namespaces = _(registry.namespaces).uniq();
|
886
1569
|
};
|
@@ -896,18 +1579,6 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
896
1579
|
});
|
897
1580
|
};
|
898
1581
|
|
899
|
-
Luca.registry.aliases = {
|
900
|
-
grid: "grid_view",
|
901
|
-
form: "form_view",
|
902
|
-
text: "text_field",
|
903
|
-
button: "button_field",
|
904
|
-
select: "select_field",
|
905
|
-
card: "card_view",
|
906
|
-
paged: "card_view",
|
907
|
-
wizard: "card_view",
|
908
|
-
collection: "collection_view"
|
909
|
-
};
|
910
|
-
|
911
1582
|
Luca.registry.lookup = function(ctype) {
|
912
1583
|
var alias, c, className, fullPath, parents, _ref;
|
913
1584
|
if (alias = Luca.registry.aliases[ctype]) ctype = alias;
|
@@ -921,14 +1592,20 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
921
1592
|
};
|
922
1593
|
|
923
1594
|
Luca.registry.instances = function() {
|
924
|
-
return _(
|
1595
|
+
return _(componentCacheStore.cid_index).values();
|
1596
|
+
};
|
1597
|
+
|
1598
|
+
Luca.registry.findInstancesByClass = function(componentClass) {
|
1599
|
+
return Luca.registry.findInstancesByClassName(componentClass.displayName);
|
925
1600
|
};
|
926
1601
|
|
927
1602
|
Luca.registry.findInstancesByClassName = function(className) {
|
928
1603
|
var instances;
|
1604
|
+
if (!_.isString(className)) className = className.displayName;
|
929
1605
|
instances = Luca.registry.instances();
|
930
1606
|
return _(instances).select(function(instance) {
|
931
|
-
var _ref;
|
1607
|
+
var isClass, _ref;
|
1608
|
+
isClass = instance.displayName === className;
|
932
1609
|
return instance.displayName === className || (typeof instance._superClass === "function" ? (_ref = instance._superClass()) != null ? _ref.displayName : void 0 : void 0) === className;
|
933
1610
|
});
|
934
1611
|
};
|
@@ -947,20 +1624,20 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
947
1624
|
});
|
948
1625
|
};
|
949
1626
|
|
950
|
-
Luca.cache = function(
|
1627
|
+
Luca.cache = Luca.cacheInstance = function(cacheKey, object) {
|
951
1628
|
var lookup_id;
|
952
|
-
if (
|
953
|
-
|
954
|
-
if (
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
1629
|
+
if (cacheKey == null) return;
|
1630
|
+
if ((object != null ? object.doNotCache : void 0) === true) return object;
|
1631
|
+
if (object != null) componentCacheStore.cid_index[cacheKey] = object;
|
1632
|
+
object = componentCacheStore.cid_index[cacheKey];
|
1633
|
+
if ((object != null ? object.component_name : void 0) != null) {
|
1634
|
+
componentCacheStore.name_index[object.component_name] = object.cid;
|
1635
|
+
} else if ((object != null ? object.name : void 0) != null) {
|
1636
|
+
componentCacheStore.name_index[object.name] = object.cid;
|
960
1637
|
}
|
961
|
-
if (
|
962
|
-
lookup_id =
|
963
|
-
return
|
1638
|
+
if (object != null) return object;
|
1639
|
+
lookup_id = componentCacheStore.name_index[cacheKey];
|
1640
|
+
return componentCacheStore.cid_index[lookup_id];
|
964
1641
|
};
|
965
1642
|
|
966
1643
|
}).call(this);
|
@@ -1006,93 +1683,45 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1006
1683
|
|
1007
1684
|
}).call(this);
|
1008
1685
|
(function() {
|
1009
|
-
var bindAllEventHandlers,
|
1686
|
+
var bindAllEventHandlers, bindEventHandlers, view;
|
1010
1687
|
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1688
|
+
view = Luca.register("Luca.View");
|
1689
|
+
|
1690
|
+
view["extends"]("Backbone.View");
|
1691
|
+
|
1692
|
+
view.includes("Luca.Events", "Luca.modules.DomHelpers");
|
1693
|
+
|
1694
|
+
view.mixesIn("DomHelpers", "Templating", "EnhancedProperties", "CollectionEventBindings", "ApplicationEventBindings", "StateModel");
|
1695
|
+
|
1696
|
+
view.triggers("before:initialize", "after:initialize", "before:render", "after:render", "first:activation", "activation", "deactivation");
|
1697
|
+
|
1698
|
+
view.defines({
|
1015
1699
|
initialize: function(options) {
|
1016
|
-
var
|
1700
|
+
var module, _i, _len, _ref, _ref2, _ref3, _ref4;
|
1017
1701
|
this.options = options != null ? options : {};
|
1018
1702
|
this.trigger("before:initialize", this, this.options);
|
1019
1703
|
_.extend(this, this.options);
|
1020
|
-
if (this.name != null) this.cid = _.uniqueId(this.name);
|
1021
|
-
templateVars = this.bodyTemplateVars ? this.bodyTemplateVars.call(this) : this;
|
1022
|
-
if (template = this.bodyTemplate) {
|
1023
|
-
this.$el.empty();
|
1024
|
-
Luca.View.prototype.$html.call(this, Luca.template(template, templateVars));
|
1025
|
-
}
|
1026
|
-
Luca.cache(this.cid, this);
|
1027
|
-
this.setupHooks(_(Luca.View.prototype.hooks.concat(this.hooks)).uniq());
|
1028
1704
|
if (this.autoBindEventHandlers === true || this.bindAllEvents === true) {
|
1029
1705
|
bindAllEventHandlers.call(this);
|
1030
1706
|
}
|
1031
|
-
if (this.
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
if (this.gridOffset) {
|
1038
|
-
this.additionalClassNames.push("offset" + this.gridOffset);
|
1039
|
-
}
|
1040
|
-
if (this.gridRowFluid) this.additionalClassNames.push("row-fluid");
|
1041
|
-
if (this.gridRow) this.additionalClassNames.push("row");
|
1042
|
-
if (((_ref = this.additionalClassNames) != null ? _ref.length : void 0) > 0) {
|
1043
|
-
_ref2 = this.additionalClassNames;
|
1707
|
+
if (this.name != null) this.cid = _.uniqueId(this.name);
|
1708
|
+
this.$el.attr("data-luca-id", this.name || this.cid);
|
1709
|
+
Luca.cacheInstance(this.cid, this);
|
1710
|
+
this.setupHooks(_(Luca.View.prototype.hooks.concat(this.hooks)).uniq());
|
1711
|
+
if (((_ref = this.mixins) != null ? _ref.length : void 0) > 0) {
|
1712
|
+
_ref2 = this.mixins;
|
1044
1713
|
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
1045
|
-
|
1046
|
-
|
1714
|
+
module = _ref2[_i];
|
1715
|
+
if ((_ref3 = Luca.mixin(module)) != null) {
|
1716
|
+
if ((_ref4 = _ref3.__initializer) != null) {
|
1717
|
+
_ref4.call(this, this, module);
|
1718
|
+
}
|
1719
|
+
}
|
1047
1720
|
}
|
1048
1721
|
}
|
1049
|
-
if (this.wrapperClass != null) this.$wrap(this.wrapperClass);
|
1050
|
-
registerCollectionEvents.call(this);
|
1051
|
-
registerApplicationEvents.call(this);
|
1052
1722
|
this.delegateEvents();
|
1053
|
-
if (this.stateful === true && !(this.state != null)) {
|
1054
|
-
this.state = new Backbone.Model(this.defaultState || {});
|
1055
|
-
if (this.set == null) {
|
1056
|
-
this.set = _.bind(this, this.state.set);
|
1057
|
-
this.get = _.bind(this, this.state.get);
|
1058
|
-
}
|
1059
|
-
}
|
1060
|
-
if (((_ref3 = this.mixins) != null ? _ref3.length : void 0) > 0) {
|
1061
|
-
_ref4 = this.mixins;
|
1062
|
-
for (_j = 0, _len2 = _ref4.length; _j < _len2; _j++) {
|
1063
|
-
module = _ref4[_j];
|
1064
|
-
Luca.modules[module]._included.call(this, this, module);
|
1065
|
-
}
|
1066
|
-
}
|
1067
1723
|
return this.trigger("after:initialize", this);
|
1068
1724
|
},
|
1069
|
-
$wrap: function(wrapper) {
|
1070
|
-
if (_.isString(wrapper) && !wrapper.match(/[<>]/)) {
|
1071
|
-
wrapper = this.make("div", {
|
1072
|
-
"class": wrapper
|
1073
|
-
});
|
1074
|
-
}
|
1075
|
-
return this.$el.wrap(wrapper);
|
1076
|
-
},
|
1077
|
-
$template: function(template, variables) {
|
1078
|
-
if (variables == null) variables = {};
|
1079
|
-
return this.$el.html(Luca.template(template, variables));
|
1080
|
-
},
|
1081
|
-
$html: function(content) {
|
1082
|
-
return this.$el.html(content);
|
1083
|
-
},
|
1084
|
-
$append: function(content) {
|
1085
|
-
return this.$el.append(content);
|
1086
|
-
},
|
1087
|
-
$attach: function() {
|
1088
|
-
return this.$container().append(this.el);
|
1089
|
-
},
|
1090
|
-
$bodyEl: function() {
|
1091
|
-
return this.$el;
|
1092
|
-
},
|
1093
|
-
$container: function() {
|
1094
|
-
return $(this.container);
|
1095
|
-
},
|
1096
1725
|
setupHooks: function(set) {
|
1097
1726
|
var _this = this;
|
1098
1727
|
set || (set = this.hooks);
|
@@ -1101,12 +1730,12 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1101
1730
|
fn = Luca.util.hook(eventId);
|
1102
1731
|
callback = function() {
|
1103
1732
|
var _ref;
|
1104
|
-
return (_ref =
|
1733
|
+
return (_ref = this[fn]) != null ? _ref.apply(this, arguments) : void 0;
|
1105
1734
|
};
|
1106
1735
|
if (eventId != null ? eventId.match(/once:/) : void 0) {
|
1107
1736
|
callback = _.once(callback);
|
1108
1737
|
}
|
1109
|
-
return _this.
|
1738
|
+
return _this.on(eventId, callback, _this);
|
1110
1739
|
});
|
1111
1740
|
},
|
1112
1741
|
registerEvent: function(selector, handler) {
|
@@ -1150,14 +1779,14 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1150
1779
|
}
|
1151
1780
|
});
|
1152
1781
|
|
1153
|
-
|
1782
|
+
Luca.View._originalExtend = Backbone.View.extend;
|
1154
1783
|
|
1155
|
-
|
1784
|
+
Luca.View.renderWrapper = function(definition) {
|
1156
1785
|
var _base;
|
1157
1786
|
_base = definition.render;
|
1158
1787
|
_base || (_base = Luca.View.prototype.$attach);
|
1159
1788
|
definition.render = function() {
|
1160
|
-
var autoTrigger, deferred, fn, target, trigger,
|
1789
|
+
var autoTrigger, deferred, fn, target, trigger,
|
1161
1790
|
_this = this;
|
1162
1791
|
view = this;
|
1163
1792
|
if (this.deferrable) {
|
@@ -1166,7 +1795,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1166
1795
|
this.deferrable = this.collection;
|
1167
1796
|
}
|
1168
1797
|
target || (target = this.deferrable);
|
1169
|
-
trigger = this.deferrable_event ? this.deferrable_event :
|
1798
|
+
trigger = this.deferrable_event ? this.deferrable_event : Luca.View.deferrableEvent;
|
1170
1799
|
deferred = function() {
|
1171
1800
|
_base.call(view);
|
1172
1801
|
return view.trigger("after:render", view);
|
@@ -1195,57 +1824,26 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1195
1824
|
};
|
1196
1825
|
|
1197
1826
|
bindAllEventHandlers = function() {
|
1198
|
-
var
|
1199
|
-
|
1200
|
-
if (_.isString(handler)) return _.bindAll(_this, handler);
|
1201
|
-
});
|
1202
|
-
};
|
1203
|
-
|
1204
|
-
registerApplicationEvents = function() {
|
1205
|
-
var app, eventTrigger, handler, _len, _ref, _ref2, _results;
|
1206
|
-
if (_.isEmpty(this.applicationEvents)) return;
|
1207
|
-
app = this.app;
|
1208
|
-
if (_.isString(app) || _.isUndefined(app)) {
|
1209
|
-
app = (_ref = Luca.Application) != null ? typeof _ref.get === "function" ? _ref.get(app) : void 0 : void 0;
|
1210
|
-
}
|
1211
|
-
if (!Luca.supportsEvents(app)) {
|
1212
|
-
throw "Error binding to the application object on " + (this.name || this.cid);
|
1213
|
-
}
|
1214
|
-
_ref2 = this.applicationEvents;
|
1827
|
+
var config, _i, _len, _ref, _results;
|
1828
|
+
_ref = [this.events, this.componentEvents, this.collectionEvents, this.applicationEvents];
|
1215
1829
|
_results = [];
|
1216
|
-
for (
|
1217
|
-
|
1218
|
-
if (_.
|
1219
|
-
if (!_.isFunction(handler)) {
|
1220
|
-
throw "Error registering application event " + eventTrigger + " on " + (this.name || this.cid);
|
1221
|
-
}
|
1222
|
-
_results.push(app.on(eventTrigger, handler));
|
1830
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1831
|
+
config = _ref[_i];
|
1832
|
+
if (!_.isEmpty(config)) _results.push(bindEventHandlers.call(this, config));
|
1223
1833
|
}
|
1224
1834
|
return _results;
|
1225
1835
|
};
|
1226
1836
|
|
1227
|
-
|
1228
|
-
var
|
1229
|
-
if (
|
1230
|
-
manager = this.collectionManager;
|
1231
|
-
if (_.isString(manager) || _.isUndefined(manager)) {
|
1232
|
-
manager = Luca.CollectionManager.get(manager);
|
1233
|
-
}
|
1234
|
-
_ref = this.collectionEvents;
|
1837
|
+
bindEventHandlers = function(events) {
|
1838
|
+
var eventSignature, handler, _results;
|
1839
|
+
if (events == null) events = {};
|
1235
1840
|
_results = [];
|
1236
|
-
for (
|
1237
|
-
handler =
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
if (_.isString(handler)) handler = this[handler];
|
1243
|
-
if (!_.isFunction(handler)) throw "invalid collectionEvents configuration";
|
1244
|
-
try {
|
1245
|
-
_results.push(collection.bind(eventTrigger, handler));
|
1246
|
-
} catch (e) {
|
1247
|
-
console.log("Error Binding To Collection in registerCollectionEvents", this);
|
1248
|
-
throw e;
|
1841
|
+
for (eventSignature in events) {
|
1842
|
+
handler = events[eventSignature];
|
1843
|
+
if (_.isString(handler)) {
|
1844
|
+
_results.push(_.bindAll(this, handler));
|
1845
|
+
} else {
|
1846
|
+
_results.push(void 0);
|
1249
1847
|
}
|
1250
1848
|
}
|
1251
1849
|
return _results;
|
@@ -1253,20 +1851,50 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1253
1851
|
|
1254
1852
|
Luca.View.extend = function(definition) {
|
1255
1853
|
var module, _i, _len, _ref;
|
1256
|
-
definition =
|
1854
|
+
definition = Luca.View.renderWrapper(definition);
|
1257
1855
|
if ((definition.mixins != null) && _.isArray(definition.mixins)) {
|
1258
1856
|
_ref = definition.mixins;
|
1259
1857
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1260
1858
|
module = _ref[_i];
|
1261
|
-
|
1859
|
+
Luca.decorate(definition)["with"](module);
|
1262
1860
|
}
|
1263
1861
|
}
|
1264
|
-
return
|
1862
|
+
return Luca.View._originalExtend.call(this, definition);
|
1265
1863
|
};
|
1266
1864
|
|
1865
|
+
Luca.View.deferrableEvent = "reset";
|
1866
|
+
|
1267
1867
|
}).call(this);
|
1268
1868
|
(function() {
|
1269
|
-
var setupComputedProperties;
|
1869
|
+
var model, setupComputedProperties;
|
1870
|
+
|
1871
|
+
model = Luca.define('Luca.Model');
|
1872
|
+
|
1873
|
+
model["extends"]('Backbone.Model');
|
1874
|
+
|
1875
|
+
model.includes('Luca.Events');
|
1876
|
+
|
1877
|
+
model.defines({
|
1878
|
+
initialize: function() {
|
1879
|
+
Backbone.Model.prototype.initialize(this, arguments);
|
1880
|
+
return setupComputedProperties.call(this);
|
1881
|
+
},
|
1882
|
+
read: function(attr) {
|
1883
|
+
if (_.isFunction(this[attr])) {
|
1884
|
+
return this[attr].call(this);
|
1885
|
+
} else {
|
1886
|
+
return this.get(attr);
|
1887
|
+
}
|
1888
|
+
},
|
1889
|
+
get: function(attr) {
|
1890
|
+
var _ref;
|
1891
|
+
if ((_ref = this.computed) != null ? _ref.hasOwnProperty(attr) : void 0) {
|
1892
|
+
return this._computed[attr];
|
1893
|
+
} else {
|
1894
|
+
return Backbone.Model.prototype.get.call(this, attr);
|
1895
|
+
}
|
1896
|
+
}
|
1897
|
+
});
|
1270
1898
|
|
1271
1899
|
setupComputedProperties = function() {
|
1272
1900
|
var attr, dependencies, _ref, _results,
|
@@ -1291,32 +1919,22 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1291
1919
|
return _results;
|
1292
1920
|
};
|
1293
1921
|
|
1294
|
-
_.def('Luca.Model')["extends"]('Backbone.Model')["with"]({
|
1295
|
-
include: ['Luca.Events'],
|
1296
|
-
initialize: function() {
|
1297
|
-
Backbone.Model.prototype.initialize(this, arguments);
|
1298
|
-
return setupComputedProperties.call(this);
|
1299
|
-
},
|
1300
|
-
get: function(attr) {
|
1301
|
-
var _ref;
|
1302
|
-
if ((_ref = this.computed) != null ? _ref.hasOwnProperty(attr) : void 0) {
|
1303
|
-
return this._computed[attr];
|
1304
|
-
} else {
|
1305
|
-
return Backbone.Model.prototype.get.call(this, attr);
|
1306
|
-
}
|
1307
|
-
}
|
1308
|
-
});
|
1309
|
-
|
1310
1922
|
}).call(this);
|
1311
1923
|
(function() {
|
1312
|
-
var
|
1924
|
+
var collection;
|
1313
1925
|
|
1314
|
-
|
1926
|
+
collection = Luca.define('Luca.Collection');
|
1315
1927
|
|
1316
|
-
if (Backbone.QueryCollection != null)
|
1928
|
+
if (Backbone.QueryCollection != null) {
|
1929
|
+
collection["extends"]('Backbone.QueryCollection');
|
1930
|
+
} else {
|
1931
|
+
collection["extends"]('Backbone.Collection');
|
1932
|
+
}
|
1317
1933
|
|
1318
|
-
|
1319
|
-
|
1934
|
+
collection.includes('Luca.Events');
|
1935
|
+
|
1936
|
+
collection.defines({
|
1937
|
+
model: Luca.Model,
|
1320
1938
|
cachedMethods: [],
|
1321
1939
|
remoteFilter: false,
|
1322
1940
|
initialize: function(models, options) {
|
@@ -1549,7 +2167,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1549
2167
|
return _results;
|
1550
2168
|
},
|
1551
2169
|
setupMethodCaching: function() {
|
1552
|
-
var cache,
|
2170
|
+
var cache, membershipEvents;
|
1553
2171
|
collection = this;
|
1554
2172
|
membershipEvents = ["reset", "add", "remove"];
|
1555
2173
|
cache = this._methodCache = {};
|
@@ -1772,11 +2390,13 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1772
2390
|
this.input_id || (this.input_id = _.uniqueId('field'));
|
1773
2391
|
this.input_name || (this.input_name = this.name);
|
1774
2392
|
this.input_class || (this.input_class = "");
|
2393
|
+
this.input_type || (this.input_type = "");
|
1775
2394
|
this.helperText || (this.helperText = "");
|
1776
2395
|
if (this.required && !((_ref = this.label) != null ? _ref.match(/^\*/) : void 0)) {
|
1777
2396
|
this.label || (this.label = "*" + this.label);
|
1778
2397
|
}
|
1779
2398
|
this.inputStyles || (this.inputStyles = "");
|
2399
|
+
this.input_value || (this.input_value = this.value || "");
|
1780
2400
|
if (this.disabled) this.disable();
|
1781
2401
|
this.updateState(this.state);
|
1782
2402
|
this.placeHolder || (this.placeHolder = "");
|
@@ -1784,22 +2404,20 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1784
2404
|
},
|
1785
2405
|
beforeRender: function() {
|
1786
2406
|
if (Luca.enableBootstrap) this.$el.addClass('control-group');
|
1787
|
-
if (this.required) this.$el.addClass('required');
|
1788
|
-
this.$el.html(Luca.template(this.template, this));
|
1789
|
-
return this.input = $('input', this.el);
|
2407
|
+
if (this.required) return this.$el.addClass('required');
|
1790
2408
|
},
|
1791
2409
|
change_handler: function(e) {
|
1792
2410
|
return this.trigger("on:change", this, e);
|
1793
2411
|
},
|
1794
2412
|
disable: function() {
|
1795
|
-
return
|
2413
|
+
return this.getInputElement().attr('disabled', true);
|
1796
2414
|
},
|
1797
2415
|
enable: function() {
|
1798
|
-
return
|
2416
|
+
return this.getInputElement().attr('disabled', false);
|
1799
2417
|
},
|
1800
2418
|
getValue: function() {
|
1801
|
-
var raw;
|
1802
|
-
raw = this.
|
2419
|
+
var raw, _ref;
|
2420
|
+
raw = (_ref = this.getInputElement()) != null ? _ref.attr('value') : void 0;
|
1803
2421
|
if (_.str.isBlank(raw)) return raw;
|
1804
2422
|
switch (this.valueType) {
|
1805
2423
|
case "integer":
|
@@ -1812,11 +2430,12 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1812
2430
|
return raw;
|
1813
2431
|
}
|
1814
2432
|
},
|
1815
|
-
render: function() {
|
1816
|
-
return $(this.container).append(this.$el);
|
1817
|
-
},
|
1818
2433
|
setValue: function(value) {
|
1819
|
-
|
2434
|
+
var _ref;
|
2435
|
+
return (_ref = this.getInputElement()) != null ? _ref.attr('value', value) : void 0;
|
2436
|
+
},
|
2437
|
+
getInputElement: function() {
|
2438
|
+
return this.input || (this.input = this.$('input').eq(0));
|
1820
2439
|
},
|
1821
2440
|
updateState: function(state) {
|
1822
2441
|
var _this = this;
|
@@ -1829,57 +2448,28 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1829
2448
|
|
1830
2449
|
}).call(this);
|
1831
2450
|
(function() {
|
1832
|
-
var applyDOMConfig, doComponents, doLayout;
|
2451
|
+
var applyDOMConfig, container, createGetterMethods, createMethodsToGetComponentsByRole, doComponents, doLayout, indexComponent, validateContainerConfiguration;
|
1833
2452
|
|
1834
|
-
|
1835
|
-
this.trigger("before:layout", this);
|
1836
|
-
this.prepareLayout();
|
1837
|
-
return this.trigger("after:layout", this);
|
1838
|
-
};
|
2453
|
+
container = Luca.register("Luca.core.Container");
|
1839
2454
|
|
1840
|
-
|
1841
|
-
var config, style_declarations;
|
1842
|
-
style_declarations = [];
|
1843
|
-
if (panel.height != null) {
|
1844
|
-
style_declarations.push("height: " + (_.isNumber(panel.height) ? panel.height + 'px' : panel.height));
|
1845
|
-
}
|
1846
|
-
if (panel.width != null) {
|
1847
|
-
style_declarations.push("width: " + (_.isNumber(panel.width) ? panel.width + 'px' : panel.width));
|
1848
|
-
}
|
1849
|
-
if (panel.float) style_declarations.push("float: " + panel.float);
|
1850
|
-
config = {
|
1851
|
-
"class": (panel != null ? panel.classes : void 0) || this.componentClass,
|
1852
|
-
id: "" + this.cid + "-" + panelIndex,
|
1853
|
-
style: style_declarations.join(';'),
|
1854
|
-
"data-luca-owner": this.name || this.cid
|
1855
|
-
};
|
1856
|
-
if (this.customizeContainerEl != null) {
|
1857
|
-
config = this.customizeContainerEl(config, panel, panelIndex);
|
1858
|
-
}
|
1859
|
-
return config;
|
1860
|
-
};
|
2455
|
+
container["extends"]("Luca.components.Panel");
|
1861
2456
|
|
1862
|
-
|
1863
|
-
this.trigger("before:components", this, this.components);
|
1864
|
-
this.prepareComponents();
|
1865
|
-
this.createComponents();
|
1866
|
-
this.trigger("before:render:components", this, this.components);
|
1867
|
-
this.renderComponents();
|
1868
|
-
return this.trigger("after:components", this, this.components);
|
1869
|
-
};
|
2457
|
+
container.triggers("before:components", "before:render:components", "before:layout", "after:components", "after:layout", "first:activation");
|
1870
2458
|
|
1871
|
-
|
2459
|
+
container.defines({
|
1872
2460
|
className: 'luca-ui-container',
|
1873
2461
|
componentTag: 'div',
|
1874
2462
|
componentClass: 'luca-ui-panel',
|
1875
2463
|
isContainer: true,
|
1876
|
-
hooks: ["before:components", "before:render:components", "before:layout", "after:components", "after:layout", "first:activation"],
|
1877
2464
|
rendered: false,
|
1878
2465
|
components: [],
|
2466
|
+
componentEvents: {},
|
1879
2467
|
initialize: function(options) {
|
1880
2468
|
this.options = options != null ? options : {};
|
1881
2469
|
_.extend(this, this.options);
|
1882
|
-
this.setupHooks(
|
2470
|
+
this.setupHooks(Luca.core.Container.prototype.hooks);
|
2471
|
+
this.components || (this.components = this.fields || (this.fields = this.pages || (this.pages = this.cards || (this.cards = this.views))));
|
2472
|
+
validateContainerConfiguration(this);
|
1883
2473
|
return Luca.View.prototype.initialize.apply(this, arguments);
|
1884
2474
|
},
|
1885
2475
|
beforeRender: function() {
|
@@ -1892,7 +2482,6 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1892
2482
|
return containerEl;
|
1893
2483
|
},
|
1894
2484
|
prepareLayout: function() {
|
1895
|
-
var container;
|
1896
2485
|
container = this;
|
1897
2486
|
return this.componentContainers = _(this.components).map(function(component, index) {
|
1898
2487
|
return applyDOMConfig.call(container, component, index);
|
@@ -1932,31 +2521,23 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1932
2521
|
if (this.componentsCreated === true) return;
|
1933
2522
|
map = this.componentIndex = {
|
1934
2523
|
name_index: {},
|
1935
|
-
cid_index: {}
|
2524
|
+
cid_index: {},
|
2525
|
+
role_index: {}
|
1936
2526
|
};
|
2527
|
+
container = this;
|
1937
2528
|
this.components = _(this.components).map(function(object, index) {
|
1938
|
-
var component;
|
1939
|
-
component = Luca.isBackboneView(object) ? object : (object.type || (object.type = object.ctype), !(object.type != null) ? object.components != null ? object.type = object.ctype = 'container' : object.type = object.ctype = Luca.defaultComponentType : void 0, Luca.util.lazyComponent(object));
|
1940
|
-
if (_.isString(component.getter)) {
|
1941
|
-
_this[component.getter] = (function() {
|
1942
|
-
return component;
|
1943
|
-
});
|
1944
|
-
}
|
2529
|
+
var component, created;
|
2530
|
+
component = Luca.isBackboneView(object) ? object : (object.type || (object.type = object.ctype), !(object.type != null) ? object.components != null ? object.type = object.ctype = 'container' : object.type = object.ctype = Luca.defaultComponentType : void 0, object = _.defaults(object, container.defaults || {}), created = Luca.util.lazyComponent(object));
|
1945
2531
|
if (!component.container && component.options.container) {
|
1946
2532
|
component.container = component.options.container;
|
1947
2533
|
}
|
1948
|
-
|
1949
|
-
if (map && (component.name != null)) {
|
1950
|
-
map.name_index[component.name] = index;
|
1951
|
-
}
|
2534
|
+
indexComponent(component).at(index)["in"](_this.componentIndex);
|
1952
2535
|
return component;
|
1953
2536
|
});
|
1954
2537
|
this.componentsCreated = true;
|
1955
|
-
if (!_.isEmpty(this.componentEvents)) this.registerComponentEvents();
|
1956
2538
|
return map;
|
1957
2539
|
},
|
1958
2540
|
renderComponents: function(debugMode) {
|
1959
|
-
var container;
|
1960
2541
|
this.debugMode = debugMode != null ? debugMode : "";
|
1961
2542
|
this.debug("container render components");
|
1962
2543
|
container = this;
|
@@ -1992,43 +2573,102 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
1992
2573
|
}
|
1993
2574
|
});
|
1994
2575
|
},
|
2576
|
+
_: function() {
|
2577
|
+
return _(this.components);
|
2578
|
+
},
|
1995
2579
|
pluck: function(attribute) {
|
1996
|
-
return _(
|
2580
|
+
return this._().pluck(attribute);
|
1997
2581
|
},
|
1998
2582
|
invoke: function(method) {
|
1999
|
-
return _(
|
2583
|
+
return this._().invoke(method);
|
2584
|
+
},
|
2585
|
+
select: function(fn) {
|
2586
|
+
return this._().select(fn);
|
2587
|
+
},
|
2588
|
+
detect: function(fn) {
|
2589
|
+
return this._().detect(attribute);
|
2590
|
+
},
|
2591
|
+
reject: function(fn) {
|
2592
|
+
return this._().reject(fn);
|
2000
2593
|
},
|
2001
2594
|
map: function(fn) {
|
2002
|
-
return _(
|
2595
|
+
return this._().map(fn);
|
2003
2596
|
},
|
2004
|
-
componentEvents: {},
|
2005
2597
|
registerComponentEvents: function() {
|
2006
|
-
var component,
|
2007
|
-
|
2598
|
+
var component, componentNameOrRole, eventId, handler, listener, _ref, _ref2, _results,
|
2599
|
+
_this = this;
|
2600
|
+
container = this;
|
2601
|
+
_ref = this.componentEvents || {};
|
2008
2602
|
_results = [];
|
2009
2603
|
for (listener in _ref) {
|
2010
2604
|
handler = _ref[listener];
|
2011
|
-
_ref2 = listener.split(' '),
|
2012
|
-
|
2013
|
-
|
2605
|
+
_ref2 = listener.split(' '), componentNameOrRole = _ref2[0], eventId = _ref2[1];
|
2606
|
+
if (!_.isFunction(this[handler])) {
|
2607
|
+
console.log("Error registering component event", listener, componentNameOrRole, eventId);
|
2608
|
+
throw "Invalid component event definition " + listener + ". Specified handler is not a method on the container";
|
2609
|
+
}
|
2610
|
+
if (componentNameOrRole === "*") {
|
2611
|
+
_results.push(this.eachComponent(function(component) {
|
2612
|
+
return component.on(eventId, _this[handler], container);
|
2613
|
+
}));
|
2614
|
+
} else {
|
2615
|
+
component = this.findComponentForEventBinding(componentNameOrRole);
|
2616
|
+
if (!((component != null) && Luca.isComponent(component))) {
|
2617
|
+
console.log("Error registering component event", listener, componentNameOrRole, eventId);
|
2618
|
+
throw "Invalid component event definition: " + componentNameOrRole;
|
2619
|
+
}
|
2620
|
+
_results.push(component != null ? component.bind(eventId, this[handler], container) : void 0);
|
2621
|
+
}
|
2014
2622
|
}
|
2015
2623
|
return _results;
|
2016
2624
|
},
|
2625
|
+
subContainers: function() {
|
2626
|
+
return this.select(function(component) {
|
2627
|
+
return component.isContainer === true;
|
2628
|
+
});
|
2629
|
+
},
|
2630
|
+
roles: function() {
|
2631
|
+
return _(this.allChildren()).pluck('role');
|
2632
|
+
},
|
2633
|
+
allChildren: function() {
|
2634
|
+
var children, grandchildren;
|
2635
|
+
children = this.components;
|
2636
|
+
grandchildren = _(this.subContainers()).invoke('allChildren');
|
2637
|
+
return this._allChildren || (this._allChildren = _([children, grandchildren]).chain().compact().flatten().uniq().value());
|
2638
|
+
},
|
2639
|
+
findComponentForEventBinding: function(nameRoleOrGetter, deep) {
|
2640
|
+
if (deep == null) deep = false;
|
2641
|
+
return this.findComponentByName(nameRoleOrGetter, deep) || this.findComponentByGetter(nameRoleOrGetter, deep) || this.findComponentByRole(nameRoleOrGetter, deep);
|
2642
|
+
},
|
2643
|
+
findComponentByGetter: function(getter, deep) {
|
2644
|
+
if (deep == null) deep = false;
|
2645
|
+
return _(this.allChildren()).detect(function(component) {
|
2646
|
+
return component.getter === getter;
|
2647
|
+
});
|
2648
|
+
},
|
2649
|
+
findComponentByRole: function(role, deep) {
|
2650
|
+
if (deep == null) deep = false;
|
2651
|
+
return _(this.allChildren()).detect(function(component) {
|
2652
|
+
return component.role === role;
|
2653
|
+
});
|
2654
|
+
},
|
2017
2655
|
findComponentByName: function(name, deep) {
|
2018
2656
|
if (deep == null) deep = false;
|
2019
|
-
return this.
|
2657
|
+
return _(this.allChildren()).detect(function(component) {
|
2658
|
+
return component.name === name;
|
2659
|
+
});
|
2020
2660
|
},
|
2021
2661
|
findComponentById: function(id, deep) {
|
2022
2662
|
if (deep == null) deep = false;
|
2023
2663
|
return this.findComponent(id, "cid_index", deep);
|
2024
2664
|
},
|
2025
2665
|
findComponent: function(needle, haystack, deep) {
|
2026
|
-
var component, position, sub_container, _ref
|
2666
|
+
var component, position, sub_container, _ref;
|
2027
2667
|
if (haystack == null) haystack = "name";
|
2028
2668
|
if (deep == null) deep = false;
|
2029
2669
|
if (this.componentsCreated !== true) this.createComponents();
|
2030
2670
|
position = (_ref = this.componentIndex) != null ? _ref[haystack][needle] : void 0;
|
2031
|
-
component =
|
2671
|
+
component = this.components[position];
|
2032
2672
|
if (component) return component;
|
2033
2673
|
if (deep === true) {
|
2034
2674
|
sub_container = _(this.components).detect(function(component) {
|
@@ -2061,20 +2701,16 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2061
2701
|
return this.components[this.activeItem];
|
2062
2702
|
},
|
2063
2703
|
componentElements: function() {
|
2064
|
-
return this.$("
|
2704
|
+
return this.$("[data-luca-parent='" + (this.name || this.cid) + "']");
|
2065
2705
|
},
|
2066
2706
|
getComponent: function(needle) {
|
2067
2707
|
return this.components[needle];
|
2068
2708
|
},
|
2069
|
-
rootComponent: function() {
|
2070
|
-
console.log("Calling rootComponent will be deprecated. use isRootComponent instead");
|
2071
|
-
return !(this.getParent != null);
|
2072
|
-
},
|
2073
2709
|
isRootComponent: function() {
|
2074
2710
|
return !(this.getParent != null);
|
2075
2711
|
},
|
2076
2712
|
getRootComponent: function() {
|
2077
|
-
if (this.
|
2713
|
+
if (this.isRootComponent()) {
|
2078
2714
|
return this;
|
2079
2715
|
} else {
|
2080
2716
|
return this.getParent().getRootComponent();
|
@@ -2082,23 +2718,21 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2082
2718
|
},
|
2083
2719
|
selectByAttribute: function(attribute, value, deep) {
|
2084
2720
|
var components;
|
2721
|
+
if (value == null) value = void 0;
|
2085
2722
|
if (deep == null) deep = false;
|
2086
2723
|
components = _(this.components).map(function(component) {
|
2087
2724
|
var matches, test;
|
2088
2725
|
matches = [];
|
2089
2726
|
test = component[attribute];
|
2090
|
-
if (test === value)
|
2727
|
+
if (test === value || (!(value != null) && (test != null))) {
|
2728
|
+
matches.push(component);
|
2729
|
+
}
|
2091
2730
|
if (deep === true) {
|
2092
2731
|
matches.push(typeof component.selectByAttribute === "function" ? component.selectByAttribute(attribute, value, true) : void 0);
|
2093
2732
|
}
|
2094
2733
|
return _.compact(matches);
|
2095
2734
|
});
|
2096
2735
|
return _.flatten(components);
|
2097
|
-
},
|
2098
|
-
select: function(attribute, value, deep) {
|
2099
|
-
if (deep == null) deep = false;
|
2100
|
-
console.log("Container.select will be replaced by selectByAttribute in 1.0");
|
2101
|
-
return Luca.core.Container.prototype.selectByAttribute.apply(this, arguments);
|
2102
2736
|
}
|
2103
2737
|
});
|
2104
2738
|
|
@@ -2108,6 +2742,97 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2108
2742
|
return attachMethod(component.render().el);
|
2109
2743
|
};
|
2110
2744
|
|
2745
|
+
doLayout = function() {
|
2746
|
+
this.trigger("before:layout", this);
|
2747
|
+
this.prepareLayout();
|
2748
|
+
return this.trigger("after:layout", this);
|
2749
|
+
};
|
2750
|
+
|
2751
|
+
applyDOMConfig = function(panel, panelIndex) {
|
2752
|
+
var config, style_declarations;
|
2753
|
+
style_declarations = [];
|
2754
|
+
if (panel.height != null) {
|
2755
|
+
style_declarations.push("height: " + (_.isNumber(panel.height) ? panel.height + 'px' : panel.height));
|
2756
|
+
}
|
2757
|
+
if (panel.width != null) {
|
2758
|
+
style_declarations.push("width: " + (_.isNumber(panel.width) ? panel.width + 'px' : panel.width));
|
2759
|
+
}
|
2760
|
+
if (panel.float) style_declarations.push("float: " + panel.float);
|
2761
|
+
config = {
|
2762
|
+
"class": (panel != null ? panel.classes : void 0) || this.componentClass,
|
2763
|
+
id: "" + this.cid + "-" + panelIndex,
|
2764
|
+
style: style_declarations.join(';'),
|
2765
|
+
"data-luca-parent": this.name || this.cid
|
2766
|
+
};
|
2767
|
+
if (this.customizeContainerEl != null) {
|
2768
|
+
config = this.customizeContainerEl(config, panel, panelIndex);
|
2769
|
+
}
|
2770
|
+
return config;
|
2771
|
+
};
|
2772
|
+
|
2773
|
+
createGetterMethods = function() {
|
2774
|
+
var childrenWithGetter;
|
2775
|
+
container = this;
|
2776
|
+
childrenWithGetter = _(this.allChildren()).select(function(component) {
|
2777
|
+
return component.getter != null;
|
2778
|
+
});
|
2779
|
+
return _(childrenWithGetter).each(function(component) {
|
2780
|
+
var _name;
|
2781
|
+
return container[_name = component.getter] || (container[_name] = function() {
|
2782
|
+
console.log("getter is being deprecated in favor of role");
|
2783
|
+
console.log(component.getter, component, container);
|
2784
|
+
return component;
|
2785
|
+
});
|
2786
|
+
});
|
2787
|
+
};
|
2788
|
+
|
2789
|
+
createMethodsToGetComponentsByRole = function() {
|
2790
|
+
var childrenWithRole;
|
2791
|
+
container = this;
|
2792
|
+
childrenWithRole = _(this.allChildren()).select(function(component) {
|
2793
|
+
return component.role != null;
|
2794
|
+
});
|
2795
|
+
return _(childrenWithRole).each(function(component) {
|
2796
|
+
var getter;
|
2797
|
+
getter = _.str.camelize("get_" + component.role);
|
2798
|
+
return container[getter] || (container[getter] = function() {
|
2799
|
+
return component;
|
2800
|
+
});
|
2801
|
+
});
|
2802
|
+
};
|
2803
|
+
|
2804
|
+
doComponents = function() {
|
2805
|
+
this.trigger("before:components", this, this.components);
|
2806
|
+
this.prepareComponents();
|
2807
|
+
this.createComponents();
|
2808
|
+
this.trigger("before:render:components", this, this.components);
|
2809
|
+
this.renderComponents();
|
2810
|
+
this.trigger("after:components", this, this.components);
|
2811
|
+
createGetterMethods.call(this);
|
2812
|
+
createMethodsToGetComponentsByRole.call(this);
|
2813
|
+
return this.registerComponentEvents();
|
2814
|
+
};
|
2815
|
+
|
2816
|
+
validateContainerConfiguration = function() {
|
2817
|
+
return true;
|
2818
|
+
};
|
2819
|
+
|
2820
|
+
indexComponent = function(component) {
|
2821
|
+
return {
|
2822
|
+
at: function(index) {
|
2823
|
+
return {
|
2824
|
+
"in": function(map) {
|
2825
|
+
if (component.cid != null) map.cid_index[component.cid] = index;
|
2826
|
+
if (component.role != null) map.role_index[component.role] = index;
|
2827
|
+
if (component.name != null) {
|
2828
|
+
return map.name_index[component.name] = index;
|
2829
|
+
}
|
2830
|
+
}
|
2831
|
+
};
|
2832
|
+
}
|
2833
|
+
};
|
2834
|
+
};
|
2835
|
+
|
2111
2836
|
}).call(this);
|
2112
2837
|
(function() {
|
2113
2838
|
var guessCollectionClass, handleInitialCollections, loadInitialCollections;
|
@@ -2158,7 +2883,12 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2158
2883
|
CollectionClass = collectionOptions.base;
|
2159
2884
|
CollectionClass || (CollectionClass = guessCollectionClass.call(this, key));
|
2160
2885
|
if (collectionOptions.private) collectionOptions.name = "";
|
2161
|
-
|
2886
|
+
try {
|
2887
|
+
collection = new CollectionClass(initialModels, collectionOptions);
|
2888
|
+
} catch (e) {
|
2889
|
+
console.log("Error creating collection", CollectionClass, collectionOptions, key);
|
2890
|
+
throw e;
|
2891
|
+
}
|
2162
2892
|
this.add(key, collection);
|
2163
2893
|
collectionManager = this;
|
2164
2894
|
if (this.relayEvents === true) {
|
@@ -2232,10 +2962,28 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2232
2962
|
|
2233
2963
|
})();
|
2234
2964
|
|
2965
|
+
Luca.CollectionManager.isRunning = function() {
|
2966
|
+
return _.isEmpty(Luca.CollectionManager.instances) !== true;
|
2967
|
+
};
|
2968
|
+
|
2235
2969
|
Luca.CollectionManager.destroyAll = function() {
|
2236
2970
|
return Luca.CollectionManager.instances = {};
|
2237
2971
|
};
|
2238
2972
|
|
2973
|
+
Luca.CollectionManager.loadCollectionsByName = function(set, callback) {
|
2974
|
+
var collection, name, _i, _len, _results;
|
2975
|
+
_results = [];
|
2976
|
+
for (_i = 0, _len = set.length; _i < _len; _i++) {
|
2977
|
+
name = set[_i];
|
2978
|
+
collection = this.getOrCreate(name);
|
2979
|
+
collection.once("reset", function() {
|
2980
|
+
return callback(collection);
|
2981
|
+
});
|
2982
|
+
_results.push(collection.fetch());
|
2983
|
+
}
|
2984
|
+
return _results;
|
2985
|
+
};
|
2986
|
+
|
2239
2987
|
guessCollectionClass = function(key) {
|
2240
2988
|
var classified, guess, guesses, _ref;
|
2241
2989
|
classified = Luca.util.classify(key);
|
@@ -2252,7 +3000,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2252
3000
|
};
|
2253
3001
|
|
2254
3002
|
loadInitialCollections = function() {
|
2255
|
-
var collectionDidLoad,
|
3003
|
+
var collectionDidLoad, set,
|
2256
3004
|
_this = this;
|
2257
3005
|
collectionDidLoad = function(collection) {
|
2258
3006
|
var current;
|
@@ -2261,14 +3009,8 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2261
3009
|
_this.trigger("collection_loaded", collection.name);
|
2262
3010
|
return collection.unbind("reset");
|
2263
3011
|
};
|
2264
|
-
|
2265
|
-
|
2266
|
-
collection = _this.getOrCreate(name);
|
2267
|
-
collection.once("reset", function() {
|
2268
|
-
return collectionDidLoad(collection);
|
2269
|
-
});
|
2270
|
-
return collection.fetch();
|
2271
|
-
});
|
3012
|
+
set = this.initialCollections;
|
3013
|
+
return Luca.CollectionManager.loadCollectionsByName.call(this, set, collectionDidLoad);
|
2272
3014
|
};
|
2273
3015
|
|
2274
3016
|
handleInitialCollections = function() {
|
@@ -2287,6 +3029,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2287
3029
|
}));
|
2288
3030
|
}
|
2289
3031
|
loadInitialCollections.call(this);
|
3032
|
+
this.initialCollectionsLoadedu;
|
2290
3033
|
return this;
|
2291
3034
|
};
|
2292
3035
|
|
@@ -2399,9 +3142,13 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2399
3142
|
|
2400
3143
|
}).call(this);
|
2401
3144
|
(function() {
|
3145
|
+
var component;
|
2402
3146
|
|
2403
|
-
|
2404
|
-
|
3147
|
+
component = Luca.define("Luca.containers.CardView");
|
3148
|
+
|
3149
|
+
component["extends"]("Luca.core.Container");
|
3150
|
+
|
3151
|
+
component.defaults({
|
2405
3152
|
className: 'luca-ui-card-view-wrapper',
|
2406
3153
|
activeCard: 0,
|
2407
3154
|
components: [],
|
@@ -2411,21 +3158,16 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2411
3158
|
initialize: function(options) {
|
2412
3159
|
this.options = options;
|
2413
3160
|
Luca.core.Container.prototype.initialize.apply(this, arguments);
|
2414
|
-
|
3161
|
+
this.setupHooks(this.hooks);
|
3162
|
+
return this.components || (this.components = this.pages || (this.pages = this.cards));
|
2415
3163
|
},
|
2416
3164
|
prepareComponents: function() {
|
2417
|
-
var _ref
|
2418
|
-
_this = this;
|
3165
|
+
var _ref;
|
2419
3166
|
if ((_ref = Luca.core.Container.prototype.prepareComponents) != null) {
|
2420
3167
|
_ref.apply(this, arguments);
|
2421
3168
|
}
|
2422
|
-
|
2423
|
-
|
2424
|
-
return $(component.container).show();
|
2425
|
-
} else {
|
2426
|
-
return $(component.container).hide();
|
2427
|
-
}
|
2428
|
-
});
|
3169
|
+
this.componentElements().hide();
|
3170
|
+
return this.activeComponentElement().show();
|
2429
3171
|
},
|
2430
3172
|
activeComponentElement: function() {
|
2431
3173
|
return this.componentElements().eq(this.activeCard);
|
@@ -2437,13 +3179,27 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2437
3179
|
containerEl.style += panelIndex === this.activeCard ? "display:block;" : "display:none;";
|
2438
3180
|
return containerEl;
|
2439
3181
|
},
|
3182
|
+
atFirst: function() {
|
3183
|
+
return this.activeCard === 0;
|
3184
|
+
},
|
3185
|
+
atLast: function() {
|
3186
|
+
return this.activeCard === this.components.length - 1;
|
3187
|
+
},
|
3188
|
+
next: function() {
|
3189
|
+
if (this.atLast()) return;
|
3190
|
+
return this.activate(this.activeCard + 1);
|
3191
|
+
},
|
3192
|
+
previous: function() {
|
3193
|
+
if (this.atFirst()) return;
|
3194
|
+
return this.activate(this.activeCard - 1);
|
3195
|
+
},
|
2440
3196
|
cycle: function() {
|
2441
3197
|
var nextIndex;
|
2442
|
-
nextIndex = this.
|
3198
|
+
nextIndex = this.atLast() ? 0 : this.activeCard + 1;
|
2443
3199
|
return this.activate(nextIndex);
|
2444
3200
|
},
|
2445
3201
|
find: function(name) {
|
2446
|
-
return
|
3202
|
+
return Luca(name);
|
2447
3203
|
},
|
2448
3204
|
firstActivation: function() {
|
2449
3205
|
return this.activeComponent().trigger("first:activation", this, this.activeComponent());
|
@@ -2523,45 +3279,105 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2523
3279
|
return this.$el.modal('hide');
|
2524
3280
|
},
|
2525
3281
|
render: function() {
|
2526
|
-
this.$el.addClass('modal');
|
2527
|
-
if (this.fade === true) this.$el.addClass('fade');
|
2528
|
-
$('body').append(this.$el);
|
2529
|
-
this.$el.modal({
|
2530
|
-
backdrop: this.backdrop === true,
|
2531
|
-
keyboard: this.closeOnEscape === true,
|
2532
|
-
show: this.showOnInitialize === true
|
2533
|
-
});
|
3282
|
+
this.$el.addClass('modal');
|
3283
|
+
if (this.fade === true) this.$el.addClass('fade');
|
3284
|
+
$('body').append(this.$el);
|
3285
|
+
this.$el.modal({
|
3286
|
+
backdrop: this.backdrop === true,
|
3287
|
+
keyboard: this.closeOnEscape === true,
|
3288
|
+
show: this.showOnInitialize === true
|
3289
|
+
});
|
3290
|
+
return this;
|
3291
|
+
}
|
3292
|
+
});
|
3293
|
+
|
3294
|
+
_.def("Luca.containers.ModalView")["extends"]("Luca.ModalView")["with"]();
|
3295
|
+
|
3296
|
+
}).call(this);
|
3297
|
+
(function() {
|
3298
|
+
|
3299
|
+
_.def("Luca.PageView")["extends"]("Luca.containers.CardView")["with"]({
|
3300
|
+
version: 2
|
3301
|
+
});
|
3302
|
+
|
3303
|
+
}).call(this);
|
3304
|
+
(function() {
|
3305
|
+
var buildButton, make, panelToolbar, prepareButtons;
|
3306
|
+
|
3307
|
+
panelToolbar = Luca.register("Luca.components.PanelToolbar");
|
3308
|
+
|
3309
|
+
panelToolbar["extends"]("Luca.View");
|
3310
|
+
|
3311
|
+
panelToolbar.defines({
|
3312
|
+
buttons: [],
|
3313
|
+
className: "luca-ui-toolbar btn-toolbar",
|
3314
|
+
well: true,
|
3315
|
+
orientation: 'top',
|
3316
|
+
autoBindEventHandlers: true,
|
3317
|
+
events: {
|
3318
|
+
"click a.btn, click .dropdown-menu li": "clickHandler"
|
3319
|
+
},
|
3320
|
+
initialize: function(options) {
|
3321
|
+
var _ref;
|
3322
|
+
this.options = options != null ? options : {};
|
3323
|
+
this._super("initialize", this, arguments);
|
3324
|
+
if (this.group === true && ((_ref = this.buttons) != null ? _ref.length : void 0) >= 0) {
|
3325
|
+
return this.buttons = [
|
3326
|
+
{
|
3327
|
+
group: true,
|
3328
|
+
buttons: this.buttons
|
3329
|
+
}
|
3330
|
+
];
|
3331
|
+
}
|
3332
|
+
},
|
3333
|
+
clickHandler: function(e) {
|
3334
|
+
var eventId, hook, me, my, source;
|
3335
|
+
me = my = $(e.target);
|
3336
|
+
if (me.is('i')) me = my = $(e.target).parent();
|
3337
|
+
if (this.selectable === true) {
|
3338
|
+
my.siblings().removeClass("is-selected");
|
3339
|
+
me.addClass('is-selected');
|
3340
|
+
}
|
3341
|
+
if (!(eventId = my.data('eventid'))) return;
|
3342
|
+
hook = Luca.util.hook(eventId);
|
3343
|
+
source = this.parent || this;
|
3344
|
+
if (_.isFunction(source[hook])) {
|
3345
|
+
return source[hook].call(this, me, e);
|
3346
|
+
} else {
|
3347
|
+
return source.trigger(eventId, me, e);
|
3348
|
+
}
|
3349
|
+
},
|
3350
|
+
beforeRender: function() {
|
3351
|
+
this._super("beforeRender", this, arguments);
|
3352
|
+
if (this.well === true) this.$el.addClass('well');
|
3353
|
+
if (this.selectable === true) this.$el.addClass('btn-selectable');
|
3354
|
+
this.$el.addClass("toolbar-" + this.orientation);
|
3355
|
+
if (this.align === "right") this.$el.addClass("pull-right");
|
3356
|
+
if (this.align === "left") return this.$el.addClass("pull-left");
|
3357
|
+
},
|
3358
|
+
render: function() {
|
3359
|
+
var element, _i, _len, _ref;
|
3360
|
+
this.$el.empty();
|
3361
|
+
_ref = prepareButtons(this.buttons);
|
3362
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
3363
|
+
element = _ref[_i];
|
3364
|
+
this.$el.append(element);
|
3365
|
+
}
|
2534
3366
|
return this;
|
2535
3367
|
}
|
2536
3368
|
});
|
2537
3369
|
|
2538
|
-
_.def("Luca.containers.ModalView")["extends"]("Luca.ModalView")["with"]();
|
2539
|
-
|
2540
|
-
}).call(this);
|
2541
|
-
(function() {
|
2542
|
-
|
2543
|
-
_.def("Luca.PageView")["extends"]("Luca.containers.CardView")["with"]({
|
2544
|
-
version: 2
|
2545
|
-
});
|
2546
|
-
|
2547
|
-
}).call(this);
|
2548
|
-
(function() {
|
2549
|
-
var buildButton, make, prepareButtons;
|
2550
|
-
|
2551
3370
|
make = Backbone.View.prototype.make;
|
2552
3371
|
|
2553
3372
|
buildButton = function(config, wrap) {
|
2554
3373
|
var autoWrapClass, buttonAttributes, buttonEl, buttons, dropdownEl, dropdownItems, label, object, white, wrapper,
|
2555
3374
|
_this = this;
|
2556
3375
|
if (wrap == null) wrap = true;
|
2557
|
-
if (config.ctype != null) {
|
3376
|
+
if ((config.ctype != null) || (config.type != null)) {
|
2558
3377
|
config.className || (config.className = "");
|
2559
3378
|
config.className += 'toolbar-component';
|
2560
3379
|
object = Luca(config).render();
|
2561
|
-
if (Luca.isBackboneView(object))
|
2562
|
-
console.log("Adding toolbar component", object);
|
2563
|
-
return object.el;
|
2564
|
-
}
|
3380
|
+
if (Luca.isBackboneView(object)) return object.$el;
|
2565
3381
|
}
|
2566
3382
|
if (config.spacer) {
|
2567
3383
|
return make("div", {
|
@@ -2574,8 +3390,11 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2574
3390
|
}, config.text);
|
2575
3391
|
}
|
2576
3392
|
wrapper = 'btn-group';
|
2577
|
-
if (config.wrapper != null) wrapper += "
|
2578
|
-
if (config.align != null)
|
3393
|
+
if (config.wrapper != null) wrapper += "" + config.wrapper;
|
3394
|
+
if (config.align != null) {
|
3395
|
+
wrapper += "pull-" + config.align + " align-" + config.align;
|
3396
|
+
}
|
3397
|
+
if (config.selectable === true) wrapper += 'btn-selectable';
|
2579
3398
|
if ((config.group != null) && (config.buttons != null)) {
|
2580
3399
|
buttons = prepareButtons(config.buttons, false);
|
2581
3400
|
return make("div", {
|
@@ -2597,6 +3416,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2597
3416
|
if (config.color != null) {
|
2598
3417
|
buttonAttributes["class"] += " btn-" + config.color;
|
2599
3418
|
}
|
3419
|
+
if (config.selected != null) buttonAttributes["class"] += " is-selected";
|
2600
3420
|
if (config.dropdown) {
|
2601
3421
|
label = "" + label + " <span class='caret'></span>";
|
2602
3422
|
buttonAttributes["class"] += " dropdown-toggle";
|
@@ -2626,51 +3446,16 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2626
3446
|
};
|
2627
3447
|
|
2628
3448
|
prepareButtons = function(buttons, wrap) {
|
3449
|
+
var button, _i, _len, _results;
|
3450
|
+
if (buttons == null) buttons = [];
|
2629
3451
|
if (wrap == null) wrap = true;
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
_.def("Luca.containers.PanelToolbar")["extends"]("Luca.View")["with"]({
|
2636
|
-
className: "luca-ui-toolbar btn-toolbar",
|
2637
|
-
buttons: [],
|
2638
|
-
well: true,
|
2639
|
-
orientation: 'top',
|
2640
|
-
autoBindEventHandlers: true,
|
2641
|
-
events: {
|
2642
|
-
"click a.btn, click .dropdown-menu li": "clickHandler"
|
2643
|
-
},
|
2644
|
-
clickHandler: function(e) {
|
2645
|
-
var eventId, hook, me, my, source;
|
2646
|
-
me = my = $(e.target);
|
2647
|
-
if (me.is('i')) me = my = $(e.target).parent();
|
2648
|
-
eventId = my.data('eventid');
|
2649
|
-
if (eventId == null) return;
|
2650
|
-
hook = Luca.util.hook(eventId);
|
2651
|
-
source = this.parent || this;
|
2652
|
-
if (_.isFunction(source[hook])) {
|
2653
|
-
return source[hook].call(this, me, e);
|
2654
|
-
} else {
|
2655
|
-
return source.trigger(eventId, me, e);
|
2656
|
-
}
|
2657
|
-
},
|
2658
|
-
beforeRender: function() {
|
2659
|
-
this._super("beforeRender", this, arguments);
|
2660
|
-
if (this.well === true) this.$el.addClass('well');
|
2661
|
-
this.$el.addClass("toolbar-" + this.orientation);
|
2662
|
-
if (this.styles != null) return this.applyStyles(this.styles);
|
2663
|
-
},
|
2664
|
-
render: function() {
|
2665
|
-
var elements,
|
2666
|
-
_this = this;
|
2667
|
-
this.$el.empty();
|
2668
|
-
elements = prepareButtons(this.buttons);
|
2669
|
-
return _(elements).each(function(element) {
|
2670
|
-
return _this.$el.append(element);
|
2671
|
-
});
|
3452
|
+
_results = [];
|
3453
|
+
for (_i = 0, _len = buttons.length; _i < _len; _i++) {
|
3454
|
+
button = buttons[_i];
|
3455
|
+
_results.push(buildButton(button, wrap));
|
2672
3456
|
}
|
2673
|
-
|
3457
|
+
return _results;
|
3458
|
+
};
|
2674
3459
|
|
2675
3460
|
}).call(this);
|
2676
3461
|
(function() {
|
@@ -2736,11 +3521,12 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2736
3521
|
return (_ref = Luca.containers.CardView.prototype.beforeLayout) != null ? _ref.apply(this, arguments) : void 0;
|
2737
3522
|
},
|
2738
3523
|
afterRender: function() {
|
2739
|
-
var _ref;
|
3524
|
+
var tabContainerId, _ref;
|
2740
3525
|
if ((_ref = Luca.containers.CardView.prototype.afterRender) != null) {
|
2741
3526
|
_ref.apply(this, arguments);
|
2742
3527
|
}
|
2743
|
-
|
3528
|
+
tabContainerId = this.tabContainer().attr("id");
|
3529
|
+
this.registerEvent("click #" + tabContainerId + " li a", "select");
|
2744
3530
|
if (Luca.enableBootstrap && (this.tab_position === "left" || this.tab_position === "right")) {
|
2745
3531
|
this.tabContainerWrapper().addClass("span2");
|
2746
3532
|
return this.tabContentWrapper().addClass("span9");
|
@@ -2751,7 +3537,9 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2751
3537
|
tabView = this;
|
2752
3538
|
return this.each(function(component, index) {
|
2753
3539
|
var icon, link, selector, _ref;
|
2754
|
-
if (component.tabIcon)
|
3540
|
+
if (component.tabIcon) {
|
3541
|
+
icon = "<i class='icon-" + component.tabIcon + "'></i>";
|
3542
|
+
}
|
2755
3543
|
link = "<a href='#'>" + (icon || '') + " " + component.title + "</a>";
|
2756
3544
|
selector = tabView.make("li", {
|
2757
3545
|
"class": "tab-selector",
|
@@ -2814,10 +3602,20 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2814
3602
|
if (this.fullscreen === true) return this.enableFullscreen();
|
2815
3603
|
},
|
2816
3604
|
enableFluid: function() {
|
2817
|
-
return this
|
3605
|
+
return this.enableWrapper();
|
2818
3606
|
},
|
2819
3607
|
disableFluid: function() {
|
2820
|
-
return this
|
3608
|
+
return this.disableWrapper();
|
3609
|
+
},
|
3610
|
+
enableWrapper: function() {
|
3611
|
+
if (this.wrapperClass != null) {
|
3612
|
+
return this.$el.parent().addClass(this.wrapperClass);
|
3613
|
+
}
|
3614
|
+
},
|
3615
|
+
disableWrapper: function() {
|
3616
|
+
if (this.wrapperClass != null) {
|
3617
|
+
return this.$el.parent().removeClass(this.wrapperClass);
|
3618
|
+
}
|
2821
3619
|
},
|
2822
3620
|
enableFullscreen: function() {
|
2823
3621
|
$('html,body').addClass('luca-ui-fullscreen');
|
@@ -2872,16 +3670,6 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2872
3670
|
|
2873
3671
|
Luca.containers.Viewport.fluidWrapperClass = 'row-fluid';
|
2874
3672
|
|
2875
|
-
}).call(this);
|
2876
|
-
(function() {
|
2877
|
-
|
2878
|
-
|
2879
|
-
|
2880
|
-
}).call(this);
|
2881
|
-
(function() {
|
2882
|
-
|
2883
|
-
|
2884
|
-
|
2885
3673
|
}).call(this);
|
2886
3674
|
(function() {
|
2887
3675
|
|
@@ -2932,7 +3720,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
2932
3720
|
Luca.Application.instances[appName] = app;
|
2933
3721
|
Luca.containers.Viewport.prototype.initialize.apply(this, arguments);
|
2934
3722
|
this.state = new Luca.Model(this.defaultState);
|
2935
|
-
this.setupMainController();
|
3723
|
+
if (this.useController === true) this.setupMainController();
|
2936
3724
|
this.setupCollectionManager();
|
2937
3725
|
this.defer(function() {
|
2938
3726
|
return app.render();
|
@@ -3036,7 +3824,9 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3036
3824
|
});
|
3037
3825
|
}
|
3038
3826
|
return (_ref2 = this.getMainController()) != null ? _ref2.each(function(component) {
|
3039
|
-
|
3827
|
+
var type;
|
3828
|
+
type = component.type || component.type;
|
3829
|
+
if (type.match(/controller$/)) {
|
3040
3830
|
return component.bind("after:card:switch", function(previous, current) {
|
3041
3831
|
_this.state.set({
|
3042
3832
|
active_sub_section: current.name
|
@@ -3052,7 +3842,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3052
3842
|
definedComponents = this.components || [];
|
3053
3843
|
this.components = [
|
3054
3844
|
{
|
3055
|
-
|
3845
|
+
type: 'controller',
|
3056
3846
|
name: "main_controller",
|
3057
3847
|
components: definedComponents
|
3058
3848
|
}
|
@@ -3061,25 +3851,27 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3061
3851
|
}
|
3062
3852
|
},
|
3063
3853
|
setupCollectionManager: function() {
|
3064
|
-
var collectionManagerOptions, _base, _ref, _ref2;
|
3065
|
-
if (this.useCollectionManager
|
3066
|
-
|
3067
|
-
|
3068
|
-
|
3069
|
-
|
3070
|
-
|
3071
|
-
|
3072
|
-
|
3073
|
-
|
3074
|
-
|
3075
|
-
|
3076
|
-
|
3077
|
-
|
3078
|
-
|
3079
|
-
|
3080
|
-
|
3081
|
-
|
3082
|
-
|
3854
|
+
var collectionManagerOptions, _base, _ref, _ref2, _ref3;
|
3855
|
+
if (this.useCollectionManager !== true) return;
|
3856
|
+
if ((this.collectionManager != null) && (((_ref = this.collectionManager) != null ? _ref.get : void 0) != null)) {
|
3857
|
+
return;
|
3858
|
+
}
|
3859
|
+
if (_.isString(this.collectionManagerClass)) {
|
3860
|
+
this.collectionManagerClass = Luca.util.resolve(this.collectionManagerClass);
|
3861
|
+
}
|
3862
|
+
collectionManagerOptions = this.collectionManagerOptions || {};
|
3863
|
+
if (_.isObject(this.collectionManager) && !_.isFunction((_ref2 = this.collectionManager) != null ? _ref2.get : void 0)) {
|
3864
|
+
collectionManagerOptions = this.collectionManager;
|
3865
|
+
this.collectionManager = void 0;
|
3866
|
+
}
|
3867
|
+
if (_.isString(this.collectionManager)) {
|
3868
|
+
collectionManagerOptions = {
|
3869
|
+
name: this.collectionManager
|
3870
|
+
};
|
3871
|
+
}
|
3872
|
+
this.collectionManager = typeof (_base = Luca.CollectionManager).get === "function" ? _base.get(collectionManagerOptions.name) : void 0;
|
3873
|
+
if (!_.isFunction((_ref3 = this.collectionManager) != null ? _ref3.get : void 0)) {
|
3874
|
+
return this.collectionManager = new this.collectionManagerClass(collectionManagerOptions);
|
3083
3875
|
}
|
3084
3876
|
},
|
3085
3877
|
setupRouter: function() {
|
@@ -3175,23 +3967,31 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3175
3967
|
|
3176
3968
|
}).call(this);
|
3177
3969
|
(function() {
|
3178
|
-
var make;
|
3970
|
+
var collectionView, make;
|
3971
|
+
|
3972
|
+
collectionView = Luca.define("Luca.components.CollectionView");
|
3973
|
+
|
3974
|
+
collectionView["extends"]("Luca.components.Panel");
|
3975
|
+
|
3976
|
+
collectionView.behavesAs("LoadMaskable", "Filterable", "Paginatable");
|
3179
3977
|
|
3180
|
-
|
3181
|
-
|
3978
|
+
collectionView.triggers("before:refresh", "after:refresh", "refresh", "empty:results");
|
3979
|
+
|
3980
|
+
collectionView.defaults({
|
3981
|
+
tagName: "ol",
|
3182
3982
|
className: "luca-ui-collection-view",
|
3183
3983
|
bodyClassName: "collection-ui-panel",
|
3184
3984
|
itemTemplate: void 0,
|
3185
3985
|
itemRenderer: void 0,
|
3186
3986
|
itemTagName: 'li',
|
3187
3987
|
itemClassName: 'collection-item',
|
3188
|
-
hooks: ["empty:results"],
|
3189
3988
|
initialize: function(options) {
|
3190
3989
|
var _this = this;
|
3191
3990
|
this.options = options != null ? options : {};
|
3192
3991
|
_.extend(this, this.options);
|
3193
3992
|
_.bindAll(this, "refresh");
|
3194
3993
|
if (!((this.collection != null) || this.options.collection)) {
|
3994
|
+
console.log("Error on initialize of collection view", this);
|
3195
3995
|
throw "Collection Views must specify a collection";
|
3196
3996
|
}
|
3197
3997
|
if (!((this.itemTemplate != null) || (this.itemRenderer != null) || (this.itemProperty != null))) {
|
@@ -3201,65 +4001,113 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3201
4001
|
if (_.isString(this.collection) && Luca.CollectionManager.get()) {
|
3202
4002
|
this.collection = Luca.CollectionManager.get().getOrCreate(this.collection);
|
3203
4003
|
}
|
3204
|
-
if (Luca.isBackboneCollection(this.collection)) {
|
4004
|
+
if (!Luca.isBackboneCollection(this.collection)) {
|
4005
|
+
throw "Collection Views must have a valid backbone collection";
|
3205
4006
|
this.collection.on("before:fetch", function() {
|
3206
|
-
|
4007
|
+
return _this.trigger("enable:loadmask");
|
3207
4008
|
});
|
3208
4009
|
this.collection.bind("reset", function() {
|
3209
|
-
|
4010
|
+
_this.refresh();
|
4011
|
+
return _this.trigger("disable:loadmask");
|
4012
|
+
});
|
4013
|
+
this.collection.bind("remove", function() {
|
3210
4014
|
return _this.refresh();
|
3211
4015
|
});
|
3212
|
-
this.collection.bind("add",
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
4016
|
+
this.collection.bind("add", function() {
|
4017
|
+
return _this.refresh();
|
4018
|
+
});
|
4019
|
+
if (this.observeChanges === true) {
|
4020
|
+
this.collection.on("change", this.refreshModel, this);
|
4021
|
+
}
|
3216
4022
|
}
|
3217
|
-
if (this.
|
4023
|
+
if (this.autoRefreshOnModelsPresent !== false) {
|
4024
|
+
this.defer(function() {
|
4025
|
+
if (_this.collection.length > 0) return _this.refresh();
|
4026
|
+
}).until("after:render");
|
4027
|
+
}
|
4028
|
+
return this.on("collection:change", this.refresh, this);
|
3218
4029
|
},
|
3219
|
-
attributesForItem: function(item) {
|
4030
|
+
attributesForItem: function(item, model) {
|
3220
4031
|
return _.extend({}, {
|
3221
4032
|
"class": this.itemClassName,
|
3222
|
-
"data-index": item.index
|
4033
|
+
"data-index": item.index,
|
4034
|
+
"data-model-id": item.model.get('id')
|
3223
4035
|
});
|
3224
4036
|
},
|
3225
4037
|
contentForItem: function(item) {
|
3226
4038
|
var content, templateFn;
|
3227
4039
|
if (item == null) item = {};
|
3228
4040
|
if ((this.itemTemplate != null) && (templateFn = Luca.template(this.itemTemplate))) {
|
3229
|
-
content = templateFn.call(this, item);
|
4041
|
+
return content = templateFn.call(this, item);
|
3230
4042
|
}
|
3231
4043
|
if ((this.itemRenderer != null) && _.isFunction(this.itemRenderer)) {
|
3232
|
-
content = this.itemRenderer.call(this, item, item.model, item.index);
|
4044
|
+
return content = this.itemRenderer.call(this, item, item.model, item.index);
|
3233
4045
|
}
|
3234
|
-
if (this.itemProperty) {
|
3235
|
-
content = item.model.
|
3236
|
-
if (_.isFunction(content)) content = content();
|
4046
|
+
if (this.itemProperty && (item.model != null)) {
|
4047
|
+
return content = item.model.read(this.itemProperty);
|
3237
4048
|
}
|
3238
|
-
return
|
4049
|
+
return "";
|
3239
4050
|
},
|
3240
4051
|
makeItem: function(model, index) {
|
3241
|
-
var item;
|
4052
|
+
var attributes, content, item;
|
3242
4053
|
item = this.prepareItem != null ? this.prepareItem.call(this, model, index) : {
|
3243
4054
|
model: model,
|
3244
4055
|
index: index
|
3245
4056
|
};
|
3246
|
-
|
4057
|
+
attributes = this.attributesForItem(item, model);
|
4058
|
+
content = this.contentForItem(item);
|
4059
|
+
try {
|
4060
|
+
return make(this.itemTagName, attributes, content);
|
4061
|
+
} catch (e) {
|
4062
|
+
return console.log("Error generating DOM element for CollectionView", this, model, index);
|
4063
|
+
}
|
4064
|
+
},
|
4065
|
+
getCollection: function() {
|
4066
|
+
return this.collection;
|
3247
4067
|
},
|
3248
|
-
|
4068
|
+
getQuery: function() {
|
4069
|
+
return this.query || (this.query = {});
|
4070
|
+
},
|
4071
|
+
getQueryOptions: function() {
|
4072
|
+
return this.queryOptions || (this.queryOptions = {});
|
4073
|
+
},
|
4074
|
+
getModels: function(query, options) {
|
3249
4075
|
var _ref;
|
3250
|
-
if ((
|
3251
|
-
|
4076
|
+
if ((_ref = this.collection) != null ? _ref.query : void 0) {
|
4077
|
+
query || (query = this.getQuery());
|
4078
|
+
options || (options = this.getQueryOptions());
|
4079
|
+
return this.collection.query(query, options);
|
3252
4080
|
} else {
|
3253
4081
|
return this.collection.models;
|
3254
4082
|
}
|
3255
4083
|
},
|
3256
|
-
|
3257
|
-
|
4084
|
+
locateItemElement: function(id) {
|
4085
|
+
return this.$("." + this.itemClassName + "[data-model-id='" + id + "']");
|
4086
|
+
},
|
4087
|
+
refreshModel: function(model) {
|
4088
|
+
var index;
|
4089
|
+
index = this.collection.indexOf(model);
|
4090
|
+
this.locateItemElement(model.get('id')).empty().append(this.contentForItem({
|
4091
|
+
model: model,
|
4092
|
+
index: index
|
4093
|
+
}, model));
|
4094
|
+
return this.trigger("model:refreshed", index, model);
|
4095
|
+
},
|
4096
|
+
refresh: function(query, options) {
|
4097
|
+
var index, model, models, _i, _len;
|
4098
|
+
query || (query = this.getQuery());
|
4099
|
+
options || (options = this.getQueryOptions());
|
3258
4100
|
this.$bodyEl().empty();
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
4101
|
+
models = this.getModels(query, options);
|
4102
|
+
this.trigger("before:refresh", models, query, options);
|
4103
|
+
if (models.length === 0) this.trigger("empty:results");
|
4104
|
+
index = 0;
|
4105
|
+
for (_i = 0, _len = models.length; _i < _len; _i++) {
|
4106
|
+
model = models[_i];
|
4107
|
+
this.$append(this.makeItem(model, index++));
|
4108
|
+
}
|
4109
|
+
this.trigger("after:refresh", models, query, options);
|
4110
|
+
return this;
|
3263
4111
|
},
|
3264
4112
|
registerEvent: function(domEvent, selector, handler) {
|
3265
4113
|
var eventTrigger;
|
@@ -3545,10 +4393,10 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3545
4393
|
return this.label || (this.label = this.name);
|
3546
4394
|
},
|
3547
4395
|
setValue: function(checked) {
|
3548
|
-
return this.
|
4396
|
+
return this.getInputElement().attr('checked', checked);
|
3549
4397
|
},
|
3550
4398
|
getValue: function() {
|
3551
|
-
return this.
|
4399
|
+
return this.getInputElement().is(":checked");
|
3552
4400
|
}
|
3553
4401
|
});
|
3554
4402
|
|
@@ -3557,10 +4405,6 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3557
4405
|
|
3558
4406
|
_.def('Luca.fields.FileUploadField')["extends"]('Luca.core.Field')["with"]({
|
3559
4407
|
template: 'fields/file_upload_field',
|
3560
|
-
initialize: function(options) {
|
3561
|
-
this.options = options != null ? options : {};
|
3562
|
-
return Luca.core.Field.prototype.initialize.apply(this, arguments);
|
3563
|
-
},
|
3564
4408
|
afterInitialize: function() {
|
3565
4409
|
this.input_id || (this.input_id = _.uniqueId('field'));
|
3566
4410
|
this.input_name || (this.input_name = this.name);
|
@@ -3574,10 +4418,6 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3574
4418
|
|
3575
4419
|
_.def('Luca.fields.HiddenField')["extends"]('Luca.core.Field')["with"]({
|
3576
4420
|
template: 'fields/hidden_field',
|
3577
|
-
initialize: function(options) {
|
3578
|
-
this.options = options != null ? options : {};
|
3579
|
-
return Luca.core.Field.prototype.initialize.apply(this, arguments);
|
3580
|
-
},
|
3581
4421
|
afterInitialize: function() {
|
3582
4422
|
this.input_id || (this.input_id = _.uniqueId('field'));
|
3583
4423
|
this.input_name || (this.input_name = this.name);
|
@@ -3591,16 +4431,13 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3591
4431
|
|
3592
4432
|
_.def("Luca.components.LabelField")["extends"]("Luca.core.Field")["with"]({
|
3593
4433
|
className: "luca-ui-field luca-ui-label-field",
|
3594
|
-
getValue: function() {
|
3595
|
-
return this.$('input').attr('value');
|
3596
|
-
},
|
3597
4434
|
formatter: function(value) {
|
3598
4435
|
value || (value = this.getValue());
|
3599
4436
|
return _.str.titleize(value);
|
3600
4437
|
},
|
3601
4438
|
setValue: function(value) {
|
3602
4439
|
this.trigger("change", value, this.getValue());
|
3603
|
-
this
|
4440
|
+
this.getInputElement().attr('value', value);
|
3604
4441
|
return this.$('.value').html(this.formatter(value));
|
3605
4442
|
}
|
3606
4443
|
});
|
@@ -3655,9 +4492,11 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3655
4492
|
return hash;
|
3656
4493
|
});
|
3657
4494
|
},
|
4495
|
+
getInputElement: function() {
|
4496
|
+
return this.input || (this.input = this.$('select').eq(0));
|
4497
|
+
},
|
3658
4498
|
afterRender: function() {
|
3659
4499
|
var _ref, _ref2;
|
3660
|
-
this.input = $('select', this.el);
|
3661
4500
|
if (((_ref = this.collection) != null ? (_ref2 = _ref.models) != null ? _ref2.length : void 0 : void 0) > 0) {
|
3662
4501
|
return this.populateOptions();
|
3663
4502
|
} else {
|
@@ -3675,9 +4514,9 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3675
4514
|
return this.trigger("on:change", this, e);
|
3676
4515
|
},
|
3677
4516
|
resetOptions: function() {
|
3678
|
-
this.
|
4517
|
+
this.getInputElement().html('');
|
3679
4518
|
if (this.includeBlank) {
|
3680
|
-
return this.
|
4519
|
+
return this.getInputElement().append("<option value='" + this.blankValue + "'>" + this.blankText + "</option>");
|
3681
4520
|
}
|
3682
4521
|
},
|
3683
4522
|
populateOptions: function() {
|
@@ -3691,7 +4530,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3691
4530
|
display = model.get(_this.displayField);
|
3692
4531
|
if (_this.selected && value === _this.selected) selected = "selected";
|
3693
4532
|
option = "<option " + selected + " value='" + value + "'>" + display + "</option>";
|
3694
|
-
return _this.
|
4533
|
+
return _this.getInputElement().append(option);
|
3695
4534
|
});
|
3696
4535
|
}
|
3697
4536
|
this.trigger("after:populate:options", this);
|
@@ -3719,6 +4558,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3719
4558
|
this.input_name || (this.input_name = this.name);
|
3720
4559
|
this.label || (this.label = this.name);
|
3721
4560
|
this.input_class || (this.input_class = this["class"]);
|
4561
|
+
this.input_value || (this.input_value = "");
|
3722
4562
|
return this.inputStyles || (this.inputStyles = "height:" + this.height + ";width:" + this.width);
|
3723
4563
|
},
|
3724
4564
|
setValue: function(value) {
|
@@ -3764,6 +4604,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3764
4604
|
this.input_name || (this.input_name = this.name);
|
3765
4605
|
this.label || (this.label = this.name);
|
3766
4606
|
this.input_class || (this.input_class = this["class"]);
|
4607
|
+
this.input_value || (this.input_value = this.value || "");
|
3767
4608
|
if (this.prepend) {
|
3768
4609
|
this.$el.addClass('input-prepend');
|
3769
4610
|
this.addOn = this.prepend;
|
@@ -3794,19 +4635,18 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3794
4635
|
_.def('Luca.fields.TypeAheadField')["extends"]('Luca.fields.TextField')["with"]({
|
3795
4636
|
className: 'luca-ui-field',
|
3796
4637
|
getSource: function() {
|
3797
|
-
|
3798
|
-
return this.source || [];
|
4638
|
+
return Luca.util.read(this.source) || [];
|
3799
4639
|
},
|
3800
4640
|
matcher: function(item) {
|
3801
4641
|
return true;
|
3802
4642
|
},
|
3803
4643
|
beforeRender: function() {
|
3804
|
-
|
3805
|
-
return this
|
4644
|
+
Luca.fields.TextField.prototype.beforeRender.apply(this, arguments);
|
4645
|
+
return this.getInputElement().attr('data-provide', 'typeahead');
|
3806
4646
|
},
|
3807
4647
|
afterRender: function() {
|
3808
|
-
|
3809
|
-
return this
|
4648
|
+
Luca.fields.TextField.prototype.afterRender.apply(this, arguments);
|
4649
|
+
return this.getInputElement().typeahead({
|
3810
4650
|
matcher: this.matcher,
|
3811
4651
|
source: this.getSource()
|
3812
4652
|
});
|
@@ -3883,6 +4723,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
3883
4723
|
this.options = options != null ? options : {};
|
3884
4724
|
if (this.loadMask == null) this.loadMask = Luca.enableBootstrap;
|
3885
4725
|
Luca.core.Container.prototype.initialize.apply(this, arguments);
|
4726
|
+
this.components || (this.components = this.fields);
|
3886
4727
|
_.bindAll(this, "submitHandler", "resetHandler", "renderToolbars", "applyLoadMask");
|
3887
4728
|
this.state || (this.state = new Backbone.Model);
|
3888
4729
|
this.setupHooks(this.hooks);
|
@@ -4361,6 +5202,93 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
4361
5202
|
bodyTemplate: "components/load_mask"
|
4362
5203
|
});
|
4363
5204
|
|
5205
|
+
}).call(this);
|
5206
|
+
(function() {
|
5207
|
+
var bubbleCollectionEvents, multiView, propagateCollectionComponents, validateComponent;
|
5208
|
+
|
5209
|
+
multiView = Luca.define("Luca.components.MultiCollectionView");
|
5210
|
+
|
5211
|
+
multiView["extends"]("Luca.containers.CardView");
|
5212
|
+
|
5213
|
+
multiView.behavesAs("LoadMaskable", "Filterable", "Paginatable");
|
5214
|
+
|
5215
|
+
multiView.triggers("before:refresh", "after:refresh", "refresh", "empty:results");
|
5216
|
+
|
5217
|
+
multiView.defaultsTo({
|
5218
|
+
version: 1,
|
5219
|
+
stateful: true,
|
5220
|
+
defaultState: {
|
5221
|
+
activeView: 0
|
5222
|
+
},
|
5223
|
+
viewContainerClass: "luca-ui-multi-view-container",
|
5224
|
+
initialize: function(options) {
|
5225
|
+
var view, _i, _len, _ref;
|
5226
|
+
this.options = options != null ? options : {};
|
5227
|
+
this.components || (this.components = this.views);
|
5228
|
+
_ref = this.components;
|
5229
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
5230
|
+
view = _ref[_i];
|
5231
|
+
validateComponent(view);
|
5232
|
+
}
|
5233
|
+
this.on("collection:change", this.refresh, this);
|
5234
|
+
this.on("after:card:switch", this.refresh, this);
|
5235
|
+
this.on("before:components", propagateCollectionComponents, this);
|
5236
|
+
this.on("after:components", bubbleCollectionEvents, this);
|
5237
|
+
return Luca.containers.CardView.prototype.initialize.apply(this, arguments);
|
5238
|
+
},
|
5239
|
+
refresh: function() {
|
5240
|
+
var _ref;
|
5241
|
+
return (_ref = this.activeComponent()) != null ? _ref.trigger("refresh") : void 0;
|
5242
|
+
},
|
5243
|
+
getQuery: Luca.components.CollectionView.prototype.getQuery,
|
5244
|
+
getQueryOptions: Luca.components.CollectionView.prototype.getQueryOptions,
|
5245
|
+
getCollection: Luca.components.CollectionView.prototype.getCollection
|
5246
|
+
});
|
5247
|
+
|
5248
|
+
bubbleCollectionEvents = function() {
|
5249
|
+
var container;
|
5250
|
+
container = this;
|
5251
|
+
return container.eachComponent(function(component) {
|
5252
|
+
var eventId, _i, _len, _ref, _results;
|
5253
|
+
_ref = ['refresh', 'before:refresh', 'after:refresh', 'empty:results'];
|
5254
|
+
_results = [];
|
5255
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
5256
|
+
eventId = _ref[_i];
|
5257
|
+
_results.push(component.on(eventId, function() {
|
5258
|
+
if (component === container.activeComponent()) {
|
5259
|
+
return container.trigger(eventId);
|
5260
|
+
}
|
5261
|
+
}));
|
5262
|
+
}
|
5263
|
+
return _results;
|
5264
|
+
});
|
5265
|
+
};
|
5266
|
+
|
5267
|
+
propagateCollectionComponents = function() {
|
5268
|
+
var component, container, _i, _len, _ref, _results;
|
5269
|
+
container = this;
|
5270
|
+
_ref = this.components;
|
5271
|
+
_results = [];
|
5272
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
5273
|
+
component = _ref[_i];
|
5274
|
+
_results.push(_.extend(component, {
|
5275
|
+
collection: (typeof container.getCollection === "function" ? container.getCollection() : void 0) || this.collection,
|
5276
|
+
getQuery: container.getQuery,
|
5277
|
+
getQueryOptions: container.getQueryOptions
|
5278
|
+
}));
|
5279
|
+
}
|
5280
|
+
return _results;
|
5281
|
+
};
|
5282
|
+
|
5283
|
+
validateComponent = function(component) {
|
5284
|
+
var type;
|
5285
|
+
type = component.type || component.ctype;
|
5286
|
+
if (type === "collection" || type === "collection_view" || type === "table" || type === "table_view") {
|
5287
|
+
return;
|
5288
|
+
}
|
5289
|
+
throw "The MultiCollectionView expects to contain multiple collection views";
|
5290
|
+
};
|
5291
|
+
|
4364
5292
|
}).call(this);
|
4365
5293
|
(function() {
|
4366
5294
|
|
@@ -4395,6 +5323,119 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
4395
5323
|
version: 2
|
4396
5324
|
});
|
4397
5325
|
|
5326
|
+
}).call(this);
|
5327
|
+
(function() {
|
5328
|
+
var paginationControl;
|
5329
|
+
|
5330
|
+
paginationControl = Luca.register("Luca.components.PaginationControl");
|
5331
|
+
|
5332
|
+
paginationControl["extends"]("Luca.View");
|
5333
|
+
|
5334
|
+
paginationControl.defines({
|
5335
|
+
template: "components/pagination",
|
5336
|
+
stateful: true,
|
5337
|
+
autoBindEventHandlers: true,
|
5338
|
+
events: {
|
5339
|
+
"click a[data-page-number]": "selectPage",
|
5340
|
+
"click a.next": "nextPage",
|
5341
|
+
"click a.prev": "previousPage"
|
5342
|
+
},
|
5343
|
+
afterInitialize: function() {
|
5344
|
+
_.bindAll(this, "refresh");
|
5345
|
+
return this.state.on("change", this.refresh, this);
|
5346
|
+
},
|
5347
|
+
limit: function() {
|
5348
|
+
var _ref;
|
5349
|
+
return parseInt(this.state.get('limit') || ((_ref = this.collection) != null ? _ref.length : void 0));
|
5350
|
+
},
|
5351
|
+
page: function() {
|
5352
|
+
return parseInt(this.state.get('page') || 1);
|
5353
|
+
},
|
5354
|
+
nextPage: function() {
|
5355
|
+
if (!this.nextEnabled()) return;
|
5356
|
+
return this.state.set('page', this.page() + 1);
|
5357
|
+
},
|
5358
|
+
previousPage: function() {
|
5359
|
+
if (!this.previousEnabled()) return;
|
5360
|
+
return this.state.set('page', this.page() - 1);
|
5361
|
+
},
|
5362
|
+
selectPage: function(e) {
|
5363
|
+
var me, my;
|
5364
|
+
me = my = this.$(e.target);
|
5365
|
+
if (!me.is('a.page')) me = my = my.closest('a.page');
|
5366
|
+
my.siblings().removeClass('is-selected');
|
5367
|
+
me.addClass('is-selected');
|
5368
|
+
return this.setPage(my.data('page-number'));
|
5369
|
+
},
|
5370
|
+
setPage: function(page, options) {
|
5371
|
+
if (page == null) page = 1;
|
5372
|
+
if (options == null) options = {};
|
5373
|
+
return this.state.set('page', page, options);
|
5374
|
+
},
|
5375
|
+
setLimit: function(limit, options) {
|
5376
|
+
if (limit == null) limit = 1;
|
5377
|
+
if (options == null) options = {};
|
5378
|
+
return this.state.set('limit', limit, options);
|
5379
|
+
},
|
5380
|
+
pageButtonContainer: function() {
|
5381
|
+
return this.$('.group');
|
5382
|
+
},
|
5383
|
+
previousEnabled: function() {
|
5384
|
+
return this.page() > 1;
|
5385
|
+
},
|
5386
|
+
nextEnabled: function() {
|
5387
|
+
return this.page() < this.totalPages();
|
5388
|
+
},
|
5389
|
+
previousButton: function() {
|
5390
|
+
return this.$('a.page.prev');
|
5391
|
+
},
|
5392
|
+
nextButton: function() {
|
5393
|
+
return this.$('a.page.next');
|
5394
|
+
},
|
5395
|
+
pageButtons: function() {
|
5396
|
+
return this.$('a[data-page-number]', this.pageButtonContainer());
|
5397
|
+
},
|
5398
|
+
refresh: function() {
|
5399
|
+
var button, page, _ref;
|
5400
|
+
this.pageButtonContainer().empty();
|
5401
|
+
for (page = 1, _ref = this.totalPages(); 1 <= _ref ? page <= _ref : page >= _ref; 1 <= _ref ? page++ : page--) {
|
5402
|
+
button = this.make("a", {
|
5403
|
+
"data-page-number": page,
|
5404
|
+
"class": "page"
|
5405
|
+
}, page);
|
5406
|
+
this.pageButtonContainer().append(button);
|
5407
|
+
}
|
5408
|
+
this.toggleNavigationButtons();
|
5409
|
+
this.selectActivePageButton();
|
5410
|
+
return this;
|
5411
|
+
},
|
5412
|
+
toggleNavigationButtons: function() {
|
5413
|
+
this.$('a.next, a.prev').addClass('disabled');
|
5414
|
+
if (this.nextEnabled()) this.nextButton().removeClass('disabled');
|
5415
|
+
if (this.previousEnabled()) {
|
5416
|
+
return this.previousButton().removeClass('disabled');
|
5417
|
+
}
|
5418
|
+
},
|
5419
|
+
selectActivePageButton: function() {
|
5420
|
+
return this.activePageButton().addClass('is-selected');
|
5421
|
+
},
|
5422
|
+
activePageButton: function() {
|
5423
|
+
return this.pageButtons().filter("[data-page-number='" + (this.page()) + "']");
|
5424
|
+
},
|
5425
|
+
totalPages: function() {
|
5426
|
+
return parseInt(Math.ceil(this.totalItems() / this.itemsPerPage()));
|
5427
|
+
},
|
5428
|
+
totalItems: function() {
|
5429
|
+
var _ref;
|
5430
|
+
return parseInt(((_ref = this.collection) != null ? _ref.length : void 0) || 0);
|
5431
|
+
},
|
5432
|
+
itemsPerPage: function(value, options) {
|
5433
|
+
if (options == null) options = {};
|
5434
|
+
if (value != null) this.state.set("limit", value, options);
|
5435
|
+
return parseInt(this.state.get("limit"));
|
5436
|
+
}
|
5437
|
+
});
|
5438
|
+
|
4398
5439
|
}).call(this);
|
4399
5440
|
(function() {
|
4400
5441
|
|
@@ -4638,6 +5679,102 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
4638
5679
|
}
|
4639
5680
|
});
|
4640
5681
|
|
5682
|
+
}).call(this);
|
5683
|
+
(function() {
|
5684
|
+
var make;
|
5685
|
+
|
5686
|
+
_.def("Luca.components.TableView")["extends"]("Luca.components.CollectionView")["with"]({
|
5687
|
+
additionalClassNames: "table",
|
5688
|
+
tagName: "table",
|
5689
|
+
bodyTemplate: "table_view",
|
5690
|
+
bodyTagName: "tbody",
|
5691
|
+
bodyClassName: "table-body",
|
5692
|
+
itemTagName: "tr",
|
5693
|
+
stateful: true,
|
5694
|
+
observeChanges: true,
|
5695
|
+
columns: [],
|
5696
|
+
emptyText: "There are no results to display",
|
5697
|
+
itemRenderer: function(item, model) {
|
5698
|
+
return Luca.components.TableView.rowRenderer.call(this, item, model);
|
5699
|
+
},
|
5700
|
+
initialize: function(options) {
|
5701
|
+
var column,
|
5702
|
+
_this = this;
|
5703
|
+
this.options = options != null ? options : {};
|
5704
|
+
Luca.components.CollectionView.prototype.initialize.apply(this, arguments);
|
5705
|
+
this.columns = (function() {
|
5706
|
+
var _i, _len, _ref, _results;
|
5707
|
+
_ref = this.columns;
|
5708
|
+
_results = [];
|
5709
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
5710
|
+
column = _ref[_i];
|
5711
|
+
if (_.isString(column)) {
|
5712
|
+
column = {
|
5713
|
+
reader: column
|
5714
|
+
};
|
5715
|
+
}
|
5716
|
+
if (!(column.header != null)) {
|
5717
|
+
column.header = _.str.titleize(_.str.humanize(column.reader));
|
5718
|
+
}
|
5719
|
+
_results.push(column);
|
5720
|
+
}
|
5721
|
+
return _results;
|
5722
|
+
}).call(this);
|
5723
|
+
return this.defer(function() {
|
5724
|
+
return Luca.components.TableView.renderHeader.call(_this, _this.columns, _this.$('thead'));
|
5725
|
+
}).until("after:render");
|
5726
|
+
}
|
5727
|
+
});
|
5728
|
+
|
5729
|
+
make = Backbone.View.prototype.make;
|
5730
|
+
|
5731
|
+
Luca.components.TableView.renderHeader = function(columns, targetElement) {
|
5732
|
+
var column, content, index, _i, _len, _results;
|
5733
|
+
index = 0;
|
5734
|
+
content = (function() {
|
5735
|
+
var _i, _len, _results;
|
5736
|
+
_results = [];
|
5737
|
+
for (_i = 0, _len = columns.length; _i < _len; _i++) {
|
5738
|
+
column = columns[_i];
|
5739
|
+
_results.push("<th data-col-index='" + (index++) + "'>" + column.header + "</th>");
|
5740
|
+
}
|
5741
|
+
return _results;
|
5742
|
+
})();
|
5743
|
+
this.$(targetElement).append("<tr>" + (content.join('')) + "</tr>");
|
5744
|
+
index = 0;
|
5745
|
+
_results = [];
|
5746
|
+
for (_i = 0, _len = columns.length; _i < _len; _i++) {
|
5747
|
+
column = columns[_i];
|
5748
|
+
if (column.width != null) {
|
5749
|
+
_results.push(this.$("th[data-col-index='" + (index++) + "']", targetElement).css('width', column.width));
|
5750
|
+
}
|
5751
|
+
}
|
5752
|
+
return _results;
|
5753
|
+
};
|
5754
|
+
|
5755
|
+
Luca.components.TableView.rowRenderer = function(item, model, index) {
|
5756
|
+
var colIndex, columnConfig, _i, _len, _ref, _results;
|
5757
|
+
colIndex = 0;
|
5758
|
+
_ref = this.columns;
|
5759
|
+
_results = [];
|
5760
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
5761
|
+
columnConfig = _ref[_i];
|
5762
|
+
_results.push(Luca.components.TableView.renderColumn.call(this, columnConfig, item, model, colIndex++));
|
5763
|
+
}
|
5764
|
+
return _results;
|
5765
|
+
};
|
5766
|
+
|
5767
|
+
Luca.components.TableView.renderColumn = function(column, item, model, index) {
|
5768
|
+
var cellValue;
|
5769
|
+
cellValue = model.read(column.reader);
|
5770
|
+
if (_.isFunction(column.renderer)) {
|
5771
|
+
cellValue = column.renderer.call(this, cellValue, model, column);
|
5772
|
+
}
|
5773
|
+
return make("td", {
|
5774
|
+
"data-col-index": index
|
5775
|
+
}, cellValue);
|
5776
|
+
};
|
5777
|
+
|
4641
5778
|
}).call(this);
|
4642
5779
|
(function() {
|
4643
5780
|
|
@@ -4674,6 +5811,19 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
|
|
4674
5811
|
|
4675
5812
|
|
4676
5813
|
|
5814
|
+
}).call(this);
|
5815
|
+
(function() {
|
5816
|
+
|
5817
|
+
|
5818
|
+
|
5819
|
+
}).call(this);
|
5820
|
+
|
5821
|
+
|
5822
|
+
|
5823
|
+
(function() {
|
5824
|
+
|
5825
|
+
|
5826
|
+
|
4677
5827
|
}).call(this);
|
4678
5828
|
|
4679
5829
|
|