ko
※ここは管理用ページなのでコンテンツはありません。
/icons/hr.icon
https://gyazo.com/7b7ca66716f251c4cc1e792e94991900
this is ko’s page
#member
/icons/hr.icon
UserScript
範囲選択してスペースキー押すと内部リンクする
//code:script.js
(() => {
let textInput = $('#text-input')0;
textInput.addEventListener('keydown', e => {
if (e.keyCode != 32 || e.shiftKey || e.ctrlKey || e.altKey) return;
if ($('#text-input').width() <= 8) return;
if (! $('.popup-menu')0) return;
let linkButton = $('.link-button')0;
if (! linkButton) return;
linkButton.click();
e.preventDefault();
});
})();
/foldrr/scrapbox-linkkey
編集モードでないとき、fまたは/を押すと検索ボックスにフォーカス
//code:script.js
(() => {
let hasTriggered = function(e) {
return (! e.shiftKey) &&
(! e.ctrlKey) &&
(! e.metaKey) &&
(! e.altKey) &&
(e.key == '/' || e.key == 'f');
};
$('body').on('keydown',function(e){
let input = e.target.tagName == "TEXTAREA" ||
e.target.tagName == "INPUT" ||
e.target == $('.search-form input')0;
if (input) return;
if (! hasTriggered(e)) return;
$('.search-form input')0.focus();
return false;
});
})();
/foldrr/scrapbox-focus-searchbox
編集モード中にescを押すと編集モードを抜ける
//code:script.js
(() => {
let hasTriggered = function(e) {
return e.keyCode == 27;
};
$('body').on('keydown',function(e){
if (! hasTriggered(e)) return;
e.target.blur();
setTimeout(function() {
e.target.blur();
}, 325);
});
})();
/foldrr/scrapbox-exit-editmode
箇条書きのとき、カーソルが行頭になくてもTab / shift+tab で階層の上げ下げが出来るようにする
code:script.js
(() => {
$('#text-input').on('keydown', e => {
if (e.keyCode != 0x09) return true;
if ($('.cursor-line .code-block').length != 0) return true;
if ($('.cursor-line .table-block').length != 0) return true;
if ($('.popup-menu').length != 0) return true;
let keydown = document.createEvent('Events');
keydown.initEvent('keydown', true, true);
keydown.keyCode = e.which = (e.shiftKey ? 37 : 39);
keydown.ctrlKey = true;
$('#text-input')0.dispatchEvent(keydown);
return false;
});
})();
//(旧い)code:script.js
$('#text-input').on('keydown', e => {
if (e.keyCode != 0x09) return;
if ($('tr.cursor-line').length != 0) return;
if ($('.cursor-line .code-block').length != 0) return;
if ($('.popup-menu').length != 0) return;
let keydown = document.createEvent('Events');
keydown.initEvent('keydown', true, true);
keydown.keyCode = e.which = (e.shiftKey ? 37 : 39);
keydown.ctrlKey = true;
$('#text-input')0.dispatchEvent(keydown);
return false;
});
/foldrr/scrapbox-indentkey
右上のページメニュー
先頭まで一気にスクロールするボタン
code:script.js
scrapbox.PageMenu.addMenu({
title: '先頭',
image:'https://gyazo.com/1986e477a22e8f3180331f8b0a10c00c/raw',
onClick: () => {
$("html,body").animate({scrollTop:$('.app').offset().top});
//$("html,body").animate({scrollTop:$('.project-home').offset().top});
}
})
/rashitamemo/長いScrapboxのページを画面下までスクロールさせたいの改造
関連ページのところまで一気にスクロールするボタン
code:script.js
scrapbox.PageMenu.addMenu({
title: '末尾',
//image:'https://gyazo.com/bb5d5bb7b119db32eeab8472c9df092d/raw',
image:'https://gyazo.com/afd3dda4c974e2ca4373a14abb72a1d6/raw',
onClick: () => {
$("html,body").animate({scrollTop:$('.related-page-sort-menu').offset().top});
}
})
/rashitamemo/長いScrapboxのページを画面下までスクロールさせたい
ポップアップボタン
箇条書き化
//code:script.js
scrapbox.PopupMenu.addButton({
title: 'list',
onClick: text => text.split(/\n/).map(line => ${line}).join('\n')
})
https://qiita.com/progfay/items/5a81e130fc36291990d4 の改造
ハッシュタグまたは内部リンクの直前にスペースがないとき、半角スペースを1個入れる
//code:script.js
scrapbox.PopupMenu.addButton({
title: '#tag',
onClick: text =>{
//# or #の直前にスペースがないとき
text=text.split(/\n/).map(line => line.replace(/(^\s)##/g,'$1 #')).join('\n')
//行頭に全角#がある場合
text=text.split(/\n/).map(line => line.replace(/^#(^\s)/g,'#$1')).join('\n')
//hogefugaのように内部リンクが直に連続している場合
text=text.split(/\n/).map(line => line.replace(/(^\s])\[/g,'$1 [')).join('\n')
return text;
}
})
範囲選択したところをコード記法にする
//code:script.js
scrapbox.PopupMenu.addButton({
title: 'code',
onClick: text =>{
text=text.split(/\n/).map(line => line.replace(/(.+)/g,'$1')).join('\n')
//text=text.split(/\n/).map(line => line.replace(/(.+)/g,'$1')).join('\n')
return text;
}
})
行頭に引用符を付ける
//code:script.js
scrapbox.PopupMenu.addButton({
title: 'Quote',
onClick: text => text.split(/\n/).map(line => > ${line}).join('\n')
})
https://scrapbox.io/forum-jp/shokai
デフォルトでは行頭に半角スペースも入るが、それはここでは除いてある。
番号リスト化
//code:script.js
scrapbox.PopupMenu.addButton({
title: 'order',
onClick: text => text.split(/\n/).map((line, index) => ${index+1}. ${line}).join('\n')
})
https://qiita.com/progfay/items/5a81e130fc36291990d4
空白行を消す
//code:script.js
scrapbox.PopupMenu.addButton({
title: 'delete blank',
onClick: text => text.split(/\n/).filter(line => !line.match(/^\s*$/)).join('\n')
})
/gofujita-notes-personals/go
Dynalist記法とMarkdownをScrapbox記法へ置換
//code:script.js
scrapbox.PopupMenu.addButton({
title: 'Dynalist', //"Dynalist" is the name of popup button.
onClick: text =>{
////Markdown////
////Hyperlink without linktext / Image without alt text
//e.g. [](https://www.google.com) or ![](https://www.google.com/google.png)
text=text.split(/\n/).map(line => line.replace(/!?\\\((https?:\/\/\w/:%#\$&\?\(\)~\.=\+\-+)\)/g,'$1')).join('\n')
////Image with alt text
//e.g. !Google logo(https://www.google.com/google.png)
text=text.split(/\n/).map(line => line.replace(/!\[(^\]+)\]\((https?:\/\/\w/:%#\$&\?\(\)~\.=\+\-+)\)/g,'$1 $2')).join('\n')
////Hyperlink with linktext
//e.g. Google(https://www.google.com)
text=text.split(/\n/).map(line => line.replace(/\[(^\]+)\]\((https?:\/\/\w/:%#\$&\?\(\)~\.=\+\-+)\)/g,'$1 $2')).join('\n')
////Emphasis
//Bold
text=text.split(/\n/).map(line => line.replace(/\*\*(\*+|^*+)\*\*/g,'$1')).join('\n')
//Italic
text=text.split(/\n/).map(line => line.replace(/\_\_(\_+|^_+)\_\_/g,'$1')).join('\n')
////Line strikethrough
text=text.split(/\n/).map(line => line.replace(/\~\~(\~+|^~+)\~\~/g,'$1')).join('\n')
////Date e.g. !(2019-09-11) or !(2019-09-11 10:00)////
text=text.split(/\n/).map(line => line.replace(/\!\((0-9{4}\-0-9{2}\-0-9{2}( 0-9{2}:0-9{2})*)\)/g,'$1')).join('\n')
////@ for hashtag////
//@ at the beginning of a line
text=text.split(/\n/).map(line => line.replace(/^(\s*)@/g,'$1#')).join('\n')
//@ at after a space
text=text.split(/\n/).map(line => line.replace(/(  )@/g,'$1#')).join('\n')
////Latex e.g. $$E=mc^2$$////
text=text.split(/\n/).map(line => line.replace(/\$\$(^$$+)\$\$/g,'\$ $1')).join('\n')
////Each four indents in a item(=a line)////
text=text.split(/\n/).map(line => line.replace(/\s{4}/g,' ')).join('\n')
return text;
}
})
dy2sc/dy2sc.js at master · kojp/dy2sc
参考資料:/scrapboxlab/$...$ でくくられた部分をすべてScrapboxのTeX記法に置換するためのUserScript
画像に枠線をつける
//code:script.js
scrapbox.PopupMenu.addButton({
title: 'IMG Border',
onClick: text =>{
text=text.split(/\n/).map(line => line.replace(/\[/g,'[| [')).join('\n')
text=text.split(/\n/).map(line => line.replace(/\]/g,']]')).join('\n')
return text;
}
})
その他
日付のフォーマット(alt+tで記入)
code:script.js
scrapbox.TimeStamp.addFormat('YYYY-MM-DD')
/help-jp/日付と時刻を入力する
/icons/hr.icon
UserCSS
画像のサイズ変更
//code:style.css
.level-1 img { width: 16.7%; max-height: none; }
.level-2 img { width: 33.3%; max-height: none; }
.level-3 img { width: 50%; max-height: none; }
.level-4 img { width: 66.7%; max-height: none; }
.level-5 img { width: 83.3%; max-height: none; }
.level-6 img { width: 100%; max-height: none; }
https://bit.ly/2Fi24Qo
縦に長い画像でも全体が見えるようにする
//code:style.css
.grid li.page-list-item a .icon img {
max-width: 100%;
max-height: 100%;
width: auto !important;
}
/customize/縦に長い画像でも全体が見えるようにする
デフォルトで表示されるポップアップボタンの中で不要なものを非表示
code:style.css
div.italic-button,div.strike-button{display:none !important}/*イタリックと取り消し線*/
画像に枠線をつける(画像のサイズを変えると機能しない)
code:style.css
img.image, img.strong-image{border:solid 1px #ddd}
各ページ右上のメニューのアイコンの明度を変える
code:style.css
img.extension-btn/*, div.dropdown button, a.random-jump-button*/{filter:invert(80%);/*filter: drop-shadow(0px 0px 10px #000);*/}
※img.extension-btnがマンタのアイコン