<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel rdf:about="https://let.hatelabo.jp/karubabu/rss">
    <link>https://let.hatelabo.jp/karubabu/rss</link>
    <description></description>
    <title>Bookmarklets from karubabu</title>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="https://let.hatelabo.jp/karubabu/let/hLHX6Lq7rZIn"/>
      </rdf:Seq>
    </items>
  </channel>
  <item rdf:about="https://let.hatelabo.jp/karubabu/let/hLHX6Lq7rZIn">
    <link>https://let.hatelabo.jp/karubabu/let/hLHX6Lq7rZIn</link>
    <dc:date>2017-10-22T10:36:06Z</dc:date>
    <description>w/ "{title} {url}" format. easy copyable title/url box; click to copy, double-click outer to close</description>
    <dc:creator>karubabu</dc:creator>
    <title>[Let] T/U box</title>
    <content:encoded>&lt;a href="javascript:%28%28%29%3D%3E%7B%27use%20strict%27%3Bconst%20canonical_base%3D%28document.querySelector%28%27head%20meta%5Bproperty%3D%22og%3Aurl%22%5D%5Bcontent%5D%27%29%7C%7C%7B%7D%29.content%7C%7C%28document.querySelector%28%27head%20link%5Brel%3D%22canonical%22%5D%5Bhref%5D%27%29%7C%7C%7B%7D%29.href%7C%7C%27%27%3Bconst%20prefix%3Dcanonical_base.startsWith%28%27%2F%27%29%3Flocation.origin%3A%27%27%3Bconst%20canonical%3Dcanonical_base%3Fprefix%2Bcanonical_base%2Blocation.hash%3Anull%3Bconst%20title%3Ddocument.title%3Bconst%20url%3D%21canonical%26%26location.href%7C%7Cnew%20URL%28canonical%29.pathname%3D%3D%3Dlocation.pathname%26%26canonical%7C%7Cconfirm%28%60%E6%AC%A1%E3%81%AEURL%E3%81%8Cmeta%E3%82%BF%E3%82%B0%E3%81%8B%E3%82%89%E8%A6%8B%E3%81%A4%E3%81%8B%E3%82%8A%E3%81%BE%E3%81%97%E3%81%9F%E3%81%8C%E3%80%81%E7%8F%BE%E5%9C%A8%E3%81%AEpath%E3%81%A8%E7%95%B0%E3%81%AA%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%5Cn%E3%82%AD%E3%83%A3%E3%83%B3%E3%82%BB%E3%83%AB%E3%82%92%E6%8A%BC%E3%81%99%E3%81%A8location.href%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%5Cn%24%7Bcanonical%7D%60%29%26%26canonical%7C%7Clocation.href%3Bconst%20box%3Ddocument.body.appendChild%28Object.assign%28document.createElement%28%27div%27%29%2C%7Bid%3A%27copy-buttons%27%2Cstyle%3A%60%5Cnbackground-color%3A%20white%3B%5Cnborder%3A%201px%20solid%20silver%3B%5Cnpadding%3A%201em%3B%5Cnposition%3A%20fixed%3B%5Cntop%3A%200%3B%5Cnleft%3A%200%3B%5Cnz-index%3A%20%24%7BNumber.MAX_SAFE_INTEGER%7C%7CNumber.MAX_VALUE%7D%3B%5Cn%60%7D%29%29%3Bconst%20onClose%3De%3D%3E%7Bbox.parentNode.removeChild%28box%29%3Bdocument.removeEventListener%28%27click%27%2ConClose%29%3Be.stopPropagation%28%29%7D%3Bbox.addEventListener%28%27click%27%2C%28e%3D%3Ee.stopPropagation%28%29%29%29%3Bbox.addEventListener%28%27dblclick%27%2ConClose%29%3Bdocument.addEventListener%28%27click%27%2ConClose%29%3B%5B%7Blabel%3A%27URL%27%2Cvalue%3Aurl%7D%2C%7Blabel%3A%27Title%27%2Cvalue%3Atitle%7D%2C%7Blabel%3A%27Title%20%2B%20URL%27%2Cvalue%3Atitle%2B%27%20%27%2Burl%7D%2C%7Blabel%3A%27HatenaSyntax%27%2Cvalue%3A%60%5B%24%7Burl%7D%3Atitle%3D%24%7Btitle%7D%5D%60%7D%2C%7Blabel%3A%27Markdown%27%2Cvalue%3A%60%5B%24%7Btitle%7D%5D%28%24%7Burl%7D%29%60%7D%5D.forEach%28%28%28%7Blabel%3Alabel%2Cvalue%3Avalue%7D%29%3D%3E%7Bbox.appendChild%28Object.assign%28document.createElement%28%27label%27%29%2C%7Bstyle%3A%60%5Cndisplay%3A%20block%3B%5Cncolor%3A%20black%3B%5Cnbackground-color%3A%20silver%3B%5Cntext-align%3A%20left%3B%5Cn%60%2CtextContent%3A%60%24%7Blabel%7D%3A%20%60%7D%29%29.appendChild%28Object.assign%28document.createElement%28%27input%27%29%2C%7Bstyle%3A%60%5Cncolor%3A%20black%3B%5Cnbackground-color%3A%20silver%3B%5Cnmargin%3A%200.5em%3B%5Cn%60%2Cvalue%3Avalue%7D%29%29.addEventListener%28%27click%27%2C%28e%3D%3E%7Be.target.select%28%29%3Bdocument.execCommand%28%27copy%27%29%3Be.stopPropagation%28%29%7D%29%29%7D%29%29%7D%29%28%29%3B"&gt;T/U box&lt;/a&gt;&lt;pre&gt;/*
 * @title T/U box
 * @description w/ &amp;quot;{title} {url}&amp;quot; format. easy copyable title/url box; click to copy, double-click outer to close
 * @include http://*
 * @include https://*
 * @contributor	pacochi	http://let.hatelabo.jp/pacochi/let/hJme3OvVzN41
 * @contributor noromanba http://let.hatelabo.jp/noromanba/let/hJme3Pyylqos
 * @license MIT License	https://opensource.org/licenses/MIT
 * @javascript_url
 */

/* modifications

* Show confirm dialog for doubtful URL
 (location.pushState/replace will cause mismatch between meta URLs and current URL)
* Fix copy format
* Add Title+URL format
* Append location.hash
* Avoid to use array for querySelector (for cloudflare rocket.js)
* Close on click anywhere
* support relative URL

*/

(() =&amp;gt; {
  'use strict';

  // https://gist.github.com/noromanba/d730ccf3ae5e6916cd60
  const canonical_base = 
        (document.querySelector('head meta[property=&amp;quot;og:url&amp;quot;][content]') || {}).content ||
        (document.querySelector('head link[rel=&amp;quot;canonical&amp;quot;][href]') || {}).href ||
        '';
  const prefix = canonical_base.startsWith('/') ? location.origin : '';
  const canonical = canonical_base ? prefix + canonical_base + location.hash : null;
  const title = document.title;
  
  const url =
        (!canonical &amp;amp;&amp;amp; location.href) ||
        (new URL(canonical).pathname === location.pathname &amp;amp;&amp;amp; canonical) ||
        (confirm(`次のURLがmetaタグから見つかりましたが、現在のpathと異なります。\nキャンセルを押すとlocation.hrefを使用します。\n${canonical}`) &amp;amp;&amp;amp; canonical) ||
        location.href;

  const box = document.body.appendChild(Object.assign(document.createElement('div'), {
    id: 'copy-buttons',
    style: `
background-color: white;
border: 1px solid silver;
padding: 1em;
position: fixed;
top: 0;
left: 0;
z-index: ${Number.MAX_SAFE_INTEGER || Number.MAX_VALUE};
`,
  }));
  const onClose = e =&amp;gt; {
    box.parentNode.removeChild(box);
    document.removeEventListener('click', onClose);
    e.stopPropagation();
  };
  
  box.addEventListener('click', e =&amp;gt; e.stopPropagation());
  box.addEventListener('dblclick', onClose);
  document.addEventListener('click', onClose);
  
  // TBD alignment
  [
    { label: 'URL', value: url },
    { label: 'Title', value: title },
    { label: 'Title + URL', value: title + ' ' + url },
    { label: 'HatenaSyntax', value: `[${url}:title=${title}]` },
    { label: 'Markdown', value: `[${title}](${url})` },
  ].forEach(({label, value}) =&amp;gt; {
    box.appendChild(Object.assign(document.createElement('label'), {
      style: `
display: block;
color: black;
background-color: silver;
text-align: left;
`,
      textContent: `${label}: `,
    })).appendChild(Object.assign(document.createElement('input'), {
      style: `
color: black;
background-color: silver;
margin: 0.5em;
`,
      value,
    })).addEventListener('click', e =&amp;gt; {
      e.target.select();
      document.execCommand('copy');
      e.stopPropagation();
    });
  });
})();
&lt;/pre&gt;</content:encoded>
  </item>
</rdf:RDF>
