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