torish14
https://scrapbox.io/files/62d131e6cc3a9a0022eea039.png
code:script.js
// Google 検索
scrapbox.PageMenu.addItem({
title: () => "> Google Site",
onClick: () =>
window.open(https://www.google.com/search?q=${encodeURIComponent(window.scrapbox.Page.title)}+site:scrapbox.io)
})
// テキスト翻訳
import '/api/code/masui/Scrapboxテキストを翻訳する/script.js'
// 選択テキストから横断検索
import '/api/code/masui/選択テキストから横断検索する/script.js'
// ctrl + Enter キーで新規ページ作成
// ページ内にカーソルをフォーカスしていると機能しない
// そのときは escape を押下
$('body').on('keydown',function(e){
if(e.target.tagName != "TEXTAREA" && e.target.tagName != "INPUT"){
if((event.keyCode == 10 || event.keyCode == 13) && event.ctrlKey){
var project = location.href.split('/')3 location.href = /${project}/new
}
}
})
/* $('.btn.btn-default').on('click',function(){ */
$('button').on('click',function(){
var s = $('.form-control').val()
if(s == ''){
var project = location.href.split('/')3; location.href = /${project}/new
}
})
// 音声入力
// import '/api/code/shokai/音声入力Menu/script.js'
scrapbox.PopupMenu.addButton({
title: "\\n",
onClick: (text) => text
.replaceAll("\n", "")
.replaceAll(".", ".\n")
.replaceAll(".", ".\n")
.replaceAll("。", "。\n"),
});
scrapbox.PopupMenu.addButton({
title: 'order',
onClick: text => text.split(/\n/).map((line, index) => ${index+1}. ${line}).join('\n')
})