-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
49 lines (40 loc) · 1.12 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"use strict";
var O = require("pop-observe");
module.exports = Main;
function Main() {
this.language = "english";
this.mode = "general-use";
this.latin = "";
this.font = "parmaite";
}
Main.prototype.hookup = function (id, component, scope) {
if (id === "this") {
this.components = scope.components;
this.init();
}
};
Main.prototype.init = function () {
this.components.latin.addEventListener("keyup", this);
this.components.latin.focus();
this.chooserObserver = O.observePropertyChange(this.components.chooser, "value", this);
delete document.body.className;
};
Main.prototype.handleValuePropertyChange = function (value) {
var parts = value.split(":");
this.mode = parts[0];
this.language = parts[1];
this.font = parts[2];
this.update();
};
Main.prototype.handleEvent = function (event) {
this.latin = this.components.latin.value;
this.update();
};
Main.prototype.update = function () {
this.components.explanation.value = {
mode: this.mode,
font: this.font,
language: this.language,
value: this.latin
};
};