Website UI Switcher

Switch UI styles (modern/eras) for YouTube, Google, Roblox, Yahoo!, and Amazon.

As of 2024-09-09. See the latest version.

  1. // ==UserScript==
  2. // @name Website UI Switcher
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Switch UI styles (modern/eras) for YouTube, Google, Roblox, Yahoo!, and Amazon.
  6. // @author Your Name
  7. // @match *://*.youtube.com/*
  8. // @match *://*.google.com/*
  9. // @match *://*.roblox.com/*
  10. // @match *://*.yahoo.com/*
  11. // @match *://*.amazon.com/*
  12. // @grant GM_addStyle
  13. // @grant GM_registerMenuCommand
  14. // ==/UserScript==
  15.  
  16. // Default settings
  17. let settings = {
  18. style: "modern", // "modern" or "classical"
  19. roundedCorners: true, // true or false
  20. };
  21.  
  22. // Load settings from localStorage
  23. if (localStorage.getItem("uiSwitcherSettings")) {
  24. settings = JSON.parse(localStorage.getItem("uiSwitcherSettings"));
  25. }
  26.  
  27. // Apply styles based on settings
  28. function applyStyles() {
  29. if (settings.style === "modern") {
  30. GM_addStyle(`
  31. /* General Modern Rounded Styles */
  32. * {
  33. border-radius: ${settings.roundedCorners ? '10px' : '0px'} !important;
  34. box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
  35. transition: all 0.3s ease;
  36. }
  37. /* Modern Font */
  38. body, button, input {
  39. font-family: 'Arial', sans-serif !important;
  40. }
  41. `);
  42. } else {
  43. GM_addStyle(`
  44. /* Classical Styles with Square Corners */
  45. * {
  46. border-radius: 0px !important;
  47. box-shadow: none !important;
  48. transition: none;
  49. }
  50. /* Classical Font */
  51. body, button, input {
  52. font-family: 'Times New Roman', serif !important;
  53. }
  54. `);
  55. }
  56. }
  57.  
  58. // Save settings
  59. function saveSettings() {
  60. localStorage.setItem("uiSwitcherSettings", JSON.stringify(settings));
  61. applyStyles();
  62. }
  63.  
  64. // Settings page UI
  65. function createSettingsPage() {
  66. const settingsContainer = document.createElement("div");
  67. settingsContainer.id = "uiSwitcherSettingsContainer";
  68. settingsContainer.style.position = "fixed";
  69. settingsContainer.style.top = "10%";
  70. settingsContainer.style.left = "50%";
  71. settingsContainer.style.transform = "translateX(-50%)";
  72. settingsContainer.style.backgroundColor = "#fff";
  73. settingsContainer.style.padding = "20px";
  74. settingsContainer.style.boxShadow = "0px 0px 10px rgba(0, 0, 0, 0.2)";
  75. settingsContainer.style.zIndex = "9999";
  76.  
  77. settingsContainer.innerHTML = `
  78. <h2>UI Switcher Settings</h2>
  79. <label>
  80. Style:
  81. <select id="uiStyleSelector">
  82. <option value="modern" ${settings.style === 'modern' ? 'selected' : ''}>Modern</option>
  83. <option value="classical" ${settings.style === 'classical' ? 'selected' : ''}>Classical</option>
  84. </select>
  85. </label><br><br>
  86. <label>
  87. Rounded Corners:
  88. <input type="checkbox" id="roundedCornersCheckbox" ${settings.roundedCorners ? 'checked' : ''}>
  89. </label><br><br>
  90. <button id="saveSettingsButton">Save</button>
  91. <button id="closeSettingsButton">Close</button>
  92. `;
  93.  
  94. document.body.appendChild(settingsContainer);
  95.  
  96. // Add event listeners for controls
  97. document.getElementById("saveSettingsButton").addEventListener("click", () => {
  98. settings.style = document.getElementById("uiStyleSelector").value;
  99. settings.roundedCorners = document.getElementById("roundedCornersCheckbox").checked;
  100. saveSettings();
  101. alert("Settings saved!");
  102. });
  103.  
  104. document.getElementById("closeSettingsButton").addEventListener("click", () => {
  105. settingsContainer.remove();
  106. });
  107. }
  108.  
  109. // Register menu command to open settings page
  110. GM_registerMenuCommand("UI Switcher Settings", createSettingsPage);
  111.  
  112. // Apply styles on page load
  113. applyStyles();