Skip to content

Instantly share code, notes, and snippets.

@brandonjp
Created July 28, 2025 18:40
Show Gist options
  • Save brandonjp/4bf0a9836973eb02ba9df70e77ee44f0 to your computer and use it in GitHub Desktop.
Save brandonjp/4bf0a9836973eb02ba9df70e77ee44f0 to your computer and use it in GitHub Desktop.
CrowdWork - change the text of any button by specificing in the config of this script
/**
* Button Text Configuration Script
* Version: 2.0.0
*
* Configurable script to change multiple button texts based on matching criteria
*/
(function() {
// Button text replacements
const buttonChanges = [
{ from: 'Purchase Tickets', to: 'Reserve Space' },
{ from: 'Get Tickets', to: 'Reserve Space' },
{ from: 'Buy Now', to: 'Register Now' }
];
// Change button text if it matches any configuration
function changeButtons() {
const buttons = [...document.querySelectorAll('button, a.btn')];
let changed = 0;
buttons.forEach(button => {
const currentText = button.textContent.trim();
const match = buttonChanges.find(change => change.from === currentText);
if (match) {
button.textContent = match.to;
changed++;
}
});
console.log(`Changed ${changed} button(s)`);
}
// Run when page loads
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', changeButtons);
} else {
changeButtons();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment