A little positivity goes a long way.
A userscript that displays positive affirmations in a clean, modern floating element that refreshes periodically. The affirmations are fetched from the Affirmations.dev API.
- Displays motivational affirmations in a floating element
- Automatically refreshes every 30 seconds
- Clean, modern UI with smooth hover effects
- Easy-to-use close button
- Works on any website
- Install a userscript manager like Tampermonkey for your browser
- Click here to install the script
- Click "Install" or "OK" when prompted by your userscript manager
Once installed, the script will:
- Create a floating element in the top-right corner of any webpage
- Display a new affirmation every 30 seconds
- Allow you to close the element using the X button
- Automatically handle API errors with fallback messages
The script uses the Affirmations.dev API to fetch random positive affirmations:
- Endpoint:
https://www.affirmations.dev/ - Method: GET
- Response Format: JSON with an
affirmationfield
The element features:
- Fixed positioning in the top-right corner
- White background with subtle shadow
- Rounded corners (10px radius)
- Responsive width (200px - 300px)
- Clean sans-serif typography
- Smooth hover transitions
The script includes comprehensive error handling:
- API fetch failures
- JSON parsing errors
- Network connectivity issues
- Tampermonkey or compatible userscript manager
- Font Awesome 6.7.2 SVG icon (embedded)
- Chrome
- Firefox
- Safari
- Edge
- Any browser that supports userscripts