-
-
Save nora-tetsu/c3cec884219f1ba75768063a5c92bac2 to your computer and use it in GitHub Desktop.
Page Menuから備忘録を呼び出すUserScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 変数が他に影響しないように即時関数内で実行する | |
(function () { | |
// メニューとタイトルを決めて変数に入れておく | |
const menuTitle = "備忘録"; | |
// Itemにするためのオブジェクトを用意して配列にする | |
const list = [ | |
{ title: '備忘録①', detail: 'alertで表示したい内容をここに書く' }, | |
{ title: '備忘録②', detail: '改行したいときは\nこうする' }, | |
] | |
// メニューを作る | |
scrapbox.PageMenu.addMenu({ | |
title: menuTitle, // タイトルが「備忘録」になる | |
image: 'https://i.gyazo.com/cf195383cbce26ac8697af2ced43343d.png', // メモの絵文字画像 | |
}); | |
// listの中身それぞれについて繰り返し処理 | |
for (const obj of list) { | |
// 「備忘録」メニューの中にItemを作る | |
scrapbox.PageMenu(menuTitle).addItem({ | |
title: obj.title, | |
onClick: () => alert(obj.detail), // Itemをクリックするとalertで内容を表示 | |
}) | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment