巴哈姆特哈啦區顯示發文者在線狀態

顯示巴哈姆特哈啦區文章列表中發文者的在線狀態

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         巴哈姆特哈啦區顯示發文者在線狀態
// @namespace    巴哈姆特哈啦區顯示發文者在線狀態
// @description  顯示巴哈姆特哈啦區文章列表中發文者的在線狀態
// @author       johnny860726
// @match        *forum.gamer.com.tw/*
// @version      20180418
// @run-at       document-end
// ==/UserScript==

// 哈啦區發文者在線狀態
try{
    var elems = document.getElementsByClassName("c-post__header__author");
    var ids = "", i;
    for(i=0; i<elems.length; i++){
        ids += elems[i].getElementsByClassName("userid")[0].innerText.toLowerCase()+',';
        var node = document.createElement("span");
        node.id = "BMW_" + i;
        elems[i].appendChild(node);
    }
    var sc = document.createElement("script");
    sc.src = "https://im.gamer.com.tw/bmw/jsIson.php?u=" + ids;
    document.getElementsByClassName("c-post__header__author")[0].appendChild(sc);
}catch (err){
}