mirror of
https://github.com/janeczku/calibre-web.git
synced 2024-11-26 08:51:05 +02:00
Code cosmetics
This commit is contained in:
parent
85068d75bf
commit
5b9b36f997
@ -227,8 +227,6 @@ kthoom.setProgressMeter = function(pct, opt_label) {
|
|||||||
labelText = opt_label + ' ' + labelText;
|
labelText = opt_label + ' ' + labelText;
|
||||||
}
|
}
|
||||||
title.appendChild(document.createTextNode(labelText));
|
title.appendChild(document.createTextNode(labelText));
|
||||||
// fade it out as it approaches finish
|
|
||||||
//title.setAttribute('fill-opacity', (pct > 90) ? ((100-pct)*5)/100 : 1);
|
|
||||||
|
|
||||||
getElem('meter2').setAttribute('width',
|
getElem('meter2').setAttribute('width',
|
||||||
100 * (totalImages == 0 ? 0 : ((currentImage+1)/totalImages)) + '%');
|
100 * (totalImages == 0 ? 0 : ((currentImage+1)/totalImages)) + '%');
|
||||||
@ -276,7 +274,6 @@ function loadFromArrayBuffer(ab) {
|
|||||||
imageFiles.push(new kthoom.ImageFile(f));
|
imageFiles.push(new kthoom.ImageFile(f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// display first page if we haven't yet
|
// display first page if we haven't yet
|
||||||
if (imageFiles.length == currentImage + 1) {
|
if (imageFiles.length == currentImage + 1) {
|
||||||
updatePage();
|
updatePage();
|
||||||
@ -286,7 +283,7 @@ function loadFromArrayBuffer(ab) {
|
|||||||
function(e) {
|
function(e) {
|
||||||
var diff = ((new Date).getTime() - start)/1000;
|
var diff = ((new Date).getTime() - start)/1000;
|
||||||
console.log('Unarchiving done in ' + diff + 's');
|
console.log('Unarchiving done in ' + diff + 's');
|
||||||
})
|
});
|
||||||
unarchiver.start();
|
unarchiver.start();
|
||||||
} else {
|
} else {
|
||||||
alert('Some error');
|
alert('Some error');
|
||||||
@ -417,7 +414,7 @@ function setImage(url) {
|
|||||||
x.restore();
|
x.restore();
|
||||||
};
|
};
|
||||||
img.src = url;
|
img.src = url;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showPrevPage() {
|
function showPrevPage() {
|
||||||
@ -434,7 +431,6 @@ function showPrevPage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePage();
|
updatePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,7 +448,6 @@ function showNextPage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePage();
|
updatePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,7 +554,6 @@ function init(filename) {
|
|||||||
request.send();
|
request.send();
|
||||||
kthoom.initProgressMeter();
|
kthoom.initProgressMeter();
|
||||||
document.body.className += /AppleWebKit/.test(navigator.userAgent) ? ' webkit' : '';
|
document.body.className += /AppleWebKit/.test(navigator.userAgent) ? ' webkit' : '';
|
||||||
//kthoom.resetFileUploader();
|
|
||||||
kthoom.loadSettings();
|
kthoom.loadSettings();
|
||||||
$(document).keydown(keyHandler);
|
$(document).keydown(keyHandler);
|
||||||
|
|
||||||
|
@ -367,7 +367,6 @@ function RarDecodeNumber(bstream, dec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function RarMakeDecodeTables(BitLength, offset, dec, size) {
|
function RarMakeDecodeTables(BitLength, offset, dec, size) {
|
||||||
var DecodeLen = dec.DecodeLen, DecodePos = dec.DecodePos, DecodeNum = dec.DecodeNum;
|
var DecodeLen = dec.DecodeLen, DecodePos = dec.DecodePos, DecodeNum = dec.DecodeNum;
|
||||||
var LenCount = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
var LenCount = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||||
@ -394,7 +393,6 @@ function RarMakeDecodeTables(BitLength, offset, dec, size) {
|
|||||||
for (I = 0; I < size; ++I)
|
for (I = 0; I < size; ++I)
|
||||||
if (BitLength[I + offset] != 0)
|
if (BitLength[I + offset] != 0)
|
||||||
DecodeNum[ TmpPos[ BitLength[offset + I] & 0xF ]++] = I;
|
DecodeNum[ TmpPos[ BitLength[offset + I] & 0xF ]++] = I;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
@ -473,7 +471,6 @@ function Unpack20(bstream, Solid) {
|
|||||||
RarCopyString(2, Distance);
|
RarCopyString(2, Distance);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
RarUpdateProgress()
|
RarUpdateProgress()
|
||||||
}
|
}
|
||||||
@ -620,7 +617,6 @@ function Unpack29(bstream, Solid) {
|
|||||||
}
|
}
|
||||||
if (num == 256) {
|
if (num == 256) {
|
||||||
if (!RarReadEndOfBlock(bstream)) break;
|
if (!RarReadEndOfBlock(bstream)) break;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (num == 257) {
|
if (num == 257) {
|
||||||
@ -662,7 +658,6 @@ function Unpack29(bstream, Solid) {
|
|||||||
RarCopyString(2, Distance);
|
RarCopyString(2, Distance);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
RarUpdateProgress()
|
RarUpdateProgress()
|
||||||
}
|
}
|
||||||
@ -671,7 +666,6 @@ function RarReadEndOfBlock(bstream) {
|
|||||||
|
|
||||||
RarUpdateProgress()
|
RarUpdateProgress()
|
||||||
|
|
||||||
|
|
||||||
var NewTable = false, NewFile = false;
|
var NewTable = false, NewFile = false;
|
||||||
if (bstream.readBits(1)) {
|
if (bstream.readBits(1)) {
|
||||||
NewTable = true;
|
NewTable = true;
|
||||||
@ -728,14 +722,12 @@ function RarCopyString(length, distance) {
|
|||||||
}
|
}
|
||||||
//TODO: lets hope that it never needs to read beyond file boundaries
|
//TODO: lets hope that it never needs to read beyond file boundaries
|
||||||
while(length--) rBuffer.insertByte(rOldBuffers[l].data[destPtr++]);
|
while(length--) rBuffer.insertByte(rOldBuffers[l].data[destPtr++]);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (length > distance) {
|
if (length > distance) {
|
||||||
while(length--) rBuffer.insertByte(rBuffer.data[destPtr++]);
|
while(length--) rBuffer.insertByte(rBuffer.data[destPtr++]);
|
||||||
} else {
|
} else {
|
||||||
rBuffer.insertBytes(rBuffer.data.subarray(destPtr, destPtr + length));
|
rBuffer.insertBytes(rBuffer.data.subarray(destPtr, destPtr + length));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var rOldBuffers = []
|
var rOldBuffers = []
|
||||||
@ -828,14 +820,14 @@ var unrar = function(arrayBuffer) {
|
|||||||
if (header.crc == 0x6152 &&
|
if (header.crc == 0x6152 &&
|
||||||
header.headType == 0x72 &&
|
header.headType == 0x72 &&
|
||||||
header.flags.value == 0x1A21 &&
|
header.flags.value == 0x1A21 &&
|
||||||
header.headSize == 7) {
|
header.headSize == 7)
|
||||||
|
{
|
||||||
info("Found RAR signature");
|
info("Found RAR signature");
|
||||||
|
|
||||||
var mhead = new RarVolumeHeader(bstream);
|
var mhead = new RarVolumeHeader(bstream);
|
||||||
if (mhead.headType != MAIN_HEAD) {
|
if (mhead.headType != MAIN_HEAD) {
|
||||||
info("Error! RAR did not include a MAIN_HEAD header");
|
info("Error! RAR did not include a MAIN_HEAD header");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
var localFiles = [],
|
var localFiles = [],
|
||||||
localFile = null;
|
localFile = null;
|
||||||
do {
|
do {
|
||||||
|
Loading…
Reference in New Issue
Block a user