Skip to content

Instantly share code, notes, and snippets.

@rmtbb
Last active September 23, 2024 06:20
Show Gist options
  • Save rmtbb/cd07423332b7087dc24d04adac9f7719 to your computer and use it in GitHub Desktop.
Save rmtbb/cd07423332b7087dc24d04adac9f7719 to your computer and use it in GitHub Desktop.
Bookmarklet: ChatGPT Delay Send
javascript:(function(){ var time = prompt("Enter delay in minutes or seconds (e.g., '5s' for 5 seconds or '4m' for 4 minutes). If not specified, default is minutes:"); var delay; if (time.endsWith('s')) { delay = parseInt(time) * 1000; } else if (time.endsWith('m') || !time.match(/\d+[sm]/)) { delay = parseInt(time) * 60000; } else { delay = parseInt(time) * 60000; } setTimeout(() => { var button = document.querySelector('body > div.relative.flex.h-full.w-full.overflow-hidden.transition-colors.z-0 > div.relative.flex.h-full.max-w-full.flex-1.flex-col.overflow-hidden > main > div.composer-parent.flex.h-full.flex-col.focus-visible\\:outline-0 > div.md\\:pt-0.dark\\:border-white\\/20.md\\:border-transparent.md\\:dark\\:border-transparent.w-full > div > div.text-base.px-3.md\\:px-4.m-auto.w-full.md\\:px-5.lg\\:px-4.xl\\:px-5 > div > form > div > div.group.relative.flex.w-full.items-center > div.flex.w-full.flex-col.gap-1\\.5.rounded-\\[26px\\].p-1\\.5.transition-colors.bg-\\[\\#f4f4f4\\].dark\\:bg-token-main-surface-secondary > div > button > svg'); if (button) { button.closest('button').click(); } else { console.log("Button not found."); } }, delay); })();
@rmtbb
Copy link
Author

rmtbb commented Sep 23, 2024

This bookmarklet is useful for when you're using ChatGPT and encounter a rate limit message like:
"It looks like you're generating images too quickly. To ensure the best experience for everyone, we have rate limits in place. Please wait for 4 minutes before generating more images."

This happens when you've submitted requests too quickly, and ChatGPT asks you to wait for a certain amount of time before you can submit another request (e.g., generating more images). Rather than manually watching the clock and clicking the button again at the right time, this bookmarklet automates the process. You can specify how long to wait, and it will automatically click the submit button for you after the specified delay. Set it and forget it!

How to Use It:

Create a new bookmark:

  1. In Chrome (or any browser), go to the bookmarks bar.
  2. Right-click the bookmarks bar and select Add Page (or just drag this code into the bookmarks bar).
  3. Name it (e.g., ChatGPT Delay Submit Button Click) and in the URL field, paste the following code:
javascript:(function(){ var time = prompt("Enter delay in minutes or seconds (e.g., '5s' for 5 seconds or '4m' for 4 minutes). If not specified, default is minutes:"); var delay; if (time.endsWith('s')) { delay = parseInt(time) * 1000; } else if (time.endsWith('m') || !time.match(/\d+[sm]/)) { delay = parseInt(time) * 60000; } else { delay = parseInt(time) * 60000; } setTimeout(() => { var button = document.querySelector('body > div.relative.flex.h-full.w-full.overflow-hidden.transition-colors.z-0 > div.relative.flex.h-full.max-w-full.flex-1.flex-col.overflow-hidden > main > div.composer-parent.flex.h-full.flex-col.focus-visible\\:outline-0 > div.md\\:pt-0.dark\\:border-white\\/20.md\\:border-transparent.md\\:dark\\:border-transparent.w-full > div > div.text-base.px-3.md\\:px-4.m-auto.w-full.md\\:px-5.lg\\:px-4.xl\\:px-5 > div > form > div > div.group.relative.flex.w-full.items-center > div.flex.w-full.flex-col.gap-1\\.5.rounded-\\[26px\\].p-1\\.5.transition-colors.bg-\\[\\#f4f4f4\\].dark\\:bg-token-main-surface-secondary > div > button > svg'); if (button) { button.closest('button').click(); } else { console.log("Button not found."); } }, delay); })();

Click the Bookmark:

When you click the bookmarklet, it will prompt you to enter a delay:

  • You can enter a number followed by s for seconds (e.g., 30s for 30 seconds).
  • Or, enter a number followed by m for minutes (e.g., 4m for 4 minutes).
  • If you only enter a number (e.g., 4), it will default to minutes.

After the specified delay, the button will be automatically clicked in ChatGPT.

This bookmarklet is flexible and allows you to specify the delay in either seconds or minutes, defaulting to minutes when no unit is specified. It's a simple way to manage ChatGPT's rate limits without manually waiting and clicking the button yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment