mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-25 02:57:22 +00:00
Code cosmetics
This commit is contained in:
parent
0405cec4ac
commit
a6dfcedfdb
@ -78,8 +78,9 @@ kthoom.saveSettings = function() {
|
||||
|
||||
kthoom.loadSettings = function() {
|
||||
try {
|
||||
if (localStorage.kthoomSettings.length < 10)
|
||||
if (localStorage.kthoomSettings.length < 10){
|
||||
return;
|
||||
}
|
||||
var s = JSON.parse(localStorage.kthoomSettings);
|
||||
kthoom.rotateTimes = s.rotateTimes;
|
||||
hflip = s.hflip;
|
||||
@ -111,13 +112,13 @@ var createURLFromArray = function(array, mimeType) {
|
||||
throw "Browser support for Blobs is missing.";
|
||||
}
|
||||
|
||||
if ((typeof URL !== "function" && typeof URL != "object") ||
|
||||
if ((typeof URL !== "function" && typeof URL !== "object") ||
|
||||
typeof URL.createObjectURL !== "function") {
|
||||
throw "Browser support for Object URLs is missing";
|
||||
}
|
||||
|
||||
return URL.createObjectURL(blob);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Stores an image filename and its data: URI.
|
||||
@ -301,7 +302,7 @@ function loadFromArrayBuffer(ab) {
|
||||
}
|
||||
}
|
||||
// display first page if we haven't yet
|
||||
if (imageFiles.length == currentImage + 1) {
|
||||
if (imageFiles.length === currentImage + 1) {
|
||||
updatePage();
|
||||
}
|
||||
});
|
||||
@ -323,7 +324,7 @@ function updatePage() {
|
||||
title.appendChild(document.createTextNode( (currentImage + 1 ) + "/" + totalImages ));
|
||||
|
||||
getElem("meter2").setAttribute("width",
|
||||
100 * (totalImages == 0 ? 0 : ((currentImage +1 ) / totalImages)) + "%");
|
||||
100 * (totalImages === 0 ? 0 : ((currentImage + 1 ) / totalImages)) + "%");
|
||||
if (imageFiles[currentImage]) {
|
||||
setImage(imageFiles[currentImage].dataURI);
|
||||
} else {
|
||||
@ -386,7 +387,10 @@ function setImage(url) {
|
||||
sh = h;
|
||||
kthoom.rotateTimes = (4 + kthoom.rotateTimes) % 4;
|
||||
x.save();
|
||||
if (kthoom.rotateTimes % 2 == 1) { sh = w; sw = h;}
|
||||
if (kthoom.rotateTimes % 2 === 1) {
|
||||
sh = w;
|
||||
sw = h;
|
||||
}
|
||||
canvas.height = sh;
|
||||
canvas.width = sw;
|
||||
x.translate(sw / 2, sh / 2);
|
||||
@ -444,13 +448,13 @@ function updateScale(clear) {
|
||||
if (!/main/.test(getElem("titlebar").className)) {
|
||||
maxheight -= 25;
|
||||
}
|
||||
if (clear || fitMode == kthoom.Key.N) {
|
||||
} else if (fitMode == kthoom.Key.B) {
|
||||
if (clear || fitMode === kthoom.Key.N) {
|
||||
} else if (fitMode === kthoom.Key.B) {
|
||||
mainImageStyle.maxWidth = "100%";
|
||||
mainImageStyle.maxHeight = maxheight + "px";
|
||||
} else if (fitMode == kthoom.Key.H) {
|
||||
} else if (fitMode === kthoom.Key.H) {
|
||||
mainImageStyle.height = maxheight + "px";
|
||||
} else if (fitMode == kthoom.Key.W) {
|
||||
} else if (fitMode === kthoom.Key.W) {
|
||||
mainImageStyle.width = "100%";
|
||||
}
|
||||
kthoom.saveSettings();
|
||||
@ -459,8 +463,9 @@ function updateScale(clear) {
|
||||
function keyHandler(evt) {
|
||||
var code = evt.keyCode;
|
||||
|
||||
if ($("#progress").css("display") == "none")
|
||||
if ($("#progress").css("display") === "none"){
|
||||
return;
|
||||
}
|
||||
canKeyNext = (($("body").css("offsetWidth") + $("body").css("scrollLeft")) / $("body").css("scrollWidth")) >= 1;
|
||||
canKeyPrev = (scrollX <= 0);
|
||||
|
||||
@ -489,10 +494,10 @@ function keyHandler(evt) {
|
||||
case kthoom.Key.F:
|
||||
if (!hflip && !vflip) {
|
||||
hflip = true;
|
||||
} else if(hflip == true) {
|
||||
} else if (hflip === true) {
|
||||
vflip = true;
|
||||
hflip = false;
|
||||
} else if(vflip == true) {
|
||||
} else if (vflip === true) {
|
||||
vflip = false;
|
||||
}
|
||||
updatePage();
|
||||
|
Loading…
Reference in New Issue
Block a user