IMDB bigger thumbnails/images/poster

edits image url to get the full size picture and increases poster size

当前为 2021-07-29 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         IMDB bigger thumbnails/images/poster
// @namespace    https://greasyfork.org/en/users/12725-alistair1231
// @version      0.2.5
// @description  edits image url to get the full size picture and increases poster size
// @author       Alistair1231
// @match        https://www.imdb.com/*
// @icon         https://www.google.com/s2/favicons?domain=imdb.com
// @grant        none
// @license GPL-3.0
// ==/UserScript==
function makeMods(x, late) {
    if (x.flag == null)
        x.flag = 0;
    if (late == false) {
        if (x.flag != 2) {
            try {
                // let path = window.location.pathname.split('/');
                // // if on search page
                // if(path[1]=="find")

                let scale = 140 / x.width;
                x.width *= scale;
                x.height *= scale;
                if (x.height >= 208)
                    x.height = 208;
                // crop instead of stretch
                x.setAttribute("style", "object-fit: cover;");
                let match = x.src.match(/https:\/\/m\.media-amazon\.com\/images\/[MS]\/[^\.]+\._V\d_/);
                if (match != null)
                    x.src = match[0] + ".jpg";
                // x.src = x.src.match(/https:\/\/m\.media-amazon\.com\/images\/[MS]\/[^\.]+/)[0] + ".UY220_CR160,220_AL_.jpg";
                x.flag++;

            } catch (e) { }
        }
    }
    else if (late == true) {
        try {
            let scale = 80 / x.width;
            x.width *= scale;
            x.height *= scale;
            // crop instead of stretch
            x.setAttribute("style", "object-fit: cover;");
            let match = x.src.match(/https:\/\/m\.media-amazon\.com\/images\/[MS]\/[^\.]+\._V\d_/);
            if (match != null)
                x.src = match[0] + ".jpg";
        } catch (e) { }
    }
}
function run() {

    // for sites like popular movies
    // https://www.imdb.com/chart/moviemeter/
    Array.from(document.querySelectorAll(".posterColumn a img")).map(x => makeMods(x, false));
    // for sites like search
    // https://www.imdb.com/find?q=invin
    Array.from(document.querySelectorAll(".primary_photo a img")).map(x => makeMods(x, false));
    // actor images
    Array.from(document.querySelectorAll(".loadlate")).map(x => makeMods(x, true));
    setTimeout(run, 2000);
}


(function () {
    run();
})();