Cursor Reset Trial

Reset Cursor Trial - Reset their Cursor trial period

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Cursor Reset Trial
// @namespace    Cursor Reset Trial Scripts 1.4
// @version      1.4
// @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=".delete-account-button:hover,.toast-button:hover{box-shadow:0 4px 6px rgba(0,0,0,.2)}@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,.5);backdrop-filter:blur(4px);z-index:99999;display:flex;align-items:center;justify-content:center}.toast-container{background-color:rgba(0,0,0,.9);color:#fff;padding:20px;border-radius:8px;min-width:300px;text-align:center;animation:.3s toastFadeIn;border:1px solid rgba(255,255,255,.1)}.delete-account-button,.toast-button{padding:8px 16px;box-shadow:0 2px 4px rgba(0,0,0,.1);transition:.3s;cursor:pointer}.toast-message{margin-bottom:16px;font-size:16px}.toast-buttons{display:flex;justify-content:center;gap:8px}.toast-button{border-radius:12px;color:#fff}.confirm-button{background-color:#fff;color:#000;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;background-color:#1a1a1a;border:1px solid #fff;color:#fff;border-radius:12px}.delete-account-button:hover{background-color:#2a2a2a}.loading-spinner{width:24px;height:24px;border:3px solid rgba(255,255,255,.3);border-radius:50%;border-top-color:#fff;animation:1s linear infinite spin;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 n=document.createElement("div");n.className="toast-container",n.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 a=n.querySelector(".confirm-button"),s=n.querySelector(".cancel-button"),i=n.querySelector(".toast-message"),l=n.querySelector(".toast-buttons"),c=()=>{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(c,500):(a.addEventListener("click",c),s.addEventListener("click",()=>{document.body.removeChild(r)})),r.appendChild(n),document.body.appendChild(r)},o=(t,e,o=10)=>{let r=0,n=()=>{r++;let a=document.querySelector(t);if(a){e(a);return}r<o?setTimeout(n,1e3):console.log("Kh\xf4ng t\xecm thấy phần tử sau nhiều lần thử")};n()},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"}})},n=()=>{let t=window.location.href;if("https://www.cursor.com/"===t)window.location.href="https://www.cursor.com/settings";else if(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()});else if(t.includes("loginDeepControl")){let e=new MutationObserver(t=>{let o=Array.from(document.querySelectorAll("button")).find(t=>{let e=t.querySelector("span")?.textContent?.trim();return"Yes, Log In"===e});if(o){e.disconnect();try{o.click()}catch(r){console.error("Error clicking button:",r);let n=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});o.dispatchEvent(n)}}});e.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>e.disconnect(),3e4)}},a=()=>{if(t(),n(),window.location.href.startsWith("https://www.cursor.com/settings")){let a=new URLSearchParams(window.location.search),s="true"===a.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)})}};a()})();