diff options
author | zefanja <zefanja@freenet.de> | 2014-04-26 13:36:58 +0700 |
---|---|---|
committer | zefanja <zefanja@freenet.de> | 2014-04-26 13:36:58 +0700 |
commit | 0c14b67f75bd24f77353fd913f5bcf2cc684f009 (patch) | |
tree | 9fd413f3f64aef14bc3c687ad688074597351494 | |
parent | 33409e448f34e1fe62c8eb4a1087f61e267fed5b (diff) | |
download | biblez-ng-0c14b67f75bd24f77353fd913f5bcf2cc684f009.tar.gz |
* fixed #12
-rw-r--r-- | biblez.appcache | 3 | ||||
-rw-r--r-- | manifest.deploy | 2 | ||||
-rw-r--r-- | manifest.desktop | 2 | ||||
-rw-r--r-- | source/App.css | 4 | ||||
-rw-r--r-- | source/api.js | 4 | ||||
-rw-r--r-- | source/dataView.js | 48 |
6 files changed, 55 insertions, 8 deletions
diff --git a/biblez.appcache b/biblez.appcache index 5ee32d7..0a8fdbd 100644 --- a/biblez.appcache +++ b/biblez.appcache @@ -1,5 +1,5 @@ CACHE MANIFEST -# v17 - 2014-04-18 +# v20 - 2014-04-26 CACHE: icon.png index.html @@ -31,6 +31,7 @@ assets/notesTB.png assets/notesTB2.png assets/oldPaper.png assets/search.png +assets/search-input.png assets/settings.png assets/twitter_32.png assets/spinner.gif diff --git a/manifest.deploy b/manifest.deploy index 5267575..5cabcfc 100644 --- a/manifest.deploy +++ b/manifest.deploy @@ -1,6 +1,6 @@ { "name": "BibleZ", - "version": "1.3.7", + "version": "1.3.8", "description": "BibleZ is an easy to use offline bible reader app for your FirefoxOS device! Enjoy the full bible at your fingertips. <b>Features:</b> <ul><li>many available bibles in different languages (e.g. ESV, KJV, NET (free version), ...)</li><li>notes</li><li>bookmarks</li><li>highlights</li><li>history of last read scriptures</li><li>no internet connection required (only for downloading modules)</li></ul> 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 <a href:mailto:info@zefanjas.de>info@zefanjas.de</a>!", "launch_path": "/index.html", "icons": { diff --git a/manifest.desktop b/manifest.desktop index 371d417..921c143 100644 --- a/manifest.desktop +++ b/manifest.desktop @@ -1,6 +1,6 @@ { "name": "BibleZ", - "version": "1.3.7", + "version": "1.3.8", "description": "BibleZ is an easy to use offline bible reader app for your Firefox! Enjoy the full bible at your fingertips. <b>Features:</b> <ul><li>many available bibles in different languages (e.g. ESV, KJV, NET (free version), ...)</li><li>notes</li><li>bookmarks</li><li>highlights</li><li>history of last read scriptures</li><li>no internet connection required (only for downloading modules)</li></ul> 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 <a href:mailto:info@zefanjas.de>info@zefanjas.de</a>!", "launch_path": "/biblez-ng/app/index.html", "icons": { diff --git a/source/App.css b/source/App.css index 5a00f80..ac0295d 100644 --- a/source/App.css +++ b/source/App.css @@ -335,6 +335,10 @@ h3, h1 { font-size: 0.9em; } +.color-button { + margin: 0 3px; +} + .main-toolbar { padding: 5px; } diff --git a/source/api.js b/source/api.js index 1979199..fc5075e 100644 --- a/source/api.js +++ b/source/api.js @@ -500,5 +500,9 @@ var api = { } } return newArray; + }, + + escapeRegExp: function (str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); } };
\ No newline at end of file diff --git a/source/dataView.js b/source/dataView.js index e64bd43..1c328f8 100644 --- a/source/dataView.js +++ b/source/dataView.js @@ -23,9 +23,16 @@ enyo.kind({ {name: "noData", classes: "center", style: "margin-top: 10px;", showing: false}, {name: "dataList", kind: "AroundList", fit: true, onSetupItem: "setupItem", aboveComponents: [ {kind: "onyx.Toolbar", layoutKind: "FittableColumnsLayout", components: [ - {kind: "onyx.InputDecorator", fit: true, noStretch: true, layoutKind: "FittableColumnsLayout", components: [ - {kind: "onyx.Input", placeholder: $L("Search..."), fit: true, oninput: "searchInputChange"}, + {name: "searchField", kind: "onyx.InputDecorator", fit: true, noStretch: true, layoutKind: "FittableColumnsLayout", components: [ + {kind: "onyx.Input", name: "searchInput", placeholder: $L("Search..."), fit: true, oninput: "searchInputChange"}, {kind: "Image", src: "assets/search-input.png", style: "height: 20px; width: 20px;"} + ]}, + {name: "colorSelector", showing: false, kind: "Group", classes: "center", style: "width: 100%;", defaultKind: "onyx.Button", highlander: false, components: [ + {caption: " ", ontap: "searchHighlights", classes: "color-button", color: "rgba(255,99,71,0.5)", style: "background-color: red;"}, + {caption: " ", ontap: "searchHighlights", classes: "color-button", color: "rgba(255,255,0,0.5)", style: "background-color: yellow;"}, + {caption: " ", ontap: "searchHighlights", classes: "color-button", color: "rgba(152,251,152,0.5)", style: "background-color: green;"}, + {caption: " ", ontap: "searchHighlights", classes: "color-button", color: "rgba(238,130,238,0.5)", style: "background-color: violet;"}, + {caption: " ", ontap: "searchHighlights", classes: "color-button", color: "rgba(255,165,0,0.5)", style: "background-color: orange;"} ]} ]}, ], components: [ @@ -61,30 +68,44 @@ enyo.kind({ sectionChanged: function (inSender, inEvent) { this.filter = null; + //this.$.searchInput.setValue(""); if (this.section === "bookmarks") { this.$.rbBm.setActive(true); + this.$.searchField.show(); + this.$.colorSelector.hide(); api.getAllBookmarks(enyo.bind(this, function (inError, inData) { if(!inError) { this.data = inData; - this.updateList(); + if(this.$.searchInput.getValue() !== "") + this.searchInputChange(this.$.searchInput); + else + this.updateList(); } else this.handleError(inError); })); } else if (this.section === "notes") { this.$.rbNotes.setActive(true); + this.$.searchField.show(); + this.$.colorSelector.hide(); api.getAllNotes(enyo.bind(this, function (inError, inData) { if(!inError) { this.data = inData; - this.updateList(); + if(this.$.searchInput.getValue() !== "") + this.searchInputChange(this.$.searchInput); + else + this.updateList(); } else this.handleError(inError); })); } else if (this.section === "highlights") { this.$.rbHl.setActive(true); + this.$.searchField.hide(); + this.$.colorSelector.show(); api.getAllHighlights(enyo.bind(this, function (inError, inData) { if(!inError) { this.data = inData; this.updateList(); + this.searchHighlights(); } else this.handleError(inError); })); @@ -138,6 +159,23 @@ enyo.kind({ return true; }, + searchHighlights: function (inSender, inEvent) { + var filter = ""; + if (inSender) { + inSender.addRemoveClass("active", !inSender.hasClass("active")); + if (!inSender.hasClass("active")) { + inSender.active = false; + } + } + + var c = this.$.colorSelector.getClientControls(); + c.forEach(function(item) { + if(item.active) + filter += (filter === "") ? api.escapeRegExp(item.color) : "|" + api.escapeRegExp(item.color); + }); + this.filterList(filter); + }, + filterList: function(inFilter) { if (inFilter != this.filter) { this.filter = inFilter; @@ -150,7 +188,7 @@ enyo.kind({ var re = new RegExp(inFilter, "i"); var r = []; for (var i=0, d; (d=this.data[i]); i++) { - if (d.osisRef.match(re) || api.formatOsis(d.osisRef).match(re) || (d.text && d.text.match(re))) { + if (d.osisRef.match(re) || api.formatOsis(d.osisRef).match(re) || (d.text && d.text.match(re)) || (d.color && d.color.match(re))) { r.push(d); } } |