Last active
July 26, 2026 03:36
-
-
Save sendarionn/012629aad183c1f6ef7b1e0552246e4f to your computer and use it in GitHub Desktop.
選択した文字列の改行を除去してコピーするブックマークレット
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:(async()=>{const text=window.getSelection()?.toString();if(!text)return;try{await navigator.clipboard.writeText(text.replace(/\r\n?|\n/g,''));const notice=document.createElement('div');notice.textContent='改行を削除してコピー完了';Object.assign(notice.style,{position:'fixed',top:'20px',left:'50%',transform:'translateX(-50%)',padding:'8px 16px',background:'#333',color:'#fff',zIndex:2147483647,borderRadius:'4px',fontSize:'14px',pointerEvents:'none',boxShadow:'0 2px 8px rgba(0,0,0,.3)'});document.body.appendChild(notice);setTimeout(()=>notice.remove(),1500);}catch(error){console.error('コピーに失敗',error);}})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment