Former-commit-id: 1c84dfabb826073dd4223cdf075826f8c2271690
This commit is contained in:
troyeguo
2020-09-26 00:29:56 +08:00
parent f282eb9725
commit 6008bfb1c8
65 changed files with 476 additions and 180 deletions

View File

@@ -1,5 +1,4 @@
import OtherUtil from "./otherUtil";
import ReaderConfig from "./readerConfig";
let Hammer = (window as any).Hammer;
export const MouseEvent = (rendition: any) => {
@@ -94,16 +93,6 @@ export const MouseEvent = (rendition: any) => {
doc.addEventListener("mousewheel", mouseChrome, false);
}
};
const handleCursor = () => {
if (lock) return;
OtherUtil.setReaderConfig("isHideCursor", "yes");
ReaderConfig.addDefaultCss();
lock = true;
setTimeout(function () {
lock = false;
}, 500);
return false;
};
rendition.on("rendered", () => {
let iframe = document.getElementsByTagName("iframe")[0];
@@ -118,7 +107,6 @@ export const MouseEvent = (rendition: any) => {
gesture(event);
});
}
doc.addEventListener("mousemove", handleCursor);
// 鼠标滚轮翻页
window.addEventListener("keydown", arrowKeys);

View File

@@ -30,19 +30,7 @@ class readerConfig {
static getDefaultCss() {
let colors = ["#FBF1D1", "#EFEEB0", "#CAEFC9", "#76BEE9"];
let lines = ["#FF0000", "#000080", "#0000FF", "#2EFF2E"];
let css1 = `::selection{background:#f3a6a68c}::-moz-selection{background:#f3a6a68c}[class*=color-]:hover{cursor:pointer;background-image:linear-gradient(0,rgba(0,0,0,.075),rgba(0,0,0,.075))}.color-0{background-color:${
colors[0]
}}.color-1{background-color:${colors[1]}}.color-2{background-color:${
colors[2]
}}.color-3{background-color:${colors[3]}}.line-0{border-bottom:2px solid ${
lines[0]
}}.line-1{border-bottom:2px solid ${
lines[1]
}}.line-2{border-bottom:2px solid ${
lines[2]
}}.line-3{border-bottom:2px solid ${lines[3]}}*{cursor:${
OtherUtil.getReaderConfig("isHideCursor") === "yes" ? "none" : ""
}}`;
let css1 = `::selection{background:#f3a6a68c}::-moz-selection{background:#f3a6a68c}[class*=color-]:hover{cursor:pointer;background-image:linear-gradient(0,rgba(0,0,0,.075),rgba(0,0,0,.075))}.color-0{background-color:${colors[0]}}.color-1{background-color:${colors[1]}}.color-2{background-color:${colors[2]}}.color-3{background-color:${colors[3]}}.line-0{border-bottom:2px solid ${lines[0]}}.line-1{border-bottom:2px solid ${lines[1]}}.line-2{border-bottom:2px solid ${lines[2]}}.line-3{border-bottom:2px solid ${lines[3]}}}`;
return css1;
}
@@ -133,8 +121,8 @@ export const config = {
: "http://localhost:3000",
token_url:
process.env.NODE_ENV === "production"
? "https://koodo.960960.xyz"
: "http://localhost:3001",
? "http://localhost:3366"
: "http://localhost:3366",
dropbox_client_id: "e3zgg310xbizvaf",
googledrive_client_id:
"99440516227-ifr1ann33f2j610i3ri17ej0i51c7m6e.apps.googleusercontent.com",

View File

@@ -27,7 +27,7 @@ class ShelfUtil {
let json = localStorage.getItem("shelfList");
let obj = JSON.parse(json!) || defaultShelf;
let shelfTitle = Object.keys(obj);
let currentShelfTitle = shelfTitle[shelfIndex + 1];
let currentShelfTitle = shelfTitle[shelfIndex];
let index = obj[currentShelfTitle].indexOf(bookKey);
obj[currentShelfTitle].splice(index, 1);
localStorage.setItem("shelfList", JSON.stringify(obj));
@@ -45,10 +45,10 @@ class ShelfUtil {
});
localStorage.setItem("shelfList", JSON.stringify(obj));
}
static removeShelf() {
static removeShelf(shelfTitle: string) {
let json = localStorage.getItem("shelfList");
let obj = JSON.parse(json!) || defaultShelf;
delete obj.shelfTitle;
delete obj[shelfTitle];
localStorage.setItem("shelfList", JSON.stringify(obj));
}
}