kujakujira
https://lh3.googleusercontent.com/a/AEdFTp6GiI7aOhBYWWfDJEdSo8hmWBk9Mh4dlVrHSoGX2w=s96-c#.png
虚飾で彩られたカラス
クジャクみたいなのでクジャクにしましたkujakujira.icon
クジラは単なるク繋ぎ
そういえばゴジラの名前もクジラに由来してるっぽい
code:script.js
import {convertWholeText} from '/api/code/1cc/UserScript_-_TweetEmbed/convert.js';
export function insertText({text}) {
const cursor = document.getElementById('text-input');
cursor.focus();
const start = cursor.selectionStart; // in this case maybe 0
cursor.setRangeText(text);
cursor.selectionStart = cursor.selectionEnd = start + text.length;
const uiEvent = document.createEvent('UIEvent');
uiEvent.initEvent('input', true, false);
cursor.dispatchEvent(uiEvent);
}
scrapbox.PopupMenu.addButton({
title: 'Embed a tweet',
onClick: text => {
// URLがなければ何もしない
if (!/https:\/\/((twitter)|x)\.com\S+\/status\/\d+/.test(text)) return;
const cursor = document.getElementById('text-input')
Promise.all(text.split('\n').map(line => {
const matches = line.match(/^\s+|.*/g);
const indent = /^\s+$/.test(matches0)? matches0 : ''; const content = /^\s+$/.test(matches0)? matches1 : matches0; return convertWholeText(content, indent)
})).then(lines => insertText({text: lines.join('\n'), cursor: cursor}));
// 入力しやすいよう選択範囲を先に消しておく
return '';
},
});
code:script.js_
import '/api/code/1cc/UserScript_-_ClearBracket/script.js';
code:script.js
import '/api/code/1cc/scrapbox-url-customizer/script.js';
code:script.js
import { mount } from '/api/code/1cc/ScrapBubble/script.js';
mount();
code:style.css
div.page {
overflow-x: visible;
overflow-y: visible;
}
<C-Enter>
code:script.js
var m=!1;scrapbox.addListener("lines:changed",()=>m=!1);scrapbox.addListener("layout:changed",()=>m=!1);var f=(e,t)=>{if(!(e instanceof HTMLTextAreaElement))throw new TypeError("${t}" must be HTMLTextAreaElement but actual is "${e}")};var s=()=>{let e=document.getElementById("text-input");if(e)return f(e,"textarea#text-input"),e};var a=(e,t)=>{let{noModifiedKeys:n=!1,...r}=t??{},i={bubbles:!0,cancelable:!0,keyCode:we,...n?{}:{...r}},o=s();if(!o)throw Error("#text-input must exist.");o.dispatchEvent(new KeyboardEvent("keydown",i)),o.dispatchEvent(new KeyboardEvent("keyup",i))},w={Backspace:8,Tab:9,Enter:13,Delete:46,Escape:27," ":32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,a:65,A:65,b:66,B:66,c:67,C:67,d:68,D:68,e:69,E:69,f:70,F:70,g:71,G:71,h:72,H:72,i:73,I:73,j:74,J:74,k:75,K:75,l:76,L:76,m:77,M:77,n:78,N:78,o:79,O:79,p:80,P:80,q:81,Q:81,r:82,R:82,s:83,S:83,t:84,T:84,u:85,U:85,v:86,V:86,w:87,W:87,x:88,X:88,y:89,Y:89,z:90,Z:90,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,F1:113,F2:114,F3:115,F4:116,F5:117,F6:118,F7:119,F8:120,F9:121,F10:122,F11:123,F12:124,":":186,"*":186,";":187,"+":187,"-":189,"=":189,".":190,">":190,"/":191,"?":191,"@":192,"":192,"[":219,"{":219,"\\":220,"|":220,"]":221,"}":221,"^":222,"~":222,_:226};function c(e,t={}){let{signal:n,persistent:r=!0}=t;return n?.aborted?Promise.reject(n.reason):new Promise((i,o)=>{let u=()=>{clearTimeout(l),o(n?.reason)},l=setTimeout(()=>{n?.removeEventListener("abort",u),i()},e);if(n?.addEventListener("abort",u,{once:!0}),r===!1)try{Deno.unrefTimer(l)}catch(p){if(!(p instanceof ReferenceError))throw p;console.error("persistent option is only available in Deno")}})}var x=async e=>{let t=s();if(!t)throw Error("#text-input is not ditected.");t.focus(),t.value=e;let n=new InputEvent("input",{bubbles:!0});t.dispatchEvent(n),await c(1)};var d=()=>{let e=s();if(!e)throw Error("#text-input is not found.");let t=Object.keys(e).find(o=>o.startsWith("__reactFiber"));if(!t)throw Error('#text-input must has the property whose name starts with "__reactFiber"');let n=e[t].return.return.stateNode._stores,r=n.find(o=>o.constructor.name==="Cursor");if(!r)throw Error('#text-input must has a "Cursor" store.');let i=n.find(o=>o.constructor.name==="Selection");if(!i)throw Error('#text-input must has a "Selection" store.');return{cursor:r,selection:i}};var E=()=>d().cursor;var h=e=>{if(e===0)return;let t={};return e&1&&(t.capture=!0),e&2&&(t.once=!0),e&4&&(t.passive=!0),t};var H=new Map;scrapbox.on("layout:changed",()=>{let e=s();if(e)for(let[t,n]of H)for(let[r,i]of n)for(let o of i)e.addEventListener(t,r,h(o))});s().addEventListener("keydown",async e=>{if(e.key!=="Enter"||e.metaKey||e.altKey||!e.ctrlKey||e.shiftKey||scrapbox.Layout!=="page")return;let t=E(),n=t.getPosition().line,r=scrapbox.Page.lines[n];!("codeBlock"in r)||r.codeBlock.start||r.codeBlock.end||(a("End"),a("Enter"),t.setPosition({line:t.getPosition().line,char:r.codeBlock.indent-1}),a("End",{shiftKey:!0}),await x(code:${r.codeBlock.filename??""}`),a("Home"),a("Enter"),a("ArrowUp"))}); 時戳格式
code:script.js
scrapbox.TimeStamp.removeAllFormats()
scrapbox.TimeStamp.addFormat('YYYY-MM-DD')