<?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/LLxyo/rss">
    <link>https://let.hatelabo.jp/LLxyo/rss</link>
    <description></description>
    <title>Bookmarklets from LLxyo</title>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="https://let.hatelabo.jp/LLxyo/let/hJmc-o62n5FZ"/>
      </rdf:Seq>
    </items>
  </channel>
  <item rdf:about="https://let.hatelabo.jp/LLxyo/let/hJmc-o62n5FZ">
    <link>https://let.hatelabo.jp/LLxyo/let/hJmc-o62n5FZ</link>
    <dc:date>2018-06-05T17:02:55Z</dc:date>
    <description>カードの祖先一覧を表示します。</description>
    <dc:creator>LLxyo</dc:creator>
    <title>[Let] [Crypko]祖先辿り</title>
    <content:encoded>&lt;a href="javascript:void%28async%28w%3D512%2Cm%3Dw%3E%3E3%2CD%3Ddocument%2C%24%3D%28q%3D%3ED.querySelector%28q%29%29%2CE%3D%28%28n%2Ca%3D%7B%7D%2Cc%3D%5B%5D%29%3D%3E%28n%3DObject.assign%28D.createElement%28n%29%2Ca%29%2Cc.forEach%28%28e%3D%3En.appendChild%28e%29%29%29%2Cn%29%29%2Cq%3D%7B%7D%2Ct%3D%5B%5B%28location.hash.match%28%2Fcard%5C%2F%28%5Cd%2B%29%24%2F%29%7C%7C%5B%5D%29%5B1%5D%5D%5D%2Cg%2Ci%2Cl%2Cd%2Cp%2Cn%29%3D%3E%7Bif%28t%5B0%5D%5B0%5D%29%7B%24%28%27%23ancestors-css%27%29%7C%7CD.head.appendChild%28E%28%27style%27%2C%7Bid%3A%27ancestors-css%27%2CtextContent%3A%60%5Cn%23ancestors%20%7B%20width%3A%20%24%7Bw%7Dpx%3B%20margin%3A%200%20auto%3B%20%7D%5Cn%23ancestors%3Ediv%20%7B%20width%3A%20100%25%20%7D%5Cn%23ancestors%3Ediv%3Ediv%20%7B%20position%3A%20relative%3B%20display%3A%20inline-block%3B%20%7D%5Cn%23ancestors%3Ediv%3Ediv%3Eimg%20%7B%20position%3A%20absolute%3B%20transition-duration%3A%200.5s%3B%20%7D%5Cn%23ancestors%3Ediv%3Ediv%3Eimg%3Ahover%20%7B%20z-index%3A%2099%3B%20width%3A%20256px%3B%20%7D%5Cn%60%7D%29%29%3B%24%28%27.info-card%27%29.before%28E%28%27div%27%2C%7Bid%3A%27ancestors%27%7D%2C%5Bn%3DE%28%27div%27%29%5D%29%29%3Bfor%28i%3D1%3Bi%3Cm%3Bi%2B%2B%29%7Bg%3Di.toString%282%29.length%3Bl%3Di-%281%3C%3Cg-1%29%3Bd%3Dt%5Bg-1%5D%5Bl%5D%3Bp%3D%5B0%2C0%5D%3Bif%28d%26%26%21q%5Bd%5D%29await%20fetch%28%60https%3A%2F%2Fapi.crypko.ai%2Fcrypkos%2F%24%7Bd%7D%2Fdetail%60%29.then%28%28r%3D%3Er.json%28%29%29%29.catch%28console.error%29.then%28%28j%3D%3E%7Bconsole.log%28q%5Bd%5D%3Dj%29%3Bn.textContent%3D%60%E8%AA%AD%E3%81%BF%E8%BE%BC%E3%81%BF%E4%B8%AD%E2%80%A6%20%23%24%7Bj.id%7D%60%7D%29%29%3Bif%28q%5Bd%5D%29%7Bp%3D%5Bq%5Bd%5D.matronId%2Cq%5Bd%5D.sireId%5D%3Bawait%20crypto.subtle.digest%28%7Bname%3A%27SHA-1%27%7D%2CUint8Array.from%28%5B...%60%24%7Bq%5Bd%5D.noise%7Dasdasd3edwasd%24%7Bq%5Bd%5D.attrs%7D%60%5D.map%28%28c%3D%3Ec.charCodeAt%28%29%29%29%29%29.then%28%28h%3D%3Eq%5Bd%5D.img%3DArray.from%28new%20Uint8Array%28h%29%29.map%28%28c%3D%3Ec.toString%2816%29.padStart%282%2C%270%27%29%29%29.join%28%27%27%29%29%29%7Dif%28%21t%5Bg%5D%29t%5Bg%5D%3D%5B%5D%3B%5Bt%5Bg%5D%5Bl%2A2%5D%2Ct%5Bg%5D%5Bl%2A2%2B1%5D%5D%3Dp%7Dconsole.log%28t%2Cq%29%3Bt.filter%28%28b%3D%3Eb.some%28%28d%3D%3Ed%29%29%29%29.forEach%28%28b%3D%3En.before%28n%3DE%28%27div%27%2C%7B%7D%2Cb.map%28%28%28d%2Ci%2Ca%29%3D%3EE%28%27div%27%2C%7Bstyle%3A%60width%3A%20%24%7Bw%2Fa.length%7Dpx%3B%20height%3A%20%24%7Bw%2Fa.length%7Dpx%3B%60%7D%2Cq%5Bd%5D%3F%5BE%28%27img%27%2C%7Bsrc%3A%60https%3A%2F%2Fimg.crypko.ai%2Fdaisy%2F%24%7Bq%5Bd%5D.img%7D_lg.jpg%60%2Cwidth%3Aw%2Fa.length%2Ctitle%3A%60Iter%20%24%7Bq%5Bd%5D.iteration%7D%20%C2%B7%20%24%7Bq%5Bd%5D.name%3Fq%5Bd%5D.name%3A%27%27%7D%23%24%7Bq%5Bd%5D.id%7D%60%2Conclick%3Ae%3D%3Ewindow.open%28%27https%3A%2F%2Fcrypko.ai%2F%23%2Fcard%2F%27%2Be.target.title.split%28%27%23%27%29.pop%28%29%2C%27_blank%27%29%7D%29%5D%3A%5B%5D%29%29%29%29%29%29%29%3Bn.parentNode.lastChild.remove%28%29%7D%7D%29%28%29%3B"&gt;[Crypko]祖先辿り&lt;/a&gt;&lt;pre&gt;/*
 * @title [Crypko]祖先辿り
 * @description カードの祖先一覧を表示します。
 * @include https://crypko.ai/#/card/*
 * @license MIT License
 * @javascript_url
 */

void (async (
 w = 512,
 m = w &amp;gt;&amp;gt; 3, // w だけにするとめいっぱい（9世代前まで）読み込む
 D = document,
 $ = q =&amp;gt; D.querySelector(q),
 E = (n, a = {}, c = []) =&amp;gt; ((n = Object.assign(D.createElement(n), a)), c.forEach(e =&amp;gt; n.appendChild(e)), n),
 q = {},
 t = [[(location.hash.match(/card\/(\d+)$/) || [])[1]]],
 g, i, l, d, p, n
) =&amp;gt; { if (t[0][0]) {

	$('#ancestors-css') || D.head.appendChild(E('style', { id: 'ancestors-css', textContent: `
#ancestors { width: ${w}px; margin: 0 auto; }
#ancestors&amp;gt;div { width: 100% }
#ancestors&amp;gt;div&amp;gt;div { position: relative; display: inline-block; }
#ancestors&amp;gt;div&amp;gt;div&amp;gt;img { position: absolute; transition-duration: 0.5s; }
#ancestors&amp;gt;div&amp;gt;div&amp;gt;img:hover { z-index: 99; width: 256px; }
` }));

	$('.info-card').before(E('div', { id: 'ancestors' }, [n = E('div')]));

	for (i = 1; i &amp;lt; m ; i++) {

		g = i.toString(2).length;
		l = i - (1 &amp;lt;&amp;lt; g - 1);
		d = t[g - 1][l];
		p = [0, 0];

		if (d &amp;amp;&amp;amp; !q[d]) await fetch(`https:\u002F\u002Fapi.crypko.ai/crypkos/${d}/detail`)
		 .then(r =&amp;gt; r.json()).catch(console.error).then(j =&amp;gt; {
			console.log(q[d] = j);
			n.textContent = `読み込み中… #${j.id}`;
		 });

		if (q[d]) {

			p = [q[d].matronId, q[d].sireId];

			// 参考: https://github.com/yuntan/crypkograph/blob/514e71daa5839a4a8f7e2f0c53750843c5d9225a/crypkograph.py#L70
			await crypto.subtle.digest({ name: 'SHA-1' }, 
			 Uint8Array.from([...`${q[d].noise}asdasd3edwasd${q[d].attrs}`]
			  .map(c =&amp;gt; c.charCodeAt()))
			).then(h =&amp;gt; 
			 (q[d].img = Array.from(new Uint8Array(h))
			 .map(c =&amp;gt; c.toString(16).padStart(2, '0')).join(''))
			);

		}

		if (!t[g]) t[g] = [];
		[t[g][l * 2], t[g][l * 2 + 1]] = p;

	}

	console.log(t,q);

	t.filter(b =&amp;gt; b.some(d =&amp;gt; d)).forEach(b =&amp;gt; n.before(n = 
	 E('div', {},
	  b.map((d, i, a) =&amp;gt; E('div', { style: `width: ${w / a.length}px; height: ${w / a.length}px;` },
	   (q[d] ? [E('img', {
	    src: `https:\u002F\u002Fimg.crypko.ai/daisy/${q[d].img}_lg.jpg`,
	    width: w / a.length,
	    title: `Iter ${q[d].iteration} · ${q[d].name ? q[d].name : ''}#${q[d].id}`,
	    onclick: e =&amp;gt; window.open('https://crypko.ai/#/card/' + e.target.title.split('#').pop(), '_blank')
	   })] : [])
	  ))
	 )
	));

	n.parentNode.lastChild.remove();

} })();

&lt;/pre&gt;</content:encoded>
  </item>
</rdf:RDF>
