diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/bcSelector.js | 24 | ||||
-rw-r--r-- | source/main.js | 9 |
2 files changed, 23 insertions, 10 deletions
diff --git a/source/bcSelector.js b/source/bcSelector.js index 4659687..5ad4828 100644 --- a/source/bcSelector.js +++ b/source/bcSelector.js @@ -52,20 +52,28 @@ enyo.kind({ }, moduleChanged: function (inSender, inEvent) { - this.books = this.module.getAllBooks(); - this.$.bookRepeater.setCount(this.books.length); + this.module.getAllBooks(enyo.bind(this, function (inError, inResult) { + if(!inError) { + this.books = inResult; + this.$.bookRepeater.setCount(this.books.length); + } else { + console.log("getAllBooks", inError); + } + })); }, setBookItems: function (inSender, inEvent) { - if (inEvent.index === 39) { - inEvent.item.$.bookItem.addStyles("clear: both;"); + var item = inEvent.item, + idx = inEvent.index; + if (this.books[idx].bookNum === 39) { + item.$.bookItem.addStyles("clear: both;"); } - if (inEvent.index >= 39) { - inEvent.item.$.bookItem.addClass("books-nt"); + if (this.books[idx].bookNum >= 39) { + item.$.bookItem.addClass("books-nt"); } else { - inEvent.item.$.bookItem.addClass("books-ot"); + item.$.bookItem.addClass("books-ot"); } - inEvent.item.$.bookItem.setContent(this.books[inEvent.index].abbrev.slice(0,4)); + item.$.bookItem.setContent(this.books[idx].abbrev.slice(0,4)); }, handleBook: function (inSender, inEvent) { diff --git a/source/main.js b/source/main.js index 9e5ff6f..be3241e 100644 --- a/source/main.js +++ b/source/main.js @@ -613,6 +613,7 @@ enyo.kind({ //handling infinite scrolling handleScrolling: function (inSender, inEvent) { + //FIXME implement enyo.job handling scrolling if(this.verses.length !== 0) { var b = inEvent.scrollBounds; var cHeight = b.clientHeight, @@ -632,13 +633,17 @@ enyo.kind({ if(!this.reachedBottom && cHeight + top > height - 200/* && yDir === 1*/) { this.reachedBottom = true; - //console.log("BOTTOM"); + enyo.job("updateBottom", this.bindSafely(function () { + this.reachedBottom = false; + }), 2000); this.addText(true, enyo.bind(this, function () { this.reachedBottom = false; })); } else if (!this.reachedTop && top < 30/* && yDir === -1*/) { this.reachedTop = true; - //console.log("TOP"); + enyo.job("updateTop", this.bindSafely(function () { + this.reachedTop = false; + }), 2000); this.addText(false, enyo.bind(this, function () { this.reachedTop = false; })); |