您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
网站右侧显示签到UI, 无需跳转直接签到成功
当前为
// ==UserScript== // @name 一款草率的V2EX右侧一键签到UI // @namespace http://tampermonkey.net/ // @version 0.1 // @description 网站右侧显示签到UI, 无需跳转直接签到成功 // @author echo // @match *://*.v2ex.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=v2ex.com // @grant none // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js // @license GNU GPLv3 // ==/UserScript== (function() { 'use strict'; $(function(){ if(window.location.pathname=='/mission/daily')return; let position=$('#Rightbar .box:eq(0) .cell:eq(2)'); if(position==null)return; let code=0; let url=""; let before={txt:'签   到',c1:'#9EEB80',c2:'#90CC78'}; let after={txt:'今日已签到',c1:'#EBA380',c2:'#EBA380'}; let bar=$(`<div class="cell" style=""> <div cellpadding="0" cellspacing="0" border="0" width="100%" style="text-shadow:0.5px 0.5px 2px #fff;background-color:#ffffffff;padding: 4px;text-align: center;"><a href="#" style=" color:#666; font-weight:bold; display: block; width: 100%; height: 100%; text-decoration: none; user-select:none "></a> </div> </div>`); let aFather=bar.children(); let a=aFather.children(); position.after(bar); let xhr=new XMLHttpRequest(); let div=document.createElement('div'); xhr.onload=function(e){ let cnt=new RegExp("<body>.*<\/body>","is").exec(xhr.response); div.innerHTML=cnt; let btn=div.querySelector('#Main input'); if(btn==null||btn.value=="查看我的账户余额"){refresh(after);stopA();return;}else{refresh(before);} let txt=btn.getAttribute('onclick'); code=new RegExp("(?<=once=)\\d{5}").exec(txt)[0]; url=`/mission/daily/redeem?once=${code}`; a.one('click',function(e){$.get(url,function(rs){refresh(after)});stopA();}); } xhr.open('get','/mission/daily'); xhr.send(); function refresh(signin){ a.html(signin.txt); aFather.css('backgroundColor',signin.c1); aFather.hover(function(){$(this).css('backgroundColor',signin.c2)},function(){$(this).css('backgroundColor',signin.c1)}); } function stopA(){ a.attr('href','/mission/daily'); } }); })();