UserScriptのkitchensink
ここを見れば大体わかる
真似したい
JSから取得できそうなオブジェクト
code:script.js
const DEBUG_MENU_TITLE = 'DEBUG';
scrapbox.PageMenu.addMenu({
title: DEBUG_MENU_TITLE,
image: DEBUG_MENU_ICON_URL,
onClick: () => {
scrapbox.PageMenu(DEBUG_MENU_TITLE).removeAllItems();
//scrapbox.PageMenu(DEBUG_MENU_TITLE).addSeparator();
scrapbox.PageMenu(DEBUG_MENU_TITLE).addItem({
title: 'show scrapbox.Page.title',
onClick: () => {
alert(scrapbox.Page.title)
}
});
/* scrapbox.Page.lines */
scrapbox.PageMenu(DEBUG_MENU_TITLE).addItem({
title: 'show scrapbox.Page.lines',
onClick: () => {
alert(JSON.stringify(scrapbox.Page.lines))
}
});
/* scrapbox.Page.id */
scrapbox.PageMenu(DEBUG_MENU_TITLE).addItem({
title: 'show scrapbox.Page.id',
onClick: () => {
alert(scrapbox.Page.id)
}
});
/* scrapbox.Project.name */
scrapbox.PageMenu(DEBUG_MENU_TITLE).addItem({
title: 'show scrapbox.Project.name',
onClick: () => {
alert(scrapbox.Project.name)
}
});
/* scrapbox.Project.pages */
scrapbox.PageMenu(DEBUG_MENU_TITLE).addItem({
title: 'show scrapbox.Project.pages',
onClick: () => {
console.log(JSON.stringify(scrapbox.Project.pages));
alert(JSON.stringify(scrapbox.Project.pages));
}
});
/* scrapbox.Layout */
scrapbox.PageMenu(DEBUG_MENU_TITLE).addItem({
title: 'show scrapbox.Layout',
onClick: () => {
console.log(scrapbox.Layout);
alert(scrapbox.Layout);
}
});
scrapbox.PageMenu(DEBUG_MENU_TITLE).addSeparator();
/* api/pages/:projectname/:pagetitle */
scrapbox.PageMenu(DEBUG_MENU_TITLE).addItem({
title: 'api/pages/:projectname/:pagetitle',
onClick: () => {
(function(){window.open(/api/pages/${scrapbox.Project.name}/${scrapbox.Page.title},'window1','width=600,height=400,scrollbars=1');})();
}
});
/* api/pages/:projectname/:pagetitle/text */
scrapbox.PageMenu(DEBUG_MENU_TITLE).addItem({
title: 'api/pages/:projectname/:pagetitle/text',
onClick: () => {
(function(){window.open(/api/pages/${scrapbox.Project.name}/${scrapbox.Page.title}/text,'window1','width=600,height=400,scrollbars=1');})();
}
});
/* api/pages/:projectname/:pagetitle/icon */
scrapbox.PageMenu(DEBUG_MENU_TITLE).addItem({
title: 'api/pages/:projectname/:pagetitle/icon',
onClick: () => {
(function(){window.open(/api/pages/${scrapbox.Project.name}/${scrapbox.Page.title}/icon,'window1','width=600,height=400,scrollbars=1');})();
}
});
scrapbox.PageMenu(DEBUG_MENU_TITLE).addSeparator();
/* api/stream/:projectname/ */
scrapbox.PageMenu(DEBUG_MENU_TITLE).addItem({
title: 'api/stream/:projectname/',
onClick: () => {
(function(){window.open(/api/stream/${scrapbox.Project.name},'window1','width=600,height=400,scrollbars=1');})();
}
});
/* api/feed/:projectname */
scrapbox.PageMenu(DEBUG_MENU_TITLE).addItem({
title: 'api/feed/:projectname',
onClick: () => {
(function(){window.open(/api/feed/${scrapbox.Project.name},'window1','width=600,height=400,scrollbars=1');})();
}
});
scrapbox.PageMenu(DEBUG_MENU_TITLE).addSeparator();
scrapbox.PageMenu(DEBUG_MENU_TITLE).addItem({
title: 'Setting',
onClick: () => location.href = 'UserScriptのkitchensink'
});
}
});
https://gyazo.com/2cec01609664e58cf51ea7bb5a52ea96