Greasy Fork

来自缓存

Greasy Fork is available in English.

Microsoft Rewards reminder

每天弹窗提示用户访问指定网页,点击跳转(在新窗口中)后记录,不跳转则明天继续提醒;使用 GM 存储 API;带关闭按钮。

当前为 2025-07-21 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name          Microsoft Rewards reminder
// @namespace  http://tampermonkey.net/
// @version       1.3
// @description  每天弹窗提示用户访问指定网页,点击跳转(在新窗口中)后记录,不跳转则明天继续提醒;使用 GM 存储 API;带关闭按钮。
// @author        FZXG.dev & OpenAI
// @match        *://*/*
// @match        https://rewards.bing.com/*
// @grant         GM.getValue
// @grant         GM.setValue
// @license       MIT
// ==/UserScript==

(async function () {
    'use strict';

    const targetURL = 'https://rewards.bing.com/'; // 👉 替换为你希望跳转的网址
    const storageKey = 'dailyVisitConfirmed';
    const today = new Date().toISOString().split('T')[0];

    const lastVisit = await GM.getValue(storageKey, '');

    if (lastVisit === today) return; // 今天已经访问过,无需提示

    // 创建样式
const style = document.createElement('style');
style.textContent = `
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.95); }
}

#popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: start; /* 改为 center 可垂直居中 */
    padding-top: 20vh;
    background-color: rgba(0, 0, 0, 0); /* 可加透明背景 */
    z-index: 9999;
}

#win11-modal {
    animation: fadeIn 0.3s ease-out forwards;
    background: #fefefe;
    border: 1px solid #d0d0d0;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    font-family: 'Segoe UI', sans-serif;
    text-align: center;
    width: 320px;
    max-width: 90vw;
    box-sizing: border-box;
    color: #1f1f1f;
}
#win11-modal.hide {
    animation: fadeOut 0.2s ease-in forwards;
}
#win11-modal p {
    font-size: 15px;
    margin-bottom: 20px;
}
#win11-modal button {
    font-size: 14px;
    padding: 10px 18px;
    margin: 0 5px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}
#goto-btn {
    background-color: #0078d4;
    color: white;
}
#goto-btn:hover {
    background-color: #005a9e;
}
#close-btn {
    background-color: #e5e5e5;
    color: #333;
}
#close-btn:hover {
    background-color: #d0d0d0;
}
`;
document.head.appendChild(style);

// 创建弹窗
const modal = document.createElement('div');
modal.innerHTML = `
    <div id="popup-overlay">
        <div id="win11-modal">
            <p>今天你还没有访问:<br><strong>${targetURL}</strong></p>
            <button id="goto-btn">点击前往</button>
            <button id="close-btn">关闭</button>
        </div>
    </div>
`;
document.body.appendChild(modal);

// 点击跳转
document.getElementById('goto-btn').addEventListener('click', async () => {
    await GM.setValue(storageKey, today);
    window.open(targetURL, '_blank');
    closeModal();
});

// 关闭弹窗
document.getElementById('close-btn').addEventListener('click', () => {
    closeModal();
});

function closeModal() {
    const modalEl = document.getElementById('win11-modal');
    const overlay = document.getElementById('popup-overlay');
    modalEl.classList.add('hide');
    setTimeout(() => overlay.remove(), 200);
}

})();