ne-sachirou
https://gyazo.com/1da10a9426ec3d7a035b6c940d6843b3
this is ne-sachirou’s page
code:script.js
console.info("👒UserScript");
EventEmitter
code:script.js
console.info("👒log UserScript Events");
window.cosense.addListener("lines:changed", (ev) => { console.info("🍇addListener lines:changed💐", ev); });
cosense.on("lines:changed", (ev) => { console.info("🍈on lines:changed💐", ev); });
cosense.once("lines:changed", (ev) => { console.info("🍋once lines:changed💐", ev); });
window.cosense.addListener("project:changed", (ev) => { console.info("🍇addListener project:changed🌸", ev); });
cosense.on("project:changed", (ev) => { console.info("🍈on project:changed🌸", ev); });
cosense.once("project:changed", (ev) => { console.info("🍋once project:changed🌸", ev); });
window.cosense.addListener("page:changed", (ev) => { console.info("🍇addListener page:changed🪷", ev); });
cosense.on("page:changed", (ev) => { console.info("🍈on page:changed🪷", ev); });
cosense.once("page:changed", (ev) => { console.info("🍋once page:changed🪷", ev); });
window.cosense.addListener("layout:changed", (ev) => { console.info("🍇addListener layout:changed🌹", ev); });
cosense.on("layout:changed", (ev) => { console.info("🍈on layout:changed🌹", ev); });
cosense.once("layout:changed", (ev) => { console.info("🍋once layout:changed🌹", ev); });
code:script.js
import '/api/code/ne-sachirou/KaTeX macro/script.js';
code:script.js
import '/api/code/ne-sachirou/クリックでON%2FOFFできるチェックボックス/script.js';
⬜sample 1
✅sample 2
code:script.js
(() => {
console.info("👒別プロジェクトへのリンク先が不存在ならオレンジ");
function markEmptyExternalProjectLink() {
Array.from(document.querySelectorAll(".page .lines a.page-link"))
.filter((a) => a.innerText.startsWith("/"))
.forEach(async (a) => {
const response = await fetch(
a.href.replace("scrapbox.io", "scrapbox.io/api/pages"),
);
const json = await response.json();
if (!json.persistent) {
a.classList.add("empty-page-link");
}
});
}
window.cosense.addListener("page:changed", () => {
markEmptyExternalProjectLink();
});
markEmptyExternalProjectLink();
})();