kitasenjudesign
my name is kitasenju design.
kitasenjudesign.icon
userscript
code:script.js
/* 英次郎&ケンブリッジへのリンクを挿入 */
scrapbox.PageMenu.addMenu({
title: 'insert eijiro/cambridge link',
onClick: () => {
let hoge = encodeURIComponent(scrapbox.Page.title) + "";
}
});
/* speechAPIの発音 */
scrapbox.PageMenu.addMenu({
title: 'pronounce on browser',
onClick: () => {
let hoge = scrapbox.Page.title + "";
let utterance = new SpeechSynthesisUtterance(hoge);
utterance.lang = "en-US"
window.speechSynthesis.speak(utterance);
}
});
/* キーワードを挿入 */
scrapbox.PageMenu.addMenu({
title: 'add keyword',
onClick: () => {
let title = encodeURIComponent(scrapbox.Page.title) + "";
}
});
/* ukonowへのリンクを挿入 */
scrapbox.PageMenu.addMenu({
title: '類似',
onClick: () => {
let title = encodeURIComponent(scrapbox.Page.title) + "";
}
});
/* ----------------------------- */
/* ページ変更の監視 とspeechAPI*/
var title = ""
window.setInterval(()=>{
if(title!=scrapbox.Page.title){
let hoge = scrapbox.Page.title;
if(hoge!=null){
let utterance = new SpeechSynthesisUtterance(""+hoge);
utterance.lang = "en-US"
utterance.volume = 0.6;
window.speechSynthesis.speak(utterance);
}
}
title=scrapbox.Page.title;
},600);
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);
}
shortcut
code:script.js
document.addEventListener('keydown', function(event) {
// cmdキーが押されているかのチェック
if (event.metaKey) {
if (event.keyCode === 82) {//r
var elements = document.getElementsByClassName("random-jump-button");
window.scrollTo({ top: 0, behavior: 'smooth' });
} else if (event.keyCode === 66) {//
// ページをback
window.history.back();
}
}
});
browser speech
code:script.js
/* speechAPIの発音 */
scrapbox.PageMenu.addMenu({
title: 'pronounce on browser',
onClick: () => {
let hoge = scrapbox.Page.title + "";
let utterance = new SpeechSynthesisUtterance(hoge);
utterance.lang = "en-US"
window.speechSynthesis.speak(utterance);
}
});
history back
code:script.js
/* historyバック */
scrapbox.PageMenu.addMenu({
title: 'history.back',
onClick: () => {
window.history.back();
}
});
未使用
code:hoge.js
/* google検索の発音 */
/*
scrapbox.PageMenu.addMenu({
title: 'google',
onClick: () => {
let hoge = scrapbox.Page.title + " pronunciation";
window.open(https://www.google.com/search?q=${encodeURIComponent(hoge)},'pronounce');}
});*/
kitasenjudesign.icon
kitasenjudesign.icon