mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
setup parsing book, new styles
This commit is contained in:
parent
79ebd15c72
commit
06d1f95b67
195 changed files with 6543 additions and 1921 deletions
|
@ -1,71 +0,0 @@
|
|||
FP.namespace('book').page = (function($){
|
||||
var _bookPages,
|
||||
_ordered,
|
||||
_$el,
|
||||
_currentPage = 0,
|
||||
_images;
|
||||
|
||||
function start($el, pages, order){
|
||||
_$el = $el;
|
||||
_bookPages = pages;
|
||||
_ordered = order;
|
||||
|
||||
_ordered.sort(function(a, b) {
|
||||
var textA = a.toUpperCase();
|
||||
var textB = b.toUpperCase();
|
||||
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
|
||||
});
|
||||
|
||||
loadIn(0)
|
||||
}
|
||||
|
||||
function loadIn(pageNum){
|
||||
var page;
|
||||
|
||||
_currentPage = pageNum;
|
||||
page = _bookPages[_ordered[_currentPage]];
|
||||
|
||||
_$el.html(page);
|
||||
|
||||
if(_images){
|
||||
scanImages();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function next(){
|
||||
if(_currentPage <= _ordered.length){
|
||||
loadIn(_currentPage+1);
|
||||
}
|
||||
}
|
||||
|
||||
function prev(){
|
||||
if(_currentPage > 0){
|
||||
loadIn(_currentPage-1);
|
||||
}
|
||||
}
|
||||
|
||||
function setImages(images){
|
||||
_images = images;
|
||||
//scanImages();
|
||||
}
|
||||
|
||||
function scanImages(){
|
||||
_$el.find("img").each(function(){
|
||||
var $this = $(this),
|
||||
src = $this.attr("src");
|
||||
|
||||
$this.attr("src", _images[src]);
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
"start" : start,
|
||||
"loadIn" : loadIn,
|
||||
"prev" : prev,
|
||||
"next" : next,
|
||||
"setImages": setImages
|
||||
};
|
||||
})(jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue