Cursor Reset Trial

Reset Cursor Trial - Reset their Cursor trial period

当前为 2024-12-30 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Cursor Reset Trial
// @namespace    http://tampermonkey.net/
// @version      1.1
// @license MIT
// @description  Reset Cursor Trial - Reset their Cursor trial period
// @author       ovftank
// @homepage     https://github.com/ovftank/cursor-reset-trial/tree/main/tampermonkey-script
// @supportURL   https://github.com/ovftank
// @match        https://www.cursor.com/*
// @match        https://authenticator.cursor.sh/*
// @grant        GM_xmlhttpRequest
// @icon         https://github.com/ovftank/cursor-reset-trial/raw/refs/heads/main/images/icon.ico
// @contactURL   https://t.me/ovftank
// @copyright    2024, ovftank (https://greasyfork.org/users/1392240-ovftank)
// ==/UserScript==

(()=>{"use strict";let t=()=>{let t=document.createElement("style");t.textContent=`
    @keyframes toastFadeIn {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .toast-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 99999;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .toast-container {
        background-color: rgba(0, 0, 0, 0.9);
        color: white;
        padding: 20px;
        border-radius: 8px;
        min-width: 300px;
        text-align: center;
        animation: toastFadeIn 0.3s ease;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .toast-message {
        margin-bottom: 16px;
        font-size: 16px;
    }

    .toast-buttons {
        display: flex;
        justify-content: center;
        gap: 8px;
    }

    .toast-button {
        padding: 8px 16px;
        border-radius: 12px;
        color: white;
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
    }

    .toast-button:hover {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    }

    .confirm-button {
        background-color: white;
        color: black;
        border: none;
    }

    .confirm-button:hover {
        background-color: #f0f0f0;
    }

    .cancel-button {
        background-color: #666;
    }

    .cancel-button:hover {
        background-color: #777;
    }

    .delete-account-button {
        width: 100%;
        margin-top: 8px;
        padding: 8px 16px;
        background-color: #1a1a1a;
        border: 1px solid white;
        color: white;
        border-radius: 12px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
        cursor: pointer;
    }

    .delete-account-button:hover {
        background-color: #2a2a2a;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    }

    .loading-spinner {
        width: 24px;
        height: 24px;
        border: 3px solid rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        border-top-color: white;
        animation: spin 1s linear infinite;
        margin: 0 auto;
        display: none;
    }

    @keyframes spin {
        to {
            transform: rotate(360deg);
        }
    }

    .toast-message.loading .loading-spinner {
        display: block;
        margin-top: 12px;
    }
`,document.head.appendChild(t)},e=(t,e,o=!1)=>{let r=document.createElement("div");r.className="toast-overlay";let a=document.createElement("div");a.className="toast-container",a.innerHTML=`
    <div class="toast-message">${t}
        <div class="loading-spinner"></div>
    </div>
    <div class="toast-buttons">
        <button class="toast-button confirm-button">Confirm</button>
        <button class="toast-button cancel-button">Cancel</button>
    </div>
`;let n=a.querySelector(".confirm-button"),s=a.querySelector(".cancel-button"),i=a.querySelector(".toast-message"),l=a.querySelector(".toast-buttons"),d=()=>{i.classList.add("loading"),l.style.display="none",i.textContent="Processing...";let t=document.createElement("div");t.className="loading-spinner",i.appendChild(t),e(r)};o?setTimeout(d,500):(n.addEventListener("click",d),s.addEventListener("click",()=>{document.body.removeChild(r)})),r.appendChild(a),document.body.appendChild(r)},o=(t,e,o=10)=>{let r=0,a=()=>{r++;let n=document.querySelector(t);if(n){e(n);return}r<o?setTimeout(a,1e3):console.log("Kh\xf4ng t\xecm thấy phần tử sau nhiều lần thử")};a()},r=t=>{GM_xmlhttpRequest({method:"POST",url:"https://www.cursor.com/api/dashboard/delete-account",headers:{"Content-Type":"application/json"},onload(e){if(200===e.status)document.body.removeChild(t),window.location.href="https://authenticator.cursor.sh";else{let o=t.querySelector(".toast-message"),r=t.querySelector(".toast-buttons");o.classList.remove("loading"),o.textContent="Failed to reset trial. Please try again.",r.style.display="flex"}},onerror(e){console.error("Error:",e);let o=t.querySelector(".toast-message"),r=t.querySelector(".toast-buttons");o.classList.remove("loading"),o.textContent="An error occurred. Please try again.",r.style.display="flex"}})},a=()=>{let t=window.location.href;"https://www.cursor.com/"===t?window.location.href="https://www.cursor.com/settings":t.startsWith("https://authenticator.cursor.sh/")&&o("body > div.radix-themes > div > div > div:nth-child(2) > div > form > div > div.rt-Grid.rt-r-gap-3 > a:nth-child(2)",t=>{t.click()})},n=()=>{if(t(),a(),window.location.href.startsWith("https://www.cursor.com/settings")){let n=new URLSearchParams(window.location.search),s="true"===n.get("reset");o("body > main > div > div > div > div > div > div.col-span-1.flex.flex-col.gap-2.xl\\:gap-4 > div:nth-child(1)",t=>{let o=document.createElement("button");o.innerHTML="Reset Trial",o.className="delete-account-button",o.addEventListener("click",()=>{e("Are you sure you want to reset your trial?",r)}),t.appendChild(o),s&&e("Are you sure you want to reset your trial?",r,!0)})}};n()})();