Last active
July 20, 2024 00:22
-
-
Save calebcauthon/f770951656919958c52a810a54a1a3cd 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
{ | |
"changeTheToFart": { | |
"name": "Change word to another word", | |
"execute": "const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT); let node; while (node = walker.nextNode()) { node.textContent = node.textContent.replace(new RegExp(`\\\\b${params.word}\\\\b`, 'gi'), params.replacement); }", | |
"params": { "word": "the", "replacement": "fart" } | |
}, | |
"changeParagraphsToLoremIpsum": { | |
"name": "Change <p> text to Lorem Ipsum", | |
"execute": "const loremIpsum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'; const paragraphs = document.getElementsByTagName('p'); for (let p of paragraphs) { p.textContent = loremIpsum; }", | |
"params": {} | |
}, | |
"addToCart": { | |
"name": "Add item to cart", | |
"execute": "const searchInputs = Array.from(document.querySelectorAll('input[aria-label]')); const searchInput = searchInputs.find(input => input.getAttribute('aria-label').toLowerCase().includes('search')); if (searchInput) { searchInput.value = params.item; searchInput.dispatchEvent(new Event('input', { bubbles: true })); console.log(`Typed '${params.item}' into the search input`); } else { console.log('Could not find a search input'); }", | |
"params": { "item": "bananas" } | |
}, | |
"highlight": { | |
"name": "Highlight an element", | |
"execute": "const elements = document.querySelectorAll(params.selector); if (elements.length) { elements.forEach(element => element.style.border = '5px solid red'); } else { console.log('Could not find any <p> elements'); } return elements; ", | |
"params": { "selector": "" } | |
}, | |
"click highlighted element": { | |
"name": "Click highlighted element", | |
"execute": "const elements = taskOutputs['Highlight the Log In Button']; if (elements.length) { elements.forEach(element => element.click()); } else { console.log('Could not find any highlighted elements'); }", | |
"params": {} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment