豆瓣高清图-douban high resolution image

可以在豆瓣小组列表页面快速预览帖子内容,无须再打开新窗口

当前为 2018-06-12 提交的版本,查看 最新版本

// ==UserScript==
// @name         豆瓣高清图-douban high resolution image
// @namespace    https://github.com/DragonCat1
// @version      0.2
// @license      MIT
// @description  可以在豆瓣小组列表页面快速预览帖子内容,无须再打开新窗口
// @author       铛铛铛铛铛/https://www.douban.com/people/48915223
// @copyright    1991-2018,铛铛铛铛铛-Dragoncat
// @match        https://www.douban.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const style = document.createElement("style")
    style.innerHTML = `
.doumail-list li,.status-item,.obu dt,#comments,.comment-item,.user-face{
overflow: visible!important;
}

.uhead-wrap{
position: relative;
}
.raw-uhead{
visibility: hidden;
position: absolute;
transition: all 0.1s;
z-index: 1;
opacity: 0;
width: auto!important;
height: auto!important;
top:0;
left:0;
}
.uhead-wrap:hover .raw-uhead{
transition: all 0.1s 0.15s;
visibility: visible;
opacity: 1;
}

`
    document.head.appendChild(style)
    const imgs =document.querySelectorAll("img")
    imgs.forEach((img)=>{
        if(/https:\/\/img\d\.doubanio\.com\/icon\/u[a-z]?\d+-\d+\.jpg/.test(img.src)){
            let rpic=img.src.replace(/^(https:\/\/img\d\.doubanio\.com\/icon\/u)[a-z]?(\d+-\d+)(\.jpg)$/,'$1r$2$3')
            img.outerHTML=`<div class="uhead-wrap">${img.outerHTML}<img class="raw-uhead" src="${rpic}" alt="无大图"/></div>`
        }
        else{
            img.src=img.src.replace(/^(https:\/\/img\d\.doubanio\.com\/view\/(group_topic|photo|richtext)\/)(.+)(\/public\/.+\..+)$/,'$1raw$4')
        }
    })
})();

QingJ © 2025

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