Greasy Fork

Greasy Fork is available in English.

巴哈姆特公會、首頁自動簽到

巴哈姆特公會、首頁自動簽到 by.moontai0724

当前为 2018-01-13 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         巴哈姆特公會、首頁自動簽到
// @version      1.4
// @description  巴哈姆特公會、首頁自動簽到 by.moontai0724
// @author       moontai0724
// @match        https://www.gamer.com.tw/*
// @match        https://guild.gamer.com.tw/*
// @grant        none
// @namespace    http://greasyfork.icu/users/165315
// ==/UserScript==

(function() {
    'use strict';
    /* (Chrome)
    如果要開啟自動簽到,請在「設定 -> 起始畫面」中新增 https://www.gamer.com.tw/index2.php#check
    如果要開啟自動簽到,請在「設定 -> 起始畫面」中新增 https://www.gamer.com.tw/index2.php#check
    如果要開啟自動簽到,請在「設定 -> 起始畫面」中新增 https://www.gamer.com.tw/index2.php#check

    網址錯誤將無法正常運行。

    意思為在開啟瀏覽器時,都會打開 https://www.gamer.com.tw/index2.php#check
    當打開 https://www.gamer.com.tw/index2.php#check 的時候,自動簽到就會開始。

    如不需要自動簽到公會,請將下方 signguild 變數 true 改為 false
    */

    var signguild = true;

    /*
    作者的話:本人僅於 Chrome 上測試,照理說應能通用,但如有錯誤,將不提供其他瀏覽器的完全支援與改動。
             (如果有錯誤還是可以回報,也許某天會改動。)
    ----------------------------------------------------------------------------------------------------*/



    // 下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。
    // 下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。
    // 下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。
    // 下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。
    // 下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。
    // 下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。
    // 下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。
    // 下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。
    // 下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。
    // 下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。下方為程式內容,請勿更動。

    if(BAHAID) {
        if(location.hash == "#check")
        {
            window.alert = function(str)
            {
                return ;
            };
        }

        if(location.hostname == "www.gamer.com.tw" && location.hash == "#check")
        {
            Signin.start(this);
            if(signguild === true) {
                window.open("https://guild.gamer.com.tw/#check");
            }
        } else if(location.hostname == "guild.gamer.com.tw" && location.hash == "#check" && signguild === true) {
            TOPBAR_show('guild', '');
            TOPBAR_show('guild', '');

            window.setTimeout(function(){
                var guild_list_temp_1 = document.getElementById("topBarMsg_guild");
                var guild_list_temp_2 = guild_list_temp_1.getElementsByClassName("TOP-msgpic");
                var guild_list = [];
                for(var i=0;i<guild_list_temp_2.length;i++) {
                    guild_list[i] = guild_list_temp_2[i].href.split("=")[1];
                }
                console.log(guild_list, "length: " + guild_list.length);
                for(var x=0;x<guild_list.length-1;x++)
                {
                    guild_sign(guild_list[x]);
                }
                window.setTimeout(function(){window.close(this);},2000);
            },100);
        }
    } else if (location.hash == "#check") {
        var _creatediv_01 = document.createElement("div");
        _creatediv_01.id = "notloggedin_out";
        _creatediv_01.setAttribute("align", "center");
        _creatediv_01.setAttribute("vertical-align", "middle");
        _creatediv_01.setAttribute("style", "width: 600px; height: 300px; position: absolute; top: 50%; left: 50%; margin: -150px 0 0 -300px; background: red;");
        document.body.appendChild(_creatediv_01);
        var _creatediv_02 = document.createElement("div");
        _creatediv_02.id = "notloggedin_in";
        _creatediv_02.setAttribute("align", "center");
        _creatediv_02.setAttribute("onclick", "window.location.replace(\"https://user.gamer.com.tw/login.php\");");
        _creatediv_02.setAttribute("style", "width: 580px; height: 280px; margin-top: 10px; background: #000000; display: flex; flex-wrap: wrap; align-items: center;");
        document.getElementById("notloggedin_out").appendChild(_creatediv_02);
        var _creatediv_03 = document.createElement("div");
        _creatediv_03.setAttribute("style", "width: 560px; font-size: 80px; margin: 0 auto; color: #ff99cc; font-family: 微軟正黑體;line-height: 80px;");
        _creatediv_03.innerHTML = "您尚未登入!";
        document.getElementById("notloggedin_in").appendChild(_creatediv_03);
        var _creatediv_04 = document.createElement("div");
        _creatediv_04.setAttribute("style", "width: 560px; font-size: 40px; margin: 0 auto; color: #ff3366; font-family: 微軟正黑體;line-height: 40px;");
        _creatediv_04.innerHTML = "簽到腳本無法進行簽到作業。\n請登入後重新打開瀏覽器。\n(或gamer.com.tw/#check)";
        document.getElementById("notloggedin_in").appendChild(_creatediv_04);
        alert("您尚未登入!");
    }
})();