// ==UserScript== // @name 巴哈縮圖和勇造縮圖 // @namespace http://tampermonkey.net/ // @version 0.2 // @description 狗才用預設縮圖= = // @author SmallYue1 // @match https://forum.gamer.com.tw/B.php* // @downloadURL none // ==/UserScript== function Find_And_Change() { var Match, Popularity, User, User_LowerCase, Time, Tempt; 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"); 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].prepend(Node_Div_Img_User_NodeTime_NodePopularity); Match[i].children[1].className=""; Match[i].children[1].setAttribute('class','IdCard'); if(Match[i].className.indexOf('b-imglist-item') != -1) { Match[i].children[1].children[1].className=""; Match[i].children[1].children[1].setAttribute('style','display:block;margin-top:5px'); } if(Match[i].children[1].children[1].childElementCount > 1) { Match[i].children[1].children[1].children[1].setAttribute('style','padding:5px;padding-bottom:0px;margin-right:20px;'); } if(Match[i].children[1].childElementCount > 2) { Match[i].children[1].children[2].setAttribute('style','margin-top:5px;margin-bottom:8px'); } if(Match[i].children[0].children[2] == null) { var Node_Span = document.createElement('span'); Node_Span.setAttribute('class','b-list__summary__gp b-gp b-gp--normal'); Node_Span.append("0"); Match[i].children[0].appendChild(Node_Span); } } } } var Match_Id = document.getElementsByTagName('td'); for(i = 0; i < Match_Id.length; i++) { if(Match_Id[i].className.indexOf("IdCard") != -1) { Match_Id[i].children[0].setAttribute("style","float:left;width:160px;margin-top:5px;margin-bottom:5px;padding-top:"+((Match_Id[i].offsetHeight/2)-(Match_Id[i].children[0].offsetHeight/2))+"px;"); Match_Id[i].setAttribute('class','Setted'); } } var Match_Div = document.getElementsByTagName('div'); for(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); // Your code here... })();