Code cosmetics

pull/346/head
OzzieIsaacs 7 years ago
parent 85068d75bf
commit 5b9b36f997

@ -5,7 +5,7 @@
*
* Copyright(c) 2011 Google Inc.
* Copyright(c) 2011 antimatter15
*/
*/
/* Reference Documentation:
@ -227,8 +227,6 @@ kthoom.setProgressMeter = function(pct, opt_label) {
labelText = opt_label + ' ' + 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',
100 * (totalImages == 0 ? 0 : ((currentImage+1)/totalImages)) + '%');
@ -276,7 +274,6 @@ function loadFromArrayBuffer(ab) {
imageFiles.push(new kthoom.ImageFile(f));
}
}
// display first page if we haven't yet
if (imageFiles.length == currentImage + 1) {
updatePage();
@ -286,7 +283,7 @@ function loadFromArrayBuffer(ab) {
function(e) {
var diff = ((new Date).getTime() - start)/1000;
console.log('Unarchiving done in ' + diff + 's');
})
});
unarchiver.start();
} else {
alert('Some error');
@ -417,7 +414,7 @@ function setImage(url) {
x.restore();
};
img.src = url;
};
}
}
function showPrevPage() {
@ -434,7 +431,6 @@ function showPrevPage() {
return;
}
}
updatePage();
}
@ -452,7 +448,6 @@ function showNextPage() {
return;
}
}
updatePage();
}
@ -559,7 +554,6 @@ function init(filename) {
request.send();
kthoom.initProgressMeter();
document.body.className += /AppleWebKit/.test(navigator.userAgent) ? ' webkit' : '';
//kthoom.resetFileUploader();
kthoom.loadSettings();
$(document).keydown(keyHandler);

@ -113,12 +113,12 @@ var RarVolumeHeader = function(bstream) {
break;
default:
bstream.readBits(16);
}
}
// byte 6,7
this.headSize = bstream.readBits(16);
info(" headSize=" + this.headSize);
switch (this.headType) {
// byte 6,7
this.headSize = bstream.readBits(16);
info(" headSize=" + this.headSize);
switch (this.headType) {
case MAIN_HEAD:
this.highPosAv = bstream.readBits(16);
this.posAv = bstream.readBits(32);
@ -367,7 +367,6 @@ function RarDecodeNumber(bstream, dec) {
}
function RarMakeDecodeTables(BitLength, offset, dec, size) {
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],
@ -394,7 +393,6 @@ function RarMakeDecodeTables(BitLength, offset, dec, size) {
for (I = 0; I < size; ++I)
if (BitLength[I + offset] != 0)
DecodeNum[ TmpPos[ BitLength[offset + I] & 0xF ]++] = I;
}
// TODO: implement
@ -473,7 +471,6 @@ function Unpack20(bstream, Solid) {
RarCopyString(2, Distance);
continue;
}
}
RarUpdateProgress()
}
@ -620,7 +617,6 @@ function Unpack29(bstream, Solid) {
}
if (num == 256) {
if (!RarReadEndOfBlock(bstream)) break;
continue;
}
if (num == 257) {
@ -662,7 +658,6 @@ function Unpack29(bstream, Solid) {
RarCopyString(2, Distance);
continue;
}
}
RarUpdateProgress()
}
@ -671,7 +666,6 @@ function RarReadEndOfBlock(bstream) {
RarUpdateProgress()
var NewTable = false, NewFile = false;
if (bstream.readBits(1)) {
NewTable = true;
@ -728,14 +722,12 @@ function RarCopyString(length, distance) {
}
//TODO: lets hope that it never needs to read beyond file boundaries
while(length--) rBuffer.insertByte(rOldBuffers[l].data[destPtr++]);
}
if (length > distance) {
while(length--) rBuffer.insertByte(rBuffer.data[destPtr++]);
} else {
rBuffer.insertBytes(rBuffer.data.subarray(destPtr, destPtr + length));
}
}
var rOldBuffers = []
@ -828,14 +820,14 @@ var unrar = function(arrayBuffer) {
if (header.crc == 0x6152 &&
header.headType == 0x72 &&
header.flags.value == 0x1A21 &&
header.headSize == 7) {
header.headSize == 7)
{
info("Found RAR signature");
var mhead = new RarVolumeHeader(bstream);
if (mhead.headType != MAIN_HEAD) {
info("Error! RAR did not include a MAIN_HEAD header");
}
else {
} else {
var localFiles = [],
localFile = null;
do {

Loading…
Cancel
Save