// ==UserScript== // @name YouTube Bot Comments Filter // @name:ru YouTube Bot Comments Filter — фильтр бот-комментариев // @name:es YouTube Bot Comments Filter — filtro de bots // @name:fr YouTube Bot Comments Filter — filtre de bots // @name:de YouTube Bot Comments Filter — Bot-Kommentarfilter // @name:pt-BR YouTube Bot Comments Filter — filtro de bots // @name:zh-CN YouTube Bot Comments Filter — 机器人评论过滤 // @name:ja YouTube Bot Comments Filter — ボットコメントフィルター // @name:ar YouTube Bot Comments Filter — فلتر تعليقات الروبوت // @name:hi YouTube Bot Comments Filter — बॉट टिप्पणी फ़िल्टर // @namespace https://github.com/NemoKing1210/youtube-bot-comments-filter // @version 1.3.0 // @author NemoKing1210 // @description Hides or blurs bot comments on YouTube (nickname pattern detection) with settings in the account menu. Multilingual UI. // @description:ru Скрывает или размывает бот-комментарии на YouTube (детекция по нику) с настройками в меню аккаунта. Мультиязычный UI. // @description:es Oculta o difumina comentarios de bots en YouTube (detección por apodo) con ajustes en el menú de la cuenta. UI multilingüe. // @description:fr Masque ou floute les commentaires de bots sur YouTube (détection par pseudo) avec des réglages dans le menu du compte. UI multilingue. // @description:de Blendet Bot-Kommentare auf YouTube aus oder macht sie unscharf (Erkennung per Nickname) mit Einstellungen im Kontomenü. Mehrsprachige UI. // @description:pt-BR Oculta ou desfoca comentários de bots no YouTube (detecção por apelido) com configurações no menu da conta. UI multilíngue. // @description:zh-CN 在 YouTube 上隐藏或模糊机器人评论(昵称模式检测),设置位于账号菜单。多语言界面。 // @description:ja YouTubeのボットコメントを非表示またはぼかし(ニックネーム検出)、設定はアカウントメニュー内。多言語UI。 // @description:ar يخفي أو يموّه تعليقات الروبوت على YouTube (كشف بالاسم) مع الإعدادات في قائمة الحساب. واجهة متعددة اللغات. // @description:hi YouTube पर बॉट टिप्पणियों को छिपाता या धुंधला करता है (उपनाम पैटर्न), सेटिंग्स खाता मेनू में। बहुभाषी UI। // @license MIT // @icon https://www.youtube.com/s/desktop/0715bbf9/img/favicon_96x96.png // @homepage https://github.com/NemoKing1210/youtube-bot-comments-filter // @homepageURL https://github.com/NemoKing1210/youtube-bot-comments-filter // @source https://github.com/NemoKing1210/youtube-bot-comments-filter.git // @supportURL https://github.com/NemoKing1210/youtube-bot-comments-filter/issues // @match https://www.youtube.com/* // @tag youtube // @tag comments // @tag filter // @grant GM_addStyle // @grant GM_getValue // @grant GM_setValue // @run-at document-idle // @noframes // ==/UserScript== (t=>{if(typeof GM_addStyle=="function"){GM_addStyle(t);return}const e=document.createElement("style");e.textContent=t,document.head.append(e)})(" .ytbf-hide-mode #main>:not(.ytbf-hidden-notice){display:none!important}.ytbf-hide-mode:not(:has(#main))>:not(.ytbf-hidden-notice):not(.ytbf-bot-score){display:none!important}.ytbf-hidden-notice{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:10px 0 6px;font-size:13px;line-height:1.4;color:var(--yt-spec-text-secondary, #909090);font-style:italic}.ytbf-hidden-notice .ytbf-hidden-notice-text{font-style:italic}.ytbf-blur #author-thumbnail,.ytbf-blur #author-text,.ytbf-blur #name,.ytbf-blur #published-time-text,.ytbf-blur #sponsor-comment-badge,.ytbf-blur #header-author>:not(.ytbf-bot-score),.ytbf-blur #content-text,.ytbf-blur #comment-content,.ytbf-blur #expander,.ytbf-blur #toolbar,.ytbf-blur #action-buttons,.ytbf-blur ytd-comment-engagement-bar,.ytbf-blur #replies{filter:blur(7px) grayscale(1);opacity:.35;transition:filter .25s ease,opacity .25s ease}.ytbf-blur:hover #author-thumbnail,.ytbf-blur:hover #author-text,.ytbf-blur:hover #name,.ytbf-blur:hover #published-time-text,.ytbf-blur:hover #sponsor-comment-badge,.ytbf-blur:hover #header-author>:not(.ytbf-bot-score),.ytbf-blur:hover #content-text,.ytbf-blur:hover #comment-content,.ytbf-blur:hover #expander,.ytbf-blur:hover #toolbar,.ytbf-blur:hover #action-buttons,.ytbf-blur:hover ytd-comment-engagement-bar,.ytbf-blur:hover #replies{filter:blur(0) grayscale(0);opacity:1}.ytbf-blur .ytbf-bot-score{filter:none!important;opacity:1!important}.ytbf-bot-score{display:inline-flex;align-items:center;gap:5px;flex:0 0 auto;margin-inline-end:6px;padding:2px 7px;border-radius:10px;vertical-align:middle;font-family:Roboto,Arial,sans-serif;font-size:12px;font-weight:500;line-height:1.2;letter-spacing:.01em;user-select:none;background:var(--yt-spec-badge-chip-background, rgba(0, 0, 0, .06));color:var(--ytbf-score-color, #e6a700);box-shadow:0 0 0 1px color-mix(in srgb,var(--ytbf-score-color, #e6a700) 35%,transparent)}html[dark] .ytbf-bot-score,html[darker-dark-theme] .ytbf-bot-score{background:#0000008c}.ytbf-bot-score[data-level=mid]{--ytbf-score-color: #c79100}.ytbf-bot-score[data-level=high]{--ytbf-score-color: #e07000}.ytbf-bot-score[data-level=critical]{--ytbf-score-color: #e53935}.ytbf-bot-score-dot{width:8px;height:8px;flex:0 0 auto;border-radius:50%;background:var(--ytbf-score-color, #e6a700);box-shadow:0 0 0 2px color-mix(in srgb,var(--ytbf-score-color, #e6a700) 25%,transparent)}.ytbf-bot-score-label{white-space:nowrap}.ytbf-account-section{display:block;border-top:1px solid var(--yt-spec-10-percent-layer, rgba(0, 0, 0, .1))}html[dark] .ytbf-account-section,html[darker-dark-theme] .ytbf-account-section{border-top-color:var(--yt-spec-10-percent-layer, rgba(255, 255, 255, .1))}.ytbf-account-link,.ytbf-submenu-item,.ytbf-submenu-back{display:flex;align-items:center;gap:16px;width:100%;box-sizing:border-box;min-height:40px;padding:0 16px;margin:0;border:none;outline:none;cursor:pointer;appearance:none;-webkit-appearance:none;background:transparent;color:var(--yt-spec-text-primary, #0f0f0f);font-family:Roboto,Arial,sans-serif;font-size:14px;font-weight:400;line-height:1.4;text-align:start;-webkit-tap-highlight-color:transparent}html[dark] .ytbf-account-link,html[dark] .ytbf-submenu-item,html[dark] .ytbf-submenu-back,html[darker-dark-theme] .ytbf-account-link,html[darker-dark-theme] .ytbf-submenu-item,html[darker-dark-theme] .ytbf-submenu-back{color:var(--yt-spec-text-primary, #f1f1f1)}.ytbf-account-link:hover,.ytbf-account-link:focus-visible,.ytbf-submenu-item:hover,.ytbf-submenu-item:focus-visible,.ytbf-submenu-back:hover,.ytbf-submenu-back:focus-visible{background:var(--yt-spec-10-percent-layer, rgba(0, 0, 0, .05))}html[dark] .ytbf-account-link:hover,html[dark] .ytbf-account-link:focus-visible,html[dark] .ytbf-submenu-item:hover,html[dark] .ytbf-submenu-item:focus-visible,html[dark] .ytbf-submenu-back:hover,html[dark] .ytbf-submenu-back:focus-visible,html[darker-dark-theme] .ytbf-account-link:hover,html[darker-dark-theme] .ytbf-account-link:focus-visible,html[darker-dark-theme] .ytbf-submenu-item:hover,html[darker-dark-theme] .ytbf-submenu-item:focus-visible,html[darker-dark-theme] .ytbf-submenu-back:hover,html[darker-dark-theme] .ytbf-submenu-back:focus-visible{background:var(--yt-spec-10-percent-layer, rgba(255, 255, 255, .1))}.ytbf-account-link-icon,.ytbf-account-link-caret,.ytbf-submenu-item-icon,.ytbf-submenu-item-check,.ytbf-submenu-back-icon{display:inline-flex;width:24px;height:24px;flex:0 0 auto;color:inherit}.ytbf-account-link-icon svg,.ytbf-account-link-caret svg,.ytbf-submenu-item-icon svg,.ytbf-submenu-item-check svg,.ytbf-submenu-back-icon svg{fill:currentColor}.ytbf-account-link-text{display:flex;flex-direction:column;flex:1 1 auto;min-width:0;gap:2px}.ytbf-account-link-label{color:inherit}.ytbf-account-link-subtitle{color:var(--yt-spec-text-secondary, #606060);font-size:12px;line-height:1.3}html[dark] .ytbf-account-link-subtitle,html[darker-dark-theme] .ytbf-account-link-subtitle{color:var(--yt-spec-text-secondary, #aaa)}.ytbf-submenu{display:flex;flex-direction:column;width:100%;box-sizing:border-box;padding:0 0 8px;color:var(--yt-spec-text-primary, #0f0f0f);font-family:Roboto,Arial,sans-serif}html[dark] .ytbf-submenu,html[darker-dark-theme] .ytbf-submenu{color:var(--yt-spec-text-primary, #f1f1f1)}.ytbf-submenu-header{display:flex;align-items:center;gap:4px;min-height:48px;padding:0 8px 0 4px;border-bottom:1px solid var(--yt-spec-10-percent-layer, rgba(0, 0, 0, .1));margin-bottom:8px}html[dark] .ytbf-submenu-header,html[darker-dark-theme] .ytbf-submenu-header{border-bottom-color:var(--yt-spec-10-percent-layer, rgba(255, 255, 255, .1))}.ytbf-submenu-back{width:auto;min-height:40px;padding:0 8px;border-radius:50%;flex:0 0 auto}.ytbf-submenu-title{flex:1 1 auto;min-width:0;font-size:16px;font-weight:500;line-height:1.4;padding-inline-end:8px}.ytbf-submenu-item-label{flex:1 1 auto;min-width:0}.ytbf-submenu-item-check{visibility:hidden}.ytbf-submenu-item[aria-checked=true] .ytbf-submenu-item-check{visibility:visible}.ytbf-submenu-extras{display:flex;flex-direction:column;margin-top:8px;padding-top:8px;border-top:1px solid var(--yt-spec-10-percent-layer, rgba(0, 0, 0, .1))}html[dark] .ytbf-submenu-extras,html[darker-dark-theme] .ytbf-submenu-extras{border-top-color:var(--yt-spec-10-percent-layer, rgba(255, 255, 255, .1))} "); (function () { 'use strict'; const e="data-ytbf-root",t="ytbf_mode",o="ytbf_show_score",n="ytbf-hidden-notice",r="data-ytbf-processed",i="ytd-comment-view-model, ytd-comment-renderer",c=["SAWS.PW","TLES.TOP","FK59.TOP"],s="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z",a={en:{hide:"Bots: hidden",blur:"Bots: blurred",tooltip:"Bot filter settings",menuTitle:"Bot filter",back:"Back",hideOption:"Hide bot comments",blurOption:"Blur bot comments",showScoreOption:"Show bot %",hiddenNotice:"This comment was hidden by the bot filter.",botScore:"Bot {n}%",botScoreTooltip:"Estimated probability this comment is from a bot"},ru:{hide:"Боты: скрыты",blur:"Боты: размыты",tooltip:"Настройки фильтра ботов",menuTitle:"Фильтр ботов",back:"Назад",hideOption:"Скрывать бот-комментарии",blurOption:"Размывать бот-комментарии",showScoreOption:"Показывать % бота",hiddenNotice:"Этот комментарий скрыт фильтром ботов.",botScore:"Бот {n}%",botScoreTooltip:"Оценка вероятности, что комментарий от бота"},es:{hide:"Bots: ocultos",blur:"Bots: difuminados",tooltip:"Ajustes del filtro de bots",menuTitle:"Filtro de bots",back:"Atrás",hideOption:"Ocultar comentarios de bots",blurOption:"Difuminar comentarios de bots",showScoreOption:"Mostrar % de bot",hiddenNotice:"Este comentario fue ocultado por el filtro de bots.",botScore:"Bot {n}%",botScoreTooltip:"Probabilidad estimada de que el comentario sea de un bot"},fr:{hide:"Bots : masqués",blur:"Bots : flous",tooltip:"Réglages du filtre anti-bots",menuTitle:"Filtre anti-bots",back:"Retour",hideOption:"Masquer les commentaires de bots",blurOption:"Flouter les commentaires de bots",showScoreOption:"Afficher le % bot",hiddenNotice:"Ce commentaire a été masqué par le filtre anti-bots.",botScore:"Bot {n}%",botScoreTooltip:"Probabilité estimée que le commentaire vienne d’un bot"},de:{hide:"Bots: ausgeblendet",blur:"Bots: unscharf",tooltip:"Bot-Filter-Einstellungen",menuTitle:"Bot-Filter",back:"Zurück",hideOption:"Bot-Kommentare ausblenden",blurOption:"Bot-Kommentare unscharf machen",showScoreOption:"Bot-% anzeigen",hiddenNotice:"Dieser Kommentar wurde vom Bot-Filter ausgeblendet.",botScore:"Bot {n}%",botScoreTooltip:"Geschätzte Wahrscheinlichkeit, dass der Kommentar von einem Bot stammt"},pt:{hide:"Bots: ocultos",blur:"Bots: desfocados",tooltip:"Configurações do filtro de bots",menuTitle:"Filtro de bots",back:"Voltar",hideOption:"Ocultar comentários de bots",blurOption:"Desfocar comentários de bots",showScoreOption:"Mostrar % de bot",hiddenNotice:"Este comentário foi ocultado pelo filtro de bots.",botScore:"Bot {n}%",botScoreTooltip:"Probabilidade estimada de o comentário ser de um bot"},zh:{hide:"机器人:已隐藏",blur:"机器人:已模糊",tooltip:"机器人过滤器设置",menuTitle:"机器人过滤器",back:"返回",hideOption:"隐藏机器人评论",blurOption:"模糊机器人评论",showScoreOption:"显示机器人百分比",hiddenNotice:"此评论已被机器人过滤器隐藏。",botScore:"机器人 {n}%",botScoreTooltip:"该评论来自机器人的估计概率"},ja:{hide:"ボット:非表示",blur:"ボット:ぼかし",tooltip:"ボットフィルター設定",menuTitle:"ボットフィルター",back:"戻る",hideOption:"ボットコメントを非表示",blurOption:"ボットコメントをぼかす",showScoreOption:"ボット%を表示",hiddenNotice:"このコメントはボットフィルターにより非表示にされました。",botScore:"ボット {n}%",botScoreTooltip:"ボットによるコメントである推定確率"},ar:{hide:"الروبوتات: مخفية",blur:"الروبوتات: ضبابية",tooltip:"إعدادات فلتر الروبوتات",menuTitle:"فلتر الروبوتات",back:"رجوع",hideOption:"إخفاء تعليقات الروبوتات",blurOption:"تمويه تعليقات الروبوتات",showScoreOption:"إظهار نسبة الروبوت",hiddenNotice:"تم إخفاء هذا التعليق بواسطة فلتر الروبوتات.",botScore:"روبوت {n}%",botScoreTooltip:"الاحتمال التقديري أن التعليق من روبوت"},hi:{hide:"बॉट: छिपे हुए",blur:"बॉट: धुंधले",tooltip:"बॉट फ़िल्टर सेटिंग्स",menuTitle:"बॉट फ़िल्टर",back:"वापस",hideOption:"बॉट टिप्पणियाँ छिपाएँ",blurOption:"बॉट टिप्पणियाँ धुंधली करें",showScoreOption:"बॉट % दिखाएँ",hiddenNotice:"यह टिप्पणी बॉट फ़िल्टर द्वारा छिपाई गई थी।",botScore:"बॉट {n}%",botScoreTooltip:"अनुमानित संभावना कि टिप्पणी बॉट की है"}},u=function(){const e=(navigator.language||"en").split("-")[0].toLowerCase();return a[e]?e:"en"}();function l(e){return a[u]&&a[u][e]||a.en[e]||e}var d=(()=>"undefined"!=typeof GM_getValue?GM_getValue:void 0)(),m=(()=>"undefined"!=typeof GM_setValue?GM_setValue:void 0)();function b(){return d(t,"hide")}function h(){return false!==d(o,false)}const f=["PW","TOP","XYZ","ONLINE","SITE","CLUB","WIN","CC","ICU","VIP","CFD","SBS","SPACE","FUN","LIVE","MOM","CASA","MONSTER","CYOU","BUZZ","WORK","RUN","STREAM","CAM"].join("|"),p={rules:[{name:"domain-like-prefix",weight:3,test:e=>new RegExp(`^@?[A-Z0-9]{2,}\\.(${f})(?:[_-]|$|[^A-Za-z0-9])`,"i").test(e)},{name:"separator-right-after-tld",weight:2,test:e=>new RegExp(`\\.(${f})[_-]{1,3}`,"i").test(e)},{name:"translit-spam-keywords",weight:3,test:e=>/(tyt[_-]?ha|[_-]caut[_-]|^caut|na[_-]?caut|na[_-]?sait|saite|sayte|perehod|smotri|4ki[_-]?na|shtuki|haxodui|hodui[_-]?caut)/i.test(e)},{name:"alnum-digit-before-tld",weight:2,test:e=>new RegExp(`^@?[A-Z0-9]*\\d[A-Z0-9]*\\.(${f})`,"i").test(e)},{name:"tld-then-translit-suffix",weight:3,test:e=>new RegExp(`\\.(${f})_[A-Za-z0-9]*caut`,"i").test(e)},{name:"trailing-numeric-suffix",weight:1,test:e=>/[_-]\d{2,3}$/.test(e.trim())},{name:"many-underscores",weight:1,test:e=>(e.match(/_/g)||[]).length>=3},{name:"leetspeak-digit-in-word",weight:1,test:e=>/[a-z]\d[a-z]/i.test(e)},{name:"caps-prefix-with-dot",weight:1,test:e=>/^@?[A-Z]{3,}\.[A-Z]{2,5}/.test(e)},{name:"exact-match-list",weight:100,test:e=>c.some(t=>e.toUpperCase().includes(t.toUpperCase()))}],threshold:4,score(e){let t=0;const o=[];for(const r of this.rules)try{r.test(e)&&(t+=r.weight,o.push(r.name));}catch(n){console.warn("[ytbf] rule error:",r.name,n);}return {total:t,matched:o}},confidencePercent:e=>e<=0?0:Math.min(100,Math.round(e/6*100)),isBot(e){return !!e&&this.score(e).total>=this.threshold}};function y(e){return h()&&e>50}function S(e){const t=function(e){return e.querySelector("#main")||e}(e);let o=t.querySelector(`.${n}`);o||(o=document.createElement("div"),o.className=n,t.appendChild(o));let r=o.querySelector(".ytbf-hidden-notice-text");return r||(r=document.createElement("span"),r.className="ytbf-hidden-notice-text",o.appendChild(r)),r.textContent=l("hiddenNotice"),o}function C(e){e.querySelectorAll(`.${n}`).forEach(e=>e.remove());}function g(e){return l("botScore").replace("{n}",String(e))}function E(e,t){const{parent:o,before:n}=function(e){if(e.classList.contains("ytbf-hide-mode")){const t=S(e),o=t.querySelector(".ytbf-hidden-notice-text");return {parent:t,before:o}}const t=e.querySelector("#author-text");if(t&&t.parentElement)return {parent:t.parentElement,before:t};const o=e.querySelector("#header-author");return o?{parent:o,before:o.firstChild}:{parent:e,before:e.firstChild}}(e);let r=e.querySelector(".ytbf-bot-score");if(!r){r=document.createElement("span"),r.className="ytbf-bot-score",r.setAttribute("role","status");const e=document.createElement("span");e.className="ytbf-bot-score-dot",e.setAttribute("aria-hidden","true");const t=document.createElement("span");t.className="ytbf-bot-score-label",r.append(e,t);}r.parentElement===o&&r.nextSibling===n||o.insertBefore(r,n),r.dataset.level=function(e){return e>=85?"critical":e>=70?"high":"mid"}(t),r.title=l("botScoreTooltip"),r.setAttribute("aria-label",g(t));const i=r.querySelector(".ytbf-bot-score-label");i&&(i.textContent=g(t));}function A(e){e.querySelectorAll(".ytbf-bot-score").forEach(e=>e.remove());}function w(e){e.classList.remove("ytbf-blur","ytbf-hide-mode"),C(e),"hide"===b()?function(e){e.classList.remove("ytbf-blur"),e.classList.add("ytbf-hide-mode"),S(e);}(e):function(e){e.classList.remove("ytbf-hide-mode"),C(e),e.classList.add("ytbf-blur");}(e);}function v(e){const t=function(e){const t=e.querySelector("#author-text");return t?t.textContent.trim():""}(e),{total:o}=p.score(t),n=o>=p.threshold,i=p.confidencePercent(o);e.setAttribute(r,"1"),e.dataset.ytbfBot=n?"1":"0",e.dataset.ytbfPercent=String(i),n?w(e):function(e){e.classList.remove("ytbf-blur","ytbf-hide-mode"),C(e);}(e),y(i)?E(e,i):A(e);}let q=null,O=false;function k(e,t){const o=document.createElement("span");o.className=t,o.setAttribute("aria-hidden","true");const n=document.createElement("div");n.style.width="100%",n.style.height="100%",n.style.display="block",n.style.fill="currentcolor";const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("height","24"),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("width","24"),r.setAttribute("focusable","false"),r.setAttribute("aria-hidden","true"),r.style.pointerEvents="none",r.style.display="inherit",r.style.width="100%",r.style.height="100%";const i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttribute("d",e),r.appendChild(i),n.appendChild(r),o.appendChild(n),o}function N(e){return l("hide"===e?"hide":"blur")}function T(e=document){e.querySelectorAll("#ytbf-account-entry").forEach(e=>{const t=e.querySelector(".ytbf-account-link-label"),o=e.querySelector(".ytbf-account-link-subtitle");t&&(t.textContent=l("menuTitle")),o&&(o.textContent=N(b())),e.setAttribute("aria-label",`${l("menuTitle")}: ${N(b())}`);});}function x(e){if(!e)return;const t=b(),o=e.querySelector(".ytbf-submenu-title");o&&(o.textContent=l("menuTitle")),e.querySelectorAll(".ytbf-submenu-item[data-mode]").forEach(e=>{e.setAttribute("aria-checked",e.dataset.mode===t?"true":"false");const o=e.querySelector(".ytbf-submenu-item-label");o&&(o.textContent=l("hide"===e.dataset.mode?"hideOption":"blurOption"));});const n=e.querySelector('.ytbf-submenu-item[data-setting="show-score"]');if(n){n.setAttribute("aria-checked",h()?"true":"false");const e=n.querySelector(".ytbf-submenu-item-label");e&&(e.textContent=l("showScoreOption"));}}function B(e){return e.shadowRoot||e}function L(e){const t=[];e.shadowRoot&&t.push(e.shadowRoot),t.push(e);for(const n of t){const e=n.querySelector("#sections");if(e)return {root:n,container:n.querySelector("#container"),submenuHost:n.querySelector("#submenu"),sections:e}}const o=B(e);return {root:o,container:o.querySelector("#container"),submenuHost:o.querySelector("#submenu"),sections:null}}function M(e){if(!e)return;const{root:t,container:o,submenuHost:n}=L(e),r=t.querySelector("#ytbf-submenu");r&&r.remove(),n&&(n.hidden=true,n.replaceChildren()),o&&(o.hidden=false),q===e&&(O=false);}function z(e,o,n){const r=document.createElement("button");r.type="button",r.className="ytbf-submenu-item",r.dataset.mode=e,r.setAttribute("role","menuitemradio"),r.setAttribute("aria-checked","false");const c=document.createElement("span");return c.className="ytbf-submenu-item-label",c.textContent=l("hide"===e?"hideOption":"blurOption"),r.appendChild(k(o,"ytbf-submenu-item-icon")),r.appendChild(c),r.appendChild(k(s,"ytbf-submenu-item-check")),r.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),function(e,o){"hide"!==e&&"blur"!==e||(b()!==e&&(function(e){m(t,e);}(e),document.querySelectorAll(`${i}[data-ytbf-bot="1"]`).forEach(e=>{w(e);const t=Number(e.dataset.ytbfPercent)||0;y(t)?E(e,t):A(e);})),T(B(o)||document),x(o&&B(o).querySelector("#ytbf-submenu")),M(o));}(e,n);}),r}function P(e){const t=document.createElement("div");t.id="ytbf-submenu",t.className="ytbf-submenu",t.setAttribute("role","menu"),t.setAttribute("aria-label",l("menuTitle"));const n=document.createElement("div");n.className="ytbf-submenu-header";const c=document.createElement("button");c.type="button",c.className="ytbf-submenu-back",c.title=l("back"),c.setAttribute("aria-label",l("back")),c.appendChild(k("M20.41 11H7.83l4.88-4.88L11.29 4.71 4 12l7.29 7.29 1.42-1.41L7.83 13h12.58v-2z","ytbf-submenu-back-icon")),c.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),M(e);});const a=document.createElement("div");a.className="ytbf-submenu-title",a.textContent=l("menuTitle"),n.appendChild(c),n.appendChild(a);const u=document.createElement("div");u.className="ytbf-submenu-items",u.appendChild(z("hide","M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z",e)),u.appendChild(z("blur","M6 13c0-1.65.67-3.15 1.76-4.24L6.34 7.34A7.95 7.95 0 004 13c0 4.42 3.58 8 8 8a7.95 7.95 0 005.66-2.34l-1.42-1.42A5.98 5.98 0 0112 19c-3.31 0-6-2.69-6-6zm12.66-5.66L17.24 8.76A5.98 5.98 0 0118 13c0 3.31-2.69 6-6 6-.79 0-1.54-.16-2.24-.43l-1.55 1.55c1.15.56 2.43.88 3.79.88 4.42 0 8-3.58 8-8 0-1.36-.32-2.64-.88-3.79zM12 5c.79 0 1.54.16 2.24.43l1.55-1.55A7.95 7.95 0 0012 3C7.58 3 4 6.58 4 11c0 1.36.32 2.64.88 3.79l1.42-1.42A5.98 5.98 0 016 11c0-3.31 2.69-6 6-6zm0 2c-2.21 0-4 1.79-4 4 0 .74.21 1.42.56 2.02L14.02 7.56A3.96 3.96 0 0012 7zm0 8c2.21 0 4-1.79 4-4 0-.74-.21-1.42-.56-2.02L9.98 16.44c.6.35 1.28.56 2.02.56z",e));const d=document.createElement("div");return d.className="ytbf-submenu-extras",d.appendChild(function(e){const t=document.createElement("button");t.type="button",t.className="ytbf-submenu-item",t.dataset.setting="show-score",t.setAttribute("role","menuitemcheckbox"),t.setAttribute("aria-checked",h()?"true":"false");const n=document.createElement("span");return n.className="ytbf-submenu-item-label",n.textContent=l("showScoreOption"),t.appendChild(k("M7.5 11C9.43 11 11 9.43 11 7.5S9.43 4 7.5 4 4 5.57 4 7.5 5.57 11 7.5 11zm0-5C8.33 6 9 6.67 9 7.5S8.33 9 7.5 9 6 8.33 6 7.5 6.67 6 7.5 6zM16.5 13c-1.93 0-3.5 1.57-3.5 3.5s1.57 3.5 3.5 3.5 3.5-1.57 3.5-3.5-1.57-3.5-3.5-3.5zm0 5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM19.41 5.41 5.41 19.41 6.83 20.83 20.83 6.83z","ytbf-submenu-item-icon")),t.appendChild(n),t.appendChild(k(s,"ytbf-submenu-item-check")),t.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),function(e){var t;t=!h(),m(o,!!t),document.querySelectorAll(`${i}[${r}]`).forEach(e=>{const t=Number(e.dataset.ytbfPercent)||0;y(t)?E(e,t):A(e);}),x(e&&B(e).querySelector("#ytbf-submenu"));}(e);}),t}(e)),t.appendChild(n),t.appendChild(u),t.appendChild(d),x(t),t}function _(e){if(!(t=e)||"YTD-MULTI-PAGE-MENU-RENDERER"!==t.tagName||"multi-page-menu-style-type-system"!==t.getAttribute("menu-style")&&!B(t).querySelector("ytd-active-account-header-renderer"))return;var t;const{root:o,sections:n,container:r,submenuHost:i}=L(e);if(!n)return;if(O&&q===e&&(o.querySelector("#ytbf-submenu")||!i||i.hidden||(O=false)),!e.isConnected)return void M(e);let c=o.querySelector("#ytbf-account-section");if(c)return void T(c);c=function(e){const t=document.createElement("div");t.id="ytbf-account-section",t.className="ytbf-account-section style-scope ytd-multi-page-menu-renderer";const o=document.createElement("button");o.type="button",o.id="ytbf-account-entry",o.className="ytbf-account-link",o.setAttribute("role","link"),o.setAttribute("aria-haspopup","menu");const n=document.createElement("div");n.className="ytbf-account-link-text";const r=document.createElement("div");r.className="ytbf-account-link-label",r.textContent=l("menuTitle");const i=document.createElement("div");return i.className="ytbf-account-link-subtitle",i.textContent=N(b()),n.appendChild(r),n.appendChild(i),o.appendChild(k("M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39C20.25 4.95 19.08 4 18 4H6c-1.08 0-2.25.95-1.75 1.61z","ytbf-account-link-icon")),o.appendChild(n),o.appendChild(k("M8.793 5.293a1 1 0 000 1.414L14.086 12l-5.293 5.293a1 1 0 101.414 1.414L16.914 12l-6.707-6.707a1 1 0 00-1.414 0Z","ytbf-account-link-caret")),o.setAttribute("aria-label",`${l("menuTitle")}: ${N(b())}`),o.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),function(e){const{container:t,submenuHost:o}=L(e);if(!t||!o)return;M(e);const n=P(e);o.replaceChildren(n),t.hidden=true,o.hidden=false,q=e,O=true;const r=n.querySelector('.ytbf-submenu-item[aria-checked="true"]');if(r)r.focus();else {const e=n.querySelector(".ytbf-submenu-back");e&&e.focus();}}(e);}),t.appendChild(o),t}(e);const s=function(e){const t=e.querySelectorAll("yt-multi-page-menu-section-renderer");for(const o of t){const e=o.querySelectorAll("#label, yt-formatted-string");for(const t of e){const e=(t.textContent||"").trim().toLowerCase();if("settings"===e||"настройки"===e||"einstellungen"===e||"paramètres"===e||"ajustes"===e||"configurações"===e||"設定"===e||"设置"===e||"الإعدادات"===e||"सेटिंग"===e)return o}}return null}(n);s?n.insertBefore(c,s):n.appendChild(c),!o.querySelector("#ytbf-submenu")&&r&&(r.hidden=false,i&&(i.hidden=true));}let $=false;function R(){$||($=true,requestAnimationFrame(()=>{$=false,document.querySelectorAll("#ytbf-menu-wrap, #ytbf-toggle-wrap, #ytbf-dropdown").forEach(e=>{e.remove();}),function(){if(!O||!q)return;const e=q.closest("tp-yt-iron-dropdown");q.isConnected&&!function(e){return !e||!e.isConnected||!!e.hasAttribute("hidden")||"true"===e.getAttribute("aria-hidden")||"none"===e.style.display||"boolean"==typeof e.opened&&!e.opened}(e)||(M(q),q=null);}(),document.querySelectorAll('ytd-multi-page-menu-renderer[menu-style="multi-page-menu-style-type-system"]').forEach(_),document.querySelectorAll("ytd-multi-page-menu-renderer").forEach(e=>{B(e).querySelector("ytd-active-account-header-renderer")&&_(e);}),function(e=document){e.querySelectorAll(`${i}:not([${r}])`).forEach(v);}();}));}function D(){document.documentElement.hasAttribute(e)||(document.documentElement.setAttribute(e,"1"),document.addEventListener("keydown",e=>{"Escape"===e.key&&O&&q&&(e.stopPropagation(),e.preventDefault(),M(q));},true),new MutationObserver(()=>R()).observe(document.documentElement,{childList:true,subtree:true}),R(),setInterval(R,2e3));}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",D,{once:true}):D(); })();