Created
April 5, 2022 23:30
-
-
Save lart2150/74893fa262106fe06df8ede53df16d5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Add AMX offfers to card | |
| // @namespace https://lart2150.com/ | |
| // @version 0.1 | |
| // @description Add all Amx offers to card | |
| // @author /u/lart2150 | |
| // @match https://global.americanexpress.com/* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=americanexpress.com | |
| // @grant GM_registerMenuCommand | |
| // ==/UserScript== | |
| const run = async () => { | |
| 'use strict'; | |
| console.log('Adding offers to card'); | |
| for (let a of document.querySelectorAll('[title="Add to Card"]')) { | |
| await (new Promise(resolve => setTimeout(resolve, 1000))); | |
| a.click(); | |
| } | |
| }; | |
| const loop = () => { | |
| if (document.querySelectorAll('[title="Add to Card"]').length === 0) { | |
| setTimeout(loop, 1000); | |
| console.log('no offers waiting to run'); | |
| } else { | |
| run(); | |
| } | |
| } | |
| setTimeout(loop, 1000); | |
| GM_registerMenuCommand('Add All Offers to card', function() { | |
| run(); | |
| }, 'o') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment