|
220 | 220 | // @description:zu *NGOKUPHEPHA* susa ukusetha kabusha ingxoxo yemizuzu eyi-10 + amaphutha enethiwekhi ahlala njalo + Ukuhlolwa kwe-Cloudflare ku-ChatGPT. |
221 | 221 | // @author Adam Lui |
222 | 222 | // @namespace https://github.com/adamlui |
223 | | -// @version 2025.9.5.5 |
| 223 | +// @version 2025.9.5.6 |
224 | 224 | // @license MIT |
225 | 225 | // @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 |
226 | 226 | // @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 |
|
290 | 290 | onload: resp => resolve(JSON.parse(resp.responseText)) |
291 | 291 | })), |
292 | 292 | msgs: await new Promise(resolve => { |
293 | | - const msgHostDir = app.urls.resourceHost + '/greasemonkey/_locales/', |
294 | | - msgLocaleDir = ( env.browser.language ? env.browser.language.replace('-', '_') : 'en' ) + '/' |
295 | | - let msgHref = msgHostDir + msgLocaleDir + 'messages.json', msgXHRtries = 0 |
| 293 | + const msgHostDir = `${app.urls.resourceHost}/greasemonkey/_locales/`, |
| 294 | + msgLocaleDir = `${ env.browser.language ? env.browser.language.replace('-', '_') : 'en' }/` |
| 295 | + let msgHref = `${ msgHostDir + msgLocaleDir }messages.json`, msgXHRtries = 0 |
296 | 296 | function fetchMsgs() { xhr({ method: 'GET', url: msgHref, onload: handleMsgs })} |
297 | 297 | function handleMsgs(resp) { |
298 | 298 | try { // to return localized messages.json |
|
305 | 305 | msgXHRtries++ ; if (msgXHRtries == 3) return resolve({}) // try original/region-stripped/EN only |
306 | 306 | msgHref = env.browser.language.includes('-') && msgXHRtries == 1 ? // if regional lang on 1st try... |
307 | 307 | msgHref.replace(/(_locales\/[^_]+)_[^_]+(\/)/, '$1$2') // ...strip region before retrying |
308 | | - : ( msgHostDir + 'en/messages.json' ) // else use default English messages |
| 308 | + : `${msgHostDir}en/messages.json` // else use default English messages |
309 | 309 | fetchMsgs() |
310 | 310 | } |
311 | 311 | } |
|
506 | 506 | ) |
507 | 507 |
|
508 | 508 | // Format text |
509 | | - aboutModal.querySelector('h2').style.cssText = ( |
510 | | - 'text-align: center ; font-size: 51px ; line-height: 46px ; padding: 15px 0' ) |
511 | | - aboutModal.querySelector('p').style.cssText = ( |
512 | | - 'text-align: center ; overflow-wrap: anywhere ;' |
513 | | - + `margin: ${ env.browser.isPortrait ? '6px 0 -16px' : '3px 0 29px' }` ) |
| 509 | + aboutModal.querySelector('h2').style.cssText = ` |
| 510 | + text-align: center ; font-size: 51px ; line-height: 46px ; padding: 15px 0` |
| 511 | + aboutModal.querySelector('p').style.cssText = ` |
| 512 | + text-align: center ; overflow-wrap: anywhere ; |
| 513 | + margin: ${ env.browser.isPortrait ? '6px 0 -16px' : '3px 0 29px' }` |
514 | 514 |
|
515 | 515 | // Hack buttons |
516 | 516 | aboutModal.querySelectorAll('button').forEach(btn => { |
|
594 | 594 | // Format buttons |
595 | 595 | if (idx == 0) btn.style.display = 'none' // hide Dismiss button |
596 | 596 | else { |
597 | | - btn.style.cssText = 'padding: 8px 6px !important ; margin-top: -14px ;' |
598 | | - + ' width: 107px ; line-height: 14px' |
| 597 | + btn.style.cssText = `padding: 8px 6px !important ; margin-top: -14px ; |
| 598 | + width: 107px ; line-height: 14px` |
599 | 599 | if (idx == btns.length -1) // de-emphasize right-most button |
600 | 600 | btn.classList.remove('primary-modal-btn') |
601 | 601 | } |
|
640 | 640 | stylize() { |
641 | 641 | if (!this.styles) document.head.append(this.styles = dom.create.elem('style')) |
642 | 642 | this.styles.textContent = ( |
643 | | - `.${this.class} {` // modals |
644 | | - + 'user-select: none ; -webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none ;' |
645 | | - + 'font-family: -apple-system, system-ui, BlinkMacSystemFont, Segoe UI, Roboto,' |
646 | | - + 'Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif ;' |
647 | | - + 'padding: 20px 25px 24px 25px !important ; font-size: 20px ;' |
648 | | - + `color: ${ env.ui.scheme == 'dark' ? 'white' : 'black' } !important ;` |
649 | | - + `background-image: linear-gradient(180deg, ${ |
650 | | - env.ui.scheme == 'dark' ? '#99a8a6 -200px, black 200px' : '#b6ebff -296px, white 171px' }) }` |
651 | | - + `.${this.class} [class*=modal-close-btn] {` |
652 | | - + 'position: absolute !important ; float: right ; top: 14px !important ; right: 16px !important ;' |
653 | | - + 'cursor: pointer ; width: 33px ; height: 33px ; border-radius: 20px }' |
654 | | - + `.${this.class} [class*=modal-close-btn] svg { height: 10px }` |
655 | | - + `.${this.class} [class*=modal-close-btn] path {` |
656 | | - + `${ env.ui.scheme == 'dark' ? 'stroke: white ; fill: white' : 'stroke: #9f9f9f ; fill: #9f9f9f' }}` |
657 | | - + ( env.ui.scheme == 'dark' ? // invert dark mode hover paths |
658 | | - `.${this.class} [class*=modal-close-btn]:hover path { stroke: black ; fill: black }` : '' ) |
659 | | - + `.${this.class} [class*=modal-close-btn]:hover { background-color: #f2f2f2 }` // hover underlay |
660 | | - + `.${this.class} [class*=modal-close-btn] svg { margin: 11.5px }` // center SVG for hover underlay |
661 | | - + `.${this.class} a { color: #${ env.ui.scheme == 'dark' ? '00cfff' : '1e9ebb' } !important }` |
662 | | - + `.${this.class} h2 { font-weight: bold }` |
663 | | - + `.${this.class} button {` |
664 | | - + '--btn-transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out ;' |
665 | | - + 'font-size: 14px ; text-transform: uppercase ;' // shrink/uppercase labels |
666 | | - + 'border-radius: 0 !important ;' // square borders |
667 | | - + 'transition: var(--btn-transition) ;' // smoothen hover fx |
668 | | - + '-webkit-transition: var(--btn-transition) ; -moz-transition: var(--btn-transition) ;' |
669 | | - + '-o-transition: var(--btn-transition) ; -ms-transition: var(--btn-transition) ;' |
670 | | - + 'cursor: pointer !important ;' // add finger cursor |
671 | | - + `border: 1px solid ${ env.ui.scheme == 'dark' ? 'white' : 'black' } !important ;` |
672 | | - + 'padding: 8px !important ; min-width: 102px }' // resize |
673 | | - + `.${this.class} button:hover {` // add zoom, re-scheme |
674 | | - + 'transform: scale(1.055) ; color: black !important ;' |
675 | | - + `background-color: #${ env.ui.scheme == 'dark' ? '00cfff' : '9cdaff' } !important }` |
676 | | - + ( !env.browser.isMobile ? `.${this.class} .modal-buttons { margin-left: -13px !important }` : '' ) |
677 | | - + `.about-em { color: ${ env.ui.scheme == 'dark' ? 'white' : 'green' } !important }` |
| 643 | + `.${this.class} { /* modals */ |
| 644 | + user-select: none ; -webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none ; |
| 645 | + font-family: -apple-system, system-ui, BlinkMacSystemFont, Segoe UI, Roboto, |
| 646 | + Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif ; |
| 647 | + padding: 20px 25px 24px 25px !important ; font-size: 20px ; |
| 648 | + color: ${ env.ui.scheme == 'dark' ? 'white' : 'black' } !important ; |
| 649 | + background-image: linear-gradient(180deg, ${ |
| 650 | + env.ui.scheme == 'dark' ? '#99a8a6 -200px, black 200px' : '#b6ebff -296px, white 171px' }) } |
| 651 | + .${this.class} [class*=modal-close-btn] { |
| 652 | + position: absolute !important ; float: right ; top: 14px !important ; right: 16px !important ; |
| 653 | + cursor: pointer ; width: 33px ; height: 33px ; border-radius: 20px } |
| 654 | + .${this.class} [class*=modal-close-btn] svg { height: 10px } |
| 655 | + .${this.class} [class*=modal-close-btn] path { |
| 656 | + ${ env.ui.scheme == 'dark' ? 'stroke: white ; fill: white' |
| 657 | + : 'stroke: #9f9f9f ; fill: #9f9f9f' }} |
| 658 | + ${ env.ui.scheme == 'dark' ? // invert dark mode hover paths |
| 659 | + `.${this.class} [class*=modal-close-btn]:hover path { stroke: black ; fill: black }` : '' } |
| 660 | + .${this.class} [class*=modal-close-btn]:hover { background-color: #f2f2f2 } /* hover underlay */ |
| 661 | + .${this.class} [class*=modal-close-btn] svg { margin: 11.5px } /* center SVG for hover underlay */ |
| 662 | + .${this.class} a { color: #${ env.ui.scheme == 'dark' ? '00cfff' : '1e9ebb' } !important } |
| 663 | + .${this.class} h2 { font-weight: bold } |
| 664 | + .${this.class} button { |
| 665 | + --btn-transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out ; |
| 666 | + font-size: 14px ; text-transform: uppercase ; /* shrink/uppercase labels */ |
| 667 | + border-radius: 0 !important ; /* square borders */ |
| 668 | + transition: var(--btn-transition) ; /* smoothen hover fx */ |
| 669 | + -webkit-transition: var(--btn-transition) ; -moz-transition: var(--btn-transition) ; |
| 670 | + -o-transition: var(--btn-transition) ; -ms-transition: var(--btn-transition) ; |
| 671 | + cursor: pointer !important ; /* add finger cursor */ |
| 672 | + border: 1px solid ${ env.ui.scheme == 'dark' ? 'white' : 'black' } !important ; |
| 673 | + padding: 8px !important ; min-width: 102px } /* resize */ |
| 674 | + .${this.class} button:hover { /* add zoom, re-scheme */ |
| 675 | + transform: scale(1.055) ; color: black !important ; |
| 676 | + background-color: #${ env.ui.scheme == 'dark' ? '00cfff' : '9cdaff' } !important } |
| 677 | + ${ env.browser.isMobile ? '' : `.${this.class} .modal-buttons { margin-left: -13px !important }` } |
| 678 | + .about-em { color: ${ env.ui.scheme == 'dark' ? 'white' : 'green' } !important }` |
678 | 679 | ) |
679 | 680 | }, |
680 | 681 |
|
|
0 commit comments