var ThreadFileList = class ThreadFileList { static default_css = ` .thread_file_list { border: 2px solid; border-radius: 10px; padding: 5px; margin: 5px; overflow: scroll; height: 90vh; width: 90vw; background: #8882; resize: both; } .thread_file_list:hover { background: radial-gradient(#fff0, #8881); } `; static list_post_images() { return Array.from(document.getElementsByClassName('post-image')); }; static get_src_by_post_image(post_image) { const p = post_image.parentElement.parentElement; const q = p.querySelector('.fileinfo > a'); if (q === null) { return null; // 削除されたファイルの場合にここに来る }; return q.href; }; static create_list() { const o = []; for (const post_image of ThreadFileList.list_post_images()) { const src = ThreadFileList.get_src_by_post_image(post_image); if (src === null) { continue; }; o.push({ 'src': src, 'thumb': post_image.src }); }; return o; }; static setup_image_list() { // この関数は1ページ1回だけ const style = document.createElement('STYLE'); style.innerHTML = ThreadFileList.default_css; const div = document.createElement('DIV'); div.className = 'thread_file_list'; const bottom = document.body.querySelector('body .bottom'); const list_src_thumb = ThreadFileList.create_list(); for (const o of list_src_thumb.reverse()) { const anchor = document.createElement('A'); const img = document.createElement('IMG'); img.src = o.thumb; anchor.href = o.src; anchor.appendChild(img); div.appendChild(anchor); }; document.head.appendChild(style); document.body.insertBefore(div, bottom); }; }; ThreadFileList.setup_image_list();