diff options
author | zefanja <zefanja@freenet.de> | 2014-04-14 20:57:56 +0700 |
---|---|---|
committer | zefanja <zefanja@freenet.de> | 2014-04-14 20:57:56 +0700 |
commit | b886231b2bf0489830f76501445d2f815d9464c8 (patch) | |
tree | cc05e4f3c92c57a5e2d5263e225883e39e3805f3 | |
parent | 340e447622aed8547b0aa07ceda66b99b1aa7230 (diff) | |
download | biblez-ng-b886231b2bf0489830f76501445d2f815d9464c8.tar.gz |
* updated bcSelector because of API change in sword.js
* fixed bug, when scrolling stops
m--------- | lib/sword | 0 | ||||
-rw-r--r-- | source/bcSelector.js | 24 | ||||
-rw-r--r-- | source/main.js | 9 |
3 files changed, 23 insertions, 10 deletions
diff --git a/lib/sword b/lib/sword -Subproject 7cf04394ee831a1b8597ef1ea55830453719671 +Subproject 3f7f5215b5c45f0171b17ae59663b0db9af198a 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; })); |