javlibrary封面大图

封面大图简易版

目前為 2021-05-20 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         javlibrary封面大图
// @namespace    http://tampermonkey.net/
// @version      2021.05.20
// @description  封面大图简易版
// @author       kygo233
// @include      *javlibrary.com/*
// @match        http://testjav.com/javlibrary.html
// @grant        GM_addStyle

// ==/UserScript==

(function() {
    'use strict';
    function addStyle(){
        let style= `
div.videos{
    display:flex;
    flex-direction:row;
    flex-wrap:wrap;
}
div.videos div.video{
    padding:5px;
    width: 33% !important;
    height: auto !important;
    margin : 0 !important;
    box-sizing: border-box;
}
.img100{
    width: 100% ;
    height: auto;
}
div.videos div.video .title{
   float: inherit !important;
   width: auto !important;
}
       `;
        GM_addStyle(style);
    }
    function replaceSrc(){
        let elems = $('div.videos div.video');
        for (let i = 0; i < elems.length; i++) {
            let img = elems.eq(i).find("img")[0];
            if(img.src.indexOf("pixhost")>=0) {
              continue;
            };
            let src = img.src.replace(/ps.jpg/, "pl.jpg");
            let bigimg = new Image();
            bigimg.src = src;
            $(bigimg).addClass("img100");
            $(img).before(bigimg);
            img.remove();
        }
    }
    addStyle();
    let url_list =['/tw/','/en/','/ja/','/zh/'];
    if( url_list.indexOf(location.pathname)>=0){
        $(`div.videothumblist`).attr("style","");
        replaceSrc();
    }else{
        const targetNode = document.getElementsByClassName("videos")[0];
        if(targetNode){
            const config = { childList: true};
            const callback = function(mutationsList, observer) {
                mutationsList.forEach(function(mutation) {
                    if(mutation.addedNodes.length>0){
                        replaceSrc();
                        console.log("replaceSrc");
                        observer.disconnect();
                    }
                });
            };
            const observer = new MutationObserver(callback);
            observer.observe(targetNode, config);
        }
    }
})();