Greasy Fork

Greasy Fork is available in English.

巴哈縮圖和勇造縮圖

狗才用預設縮圖= =

当前为 2019-04-16 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         巴哈縮圖和勇造縮圖
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  狗才用預設縮圖= =
// @author       SmallYue1
// @match        https://forum.gamer.com.tw/B.php*
// ==/UserScript==
var Match, Match_Div, Popularity, User, User_LowerCase, Time, Tempt;

function Find_And_Change()
{
    Match = document.getElementsByTagName('tr');
    for(var i = 0; i < Match.length; i++)
    {
        if(Match[i].className.indexOf('b-list__head') != -1)
        {
            for(var j = Match[i].children.length-1; j >0 ; j--)
            {
                Match[i].removeChild(Match[i].children[j]);
            }
        }
        if(Match[i].className.indexOf('b-list__row') != -1)
        {
            if(Match[i].children.length > 2)
            {
                User = Match[i].children[2].children[1].innerText;
                User_LowerCase = User.toLowerCase();
                Time = Match[i].children[3].children[0].innerText;
                Popularity = Match[i].children[2].children[0].innerText
                var NodeImg = document.createElement('img');
                var Node_Div_Img = document.createElement('div');
                var Node_A_Div_Img = document.createElement('a');
                var NodeP_A_Div_Img_User_NodeTime_NodePopularity = document.createElement('p');
                var Node_Div_Img_User_NodeTime_NodePopularity = document.createElement('div');
                var NodeTime = document.createElement('p');
                var NodePopularity = document.createElement('p');
                NodeImg.setAttribute("src", "https://avatar2.bahamut.com.tw/avataruserpic/"+User_LowerCase.split("")[0]+"/"+User_LowerCase.split("")[1]+"/"+User_LowerCase+"/"+User_LowerCase+"_s.png");
                Node_Div_Img.appendChild(NodeImg);
                Node_Div_Img.setAttribute("class", "nav-member_imgbox")
                Node_A_Div_Img.appendChild(Node_Div_Img);
                Node_A_Div_Img.append(User);
                Node_A_Div_Img.setAttribute("class", "topbar_member-home")
                Node_A_Div_Img.setAttribute("href", "https://home.gamer.com.tw/homeindex.php?owner="+User);
                Node_A_Div_Img.setAttribute("target", "_blank");
                NodeTime.appendChild(document.createElement('br'));
                NodeTime.append(" "+Time);
                NodeTime.setAttribute("style", "font-size: 13px");
                NodePopularity.append("互動: "+Popularity.split("/")[0]+" 人氣:"+Popularity.split("/")[1]);
                NodePopularity.setAttribute("style", "font-size: 11px; color:gray;");
                NodeP_A_Div_Img_User_NodeTime_NodePopularity.appendChild(Node_A_Div_Img);
                NodeP_A_Div_Img_User_NodeTime_NodePopularity.appendChild(NodeTime);
                NodeP_A_Div_Img_User_NodeTime_NodePopularity.appendChild(NodePopularity);
                NodeP_A_Div_Img_User_NodeTime_NodePopularity.setAttribute("class","b-list__count__user");
                NodeP_A_Div_Img_User_NodeTime_NodePopularity.setAttribute("style","width:100%;text-align:center;vertical-align:middle;display:inline-block;");
                Node_Div_Img_User_NodeTime_NodePopularity.appendChild(NodeP_A_Div_Img_User_NodeTime_NodePopularity);
                Node_Div_Img_User_NodeTime_NodePopularity.setAttribute("class","TOP-my");
                Node_Div_Img_User_NodeTime_NodePopularity.setAttribute("style","float:left;width:25%;");

                for(j = Match[i].children.length-1; j >1 ; j--)
                {
                    Match[i].removeChild(Match[i].children[j]);
                }
                if((Match[i].className.indexOf('b-imglist-item') != -1)&&(Match[i].children[1].children.length >1))
                {
                    Tempt = Match[i].children[1].children[0].outerHTML;
                    Match[i].children[1].children[0].outerHTML = Match[i].children[1].children[1].outerHTML;
                    Match[i].children[1].children[1].outerHTML = Tempt;
                    //Match[i].children[1].children[1].outerHTML = Match[i].children[1].children[1].children[0].dataset.thumbnail;
                }
                Match[i].children[1].prepend(Node_Div_Img_User_NodeTime_NodePopularity);
                if(Match[i].className.indexOf('b-imglist-item') != -1)
                {
                    Match[i].children[1].children[0].setAttribute("style","float:left;width:25%;"+"padding-top:"+((Match[i].children[1].offsetHeight/2)-(Match[i].children[1].children[0].offsetHeight/1.5))+"px;");
                }
                else
                {
                    Match[i].children[1].children[0].setAttribute("style","float:left;width:18%;"+"padding-top:"+((Match[i].children[1].offsetHeight/2)-(Match[i].children[1].children[0].offsetHeight/1.5))+"px;");
                }
            }
        }
    }
}

function CheckImage()
{
    Match_Div = document.getElementsByTagName('div');
    for(var i = 0; i < Match_Div.length; i++)
    {
        if(Match_Div[i].className.indexOf('skeleton') != -1)
        {
            if(Match_Div[i].style.length == 0)
            {
                Match_Div[i].style = 'background-image: url("'+Match_Div[i].dataset.thumbnail+'");';
                Match_Div[i].className = 'b-list__img';
            }
        }
    }
}

(function() {
    'use strict';
    setInterval(Find_And_Change,100);
    setInterval(CheckImage,1000);
    // Your code here...
})();