巴哈姆特 - 高亮樓主

如題

Per 28-05-2023. Zie de nieuwste versie.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name         巴哈姆特 - 高亮樓主
// @description  如題
// @namespace    gamer_lz
// @author       Covenant
// @version      1.1.0.1
// @license      MIT
// @homepage
// @match        https://forum.gamer.com.tw/C.php?*
// @match        https://forum.gamer.com.tw/Co.php?*
// @match        https://forum.gamer.com.tw/B.php*
// @match        https://forum.gamer.com.tw/Bo.php*
// @match        https://forum.gamer.com.tw/search.php?*
// @icon         data:image/x-icon;base64,AAABAAIAICAAAAEACACoCAAAJgAAABAQAAABAAgAaAUAAM4IAAAoAAAAIAAAAEAAAAABAAgAAAAAAIAEAAAAAAAAAAAAAAABAAAAAAAA////APb29gDw8PAA4+PjAN3d3ADMzMwAxsbGALu7uwCysrIAqqqqAKOjowCZmZkAiIiIAHh4dgBvb28AZmZmAFhYWABSUlEASkpKAEFBQQAzMzMAJ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cXFxcXFxcXFwoRCRcXAwoREREREBocFxcXFxcXFxcXFxcXCRECFxcXChMTEREREBERHBERCRcXFxcXFxcXFxcXFxcXChEJCQkREREREREREREcAgsPCRIXFxcXFxcXFxcXFxcXChERERERERERERERExwXFwwSCRIXFxcXFxcXFxcXFxcNERERERERERERERERHBcKEgoSFxcXFxcXFxcXFxcXChEREREREREREREREREUERcXFxcXFxcXFxcXFxcXCg0NERERERERERERERERDQ0cCBIXFxcXFxcXFwoKDRERERERERERERERERENDQ0cHBwdIRcXFwoTEhEQERESEhINDQ0NDQ0NDQ0NDQ0cHBwdFxcXFxcXFxcXFxcXFxchHBwcHBweHh4eHBwcHBwhFxcXFxcXFxcXFxcXFxchHBwcHBwcHBwcHBwcHCEXFxcXFxcXFxcXFx8fHhwcHBwcHBwcHBweHyEhFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxf////////wf///w7///4////8f////H////j////4////+P////h/3//8f9///D8///4Mf///AP///8//BwBh/+AIAf/6vwCT//3AA//8YA//HAAf/4AAB//AAMP/wACH/4AAf/4AAB/gAAAcAAAA//wAA//wAB/8AAH///////ygAAAAQAAAAIAAAAAEACAAAAAAAQAEAAAAAAAAAAAAAAAEAAAAAAAD///8A////APDw8ADj4+MA3d3cAMzMzADGxsYAu7u7ALKysgCqqqoAo6OjAJmZmQCIiIgAeHh2AG9vbwBmZmYAWFhYAFJSUQBKSkoAQUFBADMzMwAnJygABQUFAAAAAAACAf4AWk0sAHBpPwCQgC0ArpovALOiSQCglmMAwbNlAM/GlgDj3LcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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cXFxcXFxcEEAUXFxcXFxcXFxcXFxcXCBAXFxcXFxcXFxcXFxcXFwgQFxcXFxcGFxcXFxcXFxcEEAwXFxcMFxcXFxcXFxcXFwgSDA8OBBcXFwwXFxcXFxcXCBAPFxcXBhcXCgwLDA0NDQoIEQ8IBQ0XFxcGFwkXFw0PDxEREwwXFxcXFxcXFwwKFw8RHBEJFxcXFxcXDAkXDxEREREXEgcSFxcXFxcMEREREREPFwgSFwYODRERERERDxwcHBwPFxcXFyEfHxwcHBwcICEXFxcXIRwcHBwcHCAhFxcXFxcXF/8P///+d////H////z////8+////Hf///4H//9/Hf//gAH//9YD///8g///8gj///gJ//8AA///wA///wB///8=
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_registerMenuCommand
// @run-at       document-end
// @noframes
// ==/UserScript==
function create_style(textContent,id,class_name){
    let style=create_node("style",class_name,true,document.body);
    style.type='text/css';
    style.id=id;
    style.textContent=textContent;
    return style;
}
const font_family_panel="font-family: 'Noto Sans Mono','Noto Mono','Consolas','DroidSans_Mono','Courier New','symbol_emoji','color_emoji','Noto Sans CJK JP','Meiryo','Yu Gothic','Microsoft JhengHei','old_emoji',sans-serif;";
const font_family_default="font-family: 'Noto Sans','Segoe UI','Roboto_2','color_emoji','Noto Sans CJK JP','Meiryo','Yu Gothic','Microsoft JhengHei','old_emoji',sans-serif;";
const font_face_default=`@font-face{font-family: 'color_emoji';src: local('Segoe UI Emoji'),local('Noto Color Emoji');}
@font-face{font-family: 'symbol_emoji';src: local('Segoe UI Symbol');}\n@font-face{font-family: 'old_emoji';src: local('Noto Color Emoji');}
@font-face{font-family: 'DroidSans_Mono';src: local('DroidSansMono');}\n@font-face{font-family: 'Cutive_Mono';src: local('Cutive Mono');}
@font-face{font-family: 'Roboto_2';src: local('Roboto');}\n@font-face{font-family: 'Noto_Serif';src: local('NotoSerif');}\n@font-face{font-family: 'Dancing_Script';src: local('DancingScript');}\n`;
var style_font_face=create_style(font_face_default,"gm_font_face_gamer_default",["user_gm_font_face","css_gamer_default"]);
var style_user_css=create_style(".user_btn_panel{"+font_family_panel+"}\n","gm_user_css_gamer_default",["user_gm_css","css_gamer_default"]);
style_user_css.textContent+=`.user_mark_fix{left: auto;}
.user_btn_panel,.user_btn_panel_12px,.user_a_panel_12px{font-weight: 100;color: #FFFFFF;background: #303030;border-color: #707070;border-width: 0.15rem;border-radius: 4px;border-style: outset;}
.user_btn_panel,.user_btn_panel_12px,.user_a_panel_12px{min-height: 1em;line-height: 1.5em;padding: 0.1rem 0.5rem;margin-top: 1px;margin-bottom: 1px;}
.user_btn_panel,.user_btn_panel_12px{padding-left: 5px;padding-right: 5px;margin-right: 2px;margin-left: 3px;}
.user_btn_panel_12px,.user_a_panel_12px{font-size: 0.75rem;min-width: 5em;}
.user_btn_panel{min-width: 7em;}
.user_a_panel_12px{display: inline-block;text-align: center;}
div.user_mark_1_5rem{width: 60px;height: 60px;}\ndiv.user_mark_1_5rem::before{top: -40px;left: -40px;width: 80px;height: 80px;}
i.material-icons.user_mark_1_5rem{top: 4px;left: 4px;font-size: 1.5rem;}\n`;
function create_div(class_name,is_appendChild,node,refNode){
    let div=create_node("div",class_name,is_appendChild,node,refNode);
    div.style.backgroundSize='contain';
    div.style.backgroundRepeat='no-repeat';
    div.lang='ja';
    return div;
}
function create_a(text,url,class_name,is_appendChild,node,refNode){
    let anchor=create_node("a",class_name,is_appendChild,node,refNode);
    anchor.href=url;
    anchor.innerText=text;
    anchor.title=text;
    anchor.target="_blank";
    return anchor;
}
function create_i(innerText,class_name,is_appendChild,node,refNode){
    var italic=create_node_text("i",innerText,class_name,is_appendChild,node,refNode);
    return italic;
}
function create_node(tagname,class_name,is_appendChild,node,refNode){
    let element=document.createElement(tagname);
    if(Array.isArray(class_name)){
        for(let i=0; i<class_name.length; i++){element.classList.add(class_name[i]);}
    }
    else if(typeof class_name==='string'){element.classList.add(class_name);}
    if(is_appendChild){node.appendChild(element);}else{node.insertBefore(element, refNode);}
    return element;
}
function create_node_text(tagname,innerText,class_name,is_appendChild,node,refNode){
    let element = create_node(tagname,class_name,is_appendChild,node,refNode);
    element.innerText=innerText;
    element.lang='ja';
    return element;
}
function fn_url(url){
    let obj_url=new URL(url);
    let params=new URLSearchParams(obj_url.search);
    return [obj_url,params];
}
//console.log("break");
function main_01(){
    let c_post=document.querySelectorAll('.c-post');
    for(let i = 0; i < c_post.length; i++){
        let a_floor=c_post[i].querySelectorAll('a.floor')[0];
        let c_reply__item=c_post[i].querySelectorAll('div.c-reply__item');//留言
        for(let i = 0; i < c_reply__item.length; i++){
            let comment_floor=c_reply__item[i].querySelectorAll('div.edittime')[0];
            if(comment_floor.querySelectorAll('a').length==1)continue;
            let lzl_floor=comment_floor.innerText;
            comment_floor.innerText="";
            let floor_href=a_floor.href;
            let url_floor=fn_url(floor_href);
            url_floor[0].searchParams.delete('subbsn');
            url_floor[0].searchParams.delete('bPage');
            let Commendcontent=c_reply__item[i].id.replace(new RegExp("Commendcontent_", "i"), "comment");
            create_a(lzl_floor,url_floor[0].toString()+"#"+Commendcontent,[],true,comment_floor);
        }
    }
}
(function() {
    'use strict';
    let url=fn_url(document.location);
    if(url[0].pathname.search(new RegExp("/C.php", "i"))==0||url[0].pathname.search(new RegExp("/Co.php", "i"))==0){
        let c_post=document.querySelectorAll('.c-post');
        let c_section__side=document.querySelectorAll('.c-section__side');
        if(c_post.length>0&&url[0].pathname=="/C.php"&&(url[1].get('page')==null||url[1].get('page')=="1")&&url[1].get('s_author')==null){//需要判斷是不是第一頁
            if(document.querySelectorAll('.c-disable__title').length==0){//沒有首篇已刪
                let post__header__title=c_post[0].querySelectorAll('h1')[0].innerText;//標題
                let lz=c_post[0].querySelectorAll('.userid')[0].innerText.toLowerCase();//樓主id
                if(post__header__title.search("RE:")!=0){
                    for(let i=0; i<c_post.length; i++){
                        let userid=c_post[i].querySelectorAll('.userid')[0].innerText;//各樓層id
                        if(userid.toLowerCase()==lz){
                            let userlevel=c_post[i].parentNode.querySelectorAll('div.userlevel')[0];
                            let div_mark=create_div("b-mark",true,c_post[i]);
                            div_mark.title="樓主";
                            create_i("\uE838","material-icons",true,div_mark).classList.add("feature");
                            let div_mark_side=div_mark.cloneNode(true);
                            c_section__side[i].appendChild(div_mark_side);
                            if(userlevel.classList.contains('senior')||userlevel.classList.contains('master')){//紅色等級
                                div_mark_side.classList.add("b-mark--update");
                            }
                            else{
                                div_mark_side.classList.add("b-mark--feature");
                            }
                            div_mark.classList.add("user_mark_fix");
                            div_mark.classList.add("b-mark--update");
                            div_mark.classList.add("user_mark_1_5rem");
                            div_mark.querySelectorAll('i')[0].classList.add("user_mark_1_5rem");
                        }
                    }
                }
                else{//標題有"RE:",視為吃樓
                    let floor=c_post[0].querySelectorAll('div>a.floor')[0].innerText;
                    if(floor=="樓主"){//在&last=1的情況下,需要檢測是不是第一頁
                        let userlevel=c_post[0].parentNode.querySelectorAll('div.userlevel')[0];
                        let div_mark=create_div("b-mark",true,c_post[0]);
                        div_mark.title="吃樓";
                        create_i("\uE5D8","material-icons",true,div_mark).classList.add("raise");
                        let div_mark_side=div_mark.cloneNode(true);
                        c_section__side[0].appendChild(div_mark_side);
                        if(userlevel.classList.contains('senior')||userlevel.classList.contains('master')){//紅色等級
                            div_mark_side.classList.add("b-mark--update");
                        }
                        else{
                            div_mark_side.classList.add("b-mark--feature");
                        }
                        div_mark.classList.add("user_mark_fix");
                        div_mark.classList.add("b-mark--feature");
                        div_mark.classList.add("user_mark_1_5rem");
                        div_mark.querySelectorAll('i')[0].classList.add("user_mark_1_5rem");
                    }
                }
            }
        }
        let timeoutID = window.setInterval(( () => main_01() ), 5000);
    }
    let topbar_member_home=document.querySelectorAll('a.topbar_member-home');
    let is_login=topbar_member_home.length==1?true:false;
    if(is_login){//添加右上角小屋鏈接的owner參數
        let ary_tmp=fn_url(topbar_member_home[0].querySelectorAll('img')[0].src)[0].pathname.split('/');
        let userid_login=is_login?ary_tmp.pop().replace(/_s.png/i, ""):null;
        topbar_member_home[0].href+="?owner="+userid_login;
    }
})();