shortcut-script
カーソルがあたってなくても使える奴だけにしていきたい(将来)
code:script.js
//shortcut
import '/api/code/foldrr/scrapbox-shortcut/script.js' //前提
import '/api/code/yuyasurarin/scrapbox-editor-begin-edit/edit_begin.js'
scrapboxShortcut.onBrowse('enter', window.scrapboxEditorBeginEdit);
//import '/api/code/foldrr/scrapbox-editor-select-backward/script.js' //shift+backspaceで選択
//scrapboxShortcut.onEdit('shift+backspace', window.scrapboxEditorSelectBackward);
import("/api/code/villagepump/カーソルが行頭になくてもTabでインデントするUserScript/script.js").then(({ setup }) => setup());
let open = function (url) {
let pageName = location.href.split('/')4; if (!pageName) return;
let title = $('.line-title .text').text().replace(/\(\)()/g, ' '); window.open(url + title, '_blank');
return false;
};
scrapboxShortcut.onBrowse('h', () => $('.project-home')0.click()); scrapboxShortcut.onBrowse('n', () => $('.new-button')0.click()); scrapboxShortcut.onBrowse('space', () => open(google));
scrapboxShortcut.onBrowse('enter', window.scrapboxEditorBeginEdit);
code:script.js
let hasTriggered = function (e) {
return (!e.shiftKey) &&
(!e.ctrlKey) &&
(!e.metaKey) &&
(e.altKey) &&
(e.key == 'Enter');
};
$('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;
$('.new-button')0.click(); });
code:script.js
window.update_link = e => {
if (!document.getElementsByClassName("replace-page-links-alert")0) return; const replace_alert = $(".replace-page-links-alert.alert.alert-success.alert-dismissable button")1; e.preventDefault();
replace_alert.click()
};
scrapboxShortcut.onBrowse('esc', window.update_link);