3.6 KiB
3.6 KiB
Greasemonkey Quick Start Guide
Get up and running with Greasemonkey in 5 minutes!
Installation
Chrome
- Open Chrome
- Go to
chrome://extensions/ - Enable "Developer mode" (top-right toggle)
- Click "Load unpacked"
- Select the
chromefolder - Done! 🎉
Firefox
- Open Firefox
- Go to
about:debugging#/runtime/this-firefox - Click "Load Temporary Add-on"
- Select
firefox/manifest.json - Done! 🎉
Your First Rule
Let's create a simple rule that changes Google's background color:
- Click the Greasemonkey icon in your browser toolbar
- Click "+ Add Rule"
- Fill in the form:
- Rule Name:
Google Dark Background - Match Type:
URL contains string - URL Pattern:
google.com - CSS Code:
body { background-color: #1a1a1a !important; color: #e0e0e0 !important; } - Leave JavaScript blank
- Keep Enabled checked
- Rule Name:
- Click "Save Rule"
- Visit google.com and see the dark background!
Testing with Test Page
A test page is included: test-page.html
- Open
test-page.htmlin your browser - Create a rule:
- Rule Name:
Test Page Alert - Match Type:
Page contains element - Element Selector:
#test-element-1 - JavaScript Code:
alert('Greasemonkey is working!');
- Rule Name:
- Reload the test page
- You should see an alert!
Common Use Cases
Hide Annoying Elements
.advertisement,
.popup-banner,
#cookie-notice {
display: none !important;
}
Change Colors
body {
background-color: #1a1a1a !important;
color: #ffffff !important;
}
Auto-Click Buttons
const button = document.querySelector('.accept-button');
if (button) button.click();
Add Custom Content
const banner = document.createElement('div');
banner.textContent = 'Custom banner added by Greasemonkey!';
banner.style.cssText = 'position:fixed;top:0;width:100%;background:red;color:white;padding:10px;z-index:9999;';
document.body.insertBefore(banner, document.body.firstChild);
Tips
- Use
!importantin CSS to override existing styles - Check the console (F12) for error messages
- Start simple and test before adding complex rules
- Toggle rules off if they cause problems
- Element selectors can be found by right-clicking → Inspect Element
Troubleshooting
Rule not working?
- ✓ Is the rule enabled? (check the toggle)
- ✓ Does the URL pattern match? (try a shorter string)
- ✓ Does the element exist? (test in console:
document.querySelector('selector')) - ✓ Did you reload the page?
CSS not applying?
- Add
!importantto CSS rules - Check for syntax errors
JavaScript not running?
- Check browser console (F12) for errors
- Test code in console first
Next Steps
- Read the full README.md for detailed documentation
- See BUILD.md for distribution instructions
- Experiment with different selectors and code
- Share your rules with others!
Example: Complete Rule
Here's a complete rule that works on GitHub to highlight pull requests:
- Rule Name:
GitHub PR Highlight - Match Type:
Both URL and element - URL Pattern:
github.com - Element Selector:
.js-issue-row - CSS Code:
.js-issue-row { border-left: 4px solid #28a745 !important; background-color: #f0fff4 !important; } - JavaScript Code:
console.log('GitHub PR highlighting active');
Help
Need help? Check:
- Browser console (F12) for errors
- README.md for full documentation
- Element inspector to find correct selectors
Happy scripting! 🐒✨