Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* forVivaldi コマンドチェインレシピ 1.現在のタブでリンクを開く(コマンドパラメータはこれ) 2.ページにフォーカス */
- javascript:
- var text = document.title + "\n" + location.href;
- if(navigator.clipboard) {
- setTimeout(() => (navigator.clipboard.writeText(text).then(() => {}, () => {alert("コピーに失敗しました")})), 100);
- }
- else {
- var textarea = document.createElement("textarea");
- textarea.value = text;
- document.body.appendChild(textarea);
- textarea.select();
- document.execCommand("copy");
- document.body.removeChild(textarea);
- }
- if(history.replaceState){history.replaceState({},null,location.href);};
Advertisement
Comments
-
Comment was deleted
-
- /* 改良(?)圧縮版 */
- javascript:(t=>{new Promise(r=>setTimeout(r,100)).then(async()=>{await navigator.clipboard.writeText(t)}).catch(()=>{(a=>{a.value=t;document.body.appendChild(a);a.select();document.execCommand('copy');a.remove()})(document.createElement('textarea'))});history.replaceState&&history.replaceState({},'',location.href)})(document.title+'\n'+location.href)
Add Comment
Please, Sign In to add comment
Advertisement