kitasenjudesign
自分のことを名前で呼ぶとYazawaっぽくなる。
scriptの調べ方
userscript
code:script.js
import '/api/code/kinetictypo/タグが存在してなかったらタグを自動挿入/autotag.js';
import '/api/code/kinetictypo/閲覧したページのタグを収集する/collectTags.js';
/*タイトルをGoogleサーチする*/
scrapbox.PageMenu.addMenu({
title: 'google link',
onClick: () => {
let hoge = encodeURIComponent(scrapbox.Page.title) + "";
}
});
export function insertText(text) {
const cursor = document.getElementById('text-input');
cursor.focus();
cursor.value = text;
const uiEvent = document.createEvent('UIEvent');
uiEvent.initEvent('input', true, false);
cursor.dispatchEvent(uiEvent);
}
/* historyバック */
scrapbox.PageMenu.addMenu({
title: 'history.back',
onClick: () => {
window.history.back();
}
});
選択を検索
code:script.js
scrapbox.PopupMenu.addButton({
title: 'Google Search',
onClick: text => {
// 記法を解除する
const keyword = text.split(/\n/)
.map(line => line.replace(/\(.*)\/g,'$1')).join('\n'); window.open(https://www.google.com/search?q=${encodeURIComponent(keyword)});
}
});
//chatGPTに渡す
scrapbox.PopupMenu.addButton({
title: 'chatGPTに語源きく',
onClick: text => {
// 記法を解除する
const keyword = text.split(/\n/)
.map(line => line.replace(/\(.*)\/g,'$1')).join('\n'); window.open(https://chat.openai.com/?q=${encodeURIComponent(keyword)}の語源を教えて);
}
});
moji count
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
})
img
https://gyazo.com/5df603624198ca6aca4b6501fab994fe
https://gyazo.com/94bd8610fa1fa91b4f8c01e1625ff815
https://gyazo.com/2b468c2c91b17e76e553dda25e4dd02e