gbfblacklist

try to take over the world!

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         gbfblacklist
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description  try to take over the world!
// @author       Mayako
// @match        http://game.granbluefantasy.jp/
// @resource     bl https://raw.githubusercontent.com/mayako21126/gbfBlacklist/master/blackList.json
// @run-at       document-idle
// @grant        GM_getResourceText
// @grant        GM_getResourceURL
// @grant        GM_xmlhttpRequest
// ==/UserScript==
(function() {
    'use strict';
    console.log(window.document.location.href.indexOf('http://game.granbluefantasy.jp/#lobby/room/member/')+'a')
    if(window.document.location.href.indexOf('http://game.granbluefantasy.jp/#lobby/room/member/')>=0){
        ready()
    }else{
        window.onhashchange = function(e){
            console.log(e.newURL.indexOf('http://game.granbluefantasy.jp/#lobby/room/member/'))
            if(e.newURL.indexOf('http://game.granbluefantasy.jp/#lobby/room/member/')>=0){
                ready()
            }
        }
    }

    // Your code here...
})();

function ready() {
    if(window.$){
        check()
    }else{
        setTimeout(function(){
            check()
        },6000)
    }
}

function check() {
    GM_xmlhttpRequest({
        method: 'GET',
        url: 'https://raw.githubusercontent.com/mayako21126/gbfBlacklist/master/blackList.json',
        onload: function(data) {
            var list = JSON.parse(data.response);
            var length = $('.btn-lis-user').length;
            var rArr = []
            for(var i = 0;i<length;i++){
                var ele = $('.btn-lis-user')[i]
                var uid = ele.getAttribute('data-user-id')
                var name = ele.getAttribute('data-nick-name')
                for(var j = 0;j<list.list.length;j++){
                    if(list.list[j].uid==uid){
                        rArr.push('发现惯犯,曾用名'+list.list[j].name+'现用名'+name)
                    }
                }

            }
            if(rArr.length){
                alert(rArr)
            }
        }
    });

}