chocolate
Version:
A full stack Node.js web framework built using Coffeescript
883 lines (824 loc) • 42.7 kB
JavaScript
// Generated by CoffeeScript 1.12.6
(function() {
var Chocokup, Coffeekup, _, _module, litelorem,
slice = [].slice,
hasProp = {}.hasOwnProperty,
extend = 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; };
Coffeekup = require('./coffeekup');
_ = require('./chocodash');
litelorem = require('./litelorem');
Chocokup = (function() {
function Chocokup(params, content1) {
this.params = params;
this.content = content1;
if (this.content === void 0) {
this.content = this.params;
this.params = void 0;
}
this.module_path = (function() {
var files_stack, found, j, l, len, len1, line, oldPST, stack;
files_stack = [];
if (Error.prepareStackTrace != null) {
oldPST = Error.prepareStackTrace;
Error.prepareStackTrace = function(err, stack) {
return stack;
};
stack = (new Error).stack;
Error.prepareStackTrace = oldPST;
for (j = 0, len = stack.length; j < len; j++) {
line = stack[j];
files_stack.push(line.getFileName());
}
} else {
stack = (new Error).stack;
files_stack = stack.toString().split('\n');
}
found = false;
for (l = 0, len1 = files_stack.length; l < len1; l++) {
line = files_stack[l];
if ((line != null) && line.indexOf('/chocokup.') >= 0) {
found = true;
} else if ((line != null) && line.indexOf('\\chocokup.') >= 0) {
found = true;
} else if (found) {
return line;
}
}
return 'global';
})();
}
Chocokup.prototype.head_template = function() {
return text("" + (this.__.body()));
};
Chocokup.prototype.body_template = function() {
return text("" + (this.__.content()));
};
Chocokup.helpers = (function() {
function _Class() {}
_Class.prototype.__verify = function() {
var a, args, attributes, content, id_class, idclass, j, len;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
attributes = content = null;
id_class = '';
for (j = 0, len = args.length; j < len; j++) {
a = args[j];
switch (typeof a) {
case 'function':
content = a;
break;
case 'object':
attributes = a;
break;
case 'number':
case 'boolean':
content = a;
break;
case 'string':
if (args.length === 1) {
if (args[0][0] !== '.' || args[0].indexOf(' ') >= 0) {
content = a;
} else {
idclass = a;
content = null;
}
} else {
if (a === args[0]) {
id_class = a;
} else {
content = a;
}
}
}
}
return {
id_class: id_class,
attributes: attributes,
content: content
};
};
_Class.prototype.lorem = litelorem;
_Class.prototype.css = function(param) {
var compile;
compile = function(rules, helpers) {
var child, children, declarations, expand, j, key, len, nested, pairs, result, selector, split, value;
result = '';
if (helpers == null) {
helpers = {};
}
for (selector in rules) {
if (!hasProp.call(rules, selector)) continue;
pairs = rules[selector];
declarations = '';
nested = {};
if (selector.substr(0, 6) === '@media') {
result += selector + " {\n" + (compile(pairs, helpers)) + "}\n";
continue;
}
if (typeof pairs === 'function') {
helpers[selector] = pairs;
continue;
}
expand = function(what, key, value) {
var k, results, subs, v;
if (helpers[key] != null) {
subs = helpers[key](value);
delete what[key];
for (k in subs) {
v = subs[k];
if (k !== key && (helpers[k] != null)) {
expand(subs, k, v);
}
}
results = [];
for (k in subs) {
v = subs[k];
results.push(what[k] = v);
}
return results;
}
};
for (key in pairs) {
if (!hasProp.call(pairs, key)) continue;
value = pairs[key];
expand(pairs, key, value);
}
for (key in pairs) {
if (!hasProp.call(pairs, key)) continue;
value = pairs[key];
if (typeof value === 'object') {
children = [];
split = key.split(/\s*,\s*/);
for (j = 0, len = split.length; j < len; j++) {
child = split[j];
children.push(selector + " " + child);
}
nested[children.join(',')] = value;
} else {
key = key.replace(/[A-Z]/g, function(s) {
return '-' + s.toLowerCase();
});
declarations += " " + key + ": " + value + ";\n";
}
}
declarations && (result += selector + " {\n" + declarations + "}\n");
result += compile(nested, helpers);
}
return result;
};
return style((function() {
switch (typeof param) {
case 'function':
return compile(param());
case 'object':
return compile(param);
default:
return param.toString();
}
})());
};
_Class.prototype.panel = function() {
var attributes, base, content, content_, flush, id_class, new_id_class, orientation_keep, panel_index_keep, proportion_keep, ref, ref1, ref2;
ref = __verify.apply(null, arguments), id_class = ref.id_class, attributes = ref.attributes, content = ref.content;
new_id_class = 'panel';
switch (this.__.proportion()) {
case 'half':
case 'third':
case 'half-served':
if (this.__.orientation() === 'vertical') {
new_id_class += "." + (this.__.proportion()) + ".vertical";
switch (this.__.panel_index()) {
case 1:
new_id_class += '.top';
break;
case 2:
new_id_class += (ref1 = this.__.proportion()) === 'half' || ref1 === 'half-served' ? '.bottom' : '.middle';
break;
case 3:
new_id_class += '.bottom';
}
} else {
new_id_class += "." + (this.__.proportion()) + ".horizontal";
switch (this.__.panel_index()) {
case 1:
new_id_class += '.left';
break;
case 2:
new_id_class += (ref2 = this.__.proportion()) === 'half' || ref2 === 'half-served' ? '.right' : '.center';
break;
case 3:
new_id_class += '.right';
}
}
break;
case 'served':
if (this.__.orientation() === 'vertical') {
new_id_class += '.service.vertical';
switch (this.__.panel_index()) {
case 1:
new_id_class += '.top';
break;
case 2:
new_id_class += '.served.center';
break;
case 3:
new_id_class += '.bottom';
}
} else {
new_id_class += '.service.horizontal';
switch (this.__.panel_index()) {
case 1:
new_id_class += '.left';
break;
case 2:
new_id_class += '.served.center';
break;
case 3:
new_id_class += '.right';
}
}
}
panel_index_keep = this.__.panel_index();
proportion_keep = this.__.proportion();
orientation_keep = this.__.orientation();
this.__.panel_index(1);
if ((base = this.__).panel_infos == null) {
base.panel_infos = [];
}
this.__.panel_infos.push({});
this.__.proportion('none');
this.__.orientation('none');
if (attributes != null) {
if (attributes.coverage) {
new_id_class += (new_id_class !== '' ? '.' : '') + 'screen-' + attributes.coverage;
}
if (attributes.proportion != null) {
this.__.proportion(attributes.proportion);
}
if (attributes.orientation != null) {
this.__.orientation(attributes.orientation);
}
delete attributes.proportion;
delete attributes.orientation;
delete attributes.coverage;
}
id_class = new_id_class + (id_class !== '' ? '.' : '') + id_class;
flush = function() {
var panel_info, ref3;
if ((panel_info = this.__.panel_infos[this.__.panel_infos.length - 1]).footer_kept != null) {
ref3 = panel_info.footer_kept, id_class = ref3.id_class, attributes = ref3.attributes, content = ref3.content;
panel(id_class, attributes, content);
return panel_info.footer_kept = void 0;
}
};
content_ = typeof content === "function" ? (function(_this) {
return function() {
var result;
result = content.apply(_this);
flush.apply(_this);
return result;
};
})(this) : content;
div(id_class, attributes, content_);
this.__.panel_index(panel_index_keep + 1);
this.__.proportion(proportion_keep);
this.__.orientation(orientation_keep);
return this.__.panel_infos.pop();
};
_Class.prototype.box = function() {
var attributes, content, id_class, ref;
ref = __verify.apply(null, arguments), id_class = ref.id_class, attributes = ref.attributes, content = ref.content;
id_class = 'frame' + (id_class !== '' ? '.' : '') + id_class;
return panel(id_class, attributes, function() {
return panel('sizer', content);
});
};
_Class.prototype.header = function() {
var attributes, content, id_class, panel_info, ref;
ref = __verify.apply(null, arguments), id_class = ref.id_class, attributes = ref.attributes, content = ref.content;
if ((this.__.panel_infos == null) || this.__.panel_infos.length === 0 || ((attributes != null ? attributes.html5 : void 0) != null)) {
return tag.apply(null, ['header'].concat(slice.call(arguments)));
} else {
panel_info = this.__.panel_infos[this.__.panel_infos.length - 1];
panel_info.hasHeader = true;
id_class = 'header' + (id_class !== '' ? '.' : '') + id_class;
if ((attributes != null ? attributes.by : void 0) != null) {
id_class += '.by-' + attributes.by;
panel_info.header_by = attributes.by;
}
return panel(id_class, attributes, content);
}
};
_Class.prototype.footer = function() {
var attributes, content, id_class, panel_info, ref;
ref = __verify.apply(null, arguments), id_class = ref.id_class, attributes = ref.attributes, content = ref.content;
if ((this.__.panel_infos == null) || this.__.panel_infos.length === 0 || ((attributes != null ? attributes.html5 : void 0) != null)) {
return tag.apply(null, ['footer'].concat(slice.call(arguments)));
} else {
panel_info = this.__.panel_infos[this.__.panel_infos.length - 1];
panel_info.hasFooter = true;
id_class = 'footer' + (id_class !== '' ? '.' : '') + id_class;
if ((attributes != null ? attributes.by : void 0) != null) {
id_class += '.by-' + attributes.by;
panel_info.footer_by = attributes.by;
}
return panel_info.footer_kept = {
id_class: id_class,
attributes: attributes,
content: content
};
}
};
_Class.prototype.body = function() {
var attributes, content, count, id_class, new_id_class, panel_info, ref, ref1;
ref = __verify.apply(null, arguments), id_class = ref.id_class, attributes = ref.attributes, content = ref.content;
if (((ref1 = this.__.panel_infos) != null ? ref1.length : void 0) > 0) {
new_id_class = 'body';
panel_info = this.__.panel_infos[this.__.panel_infos.length - 1];
if (panel_info.hasHeader !== true) {
new_id_class += '.no-header';
}
if (panel_info.hasFooter !== true) {
new_id_class += '.no-footer';
}
if (count = panel_info.header_by) {
new_id_class += ".with-" + count + "-headers";
}
if (count = panel_info.footer_by) {
new_id_class += ".with-" + count + "-footers";
}
id_class = new_id_class + (id_class !== '' ? '.' : '') + id_class;
return panel(id_class, attributes, content);
} else {
return tag.apply(null, ['body'].concat(slice.call(arguments)));
}
};
return _Class;
})();
Chocokup.register = function(name, func) {
if (Chocokup.registered_kups == null) {
Chocokup.registered_kups = {};
}
return Chocokup.registered_kups[name] = func;
};
Chocokup.unregister = function(name) {
var k;
if (Chocokup.registered_kups == null) {
return;
}
if (name != null) {
delete Chocokup.registered_kups[name];
} else {
for (k in Chocokup.registered_kups) {
delete Chocokup.registered_kups[k];
}
}
};
Chocokup.prototype.render = function(options) {
var __, all_tags, bin, data, document, format, helper_ext, helpers, j, k, len, locals, ref, ref1, ref10, ref11, ref12, ref13, ref14, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, self, v;
locals = (ref = options != null ? options.locals : void 0) != null ? ref : {};
if (((ref1 = this.params) != null ? ref1.locals : void 0) != null) {
ref2 = this.params.locals;
for (k in ref2) {
v = ref2[k];
locals[k] = v;
}
delete this.params.locals;
}
if (Object.prototype.toString.apply(locals) !== '[object Object]') {
locals = {
locals: locals
};
}
locals.backdoor_key = options != null ? options.backdoor_key : void 0;
locals.Chocokup = Chocokup;
locals._ = _;
bin = (ref3 = options != null ? options.bin : void 0) != null ? ref3 : {};
if (((ref4 = this.params) != null ? ref4.bin : void 0) != null) {
ref5 = this.params.bin;
for (k in ref5) {
v = ref5[k];
bin[k] = v;
}
delete this.params.bin;
delete this.params.props;
}
__ = (function() {
var _body, _content, _head, _main_body_done, _orientation, _panel_index, _proportion, _title, body, content, head, main_body_done, orientation, panel_index, proportion, reset, title;
_panel_index = 1;
panel_index = function(val) {
if (val === void 0) {
return _panel_index;
} else {
return _panel_index = val;
}
};
_proportion = 'none';
proportion = function(val) {
if (val === void 0) {
return _proportion;
} else {
return _proportion = val;
}
};
_main_body_done = false;
main_body_done = function(val) {
if (val === void 0) {
return _main_body_done;
} else {
return _main_body_done = val;
}
};
_orientation = 'none';
orientation = function(val) {
if (val === void 0) {
return _orientation;
} else {
return _orientation = val;
}
};
_title = void 0;
title = function(val) {
if (val === void 0) {
return _title;
} else {
return _title = val;
}
};
reset = function() {
_panel_index = 1;
_proportion = 'none';
return _orientation = 'none';
};
_content = '';
content = function(val) {
if (val === void 0) {
return _content;
} else {
reset();
return _content = val != null ? val : '';
}
};
_body = '';
body = function(val) {
if (val === void 0) {
return _body;
} else {
reset();
return _body = val != null ? val : '';
}
};
_head = '';
head = function(val) {
if (val === void 0) {
return _head;
} else {
reset();
return _head = val != null ? val : '';
}
};
return {
panel_index: panel_index,
proportion: proportion,
main_body_done: main_body_done,
orientation: orientation,
title: title,
reset: reset,
content: content,
body: body,
head: head
};
})();
helpers = new Chocokup.helpers;
ref6 = ['helpers', 'kups', 'code'];
for (j = 0, len = ref6.length; j < len; j++) {
helper_ext = ref6[j];
if (((ref7 = this.params) != null ? ref7[helper_ext] : void 0) != null) {
ref8 = this.params[helper_ext];
for (k in ref8) {
v = ref8[k];
helpers[k] = v;
}
delete this.params[helper_ext];
}
}
ref9 = Chocokup.registered_kups;
for (k in ref9) {
v = ref9[k];
helpers[k] = v;
}
if (((ref10 = this.params) != null ? ref10['self'] : void 0) != null) {
self = this.params.self;
delete this.params.self;
}
if (((ref11 = this.params) != null ? ref11.document : void 0) != null) {
document = this.params.document;
delete this.params.document;
}
if (this.content.toString().indexOf('module_path') < 0) {
this.content = Chocokup.scope(this.content, this.module_path);
}
all_tags = (ref12 = options != null ? options.all_tags : void 0) != null ? ref12 : true;
format = (ref13 = options != null ? options.format : void 0) != null ? ref13 : false;
data = {
params: this.params,
format: format,
all_tags: all_tags,
hardcode: helpers,
document: document,
self: self,
actor: self != null ? self.actor : void 0,
locals: locals,
bin: bin,
props: bin,
space: bin != null ? (ref14 = bin.__) != null ? ref14.space : void 0 : void 0,
__: __
};
__.title(this.title);
__.content(Coffeekup.render(this.content, data));
__.body(Coffeekup.render(this.body_template, data));
return __.head(Coffeekup.render(this.head_template, data));
};
return Chocokup;
})();
Chocokup.scope = function(kup, module_path) {
if (_.type(kup) === _.Type.Function || (_.type(kup) === _.Type.String && kup.substr(8) === 'function')) {
return new Function('args', "old_module_path = this.module_path; old_local_ids = this.local_ids;\nthis.module_path = '" + module_path + "'; this.local_ids = {};\nresult = (" + (kup.toString()) + ").apply(this, arguments);\nthis.module_path = old_module_path; this.local_ids = old_local_ids;\nreturn result;");
} else {
return " old_module_path = this.module_path; old_local_ids = this.local_ids\n this.module_path = '" + module_path + "'; this.local_ids = {};\n kup = ->\n" + (kup.toString().split('\n').map(function(line) {
return " " + line;
}).join('\n')) + "\n result = kup.apply this, arguments\n this.module_path = old_module_path; this.local_ids = old_local_ids\n result";
}
};
Chocokup.Document = (function(superClass) {
extend(Document, superClass);
function Document(title1, params, content1) {
this.title = title1;
this.params = params;
this.content = content1;
Document.__super__.constructor.call(this, this.params, this.content);
}
Document.prototype.head_template = function() {
var ref;
doctype(5);
return html({
manifest: "" + (((ref = this.params) != null ? ref.manifest : void 0) || '')
}, function() {
head(function() {
var ref1, ref2;
title("" + (this.__.title() || 'Untitled'));
meta({
name: "viewport",
content: "user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"
});
meta({
name: "viewport",
content: "initial-scale=1.0,user-scalable=no,maximum-scale=1",
media: "(device-height: 568px)"
});
meta({
name: "apple-mobile-web-app-capable",
content: "yes"
});
style(Chocokup.Css[(ref1 = (ref2 = this.params) != null ? ref2.theme : void 0) != null ? ref1 : "reset"] + "\n" + Chocokup.Css.core);
return ie('lt IE 9', function() {
return script({
src: "/static/lib/html5shiv.js",
type: "text/javascript",
charset: "utf-8"
});
});
});
return text("" + (this.__.body()));
});
};
Document.prototype.body_template = function() {
return text("" + (this.__.content()));
};
return Document;
})(Chocokup);
Chocokup.Html = (function(superClass) {
extend(Html, superClass);
function Html(params, content1) {
this.params = params;
this.content = content1;
Html.__super__.constructor.call(this, this.params, this.content);
if (this.params == null) {
this.params = {};
}
}
return Html;
})(Chocokup);
Chocokup.Panel = Chocokup.Html;
Chocokup.App = (function(superClass) {
extend(App, superClass);
function App() {
return App.__super__.constructor.apply(this, arguments);
}
App.manifest = {
cache: "/static/lib/coffee-script.js\n/static/lib/chocodash.js\n/static/lib/litejq.js\n/static/lib/locco.js"
};
App.prototype.body_template = function() {
var ref;
if ((ref = this.params) != null ? ref.with_coffee : void 0) {
script({
src: "/static/lib/coffee-script.js",
type: "text/javascript",
charset: "utf-8"
});
}
script({
src: "/static/lib/chocodash.js",
type: "text/javascript",
charset: "utf-8"
});
script({
src: "/static/lib/litejq.js",
type: "text/javascript",
charset: "utf-8"
});
script({
src: "/static/lib/locco.js",
type: "text/javascript",
charset: "utf-8"
});
return text("" + (this.__.content()));
};
return App;
})(Chocokup.Document);
Chocokup.Kups = {
Tablet: function() {
style(".chocoblack {background-color: #241A15;border: 1px solid #080401;-webkit-box-shadow: inset 0 0 15px #080401;-moz-box-shadow: inset 0 0 15px #080401;-o-box-shadow: inset 0 0 15px #080401;box-shadow: inset 0 0 15px #080401;}\n.chocomilk {background-color:rgb(245, 242, 232);border: 2px solid rgba(255, 204, 0, 0.3);color: rgb(92, 75, 66);}\n.frame.chocomilk.round {-webkit-box-shadow: inset 0 0 20px #080401;-moz-box-shadow: inset 0 0 20px #080401;-o-box-shadow: inset 0 0 20px #080401;box-shadow: inset 0 0 20px #080401;} ");
return panel("#.chocoblack", {
proportion: 'third'
}, function() {
panel(function() {
return panel({
proportion: 'third',
orientation: 'vertical'
}, function() {
panel(function() {
return box("#.chocoblack", "");
});
panel(function() {
return box("#.chocoblack", "");
});
return panel(function() {
return box("#.chocoblack", "");
});
});
});
panel(function() {
return panel({
proportion: 'third',
orientation: 'vertical'
}, function() {
panel(function() {
return box("#.chocoblack", "");
});
panel(function() {
return box("#.chocomilk.round", function() {
return table('#.fullscreen.expand', function() {
return td({
style: 'text-align:center;vertical-align:middle;'
}, function() {
return key();
});
});
});
});
return panel(function() {
return box("#.chocoblack", "");
});
});
});
return panel(function() {
return panel({
proportion: 'third',
orientation: 'vertical'
}, function() {
panel(function() {
return box("#.chocoblack", "");
});
panel(function() {
return box("#.chocoblack", "");
});
return panel(function() {
return box("#.chocoblack", "");
});
});
});
});
}
};
Chocokup.Css = (function() {
function Css() {}
Css.prefix = function(css) {
var p;
return ((function() {
var j, len, ref, results;
ref = ['-webkit-', '-moz-', '-o-', '-ms-', ''];
results = [];
for (j = 0, len = ref.length; j < len; j++) {
p = ref[j];
results.push(css.replace(/-\?-/g, p));
}
return results;
})()).join('\n');
};
Css.reset = "/* Eric Meyer's Reset CSS v2.0 - http://cssreset.com */\nhtml,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}";
Css.basic = Css.reset + "/* Paper - chocolatejs.org */\nbody{line-height:1.3;margin:8px;}\nh1,h2,h3,h4,h5,h6{font-weight: bold;}h1{font-size: 2em;}h2{font-size: 1.5em;}h3{font-size: 1.17em;}h5{font-size: 0.83em;}h6{font-size: 0.67em;}\npre{margin:0.25em 0px;padding:0.8em 1.2em;}\nabbr,acronym{border-bottom:.1em dotted;cursor: help;}\nstrong, b{font-weight: bold;}\ncode,kbd,samp{font-size:smaller;padding:0.2em 0.45em 0.4em;background-color:lightgray;white-space:nowrap;border-radius:0.3em;}\npre code{white-space:pre;background-color: inherit;padding:0;}\nkbd{display: inline-block;margin:0.25em 0;padding:0.4em 0.3em;}\nem,i{font-style: italic;}\nq {font-style:italic;padding:0 0.25em;}q:before{position:relative;top:0.25em;left:-0.25em;content:\"\\201C\";font-size:1.25em;}q:after{position:relative;top:0.6em;content:\"\\201D\";font-size:1.25em;}\nsmall{font-size:smaller;}\nsub{vertical-align:sub;font-size:smaller;}\nsup{vertical-align:super;font-size:smaller;}\ndt{font-style:normal;font-weight:bold;}\ndd{padding-left:1em;}\nol{list-style:decimal;padding:0 2.25em;}\nul{list-style:disc;padding:0 2.25em;}";
Css.paper = Css.basic + "ul,ol,pre{margin: 12px 0;}\nh1,h2,h3,h4,h5,h6,p{margin: 16px 0;}";
Css.writer = Css.paper + "/* Writer - chocolatejs.org */\nbody{font-family:Georgia, serif;}\nblockquote{font-style:italic;margin:0.25em 0 0.45em;padding:0 1em;}blockquote:before{content:\"\\201C\";font-size:1.5em;top:-0.2em;}blockquote cite{display:block;font-size:0.85em;}blockquote cite:before{content:\"\\2014 \\2009\";}blockquote p{display:inline;}\npre{font-family: inherit;font-size:inherit;}\nins{border-bottom:solid 2px gray;border-radius:0.5em;padding:0 0.25em;text-decoration:none;}";
Css.coder = Css.paper + "/* Coder - chocolatejs.org */\nbody{font-family: Tahoma;font-size:small;}\npre{background-color:#F7F7F7;margin:0.25em 0px;padding:0.8em 1.2em;}\nblockquote {border-left:0.4em solid lightgray;font-style:italic;margin:0.25em 0;padding:0.5em 1em;}blockquote cite{display:block;font-size:0.85em;}blockquote cite:before{content:\"\\2014 \\2009\";}blockquote p{display:inline;}";
Css.core = ".panel{bottom:0;height:auto;left:0;overflow:hidden;position:absolute;right:0;top:0;width:auto;}\n.hidden{display:none;}\n.screen-95{height:96%;left:5%;top:2%;width:90%;}\n.screen-90{height:92%;left:10%;top:4%;width:80%;}\n.screen-85{height:88%;left:15%;top:6%;width:70%;}\n.screen-80{height:84%;left:20%;top:8%;width:60%;}\n.row-1 {height:10;}\n.row-2 {height:20%;}\n.row-3 {height:30%;}\n.row-4 {height:40%;}\n.row-5 {height:50%;}\n.row-6 {height:60%;}\n.row-7 {height:70%;}\n.row-8 {height:80%;}\n.row-9 {height:90%;}\n.row-10 {height:100%;} \n.row.offset-1 {top:10%;margin-left:auto;}\n.row.offset-2 {top:20%;margin-left:auto;}\n.row.offset-3 {top:30%;margin-left:auto;}\n.row.offset-4 {top:40%;margin-left:auto;}\n.row.offset-5 {top:50%;margin-left:auto;}\n.row.offset-6 {top:60%;margin-left:auto;}\n.row.offset-7 {top:70%;margin-left:auto;}\n.row.offset-8 {top:80%;margin-left:auto;}\n.row.offset-9 {top:90%;margin-left:auto;}\n.row.offset-10 {top:100%;left:auto;} \n.top{bottom:auto;top:0;}\n.third.vertical.middle{top:33.33%;}\n.bottom{bottom:0;top:auto;}\n.left{left:0;right:auto;}\n.third.horizontal.center{left:33.33%;}\n.right{left:auto;right:0;}\n.half.horizontal{width:50%;}\n.half.vertical{height:50%;}\n.half-served.horizontal.left{width:80%;}\n.half-served.vertical.top{height:80%;}\n.half-served.horizontal.right{width:20%;}\n.half-served.vertical.bottom{height:20%;}\n.third.horizontal{width:33.33%;}\n.third.vertical{height:33.33%;}\n.service.horizontal{width:20%;}\n.fullscreen > .service.horizontal{width:0%;}\n.service.vertical{height:20%;}\n.fullscreen > .service.vertical{height:0%;}\n.served.horizontal{left:20%;right:20%;width:60%;}\n.fullscreen > .served.horizontal{left:0%;right:0%;width:100%;}\n.served.vertical{bottom:20%;height:60%;top:20%;}\n.fullscreen > .served.vertical{bottom:0%;height:100%;top:0%;}\n.fullscreen.shrink{height:0%;width:0%;}\n.shrink.horizontal{width:0%;}\n.shrink.vertical{height:0%;}\n.fullscreen.expand{height:100%;width:100%;}\n.expand.horizontal{width:100%;}\n.expand.vertical{height:100%;}\n.source-code{white-space:pre;}\n.float-left{float:left;}\n.float-margin-left{float:left;margin-left:1em;}\n.float-right{float:right;}\n.float-margin-right{float:right;margin-right:1em;}\n.margin-none{margin:0;}\n.margin{margin:1em;}\n.margin-left{margin-left:1em;}\n.margin-right{margin-right:1em;}\n.margin-top{margin-top:1em;}\n.margin-bottom{margin-bottom:1em;}\n.padding-none{padding:0;}\n.padding{padding:1em;}\n.padding-left{padding-left:1em;}\n.padding-right{padding-right:1em;}\n.padding-top{padding-top:1em;}\n.padding-bottom{padding-bottom:1em;}\n.header{bottom:auto;height:2.4em;line-height:2.4em;overflow:hidden;position:absolute;text-align:center;top:0px;width:100%;}\n.body{bottom:2.4em;overflow:auto;position:absolute;top:2.4em;-webkit-overflow-scrolling:touch;}\n.footer{bottom:0px;height:2.4em;line-height:2.4em;overflow:hidden;position:absolute;text-align:center;top:auto;width:100%;}\n.no-header{top:0px;}\n.no-footer{bottom:0px;}\n.header.by-bootstrap, .footer.by-bootstrap{height:40px;line-height:inherit;margin:0;padding:0;}\n.header.by-2, .footer.by-2{height:4.8em;}\n.header.by-3, .footer.by-3{height:7.2em;}\n.header.by-4, .footer.by-4{height:9.6em;}\n.header.by-5, .footer.by-5{height:12em;}\n.header.by-10, .footer.by-10{height:24em;}\n.with-bootstrap-headers{top:40px;}\n.with-2-headers{top:4.8em;}\n.with-3-headers{top:7.2em;}\n.with-4-headers{top:9.6em;}\n.with-5-headers{top:12em;}\n.with-10-headers{top:24em;}\n.with-bootstrap-footers{bottom:40px;}\n.with-2-footers{bottom:4.8em;}\n.with-3-footers{bottom:7.2em;}\n.with-4-footers{bottom:9.6emx;}\n.with-5-footers{bottom:12em;}\n.with-10-footers{bottom:24em;}\n.inline{position:relative;}\n.scroll *{overflow:auto;webkit-overflow-scrolling:touch;}\n.no-scroll *{overflow:hidden;}\n.no-crop {overflow: visible;}\n.overflow {overflow: auto}\n\n.row{margin:0 auto;width:960px;overflow:hidden;display:block;}\n.row .row{margin:0 -16px 0 -16px;width:auto;display:inline-block}\n[class^=\"col-\"],[class*=\" col-\"]{margin:0 16px 0 16px;float:left;display:inline}\n.col-1{width:48px}\n.col-2{width:128px}\n.col-3{width:208px}\n.col-4{width:288px}\n.col-5{width:368px}\n.col-6{width:448px}\n.col-7{width:528px}\n.col-8{width:608px}\n.col-9{width:688px}\n.col-10{width:768px}\n.col-11{width:848px}\n.col-12{width:928px}\n.offset-1{margin-left:96px}\n.offset-2{margin-left:176px}\n.offset-3{margin-left:256px}\n.offset-4{margin-left:336px}\n.offset-5{margin-left:416px}\n.offset-6{margin-left:496px}\n.offset-7{margin-left:576px}\n.offset-8{margin-left:656px}\n.offset-9{margin-left:736px}\n.offset-10{margin-left:816px}\n.offset-11{margin-left:896px}\n.show-phone{display:none !important}\n.show-tablet{display:none !important}\n.show-screen{display:inherit !important}\n.hide-phone{display:inherit !important}\n.hide-tablet{display:inherit !important}\n.hide-screen{display:none !important}\n\n.row.fluid {width:100%}\n.row.fluid .row{margin:0}\n.row.fluid [class^=\"col-\"],.row.fluid [class*=\" col-\"]{margin:0}\n.row.fluid .col-1{width:8.333333333333332%}\n.row.fluid .col-2{width:16.666666666666664%}\n.row.fluid .col-3{width:25%}\n.row.fluid .col-4{width:33.33333333333333%}\n.row.fluid .col-5{width:41.66666666666667%}\n.row.fluid .col-6{width:50%}\n.row.fluid .col-7{width:58.333333333333336%}\n.row.fluid .col-8{width:66.66666666666666%}\n.row.fluid .col-9{width:75%}\n.row.fluid .col-10{width:83.33333333333334%}\n.row.fluid .col-11{width:91.66666666666666%}\n.row.fluid .col-12{width:100%}\n.row.fluid .offset-1{margin-left:8.333333333333332%}\n.row.fluid .offset-2{margin-left:16.666666666666664%}\n.row.fluid .offset-3{margin-left:25%}\n.row.fluid .offset-4{margin-left:33.33333333333333%}\n.row.fluid .offset-5{margin-left:41.66666666666667%}\n.row.fluid .offset-6{margin-left:50%}\n.row.fluid .offset-7{margin-left:58.333333333333336%}\n.row.fluid .offset-8{margin-left:66.66666666666666%}\n.row.fluid .offset-9{margin-left:75%}\n.row.fluid .offset-10{margin-left:83.33333333333334%}\n.row.fluid .offset-11{margin-left:91.66666666666666%}\n\n@media only screen and (min-width:1200px){\n.row{width:1200px;}\n.row .row{margin:0 -20px 0 -20px}\n[class^=\"col-\"],[class*=\" col-\"]{margin:0 20px 0 20px}\n.col-1{width:60px}\n.col-2{width:160px}\n.col-3{width:260px}\n.col-4{width:360px}\n.col-5{width:460px}\n.col-6{width:560px}\n.col-7{width:660px}\n.col-8{width:760px}\n.col-9{width:860px}\n.col-10{width:960px}\n.col-11{width:1060px}\n.col-12{width:1160px}\n.offset-1{margin-left:120px}\n.offset-2{margin-left:220px}\n.offset-3{margin-left:320px}\n.offset-4{margin-left:420px}\n.offset-5{margin-left:520px}\n.offset-6{margin-left:620px}\n.offset-7{margin-left:720px}\n.offset-8{margin-left:820px}\n.offset-9{margin-left:920px}\n.offset-10{margin-left:1020px}\n.offset-11{margin-left:1120px}\n.show-phone{display:none !important}\n.show-tablet{display:none !important}\n.show-screen{display:inherit}\n.hide-phone{display:inherit !important}\n.hide-tablet{display:inherit !important}\n.hide-screen{display:none !important}\n}\n\n@media only screen and (min-width: 768px) and (max-width: 959px){\n.row{width:768px;}\n.row .row{margin:0 -14px 0 -14px}\n[class^=\"col-\"],[class*=\" col-\"]{margin:0 14px 0 14px}\n.col-1{width:36px}\n.col-2{width:100px}\n.col-3{width:164px}\n.col-4{width:228px}\n.col-5{width:292px}\n.col-6{width:356px}\n.col-7{width:420px}\n.col-8{width:484px}\n.col-9{width:548px}\n.col-10{width:612px}\n.col-11{width:676px}\n.col-12{width:740px}\n.offset-1{margin-left:78px}\n.offset-2{margin-left:142px}\n.offset-3{margin-left:206px}\n.offset-4{margin-left:270px}\n.offset-5{margin-left:334px}\n.offset-6{margin-left:398px}\n.offset-7{margin-left:462px}\n.offset-8{margin-left:526px}\n.offset-9{margin-left:590px}\n.offset-10{margin-left:654px}\n.offset-11{margin-left:718px}\n.show-phone{display:none !important}\n.show-tablet{display:inherit !important}\n.show-screen{display:none !important}\n.hide-phone{display:inherit !important}\n.hide-tablet{display:none !important}\n.hide-screen{display:inherit !important}\n}\n\n@media only screen and (max-width: 767px){\n.row{width:300px;}\n.row .row{margin:0}\n[class^=\"col-\"],[class*=\" col-\"]{width:300px;margin:10px 0 0 0}\n.offset-1,.offset-2,.offset-3,.offset-4,.offset-5,.offset-6,.offset-7,.offset-8,.offset-9,.offset-10,.offset-11{margin-left:0}\n.show-phone{display:inherit !important}\n.show-tablet{display:none !important}\n.show-screen{display:none !important}\n.hide-phone{display:none !important}\n.hide-tablet{display:inherit !important}\n.hide-screen{display:inherit !important}\n}\n\n@media only screen and (min-width: 480px) and (max-width: 767px){\n.row{margin:0 auto;width:456px}\n.row .row{margin:0;width:auto;display:inline-block}\n[class^=\"col-\"],[class*=\" col-\"]{margin:10px 0 0 0;width:456px}\n.show-phone,.hide-tablet,.hide-screen{display:inherit !important}\n.show-tablet,.show-screen,.hide-phone{display:none !important}\n}";
return Css;
})();
Chocokup.Css.Animation = (function() {
function Animation() {}
Animation.create = function(anims, css_class) {
var anim, css, delay, i, j, l, len, len1, len2, len3, len4, m, n, o, prefix, ref, ref1, ref2, ref3, result, time, what;
result = '';
if (css_class == null) {
css_class = {};
}
if (css_class.select == null) {
css_class.select = 'to-anim';
}
if (css_class.trigger == null) {
css_class.trigger = 'animate';
}
css = [];
delay = 0;
prefix = Chocokup.Css.prefix;
for (i = j = 0, len = anims.length; j < len; i = ++j) {
anim = anims[i];
switch (anim.type) {
case 'typing':
time = 0.15;
css.push("." + ((ref = anim.css) != null ? ref : 'typing') + ".text-" + i + "." + css_class.trigger + " span {");
css.push(prefix(" -?-animation: typing " + (time * anim.what.length) + "s steps(" + anim.what.length + ", end), blink-caret 0.5s step-end;"));
css.push(prefix(" -?-animation-iteration-count: 1, " + (2 * time * anim.what.length) + ";"));
css.push(prefix(" -?-animation-delay: " + delay + "s;"));
css.push(prefix(" -?-animation-fill-mode: forwards, none;"));
css.push('}\n');
delay += time * anim.what.length;
break;
case 'fly':
time = 4;
ref1 = anim.what;
for (l = 0, len1 = ref1.length; l < len1; l++) {
what = ref1[l];
css.push(("." + anim.type + "-") + what + ("." + css_class.trigger + " {"));
css.push(prefix(" -?-animation: " + anim.type + "-" + what + " " + time + "s;"));
css.push(prefix(" -?-animation-delay: " + delay + "s;"));
css.push(prefix(" -?-animation-fill-mode: forwards;"));
css.push(" position:relative;");
css.push('}\n');
}
delay += time;
break;
case 'open':
time = 3;
ref2 = anim.what;
for (m = 0, len2 = ref2.length; m < len2; m++) {
what = ref2[m];
css.push(("." + anim.type + "-") + what + ("." + css_class.trigger + " {"));
css.push(prefix(" -?-animation: " + anim.type + "-" + what + " " + time + "s;"));
css.push(prefix(" -?-animation-delay: " + delay + "s;"));
css.push(prefix(" -?-animation-fill-mode: forwards;"));
css.push(" position:relative;");
css.push('}\n');
}
delay += time;
break;
case 'appear':
time = 2.5;
ref3 = anim.what;
for (n = 0, len3 = ref3.length; n < len3; n++) {
what = ref3[n];
css.push("." + anim.type + "-" + what + "." + css_class.trigger + " {");
css.push(prefix(" -?-animation: " + anim.type + " " + time + "s;"));
css.push(prefix(" -?-animation-delay: " + delay + "s;"));
css.push(prefix(" -?-animation-fill-mode: forwards;"));
css.push('}\n');
}
delay += time;
}
}
result += '\n<style>\n' + css.join('\n') + '\n</style>\n';
for (i = o = 0, len4 = anims.length; o < len4; i = ++o) {
anim = anims[i];
if (anim.type === 'typing') {
result += "\n<div class='" + css_class.select + " text-" + i + " " + anim.css + "'>";
result += "\n " + anim.what;
result += "\n <span> </span>";
result += "\n</div>";
}
}
return result;
};
return Animation;
})();
_module = typeof window !== "undefined" && window !== null ? window : module;
_module[_module.exports != null ? "exports" : "Chocokup"] = Chocokup;
}).call(this);