mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
added storage and chapters
This commit is contained in:
parent
a6a8661b74
commit
ca3e2c24c2
32 changed files with 2421 additions and 256 deletions
|
@ -14,38 +14,96 @@ FP.core.loadXML = function(url, callback){
|
|||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url, true);
|
||||
xhr.overrideMimeType('text/xml');
|
||||
|
||||
|
||||
xhr.onload = function(e) {
|
||||
if (this.status == 200) {
|
||||
callback(this.responseXML);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
FP.core.loadText = function(url, callback){
|
||||
// FP.core.loadFile = function(url){
|
||||
// var xhr = new XMLHttpRequest(),
|
||||
// succeeded,
|
||||
// failed;
|
||||
//
|
||||
// function _loaded(response){
|
||||
// console.log("response")
|
||||
// }
|
||||
//
|
||||
// function _error(err){
|
||||
// console.log("Error:", err);
|
||||
// }
|
||||
//
|
||||
// function start(){
|
||||
// //xhr.open('GET', url, true);
|
||||
// //xhr.responseType = 'blob';
|
||||
//
|
||||
// xhr.onload = function(e) {
|
||||
// if (this.status == 200) {
|
||||
// succeeded(this.response);
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// xhr.onerror = function(e) {
|
||||
// _error(this.status); //-- TODO: better error message
|
||||
// };
|
||||
//
|
||||
// //xhr.send();
|
||||
// console.log(succeeded)
|
||||
// }
|
||||
//
|
||||
// return {
|
||||
// "start": start,
|
||||
// "loaded" : succeeded,
|
||||
// "error" : failed
|
||||
// }
|
||||
// }
|
||||
|
||||
FP.core.loadFile = function(url, callback){
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url, true);
|
||||
//xhr.responseType = 'blob';
|
||||
|
||||
xhr.onload = function(e) {
|
||||
if (this.status == 200) {
|
||||
// Note: .response instead of .responseText
|
||||
//var blob = new Blob([this.response], {type: 'application/xhtml+xml'});
|
||||
//callback(blob);
|
||||
|
||||
callback(this.response);
|
||||
|
||||
|
||||
this.succeeded = function(response){
|
||||
if(callback){
|
||||
callback(response);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
xhr.send();
|
||||
this.failed = function(err){
|
||||
console.log("Error:", err);
|
||||
}
|
||||
|
||||
this.start = function(){
|
||||
var that = this;
|
||||
|
||||
xhr.open('GET', url, true);
|
||||
xhr.responseType = 'blob';
|
||||
|
||||
xhr.onload = function(e) {
|
||||
if (this.status == 200) {
|
||||
that.succeeded(this.response);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = function(e) {
|
||||
that.failed(this.status); //-- TODO: better error message
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
return {
|
||||
"start": this.start,
|
||||
"succeeded" : this.succeeded,
|
||||
"failed" : this.failed
|
||||
}
|
||||
}
|
||||
|
||||
FP.core.crossBrowserColumnCss = function(){
|
||||
//-- From Readium: reflowable_pagination_view.js
|
||||
|
||||
|
||||
var cssIfy = function(str) {
|
||||
return str.replace(/([A-Z])/g, function(str,m1){
|
||||
return '-' + m1.toLowerCase();
|
||||
|
@ -61,5 +119,5 @@ FP.core.crossBrowserColumnCss = function(){
|
|||
// FP.core.columnAxis = cssIfy(FP.core.columnAxis);
|
||||
// FP.core.columnGap = cssIfy(FP.core.columnGap);
|
||||
// FP.core.columnWidth = cssIfy(FP.core.columnWidth);
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue