Greasy Fork

Greasy Fork is available in English.

Pixiv动图预览

在网页右侧显示预览图(非动图适用),分辨率低慎用。

当前为 2017-06-19 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Pixiv动图预览
// @namespace    
// @version      0.1
// @description  在网页右侧显示预览图(非动图适用),分辨率低慎用。
// @author       Ocrosoft
// @match        https://www.pixiv.net/search.php*
// @match        https://www.pixiv.net/member_illust.php*
// @grant        none
// @require      http://code.jquery.com/jquery-2.1.4.min.js
// ==/UserScript==

function addSidePreview() {
    'use strict';
    try{$($('.popular-introduction-block')[0].parentNode).remove();}catch(e){}
    var d=document.createElement('div');
    d.id="preview_div";
    $(d).css({"right":"0px","position":"fixed","top":"0px","width":"25%","height":"100%"});
    //d.innerHTML='<iframe style="width:100%;height:100%;"></iframe>';
    $('body').append(d);
    //https://www.pixiv.net/member_illust.php?mode=medium&illust_id=62814980
    $('._layout-thumbnail').mouseenter(function(){
        //console.log($(this.children[0]).attr('data-id'));
        var ifr=document.createElement('iframe');
        $(ifr).css({'width':'100%','height':'100%'});
        ifr.src='https://www.pixiv.net/member_illust.php?mode=medium&illust_id='+$(this.children[0]).attr('data-id')+'#preview';
        $('#preview_div').children().remove();
        $('#preview_div').append(ifr);
    });
    $('._layout-thumbnail').addClass('prev');
}

function clearOtherElements(){
    if(location.href.indexOf('#preview')==-1)return;
    $('body').append($('.works_display')[0]);
    $('body').children().each(function(i,d){
        if(!$(d).hasClass('works_display'))d.remove();
    });
    /*var c=$('body').children();
    c.each(function(i,d){
        if(d.id!='wrapper')d.remove();
        else{
            $(d).children().each(function(j,e){
                if(!$(e).hasClass('layout-a'))e.remove();
                else{
                    $('.layout-column-1').remove();
                }
            });
        }
    });
    c=$('.layout-column-2').children();
    c.each(function(i,d){
        if(!$(d).hasClass('_unit'))d.remove();
        else{
            $(d).children().each(function(j,e){
                if(!$(e).hasClass('works_display'))e.remove();
            });
        }
    });*/
    //$('body').css('display','');
}

if(location.href.indexOf('search.php')!=-1){
    setInterval(function(){
        if(!$('._layout-thumbnail').hasClass('prev'))addSidePreview();
    },500);
}
if(location.href.indexOf('member_illust.php')!=-1){
    //$('body').css('display','none');
    $('document').ready(clearOtherElements());
}