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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
enyo.kind({
name: "biblez.main",
kind: "FittableRows",
fit: true,
events: {
onOpenModuleManager: ""
},
components:[
//{kind: "Signals", onSwordReady: "getBible"},
{kind: "onyx.MoreToolbar", components: [
{content: "", name: "bible"},
{kind: "onyx.InputDecorator", components: [
{kind: "onyx.Input", placeholder: "Enter a passage...", onchange: "handlePassage"}
]}
]},
{kind: "enyo.Scroller", fit: true, components: [
{kind: "onyx.Spinner", name: "spinner", classes: "onyx-light"},
{name: "main", classes: "nice-padding", allowHtml: true}
]},
{kind: "onyx.MoreToolbar", components: [
{kind: "onyx.IconButton", src: "assets/modules.png", ontap: "doOpenModuleManager"}
//{kind: "onyx.Button", content: "Delete all Modules", ontap: "clearDB"},
//{kind: "onyx.Button", content: "Install ESV", esv: true, ontap: "handleInstallTap"},
//{kind: "Input", type: "file", onchange: "handleInstallTap"}
]}
],
bible: null,
create: function () {
this.inherited(arguments);
this.$.spinner.stop();
this.getBible();
},
getBible: function (inSender, inEvent) {
sword.moduleMgr.getModules(enyo.bind(this, function(inError, inModules) {
if(inModules.length !== 0) {
this.bible = inModules[0];
this.$.bible.setContent(this.bible.config.moduleKey);
}
}));
},
handleInstallTap: function (inSender, inEvent) {
this.$.spinner.start();
self = this;
self.$.main.setContent("Installing Module...");
var blob = "ESV.zip";
if (!inSender.esv)
blob = inEvent.target.files[0];
sword.installMgr.installModule(blob, function (inError, inId) {
//console.log(inError, inId);
if(!inError)
sword.moduleMgr.getModule(inId, function (inError, inModule) {
//console.log(inError, inModule);
self.bible = inModule;
self.$.spinner.stop();
if(!inError) {
self.$.main.setContent(enyo.json.stringify(inModule.config));
self.$.bible.setContent(inModule.config.moduleKey);
}
});
});
},
clearDB: function () {
sword.dataMgr.clearDatabase();
},
handlePassage: function (inSender, inEvent) {
//console.log("PASSAGE", inSender.getValue());
this.bible.renderText(inSender.getValue(), {oneVersePerLine: true}, enyo.bind(this, function (inError, inText) {
//console.log(inError, inText);
this.$.main.setContent(inText);
}));
}
});
|