OpenAI ChatGPT新版UI切换

ChatGPT新版UI切换

目前为 2024-05-11 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name OpenAI ChatGPT新版UI切换
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  5. // @description ChatGPT新版UI切换
  6. // @author 树梢上有只鸟
  7. // @match https://chatgpt.com/*
  8. // @match https://chat.openai.com/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=chatgpt.com
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. // 添加样式
  18. const addStyles = () => {
  19. const styleSheet = document.createElement('style');
  20. styleSheet.type = 'text/css';
  21. styleSheet.innerText = `
  22. .modal-overlay {
  23. z-index: 1500;
  24. position: fixed;
  25. top: 0;
  26. left: 0;
  27. width: 100%;
  28. height: 100%;
  29. background-color: rgba(0, 0, 0, 0.5);
  30. display: flex;
  31. justify-content: center;
  32. align-items: center;
  33. visibility: hidden;
  34. opacity: 0;
  35. transition: all 0.3s;
  36. }
  37. .modal {
  38. background-color: white;
  39. padding: 20px;
  40. border-radius: 10px;
  41. box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  42. z-index: 1001;
  43. position: relative;
  44. min-width: 300px;
  45. min-height: 150px;
  46. width: auto;
  47. transition: all 0.3s;
  48. }
  49. .modal>h2 {
  50. margin-bottom: 10px;
  51. }
  52. .close-btn, .confirm-btn, .cancel-btn {
  53. cursor: pointer;
  54. margin-top: 20px;
  55. transition: all 0.3s;
  56.  
  57. }
  58. .close-btn {
  59. position: absolute;
  60. top: 10px;
  61. right: 10px;
  62. font-size: 16px;
  63. margin: 0;
  64. padding: 0;
  65. width: 20px;
  66. height: 20px;
  67. text-align: center;
  68. line-height: 20px;
  69. border-radius: 5px;
  70. }
  71. .close-btn:hover {
  72. background-color: #4CAF50;
  73. color: #fff;
  74. }
  75. .button-container {
  76. display: flex;
  77. justify-content: space-between;
  78. }
  79. .modal button {
  80. padding: 10px 25px;
  81. margin-right: 10px;
  82. border-radius: 10px;
  83. background-color: aliceblue;
  84. }
  85. .modal button:hover {
  86. background-color: #4CAF50;
  87. color: #fff;
  88. }
  89. bold {
  90. font-weight: bold;
  91. }
  92. `;
  93. document.head.appendChild(styleSheet);
  94. };
  95.  
  96. // 创建并显示弹窗
  97. const showModal = (currentMode) => {
  98. const modalOverlay = document.createElement('div');
  99. modalOverlay.className = 'modal-overlay';
  100. const modal = document.createElement('div');
  101. modal.className = 'modal';
  102. modal.innerHTML = `<h2>是否切换UI模式?</h2>
  103. <p>当前已 <bold>${currentMode ? '开启' : '关闭'}</bold> 新版UI</p>
  104. <p>点击确定进行切换</p>
  105. <div class="button-container">
  106. <button class="cancel-btn">取消</button>
  107. <button class="confirm-btn">确定</button>
  108. </div>
  109. <span class="close-btn">&times;</span>`;
  110.  
  111. modalOverlay.appendChild(modal);
  112. document.body.appendChild(modalOverlay);
  113.  
  114. const closeBtn = modal.querySelector('.close-btn');
  115. const confirmBtn = modal.querySelector('.confirm-btn');
  116. const cancelBtn = modal.querySelector('.cancel-btn');
  117.  
  118. // 关闭弹窗
  119. const closeModal = () => {
  120. modalOverlay.style.opacity = '0';
  121. setTimeout(() => modalOverlay.style.visibility = 'hidden', 300);
  122. };
  123.  
  124. closeBtn.addEventListener('click', closeModal);
  125. cancelBtn.addEventListener('click', closeModal);
  126.  
  127. // 确认并切换模式
  128. confirmBtn.addEventListener('click', function() {
  129. if (currentMode) {
  130. localStorage.setItem('STATSIG_LOCAL_STORAGE_INTERNAL_STORE_OVERRIDES_V3', '{"gates":{},"configs":{},"layers":{}}');
  131. } else {
  132. localStorage.setItem('STATSIG_LOCAL_STORAGE_INTERNAL_STORE_OVERRIDES_V3', '{"gates":{"chatgpt_fruit_juice":true},"configs":{},"layers":{}}');
  133. }
  134. location.reload();
  135. closeModal();
  136. });
  137.  
  138. modalOverlay.style.visibility = 'visible';
  139. modalOverlay.style.opacity = '1';
  140. };
  141.  
  142. // 按钮事件处理
  143. const addButton = () => {
  144. var button = document.createElement('button');
  145. button.textContent = '切换UI模式';
  146. button.style.position = 'fixed';
  147. button.style.bottom = '36px';
  148. button.style.right = '20px';
  149. button.style.zIndex = '1000';
  150. button.style.padding = '10px 20px';
  151. button.style.border = 'none';
  152. button.style.borderRadius = '5px';
  153. button.style.backgroundColor = '#4CAF50';
  154. button.style.color = 'white';
  155. button.style.cursor = 'pointer';
  156.  
  157. button.addEventListener('click', function() {
  158. var currentMode = localStorage.getItem('STATSIG_LOCAL_STORAGE_INTERNAL_STORE_OVERRIDES_V3');
  159. var isModeEnabled = currentMode && currentMode.includes('chatgpt_fruit_juice":true');
  160. showModal(isModeEnabled);
  161. });
  162.  
  163. document.body.appendChild(button);
  164. };
  165.  
  166. window.addEventListener('load', function() {
  167. addStyles();
  168. addButton();
  169. });
  170. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址