-// Generated by CoffeeScript 1.4.0
+// Generated by CoffeeScript 1.12.7
(function() {
var AbstractRectangle, Canvas, GradientRectangle, GraphBar, KanjiInfo, Label, Line, Screen, makeGraphPage, merge, screenPosition,
- __hasProp = {}.hasOwnProperty,
- __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; };
+ 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; },
+ hasProp = {}.hasOwnProperty;
Canvas = {
el: "canvas#header-canvas",
};
Screen = (function() {
-
function Screen(attr) {
if (attr == null) {
attr = {};
};
Screen.prototype.draw = function(obj) {
- var x, _i, _len, _ref;
+ var i, len, ref, x;
if (obj) {
obj.draw();
} else {
- _ref = this.objects;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- x = _ref[_i];
+ ref = this.objects;
+ for (i = 0, len = ref.length; i < len; i++) {
+ x = ref[i];
x.draw();
}
}
};
Screen.prototype.animate = function() {
- var _this = this;
this.locking = true;
- return setTimeout(function() {
- var animating, x, _i, _len, _ref;
- animating = false;
- _ref = _this.objects;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- x = _ref[_i];
- if (!((x.isAnimating != null) && x.isAnimating())) {
- continue;
+ return setTimeout((function(_this) {
+ return function() {
+ var animating, i, len, ref, x;
+ animating = false;
+ ref = _this.objects;
+ for (i = 0, len = ref.length; i < len; i++) {
+ x = ref[i];
+ if (!((x.isAnimating != null) && x.isAnimating())) {
+ continue;
+ }
+ x.draw();
+ animating = true;
}
- x.draw();
- animating = true;
- }
- if (animating) {
- return _this.animate();
- } else {
- return _this.afterAnimation();
- }
- }, 25);
+ if (animating) {
+ return _this.animate();
+ } else {
+ return _this.afterAnimation();
+ }
+ };
+ })(this), 25);
};
Screen.prototype.afterAnimation = function() {
- var x, _i, _len, _ref, _results;
+ var i, len, ref, results, x;
this.locking = false;
- _ref = this.objects;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- x = _ref[_i];
+ ref = this.objects;
+ results = [];
+ for (i = 0, len = ref.length; i < len; i++) {
+ x = ref[i];
if (x.afterAnimation != null) {
- _results.push(x.afterAnimation(this));
+ results.push(x.afterAnimation(this));
}
}
- return _results;
+ return results;
};
return Screen;
})();
Label = (function() {
-
function Label(text, attr) {
- var _ref, _ref1, _ref2, _ref3;
if (attr == null) {
attr = {};
}
this.text = text;
merge(this, attr);
- if ((_ref = this.font) == null) {
+ if (this.font == null) {
this.font = '10px sans';
}
- if ((_ref1 = this.color) == null) {
+ if (this.color == null) {
this.color = 'white';
}
- if ((_ref2 = this.x) == null) {
+ if (this.x == null) {
this.x = 0;
}
- if ((_ref3 = this.y) == null) {
+ if (this.y == null) {
this.y = 0;
}
}
})();
Line = (function() {
-
function Line(attr) {
if (attr == null) {
attr = {};
})();
AbstractRectangle = (function() {
-
function AbstractRectangle(attr) {
- var _ref, _ref1, _ref2, _ref3;
if (attr == null) {
attr = {};
}
merge(this, attr);
- if ((_ref = this.x0) == null) {
+ if (this.x0 == null) {
this.x0 = 0;
}
- if ((_ref1 = this.y0) == null) {
+ if (this.y0 == null) {
this.y0 = 0;
}
- if ((_ref2 = this.x1) == null) {
+ if (this.x1 == null) {
this.x1 = 0;
}
- if ((_ref3 = this.y1) == null) {
+ if (this.y1 == null) {
this.y1 = 0;
}
}
})();
- GradientRectangle = (function(_super) {
-
- __extends(GradientRectangle, _super);
+ GradientRectangle = (function(superClass) {
+ extend(GradientRectangle, superClass);
function GradientRectangle(attr) {
- var _ref, _ref1;
if (attr == null) {
attr = {};
}
GradientRectangle.__super__.constructor.call(this, attr);
- if ((_ref = this.colors) == null) {
+ if (this.colors == null) {
this.colors = ['#fff', '#fff'];
}
- if ((_ref1 = this.direction) == null) {
+ if (this.direction == null) {
this.direction = 'horizontal';
}
}
GradientRectangle.prototype.draw = function(offsetX, offsetY) {
- var c, d, g, p, v, _i, _len, _ref;
+ var c, d, g, i, len, p, ref, v;
if (offsetX == null) {
offsetX = 0;
}
g = c.createLinearGradient(p.x0, p.y0, p.x1, p.y0);
}
d = 0.0;
- _ref = this.colors;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- v = _ref[_i];
+ ref = this.colors;
+ for (i = 0, len = ref.length; i < len; i++) {
+ v = ref[i];
g.addColorStop(d, v);
d += 1 / (this.colors.length - 1);
}
})(AbstractRectangle);
GraphBar = (function() {
-
function GraphBar(attr) {
- var _ref, _ref1, _ref2, _ref3;
if (attr == null) {
attr = {};
}
merge(this, attr);
- if ((_ref = this.x) == null) {
+ if (this.x == null) {
this.x = 0;
}
- if ((_ref1 = this.y) == null) {
+ if (this.y == null) {
this.y = 0;
}
- if ((_ref2 = this.width) == null) {
+ if (this.width == null) {
this.width = 1;
}
- if ((_ref3 = this.height) == null) {
+ if (this.height == null) {
this.height = 24;
}
this.performance = attr.performance || 0;
if (parseInt(val) * 1.0 === Number(val)) {
val = parseInt(val);
}
- label = new Label("" + val + "%", {
+ label = new Label(val + "%", {
font: '12px sans'
});
width = 1.0 * this.width / this.max * this.performance;
})();
merge = function(dist, src) {
- var k, v, _results;
- _results = [];
+ var k, results, v;
+ results = [];
for (k in src) {
v = src[k];
if (src.hasOwnProperty(k)) {
- _results.push(dist[k] = v);
+ results.push(dist[k] = v);
}
}
- return _results;
+ return results;
};
screenPosition = function(obj, offsetX, offsetY) {
- var m, offset, pos, _i, _len, _ref;
+ var i, len, m, offset, pos, ref;
pos = {};
offset = {
x: offsetX,
y: offsetY
};
- _ref = screenPosition.fields;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- m = _ref[_i];
+ ref = screenPosition.fields;
+ for (i = 0, len = ref.length; i < len; i++) {
+ m = ref[i];
if (obj.hasOwnProperty(m)) {
pos[m] = obj[m] + offset[m[0]];
}
return screen.add(bottomLine);
})();
(function() {
- var d, graphArea, x, _, _i, _len, _ref, _results;
+ var _, d, graphArea, i, len, ref, results, x;
graphArea = new GradientRectangle({
x0: 146,
y0: 75,
});
screen.add(graphArea);
d = [650 - 146] / 4;
- _ref = new Array(5);
- _results = [];
- for (x = _i = 0, _len = _ref.length; _i < _len; x = ++_i) {
- _ = _ref[x];
- _results.push(screen.add(new Line({
+ ref = new Array(5);
+ results = [];
+ for (x = i = 0, len = ref.length; i < len; x = ++i) {
+ _ = ref[x];
+ results.push(screen.add(new Line({
x: 146 + d * (x + 1),
y0: 75,
y1: 268,
color: "rgb(178, 255, 178)"
})));
}
- return _results;
+ return results;
})();
(function() {
- var field, fields, n, _i, _len, _results;
+ var field, fields, i, len, n, results;
fields = ['kyoikuKanji', 'level1st', 'level2nd', 'level3rd', 'level4th'];
- _results = [];
- for (n = _i = 0, _len = fields.length; _i < _len; n = ++_i) {
+ results = [];
+ for (n = i = 0, len = fields.length; i < len; n = ++i) {
field = fields[n];
screen.add(new Label(window.dictionary[field], {
x: 30,
y: 103 + (37 * n),
font: '14px sans'
}));
- _results.push(screen.add(new GraphBar({
+ results.push(screen.add(new GraphBar({
x: 146,
y: 87 + (37 * n),
width: 504,
performance: KanjiInfo[pageName][field]
})));
}
- return _results;
+ return results;
})();
screen.add(new Line({
x: 146,
return;
}
screenScale = (function() {
- var m, scale, _i, _len, _ref;
+ var i, len, m, ref, scale;
scale = {};
- _ref = ['width', 'height'];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- m = _ref[_i];
+ ref = ['width', 'height'];
+ for (i = 0, len = ref.length; i < len; i++) {
+ m = ref[i];
scale[m] = parseInt(Canvas.$el.css(m));
}
return scale;
})();
screen = new Screen(screenScale);
return KanjiInfo.update(function() {
- var $container, b, buttons, drawPage, n, name, _i, _len, _ref;
+ var $container, b, buttons, drawPage, i, len, n, name, ref;
drawPage = function(pageIndex) {
var pageName;
pageName = drawPage.mapping[pageIndex];
}
};
drawPage.mapping = ['gothic', 'mincho'];
- $container = $('#docs-header .buttons-container .inner-container');
+ $container = $('header .buttons-container .inner-container');
buttons = [];
- _ref = drawPage.mapping;
- for (n = _i = 0, _len = _ref.length; _i < _len; n = ++_i) {
- name = _ref[n];
+ ref = drawPage.mapping;
+ for (n = i = 0, len = ref.length; i < len; n = ++i) {
+ name = ref[n];
b = document.createElement('div');
$(b).addClass('button').text(n + 1).click(function() {
var index;