Wide ai chat

adds support for iframe

当前为 2025-05-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Wide ai chat
  3. // @description adds support for iframe
  4. // @match http*://chatgpt.com/c/*
  5. // @match http*://chatgpt.com/*
  6. // @match http*://new.oaifree.com/*
  7. // @match https://shared.oaifree.com/*
  8. // @match http*://www.aicnn.cn/oaifree/*
  9. // @match http*://chat.aicnn.xyz/*
  10. // @match http*://plus.aivvm.com/*
  11. // @match http*://kimi.moonshot.cn/chat/*
  12. // @match http*://kimi.moonshot.cn/*
  13. // @match http*://tongyi.aliyun.com/qianwen*
  14. // @match https://www.tiangong.cn/*
  15. // @match http*://chatglm.cn/*
  16. // @match https://claude.ai/*
  17. // @match https://chat.deepseek.com/*
  18. // @include https://*claude*/*
  19. // @match https://chat.kelaode.ai/*
  20. // @match https://gemini.google.com/*
  21. // @match https://grok.com/*
  22. // @match https://yuanbao.tencent.com/*
  23. // @icon data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHJlY3Qgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiByeD0iNSIgcnk9IjUiIGZpbGw9IiM2YmIiLz4KICA8cGF0aCBkPSJtMTcgMTMuNyA0LTQtNC00bS0xMCA4LTQtNCA0LTRtMTMuOTk5IDMuODI1SDMuMjE1Ii8+CiAgPHBhdGggZD0iTTE5IDE2aC0yLjVhLjk5LjkgMCAwIDAtLjc3NS4zNzVsLTIuOSAzLjY1Yy0uNC41LTEuMTYyLjUtMS41NjMgMGwtMi45MjUtMy42NUEuOTkuOSAwIDAgMCA3LjUgMTZINWMtMS42NjMgMC0zLTEuMzM4LTMtM1Y2YzAtMS42NjIgMS4zNS0zIDMtM2gxNGEzIDMgMCAwIDEgMyAzdjdjMCAxLjY2Mi0xLjM1IDMtMyAzWiIgZmlsbC1vcGFjaXR5PSIuMTYiIHN0cm9rZT0iI0VFRSIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIvPgo8L3N2Zz4K
  24. // @author Yearly
  25. // @grant GM_addStyle
  26. // @version 0.0.1.20250521092707
  27. // @namespace https://greasyfork.org/users/1435046
  28. // ==/UserScript==
  29.  
  30. (function() {
  31.  
  32. var limit_anser_height = false;
  33.  
  34. if ( /kimi.moonshot.cn/.test(location.href) ) {
  35. console.log("kimi");
  36. GM_addStyle(`
  37. div[data-testid] div[data-index] div.MuiBox-root {
  38. max-width: 100% !important;
  39. }
  40. #app div.chat-editor {
  41. max-width: calc(100% - 50px);
  42. }
  43.  
  44. div[class^=mainContent] div.MuiBox-root > div[class^=chatBottom_]
  45. {
  46. max-width: calc(100% - 50px);
  47. }
  48. div.chat-detail-main div.chat-content-container > div.chat-content-list {
  49. max-width: calc(100% - 50px);
  50. }
  51. div.history-modal-container div.history-modal-list {
  52. max-width: 90%;
  53. }
  54.  
  55. #scroll-list div[class^=chatItemBox_].MuiBox-root {
  56. max-width: 100%;
  57. }
  58. #root > div > div[class*=mainContent] > div[class*=layoutContent] > div.MuiBox-root > div.MuiBox-root[class*=homepage] > div.MuiContainer-root.MuiContainer-maxWidthMd {
  59. max-width: calc(100% - 100px);
  60. }
  61. div.MuiBox-root[class^=homepage] div[class^=mainContent] div[class^=chatInput_ ] div[class^=inputInner_] div[class^=editor] {
  62. max-height: 600px;
  63. }
  64. `);
  65.  
  66. if (limit_anser_height) {
  67. GM_addStyle(`
  68. div[class^=mainContent] div[class^=chatInput_ ] div[class^=inputInner_] div[class^=editor] { max-height: 400px; }
  69. `);
  70. }
  71. } else if ( /chat.deepseek.com/.test(location.href) ) {
  72. console.log("deepseek");
  73. GM_addStyle(`
  74. div:has( > #latest-context-divider) {
  75. width: 95% !important;
  76. }
  77. div:has( > div > #chat-input) {
  78. width: 95% !important;
  79. max-width: 90vw;
  80. }
  81. :root {
  82. --message-list-max-width: calc(100% - 20px);
  83. }
  84. #root > div > div.d4850e57 > div.d7ae46fd > div.ad902ce3 {
  85. max-width: calc(100% - 20px);
  86. }
  87. #root > div > div.c3ecdb44 > div.f2eea526 > div > div > div.a2f8e4bb {
  88. max-width: calc(100% - 20px);
  89. }
  90.  
  91. #root > div > div.c3ecdb44 > div.f2eea526 > div > div > div.a2f8e4bb > div.aaff8b8f.eb830e32 > div > div > div.fad49dec {
  92. max-height: 50vh;
  93. }
  94. `);
  95.  
  96. if (limit_anser_height) {
  97. GM_addStyle(`
  98. #root > div > div > div:nth-child(2) > div > div > div > div > div > div {
  99. max-height: 600px;
  100. overflow-y: auto;
  101. }`);
  102. }
  103. } else if ( /tongyi.aliyun.com/.test(location.href) ) {
  104. console.log("tongyi");
  105. GM_addStyle(`
  106. div[class^=mainContent] div[class^=questionItem--] {
  107. width:90% !important;
  108. max-width: 90vw;
  109. }
  110. div[class^=mainContent] div[class^=answerItem--] {
  111. width:90% !important;
  112. max-width: 90vw;
  113. }
  114. div[class^=mainContent] div[class^=inputOutWrap--] {
  115. width:90% !important;
  116. max-width: 90vw;
  117. }
  118. `);
  119. } else if ( /www.tiangong.cn/.test(location.href) ) {
  120. console.log("tiangong");
  121. GM_addStyle(`
  122. #app > div > div > main > div.overflow-y-scroll.w-full > div.search-content.relative.flex.w-full.flex-row.justify-center {
  123. max-width: calc(100% - 100px);
  124. --search-max-width: calc(100% - 100px);
  125. }
  126. #app > div > div > main > div.overflow-y-scroll.w-full > div.search-content.relative.flex.w-full.flex-row.justify-center > label.w-full.cursor-default.select-auto {
  127. max-width: calc(100% - 100px);
  128. --search-max-width: calc(100% - 100px);
  129. }
  130. label.w-full {
  131. max-width: calc(100% - 100px);
  132. --search-max-width: calc(100% - 100px);
  133. }
  134. :root {
  135. --search-max-width: calc(100% - 100px);
  136. }`);
  137. } else if (/chatglm.cn/.test(location.href)) {
  138. console.log("chatglm");
  139. GM_addStyle(`
  140. div.conversation-inner.dialogue > div.conversation-list.detail > div.item.conversation-item {
  141. max-width: 95vw !important;
  142. }
  143. .markdown-body.md-body {
  144. max-width: 95vw !important;
  145. }
  146. `);
  147. } else if (/gemini.google.com/.test(location.href)) {
  148. console.log("gemini");
  149. GM_addStyle(`
  150. #chat-history > infinite-scroller > div {
  151. max-width: calc(100% - 20px);
  152. }
  153. #app-root > main > side-navigation-v2 > bard-sidenav-container > bard-sidenav-content > div > div > div.content-container > chat-window > div.chat-container.ng-star-inserted > div.bottom-container.response-optimization.ng-star-inserted {
  154. max-width: calc(100% - 20px);
  155. }
  156. #app-root > main > side-navigation-v2 > bard-sidenav-container > bard-sidenav-content > div > div > div.content-container > chat-window > div.chat-container.ng-star-inserted > div.bottom-container.response-optimization.ng-star-inserted > div.input-area-container.ng-star-inserted {
  157. max-width: calc(100% - 20px);
  158. }`);
  159.  
  160. } else if (/grok.com/.test(location.href)) {
  161. console.log("grok.com");
  162. GM_addStyle(`
  163. main div.relative.w-full.flex.flex-col.items-center > div.w-full.max-w-3xl.flex.flex-col {
  164. max-width: calc(100% - 20px);
  165. }
  166. main div.flex.flex-col.items-center > div.flex.flex-col-reverse.items-center > form.bottom-0.w-full.items-center.justify-center > div.justify-center.w-full {
  167. max-width: calc(100% - 20px);
  168. }
  169. .max-w-3xl {
  170. width:95% !important;
  171. max-width:96% !important;
  172. }
  173. div.absolute.mx-auto.z-50 {
  174. max-width: calc(100% - 50px);
  175. }
  176. div.absolute.mx-auto.z-50 .duration-100.relative.w-full {
  177. max-width: calc(100% - 50px);
  178. }
  179. `);
  180.  
  181. } else if (/yuanbao.tencent.com/.test(location.href)) {
  182. console.log("yuanbao");
  183. GM_addStyle(`
  184. :root {
  185. --hunyuan-chat-list-max-width: calc(100% - 40px);
  186. }`);
  187. } else {
  188. console.log("chatgpt/claude");
  189.  
  190. const chatWiderStyle = `
  191. .xl\:max-w-\[48rem\] {
  192. width:95% !important;
  193. max-width:96% !important;
  194. }
  195. div.mx-auto.md:max-w-3xl {
  196. max-width: calc(100% - 10px);
  197. }
  198. div.mx-auto.flex {
  199. max-width: calc(100% - 10px);
  200. }
  201. div.ProseMirror.break-words.ProseMirror-focused {
  202. max-width:100%;
  203. }
  204. body > div.flex.min-h-screen.w-full div.flex.flex-col div.flex.gap-2 div.mt-1.max-h-96.w-full.overflow-y-auto.break-words > div.ProseMirror.break-words{
  205. max-width:90%;
  206. }
  207.  
  208. body > div.flex.min-h-screen.w-full > div > main > div.top-5.z-10.mx-auto.w-full.max-w-2xl.md{
  209. max-width:100%;
  210. }
  211.  
  212. body > div.flex.min-h-screen.w-full > div > main > div.mx-auto.w-full.max-w-2xl.px-1.md {
  213. max-width:100%;
  214. }
  215. body > div.flex.min-h-screen.w-full > div > main.max-w-7xl {
  216. max-width: 90rem;
  217. }
  218. main > div.composer-parent article > div.text-base > div.mx-auto {
  219. max-width: 95%;
  220. }
  221. main article > div.text-base > div.mx-auto {
  222. max-width: 95%;
  223. } `;
  224.  
  225. if (limit_anser_height) {
  226. GM_addStyle(`
  227. pre > div.rounded-md > div.overflow-y-auto {
  228. max-height: 50vh;
  229. overflow: auto;
  230. scrollbar-width: thin;
  231. scrollbar-color: #aaaa #1111;
  232. }
  233. .code-block__code {
  234. max-height: 50vh;
  235. overflow: auto;
  236. scrollbar-width: thin;
  237. scrollbar-color: #aaaa #1111;
  238. }
  239. pre > div.rounded-md > div.overflow-y-auto ::-webkit-scrollbar-track {
  240. background: #1111;
  241. }
  242. pre > div.rounded-md > div.overflow-y-auto ::-webkit-scrollbar-thumb {
  243. background: #aaaa;
  244. }
  245. pre > div.rounded-md > div.overflow-y-auto ::-webkit-scrollbar-thumb:hover {
  246. background: #0008;
  247. }
  248. `);
  249. }
  250.  
  251. GM_addStyle(chatWiderStyle);
  252.  
  253. enhanceAddStyle();
  254.  
  255. function enhanceAddStyle(setStyle) {
  256. const chat = document.querySelector("main > div.composer-parent article > div.text-base > div.mx-auto");
  257. if (chat) {
  258. if( window.getComputedStyle(chat).maxWidth != '95%') {
  259. GM_addStyle(chatWiderStyle);
  260. }
  261. } else {
  262. setTimeout(enhanceAddStyle, 1100);
  263. }
  264. }
  265.  
  266. function link_addhref() {
  267. document.querySelectorAll('div[data-message-id] a[rel="noreferrer"]').forEach(function(item) {
  268. if(!item.href){
  269. item.href = item.innerText;
  270. item.target = "_blank"
  271. }
  272. });
  273. setTimeout(link_addhref, 1800);
  274. }
  275. link_addhref();
  276.  
  277. }
  278.  
  279. })();
  280.  
  281. +
  282. 66
  283.