// ==UserScript==
// @name 必应Rewards每日任务
// @version V1.0.0
// @description 必应Rewards每日搜索任务自动完成工具
// @author 怀沙2049
// @match https://www.bing.com/*
// @match https://cn.bing.com/*
// @license GNU GPLv3
// @icon https://www.bing.com/favicon.ico
// @run-at document-end
// @grant GM_registerMenuCommand
// @grant GM_addStyle
// @grant GM_setValue
// @grant GM_getValue
// @namespace https://gf.qytechs.cn/users/1029902 原作者地址
// ==/UserScript==
var max_rewards = 30; /*每次重复执行的次数*/
var search_dic = ["芙蓉楼送辛渐","九月九日忆山东兄弟","黄鹤楼送孟浩然之广陵","芙蓉楼送辛渐","咏雪","凉州词",
"诫子书","后宫词","宫中词","杞人忧天","近试上张水部","江南逢李龟年","早发白帝城",
"夜上受降城闻笛","秋滁州西涧","桃花溪","乌衣巷","送梓州李使君","送杜少府之任蜀州",
"木兰诗","卖油翁","陋室铭","爱莲说","登幽州台歌","汉江临眺","登飞来峰","游山西村",
"过香积寺","辋川闲居赠裴秀才迪","山居秋暝","春夜洛城闻笛","归嵩山作","晚春","泊秦淮","云阳馆与韩绅宿别",
"过松源晨炊漆公店","别房太尉墓","喜见外弟又言别","答谢中书书","记承天寺夜游","章台夜思","野望",
"黄鹤楼","使至塞上","渡荆门送别","钱塘湖春行","得道多助,失道寡助","宴梅道士山房",
"生于忧患,死于安乐","愚公移山","过故人庄","岁暮归南山","春望","雁门太守行","渡荆门送别",
"灞上秋居","白夜行","静夜思","将进酒·君不见","夜泊牛渚怀古","赠汪伦",
"望天门山","送友人","听蜀僧濬弹琴"]; /*字典*/
// 定义菜单命令1:开始
let menu1 = GM_registerMenuCommand('开始', function () {
GM_setValue('Cnt', 0); // 将计数器重置为0
location.href = "https://www.bing.com/?br_msg=Please-Wait"; // 跳转到Bing首页
}, 'o');
// 定义菜单命令2:停止
let menu2 = GM_registerMenuCommand('停止', function () {
GM_setValue('Cnt', max_rewards + 10); // 将计数器设置为超过最大搜索次数,以停止搜索
}, 'o');
// 自动将字符串中的字符进行替换
function AutoStrTrans(st) {
let yStr = st; // 原字符串
let rStr = "李白"; // 插入的字符
let zStr = ""; // 结果字符串
let prePo = 0;
for (let i = 0; i < yStr.length;) {
let step = parseInt(Math.random() * 6) + 1; // 随机生成步长
if (i > 0) {
zStr = zStr + yStr.substr(prePo, i - prePo) + rStr; // 将插入字符插入到相应位置
prePo = i;
}
i = i + step;
}
if (prePo < yStr.length) {
zStr = zStr + yStr.substr(prePo, yStr.length - prePo); // 将剩余部分添加到结果字符串中
}
return zStr;
}
(function() {
'use strict';
// 检查计数器的值,若为空则设置为超过最大搜索次数
if (GM_getValue('Cnt') == null) {
GM_setValue('Cnt', max_rewards + 10);
}
// 根据计数器的值选择搜索引擎
if (GM_getValue('Cnt') <= max_rewards / 2) {
let tt = document.getElementsByTagName("title")[0];
tt.innerHTML = "[" + GM_getValue('Cnt') + " / " + max_rewards + "] " + tt.innerHTML; // 在标题中显示当前搜索次数
setTimeout(function() {
GM_setValue('Cnt', GM_getValue('Cnt') + 1); // 将计数器加1
let nowtxt = search_dic[GM_getValue('Cnt')]; // 获取当前搜索词
nowtxt = AutoStrTrans(nowtxt); // 对搜索词进行替换
location.href = "https://www.bing.com/search?q=" + encodeURI(nowtxt); // 在Bing搜索引擎中搜索
}, 3000);
}
if (GM_getValue('Cnt') > max_rewards / 2 && GM_getValue('Cnt') < max_rewards) {
let tt = document.getElementsByTagName("title")[0];
tt.innerHTML = "[" + GM_getValue('Cnt') + " / " + max_rewards + "] " + tt.innerHTML; // 在标题中显示当前搜索次数
setTimeout(function() {
GM_setValue('Cnt', GM_getValue('Cnt') + 1); // 将计数器加1
let nowtxt = search_dic[GM_getValue('Cnt')]; // 获取当前搜索词
nowtxt = AutoStrTrans(nowtxt); // 对搜索词进行替换
location.href = "https://cn.bing.com/search?q=" + encodeURI(nowtxt); // 在Bing搜索引擎中搜索
}, 3000);
}
})();