あぷサムネ表示 [仮]

あぷ/あぷ小の一覧表示にサムネイルを追加します

目前为 2021-08-29 提交的版本。查看 最新版本

// ==UserScript==
// @name         あぷサムネ表示 [仮]
// @description  あぷ/あぷ小の一覧表示にサムネイルを追加します
// @version      1.1
// @match        https://dec.2chan.net/up/*.htm
// @match        https://dec.2chan.net/up2/*.htm
// @icon         https://www.google.com/s2/favicons?domain=2chan.net
// @grant        none
// @namespace    https://gf.qytechs.cn/users/809755
// ==/UserScript==

/* jshint esversion: 6 */

(function() {
  'use strict';
  [...document.querySelectorAll('a[href*="src/"]')].forEach(a => {
    const href = a.href;
    if (!/\.(bmp|gif|jpe?g|png|webp)$/i.test(href)) return;
    const parent = a.parentNode;
    const tmp = new URL(href);
    const src = `${tmp.origin.replace(/\./g,'-')}.cdn.ampproject.org/ii/w72/s/${tmp.host}${tmp.pathname}`;
    const br = document.createElement('br');
    const img = document.createElement('img');
    img.src = src;
    img.height = 72;
    img.style.maxWidth = "256px";
    img.className = 'lazyload';
    a.insertBefore(br, null);
    a.insertBefore(img, null);
  })
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址