Greasy Fork

签到工具-改

用于各种论坛和网站自动点击签到

目前为 2022-01-27 提交的版本。查看 最新版本

// ==UserScript==
// @name         签到工具-改
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  用于各种论坛和网站自动点击签到
// @author       Fxy
// @homepage     https://greasyfork.org/zh-CN/scripts/439136-%E8%AE%BA%E5%9D%9B%E7%AD%BE%E5%88%B0%E5%B7%A5%E5%85%B7-%E6%94%B9
// @include      http*://*/plugin.php?id=*sign*
// @include      http*://www.52pojie.cn/*
// @include      http*://zhidao.baidu.com/question/*
// @include      http*://wenku.baidu.com/task/browse/daily*
// @include      http*://*www.wenshushu.cn*
// @include      http*://bbs.kafan.cn/*
// @include      http*://bbs.wstx.com/*
// @include      http*://bbs.gfan.com/*
// @include      http*://www.horou.com/*
// @include      http*://www.92jh.cn/*
// @include      http*://bbs.ntrqq.net/*
// @include      http*://www.gn00.com/*
// @include      http*://*bili201.com*
// @include      http*://bbs.acg520*
// @include      http*://*uzxun*
// @include      http*://googlewk*
// @include      http*://yhuam*
// @include      http*://*shuyou*
// @note         论坛签到工具,签到工具,整合吾爱破解,卡饭论坛,百度知道,网易云音乐,uzxun等论坛自动点击签到
// @note         根据论坛签到工具 二次开发 需要添加其他网站请在反馈里留言
// @grant 		GM_xmlhttpRequest
// @grant 		unsafeWindow
// @run-at 		document-end
// @copyright 	2022+, Fxy
// @copyright 	2016+, wycaca
// @copyright 	2014+, jasonshaw
// @copyright 	2013+, Coolkid

// ==/UserScript==

(function () {

    //卡饭论坛
	if (isURL("bbs.kafan.cn")) {
		var imgs1 = document.getElementById("pper_a").getElementsByTagName("IMG");
		if (imgs1[0].src.indexOf("wb.png") == -1) {
			var a = document.getElementById("pper_a");
			a.click();
			return;
		}
	}

    //百度知道
	else if (isURL("zhidao.baidu.com/question")) {
		var qdbutton1 = document.getElementsByClassName('grid-l go-sign-in')[0];
		var flagText1 = qdbutton1.innerHTML;
		if (flagText1.indexOf("已签到") == -1) {
			document.getElementsByClassName('grid-l go-sign-in')[0].click();
		}
		document.getElementById('sign-in-btn').click();
		return;
	}
	else if (isURL("wenku.baidu.com/task/browse/daily")) {
		//百度文库
		var qdButton2 = document.getElementsByClassName('g-btn g-btn-pass js-signin-btn g-btn-no')[0];
		var flagText2 = qdButton2.innerHTML;
		if (flagText2.indexOf("马上签到") != -1) {
			qdButton2.click();
		}
		return;
	}

    //河洛 好书友论坛
	else if (isURL("www.horou.com") || isURL("shuyou")) {
		var imgs2 = document.getElementById("fx_checkin_b");
		if (imgs2.alt.indexOf("已") == -1) {
			imgs2.click();
			return;
		}
	}

    //华为
	else if (isURL("cn.club.vmall.com/plugin.php?id=dsu_paulsign:sign") || isURL("cn.club.vmall.com/dsu_paulsign-sign")) {
		document.getElementsByClassName('sign-btn btn_rs')[0].click();
		return;
	} else if (location.href.indexOf("plugin.php?id=dsu_paulsign:sign") != -1) {
		qd2();
		return;
	}

    //机锋
	else if (isURL("http://bbs.gfan.com/")) {
		qd();
		if (window.find("签到领奖!")) {
			window.location.href = "http://bbs.gfan.com/plugin.php?id=dsu_paulsign:sign";
			return;
		}
	}

    //NTRQQ
	else if (isURL("http://bbs.ntrqq.net/")) {
		qd();
		if (window.find("签到领奖!")) {
			window.location.href = "http://bbs.ntrqq.net/plugin.php?id=dsu_paulsign:sign";
			return;
		}
	}

    //网易云音乐
	else if (isURL("music.163.com")) {
		var p = {
			elements: ['.u-btn2-2']
		}
		qd3();
		return;
	}

    //52破解-改
	else if (isURL("52pojie.cn")) {
        var imgs4 = document.getElementsByClassName('qq_bind')[0].src;
		if (imgs4.indexOf("wbs.png") == -1) {
			document.getElementsByClassName('qq_bind')[0].click();
			return;
		}
	}

     //文叔叔
    else if (isURL("wenshushu.cn")) {
        window.setTimeout(function(){document.getElementsByClassName('icon-cont_clock')[0].click();},2000);
		return;
	}

    //绅士之庭
	else if (isURL("gmgard.com") || isURL("hggard.com")) {
		var p = {
			elements: ['.signdiv .btn-danger']
		}
		qd3();
		return;
	}

    //萌子岛
	else if (isURL("www.dxdbbb.com")) {
		var p = {
			elements: ['.do_sign']
		}
		qd3();
		return;
	}

    //bili201 WK综合论坛
    else if (isURL("bili201") || isURL("googlewk")) {
        window.setTimeout(function(){document.getElementById('JD_sign').click();},2000);
		return;
	}

     //二次元圣地
    else if (isURL("bbs.acg520")) {
        window.setTimeout(function(){document.getElementsByClassName('right')[0].click();},2000);
		return;
	}

    //uzxun
    else if (isURL("uzxun")) {
        window.setTimeout(function(){document.getElementById('checkin_button2').click();},2000);
		return;
	}

    //樱花萌ACG
    else if (isURL("yhuam.com")) {
        window.setTimeout(function(){document.getElementById('zzza_go').click();},2000);
		return;
	}

    //acfun
	else if (isURL("www.acfun.cn")) {
		//author: https://github.com/machsix/personal-scripts
		var acfun_main = /^https?:\/\/www.acfun.cn\/?$/;
		var acfun_member = /^https?:\/\/www.acfun.cn\/member(?:\/#.*)?/;
		var islogin = function (doc) {
			return JSON.parse(localStorage.user).name != "游客";
		};
		if (acfun_main.test(window.location.href)) {
			console.log("成功进入acfun世界");
			window.addEventListener('load', function () {
				if (!islogin(document)) {
					console.log('脑波没对接');
				} else {
					var i = document.createElement('iframe');
					i.name = 'autologin-iframe';
					i.width = '100%';
					i.height = '0';
					i.frameBorder = "0";
					i.style.cssText = '\
    					                    margin:0!important;\
    					                    padding:0!important;\
    					                    visibility:hidden!important;\
    					                ';
					i.src = 'http://www.acfun.cn/member/';
					document.body.appendChild(i);
				}
			}, false);
		} else if (acfun_member.test(window.location.href)) {
			console.log('进入acfun会员');
			setTimeout(function () {
				var ischecked = function (doc) {
					return doc.evaluate('//*[@id="btn-sign-user"]/text()',
						doc, null, XPathResult.FIRST_ORDERED_NODE_TYPE,
						null).singleNodeValue.data == "已签到";
				};
				if (!ischecked(document)) {
					document.getElementById("btn-sign-user").click();
					console.log('Acfun 签到完成');
				} else {
					console.log('Acfun 已签到');
				}
			}, 3000);
		}
		return;
	}

    //轻国
	else if (isURL("www.lightnovel.cn/home.php?mod=task")) {
		if (window.find("每日任务") && window.find("啪啪啪")) {
			window.location.href = "http://www.lightnovel.cn/home.php?mod=task&do=apply&id=98";
			return;
		}
	} else {
		//其他论坛
		qd();
		qd2();
	}
})();

function isURL(x) {
	return window.location.href.indexOf(x) != -1;
}

function qd() {
	if (window.find("今天签到了吗") && window.find("写下今天最想说的话")) {
		var kxImg = document.getElementById("ch_s");
		var todaySayTextArea = document.getElementById("todaysay");
		if (kxImg == null) {
			return;
		}
		kxImg.setAttribute('checked', true);
		todaySayTextArea.value = "全自动签到,就是爽~";
		var button = document.getElementById("qiandao");
		button.submit();
		return;
	}
}

function qd2() {
	document.getElementById("kx").click();
	var todaySayTextArea = document.getElementById("todaysay");
	if (todaySayTextArea != null) {
		todaySayTextArea.value = "全自动签到,就是爽~";
	}
	unsafeWindow.showWindow('qwindow', 'qiandao', 'post', '0');
	return;
}

function qd3() {
	var elements = p.elements,i = 0;
	setTimeout(function () {
		try {
			if (elements instanceof Array) var els = p.elements;
			else {
				var els = p.elements();
			}
			while (els[i]) {
				var obj = (p.elements instanceof Array) ? document.querySelector(els[i]) : els[i];
				if (obj == null) return;
				if (obj.tagName == "A" && obj.href.indexOf("javascript") < 0 && obj.onclick == "undefined") GM_openInTab(obj.href);
				else obj.click();
				i++;
			}
		} catch (e) {
			alert(e);
		}
	}, 400);
	setTimeout(function () {
		if (autoClose) window.close();
	}, delay + 100);
	return;
}