diff options
author | zefanja <zefanja@freenet.de> | 2014-01-02 15:13:12 +0700 |
---|---|---|
committer | zefanja <zefanja@freenet.de> | 2014-01-02 15:13:12 +0700 |
commit | fdcb2654e95aa230c99ea66b44f12d6017ba8016 (patch) | |
tree | 5ce2ccf5522606aab1b575a3d7d2b62a5a735c90 | |
parent | 173ae65c3d95e26d4bdca54eb925225ced1a735f (diff) | |
download | biblez-ng-fdcb2654e95aa230c99ea66b44f12d6017ba8016.tar.gz |
* added history of last read passages
* updated manifest description
-rw-r--r-- | assets/font.png | bin | 3140 -> 1628 bytes | |||
-rw-r--r-- | assets/history.png | bin | 0 -> 3090 bytes | |||
-rw-r--r-- | assets/menu.png | bin | 277 -> 276 bytes | |||
-rw-r--r-- | manifest.deploy | 3 | ||||
-rw-r--r-- | manifest.webapp | 33 | ||||
-rw-r--r-- | source/App.css | 5 | ||||
-rw-r--r-- | source/main.js | 83 | ||||
-rw-r--r-- | source/popup.js | 8 |
8 files changed, 96 insertions, 36 deletions
diff --git a/assets/font.png b/assets/font.png Binary files differindex 2551d25..be10e7f 100644 --- a/assets/font.png +++ b/assets/font.png diff --git a/assets/history.png b/assets/history.png Binary files differnew file mode 100644 index 0000000..915982b --- /dev/null +++ b/assets/history.png diff --git a/assets/menu.png b/assets/menu.png Binary files differindex 4ae3c40..e11244b 100644 --- a/assets/menu.png +++ b/assets/menu.png diff --git a/manifest.deploy b/manifest.deploy index 829bc16..98eb8e8 100644 --- a/manifest.deploy +++ b/manifest.deploy @@ -1,6 +1,7 @@ { "name": "BibleZ", - "description": "Read and study the Bible!", + "version": "1.0", + "description": "BibleZ is an easy to use offline bible reader app for your FirefoxOS device! Enjoy the full bible at your fingertips! Features: * many available bibles in different languages (e.g. ESV, KJV, NET (free version), ...) * notes * bookmarks * highlights * history of last read scriptures * no internet connection required (only for downloading modules). BibleZ is based on the SWORD Project (http://crosswire.org) and licenced under GPLv3. If you have any problems with this app just send an eMail to info@zefanjas.de!", "launch_path": "/index.html", "icons": { "128": "/assets/biblez128.png" diff --git a/manifest.webapp b/manifest.webapp index 030977b..d957a41 100644 --- a/manifest.webapp +++ b/manifest.webapp @@ -1,19 +1,20 @@ { - "name": "BibleZ Debug", - "description": "Read and study the Bible!", - "launch_path": "/debug.html", - "icons": { - "128": "/assets/biblez128.png" - }, - "developer": { - "name": "zefanjas", - "url": "http://zefanjas.de" - }, - "default_locale": "en", - "type": "privileged", - "permissions": { - "systemXHR": { - "description": "Required to download CrossWire's bible modules" + "name": "BibleZ", + "version": "1.0", + "description": "BibleZ is an easy to use offline bible reader app for your FirefoxOS device! Enjoy the full bible at your fingertips! Features: * many available bibles in different languages (e.g. ESV, KJV, NET (free version), ...) * notes * bookmarks * highlights * history of last read scriptures * no internet connection required (only for downloading modules). BibleZ is based on the SWORD Project (http://crosswire.org) and licenced under GPLv3. If you have any problems with this app just send an eMail to info@zefanjas.de!", + "launch_path": "/debug.html", + "icons": { + "128": "/assets/biblez128.png" + }, + "developer": { + "name": "zefanjas", + "url": "http://zefanjas.de" + }, + "default_locale": "en", + "type": "privileged", + "permissions": { + "systemXHR": { + "description": "Required to download CrossWire's bible modules" + } } - } }
\ No newline at end of file diff --git a/source/App.css b/source/App.css index ee0377d..74c440b 100644 --- a/source/App.css +++ b/source/App.css @@ -73,6 +73,11 @@ margin-left: 10px; } +.active-verse { + background-color: yellow; + transition: background-color 500ms linear; +} + /* MODULE MANAGER */ .item { diff --git a/source/main.js b/source/main.js index 76a3305..ef7c489 100644 --- a/source/main.js +++ b/source/main.js @@ -23,16 +23,21 @@ enyo.kind({ {name: "bcPopup", classes: "biblez-bc-popup", kind: "onyx.Popup", modal: true, floating: true, components: [ {kind: "biblez.bcSelector", name: "bcSelector", onSelect: "passageChanged", onBack: "closePopup"} ]}, - {kind: "onyx.MoreToolbar", showing: false, classes: "main-toolbar", name: "topTB", components: [ + {kind: "onyx.MoreToolbar", classes: "main-toolbar", name: "topTB", components: [ {name: "moduleSelector", kind: "onyx.MenuDecorator", onSelect: "moduleSelected", components: [ {kind: "onyx.Button", name: "btnModules", classes: "tb-button", style: "background-color: #934A15;"}, - {kind: "onyx.Menu", maxHeight: "400", name: "moduleMenu"} + {kind: "onyx.Menu", maxHeight: "300", name: "moduleMenu"} ]}, {kind: "onyx.Button", name: "btnPassage", classes: "tb-button", ontap: "handleBcSelector"}, - //{fit: true}, + {name: "historySelector", kind: "onyx.MenuDecorator", onSelect: "historySelected", components: [ + //Clock Icon by Thomas Le Bas from The Noun Project + {kind: "onyx.IconButton", name: "btnHistory", src: "assets/history.png"}, + {kind: "onyx.Menu", maxHeight: "300", name: "historyMenu"} + ]}, + {fit: true}, {name: "actionSelector", kind: "onyx.MenuDecorator", onSelect: "actionSelected", components: [ {kind: "onyx.IconButton", src: "assets/menu.png"}, - {kind: "onyx.Menu", name: "actionMenu", maxHeight: "400", style: "width: 200px;", components: [ + {kind: "onyx.Menu", name: "actionMenu", maxHeight: "300", style: "width: 200px;", components: [ {action: "bookmarks", components: [ {kind: "onyx.IconButton", src: "assets/bookmarks.png"}, {content: $L("Bookmarks"), classes: "menu-label"} @@ -56,7 +61,7 @@ enyo.kind({ ]} ]} ]}, - {name: "btFont", kind: "onyx.IconButton", src: "assets/font.png", ontap: "handleFontMenu", style: "position:absolute; right: 0;"}, + {name: "btFont", kind: "onyx.IconButton", src: "assets/font.png", ontap: "handleFontMenu"}, //{name: "btnPrefs", kind:"onyx.IconButton", src: "assets/settings.png", ontap: "handlePrefs"}, //{name: "plus", kind: "onyx.IconButton", src: "assets/add.png", style:"position:absolute;right:0;", ontap: "doOpenModuleManager"}, /*{kind: "onyx.InputDecorator", components: [ @@ -94,6 +99,7 @@ enyo.kind({ }, userData: {}, modules: [], + history: [], panelIndex: 2, settings: {id: "settings"}, @@ -104,14 +110,11 @@ enyo.kind({ this.$.mainPanel.setIndexDirect(2); }, - rendered: function () { - this.inherited(arguments); - }, - startUp: function () { api.get("settings", enyo.bind(this, function(inError, inSettings) { if(!inError) { this.settings = (inSettings) ? inSettings: this.settings; + //console.log(this.settings); this.getInstalledModules(); if(this.settings.fontSize) { this.$.fontMenu.setFontSize(this.settings.fontSize); @@ -122,6 +125,8 @@ enyo.kind({ if(this.settings.font !== "default") this.$.main.applyStyle("font-family", this.settings.font); } + if(this.settings.history) + this.history = this.settings.history; } else { this.handleError("Couldn't load settings!"); } @@ -147,12 +152,13 @@ enyo.kind({ this.$.mainPanel.setIndex(2); this.$.mainPanel.draggable = true; this.$.topTB.show(); - this.$.topTB.reflow(); this.modules = inModules; this.renderModuleMenu(this.modules); + this.$.firstStart.hide(); } else { this.$.topTB.hide(); this.$.mainPanel.draggable = false; + this.$.firstStart.show(); this.$.mainPanel.setIndex(5); } } else { @@ -203,7 +209,7 @@ enyo.kind({ if (!isNaN(inEvent.originator.index)) { this.currentModule = this.modules[inEvent.originator.index]; this.settings["lastModule"] = this.currentModule.modKey; - this.handleUnload(); + api.putSetting("lastModule", this.currentModule.modKey); this.renderModuleMenu(); } }, @@ -212,6 +218,7 @@ enyo.kind({ this.$.bcPopup.hide(); this.currentPassage.osis = inEvent.osis; this.currentPassage.label = inEvent.label; + //this.currentPassage.verseNumber = inEvent.verseNumber; this.handlePassage(); }, @@ -219,12 +226,15 @@ enyo.kind({ //console.log("PASSAGE", passage, this.currentPassage); this.$.main.setContent(""); this.$.spinner.start(); + var verseNumber = 0; //this.currentPassage.verseNumber ? this.currentPassage.verseNumber : 0; if (typeof passage === "string") { //BibleZ currently supports only Book.Chapter Osis passages in the mainView if(passage.split(".").length > 2) { + verseNumber = parseInt(passage.slice(passage.lastIndexOf(".")+1, passage.length), 10); passage = passage.slice(0, passage.lastIndexOf(".")); - } + } else + verseNumber = 0; this.currentPassage.osis = passage.replace(" ", "."); this.currentPassage.label = passage.replace(".", " "); @@ -232,20 +242,61 @@ enyo.kind({ //Persist current passage this.settings["lastRead"] = this.currentPassage; - this.handleUnload(); + this.addToHistory(this.currentPassage.osis); + api.putSetting("lastRead", this.currentPassage); this.$.btnPassage.setContent(this.currentPassage.label); + //Adjust the TB Icons + this.$.topTB.reflow(); + this.currentModule.renderText(this.currentPassage.osis, {oneVersePerLine: this.settings.linebreak ? this.settings.linebreak : false}, enyo.bind(this, function (inError, inText) { this.$.spinner.stop(); if(!inError) { - this.$.verseScroller.scrollToTop(); this.$.main.setContent(inText); + if (verseNumber < 2) + this.$.verseScroller.scrollToTop(); + else { + var e = enyo.dom.byId(this.currentPassage.osis+"."+verseNumber); + this.$.verseScroller.scrollToNode(e); + e.style.backgroundColor = "rgba(210,105,30,0.25)"; + //e.className = e.className + " active-verse"; + } this.handleUserData(this.currentPassage.osis); + this.renderHistory(); } else this.handleError(inError.message); })); }, + renderHistory: function (inSender, inEvent) { + this.$.historyMenu.destroyClientControls(); + var hisItems = []; + this.history.forEach(enyo.bind(this, function (item, idx) { + hisItems.push({content: api.formatOsis(item.osisRef), index: idx, osisRef: item.osisRef}); + })); + this.$.historyMenu.createComponents(hisItems, {owner: this.$.historyMenu}); + this.$.historyMenu.render(); + }, + + historySelected: function (inSender, inEvent) { + if (!isNaN(inEvent.originator.index)) { + this.handlePassage(this.history[inEvent.originator.index].osisRef); + } + }, + + addToHistory: function (inOsis) { + if (this.history.length > 15) { + this.history.splice(16,this.history.length-15); + } + for (var l=0;l<this.history.length;l++) { + if(this.history[l].osisRef === inOsis) { + this.history.splice(l,1); + } + } + this.history.unshift({osisRef: inOsis}); + api.putSetting("history", this.history); + }, + handleUserData: function (inOsis) { var vmax = this.currentModule.getVersesInChapter(inOsis), hlKeys = [], @@ -440,10 +491,6 @@ enyo.kind({ } }, - handleUnload: function (inSender, inEvent) { - api.put(this.settings); - }, - handleError: function (inMessage) { this.$.messagePopup.setContent(inMessage); this.$.messagePopup.show(); diff --git a/source/popup.js b/source/popup.js index fdca7bc..1e93dfc 100644 --- a/source/popup.js +++ b/source/popup.js @@ -109,7 +109,7 @@ enyo.kind({ components:[ {kind: "enyo.FittableRows", fit: true, components: [ {name: "fontSlider", kind: "onyx.Slider", value: 50, onChange: "sliderChanged", classes: "font-slider"}, - {kind: "onyx.PickerDecorator", classes: "font-selector", onSelect: "fontSelected", components: [ + {name: "fontSelector", kind: "onyx.PickerDecorator", classes: "font-selector", onSelect: "fontSelected", components: [ {}, //{kind: "onyx.Button", content: $L("Select Font")}, {kind: "onyx.Picker", components: [ {content: $L("Default"), name: "default", active: true}, @@ -122,6 +122,12 @@ enyo.kind({ ]} ], + rendered: function () { + this.inherited(arguments); + if(enyo.platform.firefoxOS) + this.$.fontSelector.hide(); + }, + sliderChanged: function (inSender, inEvent) { if(inSender.value < 10) { this.fontSize = 0.8; |