|
|
|
@ -298,7 +298,6 @@ function loadFromArrayBuffer(ab) {
|
|
|
|
|
</a> \
|
|
|
|
|
</li>"
|
|
|
|
|
);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
var percentage = (ab.page+1) / (ab.last+1);
|
|
|
|
|
totalImages = ab.last+1;
|
|
|
|
@ -339,10 +338,21 @@ function setImage(url) {
|
|
|
|
|
updateScale(true);
|
|
|
|
|
canvas.width = innerWidth - 100;
|
|
|
|
|
canvas.height = 200;
|
|
|
|
|
x.fillStyle = "red";
|
|
|
|
|
x.font = "50px sans-serif";
|
|
|
|
|
x.fillStyle = "black";
|
|
|
|
|
x.textAlign="center";
|
|
|
|
|
x.font = "24px sans-serif";
|
|
|
|
|
x.strokeStyle = "black";
|
|
|
|
|
x.fillText("Loading Page #" + (currentImage + 1), innerWidth/2, 100);
|
|
|
|
|
} else {
|
|
|
|
|
if (url === "error") {
|
|
|
|
|
updateScale(true);
|
|
|
|
|
canvas.width = innerWidth - 100;
|
|
|
|
|
canvas.height = 200;
|
|
|
|
|
x.fillStyle = "black";
|
|
|
|
|
x.textAlign="center";
|
|
|
|
|
x.font = "24px sans-serif";
|
|
|
|
|
x.strokeStyle = "black";
|
|
|
|
|
x.fillText("Loading Page #" + (currentImage + 1), 100, 100);
|
|
|
|
|
x.fillText("Unable to decompress image #" + (currentImage + 1), innerWidth/2, 100);
|
|
|
|
|
} else {
|
|
|
|
|
if ($("body").css("scrollHeight") / innerHeight > 1) {
|
|
|
|
|
$("body").css("overflowY", "scroll");
|
|
|
|
@ -353,13 +363,13 @@ function setImage(url) {
|
|
|
|
|
canvas.width = innerWidth - 100;
|
|
|
|
|
canvas.height = 300;
|
|
|
|
|
updateScale(true);
|
|
|
|
|
x.fillStyle = "orange";
|
|
|
|
|
x.fillStyle = "black";
|
|
|
|
|
x.font = "50px sans-serif";
|
|
|
|
|
x.strokeStyle = "black";
|
|
|
|
|
x.fillText("Page #" + (currentImage + 1) + " (" +
|
|
|
|
|
imageFiles[currentImage].filename + ")", 100, 100);
|
|
|
|
|
x.fillStyle = "red";
|
|
|
|
|
x.fillText("Is corrupt or not an image", 100, 200);
|
|
|
|
|
imageFiles[currentImage].filename + ")", innerWidth/2, 100);
|
|
|
|
|
x.fillStyle = "black";
|
|
|
|
|
x.fillText("Is corrupt or not an image", innerWidth/2, 200);
|
|
|
|
|
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
if (/(html|htm)$/.test(imageFiles[currentImage].filename)) {
|
|
|
|
@ -415,6 +425,7 @@ function setImage(url) {
|
|
|
|
|
};
|
|
|
|
|
img.src = url;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showPrevPage() {
|
|
|
|
@ -528,6 +539,12 @@ function keyHandler(evt) {
|
|
|
|
|
|
|
|
|
|
function ImageLoadCallback(event) {
|
|
|
|
|
var jso=this.response;
|
|
|
|
|
// Unable to decompress file, or no response from server
|
|
|
|
|
if (jso === null){
|
|
|
|
|
setImage("error");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (jso.page !== jso.last)
|
|
|
|
|
{
|
|
|
|
|
// var secRequest = new XMLHttpRequest();
|
|
|
|
@ -541,6 +558,7 @@ function ImageLoadCallback(event) {
|
|
|
|
|
console.log('Transfer done in ' + diff + 's');
|
|
|
|
|
}
|
|
|
|
|
loadFromArrayBuffer(jso);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function init(fileid) {
|
|
|
|
|
start = (new Date).getTime();
|
|
|
|
|