巴哈姆特之回文ip顯示

看看大家都從哪發文

目前為 2022-02-24 提交的版本,檢視 最新版本

// ==UserScript==
// @name         巴哈姆特之回文ip顯示
// @description  看看大家都從哪發文
// @namespace    nathan60107
// @author       nathan60107(貝果)
// @version      1.0
// @license      MIT
// @homepage     https://home.gamer.com.tw/homeindex.php?owner=nathan60107
// @match        https://forum.gamer.com.tw/C*
// @icon         https://www.google.com/s2/favicons?domain=gamer.com.tw
// @grant        GM_xmlhttpRequest
// @run-at       document-end
// @noframes
// ==/UserScript==

(function() {
    let ips = jQuery(".edittime.tippy-post-info").map(function() {
        return this.dataset.hideip.replace("xxx", "000");
    }).toArray()

    function setCountryFlag(rawdata){
        let data = JSON.parse(rawdata.response)
        let users = jQuery(".c-post__header__author")
        for(let i = 0; i < Math.min(data.length, users.length); i++){
            jQuery(users[i].children[0]).after(`<img src="https://flagicons.lipis.dev/flags/4x3/${data[i].countryCode.toLowerCase()}.svg" style="vertical-align: middle; height: 26px;">`)
        }
    }

    GM_xmlhttpRequest ( {
        method:     "POST",
        url:        "http://ip-api.com/batch?fields=countryCode",
        data:       JSON.stringify(ips),
        headers:    {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        onload:     setCountryFlag
    } );

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址