Microsoft(Bing) Rewards Script

自动获得微软(Microsoft Rewards)/必应奖励(Bing Rewards)。通过设置搜索次数,🤖自动搜索获取积分。支持获得✔电脑搜索🏆、✔移动端搜索🏅、✔Microsoft Edge 奖励✌三种奖励

目前為 2023-10-07 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Microsoft(Bing) Rewards Script
// @namespace    3hex
// @version      0.6
// @description  自动获得微软(Microsoft Rewards)/必应奖励(Bing Rewards)。通过设置搜索次数,🤖自动搜索获取积分。支持获得✔电脑搜索🏆、✔移动端搜索🏅、✔Microsoft Edge 奖励✌三种奖励
// @author       3hex
// @match        https://www.bing.com/*
// @match        https://cn.bing.com/*
// @icon         https://img1.imgtp.com/2023/05/16/SZZNGGT4.svg
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    var currentURL = window.location.href;
    var domain = new URL(currentURL).hostname;

    function getMobileViewport(width, height) {
        return {
            width: width,
            height: height,
            deviceScaleFactor: 1,
            mobile: true
        };
    }

    var num = 0;
    var mode = 0 // 0:PC 1:mobile

    console.log("[info] successful match");

    const timestamp = new Date().getTime(); // 获取当前时间戳
    console.log("[info] timestamp:"+timestamp); // 输出当前时间戳

    const div = document.createElement('div');
    const img = document.createElement('img');
    const span = document.createElement('span')

    div.appendChild(img);
    div.appendChild(span);

    img.src = 'https://img1.imgtp.com/2023/05/16/SZZNGGT4.svg'; // 设置 img 的 src 属性

    img.id = "mrs_img_auto";
    div.style.position = 'fixed'; // 设置定位方式为固定定位
    div.style.top = '15%'; // 设置 img 的上边缘距离屏幕顶部的距离为 0
    div.style.left = '3%'; // 设置 img 的左边缘距离屏幕左侧的距离为 0

    span.textContent = "0";
    span.style.color = "red";
    span.style.fontWeight = 'bold';
    span.style.display = 'flex';
    span.style.alignItems = 'center';
    span.style.justifyContent = 'center';

    num = parseInt(localStorage.getItem('mrs_count_num'), 10);
    mode = parseInt(localStorage.getItem('mrs_count_mode'), 10);
    if(!isNaN(num)&&num!=0)
    {
        span.textContent = ""+num;
        console.log("[info] count:"+num);
        num = num - 1;
        localStorage.setItem('mrs_count_num',num);

        const url = "https://" + domain + "/search?q="+timestamp; // 目标网页的地址
        window.open(url, "_self"); // 在当前页面中打开目标网页
    }

    div.addEventListener('click', function() { // 添加点击事件监听器
        const n = window.prompt('Please enter a number(Number of searches):');
        num = parseInt(n, 10);
         if(!isNaN(num)&&num!=0) {
             span.textContent = ""+num;
             console.log("[info] first count:"+num);
             num = num - 1;

             localStorage.setItem('mrs_count_num',num);

             const url = "https://cn.bing.com/search?q="+timestamp; // 目标网页的地址
             window.open(url, "_self"); // 在当前页面中打开目标网页

         }else
         {
             console.log("[info] cancel");
         }
    });
    document.getElementById('b_content').appendChild(div);

    // 监听键盘按键事件
    document.addEventListener('keydown', function(event) {
        if (event.ctrlKey && event.altKey && event.key === 'l') {
            if (confirm("Whether you want to stop automatic search? ")) {
                console.log("[info] stop");
                num = 0;
                localStorage.setItem('mrs_count_num',0);;
            } else {
               console.log("[info] continue :) ");
            }
        }
    });

})();