Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
green1052 committed Nov 10, 2024
1 parent 8b43398 commit c90b253
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "betternovelpia",
"version": "10.7.4",
"version": "10.7.5",
"scripts": {
"preinstall": "npx only-allow pnpm",
"build": "webpack --config webpack.prod.js",
Expand Down
2 changes: 1 addition & 1 deletion src/module/Bookmark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function Bookmark() {
bookmarkList.current?.scroll(0, scrollTop);
}, [scrollTop]);

useEffect(() => appendSide("ion-bookmark", "북마크", () => setHide(false)), []);
useEffect(() => appendSide("북마크", () => setHide(false)), []);

const deleteBookmark = useCallback((url: string) => {
setScrollTop(bookmarkList.current?.scrollTop ?? 0);
Expand Down
2 changes: 1 addition & 1 deletion src/module/Setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function Setting() {
forceUpdate();
}, []);

useEffect(() => appendSide("ion-ios-gear", "설정", () => setHide(false)), []);
useEffect(() => appendSide("설정", () => setHide(false)), []);

const MainDiv = styled.div`
overflow: auto;
Expand Down
2 changes: 1 addition & 1 deletion src/module/debug/Eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
}
},
start() {
appendSide("ion-settings", "eval", () => {
appendSide("eval", () => {
const code = prompt("code: ");

if (!code)
Expand Down
25 changes: 6 additions & 19 deletions src/util/AppendSide.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
import $ from "cash-dom";
import {SIDE_LEFT} from "./Selectors";
import {Cash} from "cash-dom/dist/cash";

let isFirst = true;
let $SideMenu: Cash;

export function appendSide(icon: string, title: string, onclick: () => void | Promise<void>) {
const $Code =
$(`<li class="new-list-style"><span style=width:20px;display:inline-block;text-align:center><i class="icon ${icon}"></i></span>${title}</li>`).on("click", onclick);

const $Logout = $(`.am-sideright span[onclick*="/proc/logout"]`);

if (!$Logout.length) {
const $SideLeft = $(SIDE_LEFT);

if (isFirst) {
isFirst = false;
$SideLeft.append(`<hr class="category-line">`);
}

$SideLeft.append($Code);
return;
}
export function appendSide(title: string, onclick: () => void | Promise<void>) {
const $Code = $(`<p>${title}</p>`).on("click", onclick);

if (isFirst) {
isFirst = false;
$(`<hr class="category-line">`).insertBefore($Logout.parent());
$SideMenu = $("<div class=sidemenu-service><p class=sidemenu-link-title>BetterNovelpia<div class=sidemenu-link-grid></div></div>").insertAfter(SIDE_LEFT);
}

$Code.insertBefore($Logout.parent());
$SideMenu.find(".sidemenu-link-grid").append($Code);
}
2 changes: 1 addition & 1 deletion src/util/Selectors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const SIDE_LEFT = ".am-sideleft ul";
export const SIDE_LEFT = "#m-sidemenu .sidemenu-support";

export const HEADER_BAR = "#header_bar";

Expand Down

0 comments on commit c90b253

Please sign in to comment.