junkaneko
https://lh3.googleusercontent.com/a-/AAuE7mCNH7G_yxDwT3aQZHw8xGSIwXGgmQiWtB7O0u7N_A#.png
this is junkaneko’s page
RSS通知
文字カウントツール
code:script.js
// ページ内の文字カウント
scrapbox.PageMenu.addItem({
title: () => {
if (!scrapbox.Page.lines) return
const chars = scrapbox.Page.lines.map(line => line.text.length).reduce((a,b) => a + b)
const words = scrapbox.Page.lines.map(line => line.text.split(/\s+/).length).reduce((a,b) => a + b)
return ${chars}文字 ${words}単語 ${scrapbox.Page.lines.length}行
},
onClick: () => null
})
code:script.js
//範囲選択して文字カウント
scrapbox.PopupMenu.addButton({
title: function (text) {
const chars = text.replace(/\r\n/g, '').length const words = text.trim().split(/\r\n\s+/).length return ${chars}c ${words}w
},
onClick: () => null
})
しおり記法
code:script.js
// 選択した文字列にマーカー
scrapbox.PopupMenu.addButton({
title: 'しおり',
onClick: text => [. ${text}]
})
code:style.css
/* しおり記法 -- 栞箇所のマークやハイライトが不要な場合はこのブロックは消してね */
@media screen {
body:not(.presentation) .line .deco-\. { background-color: #F5FAEA } body:not(.presentation) .line .deco-\.::after {
position: absolute; top: 3px; left: -1.4em;
content: '\f02e'; font: 1.7rem/1 'FontAwesome'; color: yellowgreen } }
@media screen and (max-width: 990px) {
body:not(.presentation) .line .deco-\.::after { position: static; padding-left: .3em } }
/* 栞一覧を出すページメニューボタンのスタイル -- ここは必要 */
button#Bookmarks.tool-btn:hover { text-decoration: none }
button#Bookmarks.tool-btn::before {
position: absolute; content: '\f02e'; font: 400 20px/46px 'Font Awesome 5 Free' }
button#Bookmarks.tool-btn img { opacity: 0 }
蛍光緑マーカー
code:script.js
// 選択した文字列にマーカー
scrapbox.PopupMenu.addButton({
title: 'マーカー',
onClick: text => [[${text}]]
})
code:style.css
/* 二重括弧による強調をマーカーっぽくする */
.line strong:not(class) { background: linear-gradient(transparent 10%, #ABFF4F 25%, #ABFF4F 70%, transparent 90%) }