タイトルとURLのコピーをするブックマークレット
タイトルとURLのコピーをするブックマークレット 2022-02-21javascript:(()=>{const e=()=>{const e=document.createElement("div"),c=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/ /g," ").replace(/\n/g,"<br>");e.innerHTML=c(n());const t=document.getElementsByTagName("body")[0];t.appendChild(e);const o=document.createRange();o.selectNode(e),window.getSelection().removeAllRanges(),window.getSelection().addRange(o);const l=document.execCommand("copy");t.removeChild(e),console.log("Copy successful? = "+l)},n=()=>{let e=document.title,n=document.URL;const c={":":":","\\[":"[","\\]":"]","\\|":"|"};for(let n in c)e=e.replace(new RegExp(n,"g"),c[n]);return e+"\n"+n+"\n\n"};e()})();
タイトルとURLのコピーしてscrapboxのリンク記法に整形するブックマークレット 2022-02-21javascript:(()=>{const e=()=>{const e=document.createElement("div"),c=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/ /g," ").replace(/\n/g,"<br>");e.innerHTML=c(n());const t=document.getElementsByTagName("body")[0];t.appendChild(e);const o=document.createRange();o.selectNode(e),window.getSelection().removeAllRanges(),window.getSelection().addRange(o);const l=document.execCommand("copy");t.removeChild(e),console.log("Copy successful? = "+l)},n=()=>{let e=document.title,n=document.URL;const c={":":":","\\[":"[","\\]":"]","\\|":"|"};for(let n in c)e=e.replace(new RegExp(n,"g"),c[n]);return "["+e+" "+n+"]"};e()})();
ーーーー
旧版
タイトルとURLのコピーをするブックマークレット2021-03-27javascript:var global=window;global.COPY_TO_CLIPBOARD=global.COPY_TO_CLIPBOARD||{};global.COPY_TO_CLIPBOARD.getUrlInfo=function(){var a=new String(document.title);a.allReplace=function(a){var b=this,c;for(c in a)b=b.replace(new RegExp(c,"g"),a[c]);return b}.bind(a);return a.allReplace({":":"\uff1a","\\[":"\uff3b","\\]":"\uff3d"})+"\n"+document.URL};global.COPY_TO_CLIPBOARD.copyToClipboard=function(){var a=document.createElement("textarea");a.textContent=this.getUrlInfo();var d=document.getElementsByTagName("body")[0];d.appendChild(a);a.select();var b=document.execCommand("copy");d.removeChild(a);return b};global.COPY_TO_CLIPBOARD.copyToClipboard();
タイトルとURLのコピーしてscrapboxのリンク記法に整形するブックマークレット2021-03-27javascript:var global=window;global.COPY_TO_CLIPBOARD=global.COPY_TO_CLIPBOARD||{};global.COPY_TO_CLIPBOARD.getUrlInfo=function(){var a=new String(document.title);a.allReplace=function(a){var b=this,c;for(c in a)b=b.replace(new RegExp(c,"g"),a[c]);return b}.bind(a);return "["+a.allReplace({":":"\uff1a","\\[":"\uff3b","\\]":"\uff3d"})+" "+document.URL+"]"};global.COPY_TO_CLIPBOARD.copyToClipboard=function(){var a=document.createElement("textarea");a.textContent=this.getUrlInfo();var d=document.getElementsByTagName("body")[0];d.appendChild(a);a.select();var b=document.execCommand("copy");d.removeChild(a);return b};global.COPY_TO_CLIPBOARD.copyToClipboard();
WebページのタイトルとURLをワンクリックでコピーするBookmarklet - Qiita
>
2022/02/13
TwitterでタイトルとURLのコピーをするブックマークレットが動作しない
他のページでは問題なく動作する
Qiitaで質問してみた
>WebページのタイトルとURLをワンクリックでコピーするBookmarklet - Qiita
>ScrapboxでURL貼り付けたらページタイトルでリンク化される機能がなくなったと思ったら,Ctrl+Shift+Vでできるんですね.裏技っぽくて良い.ちなみにtwitterのツイートだとツイート内容も埋め込めてすばらしい.
以下の方法の方がいい感じ
結局これで対応している
これも試してみたい
>PC版Chromeのアドレスバーにある「このページを共有」→「共有するリンク」→「Twitter」の動作が欲しかった機能に近い
>今までブックマーク追加ボタンでページタイトルをコピー・アドレスバー右クリックでURLコピーして貼り付けてたけど、これならツイート欄で半角スペースを改行に置き換えで済む
2022/02/22 Twitterで動作しないのを修正対応頂いた
>
不具合の報告だけでも貢献できることが嬉しい感覚がある
プルリクエスト的な感覚,コミュニティへの
貢献の面白さを感じられた
ただし,googlepodcastで動作しなくなっている...
googledriveでも動作しない
google系と相性が悪そう
spotifyでも動作しない
ーーーー
#023 NARUTOへの愛を語ろう第二弾(後編) - 重箱の隅 Season2 | Spotify でポッドキャスト
2022/03/07
開いているWebページのタイトルとURLをクリップボードにコピーするブックマークレット(+ダイアログ版) - 晴歩雨描
ブックマークレット
javascript:(()=>{
const e=()=>{
const e=document.createElement("div"),
c=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/ /g," ").replace(/\n/g,"<br>");e.innerHTML=c(n());const t=document.getElementsByTagName("body")
0;t.appendChild(e);const o=document.createRange();o.selectNode(e),window.getSelection().removeAllRanges(),window.getSelection().addRange(o);const
l=document.execCommand("copy");t.removeChild(e),console.log("Copy successful? = "+l)},
n=()=>{let e=document.title,n=document.URL;const c={":":":","\\
":"[","\\":"]","\\|":"|"};for(let n in c)e=e.replace(new RegExp(n,"g"),c
n);return e+"\n"+n+"\n\n"};e()})();