kii
https://gyazo.com/e58befe79647e161fa43fa359be52b14
old
https://gyazo.com/9a7706029b7e31c3dd5a009180fb0c38
this is kiichi’s page
以下UserScript
ポップアップメニューにマーカー追加
code:script.js
scrapbox.PopupMenu.addButton({
title: 'marker',
onClick: text => {
return '' + text + '';
}},
)
/scrapboxlab/WorkFlowyからのペーストをそれなりに整形するポップアップメニュー
code: script.js
scrapbox.PopupMenu.addButton({
title: 'インデント削除',
onClick: text => {
text = text.split(/\n/).map(line => line.normalize().replace(/\s{4}/g,' ')).join('\n');
return text;
}
})
ボツ
記述している時に、文字が見えなくなる事多かった
$('body').attr('data-daiiz-rel-bubble', 'on'); // 関連ページを吹き出し表示する
$('body').attr('data-daiiz-text-bubble', 'on'); // リンク先ページのテキストを表示する
code:script.js
$('body').attr('data-daiiz-paste-url-title', 'ctrl'); // URL titleの形でペーストする
cmd+i でフォーカスをノートに
code:script.js
addEventListener('keydown', e => {
if (!e.metaKey || e.key !== 'i') return
$('#text-input').focus()
})
見出しをメニューに追加
/shokai/ページの見出しを作るUserScript
code:script.js
scrapbox.PageMenu.addMenu({
title: '見出し',
image: 'https://i.gyazo.com/da6917552328f8ca2c42be02406ca165.png',
onClick: () => {
scrapbox.PageMenu('見出し').removeAllItems()
for (let line of scrapbox.Page.lines) {
if (!line.section.start) continue
const image = line.nodes && getIconUrl(line.nodes)
const noIcon = !!image
const title = line.nodes ? renderPlainText(line.nodes, {noIcon}) : line.text
const onClick = () => location.hash = line.id
scrapbox.PageMenu('見出し').addItem({title, image, onClick})
}
}
})
function renderPlainText (node, options) {
if (node instanceof Array) return node.map(node => renderPlainText(node, options)).join('')
if (typeof node === 'string') return node
switch (node.type) {
case 'icon':
case 'strong-icon':
return options.noIcon ? ' ' : node.unit.page
}
return renderPlainText(node.children, options)
}
function getIconUrl (node) {
if (/icon/.test(node.type)) {
return /api/pages/${node.unit.project||scrapbox.Project.name}/${node.unit.page}/icon
}
if (node instanceof Array) {
return node.map(getIconUrl).find(img => img)
}
return null
}
開いてるノートの複製
/forum-jp/duplicateボタンをサイドに設置
code:script.js
scrapbox.PageMenu.addMenu({
title: '複製',
image: 'https://gyazo.com/609f68d7ea163bc9d77ff5a5d30f1e02/raw',
onClick: function () {
window.location.href = './' + encodeURIComponent(scrapbox.Page.title) + '/copy';
}
})
/daiiz/Scrapboxのアイコンをボタンとして使う
code:script.js
$('body').attr('data-daiiz-icon-button', 'on'); // 'on' or 'off'
/programming-notes/数式をpreviewするUserScript
code:js
import('/api/code/programming-notes/数式をpreviewするUserScript/script.js');
#member