-
Notifications
You must be signed in to change notification settings - Fork 9
/
sample.js
54 lines (45 loc) · 1.42 KB
/
sample.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
49
50
51
52
53
54
// Compiles to public/sample.js
"use strict";
var GeneralUse = require("./general-use");
var Classical = require("./classical");
var TengwarParmaite = require("./tengwar-parmaite");
var body = document.body;
function report(latin, mode, font) {
var element = $("<nobr>");
$("<span></span>")
.text(latin + ": ")
.css("padding", "10px")
.appendTo(element);
$("<span>")
.attr({
"class": "tengwar " + font,
"data-tengwar": latin,
"data-mode": mode
})
.appendTo(element);
element.appendTo(body);
$("<span> </span>").appendTo(body);
}
["annatar", "parmaite"].forEach(function (font) {
$("<h1>tengwar " + font + "</h1>").appendTo(body);
$("<h2>Classical</h2>").appendTo(body);
Object.keys(Classical).forEach(function (latin) {
report(latin, "classical", font);
});
$("<h2>General Use</h2>").appendTo(body);
Object.keys(GeneralUse).forEach(function (latin) {
report(latin, "general-use", font);
});
});
$(".transcribe").each(function () {
var element = this;
setTimeout(function () {
element.classList.remove("transcribe");
element.innerHTML = GeneralUse.transcribe(element.innerHTML, {
font: TengwarParmaite
});
element.classList.add("tengwar");
element.classList.add("parmaite");
element.classList.add("rendered");
}, 0);
});