|
225 | 225 | // @description:zu Ziba itshala lokucabanga okuzoshintshwa ngokuzenzakalelayo uma ukubuka chatgpt.com |
226 | 226 | // @author Adam Lui |
227 | 227 | // @namespace https://github.com/adamlui |
228 | | -// @version 2026.7.24.1 |
| 228 | +// @version 2026.7.25 |
229 | 229 | // @license MIT |
230 | 230 | // @icon data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22180%22%20height=%22180%22%20fill=%22none%22%3E%3Cstyle%3E:root%7B--primary-fill:%23000;--secondary-fill:%23fff;%7D@media%20(prefers-color-scheme:dark)%7B:root%7B--primary-fill:%23fff;--secondary-fill:%23000;%7D%7D%3C/style%3E%3Cg%20clip-path=%22url(%23a)%22%3E%3Crect%20width=%22180%22%20height=%22180%22%20fill=%22var(--primary-fill)%22%20rx=%2290%22/%3E%3Cg%20clip-path=%22url(%23b)%22%3E%3Cpath%20fill=%22var(--secondary-fill)%22%20d=%22M75.91%2073.628V62.232c0-.96.36-1.68%201.199-2.16l22.912-13.194c3.119-1.8%206.838-2.639%2010.676-2.639%2014.394%200%2023.511%2011.157%2023.511%2023.032%200%20.839%200%201.799-.12%202.758l-23.752-13.914c-1.439-.84-2.879-.84-4.318%200L75.91%2073.627Zm53.499%2044.383v-27.23c0-1.68-.72-2.88-2.159-3.719L97.142%2069.55l9.836-5.638c.839-.48%201.559-.48%202.399%200l22.912%2013.195c6.598%203.839%2011.035%2011.995%2011.035%2019.912%200%209.116-5.397%2017.513-13.915%2020.992v.001Zm-60.577-23.99-9.836-5.758c-.84-.48-1.2-1.2-1.2-2.16v-26.39c0-12.834%209.837-22.55%2023.152-22.55%205.039%200%209.716%201.679%2013.676%204.678L70.993%2055.516c-1.44.84-2.16%202.039-2.16%203.719v34.787-.002Zm21.173%2012.234L75.91%2098.339V81.546l14.095-7.917%2014.094%207.917v16.793l-14.094%207.916Zm9.056%2036.467c-5.038%200-9.716-1.68-13.675-4.678l23.631-13.676c1.439-.839%202.159-2.038%202.159-3.718V85.863l9.956%205.757c.84.48%201.2%201.2%201.2%202.16v26.389c0%2012.835-9.957%2022.552-23.27%2022.552v.001Zm-28.43-26.75L47.72%20102.778c-6.599-3.84-11.036-11.996-11.036-19.913%200-9.236%205.518-17.513%2014.034-20.992v27.35c0%201.68.72%202.879%202.16%203.718l29.989%2017.393-9.837%205.638c-.84.48-1.56.48-2.399%200Zm-1.318%2019.673c-13.555%200-23.512-10.196-23.512-22.792%200-.959.12-1.919.24-2.879l23.63%2013.675c1.44.84%202.88.84%204.32%200l30.108-17.392v11.395c0%20.96-.361%201.68-1.2%202.16l-22.912%2013.194c-3.119%201.8-6.837%202.639-10.675%202.639Zm29.748%2014.274c14.515%200%2026.63-10.316%2029.39-23.991%2013.434-3.479%2022.071-16.074%2022.071-28.91%200-8.396-3.598-16.553-10.076-22.43.6-2.52.96-5.039.96-7.557%200-17.153-13.915-29.99-29.989-29.99-3.239%200-6.358.48-9.477%201.56-5.398-5.278-12.835-8.637-20.992-8.637-14.515%200-26.63%2010.316-29.39%2023.991-13.434%203.48-22.07%2016.074-22.07%2028.91%200%208.396%203.598%2016.553%2010.075%2022.431-.6%202.519-.96%205.038-.96%207.556%200%2017.154%2013.915%2029.989%2029.99%2029.989%203.238%200%206.357-.479%209.476-1.559%205.397%205.278%2012.835%208.637%2020.992%208.637Z%22/%3E%3C/g%3E%3C/g%3E%3Cdefs%3E%3CclipPath%20id=%22a%22%3E%3Cpath%20d=%22M0%200h180v180H0z%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22b%22%3E%3Cpath%20d=%22M29.487%2029.964h121.035v119.954H29.487z%22/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E |
231 | 231 | // @icon64 data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22180%22%20height=%22180%22%20fill=%22none%22%3E%3Cstyle%3E:root%7B--primary-fill:%23000;--secondary-fill:%23fff;%7D@media%20(prefers-color-scheme:dark)%7B:root%7B--primary-fill:%23fff;--secondary-fill:%23000;%7D%7D%3C/style%3E%3Cg%20clip-path=%22url(%23a)%22%3E%3Crect%20width=%22180%22%20height=%22180%22%20fill=%22var(--primary-fill)%22%20rx=%2290%22/%3E%3Cg%20clip-path=%22url(%23b)%22%3E%3Cpath%20fill=%22var(--secondary-fill)%22%20d=%22M75.91%2073.628V62.232c0-.96.36-1.68%201.199-2.16l22.912-13.194c3.119-1.8%206.838-2.639%2010.676-2.639%2014.394%200%2023.511%2011.157%2023.511%2023.032%200%20.839%200%201.799-.12%202.758l-23.752-13.914c-1.439-.84-2.879-.84-4.318%200L75.91%2073.627Zm53.499%2044.383v-27.23c0-1.68-.72-2.88-2.159-3.719L97.142%2069.55l9.836-5.638c.839-.48%201.559-.48%202.399%200l22.912%2013.195c6.598%203.839%2011.035%2011.995%2011.035%2019.912%200%209.116-5.397%2017.513-13.915%2020.992v.001Zm-60.577-23.99-9.836-5.758c-.84-.48-1.2-1.2-1.2-2.16v-26.39c0-12.834%209.837-22.55%2023.152-22.55%205.039%200%209.716%201.679%2013.676%204.678L70.993%2055.516c-1.44.84-2.16%202.039-2.16%203.719v34.787-.002Zm21.173%2012.234L75.91%2098.339V81.546l14.095-7.917%2014.094%207.917v16.793l-14.094%207.916Zm9.056%2036.467c-5.038%200-9.716-1.68-13.675-4.678l23.631-13.676c1.439-.839%202.159-2.038%202.159-3.718V85.863l9.956%205.757c.84.48%201.2%201.2%201.2%202.16v26.389c0%2012.835-9.957%2022.552-23.27%2022.552v.001Zm-28.43-26.75L47.72%20102.778c-6.599-3.84-11.036-11.996-11.036-19.913%200-9.236%205.518-17.513%2014.034-20.992v27.35c0%201.68.72%202.879%202.16%203.718l29.989%2017.393-9.837%205.638c-.84.48-1.56.48-2.399%200Zm-1.318%2019.673c-13.555%200-23.512-10.196-23.512-22.792%200-.959.12-1.919.24-2.879l23.63%2013.675c1.44.84%202.88.84%204.32%200l30.108-17.392v11.395c0%20.96-.361%201.68-1.2%202.16l-22.912%2013.194c-3.119%201.8-6.837%202.639-10.675%202.639Zm29.748%2014.274c14.515%200%2026.63-10.316%2029.39-23.991%2013.434-3.479%2022.071-16.074%2022.071-28.91%200-8.396-3.598-16.553-10.076-22.43.6-2.52.96-5.039.96-7.557%200-17.153-13.915-29.99-29.989-29.99-3.239%200-6.358.48-9.477%201.56-5.398-5.278-12.835-8.637-20.992-8.637-14.515%200-26.63%2010.316-29.39%2023.991-13.434%203.48-22.07%2016.074-22.07%2028.91%200%208.396%203.598%2016.553%2010.075%2022.431-.6%202.519-.96%205.038-.96%207.556%200%2017.154%2013.915%2029.989%2029.99%2029.989%203.238%200%206.357-.479%209.476-1.559%205.397%205.278%2012.835%208.637%2020.992%208.637Z%22/%3E%3C/g%3E%3C/g%3E%3Cdefs%3E%3CclipPath%20id=%22a%22%3E%3Cpath%20d=%22M0%200h180v180H0z%22/%3E%3C/clipPath%3E%3CclipPath%20id=%22b%22%3E%3Cpath%20d=%22M29.487%2029.964h121.035v119.954H29.487z%22/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E |
|
365 | 365 |
|
366 | 366 | refresh() { |
367 | 367 | if (typeof GM_unregisterMenuCommand == 'undefined') return |
368 | | - this.entryIDs.forEach(id => GM_unregisterMenuCommand(id)) |
| 368 | + this.entryIDs.forEach(GM_unregisterMenuCommand) |
369 | 369 | this.register() |
370 | 370 | }, |
371 | 371 |
|
|
397 | 397 | } |
398 | 398 | } |
399 | 399 |
|
400 | | - window.updateCheck = () => { |
401 | | - env.xhr({ |
402 | | - method: 'GET', url: `${app.urls.update.gm}?t=${Date.now()}`, |
403 | | - headers: { 'Cache-Control': 'no-cache' }, |
404 | | - onload: ({ responseText }) => { |
405 | | - |
406 | | - // Compare versions, alert if update found |
407 | | - app.latestVer = /@version +(.*)/.exec(responseText)?.[1] |
408 | | - if (app.latestVer) for (let i = 0 ; i < 4 ; i++) { // loop thru subver's |
| 400 | + window.updateCheck = () => env.xhr({ |
| 401 | + method: 'GET', url: `${app.urls.update.gm}?t=${Date.now()}`, |
| 402 | + headers: { 'Cache-Control': 'no-cache' }, |
| 403 | + onload: ({ responseText }) => { |
| 404 | + app.latestVer = /@version +(.*)/.exec(responseText)?.[1] |
| 405 | + if (app.latestVer) |
| 406 | + for (let i = 0 ; i < 4 ; i++) { // loop thru subver's |
409 | 407 | const currentSubVer = parseInt(app.version.split('.')[i], 10) || 0, |
410 | 408 | latestSubVer = parseInt(app.latestVer.split('.')[i], 10) || 0 |
411 | 409 | if (currentSubVer > latestSubVer) break // out of comparison since not outdated |
412 | 410 | else if (latestSubVer > currentSubVer) // if outdated |
413 | 411 | return modals.open('update', 'available') |
414 | 412 | } |
415 | | - |
416 | | - // Alert to no update found, nav back to About |
417 | | - modals.open('update', 'unavailable') ; modals.open('about') |
418 | | - }}) |
419 | | - } |
| 413 | + modals.open('update', 'unavailable') ; modals.open('about') |
| 414 | + } |
| 415 | + }) |
420 | 416 |
|
421 | 417 | // Define FEEDBACK functions |
422 | 418 |
|
|
502 | 498 | btn.replaceWith(btn = btn.cloneNode(true)) |
503 | 499 | btn.onclick = () => modals.safeWinOpen(app.urls[ |
504 | 500 | btn.textContent.includes(app.msgs.btnLabel_getSupport) ? 'support' |
505 | | - : btn.textContent.includes(app.msgs.btnLabel_discuss) ? 'discuss' : 'relatedExtensions' |
| 501 | + : btn.textContent.includes(app.msgs.btnLabel_discuss) ? 'discuss' |
| 502 | + : 'relatedExtensions' |
506 | 503 | ]) |
507 | 504 | } |
508 | 505 |
|
|
532 | 529 |
|
533 | 530 | init(modal) { // requires lib/css.js |
534 | 531 | this.stylize() |
535 | | - modal.classList.add(this.class) ; modal.parentNode.classList.add(`${this.class}-bg`) |
| 532 | + modal.classList.add(this.class) |
| 533 | + modal.parentNode.classList.add(`${this.class}-bg`) |
536 | 534 | css.addRisingParticles(modal) |
537 | 535 | setTimeout(() => { // dim bg |
538 | 536 | modal.parentNode.style.backgroundColor = `rgba(67,70,72, ${ env.ui.scheme == 'dark' ? 0.62 : 0.33 })` |
|
542 | 540 |
|
543 | 541 | observeRemoval(modal, modalType, modalSubType) { // to maintain stack for proper nav |
544 | 542 | const modalBG = modal.parentNode |
545 | | - new MutationObserver(([mutation], obs) => { |
546 | | - mutation.removedNodes.forEach(removedNode => { if (removedNode == modalBG) { |
| 543 | + new MutationObserver(([mutation], obs) => |
| 544 | + mutation.removedNodes.forEach(removedNode => { |
| 545 | + if (removedNode != modalBG) return |
547 | 546 | if (modals.stack[0].includes(modalSubType || modalType)) { // new modal not launched so nav back |
548 | 547 | modals.stack.shift() // remove this modal type from stack 1st |
549 | 548 | const prevModalType = modals.stack[0] |
|
553 | 552 | } |
554 | 553 | } |
555 | 554 | obs.disconnect() |
556 | | - }}) |
557 | | - }).observe(modalBG.parentNode, { childList: true, subtree: true }) |
| 555 | + }) |
| 556 | + ).observe(modalBG.parentNode, { childList: true, subtree: true }) |
558 | 557 | }, |
559 | 558 |
|
560 | 559 | open(modalType, modalSubType) { |
|
668 | 667 | new Promise(resolve => setTimeout(resolve, 1000)).then(() => { |
669 | 668 | document.querySelectorAll('div#history > a').forEach(chatEntry => chatEntry.style.display = 'none') |
670 | 669 | if (!clearChatsAndGoHome.historyObserver) { // monitor sidebar to restore temporal headings on new chats |
671 | | - clearChatsAndGoHome.historyObserver = new MutationObserver(mutations => mutations.forEach(mutation => { |
672 | | - if (mutation.type == 'childList') mutation.addedNodes.forEach(node => { |
673 | | - if (node.tagName == 'LI') node.closest('ol').previousElementSibling.style.display = 'inherit' |
674 | | - })})) |
| 670 | + clearChatsAndGoHome.historyObserver = new MutationObserver(mutations => |
| 671 | + mutations.forEach(mutation => { |
| 672 | + if (mutation.type == 'childList') |
| 673 | + mutation.addedNodes.forEach(node => { |
| 674 | + if (node.tagName == 'LI') |
| 675 | + node.closest('ol').previousElementSibling.style.display = 'inherit' |
| 676 | + }) |
| 677 | + }) |
| 678 | + ) |
675 | 679 | clearChatsAndGoHome.historyObserver.observe( |
676 | 680 | document.querySelector('nav'), { childList: true, subtree: true }) |
677 | 681 | } |
|
744 | 748 | const firstLink = chatgpt.getNewChatLink() |
745 | 749 | if (firstLink && !this.classesBorrowed) { // borrow/assign classes from sidebar elems |
746 | 750 | const firstIcon = firstLink.querySelector('div:first-child'), |
747 | | - firstLabel = firstLink.querySelector('div:nth-child(2)') |
| 751 | + firstLabel = firstLink.querySelector('div:nth-child(2)') |
748 | 752 | this.div.classList.add(...firstLink.classList, ...(firstLabel?.classList || [])) |
749 | 753 | this.div.querySelector('img')?.classList.add(...(firstIcon?.classList || [])) |
750 | 754 | this.classesBorrowed = true |
|
0 commit comments