|
235 | 235 | // @description:zu Thuthukisa iChatGPT ngemodi zesikrini ezibanzi/egcwele/ephezulu + imodi yokuvimbela i-spam. Futhi isebenza ku-perplexity.ai + poe.com! |
236 | 236 | // @author Adam Lui |
237 | 237 | // @namespace https://github.com/adamlui |
238 | | -// @version 2025.1.20 |
| 238 | +// @version 2025.1.20.1 |
239 | 239 | // @license MIT |
240 | 240 | // @icon https://assets.chatgptwidescreen.com/images/icons/widescreen-robot-emoji/icon48.png?v=844b16e |
241 | 241 | // @icon64 https://assets.chatgptwidescreen.com/images/icons/widescreen-robot-emoji/icon64.png?v=844b16e |
|
249 | 249 | // @compatible ghost |
250 | 250 | // @compatible qq |
251 | 251 | // @match *://chatgpt.com/* |
252 | | -// @match *://chat.openai.com/* |
253 | 252 | // @match *://*.perplexity.ai/* |
254 | 253 | // @match *://poe.com/* |
255 | 254 | // @connect cdn.jsdelivr.net |
|
417 | 416 | method: 'GET', url: `${app.urls.resourceHost}/assets/data/sites.json`, |
418 | 417 | onload: resp => resolve(JSON.parse(resp.responseText)) |
419 | 418 | }))) |
420 | | - sites.openai = { ...sites.chatgpt } // shallow copy to cover old domain |
421 | 419 |
|
422 | 420 | // Export DEPENDENCIES to imported resources |
423 | 421 | dom.imports.import({ env }) // for env.ui.scheme |
|
523 | 521 |
|
524 | 522 | get() { |
525 | 523 | let chatbar = document.querySelector(sites[env.site].selectors.input) |
526 | | - const lvlsToParent = /chatgpt|openai/.test(env.site) ? 3 : 2 |
| 524 | + const lvlsToParent = env.site == 'chatgpt' ? 3 : 2 |
527 | 525 | for (let i = 0 ; i < lvlsToParent ; i++) chatbar = chatbar?.parentNode |
528 | 526 | return chatbar |
529 | 527 | }, |
530 | 528 |
|
531 | 529 | tweak() { |
532 | | - if (!/chatgpt|openai/.test(env.site)) return |
| 530 | + if (!env.site == 'chatgpt') return |
533 | 531 | const chatbarDiv = chatbar.get() ; if (!chatbarDiv) return |
534 | 532 | const inputArea = chatbarDiv.querySelector(sites[env.site].selectors.input) ; if (!inputArea) return |
535 | 533 | if (chatgpt.canvasIsOpen()) inputArea.parentNode.style.width = '100%' |
|
600 | 598 |
|
601 | 599 | chatbar() { |
602 | 600 | chatbarStyle.innerText = ( |
603 | | - /chatgpt|openai/.test(env.site) ? ( config.widerChatbox ? '' |
| 601 | + env.site == 'chatgpt' ? ( config.widerChatbox ? '' |
604 | 602 | : `main form { max-width: ${chatbar.nativeWidth}px !important ; margin: auto }` ) |
605 | 603 | : env.site == 'poe' ? ( config.widerChatbox && config.wideScreen ? |
606 | 604 | '[class^=ChatPageMainFooter_footerInner] { width: 98% ; margin-right: 15px }' : '' ) |
|
609 | 607 |
|
610 | 608 | tweaks() { |
611 | 609 | tweaksStyle.innerText = ( |
612 | | - ( /chatgpt|openai/.test(env.site) ? ( |
| 610 | + ( env.site == 'chatgpt' ? ( |
613 | 611 | '[id$=-btn]:hover { opacity: 100% !important }' // prevent chatbar btn dim on hover |
614 | 612 | + 'main { overflow: clip !important }' // prevent h-scrollbar... |
615 | 613 | // ...on sync.mode('fullWindow) => delayed chatbar.tweak() |
|
632 | 630 |
|
633 | 631 | wideScreen() { |
634 | 632 | wideScreenStyle.innerText = ( |
635 | | - /chatgpt|openai/.test(env.site) ? ( |
| 633 | + env.site == 'chatgpt' ? ( |
636 | 634 | '.text-base { max-width: 100% !important }' // widen outer container |
637 | 635 | + ( !env.tallChatbar ? '.text-base:nth-of-type(2) { max-width: 97% !important }' : '' ) |
638 | 636 | ) : env.site == 'perplexity' ? ( |
|
689 | 687 | : chatgpt.isFullScreen() ) |
690 | 688 | settings.save(mode, state) ; buttons.update.svg(mode) ; update.tooltip(mode) |
691 | 689 | if (mode == 'fullWindow') sync.fullerWin() |
692 | | - if (/chatgpt|openai/.test(env.site)) setTimeout(() => chatbar.tweak(), // update inner width |
| 690 | + if (env.site == 'chatgpt') setTimeout(() => chatbar.tweak(), // update inner width |
693 | 691 | mode == 'fullWindow' && ( config.wideScreen || config.fullerWindows ) |
694 | 692 | && config.widerChatbox ? 111 : 0) // delay if toggled to/from active WCB to avoid wrong width |
695 | 693 | else if (env.site == 'poe' && config.widerChatbox) update.style.chatbar() // sync WCB |
|
739 | 737 | menu.register() ; if (env.extensionInstalled) return |
740 | 738 |
|
741 | 739 | // Init UI props |
742 | | - if (/chatgpt|openai/.test(env.site)) { |
| 740 | + if (env.site == 'chatgpt') { |
743 | 741 | sites[env.site].hasSidebar = !!await Promise.race([ |
744 | 742 | dom.getLoadedElem(sites.chatgpt.selectors.btns.sidebarToggle), // DOM element if sidebar toggle loads |
745 | 743 | dom.getLoadedElem(sites.chatgpt.selectors.btns.login).then(() => false), // null if login button loads |
|
776 | 774 |
|
777 | 775 | // Apply general style TWEAKS |
778 | 776 | const tcbStyle = ( // heighten chatbox |
779 | | - /chatgpt|openai/.test(env.site) ? `div[class*=prose]:has(${sites[env.site].selectors.input})` |
| 777 | + env.site == 'chatgpt' ? `div[class*=prose]:has(${sites[env.site].selectors.input})` |
780 | 778 | : sites[env.site].selectors.input ) |
781 | 779 | + '{ max-height: 68vh }' |
782 | 780 | const hhStyle = sites[env.site].selectors.header + '{ display: none !important }' // hide header |
783 | | - + ( /chatgpt|openai/.test(env.site) ? 'main { padding-top: 12px }' : '' ) // increase top-padding |
| 781 | + + ( env.site == 'chatgpt' ? 'main { padding-top: 12px }' : '' ) // increase top-padding |
784 | 782 | const hfStyle = sites[env.site].selectors.footer + '{ display: none }' // hide footer |
785 | 783 |
|
786 | 784 | update.style.tweaks() ; document.head.append(tweaksStyle); |
|
792 | 790 | const wideScreenStyle = dom.create.style() |
793 | 791 | wideScreenStyle.id = 'wideScreen-mode' // for sync.mode() |
794 | 792 | if (!chatbar.get()) await dom.getLoadedElem(sites[env.site].selectors.input) |
795 | | - if (/chatgpt|openai/.test(env.site)) // store native chatbar width for Wider Chatbox style |
| 793 | + if (env.site == 'chatgpt') // store native chatbar width for Wider Chatbox style |
796 | 794 | chatbar.nativeWidth = /\d+/.exec(getComputedStyle(document.querySelector('main form')).width)[0] |
797 | 795 | update.style.wideScreen() |
798 | 796 |
|
|
825 | 823 | buttons.state.status = 'missing' ; buttons.insert() } |
826 | 824 |
|
827 | 825 | // Maintain button colors + Widescreen button visibility on snowflake chatgpt.com |
828 | | - if (/chatgpt|openai/.test(env.site)) { |
| 826 | + if (env.site == 'chatgpt') { |
829 | 827 |
|
830 | 828 | // Update button colors on temp chat toggle |
831 | 829 | const chatbarIsBlack = !!document.querySelector('div[class*=bg-black]:not([id$=-btn])') |
|
870 | 868 | sync.mode('fullScreen') ; config.f11 = false } |
871 | 869 | else if (!config.fullScreen && fullScreenState) // entering full screen |
872 | 870 | sync.mode('fullScreen') |
873 | | - if (/chatgpt|openai/.test(env.site)) chatbar.tweak() // update ChatGPT chatbar inner width |
| 871 | + if (env.site == 'chatgpt') chatbar.tweak() // update ChatGPT chatbar inner width |
874 | 872 | }) |
875 | 873 |
|
876 | 874 | // Add KEY LISTENER to enable flag on F11 + stop generating text on ESC |
|
0 commit comments