今開いているページを非表示にするUserScript
たぶんbundleすれば使えるんじゃないかな(未検証)
code:js
import { disable } from "./mod.ts";
scrapbox.PageMenu.addItem({
title: () =>
Hide "${scrapbox.Page.title}",
onClick: async () => {
const project = scrapbox.Project.name;
const title = scrapbox.Page.title;
await disable(project, title);
alert(`Successfully disabled "/${
project
/}${title}"`);
},
});
code:mod.ts
import {
patch,
getProfile,
export async function disable(
project: string,
title: string,
) {
const profile = await getProfile();
if (!profile.isGuest) return;
const userName = profile.name;
await patch(project, userName, (lines) => [
...lines.map((line) => line.text),
"",
"code:style.css",
` [data-page-title="${
encodeTitleURI(title)
}"] {`,
" display: none;",
" }",
]);
}
UserScript.icon