Skip to content

Instantly share code, notes, and snippets.

@nora-tetsu
Created February 23, 2023 08:50
Show Gist options
  • Save nora-tetsu/bac49dbc95d7c6e8366c5867b7d36275 to your computer and use it in GitHub Desktop.
Save nora-tetsu/bac49dbc95d7c6e8366c5867b7d36275 to your computer and use it in GitHub Desktop.
Page Menuからclassの付け外しをするUserScript
(function () {
scrapbox.PageMenu.addMenu({
title: 'フォント変更',
image: 'https://i.gyazo.com/7057219f5b20ca8afd122945b72453d3.png', // Scrapboxアイコン
onClick: () => {
const className = 'changefont'; // 適当なクラス名を用意する
const editor = document.getElementById('editor'); // 本文部分の親要素
// クラスが既に付与されていれば外す、付与されていなければ付与する
editor.classList.contains(className) ? editor.classList.remove(className) : editor.classList.add(className);
},
})
})();
@nora-tetsu
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment