图集岛图片换源、图集页面显示小图

图集岛图片换源,图集页面显示小图

// ==UserScript==
// @name         图集岛图片换源、图集页面显示小图
// @author       Ninkror
// @namespace    Ninkror
// @version      1.1
// @description  图集岛图片换源,图集页面显示小图
// @include      /https://www\.tujidao[0-9]*\.com/
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_registerMenuCommand
// @require      https://greasyfork.org/scripts/463455-nelementgetter/code/NElementGetter.js?version=1172110
// @license      GPL
// ==/UserScript==
GM_addStyle(`
    #kbox {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        align-content: space-between;
    }
    #kbox > img {
            max-width: 15% !important;
        margin-bottom: 25px;
    }
`);

const srcList = [
    'pic.sqmuying.com',
    'tjg.sqmuying.com',
    'pic.gzhuibei.com',
    'tjg.gzhuibei.com',
    'picew6d4ew.82pic.com',
    'tjgew6d4ew.82pic.com'
];

const nowSrc = GM_getValue('src');
new ElementGetter().each('img', document, (img) => {
    img.src = img.src.replace(/https:\/\/[^/]+/, 'https://' + nowSrc)
});

srcList.forEach((item) => {
    GM_registerMenuCommand(`----${item == nowSrc ? '✅' : '❌'}${item}`, function () {
        GM_setValue('src', item);
        window.location.reload();
    });
});