codeをbookmarkletに変換する

a year ago

コードを urlencode して、その href をブックマークすればよさそう

実行後に code をクリックすればリンクを生成する

Array.from(document.querySelectorAll('code')).map(
  c =>
    (c.onclick = () => {
      a = document.createElement('a')
      a.innerText = new Date()
      a.href = 'javascript:' + encodeURIComponent(c.innerText)
      c.parentElement.appendChild(a)
    })
)