Greasy Fork is available in English.

Website UI Switcher

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

  1. // ==UserScript==
  2. // @name Website UI Switcher
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Switch UI styles (modern/retro/material) 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", "retro", or "material"
  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 if (settings.style === "retro") {
  43. GM_addStyle(`
  44. /* Retro Styles */
  45. * {
  46. border-radius: ${settings.roundedCorners ? '10px' : '0px'} !important;
  47. box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
  48. background-color: #282c34 !important;
  49. color: #61dafb !important;
  50. transition: all 0.3s ease;
  51. }
  52. /* Retro Font */
  53. body, button, input {
  54. font-family: 'Press Start 2P', cursive !important;
  55. }
  56. `);
  57. } else if (settings.style === "material") {
  58. GM_addStyle(`
  59. /* Material Design Lite Styles */
  60. @import url('https://fonts.googleapis.com/icon?family=Material+Icons');
  61. @import url('https://code.getmdl.io/1.3.0/material.indigo-pink.min.css');
  62. * {
  63. border-radius: ${settings.roundedCorners ? '4px' : '0px'} !important;
  64. box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.2) !important;
  65. transition: all 0.3s ease;
  66. }
  67.  
  68. body {
  69. font-family: 'Roboto', sans-serif !important;
  70. }
  71.  
  72. .mdl-button {
  73. border-radius: 4px !important;
  74. }
  75. `);
  76. }
  77. }
  78.  
  79. // Save settings
  80. function saveSettings() {
  81. localStorage.setItem("uiSwitcherSettings", JSON.stringify(settings));
  82. applyStyles();
  83. }
  84.  
  85. // Settings page UI
  86. function createSettingsPage() {
  87. const settingsContainer = document.createElement("div");
  88. settingsContainer.id = "uiSwitcherSettingsContainer";
  89. settingsContainer.className = "mdl-card mdl-shadow--4dp";
  90. settingsContainer.style.position = "fixed";
  91. settingsContainer.style.top = "10%";
  92. settingsContainer.style.left = "50%";
  93. settingsContainer.style.transform = "translateX(-50%)";
  94. settingsContainer.style.zIndex = "9999";
  95. settingsContainer.style.width = "300px";
  96.  
  97. settingsContainer.innerHTML = `
  98. <div class="mdl-card__title mdl-card--expand">
  99. <h2 class="mdl-card__title-text">UI Switcher Settings</h2>
  100. </div>
  101. <div class="mdl-card__supporting-text">
  102. <label for="uiStyleSelector">
  103. Style:
  104. <select id="uiStyleSelector" class="mdl-selectfield__select">
  105. <option value="modern" ${settings.style === 'modern' ? 'selected' : ''}>Modern</option>
  106. <option value="retro" ${settings.style === 'retro' ? 'selected' : ''}>Retro</option>
  107. <option value="material" ${settings.style === 'material' ? 'selected' : ''}>Material</option>
  108. </select>
  109. </label><br><br>
  110. <label for="roundedCornersCheckbox">
  111. Rounded Corners:
  112. <input type="checkbox" id="roundedCornersCheckbox" ${settings.roundedCorners ? 'checked' : ''}>
  113. </label><br><br>
  114. </div>
  115. <div class="mdl-card__actions mdl-card--border">
  116. <button id="saveSettingsButton" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored">
  117. Save
  118. </button>
  119. <button id="resetSettingsButton" class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent">
  120. Reset to Default
  121. </button>
  122. <button id="closeSettingsButton" class="mdl-button mdl-js-button mdl-button--raised">
  123. Close
  124. </button>
  125. </div>
  126. `;
  127.  
  128. document.body.appendChild(settingsContainer);
  129.  
  130. // Initialize MDL components
  131. componentHandler.upgradeDom();
  132.  
  133. // Add event listeners for controls
  134. document.getElementById("saveSettingsButton").addEventListener("click", () => {
  135. settings.style = document.getElementById("uiStyleSelector").value;
  136. settings.roundedCorners = document.getElementById("roundedCornersCheckbox").checked;
  137. saveSettings();
  138. alert("Settings saved!");
  139. });
  140.  
  141. document.getElementById("resetSettingsButton").addEventListener("click", () => {
  142. localStorage.removeItem("uiSwitcherSettings");
  143. settings = {
  144. style: "modern",
  145. roundedCorners: true
  146. };
  147. document.getElementById("uiStyleSelector").value = 'modern';
  148. document.getElementById("roundedCornersCheckbox").checked = true;
  149. saveSettings();
  150. alert("Settings reset to default!");
  151. });
  152.  
  153. document.getElementById("closeSettingsButton").addEventListener("click", () => {
  154. settingsContainer.remove();
  155. });
  156. }
  157.  
  158. // Register menu command to open settings page
  159. GM_registerMenuCommand("UI Switcher Settings", createSettingsPage);
  160.  
  161. // Apply styles on page load
  162. applyStyles();