Greasy Fork

Greasy Fork is available in English.

pixivの作品一覧をトリミングせずに表示

pixivのプロフィール画面(ユーザーのイラストやマンガが一覧表示される画面)と、作品画面の下に表示される作者の作品一覧内の作品が、正方形にトリミングされて表示されるのを防止します。

< 脚本pixivの作品一覧をトリミングせずに表示的反馈

提问/评论

§
发表于:2019-03-01
编辑于:2019-03-02

suggestion

you can use

let elementClassName=`[width="184"] [style^='background-image: url("https://i.pximg.net/c/']`;

instead of let elementClassName="*constantly changing class*";

i also made some more changes:

// @grant        GM_addStyle
// ==/UserScript==
'use strict';

GM_addStyle(`[width="184"] [style^='background-image: url("https://i.pximg.net/c/'] { background-size: contain !important; }`);

setInterval(function(){
    let array = document.querySelectorAll(`[width="184"] [style^='background-image: url("https://i.pximg.net/c/']:not(.changed)`);
    for (let i = array.length; i--;) {
        array[i].style.backgroundImage = array[i].style.backgroundImage.replace(/\d{3}x\d{3}_.+?\//, '240x240/').replace('square1200', 'master1200');
        array[i].classList.add('changed');
    }
}, 500);

Patriot作者
§
发表于:2019-03-05

Your suggestion looks very nice.👍 I'll test your script for something problems. If there is no problems, I'll merge your script into this script and will write your name on Credits with special thank. Thank you!

Patriot作者
§
发表于:2019-03-07

Your suggestion has merged. You can see it in the script page.

发表回复

登录以发表回复