YuanConv - Yuan Currency Converter
A Violentmonkey/Tampermonkey userscript that automatically converts Chinese Yuan (¥) prices to EUR or USD on buff.163.com using real-time exchange rates.
Features
- Multi-Currency Support: Convert to both EUR (€) and USD ($)
- Real-time Exchange Rates: Fetches current CNY rates from a reliable API
- HTML Structure Support: Handles complex price formats like
¥ 11<small>.7</small>
- Dynamic Content: Works with both static and dynamically loaded content
- Persistent Settings: Remembers your currency preference using GM storage
- Interactive Settings UI: Clean settings box with currency selection
- Keyboard Shortcuts: Quick access via Ctrl+Shift+Y
- Fallback Protection: Uses backup rates if API fails
- Auto-updates: Monitors page changes and converts new prices automaticallyn to Euro Converter
A Violentmonkey/Tampermonkey userscript that automatically converts Chinese Yuan (¥) prices to Euros (€) on buff.163.com using real-time exchange rates.
Features
- Real-time Exchange Rates: Fetches current CNY to EUR rates from a reliable API
- HTML Structure Support: Handles complex price formats like
¥ 11<small>.7</small>
- Dynamic Content: Works with both static and dynamically loaded content
- Fallback Protection: Uses a backup rate if API fails
- Auto-updates: Monitors page changes and converts new prices automatically
Installation
Install a userscript manager:
Click on the raw script link or copy the script content
Your userscript manager should automatically detect and prompt you to install the script
Enable the script and visit buff.163.com
How It Works
The script automatically detects and converts various yuan price formats to your selected currency:
Simple Format
¥ 3588
→ 427.37€
(EUR) or $499.49
(USD)
¥ 1,234
→ 147.84€
(EUR) or $171.84
(USD)
Complex HTML Format (buff.163.com specific)
<strong>¥ 11<small>.7</small></strong>
→ 1.40€
(EUR) or $1.63
(USD)
<strong>¥ 2,588<small>.5</small></strong>
→ 309.84€
(EUR) or $360.12
(USD)
Currency Selection
The script includes an interactive settings panel where you can:
- Switch between EUR (€) and USD ($)
- View current exchange rates
- Save preferences permanently
Controls
- Settings Panel: Appears automatically on page load
- Keyboard Shortcut:
Ctrl+Shift+Y
to show/hide settings
- Console Command: Type
YuanConvShowSettings()
in browser console
- Auto-hide: Settings panel disappears after 10 seconds
API Integration
The script fetches real-time exchange rates from:
https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/cny.json
Response format:
{
"date": "2025-07-19",
"cny": {
"usd": 0.13925057,
"eur": 0.11974298
}
}
User Interface
Settings Panel
The script provides an intuitive settings interface:
- Currency Selection: Radio buttons for EUR/USD
- Rate Display: Shows current exchange rate (1 CNY = X EUR/USD)
- Auto-save: Preferences saved automatically using GM_setValue()
- Clean Design: Non-intrusive floating panel
Access Methods
- Automatic: Panel shows on page load for 10 seconds
- Keyboard: Press
Ctrl+Shift+Y
anytime
- Console: Run
YuanConvShowSettings()
command
- Persistent: Your choice is remembered across sessions
Configuration
Changing Currency
To switch between EUR and USD:
- Press
Ctrl+Shift+Y
to open settings
- Select your preferred currency (€ or $)
- Settings save automatically and page refreshes
- All prices convert to new currency immediately
Changing Exchange Rate Source
To use a different exchange rate API, modify the fetchConversionRate()
function:
const response = await fetch('YOUR_API_URL_HERE');
Changing Fallback Rates
Update the fallback rates if needed:
let CONVERSION_RATES = {
eur: 0.119, // Change EUR fallback rate
usd: 0.139 // Change USD fallback rate
};
Adding More Websites
To use on other websites, add them to the @match
directive:
// @match *://buff.163.com/*
// @match *://example.com/*
Development
Script Metadata
- Name: Yuan Currency Converter
- Version: 1.2
- Author: enzomtp
- Namespace: https://github.com/enzomtpYT/YuanConv
- Target Site: buff.163.com
- Grants: GM_setValue, GM_getValue (for persistent settings)
Key Functions
fetchConversionRate()
: Gets real-time exchange rates for both EUR and USD
convertYenToCurrency()
: Performs currency conversion based on selected currency
getCurrentRate()
: Returns current conversion rate for selected currency
getCurrencySymbol()
: Returns appropriate symbol (€ or $)
createSettingsBox()
: Creates interactive settings UI
showSettings()
: Shows/hides settings panel
processElement()
: Handles HTML-structured prices
processTextNode()
: Handles simple text prices
walkNodes()
: Recursively processes page content
Troubleshooting
Script Not Working
- Check if the userscript manager is enabled
- Verify the script is active for buff.163.com
- Check browser console for error messages
- Ensure you're on a supported page
Wrong Conversion Rates
- Check console for "Updated CNY rates" message with both EUR and USD
- Verify API is accessible (check network tab)
- If API fails, script uses fallback rates (EUR: 0.119, USD: 0.139)
Settings Not Saving
- Ensure Violentmonkey/Tampermonkey has storage permissions
- Check that @grant GM_setValue and GM_getValue are enabled
- Try clearing userscript storage and reconfiguring
Currency Not Switching
- Settings save automatically when you select a currency
- Page reloads to apply changes immediately
- Check console for "Currency changed to: XXX" message
Prices Not Converting
- Check if prices are in the expected format (¥ symbol + numbers)
- Some cached content might need a page refresh
- Dynamic content should convert automatically
- Try pressing Ctrl+Shift+Y to access settings
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test on buff.163.com
- Submit a pull request
Support
- Issues: Report bugs on GitHub Issues
- Updates: Script auto-updates from GitHub
- Website: buff.163.com compatibility focused
Changelog
v1.2
- NEW: Multi-currency support (EUR and USD)
- NEW: Interactive settings panel with currency selection
- NEW: Persistent settings using GM_setValue/GM_getValue
- NEW: Keyboard shortcut (Ctrl+Shift+Y) to show settings
- NEW: Console command
ytoeShowSettings()
for quick access
- IMPROVED: Fetches both EUR and USD rates from API
- IMPROVED: Auto-reload page when currency changes
- IMPROVED: Enhanced UI with modern design
- UPDATED: Script name to "Yuan Currency Converter"
v1.1
- Added real-time exchange rate fetching
- Improved HTML structure parsing
- Added support for decimal prices in
<small>
tags
- Enhanced error handling and fallback protection
v1.0
- Initial release
- Basic yen to euro conversion
- Static exchange rate
- buff.163.com support