Greasy Fork

A岛黎明版图片重定向至原图

仅适合A岛黎明版

目前为 2018-08-15 提交的版本。查看 最新版本

// ==UserScript==
// @name         A岛黎明版图片重定向至原图
// @namespace    zhihaofans
// @version      0.0.1
// @description  仅适合A岛黎明版
// @author       zhihaofans
// @match        http://adnmb1.com/t/*
// @match        http://adnmb1.com/f/*
// @require      https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js
// @grant        Apache-2.0
// ==/UserScript==
(function () {
    jQuery.noConflict();
    function init() {
        var imgs = jQuery("a.h-threads-img-a");
        console.log(imgs.length);
        for (var a = 0; a < imgs.length; a++) {
            var link = jQuery(imgs.get(a));
            console.log(link);
            link.attr("href", link.attr("href").replace("http://", "https://"));
            var img = link.find("img.h-threads-img");
            var imageFullUrl = img.attr("data-src").replace("http://nmbimg.fastmirror.org/thumb/", "http://nmbimg.fastmirror.org/image/").replace("http://", "https://");
            img.attr("data-src", imageFullUrl);
            img.attr("src", imageFullUrl);
        }
    };
    jQuery(document).ready(function () {
        init();
    });
})();