1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +02:00

Break out of restore loop and check for null

This commit is contained in:
Fred Chasen 2014-01-02 21:12:51 -08:00
parent e4be17a428
commit c17e707ec4
6 changed files with 26 additions and 18 deletions

View file

@ -2223,14 +2223,18 @@ EPUBJS.Book.prototype.restore = function(identifier){
if(this.settings.clearSaved) reject = true;
if(!reject && fromStore != 'undefined' && fromStore != 'null'){
this.contents = JSON.parse(fromStore);
fetch.forEach(function(item){
book[item] = book.contents[item];
if(!book[item]) {
if(!reject && fromStore != 'undefined' && fromStore != null){
book.contents = JSON.parse(fromStore);
for(var i = 0, len = fetch.length; i < len; i++) {
var item = fetch[i];
if(!book.contents[item]) {
reject = true;
break;
}
});
book[item] = book.contents[item];
}
}
if(reject || !fromStore || !this.contents || !this.settings.contentsPath){

2
build/epub.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -21,7 +21,7 @@
document.onreadystatechange = function () {
if (document.readyState == "complete") {
EPUBJS.VERSION = "0.1.6";
EPUBJS.VERSION = "0.1.7";
EPUBJS.filePath = "js/libs/";
EPUBJS.cssPath = "css/";
@ -125,7 +125,7 @@
<div id="viewer"></div>
<div id="next" class="arrow"></div>
<div id="loader"><img src="../demo/img/loader.gif"></div>
<div id="loader"><img src="img/loader.gif"></div>
</div>
<div class="modal md-effect-1" id="settings-modal">
<div class="md-content">

View file

@ -21,7 +21,7 @@
document.onreadystatechange = function () {
if (document.readyState == "complete") {
EPUBJS.VERSION = "0.1.6";
EPUBJS.VERSION = "0.1.7";
EPUBJS.filePath = "js/libs/";
EPUBJS.cssPath = "css/";
@ -92,7 +92,7 @@
<div id="viewer"></div>
<div id="next" class="arrow"></div>
<div id="loader"><img src="../demo/img/loader.gif"></div>
<div id="loader"><img src="img/loader.gif"></div>
</div>
<div class="modal md-effect-1" id="settings-modal">
<div class="md-content">

2
demo/js/epub.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -450,14 +450,18 @@ EPUBJS.Book.prototype.restore = function(identifier){
if(this.settings.clearSaved) reject = true;
if(!reject && fromStore != 'undefined' && fromStore != 'null'){
this.contents = JSON.parse(fromStore);
fetch.forEach(function(item){
book[item] = book.contents[item];
if(!book[item]) {
if(!reject && fromStore != 'undefined' && fromStore != null){
book.contents = JSON.parse(fromStore);
for(var i = 0, len = fetch.length; i < len; i++) {
var item = fetch[i];
if(!book.contents[item]) {
reject = true;
break;
}
});
book[item] = book.contents[item];
}
}
if(reject || !fromStore || !this.contents || !this.settings.contentsPath){