choromoto
https://gyazo.com/fabe747399491753667a06a4a7b10370
ちょろ本です。岐阜でソフトウェアエンジニアやってます。
SNS
/icons/水平線.icon
user script
ページに + を追加する
code:style.css
/* 「#Template」は次に書いている「add page menu.js」のtitleと一致する */
button#Templates.tool-btn:hover { text-decoration: none }
/* Font Awesomeで「+」を表示 */
button#Templates.tool-btn::before { position: absolute; content: '\f067'; font: 900 21px/46px 'Font Awesome 5 Free' }
/* 画像は隠す */
button#Templates.tool-btn img { opacity: 0 }
code: script.js
// PageMenuに追加
scrapbox.PageMenu.addMenu({
title: "Templates",
image:
"/assets/img/logo.png" /* imageキーは必須っぽい。空文字もダメだった。404 Not Foundでもいいので何か書く必要がある */,
});
// テンプレート
scrapbox.PageMenu("Templates").addItem({
title: "トライ",
onClick: function () {
// ページタイトル
const title = "<トライ系テンプレート>";
// プロジェクトURL
const projectName = scrapbox.Project.name;
// タグ
// 基本構成
const kousei = [
"はじめに",
"結果",
"環境",
"やったこと",
"おわりに",
"参考"
];
const body = encodeURIComponent(kousei.join("\n".repeat(2)) + "\n".repeat(3) + tags.join(" "));
const scrapboxUrl = projectUrl + encodeURIComponent(title);
window.open(scrapboxUrl + "?body=" + body);
},
});
scrapbox.PageMenu("Templates").addItem({
title: "紹介",
onClick: function () {
// ページタイトル
const title = "<紹介系テンプレート>";
// プロジェクトURL
const projectName = scrapbox.Project.name;
// タグ
// 基本構成
const kousei = [
"はじめに",
"この記事を読んで欲しい人",
"サービスの特徴",
"サービスの導入方法",
"おわりに",
"参考"
];
const body = encodeURIComponent(kousei.join("\n".repeat(2)) + "\n".repeat(3) + tags.join(" "));
const scrapboxUrl = projectUrl + encodeURIComponent(title);
window.open(scrapboxUrl + "?body=" + body);
},
});