diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/App.css | 5 | ||||
-rw-r--r-- | source/App.js | 12 | ||||
-rw-r--r-- | source/main.js | 45 | ||||
-rw-r--r-- | source/moduleManagerDesktop.js | 65 | ||||
-rw-r--r-- | source/package.js | 1 |
5 files changed, 86 insertions, 42 deletions
diff --git a/source/App.css b/source/App.css index 442b4a1..a300544 100644 --- a/source/App.css +++ b/source/App.css @@ -3,11 +3,14 @@ This way, you can minify your application, and just remove the "source" folder for production */ .background { - background: url("../assets/background.png"); + background: url("../assets/oldPaper.png"); + background-size: 100%; + } .nice-padding { padding: 10px; + font-size: 1.2em } .app-panels > * { diff --git a/source/App.js b/source/App.js index aa3b787..8dd2cb3 100644 --- a/source/App.js +++ b/source/App.js @@ -13,7 +13,8 @@ enyo.kind({ {name: "panel", kind: "Panels", fit: true, classes: "app-panels", arrangerKind: "CardArranger", draggable: false, onTransitionFinish: "handlePanels", components: [ {name: "main", kind: "biblez.main", onOpenModuleManager: "openModuleManager", onOpenBC: "openSelector", onModuleChanged: "handleChangeModule"}, {name: "moduleManager", kind: "biblez.moduleManager", onBack: "handleBack", onInstalled: "handleInstalledModule"}, - {name: "bcSelector", kind: "biblez.bcSelector", onSelect: "handlePassageSelect", onBack: "handleBack"} + {name: "bcSelector", kind: "biblez.bcSelector", onSelect: "handlePassageSelect", onBack: "handleBack"}, + {name: "moduleManagerDesktop", kind: "biblez.moduleManagerDesktop", onBack: "handleBack", onInstalled: "handleInstalledModule"} //{name: "settings"} ]} ], @@ -24,7 +25,7 @@ enyo.kind({ }, handlePanels: function (inSender, inEvent) { - if(inEvent.toIndex === 1) { + if(inEvent.toIndex === 1 && !enyo.platform.firefox) { this.$.moduleManager.start(); } return true; @@ -42,7 +43,10 @@ enyo.kind({ }, openModuleManager: function (inSender, inEvent) { - this.$.panel.setIndex(1); + if(enyo.platform.firefox) + this.$.panel.setIndex(3); + else + this.$.panel.setIndex(1); return true; }, @@ -67,4 +71,4 @@ enyo.kind({ window.screen.onmozorientationchange = function () { enyo.Signals.send("onOrientationChange"); }; -enyo.dispatcher.listen(window, "beforeunload"); +//enyo.dispatcher.listen(window, "beforeunload"); diff --git a/source/main.js b/source/main.js index f38143a..9debb8a 100644 --- a/source/main.js +++ b/source/main.js @@ -12,16 +12,16 @@ enyo.kind({ }, components:[ {kind: "Signals", onOrientationChange: "handleOrientation"}, - {kind: "Signals", onbeforeunload: "handleUnload"}, + //{kind: "Signals", onbeforeunload: "handleUnload"}, {name: "messagePopup", kind: "onyx.Popup", centered: true, floating: true, classes: "message-popup"}, {kind: "onyx.MoreToolbar", name: "topTB", components: [ - {kind: "onyx.MenuDecorator", onSelect: "moduleSelected", components: [ + {name: "moduleSelector", kind: "onyx.MenuDecorator", onSelect: "moduleSelected", components: [ {kind: "onyx.IconButton", src: "assets/modules.png"}, {kind: "onyx.Menu", name: "moduleMenu"} ]}, {kind: "onyx.Button", name: "btnPassage", ontap: "doOpenBC"}, {fit: true}, - {kind: "onyx.IconButton", src: "assets/add.png", ontap: "doOpenModuleManager"} + {name: "plus", kind: "onyx.IconButton", src: "assets/add.png", ontap: "doOpenModuleManager"} /*{kind: "onyx.InputDecorator", components: [ {kind: "onyx.Input", placeholder: "Enter a passage...", onchange: "handlePassage", name: "passageInput", value: "Matt 1"} ]}*/ @@ -42,11 +42,6 @@ enyo.kind({ ]}, {}, ]}, - /*{kind: "onyx.MoreToolbar", components: [ - {kind: "onyx.IconButton", src: "assets/add.png", ontap: "doOpenModuleManager"} - //{kind: "onyx.Button", content: "Install ESV", esv: true, ontap: "handleInstallTap"}, - //{kind: "Input", type: "file", onchange: "handleInstallTap"} - ]}*/ ], currentModule: null, @@ -78,10 +73,14 @@ enyo.kind({ sword.moduleMgr.getModules(enyo.bind(this, function(inError, inModules) { if (!inError) { if(inModules.length !== 0) { + this.$.moduleSelector.show(); + this.$.btnPassage.show(); this.modules = inModules; this.renderModuleMenu(this.modules); } else { - this.$.main.setContent($L("You have no modules installed. Tap on the '+' to install one!")); + this.$.moduleSelector.hide(); + this.$.btnPassage.hide(); + this.$.main.setContent("<center>" + $L("You have no modules installed. Tap on the '+' to install one!" + "</center>")); } } else { this.handleError(inError); @@ -127,7 +126,6 @@ enyo.kind({ if (!isNaN(inEvent.originator.index)) { this.currentModule = this.modules[inEvent.originator.index]; this.settings["lastModule"] = this.currentModule.modKey; - console.log(this.settings); this.handleUnload(); this.renderModuleMenu(); //this.doModuleChanged({module: this.currentModule}); @@ -135,31 +133,6 @@ enyo.kind({ } }, - 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.currentModule = inModule; - self.$.spinner.stop(); - if(!inError) { - self.$.main.setContent(enyo.json.stringify(inModule.config)); - self.$.moduleLabel.setContent(inModule.config.moduleKey); - } else - this.handleError(inError); - }); - else - this.handleError(inError); - }); - }, - passageChanged: function (inSender, inEvent) { this.currentPassage = inEvent.book.abbrev + " " + inEvent.chapter; this.handlePassage(inEvent.osis); @@ -171,7 +144,6 @@ enyo.kind({ this.$.spinner.start(); this.currentPassage = (!passage) ? this.currentPassage : passage; - console.log(this.currentPassage); //Persist current passage this.settings["lastRead"] = this.currentPassage; @@ -214,7 +186,6 @@ enyo.kind({ }, handleUnload: function (inSender, inEvent) { - console.log("unload", this.settings); api.put(this.settings); }, diff --git a/source/moduleManagerDesktop.js b/source/moduleManagerDesktop.js new file mode 100644 index 0000000..6bcfd8c --- /dev/null +++ b/source/moduleManagerDesktop.js @@ -0,0 +1,65 @@ +enyo.kind({ + name: "biblez.moduleManagerDesktop", + kind: "enyo.FittableRows", + fit: true, + events: { + onBack: "", + onInstalled: "" + }, + components: [ + {name: "messagePopup", kind: "onyx.Popup", scrim: true, centered: true, floating: true, classes: "message-popup"}, + {name: "scrim", kind: "onyx.Scrim", classes: "onyx-scrim-translucent"}, + {kind: "onyx.MoreToolbar", components: [ + {kind: "onyx.IconButton", src: "assets/back.png", ontap: "handleBack"}, + {content: $L("Module Manager")}, + {fit: true}, + {kind: "onyx.IconButton", src: "assets/delete.png", ontap: "clearDB"} + ]}, + {classes: "center", components: [ + {content: $L("Download a zipped module from one of the following repositories:")}, + {allowHtml: true, content: "<ul><li><a target='_blank' href='http://www.crosswire.org/sword/modules/ModDisp.jsp?modType=Bibles'>CrossWire Main</a></li>" + + "<li><a target='_blank' href='http://www.crosswire.org/sword/modules/ModDisp.jsp?modType=Bibles&av=true'>CrossWire av11n</a></li>" + + "<li><a target='_blank' href='http://www.crosswire.org/sword/modules/ModDisp.jsp?modType=Bibles&beta=true'>CrossWire Beta</a></li></ul>" + }, + {content: $L("To install the module, select the module file!")}, + {kind: "onyx.Input", type: "file", id: "files", name: "files[]", onchange: "installModule"}, + {tag: "br"}, + {kind: "onyx.Spinner", name: "spinner", showing: false, classes: "onyx-light center"} + ]} + ], + + lang: [], + started: false, + repos: [], + modules: [], + langModules: [], + currentModule: null, + + handleBack: function() { + this.doBack(); + }, + + installModule: function (inSender, inEvent) { + this.$.spinner.start(); + sword.installMgr.installModule(inEvent.target.files[0], enyo.bind(this, function (inError, inModule) { + if (!inError) { + this.doInstalled(); + this.$.spinner.stop(); + this.handleError("Installed Module!"); + } else { + this.handleError((inError.message) ? inError.message : inError); + } + })); + }, + + clearDB: function () { + sword.dataMgr.clearDatabase(); + }, + + handleError: function (inMessage) { + if (inMessage.message) + inMessage = inMessage.message; + this.$.messagePopup.setContent(inMessage); + this.$.messagePopup.show(); + } +});
\ No newline at end of file diff --git a/source/package.js b/source/package.js index d4fb8c7..0c5c2e7 100644 --- a/source/package.js +++ b/source/package.js @@ -9,5 +9,6 @@ enyo.depends( "bcSelector.js", "main.js", "moduleManager.js", + "moduleManagerDesktop.js", "App.js" ); |