Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Store original setTimeout
- const originalSetTimeout = window.setTimeout;
- // Override setTimeout to instantly loop through characters instead of using delay
- window.setTimeout = function(func, delay, ...args) {
- // Detect paste-related function (heuristic)
- if (typeof func === 'function' && func.name === 'e' && args.length === 2) {
- // Simulate what multiple delayed executions would do — but all at once
- for (let i = 0; i < 10; i++) { // adjust 10 to control how many characters per loop
- func(...args);
- }
- return; // Skip real delay
- }
- // Default behavior
- return originalSetTimeout(func, delay, ...args);
- };
- // Store original splice method
- Array.prototype.originalSplice = Array.prototype.splice;
- // Override splice to process more characters at once if it matches certain pattern
- Array.prototype.splice = function(start, deleteCount, ...items) {
- // Detect a paste buffer being trimmed (for example, 50 chars)
- if (start === 0 && deleteCount === 50) {
- // Force process all characters immediately
- for (let i = 0; i < 10; i++) {
- this.originalSplice(start, deleteCount, ...items);
- }
- return this;
- }
- // Otherwise, keep normal splice
- return this.originalSplice(start, deleteCount, ...items);
- };
- console.log("✅ Paste optimizer (loop fusion) activated — pasting now uses for loops instead of timeouts!");
Add Comment
Please, Sign In to add comment