小池宏幸
https://twitter.com/plusadd https://gyazo.com/3bcda1f19fc7d6810981abbee19d46ea.png
UserCSS
code:style.css
/* 一覧カードを小さくする */
.two-two {
width: 114px !important;
height: 130px !important;
}
.two-two .icon {
padding-top: 30px !important;
}
.two-two .title {
height: 0px !important;
}
.page-list .grid li,
.related-page-list .grid li.page-list-item,
.related-page-list .grid li.relation-label {
width: 114px !important;
height: 130px !important;
}
code:style.css
@media (min-width: 1050px) {
.row-flex .col-page {
max-width: 960px;
}
.col-page .page-wrapper {
display: flex;
flex-direction: row-reverse;
justify-content: center;
}
.page-wrapper .page {
width: 700px;
}
.page-wrapper .related-page-list {
max-width: 260px;
}
.related-page-list .grid .splitter:first-child {
display: none;
}
.related-page-list .splitter {
height: 10px!important;
}
.related-page-list .realtion-label {
/* "realtion-label",これはtypo? */
height: 50px!important;
}
.related-page-list .page-list-item {
height: 50px!important;
}
.related-page-list ul.grid {
margin-right:5px;
width:240px;
}
.related-page-list .grid li {
width: 200px!important;
padding: 0 0 0 0!important;
margin: 0 0 5px 0!important;
}
.related-page-list .grid .page-list-item .content .title{
font-size: 15px;
}
.related-page-list .icon {
/* display: none!important; */
}
}
UserScript
Ctrl+Tで日時入力
code:script.js
scrapbox.TimeStamp.addFormat(']YYYY/MM[/DD HH:mm')
code:script.js
scrapbox.PopupMenu.addButton({
title: 'NewPage',
onClick: text => {
const lines = text.split(/\r\n/g) .trim()
.replace(/\^\+.icon\]/gm, '')
const projectRoot = (() => {
const tmp = location.href.split('/')
tmp.pop()
return tmp.join('/')
})()
const currentPageTitle = decodeURIComponent(location.href.split(/\//g).pop())
lines.unshift(from [${currentPageTitle}])
const body = encodeURIComponent(lines.join('\n'))
window.open(${projectRoot}/${title}?body=${body})
return [${title}]
}
})
code:script.js
$('body').attr('data-daiiz-rel-bubble', 'off'); // 関連ページを吹き出し表示する
$('body').attr('data-daiiz-text-bubble', 'on'); // リンク先ページのテキストを表示する
$('body').attr('data-daiiz-icon-button', 'on'); // アイコンをボタンにする
code:script.js
// 選択した文字列にマーカー
scrapbox.PopupMenu.addButton({
title: 'マーカー',
onClick: text => [[${text}]]
})
code:script.js
scrapbox.PageMenu.addMenu({
title: '見出し',
onClick: () => {
scrapbox.PageMenu('見出し').removeAllItems()
for (let line of scrapbox.Page.lines) {
if (!line.section.start) continue
if (!line.text.startsWith("[* ") && !line.text.startsWith("[** ") && !line.text.startsWith("[*** ")) continue
if (!line.nodes) continue
const image = ""
const noIcon = false
// hogeとhogeは先頭をインデントする。
const marginLeft = line.text.startsWith("[* ") ? " - " : ""
const marginLeft2 = line.text.startsWith("[** ") ? "・" : ""
const title = marginLeft + marginLeft2 + renderPlainText(line.nodes)
const onClick = () => location.hash = line.id
scrapbox.PageMenu('見出し').addItem({ title, image, onClick })
}
}
})
function renderPlainText(node) {
if (node instanceof Array) return node.map(node => renderPlainText(node)).join('')
if (typeof node === 'string') return node
switch (node.type) {
case 'icon':
case 'strong-icon':
return node.unit.page
}
return renderPlainText(node.children)
}
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
}