User:Ffeferg3/common.js

// Dark mode for Wikipedia function enableDarkMode { document.body.classList.add('dark-mode'); }

function disableDarkMode { document.body.classList.remove('dark-mode'); }

function toggleDarkMode { if (document.body.classList.contains('dark-mode')) { disableDarkMode; } else { enableDarkMode; } }

// Add a button to toggle dark mode function addDarkModeToggle { var toggleButton = document.createElement('button'); toggleButton.innerHTML = 'Toggle Dark Mode'; toggleButton.onclick = toggleDarkMode;

// Append the button to the page document.body.appendChild(toggleButton); }

// Style adjustments for dark mode with gray theme var style = document.createElement('style'); style.textContent = ` .dark-mode { background-color: #333; /* Dark gray background */ color: #ccc; /* Light text color */ } `;

// Append the style to the document head document.head.appendChild(style);

// Call the function to add the dark mode toggle button addDarkModeToggle;