`;
document.body.appendChild(settingsBox);
// Add event listeners
const radioButtons = settingsBox.querySelectorAll('input[name="currency"]');
radioButtons.forEach(radio => {
radio.addEventListener('change', function() {
if (this.checked) {
SELECTED_CURRENCY = this.value;
GM_setValue('selectedCurrency', SELECTED_CURRENCY);
console.log(`Currency changed to: ${SELECTED_CURRENCY.toUpperCase()}`);
// Reload page to apply changes
location.reload();
}
});
});
// Close button functionality
const closeButton = settingsBox.querySelector('#YuanConv-close');
closeButton.addEventListener('click', function() {
settingsBox.style.display = 'none';
});
// Auto-hide after 10 seconds
setTimeout(() => {
if (settingsBox.style.display !== 'none') {
settingsBox.style.display = 'none';
}
}, 10000);
}
// Function to show settings (can be called from console)
function showSettings() {
const existingSettings = document.getElementById('YuanConv-settings');
if (existingSettings) {
existingSettings.style.display = 'block';
} else {
createSettingsBox();
}
}
// Make showSettings available globally for console access
window.YuanConvShowSettings = showSettings;
// Function to walk through all nodes
function walkNodes(node) {
if (node.nodeType === Node.TEXT_NODE) {
processTextNode(node);
} else if (node.nodeType === Node.ELEMENT_NODE) {
// Check if this element contains yen prices with HTML structure
if (node.textContent.includes('¥') && node.innerHTML.includes('