// ==UserScript== // @name Twitter External Translator // @name:bg Външен преводач на Twitter // @name:zh Twitter外部翻译器 // @name:zh-CN Twitter外部翻译器 // @name:zh-TW Twitter外部翻译器 // @name:cs Externí překladatel Twitter // @name:da Twitter ekstern oversætter // @name:et Twitteri väline tõlkija // @name:fi Twitter Ulkoinen kääntäjä // @name:el Εξωτερικός μεταφραστής Twitter // @name:hu Twitter külső fordító // @name:lv Twitter Ārējais tulkotājs // @name:lt "Twitter" išorinis vertėjas // @name:ro Twitter Traducător extern // @name:sk Externý prekladateľ Twitter // @name:sl Twitter Zunanji prevajalec // @name:sv Twitter Extern översättare // @name:nl Twitter Externe Vertaler // @name:fr Traducteur externe Twitter // @name:de Externer Twitter-Übersetzer // @name:it Traduttore esterno di Twitter // @name:ja ツイッター外部翻訳者 // @name:pl Zewnętrzny tłumacz Twittera // @name:pt Tradutor externo do Twitter // @name:pt-BR Tradutor externo do Twitter // @name:ru-RU Twitter Внешний переводчик // @name:ru Twitter Внешний переводчик // @name:es Traductor externo de Twitter // @description Adds external & internal translators // @description:zh 将第三方翻译添加到推特 // @description:zh-CN 将第三方翻译添加到推特 // @description:zh-TW 將第三方翻譯添加到推特 // @description:bg Добавя преводачи на трети страни в Twitter // @description:cs Přidává překladatele třetích stran na Twitter // @description:da Tilføjer tredjepartsoversættere til Twitter // @description:et Lisab kolmanda osapoole tõlkijad Twitterisse // @description:fi Lisää kolmannen osapuolen kääntäjiä Twitteriin // @description:el Προσθέτει μεταφραστές 3ου μέρους στο Twitter // @description:hu Hozzáadja a 3. féltől származó fordítókat a Twitterhez // @description:lv Pievieno trešās puses tulkotājus Twitter // @description:lt Prideda trečiųjų šalių vertėjus į "Twitter // @description:ro Adaugă traducători de la terțe părți la Twitter // @description:sk Pridáva prekladateľov tretích strán na Twitter // @description:sl Dodaja prevajalce tretjih oseb na Twitterju // @description:sv Lägger till översättare från tredje part till Twitter // @description:nl Voegt vertalers van derden toe aan Twitter // @description:fr Ajout de traducteurs tiers à Twitter // @description:de Fügt Drittanbieter-Übersetzer zu Twitter hinzu // @description:it Aggiunge traduttori di terze parti a Twitter // @description:pl Dodaje tłumaczy innych firm do Twittera // @description:pt Adiciona tradutores de terceiros ao Twitter // @description:pt-BR Adiciona tradutores de terceiros ao Twitter // @description:ja サードパーティの翻訳者をツイッターに追加 // @description:ru-RU Добавляет сторонних переводчиков в Twitter // @description:ru Добавляет сторонних переводчиков в Twitter // @description:es Añade traductores de terceros a Twitter // @author Magic // @icon https://abs.twimg.com/favicons/twitter.ico // @version 0.28 // @license MIT // @namespace https://github.com/magicoflolis/userscriptrepo/tree/master/ExternalTranslator#twitter-external-translator // @homepageURL https://github.com/magicoflolis/userscriptrepo/tree/master/ExternalTranslator#twitter-external-translator // @supportURL https://github.com/magicoflolis/userscriptrepo/issues/new // @require https://code.jquery.com/jquery-3.6.0.slim.min.js?_=1638935718515 // @match https://mobile.twitter.com/* // @match https://twitter.com/* // @match https://tweetdeck.twitter.com/* // @match https://www.twitlonger.com/show/* // @match https://nitter.net/* // @match https://nitter.*/* // @match https://nitter.*.*/* // @match https://nitter.domain.glass/* // @match https://nitter-home.kavin.rocks/* // @match https://birdsite.xanny.family/* // @match https://twitr.gq/* // @exclude https://twitter.com/login // @exclude https://twitter.com/signup // @exclude https://twitter.com/i/flow/signup // @exclude https://twitter.com/teams/* // @exclude https://twitter.com/*/authorize?* // @exclude https://twitter.com/*/begin_password_reset // @grant GM_getValue // @grant GM.getValue // @grant GM_setValue // @grant GM.setValue // @grant GM_deleteValue // @grant GM.deleteValue // @grant GM_info // @grant GM_xmlhttpRequest // @downloadURL none // ==/UserScript== // Uncompressed source code: // https://github.com/magicoflolis/userscriptrepo/tree/master/ExternalTranslator/src "use strict"; (async () => { let twCSS = `.tet{margin-top:1%}.css-1dbjc4n{-moz-box-align:stretch;-moz-box-direction:normal;-moz-box-orient:vertical;align-items:stretch;border:0px solid #000;box-sizing:border-box;display:flex;flex-basis:auto;flex-direction:column;flex-shrink:0;margin:0px;min-height:0px;min-width:0px;padding:0px;position:relative;z-index:0}.r-b88u0q{font-weight:700}select{height:auto !important}.r-qvutc0{overflow-wrap:break-word}.r-1adg3ll{display:block}.r-u8s1d{position:absolute}.r-1wbh5a2{flex-shrink:1}.r-1ny4l3l{outline-style:none}.r-1mi75qu{box-shadow:rgba(0,0,0,.02) 0px 0px 2px inset}.r-1udh08x{overflow:hidden}.r-1awozwy{-webkit-box-align:center;-moz-box-align:center;align-items:center}.r-1hwvwag{flex-basis:48px}.r-18kxxzh{-webkit-box-flex:0;flex-grow:0}.r-1777fci{-webkit-box-pack:center;-moz-box-pack:center;justify-content:center}.r-18u37iz{-webkit-box-direction:normal;-webkit-box-orient:horizontal;-moz-box-direction:normal;-moz-box-orient:horizontal;flex-direction:row}.r-ipm5af{top:0px}.r-1ifxtd0{margin-bottom:16px}.r-6gpygo{margin-bottom:12px !important}.r-1jgb5lz{margin-left:auto;margin-right:auto}.r-1ye8kvj{max-width:600px}.r-16y2uox{-webkit-box-flex:1;-moz-box-flex:1;flex-grow:1}.r-ttdzmv{padding-top:12px !important}.r-1iusvr4{flex-basis:0px}.r-13qz1uu{width:100%}.r-1dye5f7{padding-left:32px;padding-right:32px}.r-9ilb82{color:#6e767d}.r-16dba41{font-weight:400}.r-1vr29t4{font-weight:800}.r-a023e6{font-size:15px}.r-1qd0xha{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}.r-rjixqe{line-height:20px}.r-1cwl3u0{line-height:16px}.r-bcqeeo{min-width:0px}`, tetCSS = `#tetMenuButton>span{color:#fff !important}#tetSelector>select{background-color:transparent;border:transparent}.r-kemksi>div#tetName,.r-yfoy6g>div#tetName{color:#6e767d}.tetNitterHover{background-color:#ff6c60}.tetNitter{border-color:#ffaca0;box-shadow:#ffaca0 0px 0px 0px 1px}.tetBtn.nitter{color:#fff;border:transparent;background-color:#ff6c60}h1.tetNTextColor{color:#888889}.nitter{border:1px solid #ff6c60;background-color:#0f0f0f}.nitter #tetName{color:#ff6c60}select.tetNTextColor,div.tetNTextColor{color:#f8f8f2}svg.tetNTextColor{color:#888889}.tetNText{color:#ff6c60 !important}.tetNBackground{background-color:#161616}.Button--primary{border-color:#1da1f2;box-shadow:#1da1f2 0px 0px 0px 1px}.r-tetTD{border-radius:14px;background-color:#15202b}.r-tetTD #tetName{color:#8899a6}.prf-header>div>.tet.tet-td{color:#fff !important}.tet-td{color:#1da1f2}.tet-td#tetName{color:#1da1f2 !important}.tet-td.tet{color:#8899a6}.r-hoverTD{background-color:#005fd1}.r-9ilb82{color:#6e767d}.r-1kqtdi0{border-color:#2f3336}#apifield{border-color:#2f3336}#tetSelector.r-1kqtdi0{border-color:#2f3336}#tetSelector.r-1kqtdi0#tetName{color:#6e767d !important}#tetSelector.r-1kqtdi0.r-tetTD{border-color:#8899a6}.r-urgr8i{background-color:#1da1f2}.r-p1n3y5{border-color:#1da1f2}.r-13gxpu9{color:#1da1f2}.r-13gxpu9#tetName{color:#1da1f2 !important}.r-1q3imqu{background-color:#1a91da}.r-1bih22f{box-shadow:#1da1f2 0px 0px 0px 1px}.r-1vkxrha{background-color:#ffad1f}.r-v6khid{border-color:#ffad1f}.r-61mi1v{color:#ffad1f}.r-61mi1v#tetName{color:#ffad1f !important}.r-1kplyi6{background-color:#e69c1c}.r-cdj8wb{box-shadow:#ffad1f 0px 0px 0px 1px}.r-1dgebii{background-color:#e0245e}.r-1iofnty{border-color:#e0245e}.r-daml9f{color:#e0245e}.r-daml9f#tetName{color:#e0245e !important}.r-1ucxkr8{background-color:#ca2055}.r-jd07pc{box-shadow:#e0245e 0px 0px 0px 1px}.r-168457u{background-color:#7856ff}.r-njt2r9{background-color:#865dca}.r-hy56xe{border-color:#7856ff}.r-11mmphe{box-shadow:#794bc4 0px 0px 0px 1px}.r-xfsgu1{color:#7856ff}.r-xfsgu1#tetName{color:#7856ff !important}.r-18z3xeu{background-color:#f45d22}.r-1kplyi6{background-color:#dc541f}.r-1xl5njo{border-color:#f45d22}.r-b8m25f{box-shadow:#f45d22 0px 0px 0px 1px}.r-1qkqhnw{color:#f45d22}.r-1qkqhnw#tetName{color:#f45d22 !important}.r-b5skir{background-color:#17bf63}.r-zx61xx{background-color:#15ac59}.r-5ctkeg{border-color:#17bf63}.r-1cqwhho{box-shadow:#17bf63 0px 0px 0px 1px}.r-nw8l94{color:#17bf63}.r-nw8l94#tetName{color:#17bf63 !important}.r-yfoy6g{background-color:#15202b}.r-14lw9ot{background-color:#fff}.r-kemksi{background-color:#000}.r-18jsvk2{color:#0f1419}.r-demo{border-style:solid !important;border-radius:16px !important;border-width:1px !important}.demo-TW{border-color:#2f3336 !important}.demo-TD{border:1px solid #8899a6 !important}.demo-NT{border:1px solid #FF6C6091 !important}.r-jwli3a{color:#fff}.tetAvatarFrame,#tetAvatar{align-items:stretch;border:0px solid #000;box-sizing:border-box;display:flex;flex-basis:auto;flex-direction:column;flex-shrink:0;margin:0px;min-height:0px;min-width:0px;padding:0px;position:relative;z-index:0}.tet{margin-top:4px;flex-wrap:wrap;line-height:16px;font-size:13px;font-weight:400;overflow-wrap:break-word;width:fit-content;height:min-content;display:flex}.tetAvatarFrame{flex-basis:auto;z-index:0;position:absolute;top:0px;right:0px;left:0px;bottom:0px;overflow:hidden;border-radius:9999px}.tetAvatarFrame #tetAvatar{background-image:url("https://abs.twimg.com/favicons/twitter.ico");background-size:cover;background-repeat:no-repeat;background-position:center center;z-index:-1;background-color:rgba(0,0,0,0);height:100%;width:100%;position:absolute}.tet-main{padding:0px 32px 32px 32px !important;flex-shrink:1;-moz-box-flex:1;flex-grow:1;width:100%;margin-left:auto;margin-right:auto}.tet-options{display:inline-grid;grid-template-rows:1fr 1fr 1fr}.tet-header{min-width:0px;text-align:center;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;white-space:normal;display:grid;margin:32px 0px 12px 0px !important}.tet-header .css-901oao{line-height:28px;font-size:23px;font-weight:800}.tet-header .tet-info{line-height:20px;font-size:15px;font-weight:400;color:#6e767d;margin-top:1%}.tet-header span{color:inherit;font:inherit;white-space:inherit}.tetAlert{right:0px;left:0px;bottom:0px;position:fixed !important;z-index:10000 !important}.tetAlert h1.tetAlertTxt{line-height:24px;font-size:20px;font-weight:700;min-width:0px}.tetAlert h1.tetAlertTxt span{font-family:inherit}.tetAlert .tetAlertTxt>span,.tetAlert .tetAlertTxt{white-space:normal;text-align:center;overflow-wrap:break-word;font-family:"TwitterChirp",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}.tetAlert div.tetAlertTxt{font-weight:400;font-size:15px;line-height:20px;min-width:0px;width:100%}.tetAlert .tetConfirmation{width:20%;border-radius:16px;left:40%;top:40%;position:fixed}.tetAlert .tetAlertBtns{margin:2% 25% 2% 25%;white-space:nowrap;outline-style:none;transition-property:background-color,box-shadow;transition-duration:.2s;flex-grow:1;user-select:none;border-color:rgba(0,0,0,0);overflow:hidden;border-width:1px;border-style:solid;cursor:pointer}.tetAlert .tetAlertBtns:nth-child(2){margin:0px 25% 4% 25%}.tetAlert .tetAlertBtns>div{font-size:15px;font-weight:700;font-family:"TwitterChirp",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;line-height:20px;overflow-wrap:break-word;min-width:0px;align-items:center;justify-content:center;flex-grow:1;flex-direction:row;text-align:center;display:flex}.tetAlert .tetAlertBtns>div>span{font-size:15px;font-family:inherit;line-height:20px;overflow-wrap:break-word;min-width:0px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:inherit;font:inherit;border:0px solid #000;box-sizing:border-box;display:inline;margin:0px;padding:0px}.tetAlert .tetAlertBtns>div>span>span{border:0px solid #000;box-sizing:border-box;display:inline;margin:0px;padding:0px}#tetForm{max-width:80vw;max-height:90vh;min-width:600px !important;flex-shrink:1;border-radius:16px;overflow:hidden}#tetForm>div{border-radius:16px}#tetForm .tetBackground .tetTextColor{overflow-wrap:break-word}#tetForm .tetBackground .tetTextColor span{overflow-wrap:break-word}#tetForm .tet-containter{width:100%}#tetForm .tet-containter.tet-fg{margin-left:auto;margin-right:auto}.tet-head,#tetName>span,#tweet-text>span,#tetMenuButton>span{color:inherit;font:inherit;font-family:inherit;white-space:inherit;overflow-wrap:break-word}.rm,button:not(.mini)>#tetSVG,button.mini>span{display:none !important}.tetFreeze{overflow:hidden !important;overscroll-behavior-y:none !important}#tetMenuButton{z-index:10;width:8vw;height:auto;position:fixed;top:65%;left:0px}#tetMenuButton.tetTD{left:90% !important;top:0% !important}#tetMenuButton>svg{position:relative;max-width:100%;height:1.25em;fill:currentcolor;margin-right:12px;user-select:none;right:35% !important}#tetMenuButton,.tetAlertBtns,#tetReload,#tetReset{list-style:none;text-align:inherit;text-decoration:none;border-radius:15px;justify-content:center;display:flex !important;font-family:inherit;font-size:20px !important;font-weight:bold !important;padding:0px !important}button.tetBtn.mini{border:transparent !important;background:transparent !important}#tetMenuButton,.tetAlertBtns,#tetReload,#tetReset,#tet,.tet{cursor:pointer !important}.tet.tet-td{display:inherit}#tet{justify-items:center}input#apifield,#tetName,#tetSelector>select{padding-left:2% !important}#tetReload,#tetReset{margin:2% 25% 0px 25%}#apifield,#tetSelector{border-radius:4px;border-width:1px;margin:2% 6% 0px 6%}.r-demo{outline-style:none;margin:0px 32px 0px 32px !important;padding:12px 0px 12px 0px !important;overflow:hidden;-webkit-box-direction:normal;-webkit-box-orient:horizontal;-moz-box-direction:normal;-moz-box-orient:horizontal;flex-direction:row !important;flex-shrink:1;-webkit-box-flex:1;-moz-box-flex:1;flex-grow:1}.r-demo .tet-av{width:100%;margin-left:12px !important;margin-right:12px !important;-webkit-box-flex:0;flex-grow:0;flex-shrink:1;flex-basis:48px;-webkit-box-align:center;-moz-box-align:center;align-items:center;height:48px;overflow:hidden;border-radius:9999px;outline-style:none;display:block}.r-demo .tet-txt{flex-basis:0px;-webkit-box-flex:1;-moz-box-flex:1;flex-grow:1;-webkit-box-pack:center;-moz-box-pack:center;justify-content:center}.r-demo .tet-txt .txt-header{margin-bottom:2px;-moz-box-align:start;align-items:start;-moz-box-pack:justify;justify-content:space-between;-moz-box-direction:normal;-moz-box-orient:horizontal;flex-direction:row;max-width:100%}.r-demo .tet-txt .txt-header .tet-at{display:flex;margin-left:4px;color:#6e767d;font-weight:400;font-size:15px;line-height:20px;overflow-wrap:break-word;min-width:0px}#tetDemo{margin:4px 0px 0px 0px;line-height:16px;font-size:13px;flex-wrap:wrap;font-weight:400;min-width:0px;display:flex !important}.btNav{justify-content:center;flex-direction:row;top:0px}.btNav span{font-family:inherit}.btNav,.navbackground{position:fixed !important;width:100vw;height:100vh}.navbackground{top:0;left:0}.navbackground.warn{z-index:10 !important}.mini{min-height:3% !important;overflow:hidden;background:transparent;border-color:transparent}.r-hover{text-decoration-line:underline !important;outline-style:none !important}#tweet-text{font-size:23px !important;font-weight:400 !important;line-height:28px !important}`; typeof GM === "undefined" ? (GM = {}, GM.setValue = GM_setValue, GM.getValue = GM_getValue) : false; let tetInfo = { icon: GM_info.script.icon, name: GM_info.script.name, version: GM_info.script.version }, tetAvatar = tetInfo.icon, enableLogs = false; tetInfo.name === "[Dev] Twitter External Translator" ? enableLogs = true : false; const log = (msg, alert) => { return enableLogs || alert === "error" ? console.log('[TET]', msg) : false; }, qs = (element, all) => { return !all ? document.querySelector(element) : document.querySelectorAll(element); }, ael = (event, callback, elm = document) => { return elm.addEventListener(event, callback); }, injectCSS = (css, name = "common") => { return document.head.insertAdjacentHTML('beforeend', ``); }, autoHide = async () => { await new Promise(resolve => setTimeout(resolve, 5000)); $('svg#tetSVG').hide(); }, TETObserve = (elm, callback, options = { subtree: true, childList: true }) => { let observer = new MutationObserver(callback); callback([], observer); observer.observe(elm, options); return observer; }, TETSave = (key = "Config", value = JSON.stringify(TETConfig)) => { GM.setValue(key, value); localStorage.TETConfig = value; }, lh = document.location.host, lr = document.location.href, find = { twitter: lh === "twitter.com" || lh === "mobile.twitter.com", tweetdeck: lh === "tweetdeck.twitter.com", twitlonger: lh === "www.twitlonger.com", nitter: /nitter/.test(lr) || lh === "twitr.gq" || lh === "birdsite.xanny.family" }, TETInject = () => { find.twitter ? TETObserve(document.body, () => { Twitter(); }) : find.tweetdeck ? TETObserve(document.body, () => { TweetDeck(); }) : find.twitlonger ? ael("DOMContentLoaded", TwitLonger()) : find.nitter ? TETObserve(document.body, () => { Nitter(); }) : false; }, isHTML = (str, doc = new DOMParser().parseFromString(str, "text/html")) => { return Array.from(doc.body.childNodes).some(node => node.nodeType === 1); }, icons = { azure: '', bing: '', deepl: '', gCloud: '', google: '', mymemory: '', translate: '', yandex: '', fn() { return { azure: this.azure, bing: this.bing, deepl: this.deepl, gCloud: this.gCloud, google: this.google, mymemory: this.mymemory, translate: this.translate, yandex: this.yandex }; } }, defaultLang = $("html").attr("lang"), defaultTheme = () => { let b = $("body").attr("style"), twit = b === "background-color: #FFFFFF;" ? "#FFFFFF" : b === "background-color: #15202B;" ? "#15202B" : "#000000"; return find.twitter ? twit : find.tweetdeck ? "tweetdeck" : find.nitter ? "nitter" : find.twitlonger ? "#FFFFFF" : "#000000"; }, defaultDesc = "Pretend I'm a foreign language."; let TETConfig = {}, en = { sel: `English (en)`, tw: `Translate with`, lg: `Language`, tr: `Translator`, ds: `Display`, menu: `Menu`, th: `Theme`, df: `Default`, di: `Dim`, lo: `Lights out`, col: `Color`, cb: `Blue`, cy: `Yellow`, cr: `Red`, cp: `Purple`, co: `Orange`, cg: `Green`, t: `Text`, i: `Icon`, ti: `Text + Icon`, res: `Restore to Defaults`, desc: { language: `Site Language: ${defaultLang}`, translate: `Full explanation found on GitHub.`, display: `Prefer text only? How about just an icon instead?`, color: `A rainbow of choices.`, theme: `It's best to match your current theme!` }, quest: { head: `Are you sure?`, body: `Website will be reloaded.`, yes: `Yes`, no: `No` }, fn: checkLng }, zh = { sel: `中文 (zh)`, tw: `翻译与`, lg: `语种`, tr: `译者`, ds: `显示`, ti: `文本+图标`, menu: `菜单`, th: `主题`, df: `默认情况下`, di: `凹陷`, lo: `熄灯`, col: `颜色`, cb: `蓝色`, cy: `黄色`, cr: `红色`, cp: `紫色`, co: `橙色`, cg: `绿色`, t: `案文`, i: `图标`, res: `恢复`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `你确定吗?`, body: `网站将被重新加载`, yes: `是的`, no: `不确定` }, fn: checkLng }, bg = { sel: `Български (bg)`, tw: `Преведете с`, lg: `Език`, tr: `Преводач`, ds: `Показване на`, ti: `Текст + икона`, menu: `Меню`, th: `Тема`, df: `По подразбиране`, di: `Dim`, lo: `Изгасяне на осветлението`, col: `Цвят`, cb: `Синьо`, cy: `Жълто`, cr: `Червено`, cp: `Лилаво`, co: `Оранжево`, cg: `Зелено`, t: `Текст`, i: `Икона`, res: `Възстановявам`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Сигурни ли сте?`, body: `Уебсайтът ще бъде презареден.`, yes: `Да`, no: `Не` }, fn: checkLng }, cs = { sel: `Česky (cs)`, tw: `Přeložit pomocí`, lg: `Jazyk`, tr: `Překladatel`, ds: `Zobrazit`, ti: `Text + ikona`, menu: `Nabídka`, th: `Téma`, df: `Výchozí`, di: `Dim`, lo: `Zhasnout světla`, col: `Barva`, cb: `Modrá`, cy: `Žlutá`, cr: `Červená`, cp: `Fialová`, co: `Oranžová`, cg: `Zelená`, t: `Text`, i: `Ikona`, res: `Obnovit`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Jste si jistý?`, body: `Webové stránky budou znovu načteny.`, yes: `Ano`, no: `Ne` }, fn: checkLng }, da = { sel: `Dansk (da)`, tw: `Oversæt med`, lg: `Sprog`, tr: `Oversætter`, ds: `Vis`, ti: `Tekst + ikon`, menu: `Menu`, th: `Tema`, df: `Standard`, di: `Dim`, lo: `Lyset slukkes`, col: `Farve`, cb: `Blå`, cy: `Gul`, cr: `Rød`, cp: `Lilla`, co: `Orange`, cg: `Grøn`, t: `Tekst`, i: `Ikon`, res: `Genskabe`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Er du sikker?`, body: `Hjemmesiden vil blive genindlæst.`, yes: `Ja`, no: `Nej` }, fn: checkLng }, et = { sel: `Eesti (et)`, tw: `Tõlge koos`, lg: `Keel`, tr: `Tõlkija`, ds: `Kuva`, ti: `Tekst + ikoon`, menu: `Menüü`, th: `Teema`, df: `Vaikimisi`, di: `Dim`, lo: `Valgus välja lülitatud`, col: `Värv`, cb: `Sinine`, cy: `Kollane`, cr: `Punane`, cp: `Lilla`, co: `Oranž`, cg: `Roheline`, t: `Tekst`, i: `Ikoon`, res: `Taastada`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Oled sa kindel?`, body: `Veebileht laaditakse uuesti.`, yes: `Jah`, no: `Ei` }, fn: checkLng }, fi = { sel: `Suomalainen (fi)`, tw: `Käännä kanssa`, lg: `Kieli`, tr: `Kääntäjä`, ds: `Näytä`, ti: `Teksti + kuvake`, menu: `Valikko`, th: `Teema`, df: `Oletus`, di: `Dim`, lo: `Valot pois päältä`, col: `Väri`, cb: `Sininen`, cy: `Keltainen`, cr: `Punainen`, cp: `Violetti`, co: `Oranssi`, cg: `Vihreä`, t: `Teksti`, i: `Kuvake`, res: `Palauta`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Oletko varma?`, body: `Sivusto ladataan uudelleen.`, yes: `Kyllä`, no: `Ei` }, fn: checkLng }, el = { sel: `Ελληνική (el)`, tw: `Μεταφράστε με`, lg: `Γλώσσα`, tr: `Μεταφραστής`, ds: `Εμφάνιση`, ti: `Κείμενο + εικονίδιο`, menu: `Μενού`, th: `Θέμα`, df: `Προεπιλογή`, di: `Dim`, lo: `Σβήνει τα φώτα`, col: `Χρώμα`, cb: `Μπλε`, cy: `Κίτρινο`, cr: `Κόκκινο`, cp: `Μωβ`, co: `Πορτοκαλί`, cg: `Πράσινο`, t: `Κείμενο`, i: `Εικονίδιο`, res: `Επαναφορά`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Είσαι σίγουρος;`, body: `Η ιστοσελίδα θα επαναφορτωθεί.`, yes: `Ναι`, no: `Όχι` }, fn: checkLng }, hu = { sel: `Magyar (hu)`, tw: `Fordítson a`, lg: `Nyelv`, tr: `Fordító`, ds: `Megjelenítés`, ti: `Szöveg + ikon`, menu: `Menü`, th: `Téma`, df: `Alapértelmezett`, di: `Dim`, lo: `Fények kikapcsolva`, col: `Szín`, cb: `Kék`, cy: `Sárga`, cr: `Piros`, cp: `Lila`, co: `Narancs`, cg: `Zöld`, t: `Szöveg`, i: `Ikon`, res: `Visszaállítása`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Biztos vagy benne?`, body: `A weboldal újratöltődik.`, yes: `Igen`, no: `Nem` }, fn: checkLng }, lv = { sel: `Latviešu (lv)`, tw: `Tulkot ar`, lg: `Valoda`, tr: `Tulkotājs`, ds: `Displejs`, ti: `Teksts + ikona`, menu: `Izvēlne`, th: `Tēma`, df: `Noklusējuma`, di: `Dim`, lo: `Izslēgt gaismu`, col: `Krāsa`, cb: `Zils`, cy: `Dzeltens`, cr: `Sarkans`, cp: `Violeta`, co: `Oranža`, cg: `Zaļš`, t: `Teksts`, i: `Ikona`, res: `Atjaunot`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Vai esat pārliecināts?`, body: `Tīmekļa vietne tiks ielādēta no jauna.`, yes: `Jā`, no: `Nē` }, fn: checkLng }, lt = { sel: `Lietuvių kalba (lt)`, tw: `Išversti su`, lg: `Kalba`, tr: `Vertėjas`, ds: `Rodyti`, ti: `Tekstas + piktograma`, menu: `Meniu`, th: `Tema`, df: `Numatytoji`, di: `Dim`, lo: `Išjungti šviesą`, col: `Spalva`, cb: `Mėlyna`, cy: `Geltona`, cr: `Raudona`, cp: `Violetinė`, co: `Oranžinė`, cg: `Žalia`, t: `Tekstas`, i: `Ikona`, res: `Atkurti`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Ar tikrai?`, body: `Svetainė bus iš naujo įkelta.`, yes: `Taip`, no: `Ne` }, fn: checkLng }, ro = { sel: `Românesc (ro)`, tw: `Tradu cu`, lg: `Limba`, tr: `Traducător`, ds: `Afișați`, ti: `Text + Icoană`, menu: `Meniu`, th: `Tema`, df: `Implicit`, di: `Dim`, lo: `Stinge lumina`, col: `Culoare`, cb: `Albastru`, cy: `Galben`, cr: `Roșu`, cp: `Violet`, co: `Portocaliu`, cg: `Verde`, t: `Text`, i: `Icoană`, res: `Restaurați`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Ești sigur?`, body: `Site-ul va fi reîncărcat.`, yes: `Da`, no: `Nu` }, fn: checkLng }, sk = { sel: `Slovenská (sk)`, tw: `Preložiť s`, lg: `Jazyk`, tr: `Prekladateľ`, ds: `Zobraziť`, ti: `Text + ikona`, menu: `Ponuka`, th: `Téma`, df: `Predvolené nastavenie`, di: `Dim`, lo: `Zhasnuté svetlá`, col: `Farba`, cb: `Modrá`, cy: `Žltá`, cr: `Červená`, cp: `Fialová`, co: `Oranžová`, cg: `Zelená`, t: `Text`, i: `Ikona`, res: `Obnovenie`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Ste si istý?`, body: `Webová stránka bude znovu načítaná.`, yes: `Áno`, no: `Nie` }, fn: checkLng }, sl = { sel: `Slovenski (sl)`, tw: `Prevedi z`, lg: `Jezik`, tr: `Prevajalec`, ds: `Prikaži`, ti: `Besedilo + ikona`, menu: `Meni`, th: `Tema`, df: `Privzeto`, di: `Dim`, lo: `Ugasne luči`, col: `Barva`, cb: `Modra`, cy: `Rumena`, cr: `Rdeča`, cp: `Vijolična`, co: `Oranžna`, cg: `Zelena`, t: `Besedilo`, i: `Ikona`, res: `Obnovitev`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Ste prepričani?`, body: `Spletna stran bo ponovno naložena.`, yes: `Da`, no: `Ne` }, fn: checkLng }, sv = { sel: `Svenska (sv)`, tw: `Översätt med`, lg: `Språk`, tr: `Översättare`, ds: `Visa`, ti: `Text + ikon`, menu: `Meny`, th: `Tema`, df: `Standard`, di: `Dim`, lo: `Ljuset släcks`, col: `Färg`, cb: `Blå`, cy: `Gul`, cr: `Röd`, cp: `Lila`, co: `Orange`, cg: `Grön`, t: `Text`, i: `Ikon`, res: `Återställ`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Är du säker?`, body: `Webbplatsen kommer att laddas om.`, yes: `Ja`, no: `Nej` }, fn: checkLng }, nl = { sel: `Nederlands (nl)`, tw: `Vertaal met`, lg: `Taal`, tr: `Vertaler`, ds: `Weergave`, ti: `Tekst + Pictogram`, menu: `Menu`, th: `Thema`, df: `Standaard`, di: `Dimmen`, lo: `Licht uit`, col: `Kleur`, cb: `Blauw`, cy: `Geel`, cr: `Rood`, cp: `Paars`, co: `Oranje`, cg: `Groen`, t: `Tekst`, i: `Icoon`, res: `Herstel`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Ben je zeker?`, body: `De website wordt opnieuw geladen.`, yes: `Ja`, no: `Nee` }, fn: checkLng }, fr = { sel: `Français (fr)`, tw: `Traduire avec`, lg: `Langue`, tr: `Traducteur`, ds: `Afficher`, ti: `Texte + Icône`, menu: `Menu`, th: `Thème`, df: `Défaut`, di: `Dim`, lo: `Extinction des lumières`, col: `Couleur`, cb: `Bleu`, cy: `Jaune`, cr: `Rouge`, cp: `Violet`, co: `Orange`, cg: `Vert`, t: `Texte`, i: `Icône`, res: `Restaurer`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Vous êtes sûr ?`, body: `Le site web va être rechargé.`, yes: `Oui`, no: `Non` }, fn: checkLng }, de = { sel: `Deutsch (de)`, tw: `Übersetzen mit`, lg: `Sprache`, tr: `Übersetzer`, ds: `Anzeige`, ti: `Text + Symbol`, menu: `Menü`, th: `Thema`, df: `Standard`, di: `Dimmen`, lo: `Licht aus`, col: `Farbe`, cb: `Blau`, cy: `Gelb`, cr: `Rot`, cp: `Lila`, co: `Orange`, cg: `Grün`, t: `Text`, i: `Icon`, res: `Wiederherstellen`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Sind Sie sicher?`, body: `Die Website wird neu geladen.`, yes: `Ja`, no: `Nein` }, fn: checkLng }, it = { sel: `Italiano (it)`, tw: `Tradurre con`, lg: `Lingua`, tr: `Traduttore`, ds: `Visualizza`, ti: `Testo + icona`, menu: `Menu`, th: `Tema`, df: `Default`, di: `Dim`, lo: `Luci spente`, col: `Colore`, cb: `Blu`, cy: `Giallo`, cr: `Rosso`, cp: `Viola`, co: `Arancione`, cg: `Verde`, t: `Testo`, i: `Icona`, res: `Ripristinare`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Sei sicuro?`, body: `Il sito sarà ricaricato.`, yes: `Sì`, no: `No` }, fn: checkLng }, ja = { sel: `日本語 (ja)`, tw: `で翻訳する`, lg: `言語`, tr: `翻訳者`, ds: `ディスプレイ`, ti: `テキスト+アイコン`, menu: `メニュー`, th: `テーマ`, df: `デフォルト`, di: `暗い`, lo: `消灯`, col: `カラー`, cb: `青`, cy: `黄`, cr: `赤`, cp: `紫`, co: `オレンジ`, cg: `グリーン`, t: `テキスト`, i: `アイコン`, res: `リストア`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `本当にいいの?`, body: `ウェブサイトが再読み込みされます。`, yes: `はい`, no: `いいえ` }, fn: checkLng }, pl = { sel: `Polski (pl)`, tw: `Tłumaczenie za pomocą`, lg: `Język`, tr: `Tłumacz`, ds: `Wyświetlacz`, ti: `Tekst + Ikona`, menu: `Menu`, th: `Motyw`, df: `Domyślnie`, di: `Ściemniaj`, lo: `Nie świeci się`, col: `Kolor`, cb: `Niebieski`, cy: `Żółty`, cr: `Czerwony`, cp: `Purpurowy`, co: `Pomarańczowy`, cg: `Zielony`, t: `Tekst`, i: `Ikona`, res: `Przywróć`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Czy jesteś pewien?`, body: `Strona zostanie przeładowana.`, yes: `Tak`, no: `Nie` }, fn: checkLng }, pt = { sel: `Português (pt)`, tw: `Traduzir com`, lg: `Idioma`, tr: `Tradutora`, ds: `Mostrar`, ti: `Texto + Ícone`, menu: `Menu`, th: `Tema`, df: `Por defeito`, di: `Dim`, lo: `Luzes apagadas`, col: `Cor`, cb: `Azul`, cy: `Amarelo`, cr: `Vermelho`, cp: `Púrpura`, co: `Laranja`, cg: `Verde`, t: `Texto`, i: `Ícone`, res: `Restaurar`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Tem a certeza?`, body: `O website será carregado de novo.`, yes: `Sim`, no: `Não` }, fn: checkLng }, ru = { sel: `Russisch (ru)`, tw: `Перевод с`, lg: `Язык`, tr: `Переводчик`, ds: `Показать`, ti: `Текст + иконка`, menu: `Меню`, th: `Тема`, df: `По умолчанию`, di: `Приглушить`, lo: `Выключить свет`, col: `Цвет`, cb: `Синий`, cy: `Желтый`, cr: `Красный`, cp: `Фиолетовый`, co: `Оранжевый`, cg: `Зеленый`, t: `Текст`, i: `иконка`, res: `Восстановить`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `Вы уверены?`, body: `Сайт будет перезагружен.`, yes: `Да`, no: `Нет` }, fn: checkLng }, es = { sel: `Español (es)`, tw: `Traducir con`, lg: `Idioma`, tr: `Traductor`, ds: `Mostrar`, ti: `Texto + Icono`, menu: `Menú`, th: `Tema`, df: `Por defecto`, di: `Atenuar`, lo: `Luces apagadas`, col: `Colores`, cb: `Azul`, cy: `Amarillo`, cr: `Rojo`, cp: `Púrpura`, co: `Naranja`, cg: `Verde`, t: `Texto`, i: `Icono`, res: `Restaurar`, desc: { language: `Site Language: ${defaultLang}`, translate: ` [WIP] Translate`, display: ` [WIP] Display`, color: ` [WIP] Color`, theme: ` [WIP] Theme` }, quest: { head: `¿Está seguro?`, body: `El sitio web será recargado.`, yes: `Sí`, no: `No` }, fn: checkLng }, //#endregion DefaultConfig = { lang: defaultLang, translator: 'deepl', display: "text + icon", colors: "r-urgr8i", theme: defaultTheme(), api: { deepl: "", google: "", version: "api-free" }, cBG: 'rgba(91, 112, 131, 0.4)', cColor: "r-p1n3y5 r-1bih22f", cDisplay: `DeepL ${icons.deepl}`, cHover: "r-1q3imqu", cLang: en.fn().tw, cText: "r-jwli3a", cTheme: "r-kemksi", cSub: "r-13gxpu9" }, sidebar = `\n`, get = (url, responseType = 'json', retry = 3) => new Promise((resolve, reject) => { try { GM_xmlhttpRequest({ method: 'GET', url, responseType, onerror: e => { retry === 0 ? reject(e) : (log('Network error, retry.'), setTimeout(() => { resolve(get(url, responseType, retry - 1)); }, 1000)); }, onload: ({ status, response }) => { status === 200 ? resolve(response) : retry === 0 ? reject(`${status} ${url}`) : (log(status, url), setTimeout(() => { resolve(get(url, responseType, retry - 1)); }, 500)); } }); } catch (error) { reject(error); } }), tetEach = (elm, context, callback) => { for (let i = 0; i < elm.length; i++) { if (!callback) { elm.addClass(context); } else { ael("mouseenter", callback, elm[i]); ael("mouseleave", callback, elm[i]); } ; } ; }; //#endregion //#region Site n Menu Fn function checkLng() { return { tw: this.tw, lg: this.lg, tr: this.tr, ds: this.ds, ti: this.ti, res: this.res, menu: this.menu, th: this.th, df: this.df, di: this.di, lo: this.lo, col: this.col, cb: this.cb, cy: this.cy, cr: this.cr, cp: this.cp, co: this.co, cg: this.cg, t: this.t, i: this.i, language: this.desc.language, translate: this.desc.translate, display: this.desc.display, color: this.desc.color, theme: this.desc.theme, head: this.quest.head, body: this.quest.body, yes: this.quest.yes, no: this.quest.no }; }; function TETDisplayChange(mode = "nonrepeat") { let cSel = TETConfig.translator, v = icons.fn(), disA = cSel == "bingIT" ? TETConfig.cDisplay = v.azure : cSel == "googleIT" ? TETConfig.cDisplay = v.gCloud : cSel == "google" ? TETConfig.cDisplay = v.google : cSel == "bing" ? TETConfig.cDisplay = v.bing : cSel == "mymemory" || cSel == "mymemoryIT" ? TETConfig.cDisplay = v.mymemory : cSel == "translate" ? TETConfig.cDisplay = v.translate : cSel == "yandex" ? TETConfig.cDisplay = v.yandex : TETConfig.cDisplay = v.deepl, disB = cSel == "mymemoryIT" ? TETConfig.cDisplay = "MyMemory API" : cSel == "bingIT" ? TETConfig.cDisplay = "Azure Cognitive Services" : cSel == "googleIT" ? TETConfig.cDisplay = "Google Cloud API" : cSel == "deeplIT" ? TETConfig.cDisplay = "DeepL API" : cSel == "bing" ? TETConfig.cDisplay = "Bing" : cSel == "google" ? TETConfig.cDisplay = "Google" : cSel == "mymemory" ? TETConfig.cDisplay = "MyMemory" : cSel == "translate" ? TETConfig.cDisplay = "Translate.com" : cSel == "yandex" ? TETConfig.cDisplay = "Yandex" : TETConfig.cDisplay = "DeepL", disC = cSel == "mymemoryIT" ? TETConfig.cDisplay = `MyMemory API ${v.mymemory}` : cSel == "bingIT" ? TETConfig.cDisplay = `Azure Cognitive Services ${v.azure}` : cSel == "googleIT" ? TETConfig.cDisplay = `Google Cloud API ${v.gCloud}` : cSel == "deeplIT" ? TETConfig.cDisplay = `DeepL API ${v.deepl}` : cSel == "bing" ? TETConfig.cDisplay = `Bing ${v.bing}` : cSel == "google" ? TETConfig.cDisplay = `Google ${v.google}` : cSel == "mymemory" ? TETConfig.cDisplay = `MyMemory ${v.mymemory}` : cSel == "translate" ? TETConfig.cDisplay = `Translate.com ${v.translate}` : cSel == "yandex" ? TETConfig.cDisplay = `Yandex ${v.yandex}` : TETConfig.cDisplay = `DeepL ${v.deepl}`; TETConfig.cDisplay = TETConfig.display == "icon" ? disA : TETConfig.display == "text" ? disB : TETConfig.display == "text + icon" ? disC : log("Fuck Error", "error"); return mode == "demo" ? $('#tetDemo').html(`${TETConfig.cLang} ${TETConfig.cDisplay}`) : false; } ; function site(btLang, content) { return TETConfig.translator == 'yandex' ? `https://translate.yandex.com/?lang=${btLang}-${TETConfig.lang}&text=${content}` : TETConfig.translator == 'bing' ? `https://www.bing.com/translator/?text=${content}&from=${btLang}&to=${TETConfig.lang}` : TETConfig.translator == 'google' ? `https://translate.google.com/?q=${content}&sl=${btLang}&tl=${TETConfig.lang}` : TETConfig.translator == 'mymemory' ? `https://mymemory.translated.net/${TETConfig.lang}/${btLang}/${TETConfig.lang}/${content}` : TETConfig.translator == 'translate' ? `https://www.translate.com/machine-translation#${btLang}/${TETConfig.lang}/${content}` : `https://www.deepl.com/translator#${btLang}/${TETConfig.lang}/${content}`; } ; function TETBtnClick(source, btLang, content, mode) { mode = mode ?? "append"; btLang = btLang ?? "auto"; let tetBtn = $(``); mode === "append" ? tetBtn.appendTo(source) : mode === "prepend" ? tetBtn.prependTo(source) : mode === "td" ? source.after(tetBtn) : tetBtn.prependTo(mode); tetBtn.on("click", async e => { e.preventDefault(); let vCheck = TETConfig.api.version == "api-pro" ? 'api' : 'api-free'; TETConfig.translator == 'mymemoryIT' ? get(`https://api.mymemory.translated.net/get?q=${content}&langpair=${btLang}|${TETConfig.lang}`).then(r => { let res = r.responseData.translatedText, inlineText = $(`
${res}
`); inlineText.appendTo(source); }) : TETConfig.translator == 'googleIT' ? get(`https://translation.googleapis.com/language/translate/v2?q=${content}&target=${TETConfig.lang}&source=${btLang}&key=${TETConfig.api.google}`).then(r => { let res = r.data.translations[0], inlineText = $(`
${res.translatedText}
`); inlineText.appendTo(source); }) : TETConfig.translator == 'deeplIT' ? get(`https://${vCheck}.deepl.com/v2/translate?auth_key=${TETConfig.api.deepl}&text=${content}&target_lang=${TETConfig.lang}`).then(r => { let res = r.translations[0], inlineText = $(`
${res.text}
`); inlineText.appendTo(source); }) : window.open(site(btLang, content), '_blank'); }); tetBtn.hover(function () { $(this).toggleClass("r-hover"); }, function () { $(this).toggleClass("r-hover"); }); TETDisplayChange(); } ; function Twitter(btContainer, content = '') { let translateTweet = $("div[lang]").eq(0).siblings().eq(0).children("span"), translateBio = $('div[data-testid="UserDescription"]').eq(0).siblings().eq(0).children("span"), source = translateTweet.parent().parent(), loggout = document.cookie.includes("twid"), tweetbtn = (user = "loggedin") => { user === "logout" ? ( btContainer = $("div[lang]").eq(0), source = btContainer.parent()) : (btContainer = translateTweet.parent().siblings().eq(0), source = translateTweet.parent().parent()); btContainer.children("span").each((index, item) => { let tweet = $(item).html().trim(); tweet && tweet != '' && !isHTML(tweet) ? content += tweet : false; }); TETBtnClick(source, btContainer.attr("lang"), content); }, biobtn = (user = "loggedin") => { user === "logout" ? ( btContainer = $('div[data-testid="UserDescription"]').eq(0), source = $('div[data-testid="UserDescription"]').eq(0).parent()) : (btContainer = translateBio.parent().siblings().eq(0), source = translateBio.parent().parent()); btContainer.children("span").each((index, item) => { let bio = $(item).html().trim(); bio && bio != '' && !isHTML(bio) ? content += bio : false; }); TETBtnClick(source, "auto", content); }, checker = () => { if (!$('.tet').length) { return translateBio.length ? biobtn() : $('div[data-testid="UserDescription"]').length && !loggout ? biobtn("logout") : translateTweet.length ? tweetbtn() : !translateTweet.length && !loggout && $("div[lang]").attr("lang") !== TETConfig.lang ? tweetbtn("logout") : false; } ; }; /login/.test(window.location.href) || /profile/.test(window.location.href) || /keyboard_shortcuts/.test(window.location.href) || /display/.test(window.location.href) || /video/.test(window.location.href) || /photo/.test(window.location.href) || /compose/.test(window.location.href) ? $('#tetMenuButton').attr('style', 'z-index: -1 !important;') : $('#tetMenuButton').attr('style', ''); return checker(); } ; function TweetDeck(btContainer) { let translateTweet = $('a.js-translate-call-to-action'), tweetbtn = () => { btContainer = translateTweet.siblings().eq(2), TETBtnClick(translateTweet, $('p.js-tweet-text[lang]').attr("lang"), btContainer.text(), "td"); }, checker = () => { !$('.tet').length ? $('div.prf-header').length ? TETBtnClick($('p.prf-bio').parent(), "auto", $('p.prf-bio').text()) : translateTweet.length ? tweetbtn() : $('.tet').attr('style', 'display: flex !important; align-items: end !important;') : false; }; return checker(); } ; function Nitter() { let trTweet = $('#m > div > div > div.tweet-content.media-body'), trBio = $('div.profile-bio > p'); return !$('.tet').length ? trTweet.length ? TETBtnClick(trTweet, "auto", trTweet.text(), $(".conversation")) : trBio.length ? TETBtnClick(trBio.parent(), "auto", trBio.text()) : false : false; } ; function TwitLonger() { let content = $('p#posttext').text(), source = $('.actions.text-right'); return !$(".tet").length && source.length ? TETBtnClick(source, "auto", content, "prepend") : false; } ; function Menu() { try { log("Menu init"); let nav = $('.navbackground'), menuBtn = $('button#tetMenuButton'), selLG = qs('select#languages'), selCS = qs('select#colorselect'), selTH = qs('select#theme'), selTR = qs('select#translator'), selDS = qs('select#display'), dlAPI = qs('input.deepl'), goAPI = qs('input.google'), selAPI = qs('select#api-version'), dColor = $(".tetDisplayColor"), tColor = $(".tetTextColor"), tBG = $(".tetBackground"), tDesc = $(".tet-demotext"), v = en.fn(); selLG.value = TETConfig.lang; selCS.value = TETConfig.colors; selTH.value = TETConfig.theme; selTR.value = TETConfig.translator; selDS.value = TETConfig.display; dlAPI.value = TETConfig.api.deepl ?? ""; goAPI.value = TETConfig.api.google ?? ""; selAPI.value = TETConfig.api.version; const TETLanguageChange = () => { let TETSel = selLG.value; TETSel == "en" ?? defaultLang == "en-US" ? v = en.fn() : TETSel == "bg" ? v = bg.fn() : TETSel == "cs" ? v = cs.fn() : TETSel == "da" ? v = da.fn() : TETSel == "et" ? v = et.fn() : TETSel == "fi" ? v = fi.fn() : TETSel == "el" ? v = el.fn() : TETSel == "hu" ? v = hu.fn() : TETSel == "lv" ? v = lv.fn() : TETSel == "lt" ? v = lt.fn() : TETSel == "ro" ? v = ro.fn() : TETSel == "sk" ? v = sk.fn() : TETSel == "sl" ? v = sl.fn() : TETSel == "sv" ? v = sv.fn() : TETSel == "zh" ?? defaultLang == "zh-TW" ?? defaultLang == "zh-CN" ?? defaultLang == "zh-Hant" ? v = zh.fn() : TETSel == "nl" ? v = nl.fn() : TETSel == "fr" ? v = fr.fn() : TETSel == "de" ? v = de.fn() : TETSel == "it" ? v = it.fn() : TETSel == "ja" ? v = ja.fn() : TETSel == "pl" ? v = pl.fn() : TETSel == "pt" ? v = pt.fn() : TETSel == "ru" ? v = ru.fn() : TETSel == "es" ? v = es.fn() : (v = en.fn(), TETSel = "en"); TETConfig.cLang = v.tw; $('button#tetMenuButton').attr('title', v.menu); $('button#tetMenuButton > span').text(v.menu); $('select#languages').siblings().children("span").text(v.lg); $('select#translator').siblings().children("span").text(v.tr); $('select#display').siblings().children("span").text(v.ds); $('select#theme').siblings().children("span").text(v.th); $('option[value="#FFFFFF"]').text(v.df); $('option[value="#15202B"]').text(v.di); $('option[value="#000000"]').text(v.lo); $('select#colorselect').siblings().children("span").text(v.col); $('option[value="r-urgr8i"]').text(v.cb); $('option[value="r-1vkxrha"]').text(v.cy); $('option[value="r-1dgebii"]').text(v.cr); $('option[value="r-168457u"]').text(v.cp); $('option[value="r-18z3xeu"]').text(v.co); $('option[value="r-b5skir"]').text(v.cg); $('option[value="text + icon"]').text(v.ti); $('option[value="text"]').text(v.t); $('option[value="icon"]').text(v.i); $('button#tetReset').text(v.res); $('.tet-alert-head').text(v.head); $('.tet-alert-span').text(v.body); $('.tet-confirm').text(v.yes); $('.tet-deny').text(v.no); TETDisplayChange("demo"); }, TETMenuUpdate = (cSel, type) => { if (type === "theme") { return cSel == "#FFFFFF" ? (TETConfig.cBG = "rgba(0, 0, 0, 0.4)", TETConfig.cTheme = "r-14lw9ot", TETConfig.cText = "r-18jsvk2") : cSel == "#15202B" ? TETConfig.cTheme = "r-yfoy6g" : cSel == "nitter" ? (TETConfig.cBG = "rgba(0, 0, 0, 0.4)", TETConfig.cTheme = "nitter", TETConfig.cText = "tetNTextColor") : cSel == "tweetdeck" ? (TETConfig.cBG = "rgba(0, 0, 0, 0.4)", TETConfig.cTheme = "r-tetTD", TETConfig.cText = "r-jwli3a") : TETConfig.cTheme = "r-kemksi"; } else if (type === "colors") { return cSel == "r-urgr8i" ? (TETConfig.cHover = "r-1q3imqu", TETConfig.cColor = "r-p1n3y5 r-1bih22f", TETConfig.cSub = "r-13gxpu9") : cSel == "nitter" ? (TETConfig.cHover = "tetNitterHover", TETConfig.cColor = "tetNitter", TETConfig.cSub = "tetNText") : cSel == "tweetdeck" ? (TETConfig.cHover = "r-hoverTD", TETConfig.cColor = "Button--primary", TETConfig.cSub = "tet-td") : cSel == "r-1vkxrha" ? (TETConfig.cHover = "r-1kplyi6", TETConfig.cColor = "r-v6khid r-cdj8wb", TETConfig.cSub = "r-61mi1v") : cSel == "r-1dgebii" ? (TETConfig.cHover = "r-1ucxkr8", TETConfig.cColor = "r-1iofnty r-jd07pc", TETConfig.cSub = "r-daml9f") : cSel == "r-168457u" ? (TETConfig.cHover = "r-njt2r9", TETConfig.cColor = "r-hy56xe r-11mmphe", TETConfig.cSub = "r-xfsgu1") : cSel == "r-18z3xeu" ? (TETConfig.cHover = "r-1kplyi6", TETConfig.cColor = "r-1xl5njo r-b8m25f", TETConfig.cSub = "r-1qkqhnw") : cSel == "r-b5skir" ? (TETConfig.cHover = "r-zx61xx", TETConfig.cColor = "r-5ctkeg r-1cqwhho", TETConfig.cSub = "r-nw8l94") : (TETConfig.cHover = "r-1q3imqu", TETConfig.cColor = "r-p1n3y5 r-1bih22f", TETConfig.cSub = "r-13gxpu9"); } else if (type == "translator") { return cSel == "bingIT" ? ($('.google').hide(), $('.bing').show(), $('.deepl').hide()) : cSel == "googleIT" ? ($('.google').show(), $('.bing').hide(), $('.deepl').hide()) : cSel == "deeplIT" ? ($('.deepl').show(), $('.google').hide(), $('.bing').hide()) : $('.tetFields').hide(); } }; TETConfig.theme == "nitter" ? $('.r-demo').toggleClass('demo-TW').toggleClass('demo-NT') : TETConfig.theme == "tweetdeck" ? $('.r-demo').toggleClass('demo-TW').toggleClass('demo-TD') : false; if (find.nitter) { injectCSS(twCSS, "foreign"); $('div.btNav').attr("id", "tetNT"); tetAvatar = $(`link[rel="icon"]`).attr("href"); $('#tetAvatar').attr('style', `background-image: url(${tetAvatar}) !important;`); } else if (find.tweetdeck) { injectCSS(twCSS, "foreign"); $('#tetMenuButton').toggleClass("tetTD"); tetAvatar = $(`link[rel="shortcut icon"]`).attr("href"); $('#tetAvatar').attr('style', `background-image: url(${tetAvatar}) !important;`); } else if (find.twitlonger) { injectCSS(twCSS, "foreign"); tetAvatar = $(`link[rel="shortcut icon"]`).attr("href"); $('#tetAvatar').attr('style', `background-image: url(${tetAvatar}) !important;`); } ; nav.attr("style", `background-color:${TETConfig.cBG}`); tetEach(tBG, TETConfig.cTheme); tetEach(tColor, TETConfig.cText); tetEach(dColor, TETConfig.colors); tetEach($('#tetDemo'), TETConfig.cSub); tBG.toggleClass(TETConfig.cTheme); tColor.toggleClass(TETConfig.cText); TETMenuUpdate(selTH.value, "theme"); tBG.toggleClass(TETConfig.cTheme); tColor.toggleClass(TETConfig.cText); TETMenuUpdate(selTR.value, "translator"); log("Menu functions"); tetEach(qs('div#tetSelector', true), false, e => { $(e.target).toggleClass(`${TETConfig.cColor} r-1kqtdi0`).children("div#tetName").toggleClass(`${TETConfig.cSub}`); }); ael("click", e => { !$('.tetAlert.rm').length ? $('.tetAlert').toggleClass("rm") : false; $('html').toggleClass('tetFreeze'); $('#tetForm').toggleClass("rm"); $('.btNav').attr('style', 'z-index: -1 !important;'); $('svg#tetSVG').show(); menuBtn.attr("style", ""); menuBtn.toggleClass("mini"); $('#tetDemo').toggleClass("rm"); $(e.target).removeClass("warn").toggleClass("rm"); selLG.value !== "en" ?? defaultLang !== "en" ?? defaultLang !== "en-US" ? tDesc.text("Hey look, I'm a foreign language!") : tDesc.text(defaultDesc); TETConfig.api.google = goAPI.value; TETConfig.api.deepl = dlAPI.value; TETSave(); autoHide(); }, qs('.navbackground')); ael("click", () => { nav.toggleClass("rm"); $('#tetForm').toggleClass("rm"); $('.btNav').attr('style', 'z-index: 10000 !important'); menuBtn.attr("style", "display: none !important;").toggleClass("mini"); $('html').toggleClass('tetFreeze'); }, qs("button#tetMenuButton")); ael("mouseenter", () => { menuBtn.toggleClass(TETConfig.cHover).toggleClass(TETConfig.colors); $('svg#tetSVG').hide(); menuBtn.toggleClass("mini"); }, qs("button#tetMenuButton")); ael("mouseleave", () => { menuBtn.toggleClass(TETConfig.cHover).toggleClass(TETConfig.colors); $('svg#tetSVG').show(); menuBtn.toggleClass("mini"); autoHide(); }, qs("button#tetMenuButton")); ael("change", e => { let cSel = e.target.value; tBG.toggleClass(TETConfig.cTheme); tColor.toggleClass(TETConfig.cText); TETConfig.cText = "r-jwli3a"; TETConfig.cBG = "rgba(91, 112, 131, 0.4)"; TETMenuUpdate(cSel, "theme"); TETConfig.theme = cSel; tBG.toggleClass(TETConfig.cTheme); tColor.toggleClass(TETConfig.cText); }, selTH); ael("change", e => { let cSel = e.target.value; dColor.toggleClass(TETConfig.colors); $('#tetDemo').toggleClass(TETConfig.cSub); $('.tet').toggleClass(TETConfig.cSub); TETMenuUpdate(cSel, "colors"); TETConfig.colors = cSel; $('.tet').toggleClass(TETConfig.cSub); $('#tetDemo').toggleClass(TETConfig.cSub); dColor.toggleClass(TETConfig.colors); }, selCS); ael("change", e => { TETLanguageChange(); TETConfig.lang = e.target.value; }, selLG); ael("change", e => { let cSel = e.target.value; TETConfig.translator = cSel; TETMenuUpdate(cSel, "translator"); TETDisplayChange("demo"); }, selTR); ael("change", e => { TETConfig.display = e.target.value; TETDisplayChange("demo"); }, selDS); ael("change", e => { TETConfig.api.google = goAPI.value; TETConfig.api.deepl = dlAPI.value; TETConfig.api.version = e.target.value; }, selAPI); ael("click", () => { tDesc.text(v.theme); }, selTH); ael("click", () => { tDesc.text(v.color); }, selCS); ael("click", () => { tDesc.text(v.language); }, selLG); ael("click", () => { tDesc.text(v.translate); }, selTR); ael("click", () => { tDesc.text(v.display); }, selDS); ael("click", () => { $('.tetAlert').toggleClass("rm"); nav.toggleClass("warn"); }, qs('button#tetReset')); ael("click", () => { TETConfig = DefaultConfig; TETSave(); setTimeout(() => window.location.reload(), 200); }, qs('.tetAlertBtns.confirm')); ael("click", () => { $('.tetAlert').toggleClass("rm"); nav.removeClass("warn"); }, qs('.tetAlertBtns.deny')); log("Checking for language changes"); TETConfig.lang !== DefaultConfig.lang || TETConfig.lang !== "en" || TETConfig.lang !== "en-US" ? TETLanguageChange() : false; autoHide(); } catch (e) { log(e, "error"); TETConfig = DefaultConfig; TETSave(); } } ; await Promise.all([GM.getValue("Config")]).then(data => { if (lh === "tweetdeck.twitter.com" && !document.cookie.includes("twid")) { log("Must be login!!! Canceling...", "error"); return; } ; let res = data[0]; res || TETConfig === DefaultConfig ? () => { try { TETConfig = JSON.parse(res); } catch (e) { log(e, "error"); TETConfig = res; } } : (TETConfig = DefaultConfig, log("First time init.")); const localData = localStorage.TETConfig; localData && localData.length > 0 ? TETConfig = JSON.parse(localData) : false; for (let key in DefaultConfig) { typeof TETConfig[key] ?? (TETConfig[key] = DefaultConfig[key]); } log("Config Loaded"); injectCSS(tetCSS); let body = $("body"); body.prepend(sidebar); Menu(); log("Starting TET Injection"); TETInject(); }).catch(e => { TETConfig = DefaultConfig; log(e, "error"); }); })();