// ==UserScript== // @name 巴哈姆特公會、首頁自動簽到 // @namespace https://home.gamer.com.tw/moontai0724 // @version 2.0 // @description 巴哈姆特公會、首頁自動簽到 by.moontai0724 // @author moontai0724 // @match https://www.gamer.com.tw/* // @match https://guild.gamer.com.tw/* // @grant GM_xmlhttpRequest // @supportURL https://home.gamer.com.tw/creationDetail.php?sn=3852242 // @downloadURL none // ==/UserScript== (function () { 'use strict'; /* (Chrome) 如果要開啟自動簽到,請在「設定 -> 起始畫面」中新增 https://www.gamer.com.tw/index2.php?ad=N#check 意思為在開啟瀏覽器時,都會打開 https://www.gamer.com.tw/index2.php?ad=N#check 當打開 https://www.gamer.com.tw/index2.php?ad=N#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) { jQuery.ajax({ url: "/ajax/topBar_AJAX.php?type=guild", method: "get", cache: false }).then(function (e) { $("#topBarMsg_guild").attr("className", "TOP-msg"); e ? $("#topBarMsg_guild").html('公會社團
' + e + '

參加的公會社團公會大廳創建說明

') : $("#topBarMsg_guild").html('公會社團

您還沒有加入任何公會社團喔!
觀看創建說明或前往公會大廳

'); let guild_list = jQuery("#topBarMsg_guild .TOP-msgpic").map((sort, element) => element.search.replace('?sn=', '')); console.log(guild_list, "length: " + guild_list.length); guild_list.length > 0 ? setTimeout(function sign(sort) { sort = sort ? sort : 0; GM_xmlhttpRequest({ method: 'POST', url: 'https://guild.gamer.com.tw/ajax/guildSign.php', cache: false, data: 'sn=' + guild_list[sort], headers: { "Content-Type": "application/x-www-form-urlencoded", }, onload: data => { console.log("signed: ", guild_list[sort]); sort < guild_list.length - 1 ? sign(sort + 1) : console.log('success'); } }); }) : console.log('success'); }); } } else if (location.hash == "#check") { let newAlert_mask = document.createElement('div'); newAlert_mask.id = 'newAlert_mask'; newAlert_mask.setAttribute("onmousedown", "javascript:if(!jQuery(this).hasClass('mouseenter')) jQuery(\'#newAlert_mask\').remove();"); newAlert_mask.style = 'background-color: rgba(0, 0, 0, 0.5); z-index: 95; position: fixed; top: 0px; bottom: 0px; left: 0px; right: 0px; width: 100%; height: 100%; padding-top: 35px; display: flex; align-items: center; justify-content: center; justify-content: center; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;'; document.body.appendChild(newAlert_mask); document.getElementById('newAlert_mask').innerHTML = '
' + '

' + '您尚未登入!' + '

' + '
' + '簽到腳本無法進行簽到作業。
請登入後重新打開瀏覽器。
(或 https://www.gamer.com.tw/#check)' + '

'; alert("您尚未登入!"); } })();