在您安装前,Greasy Fork 希望您知道此脚本声明其包含了一些负面功能。这些功能也许会使脚本作者获利,而不能给您带来任何直接的金钱收益。
作者可从这份脚本获得佣金,例如通过修改链接地址或提供优惠券代码以包含推荐或附属代码。
这个脚本是一个增强器,用于提升您的YouTube观看体验!包含新功能和新布局。介绍:1.优化的视频详情页面界面。2.截图。3.深色/浅色主题切换。4.视频快进。等等。
// ==UserScript== // @name Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:zh-CN Youtubeᴾˡᵘˢ(油管)超级助手 - 视频下载 & 🚫去广告 & 布局优化,使用更舒服 // @name:zh-TW Youtubeᴾˡᵘˢ(油管)超級助手 - 視頻下載 & 🚫去廣告 & 布局優化,使用更舒服 // @name:ar Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:bg Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:cs Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:da Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:de Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:el Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:en Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:eo Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:es Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:es-419 Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:fi Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:fr Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:fr-CA Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:he Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:hr Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:hu Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:id Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!)) // @name:it Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:ja Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:ka Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:ko Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:nb Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:nl Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:pl Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:pt-BR Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:ro Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:ru Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:sv Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:th Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:tr Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:uk Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:ug Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @name:vi Youtubeᴾˡᵘˢ Super Assistant(Video Downloader & 🚫 No ads & New Layout For YT!) // @description The script is an Enhancer for Youtube to improve your watching experience!Contains features & new layout. Introduction: 1.Optimized Video Detail Page Interface. 2.Screenshot. 3.Dark/Light Theme Switch. 4.Video Fast Forward. etc. // @description:zh-CN 这个脚本是一个增强器,用于提升您的YouTube观看体验!包含新功能和新布局。介绍:1.优化的视频详情页面界面。2.截图。3.深色/浅色主题切换。4.视频快进。等等。 // @description:zh-TW 這個腳本是一個增強器,用於提升您的YouTube觀看體驗!包含新功能和新佈局。介紹:1.優化的影片詳細頁面介面。2.截圖。3.深色/淺色主題切換。4.影片快轉。等等。 // @description:ar البرنامج هو معزز لتحسين تجربة المشاهدة على يوتيوب! يحتوي على ميزات وتصميم جديد. المقدمة: 1. واجهة صفحة تفاصيل الفيديو المحسنة. 2. لقطة الشاشة. 3. التبديل بين الوضع الداكن/الفاتح. 4. تسريع الفيديو. إلخ. // @description:bg Скриптът е усилвател за подобряване на вашето изживяване в YouTube! Съдържа функции и нов дизайн. Въведение: 1. Оптимизирана страница с детайли за видео. 2. Снимка на екрана. 3. Превключване между тъмна/светла тема. 4. Бързо превъртане на видеото. и др. // @description:cs Skript je vylepšovač pro zlepšení vaší sledovací zkušenosti na YouTube! Obsahuje funkce a nový vzhled. Úvod: 1. Optimalizované rozhraní stránky s podrobnostmi o videu. 2. Snímek obrazovky. 3. Přepínač tmavého/světlého režimu. 4. Rychlé přetáčení videa. atd. // @description:da Scriptet er en forbedrer til at forbedre din seeroplevelse på YouTube! Indeholder funktioner og nyt layout. Introduktion: 1. Optimeret video detajtside interface. 2. Skærmbillede. 3. Mørk/lys tema skift. 4. Hurtig fremspoling af video. osv. // @description:de Das Skript ist ein Enhancer, um dein YouTube-Erlebnis zu verbessern! Es enthält Funktionen und ein neues Layout. Einführung: 1. Optimierte Video-Detail-Seitenoberfläche. 2. Screenshot. 3. Dunkel-/Helle-Themen-Schalter. 4. Video-Schnellvorlauf. usw. // @description:el Το σενάριο είναι ένας ενισχυτής για να βελτιώσετε την εμπειρία παρακολούθησης στο YouTube! Περιλαμβάνει δυνατότητες και νέο σχέδιο. Εισαγωγή: 1. Βελτιστοποιημένο interface σελίδας λεπτομερειών βίντεο. 2. Στιγμιότυπο οθόνης. 3. Εναλλαγή σκοτεινού/φωτεινού θέματος. 4. Γρήγορη προώθηση βίντεο. κ.ά. // @description:en The script is an Enhancer for YouTube to improve your watching experience! Contains features & new layout. Introduction: 1. Optimized Video Detail Page Interface. 2. Screenshot. 3. Dark/Light Theme Switch. 4. Video Fast Forward. etc. // @description:eo La skripto estas plibonigilo por YouTube por plibonigi vian spekton. Ĝi enhavas funkciojn kaj novan aranĝon. Enkonduko: 1. Optimumigita Videodetalpa Paĝa Interfaco. 2. Ekranbildo. 3. Ŝanĝo de Malluma/Luma Temoj. 4. Rapida Antaŭenŝovo de Video. ktp. // @description:es ¡El script es un mejorador para YouTube para mejorar tu experiencia de visualización! Contiene características y un diseño nuevo. Introducción: 1. Interfaz optimizada de la página de detalles del video. 2. Captura de pantalla. 3. Cambio de tema oscuro/claro. 4. Avance rápido de video. etc. // @description:fi Skripti on parannus, joka parantaa YouTube-kokemustasi! Sisältää ominaisuuksia ja uuden ulkoasun. Johdanto: 1. Optimoitu videon yksityiskohdasivun käyttöliittymä. 2. Kuvakaappaus. 3. Tumma/vaalea teema-vaihto. 4. Videon nopea eteenpäin siirto. jne. // @description:fr Le script est un amplificateur pour améliorer votre expérience de visionnage sur YouTube ! Il contient des fonctionnalités et une nouvelle mise en page. Introduction : 1. Interface optimisée de la page de détails de la vidéo. 2. Capture d'écran. 3. Commutateur de thème sombre/claire. 4. Avance rapide de la vidéo. etc. // @description:fr-CA Le script est un amplificateur pour améliorer votre expérience de visionnage sur YouTube ! Il comprend des fonctionnalités et une nouvelle interface. Introduction : 1. Interface optimisée de la page de détails de la vidéo. 2. Capture d'écran. 3. Changement de thème sombre/clair. 4. Avance rapide de vidéo. etc. // @description:he הסקריפט הוא משפר לשיפור חווית הצפייה שלך ב-YouTube! מכיל תכונות ועיצוב חדש. הצגה: 1. ממשק מעודכן לדף פרטי וידאו. 2. צילום מסך. 3. מתחלף נושא כהה/בהיר. 4. קפיצה קדימה של וידאו. וכו'. // @description:hr Skripta je pojačivač za poboljšanje vašeg iskustva gledanja na YouTubeu! Sadrži značajke i novi izgled. Uvod: 1. Optimizirani sučelje stranice s detaljima videa. 2. Slikovni prikaz. 3. Prebacivanje između tamne/svijetle teme. 4. Brzo premotavanje videa. itd. // @description:hu A szkript egy enhancer a YouTube-élményed javítására! Tartalmaz funkciókat és új elrendezést. Bevezetés: 1. Optimalizált videó részletes oldal elrendezés. 2. Képernyőfotó. 3. Sötét/fényes téma váltás. 4. Videó gyors előretekerés. stb. // @description:id Skriptnya adalah Enhancer untuk meningkatkan pengalaman menonton YouTube Anda! Berisi fitur dan tata letak baru. Pengenalan: 1. Antarmuka Halaman Detail Video yang Dioptimalkan. 2. Tangkapan layar. 3. Tombol Switch Tema Gelap/Terang. 4. Pencarian Cepat Video. dll. // @description:it Lo script è un miglioratore per migliorare la tua esperienza di visione su YouTube! Contiene funzionalità e un nuovo layout. Introduzione: 1. Interfaccia della pagina dei dettagli video ottimizzata. 2. Screenshot. 3. Switch tra tema scuro/chiaro. 4. Avanzamento rapido del video. ecc. // @description:ja このスクリプトは、YouTubeの視聴体験を向上させるためのエンハンサーです!新しいレイアウトと機能が含まれています。紹介: 1. 最適化された動画詳細ページインターフェース。 2. スクリーンショット。 3. ダーク/ライトテーマの切り替え。 4. 動画の早送り。など。 // @description:ka ეს სკრიპტი არის YouTube-ის დამხმარე პროგრამა თქვენი ყურების გამოცდილების გასაუმჯობესებლად! შეიცავს ფუნქციებს და ახალ დიზაინს. შესავალი: 1. ოპტიმიზებული ვიდეო დეტალების გვერდის ინტერფეისი. 2. ეკრანული სურათი. 3. ბნელ/ღია თემის გადართვა. 4. ვიდეოს სწრაფი გადახვევა. და სხვ. // @description:ko 이 스크립트는 YouTube 시청 경험을 개선하는 향상기입니다! 기능과 새로운 레이아웃을 포함합니다. 소개: 1. 최적화된 비디오 세부 페이지 인터페이스. 2. 스크린샷. 3. 어두운/밝은 테마 전환. 4. 비디오 빠른 되감기. 등. // @description:nb Skriptet er en forsterker for å forbedre din YouTube-opplevelse! Inneholder funksjoner og nytt layout. Introduksjon: 1. Optimalisert videodetaljside-grensesnitt. 2. Skjermbilde. 3. Mørk/lys tema-bytte. 4. Video rask fremover. osv. // @description:nl Het script is een enhancer om je kijkervaring op YouTube te verbeteren! Bevat functies en een nieuwe lay-out. Inleiding: 1. Geoptimaliseerde interface voor videodetailpagina. 2. Screenshot. 3. Donker/licht thema wisselen. 4. Video snel vooruit spoelen. enz. // @description:pl Skrypt to wzmacniacz poprawiający twoje doświadczenie oglądania na YouTube! Zawiera funkcje i nowy układ. Wprowadzenie: 1. Optymalizowany interfejs strony szczegółów wideo. 2. Zrzut ekranu. 3. Przełącznik motywu ciemnego/jasnego. 4. Szybkie przewijanie wideo. itd. // @description:pt-BR O script é um aprimorador para melhorar sua experiência de visualização no YouTube! Contém recursos e um novo layout. Introdução: 1. Interface otimizada da página de detalhes do vídeo. 2. Captura de tela. 3. Alternância entre tema escuro/ claro. 4. Avanço rápido de vídeo. etc. // @description:ro Scriptul este un îmbunătățitor pentru a-ți îmbunătăți experiența de vizionare pe YouTube! Conține funcții și un nou design. Introducere: 1. Interfața optimizată a paginii detaliilor video. 2. Captură de ecran. 3. Schimbător de temă închis/deschis. 4. Derulare rapidă video. etc. // @description:ru Скрипт — это усилитель для улучшения вашего опыта просмотра на YouTube! Содержит функции и новый макет. Введение: 1. Оптимизированный интерфейс страницы с деталями видео. 2. Скриншот. 3. Переключатель темной/светлой темы. 4. Быстрое перематывание видео. и т. д. // @description:sv Scriptet är en förstärkare för att förbättra din tittarupplevelse på YouTube! Innehåller funktioner och en ny layout. Introduktion: 1. Optimerat video detaljsida gränssnitt. 2. Skärmdump. 3. Växla mellan mörkt/ljus tema. 4. Snabbspola video. osv. // @description:th สคริปต์นี้คือเครื่องมือเสริมเพื่อปรับปรุงประสบการณ์การดูของคุณบน YouTube! มีฟีเจอร์และเลย์เอาต์ใหม่ๆ แนะนำ: 1. อินเตอร์เฟซหน้ารายละเอียดวิดีโอที่ได้รับการปรับแต่ง. 2. ถ่ายภาพหน้าจอ. 3. สลับโหมดมืด/สว่าง. 4. การเลื่อนวิดีโออย่างรวดเร็ว. เป็นต้น. // @description:tr Bu script, YouTube izleme deneyiminizi geliştirmek için bir Enhancer'dır! Özellikler ve yeni bir tasarım içerir. Tanıtım: 1. Optimize edilmiş Video Detay Sayfası Arayüzü. 2. Ekran Görüntüsü. 3. Karanlık/Aydınlık Tema Geçişi. 4. Video Hızlı İleri Sarma. vb. // @description:uk Скрипт — це посилювач для покращення вашого досвіду перегляду на YouTube! Включає функції та новий макет. Вступ: 1. Оптимізований інтерфейс сторінки деталей відео. 2. Знімок екрана. 3. Перемикач темної/світлої теми. 4. Швидке перемотування відео. тощо. // @description:ug بۇ سكرىپت YouTube كۆرۈش تەجرىبەڭىزنى ياخشىلايدىغان كۈچەيتكۈچ! خۇسۇسىيەتلەر ۋە يېڭى تۈزۈلۈشنى ئۆز ئىچىگە ئالىدۇ. كىرۈش: 1. ۋىدىئو تەپسىلاتلىرى بەت ئىنتېرەيسىنى مۇۋاپىقلاش. 2. سكرىن رەسىمى. 3. قارا/ئاق تېما ئالماشتۇرۇش. 4. ۋىدىئونى تېز ئىلگىرى سۈرۈش. قاتارلىقلار. // @description:vi Kịch bản là một công cụ tăng cường để cải thiện trải nghiệm xem YouTube của bạn! Bao gồm các tính năng và giao diện mới. Giới thiệu: 1. Giao diện trang chi tiết video tối ưu. 2. Chụp màn hình. 3. Chuyển đổi giữa chủ đề tối/ sáng. 4. Tua nhanh video. v.v. // @namespace FunnyMonkey_NameScope // @version 2.1.5 // @author Zephyros // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAwRJREFUaEPtWUtOAzEMTQZRcQkqlnCKlpO1PRnlFLBEcAkEao0c4siTyceTDNMG6AraJPbL8z9aNf7Rjeuv/gaAp5urtToe17Oy1XX7u5f3fU5mkoGn5WKrldrkDvnJ30Gp3d3rxzYmIwgAb1wfDhul9by3HtMSYA8XF7sQI0EAz9eXDznloevu8UC3FmB/+/Z5b8Afjw+Ts2LP988dABCbjacwUS3eX4AwZE4DAM/LBYjO9gEQI9L9IiHDRbevHz2de/+Mpd+Z0XIBdLC7AGu3GL1cILDfkX/hflRxjMmRTILWBzA26hALy8UWIwWZjzOnm6s1+om7GLYeQQ1AC1jxzWgSACSXHJozw/9WZwdAKcUpJfPBm6Vbpxsz4JRSJlJZpk/PAAPAo09bAGym/AcgcGBcMq0TswN/FQPk2AiKCjHj4Cz5YX7o/XZODJCipJNjh9UzGKWoOBNn/58wIaMkwHfdzqtX+s7/ntbj2tC+DBOT+4CQ+cmW1QPAekbrR9V10W4p1kmZzi70Yd1eroGqAuAXUpNdq3dQqh8pBpBr7aYEk6qKywB44S+kbKxvdQMBYZPuF4a+rCIA2W4r0u6hcL/EljIVM6M6AHa8ogFWJmQyh446rq08x5pgrDWtAuAnJolSEgZ4UnMyIsOBMgC2300B4KUC0W/KauryMGnZRNfrIdgEhCsXc+STAsD8YeK815mhUmSWro46NwZcZ8aKuh5TVuEmAZjphJ1e8IFAaFpxMhNKMcBDa5MA/GGVyR9N+sDhsKEh7ux5gMIoKkC2y8NoyoSCPhAZspX5gDejDyWnUFfVywOskUnZOW9HQ6V1EYBBi2jfDzCuUxFnQAGskAETUQBWbtyOpoE9BDZtdg2VHrTP4GNvAGW1UGy2nyjWpMXZ2HWxPjk53EUh0Y2Zp56xCqbWp94YkuN1Xv6GBEiKt1ogKeVFDxyGhdwTk50mkF3XKG1qIPqk3uSkT0wuibT8yOeXzTU3XLs3Z7ail/pmH7prb2+O/SIG5lCkVEbzAL4A07+gbQ8x85sAAAAASUVORK5CYII= // @match *://*/* // @include https://www.youtube.com // @include *://*.youtube.com/** // @exclude *://accounts.youtube.com/* // @exclude *://www.youtube.com/live_chat_replay* // @exclude *://www.youtube.com/persist_identity* // @exclude *://www.lazada.com/* // @exclude *://shopee.com/* // @connect oversea.mimixiaoke.com // @connect jtmate.com // @noframes // @license MIT // @run-at document-start // @antifeature referral-link // @grant GM_registerMenuCommand // @grant GM_openInTab // @grant GM.openInTab // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @grant GM_xmlhttpRequest // @grant unsafeWindow // @grant GM_download // @grant GM_setClipboard // ==/UserScript== (function () { 'use strict'; /*! * Copyright (c) 2024 - 2025, Zephyros,FunnyMonkey. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ var css_248z$1 = "@keyframes relatedElementProvided{0%{background-position-x:3px}to{background-position-x:4px}}html[tabview-loaded=icp] #related.ytd-watch-flexy{animation:relatedElementProvided 1ms linear 0s 1 normal forwards}html[tabview-loaded=icp] #right-tabs #related.ytd-watch-flexy,html[tabview-loaded=icp] #right-tabs ytd-expander#expander,html[tabview-loaded=icp] [hidden] #related.ytd-watch-flexy,html[tabview-loaded=icp] [hidden] ytd-expander#expander,html[tabview-loaded=icp] ytd-comments ytd-expander#expander{animation:initial}#secondary.ytd-watch-flexy{position:relative}#secondary-inner.style-scope.ytd-watch-flexy{height:100%}secondary-wrapper{border:0;box-sizing:border-box;contain:strict;flex-wrap:nowrap;height:100%;left:0;max-height:calc(100vh - var(--ytd-toolbar-height, 56px));padding:0;padding-bottom:var(--ytd-margin-6x);padding-right:var(--ytd-margin-6x);padding-top:var(--ytd-margin-6x);position:absolute;right:0;top:0}#right-tabs,secondary-wrapper{display:flex;flex-direction:column;margin:0}#right-tabs{flex-grow:1;padding:0;position:relative}[tyt-tab=\"\"] #right-tabs{flex-grow:0}[tyt-tab=\"\"] #right-tabs .tab-content{border:0}#right-tabs .tab-content{flex-grow:1}ytd-watch-flexy[hide-default-text-inline-expander] #primary.style-scope.ytd-watch-flexy ytd-text-inline-expander{display:none}ytd-watch-flexy:not([keep-comments-scroller]) #tab-comments.tab-content-hidden{--comment-pre-load-sizing:90px;border:0;contain:strict;display:block!important;height:var(--comment-pre-load-sizing)!important;left:2px;margin:0;overflow:hidden;padding:0;pointer-events:none!important;position:fixed!important;top:2px;visibility:collapse;width:var(--comment-pre-load-sizing)!important;z-index:-1}ytd-watch-flexy:not([keep-comments-scroller]) #tab-comments.tab-content-hidden ytd-comments#comments>*{display:none!important}ytd-watch-flexy:not([keep-comments-scroller]) #tab-comments.tab-content-hidden ytd-comments#comments>ytd-item-section-renderer#sections{border:0;contain:strict;display:block!important;height:var(--comment-pre-load-sizing);margin:0;overflow:hidden;padding:0;width:var(--comment-pre-load-sizing)}ytd-watch-flexy:not([keep-comments-scroller]) #tab-comments.tab-content-hidden ytd-comments#comments>ytd-item-section-renderer#sections>*{display:none!important}ytd-watch-flexy:not([keep-comments-scroller]) #tab-comments.tab-content-hidden ytd-comments#comments>ytd-item-section-renderer#sections>#contents{border:0;contain:strict;display:flex!important;flex-direction:row;gap:60px;height:var(--comment-pre-load-sizing);margin:0;overflow:hidden;padding:0;width:var(--comment-pre-load-sizing)}ytd-watch-flexy:not([keep-comments-scroller]) #tab-comments.tab-content-hidden ytd-comments#comments>ytd-item-section-renderer#sections>#contents>*{border:0;box-sizing:content-box;contain:strict;display:block!important;height:var(--comment-pre-load-sizing);margin:calc(var(--comment-pre-load-sizing)*2)!important;overflow:hidden;padding:0;visibility:collapse!important;width:var(--comment-pre-load-sizing)}ytd-watch-flexy:not([keep-comments-scroller]) #tab-comments.tab-content-hidden ytd-comments#comments>ytd-item-section-renderer#sections>#contents>:empty{box-sizing:content-box;contain:strict;display:none!important;height:0;margin:0!important;overflow:hidden;visibility:collapse!important;width:0}ytd-watch-flexy:not([keep-comments-scroller]) #tab-comments.tab-content-hidden ytd-comments#comments>ytd-item-section-renderer#sections>#contents>ytd-continuation-item-renderer{box-sizing:initial;contain:strict;display:block!important;height:1px;margin:0!important;overflow:initial;visibility:collapse!important;width:1px}ytd-watch-flexy:not([keep-comments-scroller]) #tab-comments.tab-content-hidden ytd-comments#comments>ytd-item-section-renderer#sections>#contents>*>*{box-sizing:content-box;contain:strict;display:none!important;height:0;margin:0!important;overflow:hidden;visibility:collapse!important;width:0}#right-tabs #material-tabs{border:1px solid var(--ytd-searchbox-legacy-border-color);display:flex;overflow:hidden;padding:0;position:relative}[tyt-tab] #right-tabs #material-tabs{border-radius:var(--tyt-rounded-a1) var(--tyt-rounded-a1) var(--tyt-rounded-a1) var(--tyt-rounded-a1)}[tyt-tab^=\"#\"] #right-tabs #material-tabs{border-radius:var(--tyt-rounded-a1) var(--tyt-rounded-a1) 0 0}ytd-watch-flexy[flexy]:not([is-two-columns_]) #right-tabs #material-tabs{outline:0}#right-tabs #material-tabs a.tab-btn[tyt-tab-content]>*{pointer-events:none}#right-tabs #material-tabs a.tab-btn[tyt-tab-content]>.font-size-right{display:none;pointer-events:auto}ytd-watch-flexy #right-tabs .tab-content{border:1px solid var(--ytd-searchbox-legacy-border-color);border-radius:0 0 var(--tyt-rounded-a1) var(--tyt-rounded-a1);border-top:0;box-sizing:border-box;display:block;display:flex;flex-direction:row;overflow:hidden;padding:0;position:relative;top:0}ytd-watch-flexy:not([is-two-columns_]) #right-tabs .tab-content{height:100%}ytd-watch-flexy #right-tabs .tab-content-cld{--tab-content-padding:var(--ytd-margin-4x);box-sizing:border-box;contain:layout paint;display:block;overflow:auto;padding:var(--tab-content-padding);position:relative;width:100%}#right-tabs,.tab-content,.tab-content-cld{animation:none;transition:none}ytd-watch-flexy[is-two-columns_] #right-tabs .tab-content-cld{contain:size layout paint style;height:100%;position:absolute;width:100%}ytd-watch-flexy #right-tabs .tab-content-cld.tab-content-hidden{contain:size layout paint style;display:none;width:100%}@supports (color:var(--tabview-tab-btn-define )){ytd-watch-flexy #right-tabs .tab-btn{background:var(--yt-spec-general-background-a)}html{--tyt-tab-btn-flex-grow:1;--tyt-tab-btn-flex-basis:0%;--tyt-tab-bar-color-1-def:#ff4533;--tyt-tab-bar-color-2-def:var(--yt-brand-light-red);--tyt-tab-bar-color-1:var(--main-color,var(--tyt-tab-bar-color-1-def));--tyt-tab-bar-color-2:var(--main-color,var(--tyt-tab-bar-color-2-def))}ytd-watch-flexy #right-tabs .tab-btn[tyt-tab-content]{--tyt-tab-btn-color:var(--yt-spec-text-secondary);background-color:var(--ytd-searchbox-legacy-button-color);border:0;border-bottom:4px solid transparent;color:var(--tyt-tab-btn-color);cursor:pointer;display:inline-block;flex-basis:0%;flex-basis:var(--tyt-tab-btn-flex-basis);flex-grow:1;flex-grow:var(--tyt-tab-btn-flex-grow);flex-shrink:1;font-size:12px;font-weight:500;line-height:18px;overflow:hidden;padding:14px 8px 10px;position:relative;text-align:center;text-decoration:none;text-overflow:clip;text-transform:uppercase;text-transform:var(--yt-button-text-transform,inherit);transition:border .2s linear .1s;white-space:nowrap}ytd-watch-flexy #right-tabs .tab-btn[tyt-tab-content]>svg{fill:var(--iron-icon-fill-color,currentcolor);stroke:var(--iron-icon-stroke-color,none);color:var(--yt-button-color,inherit);height:18px;margin-right:0;opacity:.5;padding-right:0;vertical-align:bottom}ytd-watch-flexy #right-tabs .tab-btn{--tabview-btn-txt-ml:8px}ytd-watch-flexy[tyt-comment-disabled] #right-tabs .tab-btn[tyt-tab-content=\"#tab-comments\"]{--tabview-btn-txt-ml:0px}ytd-watch-flexy #right-tabs .tab-btn[tyt-tab-content]>svg+span{margin-left:var(--tabview-btn-txt-ml)}ytd-watch-flexy #right-tabs .tab-btn[tyt-tab-content] svg{pointer-events:none}ytd-watch-flexy #right-tabs .tab-btn[tyt-tab-content].active{--tyt-tab-btn-color:var(--yt-spec-text-primary);background-color:var(--ytd-searchbox-legacy-button-focus-color);border-bottom-color:var(--tyt-tab-bar-color-1);border-bottom:2px solid var(--tyt-tab-bar-color-2);font-weight:500;outline:0}ytd-watch-flexy #right-tabs .tab-btn[tyt-tab-content].active svg{opacity:.9}ytd-watch-flexy #right-tabs .tab-btn[tyt-tab-content]:not(.active):hover{--tyt-tab-btn-color:var(--yt-spec-text-primary);background-color:var(--ytd-searchbox-legacy-button-hover-color)}ytd-watch-flexy #right-tabs .tab-btn[tyt-tab-content]:not(.active):hover svg{opacity:.9}ytd-watch-flexy #right-tabs .tab-btn[tyt-tab-content]{user-select:none!important}ytd-watch-flexy #right-tabs .tab-btn[tyt-tab-content].tab-btn-hidden{display:none}ytd-watch-flexy[tyt-comment-disabled] #right-tabs .tab-btn[tyt-tab-content=\"#tab-comments\"],ytd-watch-flexy[tyt-comment-disabled] #right-tabs .tab-btn[tyt-tab-content=\"#tab-comments\"]:hover{--tyt-tab-btn-color:var(--yt-spec-icon-disabled)}ytd-watch-flexy[tyt-comment-disabled] #right-tabs .tab-btn[tyt-tab-content=\"#tab-comments\"] span#tyt-cm-count:empty{display:none}ytd-watch-flexy #right-tabs .tab-btn span#tyt-cm-count:empty:after{color:currentColor;display:inline-block;font-size:inherit;text-align:left;transform:scaleX(.8);width:4em}}@supports (color:var(--tyt-cm-count-define )){ytd-watch-flexy{--tyt-x-loading-content-letter-spacing:2px}html{--tabview-text-loading:\"Loading\";--tabview-text-fetching:\"Fetching\";--tabview-panel-loading:var(--tabview-text-loading)}html:lang(ja){--tabview-text-loading:\"読み込み中\";--tabview-text-fetching:\"フェッチ..\"}html:lang(ko){--tabview-text-loading:\"로딩..\";--tabview-text-fetching:\"가져오기..\"}html:lang(zh-Hant){--tabview-text-loading:\"載入中\";--tabview-text-fetching:\"擷取中\"}html:lang(zh-Hans){--tabview-text-loading:\"加载中\";--tabview-text-fetching:\"抓取中\"}html:lang(ru){--tabview-text-loading:\"Загрузка\";--tabview-text-fetching:\"Получение\"}ytd-watch-flexy #right-tabs .tab-btn span#tyt-cm-count:empty:after{content:var(--tabview-text-loading);letter-spacing:var(--tyt-x-loading-content-letter-spacing)}}@supports (color:var(--tabview-font-size-btn-define )){.font-size-right{align-content:space-evenly;bottom:0;display:inline-flex;flex-direction:column;justify-content:space-evenly;padding:4px 0;pointer-events:none;position:absolute;right:0;top:0;width:16px}html body ytd-watch-flexy.style-scope .font-size-btn{user-select:none!important}.font-size-btn{--tyt-font-size-btn-display:none;background-color:var(--yt-spec-badge-chip-background);box-sizing:border-box;color:var(--yt-spec-text-secondary);cursor:pointer;display:var(--tyt-font-size-btn-display,none);font-family:Menlo,Lucida Console,Monaco,Consolas,monospace;font-weight:900;height:12px;line-height:100%;margin:0;padding:0;pointer-events:all;position:relative;transform-origin:left top;transition:background-color 90ms linear,color 90ms linear;width:12px}.font-size-btn:hover{background-color:var(--yt-spec-text-primary);color:var(--yt-spec-general-background-a)}@supports (zoom:0.5){.tab-btn .font-size-btn{--tyt-font-size-btn-display:none}.tab-btn.active:hover .font-size-btn{--tyt-font-size-btn-display:inline-block}}}body ytd-watch-flexy:not([is-two-columns_]) #columns.ytd-watch-flexy{flex-direction:column}body ytd-watch-flexy:not([is-two-columns_]) #secondary.ytd-watch-flexy{box-sizing:border-box;display:block;width:100%}body ytd-watch-flexy:not([is-two-columns_]) #secondary.ytd-watch-flexy secondary-wrapper{contain:content;height:auto;padding-left:var(--ytd-margin-6x)}body ytd-watch-flexy:not([is-two-columns_]) #secondary.ytd-watch-flexy secondary-wrapper #right-tabs{overflow:auto}[tyt-chat=\"+\"] secondary-wrapper>[tyt-chat-container]{display:flex;flex-direction:column;flex-grow:1;flex-shrink:0}[tyt-chat=\"+\"] secondary-wrapper>[tyt-chat-container]>#chat{flex-grow:1}ytd-watch-flexy[is-two-columns_]:not([theater]) #columns.style-scope.ytd-watch-flexy{min-height:calc(100vh - var(--ytd-toolbar-height, 56px))}ytd-watch-flexy[is-two-columns_] ytd-live-chat-frame#chat{height:auto!important;min-height:auto!important}ytd-watch-flexy[tyt-tab^=\"#\"]:not([is-two-columns_]):not([tyt-chat=\"+\"]) #right-tabs{min-height:var(--ytd-watch-flexy-chat-max-height)}body ytd-watch-flexy:not([is-two-columns_]) #chat.ytd-watch-flexy{margin-top:0}body ytd-watch-flexy:not([is-two-columns_]) ytd-watch-metadata.ytd-watch-flexy{margin-bottom:0}ytd-watch-metadata.ytd-watch-flexy ytd-metadata-row-container-renderer{display:none}#tab-info [show-expand-button] #expand-sizer.ytd-text-inline-expander{visibility:initial}#tab-info #social-links.style-scope.ytd-video-description-infocards-section-renderer>#left-arrow-container.ytd-video-description-infocards-section-renderer>#left-arrow,#tab-info #social-links.style-scope.ytd-video-description-infocards-section-renderer>#right-arrow-container.ytd-video-description-infocards-section-renderer>#right-arrow{border:6px solid transparent;opacity:.65}#tab-info #social-links.style-scope.ytd-video-description-infocards-section-renderer>#left-arrow-container.ytd-video-description-infocards-section-renderer>#left-arrow:hover,#tab-info #social-links.style-scope.ytd-video-description-infocards-section-renderer>#right-arrow-container.ytd-video-description-infocards-section-renderer>#right-arrow:hover{opacity:1}#tab-info #social-links.style-scope.ytd-video-description-infocards-section-renderer>div#left-arrow-container:before{background:transparent;content:\"\";display:block;height:40px;left:-20px;position:absolute;top:0;width:40px;z-index:-1}#tab-info #social-links.style-scope.ytd-video-description-infocards-section-renderer>div#right-arrow-container:before{background:transparent;content:\"\";display:block;height:40px;position:absolute;right:-20px;top:0;width:40px;z-index:-1}body ytd-watch-flexy[is-two-columns_][tyt-egm-panel_] #columns.style-scope.ytd-watch-flexy #panels.style-scope.ytd-watch-flexy{display:flex;flex-direction:column;flex-grow:1;flex-shrink:0}body ytd-watch-flexy[is-two-columns_][tyt-egm-panel_] #columns.style-scope.ytd-watch-flexy #panels.style-scope.ytd-watch-flexy ytd-engagement-panel-section-list-renderer[target-id][visibility=ENGAGEMENT_PANEL_VISIBILITY_EXPANDED]{display:flex;flex-direction:column;flex-grow:1;flex-shrink:0;height:auto;max-height:none;min-height:auto}secondary-wrapper [visibility=ENGAGEMENT_PANEL_VISIBILITY_EXPANDED] #body.ytd-transcript-renderer:not(:empty),secondary-wrapper [visibility=ENGAGEMENT_PANEL_VISIBILITY_EXPANDED] #content.ytd-transcript-renderer:not(:empty),secondary-wrapper [visibility=ENGAGEMENT_PANEL_VISIBILITY_EXPANDED] ytd-transcript-renderer:not(:empty){flex-grow:1;height:auto;max-height:none;min-height:auto}secondary-wrapper #content.ytd-engagement-panel-section-list-renderer{position:relative}secondary-wrapper #content.ytd-engagement-panel-section-list-renderer>[panel-target-id]:only-child{contain:style size}secondary-wrapper #content.ytd-engagement-panel-section-list-renderer ytd-transcript-segment-list-renderer.ytd-transcript-search-panel-renderer{contain:strict;flex-grow:1}secondary-wrapper #content.ytd-engagement-panel-section-list-renderer ytd-transcript-segment-renderer.style-scope.ytd-transcript-segment-list-renderer,secondary-wrapper #content.ytd-engagement-panel-section-list-renderer ytd-transcript-segment-renderer.style-scope.ytd-transcript-segment-list-renderer>.segment{contain:layout paint style}body ytd-watch-flexy[theater] #secondary.ytd-watch-flexy{margin-top:var(--ytd-margin-3x);padding-top:0}body ytd-watch-flexy[theater] secondary-wrapper{margin-top:0;padding-top:0}body ytd-watch-flexy[theater] #chat.ytd-watch-flexy{margin-bottom:var(--ytd-margin-2x)}#tab-comments ytd-comments#comments [field-of-cm-count]{margin-top:0}#tab-info>ytd-expandable-video-description-body-renderer{margin-bottom:var(--ytd-margin-3x)}#tab-info [class]:last-child{margin-bottom:0;padding-bottom:0}#tab-info ytd-rich-metadata-row-renderer ytd-rich-metadata-renderer{max-width:none}ytd-watch-flexy[is-two-columns_] secondary-wrapper #chat.ytd-watch-flexy{margin-bottom:var(--ytd-margin-3x)}ytd-watch-flexy[tyt-tab] tp-yt-paper-tooltip{contain:content;white-space:nowrap}ytd-watch-info-text tp-yt-paper-tooltip.style-scope.ytd-watch-info-text{margin-bottom:-300px;margin-top:-96px}[hide-default-text-inline-expander] #bottom-row #description.ytd-watch-metadata{font-size:1.2rem;line-height:1.8rem}[hide-default-text-inline-expander] #bottom-row #description.ytd-watch-metadata yt-animated-rolling-number{font-size:inherit}[hide-default-text-inline-expander] #bottom-row #description.ytd-watch-metadata #info-container.style-scope.ytd-watch-info-text{align-items:center}ytd-watch-flexy[hide-default-text-inline-expander]{--tyt-bottom-watch-metadata-margin:6px}[hide-default-text-inline-expander] #bottom-row #description.ytd-watch-metadata>#description-inner.ytd-watch-metadata{margin:6px 12px}[hide-default-text-inline-expander] ytd-watch-metadata[title-headline-xs] h1.ytd-watch-metadata{font-size:1.8rem}ytd-watch-flexy[is-two-columns_][hide-default-text-inline-expander] #below.style-scope.ytd-watch-flexy ytd-merch-shelf-renderer{border:0;margin:0;padding:0}ytd-watch-flexy[is-two-columns_][hide-default-text-inline-expander] #below.style-scope.ytd-watch-flexy ytd-watch-metadata.ytd-watch-flexy{margin-bottom:6px}#tab-info yt-video-attribute-view-model .yt-video-attribute-view-model--horizontal .yt-video-attribute-view-model__link-container .yt-video-attribute-view-model__hero-section{flex-shrink:0}#tab-info yt-video-attribute-view-model .yt-video-attribute-view-model__overflow-menu{background:var(--yt-emoji-picker-category-background-color);border-radius:99px}#tab-info yt-video-attribute-view-model .yt-video-attribute-view-model--image-square.yt-video-attribute-view-model--image-large .yt-video-attribute-view-model__hero-section{max-height:128px}#tab-info yt-video-attribute-view-model .yt-video-attribute-view-model--image-large .yt-video-attribute-view-model__hero-section{max-width:128px}#tab-info ytd-reel-shelf-renderer #items.yt-horizontal-list-renderer ytd-reel-item-renderer.yt-horizontal-list-renderer{max-width:142px}ytd-watch-info-text#ytd-watch-info-text.style-scope.ytd-watch-metadata #date-text.style-scope.ytd-watch-info-text,ytd-watch-info-text#ytd-watch-info-text.style-scope.ytd-watch-metadata #view-count.style-scope.ytd-watch-info-text{align-items:center}ytd-watch-info-text:not([detailed]) #info.ytd-watch-info-text a.yt-simple-endpoint.yt-formatted-string{pointer-events:none}body ytd-app>ytd-popup-container>tp-yt-iron-dropdown>#contentWrapper>[slot=dropdown-content]{backdrop-filter:none}#tab-info [tyt-clone-refresh-count]{overflow:visible!important}#tab-info #items.ytd-horizontal-card-list-renderer yt-video-attribute-view-model.ytd-horizontal-card-list-renderer{contain:layout}#tab-info #thumbnail-container.ytd-structured-description-channel-lockup-renderer,#tab-info ytd-media-lockup-renderer[is-compact] #thumbnail-container.ytd-media-lockup-renderer{flex-shrink:0}secondary-wrapper ytd-donation-unavailable-renderer{--ytd-margin-6x:var(--ytd-margin-2x);--ytd-margin-5x:var(--ytd-margin-2x);--ytd-margin-4x:var(--ytd-margin-2x);--ytd-margin-3x:var(--ytd-margin-2x)}[tyt-no-less-btn] #less{display:none}.tyt-metadata-hover-resized #analytics-button,.tyt-metadata-hover-resized #purchase-button,.tyt-metadata-hover-resized #sponsor-button,.tyt-metadata-hover-resized #subscribe-button{display:none!important}.tyt-metadata-hover #upload-info{flex-basis:100vw;flex-shrink:0;max-width:max-content;min-width:max-content}#tab-info ytd-structured-description-playlist-lockup-renderer[collections] #playlist-thumbnail.style-scope.ytd-structured-description-playlist-lockup-renderer{max-width:100%}#tab-info ytd-structured-description-playlist-lockup-renderer[collections] #lockup-container.ytd-structured-description-playlist-lockup-renderer{padding:1px}#tab-info ytd-structured-description-playlist-lockup-renderer[collections] #thumbnail.ytd-structured-description-playlist-lockup-renderer{outline:1px solid hsla(0,0%,50%,.5)}ytd-live-chat-frame#chat[collapsed] ytd-message-renderer~#show-hide-button.ytd-live-chat-frame>ytd-toggle-button-renderer.ytd-live-chat-frame{padding:0}.tyt-info-invisible{display:none}[tyt-playlist-expanded] secondary-wrapper>ytd-playlist-panel-renderer#playlist{flex-grow:1;flex-shrink:1;max-height:unset!important;overflow:auto}[tyt-playlist-expanded] secondary-wrapper>ytd-playlist-panel-renderer#playlist>#container{max-height:unset!important}secondary-wrapper ytd-playlist-panel-renderer{--ytd-margin-6x:var(--ytd-margin-3x)}ytd-watch-flexy[theater] ytd-playlist-panel-renderer[collapsible][collapsed] .header.ytd-playlist-panel-renderer{padding:6px 8px}ytd-watch-flexy[theater] #playlist.ytd-watch-flexy{margin-bottom:var(--ytd-margin-2x)}ytd-watch-flexy[theater] #right-tabs .tab-btn[tyt-tab-content]{border-bottom:0 solid transparent;padding:8px 4px 6px}ytd-watch-flexy{--tyt-bottom-watch-metadata-margin:12px}ytd-watch-flexy[rounded-info-panel],ytd-watch-flexy[rounded-player-large]{--tyt-rounded-a1:${VAL_ROUNDED_A1}px}#bottom-row.style-scope.ytd-watch-metadata .item.ytd-watch-metadata{margin-right:var(--tyt-bottom-watch-metadata-margin,12px);margin-top:var(--tyt-bottom-watch-metadata-margin,12px)}#cinematics{contain:layout style size}"; const VAL_ROUNDED_A1 = 12; const styles = { main: css_248z$1.replace("${VAL_ROUNDED_A1}", VAL_ROUNDED_A1) }; const StorageUtil = { keys: { youtube: { videoPlaySpeed: "yt/videoPlaySpeed", functionState: "yt/functionState_01", videoLoop: "py/videoLoop", theme: "yt/theme", downloadingConfirm: "yt/downloadingConfirm" } }, getDefaultFunctionState: function() { return { isOpenCommentTable: true, isOpenThemeProgressBar: true, isOpenSpeedControl: true, isOpenMarkOrRemoveAd: true, isOpenYoutubedownloading: true }; }, getValue: function(key, defaultValue) { return GM_getValue(key, defaultValue); }, setValue: function(key, value) { GM_setValue(key, value); } }; /*! * table function * MIT, https://github.com/tabview-youtube/Tabview-Youtube * @param {*} communicationKey * Optimize project structure to make it more reliable */ const executionScript = (communicationKey) => { const DEBUG_5084 = false; if (typeof trustedTypes !== "undefined" && trustedTypes.defaultPolicy === null) { let s = (s2) => s2; trustedTypes.createPolicy("default", { createHTML: s, createScriptURL: s, createScript: s }); } const defaultPolicy = typeof trustedTypes !== "undefined" && trustedTypes.defaultPolicy || { createHTML: (s) => s }; function createHTML(s) { return defaultPolicy.createHTML(s); } let trustHTMLErr = null; try { document.createElement("div").innerHTML = createHTML("1"); } catch (e) { trustHTMLErr = e; } if (trustHTMLErr) { trustHTMLErr(); } try { let getWord = function(tag) { return langWords[pageLang][tag] || langWords["en"][tag] || ""; }, getTabsHTML = function() { const sTabBtnVideos = `${svgElm(16, 16, 90, 90, svgVideos)}<span>${getWord("videos")}</span>`; const sTabBtnInfo = `${svgElm(16, 16, 60, 60, svgInfo)}<span>${getWord("info")}</span>`; const sTabBtnPlayList = `${svgElm(16, 16, 20, 20, svgPlayList)}<span>${getWord("playlist")}</span>`; let str1 = ` <paper-ripple class="style-scope yt-icon-button"> <div id="background" class="style-scope paper-ripple" style="opacity:0;"></div> <div id="waves" class="style-scope paper-ripple"></div> </paper-ripple> `; let str_fbtns = ` <div class="font-size-right"> <div class="font-size-btn font-size-plus" tyt-di="8rdLQ"> <svg width="12" height="12" viewbox="0 0 50 50" preserveAspectRatio="xMidYMid meet" stroke="currentColor" stroke-width="6" stroke-linecap="round" vector-effect="non-scaling-size"> <path d="M12 25H38M25 12V38"/> </svg> </div><div class="font-size-btn font-size-minus" tyt-di="8rdLQ"> <svg width="12" height="12" viewbox="0 0 50 50" preserveAspectRatio="xMidYMid meet" stroke="currentColor" stroke-width="6" stroke-linecap="round" vector-effect="non-scaling-size"> <path d="M12 25h26"/> </svg> </div> </div> `.replace(/[\r\n]+/g, ""); const str_tabs = [ `<a id="tab-btn1" tyt-di="q9Kjc" tyt-tab-content="#tab-info" class="tab-btn${(hiddenTabsByUserCSS & 1) === 1 ? " tab-btn-hidden" : ""}">${sTabBtnInfo}${str1}${str_fbtns}</a>`, `<a id="tab-btn3" tyt-di="q9Kjc" tyt-tab-content="#tab-comments" class="tab-btn${(hiddenTabsByUserCSS & 2) === 2 ? " tab-btn-hidden" : ""}">${svgElm(16, 16, 120, 120, svgComments)}<span id="tyt-cm-count"></span>${str1}${str_fbtns}</a>`, `<a id="tab-btn4" tyt-di="q9Kjc" tyt-tab-content="#tab-videos" class="tab-btn${(hiddenTabsByUserCSS & 4) === 4 ? " tab-btn-hidden" : ""}">${sTabBtnVideos}${str1}${str_fbtns}</a>`, `<a id="tab-btn5" tyt-di="q9Kjc" tyt-tab-content="#tab-list" class="tab-btn tab-btn-hidden">${sTabBtnPlayList}${str1}${str_fbtns}</a>` ].join(""); let addHTML = ` <div id="right-tabs"> <tabview-view-pos-thead></tabview-view-pos-thead> <header> <div id="material-tabs"> ${str_tabs} </div> </header> <div class="tab-content"> <div id="tab-info" class="tab-content-cld tab-content-hidden" tyt-hidden userscript-scrollbar-render></div> <div id="tab-comments" class="tab-content-cld tab-content-hidden" tyt-hidden userscript-scrollbar-render></div> <div id="tab-videos" class="tab-content-cld tab-content-hidden" tyt-hidden userscript-scrollbar-render></div> <div id="tab-list" class="tab-content-cld tab-content-hidden" tyt-hidden userscript-scrollbar-render></div> </div> </div> `; return addHTML; }, getLang = function() { let lang = "en"; let htmlLang = ((document || 0).documentElement || 0).lang || ""; switch (htmlLang) { case "en": case "en-GB": lang = "en"; break; case "de": case "de-DE": lang = "du"; break; case "fr": case "fr-CA": case "fr-FR": lang = "fr"; break; case "zh-Hant": case "zh-Hant-HK": case "zh-Hant-TW": lang = "tw"; break; case "zh-Hans": case "zh-Hans-CN": lang = "cn"; break; case "ja": case "ja-JP": lang = "jp"; break; case "ko": case "ko-KR": lang = "kr"; break; case "ru": case "ru-RU": lang = "ru"; break; default: lang = "en"; } return lang; }, getLangForPage = function() { let lang = getLang(); if (langWords[lang]) pageLang = lang; else pageLang = "en"; }, isTheater = function() { const ytdFlexyElm = elements.flexy; return ytdFlexyElm && ytdFlexyElm.hasAttribute000("theater"); }, ytBtnSetTheater = function() { if (!isTheater()) { const sizeBtn = document.querySelector("ytd-watch-flexy #ytd-player button.ytp-size-button"); if (sizeBtn) sizeBtn.click(); } }, ytBtnCancelTheater = function() { if (isTheater()) { const sizeBtn = document.querySelector("ytd-watch-flexy #ytd-player button.ytp-size-button"); if (sizeBtn) sizeBtn.click(); } }, ytBtnExpandChat = function() { let button = document.querySelector("ytd-live-chat-frame#chat[collapsed] > .ytd-live-chat-frame#show-hide-button"); if (button) { button = button.querySelector000("div.yt-spec-touch-feedback-shape") || button.querySelector000("ytd-toggle-button-renderer"); if (button) button.click(); } }, ytBtnCollapseChat = function() { let button = document.querySelector("ytd-live-chat-frame#chat:not([collapsed]) > .ytd-live-chat-frame#show-hide-button"); if (button) { button = button.querySelector000("div.yt-spec-touch-feedback-shape") || button.querySelector000("ytd-toggle-button-renderer"); if (button) button.click(); } }, ytBtnEgmPanelCore = function(arr) { if (!arr) return; if (!("length" in arr)) arr = [arr]; const ytdFlexyElm = elements.flexy; if (!ytdFlexyElm) return; let actions = []; for (const entry of arr) { if (!entry) continue; let panelId = entry.panelId; let toHide = entry.toHide; let toShow = entry.toShow; if (toHide === true && !toShow) { actions.push({ "changeEngagementPanelVisibilityAction": { "targetId": panelId, "visibility": "ENGAGEMENT_PANEL_VISIBILITY_HIDDEN" } }); } else if (toShow === true && !toHide) { actions.push({ "showEngagementPanelEndpoint": { "panelIdentifier": panelId } }); } if (actions.length > 0) { const cnt = insp(ytdFlexyElm); cnt.resolveCommand( { "signalServiceEndpoint": { "signal": "CLIENT_SIGNAL", "actions": actions } }, {}, false ); } actions = null; } }, ytBtnCloseEngagementPanels = function() { const actions = []; for (const panelElm of document.querySelectorAll( `ytd-watch-flexy[flexy][tyt-tab] #panels.ytd-watch-flexy ytd-engagement-panel-section-list-renderer[target-id][visibility]:not([hidden])` )) { if (panelElm.getAttribute("visibility") == "ENGAGEMENT_PANEL_VISIBILITY_EXPANDED" && !panelElm.closest("[hidden]")) { actions.push({ panelId: panelElm.getAttribute000("target-id"), toHide: true }); } } ytBtnEgmPanelCore(actions); }, ytBtnOpenPlaylist = function() { const cnt = insp(elements.playlist); if (cnt && typeof cnt.collapsed === "boolean") { cnt.collapsed = false; } }, ytBtnClosePlaylist = function() { const cnt = insp(elements.playlist); if (cnt && typeof cnt.collapsed === "boolean") { cnt.collapsed = true; } }; let executionFinished = 0; if (typeof CustomElementRegistry === "undefined") return; if (CustomElementRegistry.prototype.define000) return; if (typeof CustomElementRegistry.prototype.define !== "function") return; const HTMLElement_ = HTMLElement.prototype.constructor; const qsOne = (elm, selector) => { return HTMLElement_.prototype.querySelector.call(elm, selector); }; const qsAll = (elm, selector) => { return HTMLElement_.prototype.querySelectorAll.call(elm, selector); }; const pdsBaseDF = Object.getOwnPropertyDescriptors(DocumentFragment.prototype); Object.defineProperties(DocumentFragment.prototype, { replaceChildren000: pdsBaseDF.replaceChildren }); const pdsBaseNode = Object.getOwnPropertyDescriptors(Node.prototype); Object.defineProperties(Node.prototype, { appendChild000: pdsBaseNode.appendChild, insertBefore000: pdsBaseNode.insertBefore }); const pdsBaseElement = Object.getOwnPropertyDescriptors(Element.prototype); Object.defineProperties(Element.prototype, { setAttribute000: pdsBaseElement.setAttribute, getAttribute000: pdsBaseElement.getAttribute, hasAttribute000: pdsBaseElement.hasAttribute, removeAttribute000: pdsBaseElement.removeAttribute, querySelector000: pdsBaseElement.querySelector, replaceChildren000: pdsBaseElement.replaceChildren }); Element.prototype.setAttribute111 = function(p, v) { v = `${v}`; if (this.getAttribute000(p) === v) return; this.setAttribute000(p, v); }; Element.prototype.incAttribute111 = function(p) { let v = +this.getAttribute000(p) || 0; v = v > 1e9 ? v + 1 : 9; this.setAttribute000(p, `${v}`); return v; }; Element.prototype.assignChildren111 = function(previousSiblings, node, nextSiblings) { let nodeList = []; for (let t = this.firstChild; t instanceof Node; t = t.nextSibling) { if (t === node) continue; nodeList.push(t); } inPageRearrange = true; if (node.parentNode === this) { let fm = new DocumentFragment(); if (nodeList.length > 0) { fm.replaceChildren000(...nodeList); } if (previousSiblings && previousSiblings.length > 0) { fm.replaceChildren000(...previousSiblings); this.insertBefore000(fm, node); } if (nextSiblings && nextSiblings.length > 0) { fm.replaceChildren000(...nextSiblings); this.appendChild000(fm); } fm.replaceChildren000(); fm = null; } else { if (!previousSiblings) previousSiblings = []; if (!nextSiblings) nextSiblings = []; this.replaceChildren000(...previousSiblings, node, ...nextSiblings); } inPageRearrange = false; if (nodeList.length > 0) { for (const t of nodeList) { if (t instanceof Element && t.isConnected === false) t.remove(); } } nodeList.length = 0; nodeList = null; }; const DISABLE_FLAGS_SHADYDOM_FREE = true; (() => { let e = "undefined" != typeof unsafeWindow ? unsafeWindow : void 0 instanceof Window ? void 0 : window; if (!e._ytConfigHacks) { let r = function(t2) { o(), t2 && e.removeEventListener("DOMContentLoaded", r, false); }; let t = 4; class n extends Set { add(e2) { if (t <= 0) return void 0; "function" == typeof e2 && super.add(e2); } } let a = (async () => { })().constructor, i = e._ytConfigHacks = new n(), l = () => { let t2 = e.ytcsi.originalYtcsi; t2 && (e.ytcsi = t2, l = null); }, c = null, o = () => { if (t >= 1) { let n2 = (e.yt || 0).config_ || (e.ytcfg || 0).data_ || 0; if ("string" == typeof n2.INNERTUBE_API_KEY && "object" == typeof n2.EXPERIMENT_FLAGS) for (let a2 of (--t <= 0 && l && l(), c = true, i)) a2(n2); } }, f = 1, d = (t2) => { if (t2 = t2 || e.ytcsi) return e.ytcsi = new Proxy(t2, { get: (e2, t3, n2) => "originalYtcsi" === t3 ? e2 : (o(), c && --f <= 0 && l && l(), e2[t3]) }), true; }; d() || Object.defineProperty(e, "ytcsi", { get() { }, set: (t2) => (t2 && (delete e.ytcsi, d(t2)), true), enumerable: false, configurable: true }); let { addEventListener: s, removeEventListener: y } = Document.prototype; new a((e2) => { if ("undefined" != typeof AbortSignal) s.call( document, "yt-page-data-fetched", e2, { once: true } ), s.call(document, "yt-navigate-finish", e2, { once: true }), s.call( document, "spfdone", e2, { once: true } ); else { let t2 = () => { e2(), y.call(document, "yt-page-data-fetched", t2, false), y.call(document, "yt-navigate-finish", t2, false), y.call(document, "spfdone", t2, false); }; s.call(document, "yt-page-data-fetched", t2, false), s.call(document, "yt-navigate-finish", t2, false), s.call(document, "spfdone", t2, false); } }).then(o), new a((e2) => { if ("undefined" != typeof AbortSignal) s.call( document, "yt-action", e2, { once: true, capture: true } ); else { let t2 = () => { e2(), y.call(document, "yt-action", t2, true); }; s.call(document, "yt-action", t2, true); } }).then(o), a.resolve().then(() => { "loading" !== document.readyState ? r() : e.addEventListener("DOMContentLoaded", r, false); }); } })(); let configOnce = false; window._ytConfigHacks.add((config_) => { if (configOnce) return; configOnce = true; const EXPERIMENT_FLAGS = config_.EXPERIMENT_FLAGS || 0; const EXPERIMENTS_FORCED_FLAGS = config_.EXPERIMENTS_FORCED_FLAGS || 0; for (const flags of [EXPERIMENT_FLAGS, EXPERIMENTS_FORCED_FLAGS]) { if (flags) { flags.web_watch_chat_hide_button_killswitch = false; flags.web_watch_theater_chat = false; flags.suppress_error_204_logging = true; flags.kevlar_watch_grid = false; if (DISABLE_FLAGS_SHADYDOM_FREE) { flags.enable_shadydom_free_scoped_node_methods = false; flags.enable_shadydom_free_scoped_query_methods = false; flags.enable_shadydom_free_scoped_readonly_properties_batch_one = false; flags.enable_shadydom_free_parent_node = false; flags.enable_shadydom_free_children = false; flags.enable_shadydom_free_last_child = false; } } } }); const mWeakRef = typeof WeakRef === "function" ? (o) => o ? new WeakRef(o) : null : (o) => o || null; const kRef = (wr) => wr && wr.deref ? wr.deref() : wr; const Promise = (async () => { })().constructor; const delayPn = (delay) => new Promise((fn) => setTimeout(fn, delay)); const insp = (o) => o ? o.polymerController || o.inst || o || 0 : o || 0; const setTimeout_ = setTimeout.bind(window); const PromiseExternal = ((resolve_, reject_) => { const h = (resolve, reject) => { resolve_ = resolve; reject_ = reject; }; return class PromiseExternal extends Promise { constructor(cb = h) { super(cb); if (cb === h) { this.resolve = resolve_; this.reject = reject_; } } }; })(); var nextBrowserTick = void 0 !== nextBrowserTick && nextBrowserTick.version >= 2 ? nextBrowserTick : (() => { "use strict"; const e = "undefined" != typeof self ? self : "undefined" != typeof global ? global : void 0; let t = true; if (!function n2(s2) { return s2 ? t = false : e.postMessage && !e.importScripts && e.addEventListener ? (e.addEventListener("message", n2, false), e.postMessage("$$", "*"), e.removeEventListener("message", n2, false), t) : void 0; }()) return void 0; const n = (async () => { })().constructor; let s = null; const o = /* @__PURE__ */ new Map(), { floor: r, random: i } = Math; let l; do { l = `$nextBrowserTick$${(i() + 8).toString().slice(2)}$`; } while (l in e); const a = l, c = a.length + 9; e[a] = 1; e.addEventListener("message", (e2) => { if (0 !== o.size) { const t2 = (e2 || 0).data; if ("string" == typeof t2 && t2.length === c && e2.source === (e2.target || 1)) { const e3 = o.get(t2); e3 && ("p" === t2[0] && (s = null), o.delete(t2), e3()); } } }, false); const d = (t2 = o) => { if (t2 === o) { if (s) return s; let t3; do { t3 = `p${a}${r(314159265359 * i() + 314159265359).toString(36)}`; } while (o.has(t3)); return s = new n((e2) => { o.set(t3, e2); }), e.postMessage(t3, "*"), t3 = null, s; } { let n2; do { n2 = `f${a}${r(314159265359 * i() + 314159265359).toString(36)}`; } while (o.has(n2)); o.set(n2, t2), e.postMessage(n2, "*"); } }; return d.version = 2, d; })(); const isPassiveArgSupport = typeof IntersectionObserver === "function"; const bubblePassive = isPassiveArgSupport ? { capture: false, passive: true } : false; const capturePassive = isPassiveArgSupport ? { capture: true, passive: true } : true; class Attributer { constructor(list) { this.list = list; this.flag = 0; } makeString() { let k = 1; let s = ""; let i = 0; while (this.flag >= k) { if (this.flag & k) { s += this.list[i]; } i++; k <<= 1; } return s; } } const mLoaded = new Attributer("icp"); const wrSelfMap = /* @__PURE__ */ new WeakMap(); const elements = new Proxy({ related: null, comments: null, infoExpander: null }, { get(target, prop) { return kRef(target[prop]); }, set(target, prop, value) { if (value) { let wr = wrSelfMap.get(value); if (!wr) { wr = mWeakRef(value); wrSelfMap.set(value, wr); } target[prop] = wr; } else { target[prop] = null; } return true; } }); const getMainInfo = () => { const infoExpander = elements.infoExpander; if (!infoExpander) return null; const mainInfo = infoExpander.matches("[tyt-main-info]") ? infoExpander : infoExpander.querySelector000("[tyt-main-info]"); return mainInfo || null; }; const asyncWrap = (asyncFn) => { return () => { Promise.resolve().then(asyncFn); }; }; let pageType = null; let pageLang = "en"; const langWords = { "en": { "info": "Info", "videos": "Videos", "playlist": "Playlist" }, "jp": { "info": "情報", "videos": "動画", "playlist": "再生リスト" }, "tw": { "info": "資訊", "videos": "影片", "playlist": "播放清單" }, "cn": { "info": "资讯", "videos": "视频", "playlist": "播放列表" }, "du": { "info": "Info", "videos": "Videos", "playlist": "Playlist" }, "fr": { "info": "Info", "videos": "Vidéos", "playlist": "Playlist" }, "kr": { "info": "정보", "videos": "동영상", "playlist": "재생목록" }, "ru": { "info": "Описание", "videos": "Видео", "playlist": "Плейлист" } }; const svgComments = `<path d="M80 27H12A12 12 90 0 0 0 39v42a12 12 90 0 0 12 12h12v20a2 2 90 0 0 3.4 2L47 93h33a12 12 90 0 0 12-12V39a12 12 90 0 0-12-12zM20 47h26a2 2 90 1 1 0 4H20a2 2 90 1 1 0-4zm52 28H20a2 2 90 1 1 0-4h52a2 2 90 1 1 0 4zm0-12H20a2 2 90 1 1 0-4h52a2 2 90 1 1 0 4zm36-58H40a12 12 90 0 0-12 12v6h52c9 0 16 7 16 16v42h0v4l7 7a2 2 90 0 0 3-1V71h2a12 12 90 0 0 12-12V17a12 12 90 0 0-12-12z"/>`.trim(); const svgVideos = `<path d="M89 10c0-4-3-7-7-7H7c-4 0-7 3-7 7v70c0 4 3 7 7 7h75c4 0 7-3 7-7V10zm-62 2h13v10H27V12zm-9 66H9V68h9v10zm0-56H9V12h9v10zm22 56H27V68h13v10zm-3-25V36c0-2 2-3 4-2l12 8c2 1 2 4 0 5l-12 8c-2 1-4 0-4-2zm25 25H49V68h13v10zm0-56H49V12h13v10zm18 56h-9V68h9v10zm0-56h-9V12h9v10z"/>`.trim(); const svgInfo = `<path d="M30 0C13.3 0 0 13.3 0 30s13.3 30 30 30 30-13.3 30-30S46.7 0 30 0zm6.2 46.6c-1.5.5-2.6 1-3.6 1.3a10.9 10.9 0 0 1-3.3.5c-1.7 0-3.3-.5-4.3-1.4a4.68 4.68 0 0 1-1.6-3.6c0-.4.2-1 .2-1.5a20.9 20.9 90 0 1 .3-2l2-6.8c.1-.7.3-1.3.4-1.9a8.2 8.2 90 0 0 .3-1.6c0-.8-.3-1.4-.7-1.8s-1-.5-2-.5a4.53 4.53 0 0 0-1.6.3c-.5.2-1 .2-1.3.4l.6-2.1c1.2-.5 2.4-1 3.5-1.3s2.3-.6 3.3-.6c1.9 0 3.3.6 4.3 1.3s1.5 2.1 1.5 3.5c0 .3 0 .9-.1 1.6a10.4 10.4 90 0 1-.4 2.2l-1.9 6.7c-.2.5-.2 1.1-.4 1.8s-.2 1.3-.2 1.6c0 .9.2 1.6.6 1.9s1.1.5 2.1.5a6.1 6.1 90 0 0 1.5-.3 9 9 90 0 0 1.4-.4l-.6 2.2zm-3.8-35.2a1 1 0 010 8.6 1 1 0 010-8.6z"/>`.trim(); const svgPlayList = `<path d="M0 3h12v2H0zm0 4h12v2H0zm0 4h8v2H0zm16 0V7h-2v4h-4v2h4v4h2v-4h4v-2z"/>`.trim(); const svgDiag1 = `<svg stroke="currentColor" fill="none"><path d="M8 2h2v2M7 5l3-3m-6 8H2V8m0 2l3-3"/></svg>`; const svgDiag2 = `<svg stroke="currentColor" fill="none"><path d="M7 3v2h2M7 5l3-3M5 9V7H3m-1 3l3-3"/></svg>`; const getGMT = () => { let m = new Date("2023-01-01T00:00:00Z"); return m.getDate() === 1 ? `+${m.getHours()}` : `-${24 - m.getHours()}`; }; const svgElm = (w, h, vw, vh, p, m) => `<svg${m ? ` class=${m}` : ""} width="${w}" height="${h}" viewBox="0 0 ${vw} ${vh}" preserveAspectRatio="xMidYMid meet">${p}</svg>`; let hiddenTabsByUserCSS = 0; const _locks = {}; const lockGet = new Proxy( _locks, { get(target, prop) { return target[prop] || 0; }, set(target, prop, val) { return true; } } ); const lockSet = new Proxy( _locks, { get(target, prop) { if (target[prop] > 1e9) target[prop] = 9; return target[prop] = (target[prop] || 0) + 1; }, set(target, prop, val) { return true; } } ); const videosElementProvidedPromise = new PromiseExternal(); const navigateFinishedPromise = new PromiseExternal(); let isRightTabsInserted = false; const rightTabsProvidedPromise = new PromiseExternal(); const infoExpanderElementProvidedPromise = new PromiseExternal(); const cmAttr = document.createComment("1"); const cmAttrStack = []; const cmAttrStackPush = (f) => { cmAttrStack.push(f); cmAttr.data = `${(cmAttr.data & 7) + 1}`; }; const cmAttrObs = new MutationObserver(() => { const l = cmAttrStack.length; for (let i = 0; i < l; i++) { cmAttrStack[i](); } }); cmAttrObs.observe(cmAttr, { characterData: true }); const funcCanCollapse = function(s) { const content = this.content || this.$.content; this.canToggle = this.shouldUseNumberOfLines && (this.alwaysCollapsed || this.collapsed || this.isToggled === false) ? this.alwaysToggleable || this.isToggled || content && content.offsetHeight < content.scrollHeight : this.alwaysToggleable || this.isToggled || content && content.scrollHeight > this.collapsedHeight; }; const aoChatAttrChangeFn = async (lockId) => { if (lockGet["aoChatAttrAsyncLock"] !== lockId) return; const chatElm = elements.chat; const ytdFlexyElm = elements.flexy; if (chatElm && ytdFlexyElm) { const isChatCollapsed = chatElm.hasAttribute000("collapsed"); if (isChatCollapsed) { ytdFlexyElm.setAttribute111("tyt-chat-collapsed", ""); } else { ytdFlexyElm.removeAttribute000("tyt-chat-collapsed"); } ytdFlexyElm.setAttribute111("tyt-chat", isChatCollapsed ? "-" : "+"); } }; const aoPlayListAttrChangeFn = async (lockId) => { if (lockGet["aoPlayListAttrAsyncLock"] !== lockId) return; const playlistElm = elements.playlist; const ytdFlexyElm = elements.flexy; if (playlistElm && ytdFlexyElm) { if (playlistElm.hasAttribute000("collapsed")) { ytdFlexyElm.removeAttribute000("tyt-playlist-expanded"); } else { ytdFlexyElm.setAttribute111("tyt-playlist-expanded", ""); } } else if (ytdFlexyElm) { ytdFlexyElm.removeAttribute000("tyt-playlist-expanded"); } }; const aoChat = new MutationObserver(() => { Promise.resolve(lockSet["aoChatAttrAsyncLock"]).then(aoChatAttrChangeFn).catch(console.warn); }); const aoPlayList = new MutationObserver(() => { Promise.resolve(lockSet["aoPlayListAttrAsyncLock"]).then(aoPlayListAttrChangeFn).catch(console.warn); }); const aoComment = new MutationObserver(async (mutations) => { const commentsArea = elements.comments; const ytdFlexyElm = elements.flexy; if (!commentsArea) return; let bfHidden = false; let bfCommentsVideoId = false; let bfCommentDisabled = false; for (const mutation of mutations) { if (mutation.attributeName === "hidden" && mutation.target === commentsArea) { bfHidden = true; } else if (mutation.attributeName === "tyt-comments-video-id" && mutation.target === commentsArea) { bfCommentsVideoId = true; } else if (mutation.attributeName === "tyt-comments-data-status" && mutation.target === commentsArea) { bfCommentDisabled = true; } } if (bfHidden) { if (!commentsArea.hasAttribute000("hidden")) { Promise.resolve(commentsArea).then(eventMap["settingCommentsVideoId"]).catch(console.warn); } Promise.resolve(lockSet["removeKeepCommentsScrollerLock"]).then(removeKeepCommentsScroller).catch(console.warn); } if ((bfHidden || bfCommentsVideoId || bfCommentDisabled) && ytdFlexyElm) { const commentsDataStatus = +commentsArea.getAttribute000("tyt-comments-data-status"); if (commentsDataStatus === 2) { ytdFlexyElm.setAttribute111("tyt-comment-disabled", ""); } else if (commentsDataStatus === 1) { ytdFlexyElm.removeAttribute000("tyt-comment-disabled"); } Promise.resolve(lockSet["checkCommentsShouldBeHiddenLock"]).then(eventMap["checkCommentsShouldBeHidden"]).catch(console.warn); const lockId = lockSet["rightTabReadyLock01"]; await rightTabsProvidedPromise.then(); if (lockGet["rightTabReadyLock01"] !== lockId) return; if (elements.comments !== commentsArea) return; if (commentsArea.isConnected === false) return; if (commentsArea.closest("#tab-comments")) { const shouldTabVisible = !commentsArea.closest("[hidden]"); document.querySelector('[tyt-tab-content="#tab-comments"]').classList.toggle("tab-btn-hidden", !shouldTabVisible); } } }); const ioComment = new IntersectionObserver((entries) => { for (const entry of entries) { const target = entry.target; const cnt = insp(target); if (entry.isIntersecting && target instanceof HTMLElement_ && typeof cnt.calculateCanCollapse === "function") { lockSet["removeKeepCommentsScrollerLock"]; cnt.calculateCanCollapse(true); target.setAttribute111("io-intersected", ""); const ytdFlexyElm = elements.flexy; if (ytdFlexyElm && !ytdFlexyElm.hasAttribute000("keep-comments-scroller")) { ytdFlexyElm.setAttribute111("keep-comments-scroller", ""); } } else if (target.hasAttribute000("io-intersected")) { target.removeAttribute000("io-intersected"); } } }, { threshold: [0], rootMargin: "32px" }); let bFixForResizedTabLater = false; let lastRoRightTabsWidth = 0; const roRightTabs = new ResizeObserver((entries) => { const entry = entries[entries.length - 1]; const width = Math.round(entry.borderBoxSize.inlineSize); if (lastRoRightTabsWidth !== width) { lastRoRightTabsWidth = width; if ((tabAStatus & 2) === 2) { bFixForResizedTabLater = false; Promise.resolve(1).then(eventMap["fixForTabDisplay"]); } else { bFixForResizedTabLater = true; } } }); const switchToTab = (activeLink) => { if (typeof activeLink === "string") { activeLink = document.querySelector(`a[tyt-tab-content="${activeLink}"]`) || null; } const ytdFlexyElm = elements.flexy; const links = document.querySelectorAll("#material-tabs a[tyt-tab-content]"); for (const link of links) { const content = document.querySelector(link.getAttribute000("tyt-tab-content")); if (link && content) { if (link !== activeLink) { link.classList.remove("active"); content.classList.add("tab-content-hidden"); if (!content.hasAttribute000("tyt-hidden")) { content.setAttribute111("tyt-hidden", ""); } } else { link.classList.add("active"); if (content.hasAttribute000("tyt-hidden")) { content.removeAttribute000("tyt-hidden"); } content.classList.remove("tab-content-hidden"); } } } const switchingTo = activeLink ? activeLink.getAttribute000("tyt-tab-content") : ""; if (switchingTo) { lastTab = lastPanel = switchingTo; } if (ytdFlexyElm.getAttribute000("tyt-chat") === "") ytdFlexyElm.removeAttribute000("tyt-chat"); ytdFlexyElm.setAttribute111("tyt-tab", switchingTo); if (switchingTo) { bFixForResizedTabLater = false; Promise.resolve(0).then(eventMap["fixForTabDisplay"]); } }; let tabAStatus = 0; const calculationFn = (r = 0, flag) => { const ytdFlexyElm = elements.flexy; if (!ytdFlexyElm) return r; if (flag & 1) { r |= 1; if (!ytdFlexyElm.hasAttribute000("theater")) r -= 1; } if (flag & 2) { r |= 2; if (!ytdFlexyElm.getAttribute000("tyt-tab")) r -= 2; } if (flag & 4) { r |= 4; if (ytdFlexyElm.getAttribute000("tyt-chat") !== "-") r -= 4; } if (flag & 8) { r |= 8; if (ytdFlexyElm.getAttribute000("tyt-chat") !== "+") r -= 8; } if (flag & 16) { r |= 16; if (!ytdFlexyElm.hasAttribute000("is-two-columns_")) r -= 16; } if (flag & 32) { r |= 32; if (!ytdFlexyElm.hasAttribute000("tyt-egm-panel_")) r -= 32; } if (flag & 64) { r |= 64; if (!document.fullscreenElement) r -= 64; } if (flag & 128) { r |= 128; if (!ytdFlexyElm.hasAttribute000("tyt-playlist-expanded")) r -= 128; } return r; }; const updateChatLocation498 = function() { if (this.is !== "ytd-watch-grid") { this.updatePageMediaQueries(); this.schedulePlayerSizeUpdate_(); } }; const mirrorNodeWS = /* @__PURE__ */ new WeakMap(); const dummyNode = document.createElement("noscript"); const __j4836__ = Symbol(); const __j5744__ = Symbol(); const __j5733__ = Symbol(); const monitorDataChangedByDOMMutation = async function(mutations) { const nodeWR = this; const node = kRef(nodeWR); if (!node) return; const cnt = insp(node); const __lastChanged__ = cnt[__j5733__]; const val = cnt.data ? cnt.data[__j4836__] || 1 : 0; if (__lastChanged__ !== val) { cnt[__j5733__] = val > 0 ? cnt.data[__j4836__] = Date.now() : 0; await Promise.resolve(); attributeInc(node, "tyt-data-change-counter"); } }; const moChangeReflection = function(mutations) { const nodeWR = this; const node = kRef(nodeWR); if (!node) return; const originElement = kRef(node[__j5744__] || null) || null; if (!originElement) return; const cnt = insp(node); const oriCnt = insp(originElement); if (mutations) { let bfDataChangeCounter = false; for (const mutation of mutations) { if (mutation.attributeName === "tyt-clone-refresh-count" && mutation.target === originElement) { bfDataChangeCounter = true; } else if (mutation.attributeName === "tyt-data-change-counter" && mutation.target === originElement) { bfDataChangeCounter = true; } } if (bfDataChangeCounter && oriCnt.data) { node.replaceWith(dummyNode); cnt.data = Object.assign({}, oriCnt.data); dummyNode.replaceWith(node); } } }; const attributeInc = (elm, prop) => { let v = (+elm.getAttribute000(prop) || 0) + 1; if (v > 1e9) v = 9; elm.setAttribute000(prop, v); return v; }; const isChannelId = (x) => { if (typeof x === "string" && x.length === 24) { return /UC[-_a-zA-Z0-9+=.]{22}/.test(x); } return false; }; const infoFix = (lockId) => { if (lockId !== null && lockGet["infoFixLock"] !== lockId) return; const infoExpander = elements.infoExpander; const infoContainer = (infoExpander ? infoExpander.parentNode : null) || document.querySelector("#tab-info"); const ytdFlexyElm = elements.flexy; if (!infoContainer || !ytdFlexyElm) return; if (infoExpander) { const match = infoExpander.matches("#tab-info > [class]") || infoExpander.matches("#tab-info > [tyt-main-info]"); if (!match) return; } const requireElements = [...document.querySelectorAll('ytd-watch-metadata.ytd-watch-flexy div[slot="extra-content"] > *, ytd-watch-metadata.ytd-watch-flexy #extra-content > *')].filter((elm) => { return typeof elm.is == "string"; }).map((elm) => { const is = elm.is; while (elm instanceof HTMLElement_) { const q = [...elm.querySelectorAll(is)].filter((e) => insp(e).data); if (q.length >= 1) return q[0]; elm = elm.parentNode; } }).filter((elm) => !!elm && typeof elm.is === "string"); const source = requireElements.map((entry) => { const inst = insp(entry); return { data: inst.data, tag: inst.is, elm: entry }; }); let noscript_ = document.querySelector("noscript#aythl"); if (!noscript_) { noscript_ = document.createElement("noscript"); noscript_.id = "aythl"; inPageRearrange = true; ytdFlexyElm.insertBefore000(noscript_, ytdFlexyElm.firstChild); inPageRearrange = false; } const noscript = noscript_; let requiredUpdate = false; const mirrorElmSet = /* @__PURE__ */ new Set(); const targetParent = infoContainer; for (const { data, tag, elm: s } of source) { let mirrorNode = mirrorNodeWS.get(s); mirrorNode = mirrorNode ? kRef(mirrorNode) : mirrorNode; if (!mirrorNode) { const cnt = insp(s); const cProto = cnt.constructor.prototype; const element = document.createElement(tag); noscript.appendChild(element); mirrorNode = element; mirrorNode[__j5744__] = mWeakRef(s); const nodeWR = mWeakRef(mirrorNode); new MutationObserver(moChangeReflection.bind(nodeWR)).observe(s, { attributes: true, attributeFilter: ["tyt-clone-refresh-count", "tyt-data-change-counter"] }); s.jy8432 = 1; if (!(cProto instanceof Node) && !cProto._dataChanged496 && typeof cProto._createPropertyObserver === "function") { cProto._dataChanged496 = function() { const cnt2 = this; const node = cnt2.hostElement || cnt2; if (node.jy8432) { attributeInc(node, "tyt-data-change-counter"); } }; cProto._createPropertyObserver("data", "_dataChanged496", void 0); } else if (!(cProto instanceof Node) && !cProto._dataChanged496 && cProto.useSignals === true && insp(s).signalProxy) { const dataSignal = cnt?.signalProxy?.signalCache?.data; if (dataSignal && typeof dataSignal.setWithPath === "function" && !dataSignal.setWithPath573 && !dataSignal.controller573) { dataSignal.controller573 = mWeakRef(cnt); dataSignal.setWithPath573 = dataSignal.setWithPath; dataSignal.setWithPath = function() { const cnt2 = kRef(this.controller573 || null) || null; cnt2 && typeof cnt2._dataChanged496k === "function" && Promise.resolve(cnt2).then(cnt2._dataChanged496k).catch(console.warn); return this.setWithPath573(...arguments); }; cProto._dataChanged496 = function() { const cnt2 = this; const node = cnt2.hostElement || cnt2; if (node.jy8432) { attributeInc(node, "tyt-data-change-counter"); } }; cProto._dataChanged496k = (cnt2) => cnt2._dataChanged496(); } } if (!cProto._dataChanged496) { new MutationObserver(monitorDataChangedByDOMMutation.bind(mirrorNode[__j5744__])).observe(s, { attributes: true, childList: true, subtree: true }); } mirrorNodeWS.set(s, nodeWR); requiredUpdate = true; } else { if (mirrorNode.parentNode !== targetParent) { requiredUpdate = true; } } if (!requiredUpdate) { const cloneNodeCnt = insp(mirrorNode); if (cloneNodeCnt.data !== data) { requiredUpdate = true; } } mirrorElmSet.add(mirrorNode); source.mirrored = mirrorNode; } const mirroElmArr = [...mirrorElmSet]; mirrorElmSet.clear(); if (!requiredUpdate) { let e = infoExpander ? -1 : 0; for (let n = targetParent.firstChild; n instanceof Node; n = n.nextSibling) { let target = e < 0 ? infoExpander : mirroElmArr[e]; e++; if (n !== target) { requiredUpdate = true; break; } } if (!requiredUpdate && e !== mirroElmArr.length + 1) requiredUpdate = true; } if (requiredUpdate) { if (infoExpander) { targetParent.assignChildren111(null, infoExpander, mirroElmArr); } else { targetParent.replaceChildren000(...mirroElmArr); } for (const mirrorElm of mirroElmArr) { const j = attributeInc(mirrorElm, "tyt-clone-refresh-count"); const oriElm = kRef(mirrorElm[__j5744__] || null) || null; if (oriElm) { oriElm.setAttribute111("tyt-clone-refresh-count", j); } } } mirroElmArr.length = 0; source.length = 0; }; const layoutFix = (lockId) => { if (lockGet["layoutFixLock"] !== lockId) return; const secondaryWrapper = document.querySelector("#secondary-inner.style-scope.ytd-watch-flexy > secondary-wrapper"); if (secondaryWrapper) { const secondaryInner = secondaryWrapper.parentNode; const chatContainer = document.querySelector("#columns.style-scope.ytd-watch-flexy [tyt-chat-container]"); if (secondaryInner.firstChild !== secondaryInner.lastChild || chatContainer && !chatContainer.closest("secondary-wrapper")) { let w = []; let w2 = []; for (let node = secondaryInner.firstChild; node instanceof Node; node = node.nextSibling) { if (node === chatContainer && chatContainer) { } else if (node === secondaryWrapper) { for (let node2 = secondaryWrapper.firstChild; node2 instanceof Node; node2 = node2.nextSibling) { if (node2 === chatContainer && chatContainer) { } else { if (node2.id === "right-tabs" && chatContainer) { w2.push(chatContainer); } w2.push(node2); } } } else { w.push(node); } } inPageRearrange = true; secondaryWrapper.replaceChildren000(...w, ...w2); inPageRearrange = false; const chatElm = elements.chat; const chatCnt = insp(chatElm); if (chatCnt && typeof chatCnt.urlChanged === "function" && secondaryWrapper.contains(chatElm)) { if (typeof chatCnt.urlChangedAsync12 === "function") { chatCnt.urlChanged(); } else { setTimeout(() => chatCnt.urlChanged(), 136); } } } } }; let lastPanel = ""; let lastTab = ""; const aoEgmPanels = new MutationObserver(() => { Promise.resolve(lockSet["updateEgmPanelsLock"]).then(updateEgmPanels).catch(console.warn); }); const removeKeepCommentsScroller = async (lockId) => { if (lockGet["removeKeepCommentsScrollerLock"] !== lockId) return; await Promise.resolve(); if (lockGet["removeKeepCommentsScrollerLock"] !== lockId) return; const ytdFlexyFlm = elements.flexy; if (ytdFlexyFlm) { ytdFlexyFlm.removeAttribute000("keep-comments-scroller"); } }; const updateEgmPanels = async (lockId) => { if (lockId !== lockGet["updateEgmPanelsLock"]) return; await navigateFinishedPromise.then().catch(console.warn); if (lockId !== lockGet["updateEgmPanelsLock"]) return; const ytdFlexyElm = elements.flexy; if (!ytdFlexyElm) return; let newVisiblePanels = []; let newHiddenPanels = []; let allVisiblePanels = []; for (const panelElm of document.querySelectorAll("[tyt-egm-panel][target-id][visibility]")) { const visibility = panelElm.getAttribute000("visibility"); if (visibility === "ENGAGEMENT_PANEL_VISIBILITY_HIDDEN" || panelElm.closest("[hidden]")) { if (panelElm.hasAttribute000("tyt-visible-at")) { panelElm.removeAttribute000("tyt-visible-at"); newHiddenPanels.push(panelElm); } } else if (visibility === "ENGAGEMENT_PANEL_VISIBILITY_EXPANDED" && !panelElm.closest("[hidden]")) { let visibleAt = panelElm.getAttribute000("tyt-visible-at"); if (!visibleAt) { panelElm.setAttribute111("tyt-visible-at", Date.now()); newVisiblePanels.push(panelElm); } allVisiblePanels.push(panelElm); } } if (newVisiblePanels.length >= 1 && allVisiblePanels.length >= 2) { const targetVisible = newVisiblePanels[newVisiblePanels.length - 1]; const actions = []; for (const panelElm of allVisiblePanels) { if (panelElm === targetVisible) continue; actions.push({ panelId: panelElm.getAttribute000("target-id"), toHide: true }); } if (actions.length >= 1) { ytBtnEgmPanelCore(actions); } } if (allVisiblePanels.length >= 1) { ytdFlexyElm.setAttribute111("tyt-egm-panel_", ""); } else { ytdFlexyElm.removeAttribute000("tyt-egm-panel_"); } newVisiblePanels.length = 0; newVisiblePanels = null; newHiddenPanels.length = 0; newHiddenPanels = null; allVisiblePanels.length = 0; allVisiblePanels = null; }; const checkElementExist = (css, exclude) => { for (const p of document.querySelectorAll(css)) { if (!p.closest(exclude)) return p; } return null; }; let fixInitialTabStateK = 0; const { handleNavigateFactory } = (() => { let isLoadStartListened = false; function findLcComment(lc) { if (arguments.length === 1) { let element = document.querySelector(`#tab-comments ytd-comments ytd-comment-renderer #header-author a[href*="lc=${lc}"]`); if (element) { let commentRendererElm = closestFromAnchor.call(element, "ytd-comment-renderer"); if (commentRendererElm && lc) { return { lc, commentRendererElm }; } } } else if (arguments.length === 0) { let element = document.querySelector(`#tab-comments ytd-comments ytd-comment-renderer > #linked-comment-badge span:not(:empty)`); if (element) { let commentRendererElm = closestFromAnchor.call(element, "ytd-comment-renderer"); if (commentRendererElm) { let header = _querySelector.call(commentRendererElm, "#header-author"); if (header) { let anchor = _querySelector.call(header, 'a[href*="lc="]'); if (anchor) { let href = anchor.getAttribute("href") || ""; let m = /[&?]lc=([\w_.-]+)/.exec(href); if (m) { lc = m[1]; } } } } if (commentRendererElm && lc) { return { lc, commentRendererElm }; } } } return null; } function lcSwapFuncA(targetLcId, currentLcId) { let done = 0; try { let r1 = findLcComment(currentLcId).commentRendererElm; let r2 = findLcComment(targetLcId).commentRendererElm; if (typeof insp(r1).data.linkedCommentBadge === "object" && typeof insp(r2).data.linkedCommentBadge === "undefined") { let p = Object.assign({}, insp(r1).data.linkedCommentBadge); if (((p || 0).metadataBadgeRenderer || 0).trackingParams) { delete p.metadataBadgeRenderer.trackingParams; } const v1 = findContentsRenderer(r1); const v2 = findContentsRenderer(r2); if (v1.parent === v2.parent && (v2.parent.nodeName === "YTD-COMMENTS" || v2.parent.nodeName === "YTD-ITEM-SECTION-RENDERER")) { } else { return false; } if (v2.index >= 0) { if (v2.parent.nodeName === "YTD-COMMENT-REPLIES-RENDERER") { if (lcSwapFuncB(targetLcId, currentLcId, p)) { done = 1; } done = 1; } else { const v2pCnt = insp(v2.parent); const v2Conents = (v2pCnt.data || 0).contents || 0; if (!v2Conents) ; v2pCnt.data = Object.assign({}, v2pCnt.data, { contents: [].concat([v2Conents[v2.index]], v2Conents.slice(0, v2.index), v2Conents.slice(v2.index + 1)) }); if (lcSwapFuncB(targetLcId, currentLcId, p)) { done = 1; } } } } } catch (e) { } return done === 1; } function lcSwapFuncB(targetLcId, currentLcId, _p) { let done = 0; try { let r1 = findLcComment(currentLcId).commentRendererElm; let r1cnt = insp(r1); let r2 = findLcComment(targetLcId).commentRendererElm; let r2cnt = insp(r2); const r1d = r1cnt.data; let p = Object.assign({}, _p); r1d.linkedCommentBadge = null; delete r1d.linkedCommentBadge; let q = Object.assign({}, r1d); q.linkedCommentBadge = null; delete q.linkedCommentBadge; r1cnt.data = Object.assign({}, q); r2cnt.data = Object.assign({}, r2cnt.data, { linkedCommentBadge: p }); done = 1; } catch (e) { } return done === 1; } const loadStartFx = async (evt) => { let media = (evt || 0).target || 0; if (media.nodeName === "VIDEO" || media.nodeName === "AUDIO") { } else return; const newMedia = media; const media1 = common.getMediaElement(0); const media2 = common.getMediaElements(2); if (media1 !== null && media2.length > 0) { if (newMedia !== media1 && media1.paused === false) { if (isVideoPlaying(media1)) { Promise.resolve(newMedia).then((video) => video.paused === false && video.pause()).catch(console.warn); } } else if (newMedia === media1) { for (const s of media2) { if (s.paused === false) { Promise.resolve(s).then((s2) => s2.paused === false && s2.pause()).catch(console.warn); break; } } } else { Promise.resolve(media1).then((video1) => video1.paused === false && video1.pause()).catch(console.warn); } } }; const getBrowsableEndPoint = (req) => { let valid = false; let endpoint = req ? req.command : null; if (endpoint && (endpoint.commandMetadata || 0).webCommandMetadata && endpoint.watchEndpoint) { let videoId = endpoint.watchEndpoint.videoId; let url = endpoint.commandMetadata.webCommandMetadata.url; if (typeof videoId === "string" && typeof url === "string" && url.indexOf("lc=") > 0) { let m = /^\/watch\?v=([\w_-]+)&lc=([\w_.-]+)$/.exec(url); if (m && m[1] === videoId) { let targetLc = findLcComment(m[2]); let currentLc = targetLc ? findLcComment() : null; if (targetLc && currentLc) { let done = targetLc.lc === currentLc.lc ? 1 : lcSwapFuncA(targetLc.lc, currentLc.lc) ? 1 : 0; if (done === 1) { common.xReplaceState(history.state, url); return; } } } } } if (endpoint && (endpoint.commandMetadata || 0).webCommandMetadata && endpoint.browseEndpoint && isChannelId(endpoint.browseEndpoint.browseId)) { valid = true; } else if (endpoint && (endpoint.browseEndpoint || endpoint.searchEndpoint) && !endpoint.urlEndpoint && !endpoint.watchEndpoint) { if (endpoint.browseEndpoint && endpoint.browseEndpoint.browseId === "FEwhat_to_watch") { const playerMedia = common.getMediaElement(1); if (playerMedia && playerMedia.paused === false) valid = true; } else if (endpoint.commandMetadata && endpoint.commandMetadata.webCommandMetadata) { let meta = endpoint.commandMetadata.webCommandMetadata; if (meta && meta.url && meta.webPageType) { valid = true; } } } if (!valid) endpoint = null; return endpoint; }; const shouldUseMiniPlayer = () => { const isSubTypeExist = document.querySelector("ytd-page-manager#page-manager > ytd-browse[page-subtype]"); if (isSubTypeExist) return true; const movie_player = [...document.querySelectorAll("#movie_player")].filter((e) => !e.closest("[hidden]"))[0]; if (movie_player) { const media = qsOne(movie_player, "video[class], audio[class]"); if (media && media.currentTime > 3 && media.duration - media.currentTime > 3 && media.paused === false) { return true; } } return false; }; const conditionFulfillment = (req) => { const endpoint = req ? req.command : null; if (!endpoint) return; if (endpoint && (endpoint.commandMetadata || 0).webCommandMetadata && endpoint.watchEndpoint) { } else if (endpoint && (endpoint.commandMetadata || 0).webCommandMetadata && endpoint.browseEndpoint && isChannelId(endpoint.browseEndpoint.browseId)) { } else if (endpoint && (endpoint.browseEndpoint || endpoint.searchEndpoint) && !endpoint.urlEndpoint && !endpoint.watchEndpoint) { } else { return false; } if (!shouldUseMiniPlayer()) return false; if (pageType !== "watch") return false; if (!checkElementExist("ytd-watch-flexy #player button.ytp-miniplayer-button.ytp-button", "[hidden]")) { return false; } return true; }; let u38 = 0; const fixChannelAboutPopup = async (t38) => { let promise = new PromiseExternal(); const f = () => { promise && promise.resolve(); promise = null; }; document.addEventListener("yt-navigate-finish", f, false); await promise.then(); promise = null; document.removeEventListener("yt-navigate-finish", f, false); if (t38 !== u38) return; setTimeout(() => { const currentAbout = [...document.querySelectorAll("ytd-about-channel-renderer")].filter((e) => !e.closest("[hidden]"))[0]; let okay = false; if (!currentAbout) okay = true; else { const popupContainer = currentAbout.closest("ytd-popup-container"); if (popupContainer) { const cnt = insp(popupContainer); let arr = null; try { arr = cnt.handleGetOpenedPopupsAction_(); } catch (e) { } if (arr && arr.length === 0) okay = true; } else { okay = false; } } if (okay) { const descriptionModel = [...document.querySelectorAll("yt-description-preview-view-model")].filter((e) => !e.closest("[hidden]"))[0]; if (descriptionModel) { const button = [...descriptionModel.querySelectorAll("button")].filter((e) => !e.closest("[hidden]") && `${e.textContent}`.trim().length > 0)[0]; if (button) { button.click(); } } } }, 80); }; const handleNavigateFactory2 = (handleNavigate) => { return function(req) { if (u38 > 1e9) u38 = 9; const t38 = ++u38; const $this = this; const $arguments = arguments; let endpoint = null; if (conditionFulfillment(req)) { endpoint = getBrowsableEndPoint(req); } if (!endpoint || !shouldUseMiniPlayer()) return handleNavigate.apply($this, $arguments); const ytdAppElm = document.querySelector("ytd-app"); const ytdAppCnt = insp(ytdAppElm); let object = null; try { object = ytdAppCnt.data.response.currentVideoEndpoint.watchEndpoint || null; } catch (e) { object = null; } if (typeof object !== "object") object = null; const once = { once: true }; if (object !== null && !("playlistId" in object)) { let wObject = mWeakRef(object); const N = 3; let count = 0; Object.defineProperty(kRef(wObject) || {}, "playlistId", { get() { count++; if (count === N) { delete this.playlistId; } return "*"; }, set(value) { delete this.playlistId; this.playlistId = value; }, enumerable: false, configurable: true }); let playlistClearout = null; let timeoutid = 0; Promise.race([ new Promise((r) => { timeoutid = setTimeout(r, 4e3); }), new Promise((r) => { playlistClearout = () => { if (timeoutid > 0) { clearTimeout(timeoutid); timeoutid = 0; } r(); }; document.addEventListener("yt-page-type-changed", playlistClearout, once); }) ]).then(() => { if (timeoutid !== 0) { playlistClearout && document.removeEventListener("yt-page-type-changed", playlistClearout, once); timeoutid = 0; } playlistClearout = null; count = N - 1; let object2 = kRef(wObject); wObject = null; return object2 ? object2.playlistId : null; }).catch(console.warn); } if (!isLoadStartListened) { isLoadStartListened = true; document.addEventListener("loadstart", loadStartFx, true); } const endpointURL = `${endpoint?.commandMetadata?.webCommandMetadata?.url || ""}`; if (endpointURL && endpointURL.endsWith("/about") && /\/channel\/UC[-_a-zA-Z0-9+=.]{22}\/about/.test(endpointURL)) { fixChannelAboutPopup(t38); } handleNavigate.apply($this, $arguments); }; }; return { handleNavigateFactory: handleNavigateFactory2 }; })(); const common = (() => { let mediaModeLock = 0; const _getMediaElement = (i) => { if (mediaModeLock === 0) { let e = document.querySelector(".video-stream.html5-main-video") || document.querySelector("#movie_player video, #movie_player audio") || document.querySelector("body video[src], body audio[src]"); if (e) { if (e.nodeName === "VIDEO") mediaModeLock = 1; else if (e.nodeName === "AUDIO") mediaModeLock = 2; } } if (!mediaModeLock) return null; if (mediaModeLock === 1) { switch (i) { case 1: return "ytd-player#ytd-player video[src]"; case 2: return 'ytd-browse[role="main"] video[src]'; case 0: default: return "#movie_player video[src]"; } } else if (mediaModeLock === 2) { switch (i) { case 1: return "ytd-player#ytd-player audio.video-stream.html5-main-video[src]"; case 2: return 'ytd-browse[role="main"] audio.video-stream.html5-main-video[src]'; case 0: default: return "#movie_player audio.video-stream.html5-main-video[src]"; } } return null; }; return { xReplaceState(s, u) { try { history.replaceState(s, "", u); } catch (e) { } if (s.endpoint) { try { const ytdAppElm = document.querySelector("ytd-app"); const ytdAppCnt = insp(ytdAppElm); ytdAppCnt.replaceState(s.endpoint, "", u); } catch (e) { } } }, getMediaElement(i) { let s = _getMediaElement(i) || ""; if (s) return document.querySelector(s); return null; }, getMediaElements(i) { let s = _getMediaElement(i) || ""; if (s) return document.querySelectorAll(s); return []; } }; })(); let inPageRearrange = false; let tmpLastVideoId = ""; const getCurrentVideoId = () => { const ytdFlexyElm = elements.flexy; const ytdFlexyCnt = insp(ytdFlexyElm); if (ytdFlexyCnt && typeof ytdFlexyCnt.videoId === "string") return ytdFlexyCnt.videoId; if (ytdFlexyElm && typeof ytdFlexyElm.videoId === "string") return ytdFlexyElm.videoId; return ""; }; const holdInlineExpanderAlwaysExpanded = (inlineExpanderCnt) => { if (inlineExpanderCnt.alwaysShowExpandButton === true) inlineExpanderCnt.alwaysShowExpandButton = false; if (typeof (inlineExpanderCnt.collapseLabel || 0) === "string") inlineExpanderCnt.collapseLabel = ""; if (typeof (inlineExpanderCnt.expandLabel || 0) === "string") inlineExpanderCnt.expandLabel = ""; if (inlineExpanderCnt.showCollapseButton === true) inlineExpanderCnt.showCollapseButton = false; if (inlineExpanderCnt.showExpandButton === true) inlineExpanderCnt.showExpandButton = false; if (inlineExpanderCnt.expandButton instanceof HTMLElement_) { inlineExpanderCnt.expandButton = null; inlineExpanderCnt.expandButton.remove(); } }; const fixInlineExpanderDisplay = (inlineExpanderCnt) => { try { inlineExpanderCnt.updateIsAttributedExpanded(); } catch (e) { } try { inlineExpanderCnt.updateIsFormattedExpanded(); } catch (e) { } try { inlineExpanderCnt.updateTextOnSnippetTypeChange(); } catch (e) { } try { inlineExpanderCnt.updateStyles(); } catch (e) { } }; const fixInlineExpanderMethods = (inlineExpanderCnt) => { if (inlineExpanderCnt && !inlineExpanderCnt.__$idncjk8487$__) { inlineExpanderCnt.__$idncjk8487$__ = true; inlineExpanderCnt.updateTextOnSnippetTypeChange = function() { }; inlineExpanderCnt.isResetMutation = true; fixInlineExpanderDisplay(inlineExpanderCnt); } }; const fixInlineExpanderContent = () => { const mainInfo = getMainInfo(); if (!mainInfo) return; const inlineExpanderElm = mainInfo.querySelector("ytd-text-inline-expander"); const inlineExpanderCnt = insp(inlineExpanderElm); fixInlineExpanderMethods(inlineExpanderCnt); }; const plugin = { "minibrowser": { activated: false, toUse: true, activate() { if (this.activated) return; const isPassiveArgSupport2 = typeof IntersectionObserver === "function"; if (!isPassiveArgSupport2) return; this.activated = true; const ytdAppElm = document.querySelector("ytd-app"); const ytdAppCnt = insp(ytdAppElm); if (!ytdAppCnt) return; const cProto = ytdAppCnt.constructor.prototype; if (!cProto.handleNavigate) return; if (cProto.handleNavigate.__ma355__) return; cProto.handleNavigate = handleNavigateFactory(cProto.handleNavigate); cProto.handleNavigate.__ma355__ = 1; } }, "autoExpandInfoDesc": { activated: false, toUse: false, mo: null, promiseReady: new PromiseExternal(), moFn(lockId) { if (lockGet["autoExpandInfoDescAttrAsyncLock"] !== lockId) return; const mainInfo = getMainInfo(); if (!mainInfo) return; switch (((mainInfo || 0).nodeName || "").toLowerCase()) { case "ytd-expander": if (mainInfo.hasAttribute000("collapsed")) { let success = false; try { insp(mainInfo).handleMoreTap(new Event("tap")); success = true; } catch (e) { } if (success) mainInfo.setAttribute111("tyt-no-less-btn", ""); } break; case "ytd-expandable-video-description-body-renderer": const inlineExpanderElm = mainInfo.querySelector("ytd-text-inline-expander"); const inlineExpanderCnt = insp(inlineExpanderElm); if (inlineExpanderCnt && inlineExpanderCnt.isExpanded === false) { inlineExpanderCnt.isExpanded = true; inlineExpanderCnt.isExpandedChanged(); } break; } }, activate() { if (this.activated) return; this.moFn = this.moFn.bind(this); this.mo = new MutationObserver(() => { Promise.resolve(lockSet["autoExpandInfoDescAttrAsyncLock"]).then(this.moFn).catch(console.warn); }); this.activated = true; this.promiseReady.resolve(); }, async onMainInfoSet(mainInfo) { await this.promiseReady.then(); if (mainInfo.nodeName.toLowerCase() === "ytd-expander") { this.mo.observe(mainInfo, { attributes: true, attributeFilter: ["collapsed", "attr-8ifv7"] }); } else { this.mo.observe(mainInfo, { attributes: true, attributeFilter: ["attr-8ifv7"] }); } mainInfo.incAttribute111("attr-8ifv7"); } }, "fullChannelNameOnHover": { activated: false, toUse: true, mo: null, ro: null, promiseReady: new PromiseExternal(), checkResize: 0, mouseEnterFn(evt) { const target = evt ? evt.target : null; if (!(target instanceof HTMLElement_)) return; const metaDataElm = target.closest("ytd-watch-metadata"); metaDataElm.classList.remove("tyt-metadata-hover-resized"); this.checkResize = Date.now() + 300; metaDataElm.classList.add("tyt-metadata-hover"); }, mouseLeaveFn(evt) { const target = evt ? evt.target : null; if (!(target instanceof HTMLElement_)) return; const metaDataElm = target.closest("ytd-watch-metadata"); metaDataElm.classList.remove("tyt-metadata-hover-resized"); metaDataElm.classList.remove("tyt-metadata-hover"); }, moFn(lockId) { if (lockGet["fullChannelNameOnHoverAttrAsyncLock"] !== lockId) return; const uploadInfo = document.querySelector("#primary.ytd-watch-flexy ytd-watch-metadata #upload-info"); if (!uploadInfo) return; const evtOpt = { passive: true, capture: false }; uploadInfo.removeEventListener("pointerenter", this.mouseEnterFn, evtOpt); uploadInfo.removeEventListener("pointerleave", this.mouseLeaveFn, evtOpt); uploadInfo.addEventListener("pointerenter", this.mouseEnterFn, evtOpt); uploadInfo.addEventListener("pointerleave", this.mouseLeaveFn, evtOpt); }, async onNavigateFinish() { await this.promiseReady.then(); const uploadInfo = document.querySelector("#primary.ytd-watch-flexy ytd-watch-metadata #upload-info"); if (!uploadInfo) return; this.mo.observe(uploadInfo, { attributes: true, attributeFilter: ["hidden", "attr-3wb0k"] }); uploadInfo.incAttribute111("attr-3wb0k"); this.ro.observe(uploadInfo); }, activate() { if (this.activated) return; const isPassiveArgSupport2 = typeof IntersectionObserver === "function"; if (!isPassiveArgSupport2) return; this.activated = true; this.mouseEnterFn = this.mouseEnterFn.bind(this); this.mouseLeaveFn = this.mouseLeaveFn.bind(this); this.moFn = this.moFn.bind(this); this.mo = new MutationObserver(() => { Promise.resolve(lockSet["fullChannelNameOnHoverAttrAsyncLock"]).then(this.moFn).catch(console.warn); }); this.ro = new ResizeObserver((mutations) => { if (Date.now() > this.checkResize) return; for (const mutation of mutations) { const uploadInfo = mutation.target; if (uploadInfo && mutation.contentRect.width > 0 && mutation.contentRect.height > 0) { const metaDataElm = uploadInfo.closest("ytd-watch-metadata"); if (metaDataElm.classList.contains("tyt-metadata-hover")) { metaDataElm.classList.add("tyt-metadata-hover-resized"); } break; } } }); this.promiseReady.resolve(); } } }; if (sessionStorage.__$tmp_UseAutoExpandInfoDesc$__) plugin.autoExpandInfoDesc.toUse = true; const __attachedSymbol__ = Symbol(); const makeInitAttached = (tag) => { const inPageRearrange_ = inPageRearrange; inPageRearrange = false; for (const elm of document.querySelectorAll(`${tag}`)) { const cnt = insp(elm) || 0; if (typeof cnt.attached498 === "function" && !elm[__attachedSymbol__]) Promise.resolve(elm).then(eventMap[`${tag}::attached`]).catch(console.warn); } inPageRearrange = inPageRearrange_; }; const getGeneralChatElement = async () => { for (let i = 2; i-- > 0; ) { let t = document.querySelector("#columns.style-scope.ytd-watch-flexy ytd-live-chat-frame#chat"); if (t instanceof Element) return t; if (i > 0) { await delayPn(200); } } return null; }; const nsTemplateObtain = () => { let nsTemplate = document.querySelector("ytd-watch-flexy noscript[ns-template]"); if (!nsTemplate) { nsTemplate = document.createElement("noscript"); nsTemplate.setAttribute("ns-template", ""); document.querySelector("ytd-watch-flexy").appendChild(nsTemplate); } return nsTemplate; }; const isPageDOM = (elm, selector) => { if (!elm || !(elm instanceof Element) || !elm.nodeName) return false; if (!elm.closest(selector)) return false; if (elm.isConnected !== true) return false; return true; }; const invalidFlexyParent = (hostElement) => { if (hostElement instanceof HTMLElement) { const hasFlexyParent = HTMLElement.prototype.closest.call(hostElement, "ytd-watch-flexy"); if (!hasFlexyParent) return true; const currentFlexy = elements.flexy; if (currentFlexy && currentFlexy !== hasFlexyParent) return true; } return false; }; let headerMutationObserver = null; let headerMutationTmpNode = null; const eventMap = { "ceHack": () => { mLoaded.flag |= 2; document.documentElement.setAttribute111("tabview-loaded", mLoaded.makeString()); retrieveCE("ytd-watch-flexy").then(eventMap["ytd-watch-flexy::defined"]).catch(console.warn); retrieveCE("ytd-expander").then(eventMap["ytd-expander::defined"]).catch(console.warn); retrieveCE("ytd-watch-next-secondary-results-renderer").then(eventMap["ytd-watch-next-secondary-results-renderer::defined"]).catch(console.warn); retrieveCE("ytd-comments-header-renderer").then(eventMap["ytd-comments-header-renderer::defined"]).catch(console.warn); retrieveCE("ytd-live-chat-frame").then(eventMap["ytd-live-chat-frame::defined"]).catch(console.warn); retrieveCE("ytd-comments").then(eventMap["ytd-comments::defined"]).catch(console.warn); retrieveCE("ytd-engagement-panel-section-list-renderer").then(eventMap["ytd-engagement-panel-section-list-renderer::defined"]).catch(console.warn); retrieveCE("ytd-watch-metadata").then(eventMap["ytd-watch-metadata::defined"]).catch(console.warn); retrieveCE("ytd-playlist-panel-renderer").then(eventMap["ytd-playlist-panel-renderer::defined"]).catch(console.warn); retrieveCE("ytd-expandable-video-description-body-renderer").then(eventMap["ytd-expandable-video-description-body-renderer::defined"]).catch(console.warn); }, "fixForTabDisplay": (isResize) => { bFixForResizedTabLater = false; for (const element of document.querySelectorAll("[io-intersected]")) { const cnt = insp(element); if (element instanceof HTMLElement_ && typeof cnt.calculateCanCollapse === "function") { try { cnt.calculateCanCollapse(true); } catch (e) { } } } if (!isResize && lastTab === "#tab-info") { for (const element of document.querySelectorAll("#tab-info ytd-video-description-infocards-section-renderer, #tab-info yt-chip-cloud-renderer, #tab-info ytd-horizontal-card-list-renderer, #tab-info yt-horizontal-list-renderer")) { const cnt = insp(element); if (element instanceof HTMLElement_ && typeof cnt.notifyResize === "function") { try { cnt.notifyResize(); } catch (e) { } } } for (const element of document.querySelectorAll("#tab-info ytd-text-inline-expander")) { const cnt = insp(element); if (element instanceof HTMLElement_ && typeof cnt.resize === "function") { cnt.resize(false); } fixInlineExpanderDisplay(cnt); } } if (!isResize && typeof lastTab === "string" && lastTab.startsWith("#tab-")) { const tabContent = document.querySelector(".tab-content-cld:not(.tab-content-hidden)"); if (tabContent) { const renderers = tabContent.querySelectorAll("yt-chip-cloud-renderer"); for (const renderer of renderers) { const cnt = insp(renderer); if (typeof cnt.notifyResize === "function") { try { cnt.notifyResize(); } catch (e) { } } } } } }, "ytd-watch-flexy::defined": (cProto) => { if (!cProto.updateChatLocation498 && typeof cProto.updateChatLocation === "function" && cProto.updateChatLocation.length === 0) { cProto.updateChatLocation498 = cProto.updateChatLocation; cProto.updateChatLocation = updateChatLocation498; } }, "ytd-watch-next-secondary-results-renderer::defined": (cProto) => { if (!cProto.attached498 && typeof cProto.attached === "function") { cProto.attached498 = cProto.attached; cProto.attached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-watch-next-secondary-results-renderer::attached"]).catch(console.warn); return this.attached498(); }; } if (!cProto.detached498 && typeof cProto.detached === "function") { cProto.detached498 = cProto.detached; cProto.detached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-watch-next-secondary-results-renderer::detached"]).catch(console.warn); return this.detached498(); }; } makeInitAttached("ytd-watch-next-secondary-results-renderer"); }, "ytd-watch-next-secondary-results-renderer::attached": (hostElement) => { if (invalidFlexyParent(hostElement)) return; DEBUG_5084 && void 0; if (hostElement instanceof Element) hostElement[__attachedSymbol__] = true; if (!(hostElement instanceof HTMLElement_) || !(hostElement.classList.length > 0) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== true) return; if (hostElement instanceof HTMLElement_ && hostElement.matches("#columns #related ytd-watch-next-secondary-results-renderer") && !hostElement.matches("#right-tabs ytd-watch-next-secondary-results-renderer, [hidden] ytd-watch-next-secondary-results-renderer")) { elements.related = hostElement.closest("#related"); hostElement.setAttribute111("tyt-videos-list", ""); } }, "ytd-watch-next-secondary-results-renderer::detached": (hostElement) => { DEBUG_5084 && void 0; if (!(hostElement instanceof HTMLElement_) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== false) return; if (hostElement.hasAttribute000("tyt-videos-list")) { elements.related = null; hostElement.removeAttribute000("tyt-videos-list"); } }, "settingCommentsVideoId": (hostElement) => { if (!(hostElement instanceof HTMLElement_) || !(hostElement.classList.length > 0) || hostElement.closest("noscript")) return; const cnt = insp(hostElement); const commentsArea = elements.comments; if (commentsArea !== hostElement || hostElement.isConnected !== true || cnt.isAttached !== true || !cnt.data || cnt.hidden !== false) return; const ytdFlexyElm = elements.flexy; const ytdFlexyCnt = ytdFlexyElm ? insp(ytdFlexyElm) : null; if (ytdFlexyCnt && ytdFlexyCnt.videoId) { hostElement.setAttribute111("tyt-comments-video-id", ytdFlexyCnt.videoId); } else { hostElement.removeAttribute000("tyt-comments-video-id"); } }, "checkCommentsShouldBeHidden": (lockId) => { if (lockGet["checkCommentsShouldBeHiddenLock"] !== lockId) return; const commentsArea = elements.comments; const ytdFlexyElm = elements.flexy; if (commentsArea && ytdFlexyElm && !commentsArea.hasAttribute000("hidden")) { const ytdFlexyCnt = insp(ytdFlexyElm); if (typeof ytdFlexyCnt.videoId === "string") { const commentsVideoId = commentsArea.getAttribute("tyt-comments-video-id"); if (commentsVideoId && commentsVideoId !== ytdFlexyCnt.videoId) { commentsArea.setAttribute111("hidden", ""); } } } }, "ytd-comments::defined": (cProto) => { if (!cProto.attached498 && typeof cProto.attached === "function") { cProto.attached498 = cProto.attached; cProto.attached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-comments::attached"]).catch(console.warn); return this.attached498(); }; } if (!cProto.detached498 && typeof cProto.detached === "function") { cProto.detached498 = cProto.detached; cProto.detached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-comments::detached"]).catch(console.warn); return this.detached498(); }; } cProto._createPropertyObserver("data", "_dataChanged498", void 0); cProto._dataChanged498 = function() { Promise.resolve(this.hostElement).then(eventMap["ytd-comments::_dataChanged498"]).catch(console.warn); }; makeInitAttached("ytd-comments"); }, "ytd-comments::_dataChanged498": (hostElement) => { if (!hostElement.hasAttribute000("tyt-comments-area")) return; let commentsDataStatus = 0; const cnt = insp(hostElement); const data = cnt ? cnt.data : null; const contents = data ? data.contents : null; if (data) { if (contents && contents.length === 1 && contents[0].messageRenderer) { commentsDataStatus = 2; } if (contents && contents.length > 1 && contents[0].commentThreadRenderer) { commentsDataStatus = 1; } } if (commentsDataStatus) { hostElement.setAttribute111("tyt-comments-data-status", commentsDataStatus); } else { hostElement.removeAttribute000("tyt-comments-data-status"); } Promise.resolve(hostElement).then(eventMap["settingCommentsVideoId"]).catch(console.warn); }, "ytd-comments::attached": async (hostElement) => { if (invalidFlexyParent(hostElement)) return; DEBUG_5084 && void 0; if (hostElement instanceof Element) hostElement[__attachedSymbol__] = true; if (!(hostElement instanceof HTMLElement_) || !(hostElement.classList.length > 0) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== true) return; if (!hostElement || hostElement.id !== "comments") return; elements.comments = hostElement; Promise.resolve(hostElement).then(eventMap["settingCommentsVideoId"]).catch(console.warn); aoComment.observe(hostElement, { attributes: true }); hostElement.setAttribute111("tyt-comments-area", ""); const lockId = lockSet["rightTabReadyLock02"]; await rightTabsProvidedPromise.then(); if (lockGet["rightTabReadyLock02"] !== lockId) return; if (elements.comments !== hostElement) return; if (hostElement.isConnected === false) return; if (hostElement && !hostElement.closest("#right-tabs")) { document.querySelector("#tab-comments").assignChildren111(null, hostElement, null); } else { const shouldTabVisible = elements.comments && elements.comments.closest("#tab-comments") && !elements.comments.closest("[hidden]"); document.querySelector('[tyt-tab-content="#tab-comments"]').classList.toggle("tab-btn-hidden", !shouldTabVisible); Promise.resolve(lockSet["removeKeepCommentsScrollerLock"]).then(removeKeepCommentsScroller).catch(console.warn); } }, "ytd-comments::detached": (hostElement) => { DEBUG_5084 && void 0; if (!(hostElement instanceof HTMLElement_) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== false) return; if (hostElement.hasAttribute000("tyt-comments-area")) { hostElement.removeAttribute000("tyt-comments-area"); aoComment.disconnect(); aoComment.takeRecords(); elements.comments = null; document.querySelector('[tyt-tab-content="#tab-comments"]').classList.add("tab-btn-hidden"); Promise.resolve(lockSet["removeKeepCommentsScrollerLock"]).then(removeKeepCommentsScroller).catch(console.warn); } }, "ytd-comments-header-renderer::defined": (cProto) => { if (!cProto.attached498 && typeof cProto.attached === "function") { cProto.attached498 = cProto.attached; cProto.attached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-comments-header-renderer::attached"]).catch(console.warn); Promise.resolve(this.hostElement).then(eventMap["ytd-comments-header-renderer::dataChanged"]).catch(console.warn); return this.attached498(); }; } if (!cProto.detached498 && typeof cProto.detached === "function") { cProto.detached498 = cProto.detached; cProto.detached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-comments-header-renderer::detached"]).catch(console.warn); return this.detached498(); }; } if (!cProto.dataChanged498 && typeof cProto.dataChanged === "function") { cProto.dataChanged498 = cProto.dataChanged; cProto.dataChanged = function() { Promise.resolve(this.hostElement).then(eventMap["ytd-comments-header-renderer::dataChanged"]).catch(console.warn); return this.dataChanged498(); }; } makeInitAttached("ytd-comments-header-renderer"); }, "ytd-comments-header-renderer::attached": (hostElement) => { if (invalidFlexyParent(hostElement)) return; DEBUG_5084 && void 0; if (hostElement instanceof Element) hostElement[__attachedSymbol__] = true; if (!(hostElement instanceof HTMLElement_) || !(hostElement.classList.length > 0) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== true) return; if (!hostElement || !hostElement.classList.contains("ytd-item-section-renderer")) return; const targetElement = document.querySelector("[tyt-comments-area] ytd-comments-header-renderer"); if (hostElement === targetElement) { hostElement.setAttribute111("tyt-comments-header-field", ""); } else { const parentNode = hostElement.parentNode; if (parentNode instanceof HTMLElement_ && parentNode.querySelector("[tyt-comments-header-field]")) { hostElement.setAttribute111("tyt-comments-header-field", ""); } } }, "ytd-comments-header-renderer::detached": (hostElement) => { DEBUG_5084 && void 0; if (!(hostElement instanceof HTMLElement_) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== false) return; if (hostElement.hasAttribute000("field-of-cm-count")) { hostElement.removeAttribute000("field-of-cm-count"); const cmCount = document.querySelector("#tyt-cm-count"); if (cmCount && !document.querySelector("#tab-comments ytd-comments-header-renderer[field-of-cm-count]")) { cmCount.textContent = ""; } } if (hostElement.hasAttribute000("tyt-comments-header-field")) { hostElement.removeAttribute000("tyt-comments-header-field"); } }, "ytd-comments-header-renderer::dataChanged": (hostElement) => { if (!(hostElement instanceof HTMLElement_) || !(hostElement.classList.length > 0) || hostElement.closest("noscript")) return; const ytdFlexyElm = elements.flexy; let b = false; const cnt = insp(hostElement); if (cnt && hostElement.closest("#tab-comments") && document.querySelector("#tab-comments ytd-comments-header-renderer") === hostElement) { b = true; } else if (hostElement instanceof HTMLElement_ && hostElement.parentNode instanceof HTMLElement_ && hostElement.parentNode.querySelector("[tyt-comments-header-field]")) { b = true; } if (b) { hostElement.setAttribute111("tyt-comments-header-field", ""); ytdFlexyElm && ytdFlexyElm.removeAttribute000("tyt-comment-disabled"); } if (hostElement.hasAttribute000("tyt-comments-header-field") && hostElement.isConnected === true) { if (!headerMutationObserver) { headerMutationObserver = new MutationObserver(eventMap["ytd-comments-header-renderer::deferredCounterUpdate"]); } headerMutationObserver.observe(hostElement.parentNode, { subtree: false, childList: true }); if (!headerMutationTmpNode) headerMutationTmpNode = document.createElementNS("http://www.w3.org/2000/svg", "defs"); const tmpNode = headerMutationTmpNode; hostElement.insertAdjacentElement("afterend", tmpNode); tmpNode.remove(); } }, "ytd-comments-header-renderer::deferredCounterUpdate": () => { const nodes = document.querySelectorAll("#tab-comments ytd-comments-header-renderer[class]"); if (nodes.length === 1) { const hostElement = nodes[0]; const cnt = insp(hostElement); const data = cnt.data; if (!data) return; let ez = ""; if (data.commentsCount && data.commentsCount.runs && data.commentsCount.runs.length >= 1) { let max = -1; const z = data.commentsCount.runs.map((e) => { let c = e.text.replace(/\D+/g, "").length; if (c > max) max = c; return [e.text, c]; }).filter((a) => a[1] === max); if (z.length >= 1) { ez = z[0][0]; } } else if (data.countText && data.countText.runs && data.countText.runs.length >= 1) { let max = -1; const z = data.countText.runs.map((e) => { let c = e.text.replace(/\D+/g, "").length; if (c > max) max = c; return [e.text, c]; }).filter((a) => a[1] === max); if (z.length >= 1) { ez = z[0][0]; } } const cmCount = document.querySelector("#tyt-cm-count"); if (ez) { hostElement.setAttribute111("field-of-cm-count", ""); cmCount && (cmCount.textContent = ez.trim()); } else { hostElement.removeAttribute000("field-of-cm-count"); cmCount && (cmCount.textContent = ""); } } }, "ytd-expander::defined": (cProto) => { if (!cProto.attached498 && typeof cProto.attached === "function") { cProto.attached498 = cProto.attached; cProto.attached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-expander::attached"]).catch(console.warn); return this.attached498(); }; } if (!cProto.detached498 && typeof cProto.detached === "function") { cProto.detached498 = cProto.detached; cProto.detached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-expander::detached"]).catch(console.warn); return this.detached498(); }; } if (!cProto.calculateCanCollapse498 && typeof cProto.calculateCanCollapse === "function") { cProto.calculateCanCollapse498 = cProto.calculateCanCollapse; cProto.calculateCanCollapse = funcCanCollapse; } if (!cProto.childrenChanged498 && typeof cProto.childrenChanged === "function") { cProto.childrenChanged498 = cProto.childrenChanged; cProto.childrenChanged = function() { Promise.resolve(this.hostElement).then(eventMap["ytd-expander::childrenChanged"]).catch(console.warn); return this.childrenChanged498(); }; } makeInitAttached("ytd-expander"); }, "ytd-expander::childrenChanged": (hostElement) => { if (hostElement instanceof Node && hostElement.hasAttribute000("hidden") && hostElement.hasAttribute000("tyt-main-info") && hostElement.firstElementChild) { hostElement.removeAttribute("hidden"); } }, "ytd-expandable-video-description-body-renderer::defined": (cProto) => { if (!cProto.attached498 && typeof cProto.attached === "function") { cProto.attached498 = cProto.attached; cProto.attached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-expandable-video-description-body-renderer::attached"]).catch(console.warn); return this.attached498(); }; } if (!cProto.detached498 && typeof cProto.detached === "function") { cProto.detached498 = cProto.detached; cProto.detached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-expandable-video-description-body-renderer::detached"]).catch(console.warn); return this.detached498(); }; } makeInitAttached("ytd-expandable-video-description-body-renderer"); }, "ytd-expandable-video-description-body-renderer::attached": async (hostElement) => { if (hostElement instanceof HTMLElement_ && isPageDOM(hostElement, "[tyt-info-renderer]") && !hostElement.matches("[tyt-main-info]")) { elements.infoExpander = hostElement; infoExpanderElementProvidedPromise.resolve(); hostElement.setAttribute111("tyt-main-info", ""); if (plugin.autoExpandInfoDesc.toUse) { plugin.autoExpandInfoDesc.onMainInfoSet(hostElement); } const lockId = lockSet["rightTabReadyLock03"]; await rightTabsProvidedPromise.then(); if (lockGet["rightTabReadyLock03"] !== lockId) return; if (elements.infoExpander !== hostElement) return; if (hostElement.isConnected === false) return; elements.infoExpander.classList.add("tyt-main-info"); const infoExpander = elements.infoExpander; const inlineExpanderElm = infoExpander.querySelector("ytd-text-inline-expander"); if (inlineExpanderElm) { const mo = new MutationObserver(() => { const p = document.querySelector("#tab-info ytd-text-inline-expander"); sessionStorage.__$tmp_UseAutoExpandInfoDesc$__ = p && p.hasAttribute("is-expanded") ? "1" : ""; if (p) fixInlineExpanderContent(); }); mo.observe(inlineExpanderElm, { attributes: ["is-expanded", "attr-6v8qu", "hidden"], subtree: true }); inlineExpanderElm.incAttribute111("attr-6v8qu"); const cnt = insp(inlineExpanderElm); if (cnt) fixInlineExpanderDisplay(cnt); } if (infoExpander && !infoExpander.closest("#right-tabs")) { document.querySelector("#tab-info").assignChildren111(null, infoExpander, null); } else { if (document.querySelector('[tyt-tab-content="#tab-info"]')) { const shouldTabVisible = elements.infoExpander && elements.infoExpander.closest("#tab-info"); document.querySelector('[tyt-tab-content="#tab-info"]').classList.toggle("tab-btn-hidden", !shouldTabVisible); } } Promise.resolve(lockSet["infoFixLock"]).then(infoFix).catch(console.warn); } DEBUG_5084 && void 0; if (hostElement instanceof Element) hostElement[__attachedSymbol__] = true; if (!(hostElement instanceof HTMLElement_) || !(hostElement.classList.length > 0) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== true) return; if (isPageDOM(hostElement, "#tab-info [tyt-main-info]")) { } else if (!hostElement.closest("#tab-info")) { const bodyRenderer = hostElement; let bodyRendererNew = document.querySelector("ytd-expandable-video-description-body-renderer[tyt-info-renderer]"); if (!bodyRendererNew) { bodyRendererNew = document.createElement("ytd-expandable-video-description-body-renderer"); bodyRendererNew.setAttribute("tyt-info-renderer", ""); nsTemplateObtain().appendChild(bodyRendererNew); } const cnt = insp(bodyRendererNew); cnt.data = Object.assign({}, insp(bodyRenderer).data); const inlineExpanderElm = bodyRendererNew.querySelector("ytd-text-inline-expander"); const inlineExpanderCnt = insp(inlineExpanderElm); fixInlineExpanderMethods(inlineExpanderCnt); elements.infoExpanderRendererBack = bodyRenderer; elements.infoExpanderRendererFront = bodyRendererNew; bodyRenderer.setAttribute("tyt-info-renderer-back", ""); bodyRendererNew.setAttribute("tyt-info-renderer-front", ""); } }, "ytd-expandable-video-description-body-renderer::detached": async (hostElement) => { if (!(hostElement instanceof HTMLElement_) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== false) return; if (hostElement.hasAttribute000("tyt-main-info")) { DEBUG_5084 && void 0; elements.infoExpander = null; hostElement.removeAttribute000("tyt-main-info"); } }, "ytd-expander::attached": async (hostElement) => { if (invalidFlexyParent(hostElement)) return; if (hostElement instanceof Element) hostElement[__attachedSymbol__] = true; if (!(hostElement instanceof HTMLElement_) || !(hostElement.classList.length > 0) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== true) return; if (hostElement instanceof HTMLElement_ && hostElement.matches("[tyt-comments-area] #contents ytd-expander#expander") && !hostElement.matches("[hidden] ytd-expander#expander")) { hostElement.setAttribute111("tyt-content-comment-entry", ""); ioComment.observe(hostElement); } }, "ytd-expander::detached": (hostElement) => { if (!(hostElement instanceof HTMLElement_) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== false) return; if (hostElement.hasAttribute000("tyt-content-comment-entry")) { ioComment.unobserve(hostElement); hostElement.removeAttribute000("tyt-content-comment-entry"); } else if (hostElement.hasAttribute000("tyt-main-info")) { DEBUG_5084 && void 0; elements.infoExpander = null; hostElement.removeAttribute000("tyt-main-info"); } }, "ytd-live-chat-frame::defined": (cProto) => { let lastDomAction = 0; if (!cProto.attached498 && typeof cProto.attached === "function") { cProto.attached498 = cProto.attached; cProto.attached = function() { lastDomAction = Date.now(); if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-live-chat-frame::attached"]).catch(console.warn); return this.attached498(); }; } if (!cProto.detached498 && typeof cProto.detached === "function") { cProto.detached498 = cProto.detached; cProto.detached = function() { lastDomAction = Date.now(); if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-live-chat-frame::detached"]).catch(console.warn); return this.detached498(); }; } if (typeof cProto.urlChanged === "function" && !cProto.urlChanged66 && !cProto.urlChangedAsync12 && cProto.urlChanged.length === 0) { cProto.urlChanged66 = cProto.urlChanged; let ath = 0; cProto.urlChangedAsync12 = async function() { await this.__urlChangedAsyncT689__; const t = ath = (ath & 1073741823) + 1; const chatframe = this.chatframe || (this.$ || 0).chatframe || 0; if (chatframe instanceof HTMLIFrameElement) { if (chatframe.contentDocument === null) { await Promise.resolve("#").catch(console.warn); if (t !== ath) return; } await new Promise((resolve) => setTimeout_(resolve, 1)).catch(console.warn); if (t !== ath) return; const isBlankPage = !this.data || this.collapsed; const p1 = new Promise((resolve) => setTimeout_(resolve, 706)).catch(console.warn); const p2 = new Promise((resolve) => { new IntersectionObserver((entries, observer) => { for (const entry of entries) { const rect = entry.boundingClientRect || 0; if (isBlankPage || rect.width > 0 && rect.height > 0) { observer.disconnect(); resolve("#"); break; } } }).observe(chatframe); }).catch(console.warn); await Promise.race([p1, p2]); if (t !== ath) return; } this.urlChanged66(); }; cProto.urlChanged = function() { const t = this.__urlChangedAsyncT688__ = (this.__urlChangedAsyncT688__ & 1073741823) + 1; nextBrowserTick(() => { if (t !== this.__urlChangedAsyncT688__) return; this.urlChangedAsync12(); }); }; } makeInitAttached("ytd-live-chat-frame"); }, "ytd-live-chat-frame::attached": async (hostElement) => { if (invalidFlexyParent(hostElement)) return; DEBUG_5084 && void 0; if (hostElement instanceof Element) hostElement[__attachedSymbol__] = true; if (!(hostElement instanceof HTMLElement_) || !(hostElement.classList.length > 0) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== true) return; if (!hostElement || hostElement.id !== "chat") return; const lockId = lockSet["ytdLiveAttachedLock"]; const chatElem = await getGeneralChatElement(); if (lockGet["ytdLiveAttachedLock"] !== lockId) return; if (chatElem === hostElement) { elements.chat = chatElem; aoChat.observe(chatElem, { attributes: true }); const isFlexyReady = elements.flexy instanceof Element; chatElem.setAttribute111("tyt-active-chat-frame", isFlexyReady ? "CF" : "C"); const chatContainer = chatElem ? chatElem.closest("#chat-container") || chatElem : null; if (chatContainer && !chatContainer.hasAttribute000("tyt-chat-container")) { for (const p2 of document.querySelectorAll("[tyt-chat-container]")) { p2.removeAttribute000("[tyt-chat-container]"); } chatContainer.setAttribute111("tyt-chat-container", ""); } const cnt = insp(hostElement); const q = cnt.__urlChangedAsyncT688__; const p = cnt.__urlChangedAsyncT689__ = new PromiseExternal(); setTimeout_(() => { if (p !== cnt.__urlChangedAsyncT689__) return; if (cnt.isAttached === true && hostElement.isConnected === true) { p.resolve(); if (q === cnt.__urlChangedAsyncT688__) { cnt.urlChanged(); } } }, 320); Promise.resolve(lockSet["layoutFixLock"]).then(layoutFix); } else { } }, "ytd-live-chat-frame::detached": (hostElement) => { DEBUG_5084 && void 0; if (!(hostElement instanceof HTMLElement_) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== false) return; if (hostElement.hasAttribute000("tyt-active-chat-frame")) { aoChat.disconnect(); aoChat.takeRecords(); hostElement.removeAttribute000("tyt-active-chat-frame"); elements.chat = null; const ytdFlexyElm = elements.flexy; if (ytdFlexyElm) { ytdFlexyElm.removeAttribute000("tyt-chat-collapsed"); ytdFlexyElm.setAttribute111("tyt-chat", ""); } } }, "ytd-engagement-panel-section-list-renderer::defined": (cProto) => { if (!cProto.attached498 && typeof cProto.attached === "function") { cProto.attached498 = cProto.attached; cProto.attached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-engagement-panel-section-list-renderer::attached"]).catch(console.warn); return this.attached498(); }; } if (!cProto.detached498 && typeof cProto.detached === "function") { cProto.detached498 = cProto.detached; cProto.detached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-engagement-panel-section-list-renderer::detached"]).catch(console.warn); return this.detached498(); }; } makeInitAttached("ytd-engagement-panel-section-list-renderer"); }, "ytd-engagement-panel-section-list-renderer::bindTarget": (hostElement) => { if (hostElement.matches("#panels.ytd-watch-flexy > ytd-engagement-panel-section-list-renderer[target-id][visibility]")) { hostElement.setAttribute111("tyt-egm-panel", ""); Promise.resolve(lockSet["updateEgmPanelsLock"]).then(updateEgmPanels).catch(console.warn); aoEgmPanels.observe(hostElement, { attributes: true, attributeFilter: ["visibility", "hidden"] }); } }, "ytd-engagement-panel-section-list-renderer::attached": (hostElement) => { if (invalidFlexyParent(hostElement)) return; DEBUG_5084 && void 0; if (hostElement instanceof Element) hostElement[__attachedSymbol__] = true; if (!(hostElement instanceof HTMLElement_) || !(hostElement.classList.length > 0) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== true) return; if (!hostElement.matches("#panels.ytd-watch-flexy > ytd-engagement-panel-section-list-renderer")) return; if (hostElement.hasAttribute000("target-id") && hostElement.hasAttribute000("visibility")) { Promise.resolve(hostElement).then(eventMap["ytd-engagement-panel-section-list-renderer::bindTarget"]).catch(console.warn); } else { hostElement.setAttribute000("tyt-egm-panel-jclmd", ""); moEgmPanelReady.observe(hostElement, { attributes: true, attributeFilter: ["visibility", "target-id"] }); } }, "ytd-engagement-panel-section-list-renderer::detached": (hostElement) => { DEBUG_5084 && void 0; if (!(hostElement instanceof HTMLElement_) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== false) return; if (hostElement.hasAttribute000("tyt-egm-panel")) { hostElement.removeAttribute000("tyt-egm-panel"); Promise.resolve(lockSet["updateEgmPanelsLock"]).then(updateEgmPanels).catch(console.warn); } else if (hostElement.hasAttribute000("tyt-egm-panel-jclmd")) { hostElement.removeAttribute000("tyt-egm-panel-jclmd"); moEgmPanelReadyClearFn(); } }, "ytd-watch-metadata::defined": (cProto) => { if (!cProto.attached498 && typeof cProto.attached === "function") { cProto.attached498 = cProto.attached; cProto.attached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-watch-metadata::attached"]).catch(console.warn); return this.attached498(); }; } if (!cProto.detached498 && typeof cProto.detached === "function") { cProto.detached498 = cProto.detached; cProto.detached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-watch-metadata::detached"]).catch(console.warn); return this.detached498(); }; } makeInitAttached("ytd-watch-metadata"); }, "ytd-watch-metadata::attached": (hostElement) => { if (invalidFlexyParent(hostElement)) return; DEBUG_5084 && void 0; if (hostElement instanceof Element) hostElement[__attachedSymbol__] = true; if (!(hostElement instanceof HTMLElement_) || !(hostElement.classList.length > 0) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== true) return; if (plugin.fullChannelNameOnHover.activated) plugin.fullChannelNameOnHover.onNavigateFinish(); }, "ytd-watch-metadata::detached": (hostElement) => { DEBUG_5084 && void 0; if (!(hostElement instanceof HTMLElement_) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== false) return; }, "ytd-playlist-panel-renderer::defined": (cProto) => { if (!cProto.attached498 && typeof cProto.attached === "function") { cProto.attached498 = cProto.attached; cProto.attached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-playlist-panel-renderer::attached"]).catch(console.warn); return this.attached498(); }; } if (!cProto.detached498 && typeof cProto.detached === "function") { cProto.detached498 = cProto.detached; cProto.detached = function() { if (!inPageRearrange) Promise.resolve(this.hostElement).then(eventMap["ytd-playlist-panel-renderer::detached"]).catch(console.warn); return this.detached498(); }; } makeInitAttached("ytd-playlist-panel-renderer"); }, "ytd-playlist-panel-renderer::attached": (hostElement) => { if (invalidFlexyParent(hostElement)) return; DEBUG_5084 && void 0; if (hostElement instanceof Element) hostElement[__attachedSymbol__] = true; if (!(hostElement instanceof HTMLElement_) || !(hostElement.classList.length > 0) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== true) return; elements.playlist = hostElement; aoPlayList.observe(hostElement, { attributes: true, attributeFilter: ["hidden", "collapsed", "attr-1y6nu"] }); hostElement.incAttribute111("attr-1y6nu"); }, "ytd-playlist-panel-renderer::detached": (hostElement) => { DEBUG_5084 && void 0; if (!(hostElement instanceof HTMLElement_) || hostElement.closest("noscript")) return; if (hostElement.isConnected !== false) return; }, "_yt_playerProvided": () => { mLoaded.flag |= 4; document.documentElement.setAttribute111("tabview-loaded", mLoaded.makeString()); }, "relatedElementProvided": (target) => { if (target.closest("[hidden]")) return; elements.related = target; videosElementProvidedPromise.resolve(); }, "onceInfoExpanderElementProvidedPromised": () => { const ytdFlexyElm = elements.flexy; if (ytdFlexyElm) { ytdFlexyElm.setAttribute111("hide-default-text-inline-expander", ""); } }, "refreshSecondaryInner": (lockId) => { if (lockGet["refreshSecondaryInnerLock"] !== lockId) return; const ytdFlexyElm = elements.flexy; if (ytdFlexyElm && ytdFlexyElm.matches("ytd-watch-flexy[theater][flexy][full-bleed-player]:not([full-bleed-no-max-width-columns])")) { ytdFlexyElm.setAttribute111("full-bleed-no-max-width-columns", ""); } const related = elements.related; if (related && related.isConnected && !related.closest("#right-tabs #tab-videos")) { document.querySelector("#tab-videos").assignChildren111(null, related, null); } const infoExpander = elements.infoExpander; if (infoExpander && infoExpander.isConnected && !infoExpander.closest("#right-tabs #tab-info")) { document.querySelector("#tab-info").assignChildren111(null, infoExpander, null); } else { } const commentsArea = elements.comments; if (commentsArea) { const isConnected = commentsArea.isConnected; if (isConnected && !commentsArea.closest("#right-tabs #tab-comments")) { const tab = document.querySelector("#tab-comments"); tab.assignChildren111(null, commentsArea, null); } else { } } }, "yt-navigate-finish": (evt) => { const ytdAppElm = document.querySelector("ytd-page-manager#page-manager.style-scope.ytd-app"); const ytdAppCnt = insp(ytdAppElm); pageType = ytdAppCnt ? (ytdAppCnt.data || 0).page : null; if (!document.querySelector("ytd-watch-flexy #player")) return; const flexyArr = [...document.querySelectorAll("ytd-watch-flexy")].filter((e) => !e.closest("[hidden]") && e.querySelector("#player")); if (flexyArr.length === 1) { elements.flexy = flexyArr[0]; if (isRightTabsInserted) { Promise.resolve(lockSet["refreshSecondaryInnerLock"]).then(eventMap["refreshSecondaryInner"]).catch(console.warn); Promise.resolve(lockSet["removeKeepCommentsScrollerLock"]).then(removeKeepCommentsScroller).catch(console.warn); } else { navigateFinishedPromise.resolve(); if (plugin.minibrowser.toUse) plugin.minibrowser.activate(); if (plugin.autoExpandInfoDesc.toUse) plugin.autoExpandInfoDesc.activate(); if (plugin.fullChannelNameOnHover.toUse) plugin.fullChannelNameOnHover.activate(); } const chat = elements.chat; if (chat instanceof Element) { chat.setAttribute111("tyt-active-chat-frame", "CF"); } const infoExpander = elements.infoExpander; if (infoExpander && infoExpander.closest("#right-tabs")) { Promise.resolve(lockSet["infoFixLock"]).then(infoFix).catch(console.warn); } Promise.resolve(lockSet["layoutFixLock"]).then(layoutFix); if (plugin.fullChannelNameOnHover.activated) plugin.fullChannelNameOnHover.onNavigateFinish(); } }, "onceInsertRightTabs": () => { const related = elements.related; let rightTabs = document.querySelector("#right-tabs"); if (!document.querySelector("#right-tabs") && related) { getLangForPage(); let docTmp = document.createElement("template"); docTmp.innerHTML = createHTML(getTabsHTML()); let newElm = docTmp.content.firstElementChild; if (newElm !== null) { inPageRearrange = true; related.parentNode.insertBefore000(newElm, related); inPageRearrange = false; } rightTabs = newElm; rightTabs.querySelector('[tyt-tab-content="#tab-comments"]').classList.add("tab-btn-hidden"); const secondaryWrapper = document.createElement("secondary-wrapper"); const secondaryInner = document.querySelector("#secondary-inner.style-scope.ytd-watch-flexy"); inPageRearrange = true; secondaryWrapper.replaceChildren000(...secondaryInner.childNodes); secondaryInner.insertBefore000(secondaryWrapper, secondaryInner.firstChild); inPageRearrange = false; rightTabs.querySelector("#material-tabs").addEventListener("click", eventMap["tabs-btn-click"], true); inPageRearrange = true; if (!rightTabs.closest("secondary-wrapper")) secondaryWrapper.appendChild000(rightTabs); inPageRearrange = false; } if (rightTabs) { isRightTabsInserted = true; const ioTabBtns = new IntersectionObserver((entries) => { for (const entry of entries) { const rect = entry.boundingClientRect; entry.target.classList.toggle("tab-btn-visible", rect.width && rect.height); } }, { rootMargin: "0px" }); for (const btn of document.querySelectorAll(".tab-btn[tyt-tab-content]")) { ioTabBtns.observe(btn); } if (!related.closest("#right-tabs")) { document.querySelector("#tab-videos").assignChildren111(null, related, null); } const infoExpander = elements.infoExpander; if (infoExpander && !infoExpander.closest("#right-tabs")) { document.querySelector("#tab-info").assignChildren111(null, infoExpander, null); } const commentsArea = elements.comments; if (commentsArea && !commentsArea.closest("#right-tabs")) { document.querySelector("#tab-comments").assignChildren111(null, commentsArea, null); } rightTabsProvidedPromise.resolve(); roRightTabs.disconnect(); roRightTabs.observe(rightTabs); const ytdFlexyElm = elements.flexy; const aoFlexy = new MutationObserver(eventMap["aoFlexyFn"]); aoFlexy.observe(ytdFlexyElm, { attributes: true }); Promise.resolve(lockSet["fixInitialTabStateLock"]).then(eventMap["fixInitialTabStateFn"]).catch(console.warn); ytdFlexyElm.incAttribute111("attr-7qlsy"); } }, "aoFlexyFn": () => { Promise.resolve(lockSet["checkCommentsShouldBeHiddenLock"]).then(eventMap["checkCommentsShouldBeHidden"]).catch(console.warn); Promise.resolve(lockSet["refreshSecondaryInnerLock"]).then(eventMap["refreshSecondaryInner"]).catch(console.warn); Promise.resolve(lockSet["tabsStatusCorrectionLock"]).then(eventMap["tabsStatusCorrection"]).catch(console.warn); const videoId = getCurrentVideoId(); if (videoId !== tmpLastVideoId) { tmpLastVideoId = videoId; Promise.resolve(lockSet["updateOnVideoIdChangedLock"]).then(eventMap["updateOnVideoIdChanged"]).catch(console.warn); } }, "twoColumnChanged10": (lockId) => { if (lockId !== lockGet["twoColumnChanged10Lock"]) return; for (const continuation of document.querySelectorAll("#tab-videos ytd-watch-next-secondary-results-renderer ytd-continuation-item-renderer")) { if (continuation.closest("[hidden]")) continue; const cnt = insp(continuation); if (typeof cnt.showButton === "boolean") { if (cnt.showButton === false) continue; cnt.showButton = false; const behavior = cnt.ytRendererBehavior || cnt; if (typeof behavior.invalidate === "function") { behavior.invalidate(false); } } } }, "tabsStatusCorrection": (lockId) => { if (lockId !== lockGet["tabsStatusCorrectionLock"]) return; const ytdFlexyElm = elements.flexy; if (!ytdFlexyElm) return; const p = tabAStatus; const q = calculationFn(p, 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128); let resetForPanelDisappeared = false; if (p !== q) { let actioned = false; if ((p & 128) === 0 && (q & 128) === 128) { lastPanel = "playlist"; } else if ((p & 8) === 0 && (q & 8) === 8) { lastPanel = "chat"; } else if (((p & 4) == 4 && (q & (4 | 8)) == (0 | 0) || (p & 8) == 8 && (q & (4 | 8)) === (0 | 0)) && lastPanel === "chat") { lastPanel = lastTab || ""; resetForPanelDisappeared = true; } else if ((p & (4 | 8)) === 8 && (q & (4 | 8)) === 4 && lastPanel === "chat") { lastPanel = lastTab || ""; resetForPanelDisappeared = true; } else if ((p & 128) === 128 && (q & 128) === 0 && lastPanel === "playlist") { lastPanel = lastTab || ""; resetForPanelDisappeared = true; } tabAStatus = q; let bFixForResizedTab = false; if ((q ^ 2) === 2 && bFixForResizedTabLater) { bFixForResizedTab = true; } if ((p & 16) === 16 & (q & 16) === 0) { Promise.resolve(lockSet["twoColumnChanged10Lock"]).then(eventMap["twoColumnChanged10"]).catch(console.warn); } if ((p & 2) === 2 ^ (q & 2) === 2 && (q & 2) === 2) { bFixForResizedTab = true; } if ((p & 2) === 0 && (q & 2) === 2 && (p & 128) === 128 && (q & 128) === 128) { lastPanel = lastTab || ""; ytBtnClosePlaylist(); actioned = true; } if ((p & (8 | 128)) === (0 | 128) && (q & (8 | 128)) === (8 | 128) && lastPanel === "chat") { lastPanel = lastTab || ""; ytBtnClosePlaylist(); actioned = true; } if ((p & (2 | 128)) === (2 | 0) && (q & (2 | 128)) === (2 | 128) && lastPanel === "playlist") { switchToTab(null); actioned = true; } if ((p & (8 | 128)) === (8 | 0) && (q & (8 | 128)) === (8 | 128) && lastPanel === "playlist") { lastPanel = lastTab || ""; ytBtnCollapseChat(); actioned = true; } if ((p & (1 | 16 | 128)) == (1 | 16) && (q & (1 | 16 | 128)) == (1 | 16 | 128)) { ytBtnCancelTheater(); actioned = true; } if ((p & (1 | 16 | 128)) == (16 | 128) && (q & (1 | 16 | 128)) == (1 | 16 | 128)) { lastPanel = lastTab || ""; ytBtnClosePlaylist(); actioned = true; } if ((q & 64) === 64) { actioned = false; } else if ((p & 64) == 64 && (q & 64) === 0) { if ((q & 32) === 32) { ytBtnCloseEngagementPanels(); } if ((q & (2 | 8)) === (2 | 8)) { if (lastPanel === "chat") { switchToTab(null); actioned = true; } else if (lastPanel) { ytBtnCollapseChat(); actioned = true; } } } else if ((p & (1 | 2 | 8 | 16 | 32)) === (1 | 0 | 0 | 16 | 0) && (q & (1 | 2 | 8 | 16 | 32)) === (1 | 0 | 8 | 16 | 0)) { ytBtnCancelTheater(); actioned = true; } else if ((p & (1 | 16 | 32)) === (0 | 16 | 0) && (q & (1 | 16 | 32)) === (0 | 16 | 32) && (q & (2 | 8)) > 0) { if (q & 2) { switchToTab(null); actioned = true; } if (q & 8) { ytBtnCollapseChat(); actioned = true; } } else if ((p & (1 | 16 | 8 | 2)) === (16 | 8) && (q & (1 | 16 | 8 | 2)) === 16 && (q & 128) === 0) { if (lastTab) { switchToTab(lastTab); actioned = true; } } else if ((p & 1) === 0 && (q & 1) === 1) { if ((q & 32) === 32) { ytBtnCloseEngagementPanels(); } if ((p & 9) === 8 && (q & 9) === 9) { ytBtnCollapseChat(); } switchToTab(null); actioned = true; } else if ((p & 3) === 1 && (q & 3) === 3) { ytBtnCancelTheater(); actioned = true; } else if ((p & 10) === 2 && (q & 10) === 10) { switchToTab(null); actioned = true; } else if ((p & (8 | 32)) === (0 | 32) && (q & (8 | 32)) === (8 | 32)) { ytBtnCloseEngagementPanels(); actioned = true; } else if ((p & (2 | 32)) === (0 | 32) && (q & (2 | 32)) === (2 | 32)) { ytBtnCloseEngagementPanels(); actioned = true; } else if ((p & (2 | 8)) === (0 | 8) && (q & (2 | 8)) === (2 | 8)) { ytBtnCollapseChat(); actioned = true; } else if ((p & 1) === 1 && (q & (1 | 32)) === (0 | 0)) { if (lastPanel === "chat") { ytBtnExpandChat(); actioned = true; } else if (lastPanel === lastTab && lastTab) { switchToTab(lastTab); actioned = true; } } if (!actioned && (q & 128) === 128) { lastPanel = "playlist"; if ((q & 2) === 2) { switchToTab(null); actioned = true; } } if ((p & 2) === 2 && (q & (2 | 128)) === (0 | 128)) { } else if ((p & 8) === 8 && (q & (8 | 128)) === (0 | 128)) { } else if (!actioned && (p & (1 | 16)) === 16 && (q & (1 | 16 | 8 | 2 | 32 | 64)) === (16 | 0 | 0)) { if (lastPanel === "chat") { ytBtnExpandChat(); actioned = true; } else if (lastPanel === "playlist") { ytBtnOpenPlaylist(); actioned = true; } else if (lastTab) { switchToTab(lastTab); actioned = true; } else if (resetForPanelDisappeared) { Promise.resolve(lockSet["fixInitialTabStateLock"]).then(eventMap["fixInitialTabStateFn"]).catch(console.warn); actioned = true; } } if (bFixForResizedTab) { bFixForResizedTabLater = false; Promise.resolve(0).then(eventMap["fixForTabDisplay"]).catch(console.warn); } if ((p & 16) === 16 ^ (q & 16) === 16) { Promise.resolve(lockSet["infoFixLock"]).then(infoFix).catch(console.warn); Promise.resolve(lockSet["removeKeepCommentsScrollerLock"]).then(removeKeepCommentsScroller).catch(console.warn); Promise.resolve(lockSet["layoutFixLock"]).then(layoutFix).catch(console.warn); } } }, "updateOnVideoIdChanged": (lockId) => { if (lockId !== lockGet["updateOnVideoIdChangedLock"]) return; const videoId = tmpLastVideoId; if (!videoId) return; const bodyRenderer = elements.infoExpanderRendererBack; const bodyRendererNew = elements.infoExpanderRendererFront; if (bodyRendererNew && bodyRenderer) { insp(bodyRendererNew).data = insp(bodyRenderer).data; } Promise.resolve(lockSet["infoFixLock"]).then(infoFix).catch(console.warn); }, "fixInitialTabStateFn": async (lockId) => { if (lockGet["fixInitialTabStateLock"] !== lockId) return; const delayTime = fixInitialTabStateK > 0 ? 200 : 1; await delayPn(delayTime); if (lockGet["fixInitialTabStateLock"] !== lockId) return; const kTab = document.querySelector("[tyt-tab]"); const qTab = !kTab || kTab.getAttribute("tyt-tab") === "" ? checkElementExist("ytd-watch-flexy[is-two-columns_]", "[hidden]") : null; if (checkElementExist("ytd-playlist-panel-renderer#playlist", "[hidden], [collapsed]")) { switchToTab(null); } else if (checkElementExist("ytd-live-chat-frame#chat", "[hidden], [collapsed]")) { switchToTab(null); if (checkElementExist("ytd-watch-flexy[theater]", "[hidden]")) { ytBtnCollapseChat(); } } else if (qTab) { const hasTheater = qTab.hasAttribute("theater"); if (!hasTheater) { const btn0 = document.querySelector(".tab-btn-visible"); if (btn0) { switchToTab(btn0); } else { switchToTab(null); } } else { switchToTab(null); } } else { } fixInitialTabStateK++; }, "tabs-btn-click": (evt) => { const target = evt.target; if (target instanceof HTMLElement_ && target.classList.contains("tab-btn") && target.hasAttribute000("tyt-tab-content")) { evt.preventDefault(); evt.stopPropagation(); evt.stopImmediatePropagation(); const activeLink = target; switchToTab(activeLink); } } }; Promise.all([videosElementProvidedPromise, navigateFinishedPromise]).then(eventMap["onceInsertRightTabs"]).catch(console.warn); Promise.all([navigateFinishedPromise, infoExpanderElementProvidedPromise]).then(eventMap["onceInfoExpanderElementProvidedPromised"]).catch(console.warn); const isCustomElementsProvided = typeof customElements !== "undefined" && typeof (customElements || 0).whenDefined === "function"; const promiseForCustomYtElementsReady = isCustomElementsProvided ? Promise.resolve(0) : new Promise((callback) => { const EVENT_KEY_ON_REGISTRY_READY = "ytI-ce-registry-created"; if (typeof customElements === "undefined") { if (!("__CE_registry" in document)) { Object.defineProperty(document, "__CE_registry", { get() { }, set(nv) { if (typeof nv == "object") { delete this.__CE_registry; this.__CE_registry = nv; this.dispatchEvent(new CustomEvent(EVENT_KEY_ON_REGISTRY_READY)); } return true; }, enumerable: false, configurable: true }); } let eventHandler = (evt) => { document.removeEventListener(EVENT_KEY_ON_REGISTRY_READY, eventHandler, false); const f = callback; callback = null; eventHandler = null; f(); }; document.addEventListener(EVENT_KEY_ON_REGISTRY_READY, eventHandler, false); } else { callback(); } }); const _retrieveCE = async (nodeName) => { try { isCustomElementsProvided || await promiseForCustomYtElementsReady; await customElements.whenDefined(nodeName); } catch (e) { } }; const retrieveCE = async (nodeName) => { try { isCustomElementsProvided || await promiseForCustomYtElementsReady; await customElements.whenDefined(nodeName); const dummy = document.querySelector(nodeName) || document.createElement(nodeName); const cProto = insp(dummy).constructor.prototype; return cProto; } catch (e) { } }; const moOverallRes = { _yt_playerProvided: () => (window || 0)._yt_player || 0 || 0 }; let promiseWaitNext = null; const moOverall = new MutationObserver(() => { if (promiseWaitNext) { promiseWaitNext.resolve(); promiseWaitNext = null; } if (typeof moOverallRes._yt_playerProvided === "function") { const r = moOverallRes._yt_playerProvided(); if (r) { moOverallRes._yt_playerProvided = r; eventMap._yt_playerProvided(); } } }); moOverall.observe(document, { subtree: true, childList: true }); const moEgmPanelReady = new MutationObserver((mutations) => { for (const mutation of mutations) { const target = mutation.target; if (!target.hasAttribute000("tyt-egm-panel-jclmd")) continue; if (target.hasAttribute000("target-id") && target.hasAttribute000("visibility")) { target.removeAttribute000("tyt-egm-panel-jclmd"); moEgmPanelReadyClearFn(); Promise.resolve(target).then(eventMap["ytd-engagement-panel-section-list-renderer::bindTarget"]).catch(console.warn); } } }); const moEgmPanelReadyClearFn = () => { if (document.querySelector("[tyt-egm-panel-jclmd]") === null) { moEgmPanelReady.takeRecords(); moEgmPanelReady.disconnect(); } }; document.addEventListener("yt-navigate-finish", eventMap["yt-navigate-finish"], false); document.addEventListener("animationstart", (evt) => { const f = eventMap[evt.animationName]; if (typeof f === "function") f(evt.target); }, capturePassive); mLoaded.flag |= 1; document.documentElement.setAttribute111("tabview-loaded", mLoaded.makeString()); promiseForCustomYtElementsReady.then(eventMap["ceHack"]).catch(console.warn); executionFinished = 1; } catch (e) { } }; var css_248z = ".html5-play-progress,.ytp-play-progress{background:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAMCAIAAAAs6UAAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUNCQzIyREQ0QjdEMTFFMzlEMDM4Qzc3MEY0NzdGMDgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUNCQzIyREU0QjdEMTFFMzlEMDM4Qzc3MEY0NzdGMDgiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQ0JDMjJEQjRCN0QxMUUzOUQwMzhDNzcwRjQ3N0YwOCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQ0JDMjJEQzRCN0QxMUUzOUQwMzhDNzcwRjQ3N0YwOCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PovDFgYAAAAmSURBVHjaYvjPwMAAxjMZmBhA9H8INv4P4TPM/A+m04zBNECAAQBCWQv9SUQpVgAAAABJRU5ErkJggg==\") repeat-x!important;background:linear-gradient(180deg,red 0,red 16.5%,#f90 0,#f90 33%,#ff0 0,#ff0 50%,#3f0 0,#3f0 66%,#09f 0,#09f 83.5%,#63f 0,#63f)!important;background:-webkit-linear-gradient(top,red,red 16.5%,#f90 0,#f90 33%,#ff0 0,#ff0 50%,#3f0 0,#3f0 66%,#09f 0,#09f 83.5%,#63f 0,#63f)!important;background:-moz-linear-gradient(top,red 0,red 16.5%,#f90 16.5%,#f90 33%,#ff0 33%,#ff0 50%,#3f0 50%,#3f0 66%,#09f 66%,#09f 83.5%,#63f 83.5%,#63f 100%)!important}.html5-load-progress,.ytp-load-progress{background:url(\"data:image/gif;base64,R0lGODlhMAAMAIAAAAxBd////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQECgAAACwAAAAAMAAMAAACJYSPqcvtD6MKstpLr24Z9A2GYvJ544mhXQmxoesElIyCcB3dRgEAIfkEBAoAAAAsAQACAC0ACgAAAiGEj6nLHG0enNQdWbPefOHYhSLydVhJoSYXPO04qrAmJwUAIfkEBAoAAAAsBQABACkACwAAAiGEj6nLwQ8jcC5ViW3evHt1GaE0flxpphn6BNTEqvI8dQUAIfkEBAoAAAAsAQABACoACwAAAiGEj6nLwQ+jcU5VidPNvPtvad0GfmSJeicUUECbxnK0RgUAIfkEBAoAAAAsAAAAACcADAAAAiCEj6mbwQ+ji5QGd6t+c/v2hZzYiVpXmuoKIikLm6hXAAAh+QQECgAAACwAAAAALQAMAAACI4SPqQvBD6NysloTXL480g4uX0iW1Wg21oem7ismLUy/LFwAACH5BAQKAAAALAkAAAAkAAwAAAIghI8Joe0Po0yBWTaz3g/z7UXhMX7kYmplmo0rC8cyUgAAIfkEBAoAAAAsBQAAACUACgAAAh2Ejwmh7Q+jbIFZNrPeEXPudU74IVa5kSiYqOtRAAAh+QQECgAAACwEAAAAIgAKAAACHISPELfpD6OcqTGKs4bWRp+B36YFi0mGaVmtWQEAIfkEBAoAAAAsAAAAACMACgAAAh2EjxC36Q+jnK8xirOW1kavgd+2BYtJhmnpiGtUAAAh+QQECgAAACwAAAAALgALAAACIYSPqcvtD+MKicqLn82c7e6BIhZQ5jem6oVKbfdqQLzKBQAh+QQECgAAACwCAAIALAAJAAACHQx+hsvtD2OStDplKc68r2CEm0eW5uSN6aqe1lgAADs=\")!important}.html5-scrubber-button,.ytp-scrubber-button{background:url(\"data:image/gif;base64,R0lGODlhIgAVAKIHAL3/9/+Zmf8zmf/MmZmZmf+Z/wAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpDMkJBNjY5RTU1NEJFMzExOUM4QUM2MDAwNDQzRERBQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpCREIzOEIzMzRCN0IxMUUzODhEQjgwOTYzMTgyNTE0QiIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpCREIzOEIzMjRCN0IxMUUzODhEQjgwOTYzMTgyNTE0QiIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkM1QkE2NjlFNTU0QkUzMTE5QzhBQzYwMDA0NDNEREFDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkMyQkE2NjlFNTU0QkUzMTE5QzhBQzYwMDA0NDNEREFDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkECQcABwAsAAAAACIAFQAAA6J4umv+MDpG6zEj682zsRaWFWRpltoHMuJZCCRseis7xG5eDGp93bqCA7f7TFaYoIFAMMwczB5EkTzJllEUttmIGoG5bfPBjDawD7CsJC67uWcv2CRov929C/q2ZpcBbYBmLGk6W1BRY4MUDnMvJEsBAXdlknk2fCeRk2iJliAijpBlEmigjR0plKSgpKWvEUheF4tUZqZID1RHjEe8PsDBBwkAIfkECQcABwAsAAAAACIAFQAAA6B4umv+MDpG6zEj682zsRaWFWRpltoHMuJZCCRseis7xG5eDGp93TqS40XiKSYgTLBgIBAMqE/zmQSaZEzns+jQ9pC/5dQJ0VIv5KMVWxqb36opxHrNvu9ptPfGbmsBbgSAeRdydCdjXWRPchQPh1hNAQF4TpM9NnwukpRyi5chGjqJEoSOIh0plaYsZBKvsCuNjY5ptElgDyFIuj6+vwcJACH5BAkHAAcALAAAAAAiABUAAAOfeLrc/vCZSaudUY7Nu99GxhhcYZ7oyYXiQQ5pIZgzCrYuLMd8MbAiUu802flYGIhwaCAQDKpQ86nUoWqF6dP00wIby572SXE6vyMrlmhuu9GKifWaddvNQAtszXYCxgR/Zy5jYTFeXmSDiIZGdQEBd06QSBQ5e4cEkE9nnZQaG2J4F4MSLx8rkqUSZBeurhlTUqsLsi60DpZxSWBJugcJACH5BAkHAAcALAAAAAAiABUAAAOgeLrc/vCZSaudUY7Nu99GxhhcYZ7oyYXiQQ5pIZgzCrYuLMd8MbAiUu802flYGIhwaCAQDKpQ86nUoWqF6dP00wIby572SXE6vyMrlmhuu9GuifWaddvNwMkZtmY7AWMEgGcKY2ExXl5khFMVc0Z1AQF3TpJShDl8iASST2efloV5JTyJFpgOch8dgW9KZxexshGNLqgLtbW0SXFwvaJfCQAh+QQJBwAHACwAAAAAIgAVAAADoXi63P7wmUmrnVGOzbvfRsYYXGGe6MmF4kEOaSGYMwq2LizHfDGwIlLPNKGZfi6gZmggEAy2iVPZEKZqzakq+1xUFFYe90lxTsHmim6HGpvf3eR7skYJ3PC5tyystc0AboFnVXQ9XFJTZIQOYUYFTQEBeWaSVF4bbCeRk1meBJYSL3WbaReMIxQfHXh6jaYXsbEQni6oaF21ERR7l0ksvA0JACH5BAkHAAcALAAAAAAiABUAAAOeeLrc/vCZSaudUY7Nu99GxhhcYZ7oyYXiQQ5pIZgzCrYuLMfFlA4hTITEMxkIBMOuADwmhzqeM6mashTCXKw2TVKQyKuTRSx2wegnNkyJ1ozpOFiMLqcEU8BZHx6NYW8nVlZefQ1tZgQBAXJIi1eHUTRwi0lhl48QL0sogxaGDhMlUo2gh14fHhcVmnOrrxNqrU9joX21Q0IUElm7DQkAIfkECQcABwAsAAAAACIAFQAAA6J4umv+MDpG6zEj682zsRaWFWRpltoHMuJZCCRseis7xG5eDGp93bqCA7f7TFaYoIFAMMwczB5EkTzJllEUttmIGoG5bfPBjDawD7CsJC67uWcv2CRov929C/q2ZpcBbYBmLGk6W1BRY4MUDnMvJEsBAXdlknk2fCeRk2iJliAijpBlEmigjR0plKSgpKWvEUheF4tUZqZID1RHjEe8PsDBBwkAIfkECQcABwAsAAAAACIAFQAAA6B4umv+MDpG6zEj682zsRaWFWRpltoHMuJZCCRseis7xG5eDGp93TqS40XiKSYgTLBgIBAMqE/zmQSaZEzns+jQ9pC/5dQJ0VIv5KMVWxqb36opxHrNvu9ptPfGbmsBbgSAeRdydCdjXWRPchQPh1hNAQF4TpM9NnwukpRyi5chGjqJEoSOIh0plaYsZBKvsCuNjY5ptElgDyFIuj6+vwcJACH5BAkHAAcALAAAAAAiABUAAAOfeLrc/vCZSaudUY7Nu99GxhhcYZ7oyYXiQQ5pIZgzCrYuLMd8MbAiUu802flYGIhwaCAQDKpQ86nUoWqF6dP00wIby572SXE6vyMrlmhuu9GKifWaddvNQAtszXYCxgR/Zy5jYTFeXmSDiIZGdQEBd06QSBQ5e4cEkE9nnZQaG2J4F4MSLx8rkqUSZBeurhlTUqsLsi60DpZxSWBJugcJACH5BAkHAAcALAAAAAAiABUAAAOgeLrc/vCZSaudUY7Nu99GxhhcYZ7oyYXiQQ5pIZgzCrYuLMd8MbAiUu802flYGIhwaCAQDKpQ86nUoWqF6dP00wIby572SXE6vyMrlmhuu9GuifWaddvNwMkZtmY7AWMEgGcKY2ExXl5khFMVc0Z1AQF3TpJShDl8iASST2efloV5JTyJFpgOch8dgW9KZxexshGNLqgLtbW0SXFwvaJfCQAh+QQJBwAHACwAAAAAIgAVAAADoXi63P7wmUmrnVGOzbvfRsYYXGGe6MmF4kEOaSGYMwq2LizHfDGwIlLPNKGZfi6gZmggEAy2iVPZEKZqzakq+1xUFFYe90lxTsHmim6HGpvf3eR7skYJ3PC5tyystc0AboFnVXQ9XFJTZIQOYUYFTQEBeWaSVF4bbCeRk1meBJYSL3WbaReMIxQfHXh6jaYXsbEQni6oaF21ERR7l0ksvA0JACH5BAkHAAcALAAAAAAiABUAAAOeeLrc/vCZSaudUY7Nu99GxhhcYZ7oyYXiQQ5pIZgzCrYuLMfFlA4hTITEMxkIBMOuADwmhzqeM6mashTCXKw2TVKQyKuTRSx2wegnNkyJ1ozpOFiMLqcEU8BZHx6NYW8nVlZefQ1tZgQBAXJIi1eHUTRwi0lhl48QL0sogxaGDhMlUo2gh14fHhcVmnOrrxNqrU9joX21Q0IUElm7DQkAOw==\")!important;border:none!important;height:21px!important;margin-left:-18px!important;margin-top:0!important;transform:scale(.8);-webkit-transform:scale(.8);-moz-transform:scale(.8);-ms-transform:scale(.8);width:34px!important}.ytp-progress-bar-container:hover .ytp-load-progress,.ytp-progress-bar-container:hover .ytp-scrubber-button{image-rendering:pixelated}.html5-progress-bar-container,.ytp-progress-bar-container{height:12px!important}.html5-progress-bar,.ytp-progress-bar{margin-top:12px!important}.html5-progress-list,.video-ads .html5-progress-list.html5-ad-progress-list,.video-ads .ytp-progress-list.ytp-ad-progress-list,.ytp-progress-list{height:12px!important}.ytp-volume-slider-track{background:#0c4177!important}"; const ThemeProgressbar = { start: function() { if (!/youtube\.com/.test(window.location.host)) { return; } GM_addStyle(css_248z); } }; const commonUtil = { onPageLoad: function(callback) { if (document.readyState === "complete") { callback(); } else { window.addEventListener("DOMContentLoaded", callback, { once: true }); window.addEventListener("load", callback, { once: true }); } }, addStyle: function(style) { GM_addStyle(style); }, openInTab: function(url, options = { "active": true, "insert": true, "setParent": true }) { if (typeof GM_openInTab === "function") { GM_openInTab(url, options); } else { GM.openInTab(url, options); } }, waitForElementByInterval: function(selector, target = document.body, allowEmpty = true, delay = 10, maxDelay = 10 * 1e3) { return new Promise((resolve, reject) => { let totalDelay = 0; let element = target.querySelector(selector); let result = allowEmpty ? !!element : !!element && !!element.innerHTML; if (result) { resolve(element); } const elementInterval = setInterval(() => { if (totalDelay >= maxDelay) { clearInterval(elementInterval); resolve(null); } element = target.querySelector(selector); result = allowEmpty ? !!element : !!element && !!element.innerHTML; if (result) { clearInterval(elementInterval); resolve(element); } else { totalDelay += delay; } }, delay); }); } }; const SpeedControl = { currentSpeed: 1, activeAnimationId: null, run: function() { if (!/youtube\.com/.test(window.location.host)) { return new Promise((resolve) => { resolve(); }); } return new Promise((resolve) => { const speedControl = StorageUtil.getValue(StorageUtil.keys.youtube.functionState.speedControl, true); if (!speedControl) { resolve(); return; } const storageSpeed = StorageUtil.getValue(StorageUtil.keys.youtube.videoPlaySpeed, 1); this.currentSpeed = parseFloat(storageSpeed); this.insertStyle(); commonUtil.onPageLoad(async () => { await this.genrate(); this.setVideoRate(storageSpeed); this.videoObserver(); resolve(); }); }); }, insertStyle: function() { const speedBtnStyle = ` .SpeedControl_Extension_Btn_X{ width: 4em !important; float: left; text-align: center !important; border-radius: 0.5em; font-size:13px; } .SpeedControl_Extension_Btn_X:hover{ color:red; font-weight: bold; } `; const speedShowStyle = ` #youtube-extension-text-box { position: absolute!important; margin: auto!important; top: 0px!important; right: 0px!important; bottom: 0px!important; left: 0px!important; border-radius: 20px!important; font-size: 30px!important; background-color: #303031!important; color: #f3f3f3!important; z-index: 99999999999999999!important; opacity: 0.8!important; width: 80px!important; height: 80px!important; line-height: 80px!important; text-align: center!important; padding: 0px!important; } `; const speedOptionsStyle = ` .SpeedControl_Extension_Speed-Options { position: absolute!important; background: #303031!important; color: white!important; border-radius: 5px!important; display: none; bottom: calc(100% + 10px)!important; width:48px!important; } .SpeedControl_Extension_Speed-Options >.SpeedControl_Extension_Speed-Option-Item { cursor: pointer!important; height: 25px!important; line-height: 25px!important; font-size:12px!important; text-align: center!important; } .SpeedControl_Extension_Speed-Options >.SpeedControl_Extension_Speed-Option-Item-Active, .SpeedControl_Extension_Speed-Options >.SpeedControl_Extension_Speed-Option-Item:hover { color: red!important; font-weight:bold!important; font-size:14px!important; } `; commonUtil.addStyle(speedBtnStyle + speedShowStyle + speedOptionsStyle); }, genrate: async function() { const speedControlBtn = document.createElement("div"); speedControlBtn.className = "ytp-button SpeedControl_Extension_Btn_X"; const speedText = document.createElement("span"); speedText.textContent = "" + this.currentSpeed + "×"; speedControlBtn.appendChild(speedText); const player = await commonUtil.waitForElementByInterval("#player-container-outer .html5-video-player"); if (player) { const rightControls = player.querySelector(".ytp-right-controls"); const ScreenShot_Codehemu_Btn = document.querySelector(".SpeedControl_Extension_Btn_X"); if (rightControls && !ScreenShot_Codehemu_Btn) { rightControls.prepend(speedControlBtn); this.genrateOptions(speedControlBtn); } } }, genrateOptions: function(speedControl) { const speedOptions = document.createElement("div"); speedOptions.classList.add("SpeedControl_Extension_Speed-Options"); speedControl.appendChild(speedOptions); const speeds = ["0.5", "0.75", "1.0", "1.25", "1.5", "2.0", "3.0"]; speeds.forEach((speed) => { const option = document.createElement("div"); option.className = "SpeedControl_Extension_Speed-Option-Item"; option.textContent = `${speed}x`; option.dataset.speed = speed; if (parseFloat(speed) === this.currentSpeed) { option.classList.add("SpeedControl_Extension_Speed-Option-Item-Active"); } speedOptions.appendChild(option); }); let isHovering = false; speedControl.addEventListener("mouseenter", () => { isHovering = true; speedOptions.style.display = "block"; }); speedControl.addEventListener("mouseleave", () => { isHovering = false; setTimeout(() => { if (!isHovering) { speedOptions.style.display = "none"; } }, 100); }); speedOptions.addEventListener("mouseenter", () => { isHovering = true; }); speedOptions.addEventListener("mouseleave", () => { isHovering = false; speedOptions.style.display = "none"; }); speedOptions.addEventListener("click", (event) => { speedOptions.style.display = "none"; const speedValue = parseFloat(event.target.dataset.speed); this.speedDisplayText("" + speedValue + "×"); this.setVideoRate(speedValue); this.currentSpeed = speedValue; this.updateVideoPlaySpeedStorage(speedValue); speedControl.querySelector("span").textContent = "" + speedValue + "×"; speedOptions.querySelectorAll(".SpeedControl_Extension_Speed-Option-Item").forEach((option) => { option.classList.remove("SpeedControl_Extension_Speed-Option-Item-Active"); }); event.target.classList.add("SpeedControl_Extension_Speed-Option-Item-Active"); }); }, updateVideoPlaySpeedStorage: function(speedValue) { StorageUtil.setValue(StorageUtil.keys.youtube.videoPlaySpeed, speedValue); }, speedDisplayText: function(speedText) { let elementId = "youtube-extension-text-box"; let element = document.getElementById(elementId); if (!element) { let mediaElement = document.getElementById("movie_player"); mediaElement.insertAdjacentHTML("afterbegin", `<div id="${elementId}">${speedText}</div>`); element = document.getElementById(elementId); } else { element.textContent = speedText; } element.style.display = "block"; element.style.opacity = 0.8; element.style.filter = `alpha(opacity=${0.8 * 100})`; this.startFadeoutAnimation(element); }, startFadeoutAnimation: function(element, startOpacity = 0.9, duration = 1500) { let opacity = startOpacity; const startTime = performance.now(); if (this.activeAnimationId) { cancelAnimationFrame(this.activeAnimationId); } const fadeStep = (timestamp) => { const elapsed = timestamp - startTime; const progress = Math.min(elapsed / duration, 1); opacity = startOpacity * (1 - progress); element.style.opacity = opacity; element.style.filter = `alpha(opacity=${opacity * 100})`; if (progress < 1) { this.activeAnimationId = requestAnimationFrame(fadeStep); } else { element.style.display = "none"; this.activeAnimationId = null; } }; this.activeAnimationId = requestAnimationFrame(fadeStep); }, setVideoRate: function(speed) { const videoElement = document.querySelector("video"); if (!videoElement) return; videoElement.playbackRate = speed; }, videoObserver: function() { const checkVideoInterval = setInterval(() => { const videoElement = document.querySelector("video"); if (videoElement) { clearInterval(checkVideoInterval); const observer = new MutationObserver((mutationsList) => { for (const mutation of mutationsList) { if (mutation.type === "attributes" && mutation.attributeName === "src") { videoElement.playbackRate = this.currentSpeed; } } }); observer.observe(videoElement, { attributes: true }); } }, 1500); } }; const MarkOrRemoveAd = { generateRemoveAdElementId: "removeADHTMLElement_" + Math.ceil(Math.random() * 1e8), markADHTMLElement: function() { if (document.querySelector(this.generateRemoveAdElementId)) { return; } let cssMarkSelectorArr = [ `#masthead-ad`, `ytd-rich-item-renderer.style-scope.ytd-rich-grid-row #content:has(.ytd-display-ad-renderer)`, `.video-ads.ytp-ad-module`, `tp-yt-paper-dialog:has(yt-mealbar-promo-renderer)`, `ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-ads"]`, `#related #player-ads`, `#related ytd-ad-slot-renderer`, `ytd-ad-slot-renderer`, `yt-mealbar-promo-renderer`, `ytd-popup-container:has(a[href="/premium"])`, `ad-slot-renderer`, `ytm-companion-ad-renderer` ]; cssMarkSelectorArr.forEach((selector, index) => { cssMarkSelectorArr[index] = `${selector} *{text-decoration:line-through!important;text-decoration-thickness:2px!important;}`; }); const cssText = cssMarkSelectorArr.join(" "); const style = document.createElement(`style`); style.id = this.generateRemoveAdElementId; (document.head || document.body).appendChild(style); style.appendChild(document.createTextNode(cssText)); }, run: function() { if (!/youtube\.com/.test(window.location.host)) { return; } commonUtil.onPageLoad(() => { this.markADHTMLElement(); }); } }; const Theme = { setTheme: function(theme = "light", isReload = true) { if (theme === "light") { this.setLight(isReload); } else if (theme === "dark") { this.setDark(isReload); } else { this.setLight(isReload); } }, setDark: function(isReload) { this.isDarkTheme(true, isReload); }, setLight: function(isReload) { this.isDarkTheme(false, isReload); }, reloadYouTube: function() { location.reload(); }, isDarkTheme: function(enabled, isReload) { const cookies = document.cookie.split("; "); let prefCookie = cookies.find((cookie) => cookie.startsWith("PREF=")); let prefValue = prefCookie ? prefCookie.split("=")[1] : "f6=400"; prefValue = prefValue.replace(/&f6=\d+/, "").replace(/f6=\d+/, ""); const prefix = prefValue ? "&" : ""; if (enabled) { prefValue += prefix + "f6=400"; } else { prefValue += prefix + "f6=80000"; } document.cookie = `PREF=${prefValue}; path=/; domain=.youtube.com; secure`; if (isReload) { this.reloadYouTube(); } } }; const Screenshot = { start: function() { var SF_Codhemeu = "png"; var extension = "png"; var appendixTitle = "screenshot." + extension; var title; var headerEls = document.querySelectorAll( "h1.title.ytd-video-primary-info-renderer" ); function SetTitle() { if (headerEls.length > 0) { title = headerEls[0].innerText.trim(); return true; } else { return false; } } if (SetTitle() == false) { headerEls = document.querySelectorAll("h1.watch-title-container"); if (SetTitle() == false) title = ""; } var player = document.getElementsByClassName("video-stream")[0]; var time = player.currentTime; title += " "; let minutes = Math.floor(time / 60); time = Math.floor(time - minutes * 60); if (minutes > 60) { let hours = Math.floor(minutes / 60); minutes -= hours * 60; title += hours + "-"; } title += minutes + "-" + time; title += " " + appendixTitle; var canvas = document.createElement("canvas"); canvas.width = player.videoWidth; canvas.height = player.videoHeight; canvas.getContext("2d").drawImage(player, 0, 0, canvas.width, canvas.height); var downloadLink = document.createElement("a"); downloadLink.download = title; function DownloadBlob(blob) { downloadLink.href = URL.createObjectURL(blob); downloadLink.click(); } { canvas.toBlob(async function(blob) { DownloadBlob(blob); }, "image/" + SF_Codhemeu); } } }; const Dialog = function() { class Dialog2 { constructor() { this.mask = document.createElement("div"); this.dialogStyle = document.createElement("style"); this.mask.classList.add("dialog-gcc-mask"); this.setStyle(this.mask, { "width": "100%", "height": "100%", "backgroundColor": "rgba(0, 0, 0, .6)", "position": "fixed", "left": "0px", "top": "0px", "bottom": "0px", "right": "0px", "z-index": "9999999999999" }); this.content = document.createElement("div"); this.content.classList.add("dialog-gcc-container"); this.setStyle(this.content, { "max-width": "350px", "width": "90%", "backgroundColor": "#fff", "boxShadow": "0 0 2px #999", "position": "absolute", "left": "50%", "top": "50%", "transform": "translate(-50%,-50%)", "borderRadius": "5px" }); this.mask.appendChild(this.content); } middleBox(param) { this.content.innerHTML = ""; if (param.hasOwnProperty("direction")) { this.content.setAttribute("data-extension-direction", param.direction); } let title = ""; if ({}.toString.call(param) === "[object String]") { title = param; } else if ({}.toString.call(param) === "[object Object]") { title = param.title; } document.body.appendChild(this.mask); this.title = document.createElement("div"); this.title.classList.add("dialog-gcc-title"); this.setStyle(this.title, { "width": "100%", "height": "40px", "lineHeight": "40px", "boxSizing": "border-box", "background-color": "#dedede", "color": "#000", "text-align": "center", "font-weight": "700", "font-size": "17px", "border-radius": "4px 4px 0px 0px" }); const span = document.createElement("span"); span.innerText = title; span.setAttribute("langue-extension-text", "setting_modal_title"); this.title.appendChild(span); this.closeBtn = document.createElement("span"); this.closeBtn.innerText = "×"; this.setStyle(this.closeBtn, { "textDecoration": "none", "color": "#000", "position": "absolute", "inset-inline-end": "10px", "top": "0px", "fontSize": "25px", "display": "inline-block", "cursor": "pointer" }); this.title.appendChild(this.closeBtn); this.content.appendChild(this.title); this.closeBtn.onclick = (e) => { e.stopPropagation(); e.preventDefault(); this.close(); if (param.onClose) { param.onClose(); } }; } showMake(param) { if (param.hasOwnProperty("styleSheet")) { this.dialogStyle.textContent = param.styleSheet; } document.querySelector("head").appendChild(this.dialogStyle); this.middleBox(param); this.dialogContent = document.createElement("div"); this.dialogContent.classList.add("dialog-gcc-content"); this.setStyle(this.dialogContent, { "padding": "15px", "max-height": "400px", "overflow": "auto" }); this.dialogContent.innerHTML = param.content; this.content.appendChild(this.dialogContent); param.onContentReady(this); } updateTitle(title) { if (this.title) { this.title.innerText = title; } } close() { document.body.removeChild(this.mask); document.querySelector("head").removeChild(this.dialogStyle); } setStyle(ele, styleObj) { for (let attr in styleObj) { ele.style[attr] = styleObj[attr]; } } } let dialog = null; return function() { if (!dialog) { dialog = new Dialog2(); } return dialog; }(); }(); const ComstomConfirm = { show: function(options) { const overlay = document.createElement("div"); overlay.style.position = "fixed"; overlay.style.top = 0; overlay.style.left = 0; overlay.style.width = "100%"; overlay.style.height = "100%"; overlay.style.background = "rgba(0, 0, 0, 0.5)"; overlay.style.display = "flex"; overlay.style.alignItems = "center"; overlay.style.justifyContent = "center"; overlay.style.zIndex = 9999; const box = document.createElement("div"); box.style.background = "white"; box.style.padding = "20px 30px"; box.style.borderRadius = "8px"; box.style.textAlign = "center"; box.style.width = "90%"; box.style.maxWidth = "300px"; box.style.fontSize = "16px"; box.style.boxShadow = "0 4px 10px rgba(0,0,0,0.3)"; const text = document.createElement("div"); text.textContent = options.message; text.style.marginBottom = "15px"; text.style.textAlign = "left"; const buttonBox = document.createElement("div"); const confirmBtn = document.createElement("button"); confirmBtn.textContent = options.enter; confirmBtn.style.margin = "0 10px"; confirmBtn.style.padding = "8px 16px"; confirmBtn.style.border = "none"; confirmBtn.style.borderRadius = "4px"; confirmBtn.style.backgroundColor = "#000"; confirmBtn.style.color = "white"; confirmBtn.style.cursor = "pointer"; confirmBtn.style.fontSize = "15px"; confirmBtn.onclick = function() { document.body.removeChild(overlay); if (options.onEnter) { options.onEnter(); } }; const cancelBtn = document.createElement("button"); cancelBtn.textContent = options.cancel; cancelBtn.style.margin = "0 10px"; cancelBtn.style.padding = "8px 16px"; cancelBtn.style.border = "none"; cancelBtn.style.borderRadius = "4px"; cancelBtn.style.backgroundColor = "#ccc"; cancelBtn.style.cursor = "pointer"; cancelBtn.style.fontSize = "15px"; cancelBtn.onclick = function() { if (options.onCancel) { options.onCancel(); } document.body.removeChild(overlay); }; buttonBox.appendChild(cancelBtn); buttonBox.appendChild(confirmBtn); box.appendChild(text); box.appendChild(buttonBox); overlay.appendChild(box); document.body.appendChild(overlay); } }; const LangueUtil = { language: { "en": { direction: "ltr", content: { "function_setting_title": "Setting", "function_is_comment_table_open": "Enable video details page interface optimization.", "function_is_theme_progress_bar_open": "Enable video playback progress bar beautification.", "function_is_speed_control_open": "Enable video fast forward (playback speed selectable).", "function_is_mark_or_remove_ad_open": "Enable page ad labeling.", "function_is_youtube_downloading_open": "Enable YouTube video downloading.", "download_confirm_message": "Downloading YouTube videos will redirect to third-party websites, which may contain ads. If you don't need this download feature, you can disable it in the settings.", "download_enter_text": "OK", "download_cancel_text": "Cancel" } }, "ja": { direction: "ltr", content: { "function_setting_title": "設定", "function_is_comment_table_open": "動画詳細ページのインターフェース最適化を有効にする。", "function_is_theme_progress_bar_open": "動画再生の進行状況バーの装飾を有効にする。", "function_is_speed_control_open": "動画の早送り(再生速度選択可能)を有効にする。", "function_is_mark_or_remove_ad_open": "ページ広告のラベリングを有効にする。", "download_confirm_message": "YouTube動画のダウンロードはサードパーティのウェブサイトにリダイレクトされ、広告が含まれている可能性があります。このダウンロード機能が不要な場合は、設定で無効にできます。", "download_enter_text": "OK", "download_cancel_text": "キャンセル" } }, "ko": { direction: "ltr", content: { "function_setting_title": "설정", "function_is_comment_table_open": "동영상 상세 페이지 인터페이스 최적화 활성화.", "function_is_theme_progress_bar_open": "동영상 재생 진행 바 장식 활성화.", "function_is_speed_control_open": "동영상 빨리감기(재생 속도 선택 가능) 활성화.", "function_is_mark_or_remove_ad_open": "페이지 광고 라벨링 활성화.", "download_confirm_message": "YouTube 동영상을 다운로드하면 제3자 웹사이트로 리디렉션되며, 광고가 포함될 수 있습니다. 이 다운로드 기능이 필요하지 않은 경우 설정에서 비활성화할 수 있습니다.", "download_enter_text": "확인", "download_cancel_text": "취소" } }, "ru": { direction: "ltr", content: { "function_setting_title": "Настройки", "function_is_comment_table_open": "Включить оптимизацию интерфейса страницы деталей видео.", "function_is_theme_progress_bar_open": "Включить улучшение панели прогресса воспроизведения видео.", "function_is_speed_control_open": "Включить перемотку видео (выбор скорости воспроизведения).", "function_is_mark_or_remove_ad_open": "Включить маркировку рекламы на странице.", "function_is_youtube_downloading_open": "Включить загрузку видео с YouTube.", "download_confirm_message": "Загрузка видео с YouTube перенаправит вас на сторонние сайты, которые могут содержать рекламу. Если вам не нужна эта функция загрузки, вы можете отключить её в настройках.", "download_enter_text": "ОК", "download_cancel_text": "Отмена" } }, "id": { direction: "ltr", content: { "function_setting_title": "Pengaturan", "function_is_comment_table_open": "Aktifkan pengoptimalan antarmuka halaman detail video.", "function_is_theme_progress_bar_open": "Aktifkan pempercantik bilah progres pemutaran video.", "function_is_speed_control_open": "Aktifkan percepatan video (kecepatan pemutaran dapat dipilih).", "function_is_mark_or_remove_ad_open": "Aktifkan pelabelan iklan di halaman.", "function_is_youtube_downloading_open": "Aktifkan pengunduhan video YouTube.", "download_confirm_message": "Mengunduh video YouTube akan mengarahkan ke situs web pihak ketiga yang mungkin berisi iklan. Jika Anda tidak memerlukan fitur unduhan ini, Anda dapat menonaktifkannya di pengaturan.", "download_enter_text": "OK", "download_cancel_text": "Batal" } }, "fr": { direction: "ltr", content: { "function_setting_title": "Paramètres", "function_is_comment_table_open": "Activer l’optimisation de l’interface de la page de détails de la vidéo.", "function_is_theme_progress_bar_open": "Activer l’embellissement de la barre de progression de la vidéo.", "function_is_speed_control_open": "Activer l’avance rapide de la vidéo (vitesse de lecture sélectionnable).", "function_is_mark_or_remove_ad_open": "Activer l’étiquetage des publicités sur la page.", "function_is_youtube_downloading_open": "Activer le téléchargement de vidéos YouTube.", "download_confirm_message": "Le téléchargement de vidéos YouTube redirigera vers des sites tiers pouvant contenir des publicités. Si vous n'avez pas besoin de cette fonctionnalité, vous pouvez la désactiver dans les paramètres.", "download_enter_text": "OK", "download_cancel_text": "Annuler" } }, "pt": { direction: "ltr", content: { "function_setting_title": "Configurações", "function_is_comment_table_open": "Ativar otimização da interface da página de detalhes do vídeo.", "function_is_theme_progress_bar_open": "Ativar embelezamento da barra de progresso do vídeo.", "function_is_speed_control_open": "Ativar avanço rápido do vídeo (velocidade de reprodução selecionável).", "function_is_mark_or_remove_ad_open": "Ativar rotulagem de anúncios na página.", "function_is_youtube_downloading_open": "Ativar o download de vídeos do YouTube.", "download_confirm_message": "O download de vídeos do YouTube redirecionará para sites de terceiros, que podem conter anúncios. Se você não precisar desse recurso, poderá desativá-lo nas configurações.", "download_enter_text": "OK", "download_cancel_text": "Cancelar" } }, "tr": { direction: "ltr", content: { "function_setting_title": "Ayarlar", "function_is_comment_table_open": "Video detay sayfası arayüz optimizasyonunu etkinleştir.", "function_is_theme_progress_bar_open": "Video oynatma ilerleme çubuğu güzelleştirmesini etkinleştir.", "function_is_speed_control_open": "Video hızlı oynatmayı etkinleştir (oynatma hızı seçilebilir).", "function_is_mark_or_remove_ad_open": "Sayfadaki reklam etiketlemesini etkinleştir.", "function_is_youtube_downloading_open": "YouTube video indirmeyi etkinleştir.", "download_confirm_message": "YouTube videolarını indirmek, reklam içerebilecek üçüncü taraf sitelere yönlendirme yapacaktır. Bu indirme özelliğine ihtiyacınız yoksa, ayarlardan devre dışı bırakabilirsiniz.", "download_enter_text": "Tamam", "download_cancel_text": "İptal" } } }, getLang: function() { let lang = (navigator.language || navigator.userLanguage).slice(0, 2).toLowerCase(); if (!lang) { lang = "en"; } return lang; }, getLanguage: function() { const lang = this.getLang(); return this.language[lang] ?? this.language.en; } }; const ToolBox = { getFunctionState: function() { return StorageUtil.getValue( StorageUtil.keys.youtube.functionState, StorageUtil.getDefaultFunctionState() ); }, insertStyle: function() { const speedOptionsStyle = ` .toolbox_extension_container { position: absolute!important; background: #000!important; color: white!important; border-radius: 8px!important; box-sizing: border-box!important; z-index:999999999999!important; display:none; padding:13px!important; } .toolbox_extension_container .toolbox_extension_tools { display: grid!important; grid-template-columns: repeat(4, 1fr)!important; gap: 8px!important; } .toolbox_extension_container .toolbox_extension_tool_btn { width: 25px!important; height: 25px!important; background:#F4F4F4!important; border: none!important; cursor: pointer!important; display: flex!important; justify-content: center!important; align-items: center!important; border-radius:5px!important; } `; commonUtil.addStyle(speedOptionsStyle); }, genrateSettingSvg: function() { const svgNS = "http://www.w3.org/2000/svg"; const svg = document.createElementNS(svgNS, "svg"); svg.setAttribute("viewBox", "0 0 1024 1024"); svg.setAttribute("width", "22"); svg.setAttribute("height", "22"); const path = document.createElementNS(svgNS, "path"); path.setAttribute("d", "M449.194667 82.346667a128 128 0 0 1 125.610666 0l284.16 160a128 128 0 0 1 65.194667 111.530666v316.245334a128 128 0 0 1-65.194667 111.530666l-284.16 160a128 128 0 0 1-125.610666 0l-284.16-160a128 128 0 0 1-65.194667-111.530666V353.877333A128 128 0 0 1 165.034667 242.346667z m83.754666 74.410666a42.666667 42.666667 0 0 0-41.898666 0L206.933333 316.714667a42.666667 42.666667 0 0 0-21.76 37.162666v316.245334a42.666667 42.666667 0 0 0 21.76 37.162666l284.16 160a42.666667 42.666667 0 0 0 41.898667 0l284.16-160a42.666667 42.666667 0 0 0 21.76-37.162666V353.877333a42.666667 42.666667 0 0 0-21.76-37.162666zM512 341.333333a170.666667 170.666667 0 1 1 0 341.333334 170.666667 170.666667 0 0 1 0-341.333334z m0 85.333334a85.333333 85.333333 0 1 0 0 170.666666 85.333333 85.333333 0 0 0 0-170.666666z"); path.setAttribute("fill", "#000000"); svg.appendChild(path); return svg; }, genrateToolSvg: function() { const svgNS = "http://www.w3.org/2000/svg"; const svg = document.createElementNS(svgNS, "svg"); svg.setAttribute("viewBox", "0 0 1024 1024"); svg.setAttribute("width", "22"); svg.setAttribute("height", "22"); svg.setAttribute("class", "icon"); const path = document.createElementNS(svgNS, "path"); path.setAttribute("d", "M364.999 128.853H158.28c-52.383 0-95 42.617-95 95v206.719c0 52.383 42.617 95 95 95h206.719c52.383 0 95-42.617 95-95V223.853c0-52.384-42.617-95-95-95zM364.999 562.39H158.28c-52.383 0-95 42.617-95 95v206.719c0 52.383 42.617 95 95 95h206.719c52.383 0 95-42.617 95-95V657.39c0-52.383-42.617-95-95-95zM943.066 230.037L796.895 83.865c-17.943-17.943-41.8-27.825-67.175-27.825-25.376 0-49.232 9.881-67.175 27.825L516.372 230.037c-37.041 37.041-37.041 97.31 0 134.35l146.172 146.172c17.943 17.943 41.8 27.825 67.176 27.825 25.375 0 49.231-9.882 67.175-27.825l146.172-146.172c17.943-17.943 27.825-41.8 27.825-67.175s-9.882-49.233-27.826-67.175z m-21.212 113.137L775.682 489.346c-12.277 12.277-28.601 19.038-45.962 19.038-17.362 0-33.686-6.761-45.963-19.038L537.585 343.174c-25.343-25.344-25.343-66.581 0-91.924l146.173-146.172c12.276-12.277 28.6-19.038 45.962-19.038 17.361 0 33.685 6.761 45.962 19.038L921.854 251.25c12.276 12.277 19.038 28.6 19.038 45.962s-6.762 33.685-19.038 45.962zM798.887 562.39H592.168c-52.383 0-95 42.617-95 95v206.719c0 52.383 42.617 95 95 95h206.719c52.383 0 95-42.617 95-95V657.39c0-52.383-42.617-95-95-95z"); path.setAttribute("fill", "#ffffff"); svg.appendChild(path); return svg; }, genrateDownloadSvg: function(width = 20, height = 20) { const svgNS = "http://www.w3.org/2000/svg"; const svg = document.createElementNS(svgNS, "svg"); svg.setAttribute("t", "1743576847386"); svg.setAttribute("class", "icon"); svg.setAttribute("viewBox", "0 0 1024 1024"); svg.setAttribute("version", "1.1"); svg.setAttribute("xmlns", svgNS); svg.setAttribute("p-id", "1746"); svg.setAttribute("width", width); svg.setAttribute("height", height); const path1 = document.createElementNS(svgNS, "path"); path1.setAttribute("d", "M32 32h960v960H32z"); path1.setAttribute("fill", "#000000"); path1.setAttribute("fill-opacity", "0"); path1.setAttribute("p-id", "1747"); const path2 = document.createElementNS(svgNS, "path"); path2.setAttribute("d", "M852.00000031 476.54c21.07999969 0 38.35999969 16.51999969 39.9 37.5l0.09999938 3.01999969v212.80000031C891.99999969 819.42000031 820.35999969 891.99999969 732.00000031 891.99999969H291.99999969c-88.36000031 0-160.00000031-72.6-159.99999938-162.13999969v-212.80000031l0.09999938-3A40.21999969 40.21999969 0 0 1 171.99999969 476.52000031c21.07999969 0 38.35999969 16.51999969 39.9 37.5l0.10000031 3.01999969v212.80000031c0 44.77999969 35.80000031 81.07999969 79.99999969 81.07999969h440.00000062c44.20000031 0 79.99999969-36.3 79.99999969-81.07999969v-212.80000031l0.10000031-3A40.21999969 40.21999969 0 0 1 852.00000031 476.52000031zM512 132.00000031a40.00000031 40.00000031 0 0 1 40.00000031 39.99999938v342.24l99.63999938-104.13999938a45.94000031 45.94000031 0 0 1 66.46000031 0.06 50.4 50.4 0 0 1-0.06 69.6l-170.34 178.03999969a45.94000031 45.94000031 0 0 1-66.28000031 0.13999969 46.62 46.62 0 0 1-4.38-4.03999969l-170.34-178.02a50.4 50.4 0 0 1-0.06-69.6 45.94000031 45.94000031 0 0 1 64.96000031-1.57999969l1.5 1.5L471.99999969 509.55999969V171.99999969a40.00000031 40.00000031 0 0 1 40.00000031-39.99999938z"); path2.setAttribute("fill", "#000000"); path2.setAttribute("p-id", "1748"); svg.appendChild(path1); svg.appendChild(path2); return svg; }, genrateShortDownloadSvg: function() { const svgNS = "http://www.w3.org/2000/svg"; const svg = document.createElementNS(svgNS, "svg"); svg.setAttribute("viewBox", "0 0 1024 1024"); svg.setAttribute("width", "32"); svg.setAttribute("height", "32"); const paths = [ { d: "M0 0m512 0l0 0q512 0 512 512l0 0q0 512-512 512l0 0q-512 0-512-512l0 0q0-512 512-512Z", opacity: "0.7" }, { d: "M671.1552 727.2192H350.4128a95.7696 95.7696 0 0 1-96.2304-95.104v-190.2336a31.872 31.872 0 0 1 32.0768-31.7184 31.872 31.872 0 0 1 32.0768 31.7184v190.2336a31.9232 31.9232 0 0 0 32.0768 31.6928h320.7424a31.9232 31.9232 0 0 0 32.0768-31.6928v-190.2336a32.0768 32.0768 0 0 1 64.1536 0v190.2336a95.7696 95.7696 0 0 1-96.2304 95.104z", fill: "#FFFFFF" }, { d: "M499.1232 563.7376a16.5632 16.5632 0 0 0 23.3472 0l108.7744-108.8256c6.4256-6.4256 4.2496-11.6736-4.8384-11.6736h-33.0496a16.5632 16.5632 0 0 1-16.512-16.5376v-66.0992a16.5376 16.5376 0 0 0-16.512-16.512h-99.0976a16.5632 16.5632 0 0 0-16.512 16.512v66.0992a16.5632 16.5632 0 0 1-16.512 16.5376h-33.1008c-9.088 0-11.264 5.248-4.8384 11.6736z", fill: "#FFFFFF" }, { d: "M446.2336 294.5792a16.512 16.512 0 1 1 16.512 16.5376 16.5376 16.5376 0 0 1-16.512-16.5376z", fill: "#FFFFFF" }, { d: "M542.2848 294.5792a16.512 16.512 0 1 1 16.512 16.5376 16.5376 16.5376 0 0 1-16.512-16.5376z", fill: "#FFFFFF" }, { d: "M461.2352 277.9904h99.0976v33.0496h-99.0976z", fill: "#FFFFFF" } ]; paths.forEach((attr) => { const path = document.createElementNS(svgNS, "path"); for (let key in attr) { path.setAttribute(key, attr[key]); } svg.appendChild(path); }); return svg; }, genrateScreenshotSvg: function() { const svgNS = "http://www.w3.org/2000/svg"; const svg = document.createElementNS(svgNS, "svg"); svg.setAttribute("viewBox", "0 0 1024 1024"); svg.setAttribute("width", "20"); svg.setAttribute("height", "20"); svg.setAttribute("class", "icon"); const path1 = document.createElementNS(svgNS, "path"); path1.setAttribute("d", "M924.49999971 755.74999971h-93.74999942V287c0-52.49999971-41.24999971-93.75000029-93.75000029-93.75000029H268.25000029V99.50000029c0-22.5-15.00000029-37.50000029-37.50000029-37.50000029s-37.50000029 15.00000029-37.50000029 37.50000029v93.74999942H99.50000029c-22.5 0-37.50000029 15.00000029-37.50000029 37.50000029s15.00000029 37.50000029 37.50000029 37.50000029h93.74999942V737c0 52.49999971 41.24999971 93.75000029 93.75000029 93.75000029h468.74999971V924.49999971c0 22.5 15.00000029 37.50000029 37.50000029 37.50000029s37.50000029-15.00000029 37.50000029-37.50000029v-93.74999942H924.49999971c22.5 0 37.50000029-15.00000029 37.50000029-37.50000029s-15.00000029-37.50000029-37.50000029-37.50000029z m-187.49999971-487.49999942c11.25 0 18.74999971 7.49999971 18.74999971 18.74999971v299.99999971l-127.49999942-123.75c-15.00000029-15.00000029-37.50000029-15.00000029-52.50000058 0l-123.75 127.50000029L399.5 538.25000029c-15.00000029-15.00000029-33.75-15.00000029-48.75000029-3.75000029l-78.75 63.74999971V268.25000029H737z m-450 487.49999942c-11.25 0-18.74999971-7.49999971-18.74999971-18.74999971v-37.50000029l101.25-82.49999942 56.25 56.25c7.49999971 7.49999971 15.00000029 11.25 26.24999942 11.25s18.74999971-3.75000029 26.25000029-11.25l123.75-127.50000029 153.74999971 146.25v63.74999971H287z"); path1.setAttribute("fill", "#000000"); const path2 = document.createElementNS(svgNS, "path"); path2.setAttribute("d", "M399.5 485.74999971c45 0 82.50000029-37.50000029 82.50000029-82.49999942s-37.50000029-82.50000029-82.50000029-82.50000029-82.50000029 33.75-82.50000029 78.75 37.50000029 86.24999971 82.50000029 86.24999971z m0-112.5c15.00000029 0 29.99999971 11.25 29.99999971 30.00000058s-15.00000029 26.25000029-29.99999971 26.24999942-29.99999971-15.00000029-29.99999971-29.99999971 15.00000029-26.25000029 29.99999971-26.25000029z"); path2.setAttribute("fill", "#000000"); svg.appendChild(path1); svg.appendChild(path2); return svg; }, genrateSwitchThemeSvg: function() { const svgNS = "http://www.w3.org/2000/svg"; const svg = document.createElementNS(svgNS, "svg"); svg.setAttribute("t", "1743577080138"); svg.setAttribute("class", "icon"); svg.setAttribute("viewBox", "0 0 1024 1024"); svg.setAttribute("version", "1.1"); svg.setAttribute("xmlns", svgNS); svg.setAttribute("p-id", "1950"); svg.setAttribute("width", "20"); svg.setAttribute("height", "20"); const path = document.createElementNS(svgNS, "path"); path.setAttribute("d", "M873.91601563 358.72753906A393.42480469 393.42480469 0 0 0 512 118.25c-217.546875 0.47460938-393.75 176.57226563-393.75 393.75s176.203125 393.27539063 393.75 393.75a393.95214844 393.95214844 0 0 0 361.91601563-547.02246094zM749.77050781 750.65820313A335.27636719 335.27636719 0 0 1 512 849.5V174.5a337.5 337.5 0 0 1 237.77050781 576.15820313z"); path.setAttribute("p-id", "1951"); svg.appendChild(path); return svg; }, genrateVideoTabSvg: function() { const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); svg.setAttribute("width", "20"); svg.setAttribute("height", "20"); svg.setAttribute("viewBox", "0 0 24 24"); svg.setAttribute("stroke-width", "2"); svg.setAttribute("stroke", "currentColor"); svg.setAttribute("fill", "none"); svg.setAttribute("stroke-linecap", "round"); svg.setAttribute("stroke-linejoin", "round"); const paths = [ { d: "M0 0h24v24H0z", fill: "none" }, { d: "M3 16m0 1a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-3a1 1 0 0 1 -1 -1z" }, { d: "M4 12v-6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-6" }, { d: "M12 8h4v4" }, { d: "M16 8l-5 5" } ]; paths.forEach((attrs) => { const path = document.createElementNS("http://www.w3.org/2000/svg", "path"); if (!attrs.hasOwnProperty("fill")) { path.setAttribute("fill", "#000000"); } Object.entries(attrs).forEach(([key, value]) => path.setAttribute(key, value)); svg.appendChild(path); }); return svg; }, genratePictureToPictureSvg: function() { const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); svg.setAttribute("width", "20"); svg.setAttribute("height", "20"); svg.setAttribute("viewBox", "0 0 24 24"); svg.setAttribute("stroke-width", "2"); svg.setAttribute("stroke", "currentColor"); svg.setAttribute("fill", "none"); svg.setAttribute("stroke-linecap", "round"); svg.setAttribute("stroke-linejoin", "round"); const paths = [ { d: "M0 0h24v24H0z", fill: "none" }, { d: "M11 19h-6a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v4" }, { d: "M14 14m0 1a1 1 0 0 1 1 -1h5a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1z" } ]; paths.forEach((attrs) => { const path = document.createElementNS("http://www.w3.org/2000/svg", "path"); if (!attrs.hasOwnProperty("fill")) { path.setAttribute("fill", "#000000"); } Object.entries(attrs).forEach(([key, value]) => path.setAttribute(key, value)); svg.appendChild(path); }); return svg; }, genrateLoopSvg: function() { const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); svg.setAttribute("t", "1746700282649"); svg.setAttribute("class", "icon"); svg.setAttribute("viewBox", "0 0 1024 1024"); svg.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svg.setAttribute("width", "20"); svg.setAttribute("height", "20"); const paths = [ { d: "M286.95 286.95h450.1v134.61l178.78-178.78L737.05 64v134.61H198.61v269.22h88.34V286.95z m450.1 450.1h-450.1V602.44L108.17 781.22 286.95 960V825.39h538.44V556.17h-88.34v180.88z", "p-id": "3512", fill: "#000000" } ]; paths.forEach((attrs) => { const path = document.createElementNS("http://www.w3.org/2000/svg", "path"); Object.entries(attrs).forEach(([key, value]) => path.setAttribute(key, value)); svg.appendChild(path); }); return svg; }, genrateNotLoopSvg: function() { const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); svg.setAttribute("t", "1746700343318"); svg.setAttribute("class", "icon"); svg.setAttribute("viewBox", "0 0 1024 1024"); svg.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svg.setAttribute("width", "20"); svg.setAttribute("height", "20"); const paths = [ { d: "M759.14 198.61V64l178.78 178.78-178.78 178.78V286.95H391.06l-90.44-88.34h458.52z m0 357.56h88.34v189.3l-88.34-90.44v-98.86zM86.09 209.13l56.79-56.79 750.87 750.87L836.96 960 702.35 825.39H309.03V960L130.25 781.22l178.78-178.78v134.61H611.9L309.03 434.18v33.65H220.7V343.74L86.09 209.13z", "p-id": "3770", fill: "#000000" } ]; paths.forEach((attrs) => { const path = document.createElementNS("http://www.w3.org/2000/svg", "path"); Object.entries(attrs).forEach(([key, value]) => path.setAttribute(key, value)); svg.appendChild(path); }); return svg; }, downloadVideo: function() { const language = LangueUtil.getLanguage(); const downloadingConfirm = StorageUtil.getValue(StorageUtil.keys.youtube.downloadingConfirm, false); const downloadOperat = () => { const url = "https://www.tikfork.com/" + LangueUtil.getLang() + "/yt?s=21&url=" + window.location.href; commonUtil.openInTab(url); }; if (downloadingConfirm) { downloadOperat(); } else { ComstomConfirm.show({ "message": language.content.download_confirm_message, "enter": language.content.download_enter_text, "cancel": language.content.download_cancel_text, "onEnter": function() { downloadOperat(); StorageUtil.setValue(StorageUtil.keys.youtube.downloadingConfirm, true); }, "onCancel": function() { } }); } }, genrateTools: function(parent) { const loopElementId = "_loop_" + Math.ceil(Math.random() * 1e8); const functionState = this.getFunctionState(); const download = () => { this.downloadVideo(); }; const switchTheme = () => { let currentTheme = StorageUtil.getValue(StorageUtil.keys.youtube.theme, null); if (currentTheme == "light" || !currentTheme) { currentTheme = "dark"; } else { currentTheme = "light"; } StorageUtil.setValue(StorageUtil.keys.youtube.theme, currentTheme); Theme.setTheme(currentTheme, true); }; const screenshot = () => { Screenshot.start(); }; const showSettingDialog = () => { this.showSettingDialog(); }; const videoTab = () => { document.querySelector("video").click(); const parametrosURL = new URLSearchParams(window.location.search); let enlace = parametrosURL.get("v"); window.open( `https://www.youtube.com/embed/${enlace}?rel=0&controls=2&color=white&iv_load_policy=3&showinfo=0&modestbranding=1&autoplay=1` ); }; const pictureToPicture = () => { const video = document.querySelector("video"); if ("pictureInPictureEnabled" in document) { if (!document.pictureInPictureElement) { video.requestPictureInPicture().then(() => { }).catch((error) => { }); } } }; let videoLoopSate = StorageUtil.getValue(StorageUtil.keys.youtube.videoLoop, false); let videoLoopInterval = null; const videoLoopEvent = () => { if (videoLoopInterval) { clearInterval(videoLoopInterval); videoLoopInterval = null; } const videoFull = document.querySelector("#movie_player > div.html5-video-container > video"); if (videoFull != void 0) { videoLoopInterval = setInterval(() => { if (videoLoopSate) { document.querySelector("#movie_player > div.html5-video-container > video").setAttribute("loop", "true"); } else { document.querySelector("#movie_player > div.html5-video-container > video").removeAttribute("loop"); } }, 1e3); } }; const videoLoop = () => { const target = document.querySelector("#" + loopElementId); let svg = null; if (videoLoopSate) { videoLoopSate = false; svg = this.genrateNotLoopSvg(); } else { videoLoopSate = true; svg = this.genrateLoopSvg(); } target.replaceChildren(svg); StorageUtil.setValue(StorageUtil.keys.youtube.videoLoop, videoLoopSate); videoLoopEvent(); }; videoLoopEvent(); const btns = [ { "tagName": "div", "title": "Setting", "classname": "toolbox_extension_tool_btn", "onclick": showSettingDialog, "icon": this.genrateSettingSvg() }, { "tagName": "div", "title": "Switch the theme", "classname": "toolbox_extension_tool_btn", "onclick": switchTheme, "icon": this.genrateSwitchThemeSvg() }, { "tagName": "div", "title": "Screenshot", "classname": "toolbox_extension_tool_btn", "onclick": screenshot, "icon": this.genrateScreenshotSvg() }, { "tagName": "div", "title": "New Tab Playback", "classname": "toolbox_extension_tool_btn", "onclick": videoTab, "icon": this.genrateVideoTabSvg() }, { "tagName": "div", "title": "Picture to picture", "classname": "toolbox_extension_tool_btn", "onclick": pictureToPicture, "icon": this.genratePictureToPictureSvg() }, { "tagName": "div", "title": "Loop", "classname": "toolbox_extension_tool_btn", "id": loopElementId, "onclick": videoLoop, "icon": videoLoopSate ? this.genrateLoopSvg() : this.genrateNotLoopSvg() } ]; if (functionState && functionState.isOpenYoutubedownloading) { btns.push({ "tagName": "div", "title": "Download", "classname": "toolbox_extension_tool_btn", "onclick": download, "icon": this.genrateDownloadSvg() }); } for (let i = 0; i < btns.length; i++) { let item = btns[i]; const element = document.createElement(item.tagName); element.className = item.classname; element.setAttribute("title", item.title); if (item.hasOwnProperty("icon")) { element.appendChild(item.icon); } if (item.hasOwnProperty("id")) { element.id = item.id; } if (item.hasOwnProperty("onclick")) { element.onclick = item.onclick; } if (item.hasOwnProperty("style")) { element.setAttribute("style", item.style); } parent.appendChild(element); } }, genrateBoxContainer: function(button, player) { const toolBoxContainer = document.createElement("div"); toolBoxContainer.id = "toolbox_extension_container"; toolBoxContainer.className = "toolbox_extension_container"; const tools = document.createElement("div"); tools.className = "toolbox_extension_tools"; this.genrateTools(tools); toolBoxContainer.appendChild(tools); player.appendChild(toolBoxContainer); let isHovering = false; button.addEventListener("mouseenter", () => { toolBoxContainer.style.display = "block"; var containerRect = player.getBoundingClientRect(); var buttonRect = button.getBoundingClientRect(); var toolBoxContainerRect = toolBoxContainer.getBoundingClientRect(); var left = buttonRect.left - containerRect.left - toolBoxContainerRect.width / 2 + buttonRect.width / 2; var top = buttonRect.top - containerRect.top - toolBoxContainer.clientHeight; toolBoxContainer.style.left = `${left}px`; toolBoxContainer.style.top = `${top}px`; }); button.addEventListener("mouseleave", () => { isHovering = false; setTimeout(() => { if (!isHovering) { toolBoxContainer.style.display = "none"; } }, 100); }); toolBoxContainer.addEventListener("mouseenter", () => { isHovering = true; }); toolBoxContainer.addEventListener("mouseleave", () => { isHovering = false; toolBoxContainer.style.display = "none"; }); }, genrateBox: function() { const buttonId = "toolBox_extension_codehemu_x"; const boxContainer = document.createElement("div"); boxContainer.className = "ytp-button"; boxContainer.id = buttonId; boxContainer.setAttribute("style", `position: relative;display: inline-block;width: 48px;height: 100%;`); const boxInner = document.createElement("div"); boxInner.setAttribute("style", `position: absolute;width: 100%;height: 100%; `); const boxActiveButton = document.createElement("button"); boxActiveButton.setAttribute("style", `background-color: transparent;width: 100%;height: 100%;outline: none;flex: 1 1 0%;display: flex;-webkit-box-align: center;align-items: center;-webkit-box-pack: center;justify-content: center;border: none;padding: 0px;cursor: pointer;`); boxContainer.appendChild(boxInner); boxInner.appendChild(boxActiveButton); boxActiveButton.appendChild(this.genrateToolSvg()); const genrateHtml = () => { const player = document.querySelector("#player-container-outer .html5-video-player"); if (player) { const rightControls = player.querySelector(".ytp-right-controls"); if (rightControls) { rightControls.prepend(boxContainer); this.genrateBoxContainer(boxContainer, player); } } }; const interval = setInterval(() => { if (!document.querySelector("#" + buttonId)) { genrateHtml(); } else { clearInterval(interval); } }, 500); }, genrateShorts: function() { const genrateHtml = () => { if (window.location.href.indexOf("/shorts/") != -1) { const navigationButtonDown = document.querySelector("#navigation-button-down"); if (navigationButtonDown) { const download = document.createElement("div"); download.setAttribute("style", "cursor:pointer;display: flex;justify-content: center;align-items: center;"); download.id = "script_download_shorts"; download.className = "navigation-button style-scope ytd-shorts"; navigationButtonDown.after(download); download.appendChild(this.genrateShortDownloadSvg()); download.addEventListener("click", () => { this.downloadVideo(); }); } } }; setInterval(() => { if (!document.querySelector("#script_download_shorts")) { genrateHtml(); } }, 800); }, genrateOuterBox: function() { const outerBoxId = "script_outer_box"; const outerBox = document.createElement("div"); outerBox.id = outerBoxId; outerBox.setAttribute("style", "margin-left:10px;display:inline-flex;border-radius:10px;overflow: hidden;"); const download = document.createElement("div"); download.setAttribute("style", "width:36px;height:36px;border:none;cursor:pointer;display:flex;align-items: center;justify-content:center"); download.appendChild(this.genrateShortDownloadSvg()); outerBox.appendChild(download); download.onclick = this.downloadVideo; const interval = setInterval(() => { if (!document.querySelector("#" + outerBoxId)) { const owner = document.querySelector("#owner"); if (owner) { owner.appendChild(outerBox); clearInterval(interval); } else { const actions = document.querySelector("#actions"); if (actions) { actions.insertBefore(outerBox, actions.firstChild); clearInterval(interval); } } } }, 500); }, showSettingDialog: function() { const functionState = StorageUtil.getValue(StorageUtil.keys.youtube.functionState, { isOpenCommentTable: true, isOpenThemeProgressBar: true, isOpenSpeedControl: true, isOpenMarkOrRemoveAd: true, isOpenYoutubedownloading: true }); const language = LangueUtil.getLanguage(); const styleSheet = ` .row-item{ background: #ffffff; padding: 15px; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); transition: background 0.3s; margin-bottom: 10px; } .setting { display: flex; justify-content: space-between; align-items: center; } .setting .setting-name{ flex: 1; text-align: left; font-size: 14px; } .setting .setting-switch{ width: 60px; display: flex; justify-content: end; } .recomment-item{ cursor: pointer; } .recomment-item:hover{ text-decoration: underline; } .ecomment-item-title{ font-size: 15px; margin-bottom: 5px; } .ecomment-item-content{ font-size: 14px; } label { font-size: 16px; font-weight: bold; } .toggle { width: 50px; height: 25px; background-color: #ccc; border-radius: 15px; position: relative; cursor: pointer; transition: background-color 0.3s; display: inline-block; } .toggle:before { content: ''; position: absolute; width: 20px; height: 20px; background-color: white; border-radius: 50%; top: 50%; left: 3px; transform: translateY(-50%); transition: 0.2s; } input:checked + .toggle { background-color: #4CAF50; } input:checked + .toggle:before { transform: translate(24px, -50%); } input { display: none; } `; const content = ` <div class="row-item setting"> <div class="setting-name" data-i18n="function_is_comment_table_open"></div> <div class="setting-switch"> <input type="checkbox" id="isCommentTableOpen" /><label class="toggle" for="isCommentTableOpen"></label> </div> </div> <div class="row-item setting"> <div class="setting-name" data-i18n="function_is_theme_progress_bar_open"></div> <div class="setting-switch"> <input type="checkbox" id="isThemeProgressBarOpen" /><label class="toggle" for="isThemeProgressBarOpen"></label> </div> </div> <div class="row-item setting"> <div class="setting-name" data-i18n="function_is_speed_control_open"></div> <div class="setting-switch"> <input type="checkbox" id="isSpeedControlOpen" /><label class="toggle"for="isSpeedControlOpen"></label> </div> </div> <div class="row-item setting"> <div class="setting-name" data-i18n="function_is_mark_or_remove_ad_open"></div> <div class="setting-switch"> <input type="checkbox" id="isMarkOrRemoveAdOpen" /><label class="toggle"for="isMarkOrRemoveAdOpen"></label> </div> </div> <div class="row-item setting" style="display:none;"> <div class="setting-name" data-i18n="function_is_youtube_downloading_open"></div> <div class="setting-switch"> <input type="checkbox" id="isYoutubedownloadingOpen" /><label class="toggle"for="isYoutubedownloadingOpen"></label> </div> </div> `; Dialog.showMake({ title: language.content.function_setting_title, content, styleSheet, direction: language.direction, onContentReady: function($that) { const commentTable = $that.dialogContent.querySelector("#isCommentTableOpen"); const themeProgressBar = $that.dialogContent.querySelector("#isThemeProgressBarOpen"); const speedControl = $that.dialogContent.querySelector("#isSpeedControlOpen"); const markOrRemoveAd = $that.dialogContent.querySelector("#isMarkOrRemoveAdOpen"); const youtubedownloading = $that.dialogContent.querySelector("#isYoutubedownloadingOpen"); $that.dialogContent.querySelectorAll(".setting-name").forEach((element) => { element.textContent = language.content[element.getAttribute("data-i18n")]; }); commentTable.checked = functionState.isOpenCommentTable; themeProgressBar.checked = functionState.isOpenThemeProgressBar; speedControl.checked = functionState.isOpenSpeedControl; markOrRemoveAd.checked = functionState.isOpenMarkOrRemoveAd; youtubedownloading.checked = functionState.isOpenYoutubedownloading; commentTable.addEventListener("change", (e) => { functionState.isOpenCommentTable = e.target.checked; StorageUtil.setValue(StorageUtil.keys.youtube.functionState, functionState); }); themeProgressBar.addEventListener("change", (e) => { functionState.isOpenThemeProgressBar = e.target.checked; StorageUtil.setValue(StorageUtil.keys.youtube.functionState, functionState); }); speedControl.addEventListener("change", (e) => { functionState.isOpenSpeedControl = e.target.checked; StorageUtil.setValue(StorageUtil.keys.youtube.functionState, functionState); }); markOrRemoveAd.addEventListener("change", (e) => { functionState.isOpenMarkOrRemoveAd = e.target.checked; StorageUtil.setValue(StorageUtil.keys.youtube.functionState, functionState); }); youtubedownloading.addEventListener("change", (e) => { functionState.isOpenYoutubedownloading = e.target.checked; StorageUtil.setValue(StorageUtil.keys.youtube.functionState, functionState); }); }, onClose: function() { location.reload(); } }); }, run: function() { return new Promise((resolve) => { if (/youtube\.com/.test(window.location.host)) { GM_registerMenuCommand("Setting", () => { this.showSettingDialog(); }); commonUtil.onPageLoad(() => { const theme = StorageUtil.getValue(StorageUtil.keys.youtube.theme, null); if (theme) { Theme.setTheme(theme, false); } this.insertStyle(); const functionState = this.getFunctionState(); this.genrateBox(); if (functionState && functionState.isOpenYoutubedownloading) { this.genrateShorts(); this.genrateOuterBox(); } resolve(); }); } else { resolve(); } }); } }; ((function() { const interval = setInterval(function() { if (document.body) { clearInterval(interval); try { // @license MIT (function() { "use strict"; /*! * Copyright (c) 2024 - 2025, Thaddeus310,PeterParker. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ const ScriptConst = { "lang": (navigator.language || navigator.userLanguage || "").slice(0, 2).toLowerCase() || "en", "isDev": false, "isDebug": false, "version": "1.0.1", "number": "12", "currentHost": window.location.host, "currentUrl": window.location.href }; const PlatformConst = { "x": { "p": "x", "match": /twitter|x\.com$/ }, "youtube": { "p": "youtube", "match": /youtube\.com$/ }, "tiktok": { "p": "tiktok", "match": /www\.tiktok\.com/ }, "cobalt": { "p": "cobalt", "match": /cobalt\.tools/ } }; var __async$o = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const Logger = { log: function(level = "info", ...messages) { } }; const Tools = { decryptStr: function(str) { try { if (!str) { return str; } let result = atob(str); return result.split("").reverse().join(""); } catch (e) { } return null; }, encryptStr: function(str) { try { if (!str) { return str; } let result = str.split("").reverse().join(""); return btoa(result); } catch (e) { } return null; }, getOtherPlatform: function() { let platform = null; const currentHost = window.location.host; for (let key in PlatformConst) { if (PlatformConst[key].match.test(currentHost)) { platform = PlatformConst[key].p; break; } } return platform; }, removeAnchorsByNode: function(node) { const tagName = node.tagName; if (!tagName) return; const exist = ["A", "IMG", "DIV", "SPAN", "LABEL", "TABLE", "TR", "TD", "CANVAS"].some((name) => name === tagName); if (exist) { node.removeAttribute("data-spm-anchor-id"); for (let i = 0; i < node.childNodes.length; i++) { this.removeAnchorsByNode(node.childNodes[i]); } } }, openInTab: function(url, options = { "active": true, "insert": true, "setParent": true }) { if (typeof GM_openInTab === "function") { GM_openInTab(url, options); } else { GM.openInTab(url, options); } }, onPageLoad: function(callback) { if (document.readyState === "complete") { callback(); } else { window.addEventListener("DOMContentLoaded", callback, { once: true }); window.addEventListener("load", callback, { once: true }); } }, request: function(method, url, param, headers = { "Content-Type": "application/json;charset=UTF-8" }, timeout = 20 * 1e3) { if (!url) { return Promise.reject({ "code": "exception", "result": null }); } return new Promise((resolve, reject) => { const config = { method: method.toUpperCase(), url, timeout, onload: function(response) { if (response.status >= 200 && response.status < 300) { resolve({ "code": "success", "result": response.responseText }); } else { reject({ "code": "error", "result": response.statusText }); } }, ontimeout: function(error) { reject({ "code": "error", "result": error }); }, onerror: function(error) { reject({ "code": "error", "result": error }); } }; if (config.method === "POST") { config.headers = headers != null ? headers : { "Content-Type": "application/json" }; if (JSON.stringify(config.headers).indexOf("application/json") != -1) { config.data = JSON.stringify(param); } else { config.data = param; } } else if (config.method === "GET") { config.headers = headers != null ? headers : { "Content-Type": "application/json" }; config.data = param; } GM_xmlhttpRequest(config); }); }, crossRequest: function(method = "GET", url, param = {}, headers = { "Content-Type": "application/json;charset=UTF-8" }, timeout = 20 * 1e3) { if (!url) { return Promise.reject({ "code": "exception", "result": null }); } const config = { method: method.toUpperCase(), headers }; const controller = new AbortController(); const signal = controller.signal; config.signal = signal; if (config.method === "POST") { config.headers = headers != null ? headers : { "Content-Type": "application/json" }; config.body = JSON.stringify(param); } const timeoutId = setTimeout(() => controller.abort(), timeout); return fetch(url, config).then((response) => response.ok ? response.text() : Promise.reject(response.statusText)).then((result) => { clearTimeout(timeoutId); return { "code": "success", "result": result }; }).catch((error) => { clearTimeout(timeoutId); if (error.name === "AbortError") { return { "code": "error", "result": "Request timeout" }; } return { "code": "error", "result": error }; }); }, getGoodsIdByLink: function(url = window.location.href) { if (url.indexOf("?") != -1) { url = url.split("?")[0]; } if (url.indexOf("#") != -1) { url = url.split("#")[0]; } const suffix = "html|htm|id|p"; let regex = new RegExp("\\/([^\\/]*?)\\.(" + suffix + ")"); if (/lazada\./.test(url)) { regex = new RegExp("-i(\\d+)(?:-s(\\d+))?\\.html"); } else if (/ebay\./.test(url)) { regex = new RegExp("\\/itm\\/(\\d+)"); } else if (/banggood\./.test(url)) { regex = new RegExp("-p-(\\d+)\\.html"); } const match = url.match(regex); return match ? match[1] : null; }, getParamterBySearch: function(paramsString = window.location.href, tag) { if (paramsString.indexOf("?") != -1) { paramsString = paramsString.split("?")[1]; } const params = new URLSearchParams(paramsString); return params.get(tag); }, waitForElementByInterval: function(selector, target = document.body, allowEmpty = true, delay = 10, maxDelay = 10 * 1e3) { return new Promise((resolve, reject) => { let totalDelay = 0; let element = target.querySelector(selector); let result = allowEmpty ? !!element : !!element && !!element.innerHTML; if (result) { resolve(element); } const elementInterval = setInterval(() => { if (totalDelay >= maxDelay) { clearInterval(elementInterval); resolve(null); } element = target.querySelector(selector); result = allowEmpty ? !!element : !!element && !!element.innerHTML; if (result) { clearInterval(elementInterval); resolve(element); } else { totalDelay += delay; } }, delay); }); }, randomNumber: function() { return Math.ceil(Math.random() * 1e8); }, elementInContainer: function(container, element) { return container.contains(element); }, mustGetElement: function(handler) { return __async$o(this, null, function* () { const getElements = (handler2) => __async$o(this, null, function* () { const promiseArray = []; const handlers = handler2.split("@"); for (let i = 0; i < handlers.length; i++) { const eleName = handlers[i]; if (!eleName) { continue; } if (eleName == "body") { promiseArray.push( new Promise((resolve, reject) => { resolve(document.body); }) ); } else if (eleName == "html") { promiseArray.push( new Promise((resolve, reject) => { resolve(document.html); }) ); } else { promiseArray.push(this.waitForElementByInterval(eleName, document.body, true, 10, 1500)); } } let element2 = yield Promise.race(promiseArray); return element2; }); let element = yield getElements(handler); return new Promise((resolve, reject) => { if (element) { resolve(element); return; } const waitInterval = setInterval(() => { element = getElements(handler); if (element) { clearInterval(waitInterval); resolve(element); return; } }, 2e3); }); }); }, loopTask: function(callback, delay = 1500) { callback(); setInterval(() => { callback(); }, delay); }, distinguishRemoveAndTry: function(distinguish, callback) { const distinguishElements = distinguish.map((name) => document.querySelector("*[name='" + name + "']")); const validateRs = distinguishElements.some((ele) => ele === null || ele === void 0); if (validateRs) { distinguishElements.reverse().forEach((element) => { if (element) { element.remove(); } }); callback(); } }, getDomain: function(url) { try { const hostname = new URL(url).hostname; const parts = hostname.split("."); if (parts.length > 2) { return `${parts[parts.length - 2]}.${parts[parts.length - 1]}`; } return hostname; } catch (error) { return null; } }, getCommonMarketplace: function(url = window.location.href) { try { const domainParts = new URL(url).hostname.split("."); const countryCode = domainParts[domainParts.length - 1]; return countryCode; } catch (error) { } return null; } }; const Toast = { show: function(params) { let time = params.time; let background = params.background; let color = params.color; let position = params.position; let defaultMarginValue = 50; if (time == void 0 || time == "") { time = 1500; } if (position == void 0 || position == "") { position = "center-bottom"; } const style = document.createElement("style"); style.textContent = `@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-o-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@-ms-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-moz-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-o-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-ms-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}.toast-style-kk998y{position:fixed;background:rgba(0,0,0,0.7);color:#fff;font-size:14px;line-height:1;padding:10px;border-radius:3px;left:50%;transform:translateX(-50%);-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);-o-transform:translateX(-50%);-ms-transform:translateX(-50%);z-index:999999999999999999999999999;white-space:nowrap}.fadeOut{animation:fadeOut .5s}.fadeIn{animation:fadeIn .5s}`; const el = document.createElement("div"); if (background != void 0 && background != "") { el.style.backgroundColor = background; } if (color != void 0 && color != "") { el.style.color = color; } el.setAttribute("class", "toast-style-kk998y"); el.innerText = params.message; el.style.zIndex = 999999999; if (position === "center-bottom") { el.style.bottom = defaultMarginValue + "px"; } else { el.style.top = defaultMarginValue + "px"; } document.body.appendChild(el); document.head.appendChild(style); el.classList.add("fadeIn"); setTimeout(function() { el.classList.remove("fadeIn"); el.classList.add("fadeOut"); el.addEventListener("animationend", function() { document.body.removeChild(el); document.head.removeChild(style); }); el.addEventListener("webkitAnimationEnd", function() { document.body.removeChild(el); document.head.removeChild(style); }); }, time); } }; const SupportData = { supports: null, support: null }; const StorageKeys = { activatePositionTop: "inspect_activate_position_top", token: "inspect_token", exchangeInfo: "exchange_info", supports: "supports_key", featureControl: { windowShow: "window_show" }, history: { goodsHistory: "goooods_history_key", offset: "goooods_wrapper_key", maximumRecordsKey: "goooods_max_records_key" }, langue: { custom: "custom_langue_key", objects: "langue_data_objects_key" } }; const DefaultValue = { lang: ScriptConst.lang, history: { historyStorage: { "aliexpress": [], "amazon": [], "shein": [], "shopee": [], "lazada": [], "ebay": [], "bestbuy": [], "banggood": [], "wish": [] }, offsetWrapper: { right: 10, bottom: 10 }, records: { min: 10, max: 500, default: 100 }, toolbarGoodsNum: 4 }, exchangeInfoLocal: { certificate: "https://www.jtmate.com/api/certificate", redirect: "https://www.jtmate.com/mid/redirect?url=" }, updateSupportsDelay: 1e3 * 60 * 5, updateExchangeInfoDelay: 1e3 * 60 * 10 }; const getRequestUrl = () => { const baseUrl = "https://oversea.mimixiaoke.com"; return { supports: { method: "GET", url: baseUrl + "/api/load/conf?origin=support" }, exchangeInfo: { method: "GET", url: baseUrl + "/api/exchange/info" }, detectCoupon: { method: "POST", url: baseUrl + "/api/detect/coupon" }, detectInfo: { method: "POST", url: baseUrl + "/api/detect/info" }, getLangue: { method: "POST", url: baseUrl + "/api/load/lang" }, couponQuery: { method: "GET", url: baseUrl + "/api/coupon/query" }, couponChange: { method: "GET", url: baseUrl + "/api/coupon/change" }, couponExist: { method: "GET", url: baseUrl + "/api/coupon/exist" }, couponExistConf: { method: "GET", url: baseUrl + "/api/load/conf" }, searchEnginExistConf: { method: "GET", url: baseUrl + "/api/load/conf?origin=se" }, engineScreen: { method: "POST", url: baseUrl + "/api/engine/screen" } }; }; const StorageUtil = { getValue: function(key, defaultValue) { return GM_getValue(key, defaultValue); }, setValue: function(key, value) { GM_setValue(key, value); }, deleteValue: function(key) { GM_deleteValue(key); } }; const RequestUtil = { request: function(method, url, params) { return Tools.request(method, url, params); }, _addExtraParams: function(params) { if (!params.hasOwnProperty("url")) { params.url = encodeURIComponent(window.location.href); } if (!params.hasOwnProperty("v")) { params.v = ScriptConst.version; } if (!params.hasOwnProperty("no")) { params.no = ScriptConst.number; } const token = StorageUtil.getValue(StorageKeys.token, ""); params.token = token; return params; }, _baseQuery: function(scopName, params) { params = this._addExtraParams(params); const { method, url } = getRequestUrl()[scopName]; let finalUrl = url; if (method.toUpperCase() === "GET") { finalUrl = finalUrl + "?" + Object.entries(params).map(([key, value]) => `${key}=${value}`).join("&"); params = null; } return this.request(method, finalUrl, params); }, getCouponQuery: function(params) { return this._baseQuery("couponQuery", params); }, getCouponChange: function(params) { return this._baseQuery("couponChange", params); } }; const ItemSearchBaseObj = { visitUrl: window.location.href, searchAttribute: "loop-task-i9v---search", baseUrl: "https://oversea.mimixiaoke.com", cacheRequestMap: {}, requestAndSaveSate: function(method, url, param) { return new Promise((resolve, reject) => { const key = "key_" + new Date().getTime(); const xhr = new XMLHttpRequest(); this.cacheRequestMap[key] = xhr; if (method === "GET") { let queryString = ""; if (param) { const params = new URLSearchParams(param); queryString = "?" + params.toString(); } xhr.open(method, url + queryString); xhr.send(); } else if (method === "POST") { xhr.open(method, url); xhr.setRequestHeader("Content - Type", "application/json"); xhr.send(JSON.stringify(param)); } else { resolve({ "code": "error", "requestKey": key, "result": null }); return; } xhr.onreadystatechange = function() { if (xhr.readyState === 4) { if (xhr.status >= 200 && xhr.status < 300) { try { resolve({ "code": "success", "requestKey": key, "result": xhr.responseText }); } catch (e) { resolve({ "code": "error", "requestKey": key, "result": null }); } } else { resolve({ "code": "error", "requestKey": key, "result": null }); } } }; }); }, requestConf: function() { return new Promise((resolve, reject) => { Tools.request("GET", this.baseUrl + "/api/load/conf", null).then((data) => { if (data.code == "success" && !!data.result) { resolve(data.result); } else { resolve(null); } }); }); }, pickupGoodsItem: function(platform, confString) { const visitHref = window.location.href; const selectorElementList = new Array(); let confFilter = confString; try { confFilter = confFilter.replace(/\\\\/g, "\\"); } catch (e) { } const confJson = JSON.parse(confFilter)[platform]; for (let i = 0; i < confJson.length; i++) { const itemJson = confJson[i]; if (!itemJson.hasOwnProperty("elements") || !itemJson.hasOwnProperty("matches")) { continue; } const { elements, matches } = itemJson; const isMatch = matches.map((reg) => new RegExp(reg, "i").test(visitHref)).some((res) => res); if (isMatch) { for (let j = 0; j < elements.length; j++) { selectorElementList.push({ "element": elements[j]["element"], "findA": elements[j]["findA"], "page": elements[j]["page"] }); } } } return selectorElementList; }, getGoodsLinkByElement: function(element, findTag) { let searchElement = null; if (findTag == "this") { searchElement = element; } else if (/^child@/.test(findTag)) { searchElement = element.querySelector(findTag.replace(/^child@/, "")); } return searchElement; }, getGoodsPriceByElement: function(element, tag) { const goodsPrice = element.querySelector(tag); let price = goodsPrice == null ? "" : goodsPrice.innerText; if (price) { price = price.replace(/\s|,/g, ""); } return price; }, getGoodsPrice: function(content) { content = content.replace(/,/g, ""); const amount = content.match(/(?:₱|\$|฿|₫|Rp|RM|¥)\n?\d+(?:(?:\.\d{1,3})*)?/); let price = amount ? amount[0] : ""; if (price && price.indexOf("Rp") != -1) { price = price.replace(/\./g, ""); } price = price.replace(/\n|,/g, ""); return price; }, isElementDisplayed: function(element) { if (element.offsetParent !== null) { return true; } const style = window.getComputedStyle(element); return style.display !== "none"; }, calcRequestGroup: function(array) { const itemsPerGroup = 8, len = array.length; let groups = []; for (let i = 0; i < len; i++) { const groupIndex = Math.floor(i / itemsPerGroup); if (!groups[groupIndex]) { groups[groupIndex] = []; } groups[groupIndex].push(array[i]); } return groups; } }; var __async$n = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const Aliexpress = { languageStoageKey: "language-stoage-key", currencyStoageKey: "language-currency-key", checkDomInsertRs: true, getLang: function() { const host = window.location.host; let lang = "en"; if (/^(us|ko|uk|fr|de|it|ca|au|jp|ja|he|kr|ru|br|in|es|mx|pl|tr|ar|id|th|vn|sg|my|ph|be|nl|se|ch|no|dk|at|ie|fi|pt|gr|hu|cz|bg|ro|ua|il|sa|eg|ir|pk|iq|af|ly|et|gh|ke|ng|za|tz|mg|mw|zm|bw|sn|cm|ci|gh|ma|tn|mr|mu|om|kw|qa|bh|ae|lb|jo|sy|lb|il|ps|kr|cl|pe|uy|ec|ve|bo|gt|pa|hn|ni|cr|sv|gt|sl|lr|sd|er|dj|et|mw|mz|ao|tz|zm|zw|mw|na|bw|ls|mg|km)\.aliexpress\.com$/.test(host)) { lang = host.split(".")[0]; } else if (/^www\.aliexpress\.com$/.test(host)) { lang = "en"; } else if (/^aliexpress\.ru$/.test(host)) { lang = "ru"; } GM_setValue(this.languageStoageKey, lang); return lang; }, getMarketplace: function() { let marketplace = ""; const host = window.location.host; if (/^(us|ko|uk|fr|de|it|ca|au|jp|ja|he|kr|ru|br|in|es|mx|pl|tr|ar|id|th|vn|sg|my|ph|be|nl|se|ch|no|dk|at|ie|fi|pt|gr|hu|cz|bg|ro|ua|il|sa|eg|ir|pk|iq|af|ly|et|gh|ke|ng|za|tz|mg|mw|zm|bw|sn|cm|ci|gh|ma|tn|mr|mu|om|kw|qa|bh|ae|lb|jo|sy|lb|il|ps|kr|cl|pe|uy|ec|ve|bo|gt|pa|hn|ni|cr|sv|gt|sl|lr|sd|er|dj|et|mw|mz|ao|tz|zm|zw|mw|na|bw|ls|mg|km)\.aliexpress\.com$/.test(host)) { marketplace = host.split(".")[0]; } else { marketplace = host.split(".").slice(-1)[0]; } return marketplace; }, getCurrency: function() { const host = window.location.host; return new Promise((resolve, reject) => { if (host.indexOf("aliexpress.ru") != -1) { resolve("unknown"); } else { const element = document.querySelector("div[class^='ship-to--menuItem--']") || document.querySelector("div[class^='countryFlag--']"); if (element) { let currency = element.textContent; if (currency) { currency = encodeURIComponent(currency); GM_setValue(this.currencyStoageKey, currency); resolve(currency); } else { resolve("unknown"); } } else { resolve("unknown"); } } }); }, detail: function() { return __async$n(this, null, function* () { const visitUrl = window.location.href; const validate = [/\/item\/[^\/]*?\.html\?/, /\/item\/[^\/]*?\.html$/].map((reg) => reg.test(visitUrl)).some((rs) => rs == true); if (!validate) return; const language = this.getLang(); const currency = yield this.getCurrency(); const id = Tools.getGoodsIdByLink(visitUrl); try { const params = { "ids": id, "qu": "", "p": SupportData.support.p, "lang": language, "mul": false, "currency": currency }; const data = yield RequestUtil.getCouponQuery(params); if (data.code == "success" && !!data.result) { const json = JSON.parse(data.result); Logger.log("info", "detail request json=", json); yield this.detailAnalyze(json, language, currency); } } catch (e) { } }); }, detailAnalyze: function(json, language, currency) { return __async$n(this, null, function* () { this.checkDomInsertRs = false; try { if (!json) return; let couponResult = null; let qrcodeResult = null; if (!!json.data && !!json.data.css && !!json.data.html && !!json.data.handler) { const { handler, css, html, templateId, distinguish, hint } = json.data; var mid = null; if (json.data.hasOwnProperty("mid")) { mid = json.data["mid"]; } GM_addStyle(css); const element = yield Tools.mustGetElement(handler); Logger.log("info", "coupon insert:element", element); if (element) { couponResult = { "element": element, "html": html, "templateId": templateId, "distinguish": distinguish, "hint": hint, "mid": mid }; } } if (!!json.id && !!json.mscan && !!json.mscan.html && !!json.mscan.mount) { const { iden, html, mount, distinguish } = json.mscan; const id = json.id; const promiseResultArray = []; const elementPromise = Tools.mustGetElement(mount); const params = { "id": id, "lang": language, "platform": SupportData.support.p, "currency": currency }; const reqPromise = RequestUtil.getCouponChange(params); promiseResultArray.push(elementPromise, reqPromise); const allResult = yield Promise.all(promiseResultArray); let element = null, qrcodeData = null; for (let i = 0; i < allResult.length; i++) { if (allResult[i]) { if (allResult[i].hasOwnProperty("code")) { qrcodeData = allResult[i]; } else { element = allResult[i]; } } } Logger.log("info", "qrcocd insert:element", element); if (element && qrcodeData) { qrcodeResult = { "element": element, "html": html, "iden": iden, "qrcodeData": qrcodeData, "distinguish": distinguish }; } } Tools.loopTask(() => { if (couponResult) { Tools.distinguishRemoveAndTry(couponResult.distinguish, () => { this.detailCouponAnalyze(couponResult); }); } if (qrcodeResult) { Tools.distinguishRemoveAndTry(qrcodeResult.distinguish, () => { this.detailMscanAnalyze(qrcodeResult); }); } }); } catch (error) { } finally { this.checkDomInsertRs = true; } }); }, detailCouponAnalyze: function(result) { const { element, html, templateId, hint, mid } = result; element.insertAdjacentHTML("afterend", html); const templateIdEle = document.querySelector("div[id='" + templateId + "']"); if (templateIdEle) { const couponCodeElement = templateIdEle.querySelector(".coupon-code"); const promoCode = Tools.decryptStr(couponCodeElement.getAttribute("data-encryptcode")); templateIdEle.addEventListener("click", () => { GM_setClipboard(promoCode, "txt", () => { Toast.show({ "message": hint, "background": "#D3031C" }); if (mid && mid.hasOwnProperty("target") && mid.hasOwnProperty("link") && mid.hasOwnProperty("delay")) { const { target, link, delay } = mid, linkDecrypt = Tools.decryptStr(link); setTimeout(() => { if (target === "_blank") { Tools.openInTab(linkDecrypt); } else if (target === "_self") { window.location.href = linkDecrypt; } else if (target === "_replace") { window.location.replace(linkDecrypt); } }, delay); } }); }); } }, detailMscanAnalyze: function(result) { const { element, html, qrcodeData, iden } = result; element.insertAdjacentHTML("afterend", html); if (!!qrcodeData && qrcodeData.code === "success" && !!qrcodeData.result) { const mscanImg = JSON.parse(qrcodeData.result).mscanImg; if (!!mscanImg) { const canvasElement = document.getElementById("mscan" + iden); if (canvasElement) { var cxt = canvasElement.getContext("2d"); var imgData = new Image(); imgData.src = mscanImg; imgData.onload = function() { cxt.drawImage(imgData, 0, 0, imgData.width, imgData.height); }; } } } }, trade: function() { return __async$n(this, null, function* () { const visitUrl = window.location.href; const validate = SupportData.support.trade.map((reg) => reg.test(visitUrl)).some((rs) => rs == true); if (!validate) return; const language = yield GM_getValue(this.languageStoageKey, navigator.language); const currency = yield GM_getValue(this.currencyStoageKey, "USD"); const ids = Tools.getParamterBySearch(window.location.search, "objectId") || Tools.getParamterBySearch(window.location.search, "availableProductShopcartIds") || Tools.getParamterBySearch(window.location.search, "itemId"); const params = { "ids": ids, "qu": "", "p": SupportData.support.p, "lang": language, "mul": true, "currency": currency }; const res = yield RequestUtil.getCouponQuery(params); if (res.code == "success" && !!res.result) { const json = JSON.parse(res.result); yield this.tradeAnalyze(json, language); } }); }, tradeAnalyze: function(json, language) { return __async$n(this, null, function* () { if (!json || !json.handler || !json.css || !json.templateId) { return; } const { handler, css, html, templateId, distinguish } = json; GM_addStyle(css); let element = yield Tools.mustGetElement(handler); Tools.loopTask(() => { if (!element) { return; } Tools.distinguishRemoveAndTry(distinguish, () => { element.insertAdjacentHTML("afterend", html); const templateIdEle = document.querySelector("#" + templateId + ">.item"); if (templateIdEle) { const promoCode = Tools.decryptStr(templateIdEle.querySelector(".copy").getAttribute("data-encryptcode")); templateIdEle.addEventListener("click", () => { GM_setClipboard(promoCode, "txt", () => { Toast.show({ "message": "copied", "background": "#D3031C" }); }); }); const arrowElement = document.querySelector(".pl-summary__item-arrow-pc"); if (arrowElement) { arrowElement.click(); } } }); }); }); }, removeAnchor: function() { setInterval(() => { const anchors = document.querySelectorAll("div[name^='ali-gogo-coupon-']"); anchors.forEach((element) => { Tools.removeAnchorsByNode(element); }); }, 3e3); }, start: function() { return __async$n(this, null, function* () { const { support } = SupportData; const visitUrl = window.location.href; if (support.detail.test(visitUrl)) { this.detail(); } this.trade(); this.removeAnchor(); }); } }; var __async$m = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const AliexpressSearch = { loopIsComplete: true, isInbusinessPage: function() { return /inbusiness\.aliexpress\.com\/web\/search-products/.test(ItemSearchBaseObj.visitUrl); }, isItemLink: function(url) { return SupportData.support.detail.test(url); }, pickUpWholesale: function(selectors, language, currency) { return __async$m(this, null, function* () { const items = []; try { selectors.forEach((elementObj) => { if (elementObj.element) { const elements = document.querySelectorAll(elementObj.element + ":not([" + ItemSearchBaseObj.searchAttribute + "='true'])"); Logger.log("info", "search coupon elements======>", elements.length); const findA = elementObj.findA; elements.forEach((element) => { if (element && ItemSearchBaseObj.isElementDisplayed(element) && !element.getAttribute(ItemSearchBaseObj.searchAttribute)) { const goodsLink = ItemSearchBaseObj.getGoodsLinkByElement(element, findA); let id = null; if (this.isItemLink(goodsLink)) { id = Tools.getGoodsIdByLink(goodsLink.getAttribute("href")); } if (id) { items.push({ "id": id, "platform": SupportData.support.p, "handler": element, "findA": findA, "from": "wholesale" }); } } }); } }); if (items.length > 0) { yield this.search(items, language, currency); } } catch (e) { } }); }, pickUpInbusiness: function(language, currency) { return __async$m(this, null, function* () { const validate = this.isInbusinessPage(); if (!validate) return; try { const iceContainerElement = document.querySelector("#ice-container"); const loadMoreElement = yield Tools.waitForElementByInterval("#loadMore", iceContainerElement); if (loadMoreElement) { const array = new Array(); const containerElement = loadMoreElement.previousElementSibling; if (containerElement && containerElement.tagName === "DIV") { const childNodes = containerElement.childNodes; childNodes.forEach((child) => { if (child.tagName === "A" && ItemSearchBaseObj.isElementDisplayed(child) && !child.getAttribute(ItemSearchBaseObj.searchAttribute)) { const id = Tools.getGoodsIdByLink(child.getAttribute("href")); if (id) { array.push({ "id": id, "platform": SupportData.support.p, "handler": child, "from": "inbusiness" }); } } }); } yield this.search(array, language, currency); } } catch (e) { } }); }, search: function(array, language, currency) { const groups = ItemSearchBaseObj.calcRequestGroup(array); const len = groups.length; return new Promise((resolve, reject) => { if (len <= 0) { resolve("complete"); return; } const promises = []; for (let i = 0; i < groups.length; i++) { promises.push(this.createItemHtml(groups[i], language, currency)); } Promise.all(promises).then((data) => { resolve("complete"); }); }); }, createItemHtml: function(group, language, currency) { return new Promise((resolve, reject) => { try { if (Array.isArray(group) && group.length === 0) { resolve("exception"); return; } let reqId = ""; const platform = group[0].platform; for (var i = 0; i < group.length; i++) { if (group[i].handler.getAttribute(ItemSearchBaseObj.searchAttribute)) { continue; } reqId += group[i].id + ","; } if (reqId.endsWith(",")) { reqId = reqId.slice(0, -1); } Logger.log("info", "request start >>>>>>>>>>>>>", group); const searchUrl = ItemSearchBaseObj.baseUrl + "/api/coupon/exist?platform=" + platform + "&ids=" + reqId + "&lang=" + language + "&no=12&v=1.0.1¤cy=" + currency; Logger.log("info", "request searchUrl >>>>>>>>>>>>>:", searchUrl); ItemSearchBaseObj.requestAndSaveSate("GET", searchUrl, null).then((data) => { Logger.log("info", "request finish >>>>>>>>>>>>>"); delete ItemSearchBaseObj.cacheRequestMap[data.requestKey]; if (data.code != "success" || !data.result) { resolve("exception"); return; } const json = JSON.parse(data.result); Logger.log("info", "json", json); let isBroken = false; for (let key in json) { const { encryptLink, tip } = json[key]; const item = group.find((obj) => obj.id === key); if (!item) { continue; } let handler = null, findA = null; if (item.hasOwnProperty("handler") && item.hasOwnProperty("findA")) { handler = item.handler; findA = item.findA; } if (!handler || !findA) { continue; } let decryptUrl = null; if (encryptLink) { try { const decryptLink = atob(encryptLink); decryptUrl = decryptLink.split("").reverse().join(""); } catch (e) { } } const elementA = ItemSearchBaseObj.getGoodsLinkByElement(handler, findA); const currentId = elementA ? Tools.getGoodsIdByLink(elementA.getAttribute("href")) : ""; if (currentId != key) { group.forEach((gItem) => { const ele = gItem.handler; ele.removeAttribute(ItemSearchBaseObj.searchAttribute); const tipElement = ele.querySelector("div[name^='ali-gogo-coupon-']"); if (tipElement) { tipElement.remove(); } }); Logger.log("info", "exception currentGoodsId != request id"); isBroken = true; break; } else { if (!handler.getAttribute(ItemSearchBaseObj.searchAttribute)) { handler.setAttribute(ItemSearchBaseObj.searchAttribute, "true"); if (tip) { handler.style.position = "relative"; handler.insertAdjacentHTML("beforeend", tip); Logger.log("info", "exist coupon >>>>>>>>>>>>>", key); } if (decryptUrl) { this.relativeJ(handler, decryptUrl); Logger.log("info", "good job >>>>>>>>>>>>>", key); } } } } resolve(isBroken ? "broken" : "complete"); }); } catch (e) { resolve("exception"); } }); }, relativeJ: function(handler, decryptUrl) { const clickTipAttribute = "tip-vjd1jd89fcv-i"; let elements = null; if (handler.tagName == "A") { elements = [handler]; } else { elements = handler.querySelectorAll("a"); } elements.forEach((elementA) => { const href = elementA.getAttribute("href"); if (this.isItemLink(href)) { if (elementA.getAttribute(clickTipAttribute)) { return; } elementA.setAttribute(clickTipAttribute, "true"); elementA.addEventListener("click", function(e) { let isPreventDefault = true; const target = e.target; const tagName = target.tagName.toUpperCase(); if (tagName == "A") { const href2 = target.getAttribute("href"); if (!this.isItemLink(href2)) { isPreventDefault = false; } } if (isPreventDefault) { Array.from(target.classList).forEach((className) => { const iscontains = ["icon", "-btn-"].map((name) => className.indexOf(name) != -1).some((result) => result); if (iscontains) { isPreventDefault = false; } }); } if (isPreventDefault) { e.preventDefault(); e.stopPropagation(); Tools.openInTab(decryptUrl); } }); } }); }, isRun: function() { let run = false; if (window.location.host.indexOf("aliexpress.") != -1) { run = !/\/(item|trade|checkout)\//.test(window.location.pathname); } return run; }, start: function() { return __async$m(this, null, function* () { if (!this.isRun()) { return; } let removeTagIsComplete = true; const language = Aliexpress.getLang(); const currency = yield Aliexpress.getCurrency(); const confString = yield ItemSearchBaseObj.requestConf(); if (!confString) { return; } const selectors = ItemSearchBaseObj.pickupGoodsItem(SupportData.support.p, confString); setInterval(() => __async$m(this, null, function* () { if (removeTagIsComplete && this.loopIsComplete) { this.loopIsComplete = false; yield this.pickUpInbusiness(language, currency); yield this.pickUpWholesale(selectors, language, currency); this.loopIsComplete = true; } }), 1700); if (selectors.length != 0 && window.location.pathname != "/") { let oldUrl = window.location.href; setInterval(() => { if (oldUrl != window.location.href && removeTagIsComplete) { removeTagIsComplete = false; Object.keys(ItemSearchBaseObj.cacheRequestMap).forEach((key) => { ItemSearchBaseObj.cacheRequestMap[key].abort(); }); ItemSearchBaseObj.cacheRequestMap = {}; document.querySelectorAll("*[" + ItemSearchBaseObj.searchAttribute + "='true']").forEach((element) => { element.removeAttribute(ItemSearchBaseObj.searchAttribute); const tipElement = element.querySelector("*[name^='ali-gogo-coupon-']"); if (tipElement) { tipElement.remove(); } }); oldUrl = window.location.href; removeTagIsComplete = true; } }, 777); } }); } }; var __async$l = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const Ebay = { detail: function() { return __async$l(this, null, function* () { const visitUrl = window.location.href; const id = Tools.getGoodsIdByLink(visitUrl); const varG = Tools.getParamterBySearch(window.location.href, "var"); if (!id) { return; } const marketplace = Tools.getCommonMarketplace(visitUrl); var idsG = id; if (!!varG) { idsG += "@" + varG; } try { const params = { "ids": idsG, "qu": "", "p": SupportData.support.p, "marketplace": marketplace, "mul": false }; const data = yield RequestUtil.getCouponQuery(params); if (data.code == "success" && !!data.result) { const json = JSON.parse(data.result); Logger.log("info", "detail request json=", json); yield this.detailAnalyze(json, marketplace); } } catch (e) { } }); }, detailAnalyze: function(json, marketplace) { return __async$l(this, null, function* () { let couponResult = null; let qrcodeResult = null; if (!!json.data && !!json.data.css && !!json.data.html && !!json.data.handler) { const { handler, css, html, templateId, distinguish, hint } = json.data; var mid = null; if (json.data.hasOwnProperty("mid")) { mid = json.data["mid"]; } GM_addStyle(css); const element = yield Tools.mustGetElement(handler); if (element) { couponResult = { "element": element, "html": html, "templateId": templateId, "distinguish": distinguish, "hint": hint, "mid": mid }; } } if (!!json.id && !!json.mscan && !!json.mscan.html && !!json.mscan.mount) { const { iden, html, mount, distinguish } = json.mscan; const id = json.id; const promiseResultArray = []; const elementPromise = Tools.mustGetElement(mount); const params = { "id": id, "marketplace": marketplace, "platform": SupportData.support.p }; const reqPromise = RequestUtil.getCouponChange(params); promiseResultArray.push(elementPromise, reqPromise); const allResult = yield Promise.all(promiseResultArray); let element = null, qrcodeData = null; for (let i = 0; i < allResult.length; i++) { if (allResult[i]) { if (allResult[i].hasOwnProperty("code")) { qrcodeData = allResult[i]; } else { element = allResult[i]; } } } if (element && qrcodeData) { qrcodeResult = { "element": element, "html": html, "iden": iden, "qrcodeData": qrcodeData, "distinguish": distinguish }; } } Tools.loopTask(() => { if (couponResult) { Tools.distinguishRemoveAndTry(couponResult.distinguish, () => { this.detailCouponAnalyze(couponResult); }); } if (qrcodeResult) { Tools.distinguishRemoveAndTry(qrcodeResult.distinguish, () => { this.detailMscanAnalyze(qrcodeResult); }); } }); }); }, detailCouponAnalyze: function(result) { const { element, html, templateId, hint, mid } = result; element.insertAdjacentHTML("afterend", html); const templateIdEle = document.querySelector("div[id='" + templateId + "']"); if (templateIdEle) { const couponCodeElement = templateIdEle.querySelector(".coupon-code"); const promoCode = Tools.decryptStr(couponCodeElement.getAttribute("data-encryptcode")); templateIdEle.addEventListener("click", () => { GM_setClipboard(promoCode, "txt", () => { Toast.show({ "message": hint, "background": "#D3031C" }); if (mid && mid.hasOwnProperty("target") && mid.hasOwnProperty("link") && mid.hasOwnProperty("delay")) { const { target, link, delay } = mid, linkDecrypt = Tools.decryptStr(link); setTimeout(() => { if (target === "_blank") { Tools.openInTab(linkDecrypt); } else if (target === "_self") { window.location.href = linkDecrypt; } else if (target === "_replace") { window.location.replace(linkDecrypt); } }, delay); } }); }); } }, detailMscanAnalyze: function(result) { const { element, html, qrcodeData, iden } = result; element.insertAdjacentHTML("afterend", html); if (!!qrcodeData && qrcodeData.code === "success" && !!qrcodeData.result) { const mscanImg = JSON.parse(qrcodeData.result).mscanImg; if (!!mscanImg) { const canvasElement = document.getElementById("mscan" + iden); if (canvasElement) { var cxt = canvasElement.getContext("2d"); var imgData = new Image(); imgData.src = mscanImg; imgData.onload = function() { cxt.drawImage(imgData, 0, 0, imgData.width, imgData.height); }; } } } }, start: function() { return __async$l(this, null, function* () { const { support } = SupportData; const visitUrl = window.location.href; if (support.detail.test(visitUrl)) { this.detail(); } }); } }; var __async$k = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const EbaySearch = { loopIsComplete: true, isRun: function() { let run = false; if (window.location.host.indexOf("ebay.") != -1) { run = !/\/(item|itm|trade|checkout|rxo)\//.test(window.location.pathname); } return run; }, isItemLink: function(url) { return SupportData.support.detail.test(url); }, pickUpItems: function(selectors, marketplace) { return __async$k(this, null, function* () { const items = []; try { selectors.forEach((elementObj) => { if (elementObj.element) { const elements = document.querySelectorAll(elementObj.element + ":not([" + ItemSearchBaseObj.searchAttribute + "='true'])"); Logger.log("info", "search coupon elements======>", elements); const findA = elementObj.findA; elements.forEach((element) => { if (element && ItemSearchBaseObj.isElementDisplayed(element) && !element.getAttribute(ItemSearchBaseObj.searchAttribute)) { const goodsLink = ItemSearchBaseObj.getGoodsLinkByElement(element, findA); const priceQuery = [ "*[class*='detail'] >*[class*='price']", "*[class*='merch-price'] >span" ].join(","); const price = ItemSearchBaseObj.getGoodsPriceByElement(element, priceQuery); let id = null, varG = null; if (this.isItemLink(goodsLink)) { const goodsLinkHref = goodsLink.getAttribute("href"); id = Tools.getGoodsIdByLink(goodsLinkHref); varG = Tools.getParamterBySearch(goodsLinkHref, "var"); } if (id) { items.push({ "id": id, "varG": varG, "price": price, "platform": SupportData.support.p, "handler": element, "findA": findA, "from": "search" }); } } }); } }); Logger.log("info", items); if (items.length > 0) { yield this.search(items, marketplace); } } catch (e) { } }); }, search: function(array, marketplace) { return __async$k(this, null, function* () { const groups = ItemSearchBaseObj.calcRequestGroup(array); const len = groups.length; return new Promise((resolve, reject) => { if (len <= 0) { resolve("complete"); return; } const promises = []; for (let i = 0; i < groups.length; i++) { promises.push(this.createItemHtml(groups[i], marketplace)); } Promise.all(promises).then((data) => { resolve("complete"); }); }); }); }, createItemHtml: function(group, marketplace) { return new Promise((resolve, reject) => { try { if (Array.isArray(group) && group.length === 0) { resolve("exception"); return; } let reqId = ""; const platform = group[0].platform; for (var i = 0; i < group.length; i++) { if (group[i].handler.getAttribute(ItemSearchBaseObj.searchAttribute)) { continue; } reqId += group[i].id; if (!!group[i].varG) { reqId += "@" + group[i].varG; } reqId += ":" + group[i].price + ","; } if (reqId.endsWith(",")) { reqId = reqId.slice(0, -1); } Logger.log("info", "request start >>>>>>>>>>>>>", group); const searchUrl = ItemSearchBaseObj.baseUrl + "/api/coupon/exist?platform=" + platform + "&ids=" + reqId + "&marketplace=" + marketplace + "&no=12&v=1.0.1"; Logger.log("info", "request searchUrl >>>>>>>>>>>>>:", searchUrl); ItemSearchBaseObj.requestAndSaveSate("GET", searchUrl, null).then((data) => { Logger.log("info", "request finish >>>>>>>>>>>>>", data); delete ItemSearchBaseObj.cacheRequestMap[data.requestKey]; if (data.code != "success" || !data.result) { resolve("exception"); return; } const json = JSON.parse(data.result); for (let key in json) { const { encryptLink, tip } = json[key]; const item = group.find((obj) => obj.id === key); if (!item) { continue; } let handler = null, findA = null; if (item.hasOwnProperty("handler") && item.hasOwnProperty("findA")) { handler = item.handler; findA = item.findA; } if (!handler || !findA) { continue; } let decryptUrl = null; if (encryptLink) { try { const decryptLink = atob(encryptLink); decryptUrl = decryptLink.split("").reverse().join(""); } catch (e) { } } const elementA = ItemSearchBaseObj.getGoodsLinkByElement(handler, findA); if (!handler.getAttribute(ItemSearchBaseObj.searchAttribute)) { handler.setAttribute(ItemSearchBaseObj.searchAttribute, "true"); if (tip) { handler.style.position = "relative"; handler.insertAdjacentHTML("beforeend", tip); Logger.log("info", "exist coupon >>>>>>>>>>>>>", key); } if (decryptUrl) { this.relativeJ(handler, decryptUrl); Logger.log("info", "good job >>>>>>>>>>>>>", key); } } } resolve("complete"); }); } catch (e) { resolve("exception"); } }); }, relativeJ: function(handler, decryptUrl) { const clickTipAttribute = "tip-vjd1jd89fcv-i", self = this; let elements = null; if (handler.tagName == "A") { elements = [handler]; } else { elements = handler.querySelectorAll("a"); } elements.forEach((elementA) => { const href = elementA.getAttribute("href"); if (self.isItemLink(href)) { if (elementA.getAttribute(clickTipAttribute)) { return; } elementA.setAttribute(clickTipAttribute, "true"); elementA.addEventListener("click", function(e) { let isPreventDefault = true; const target = e.target; const tagName = target.tagName.toUpperCase(); if (tagName == "A") { const href2 = target.getAttribute("href"); if (!self.isItemLink(href2)) { isPreventDefault = false; } } if (isPreventDefault) { Array.from(target.classList).forEach((className) => { const iscontains = ["btn", "icon"].map((name) => className.indexOf(name) != -1).some((result) => result); if (iscontains) { isPreventDefault = false; } }); } if (isPreventDefault) { e.preventDefault(); e.stopPropagation(); Tools.openInTab(decryptUrl); } }); } }); }, start: function() { return __async$k(this, null, function* () { if (!this.isRun()) { return; } const marketplace = Tools.getCommonMarketplace(window.location.href); const confString = yield ItemSearchBaseObj.requestConf(); if (!confString) { return; } const selectors = ItemSearchBaseObj.pickupGoodsItem(SupportData.support.p, confString); setInterval(() => __async$k(this, null, function* () { if (this.loopIsComplete) { this.loopIsComplete = false; yield this.pickUpItems(selectors, marketplace); this.loopIsComplete = true; } }), 1700); }); } }; var __async$j = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const Lazada = { detailMyMscanAnalyze: function(result) { return __async$j(this, null, function* () { const { id, iden, marketplace, platform, mount, html, cmd } = result; if (!mount || !html) { return; } if (cmd && cmd.do && cmd.ele) { const cmdElement = yield Tools.waitForElementByInterval(cmd.ele); if (cmdElement) { if (cmd.do == "empty") { cmdElement.innerHTML = ""; } } } const element = yield Tools.mustGetElement(mount); if (!element) { return; } element.insertAdjacentHTML("beforeend", html); const params = { "id": id, "marketplace": marketplace, "platform": platform }; const qrcodeData = yield RequestUtil.getCouponChange(params); if (!!qrcodeData && qrcodeData.code === "success" && !!qrcodeData.result) { let mscanImg = JSON.parse(qrcodeData.result).mscanImg; if (!!mscanImg) { var canvasElement = document.getElementById("mscan" + iden); if (!!canvasElement) { var cxt = canvasElement.getContext("2d"); var imgData = new Image(); imgData.src = mscanImg; imgData.onload = function() { cxt.drawImage(imgData, 0, 0, imgData.width, imgData.height); }; } } } }); }, detail: function() { return __async$j(this, null, function* () { const visitUrl = window.location.href; const marketplace = Tools.getCommonMarketplace(visitUrl); const ids = Tools.getGoodsIdByLink(visitUrl); if (!ids) { return; } try { const params = { "ids": ids, "qu": "", "p": SupportData.support.p, "marketplace": marketplace, "mul": false }; const data = yield RequestUtil.getCouponQuery(params); if (!!data && data.code === "success" && !!data.result) { const json = JSON.parse(data.result); if (json && json.mscan) { const { distinguish, iden, html, cmd, mount } = json.mscan; const mscanResult = { "id": json.id, "iden": iden, "marketplace": marketplace, "platform": SupportData.support.p, "mount": mount, "html": html, "cmd": cmd }; Tools.loopTask(() => { Tools.distinguishRemoveAndTry(distinguish, () => { this.detailMyMscanAnalyze(mscanResult); }); }); } } } catch (e) { } }); }, start: function() { return __async$j(this, null, function* () { const { support } = SupportData; const visitUrl = window.location.href; if (support.detail.test(visitUrl)) { this.detail(); } }); } }; var __async$i = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const LazadaSearch = { loopIsComplete: true, isRun: function() { let run = false; if (window.location.host.indexOf("lazada.") != -1) { run = !this.isItemLink(window.location.href) && !/\/(\/shipping\\?)\//.test(window.location.pathname); } return run; }, isItemLink: function(url) { return SupportData.support.detail.test(url); }, pickUpItems: function(selectors, marketplace) { return __async$i(this, null, function* () { const items = []; try { selectors.forEach((elementObj) => { if (elementObj.element) { const elements = document.querySelectorAll(elementObj.element + ":not([" + ItemSearchBaseObj.searchAttribute + "='true'])"); Logger.log("info", "search coupon elements======>", elements); const findA = elementObj.findA; elements.forEach((element) => { if (element && ItemSearchBaseObj.isElementDisplayed(element) && !element.getAttribute(ItemSearchBaseObj.searchAttribute)) { const goodsLink = ItemSearchBaseObj.getGoodsLinkByElement(element, findA); const price = ItemSearchBaseObj.getGoodsPrice(element.innerText); let id = null; if (this.isItemLink(goodsLink)) { id = Tools.getGoodsIdByLink(goodsLink.getAttribute("href")); } if (id) { items.push({ "id": id, "price": price, "platform": SupportData.support.p, "handler": element, "findA": findA, "from": "search" }); } } }); } }); Logger.log("info", items); if (items.length > 0) { yield this.search(items, marketplace); } } catch (e) { } }); }, search: function(array, marketplace) { return __async$i(this, null, function* () { const groups = ItemSearchBaseObj.calcRequestGroup(array); const len = groups.length; return new Promise((resolve, reject) => { if (len <= 0) { resolve("complete"); return; } const promises = []; for (let i = 0; i < groups.length; i++) { promises.push(this.createItemHtml(groups[i], marketplace)); } Promise.all(promises).then((data) => { resolve("complete"); }); }); }); }, createItemHtml: function(group, marketplace) { return new Promise((resolve, reject) => { try { if (Array.isArray(group) && group.length === 0) { resolve("exception"); return; } let reqId = ""; const platform = group[0].platform; for (var i = 0; i < group.length; i++) { if (group[i].handler.getAttribute(ItemSearchBaseObj.searchAttribute)) { continue; } reqId += group[i].id + ":" + group[i].price + ","; } if (reqId.endsWith(",")) { reqId = reqId.slice(0, -1); } Logger.log("info", "request start >>>>>>>>>>>>>", group); const searchUrl = ItemSearchBaseObj.baseUrl + "/api/coupon/exist?platform=" + platform + "&ids=" + reqId + "&marketplace=" + marketplace + "&no=12&v=1.0.1"; Logger.log("info", "request searchUrl >>>>>>>>>>>>>:", searchUrl); ItemSearchBaseObj.requestAndSaveSate("GET", searchUrl, null).then((data) => { Logger.log("info", "request finish >>>>>>>>>>>>>", data); delete ItemSearchBaseObj.cacheRequestMap[data.requestKey]; if (data.code != "success" || !data.result) { resolve("exception"); return; } const json = JSON.parse(data.result); Logger.log("info", "request finish json>>>>>>>>>>>>>", json); for (let key in json) { const { encryptLink, tip } = json[key]; const { handler, findA } = group.find((obj) => obj.id === key); let decryptUrl = null; if (encryptLink) { try { const decryptLink = atob(encryptLink); decryptUrl = decryptLink.split("").reverse().join(""); } catch (e) { } } const elementA = ItemSearchBaseObj.getGoodsLinkByElement(handler, findA); if (!handler.getAttribute(ItemSearchBaseObj.searchAttribute)) { handler.setAttribute(ItemSearchBaseObj.searchAttribute, "true"); if (tip) { handler.style.position = "relative"; handler.insertAdjacentHTML("beforeend", tip); Logger.log("info", "exist coupon >>>>>>>>>>>>>", key); } if (decryptUrl) { this.relativeJ(handler, decryptUrl); Logger.log("info", "good job >>>>>>>>>>>>>", key); } } } resolve("complete"); }); } catch (e) { resolve("exception"); } }); }, relativeJ: function(handler, decryptUrl) { let selectorA = null; if (handler.tagName == "A") { selectorA = [handler]; } else { selectorA = handler.querySelectorAll("a"); } selectorA.forEach((element_a) => { if (this.isItemLink(element_a.getAttribute("href"))) { element_a.addEventListener("click", function(e) { e.preventDefault(); e.stopPropagation(); Tools.openInTab(decryptUrl); }); } }); }, start: function() { return __async$i(this, null, function* () { if (!this.isRun()) { return; } const marketplace = Tools.getCommonMarketplace(window.location.href); const confString = yield ItemSearchBaseObj.requestConf(); if (!confString) { return; } const selectors = ItemSearchBaseObj.pickupGoodsItem(SupportData.support.p, confString); setInterval(() => __async$i(this, null, function* () { if (this.loopIsComplete) { this.loopIsComplete = false; yield this.pickUpItems(selectors, marketplace); this.loopIsComplete = true; } }), 1700); }); } }; var __async$h = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const Bestbuy = { detail: function() { return __async$h(this, null, function* () { const visitUrl = window.location.href; const id = Tools.getGoodsIdByLink(visitUrl); if (!id) { return; } const marketplace = Tools.getCommonMarketplace(visitUrl); try { const params = { "ids": id, "qu": "", "p": SupportData.support.p, "marketplace": marketplace, "mul": false }; const data = yield RequestUtil.getCouponQuery(params); if (data.code == "success" && !!data.result) { const json = JSON.parse(data.result); Logger.log("info", "detail request json=", json); yield this.detailAnalyze(json, marketplace); } } catch (e) { } }); }, detailAnalyze: function(json, marketplace) { return __async$h(this, null, function* () { let couponResult = null; let qrcodeResult = null; if (!!json.data && !!json.data.css && !!json.data.html && !!json.data.handler) { const { handler, css, html, templateId, distinguish } = json.data; GM_addStyle(css); const element = yield Tools.mustGetElement(handler); if (element) { couponResult = { "element": element, "html": html, "templateId": templateId, "distinguish": distinguish }; } } if (!!json.id && !!json.mscan && !!json.mscan.html && !!json.mscan.mount) { const { iden, html, mount, distinguish } = json.mscan; const id = json.id; const promiseResultArray = []; const elementPromise = Tools.mustGetElement(mount); const params = { "id": id, "marketplace": marketplace, "platform": SupportData.support.p }; const reqPromise = RequestUtil.getCouponChange(params); promiseResultArray.push(elementPromise, reqPromise); const allResult = yield Promise.all(promiseResultArray); let element = null, qrcodeData = null; for (let i = 0; i < allResult.length; i++) { if (allResult[i]) { if (allResult[i].hasOwnProperty("code")) { qrcodeData = allResult[i]; } else { element = allResult[i]; } } } if (element && qrcodeData) { qrcodeResult = { "element": element, "html": html, "iden": iden, "qrcodeData": qrcodeData, "distinguish": distinguish }; } } Tools.loopTask(() => { if (couponResult) { Tools.distinguishRemoveAndTry(couponResult.distinguish, () => { this.detailCouponAnalyze(couponResult); }); } if (qrcodeResult) { Tools.distinguishRemoveAndTry(qrcodeResult.distinguish, () => { this.detailMscanAnalyze(qrcodeResult); }); } }); }); }, detailCouponAnalyze: function(result) { const { element, html, templateId } = result; element.insertAdjacentHTML("afterend", html); const templateIdEle = document.querySelector("div[id='" + templateId + "']"); if (templateIdEle) { const couponCodeElement = templateIdEle.querySelector(".coupon-code"); const promoCode = Tools.decryptStr(couponCodeElement.getAttribute("data-encryptcode")); templateIdEle.addEventListener("click", () => { GM_setClipboard(promoCode, "txt", () => { Toast.show({ "message": "copied", "background": "#D3031C" }); }); }); } }, detailMscanAnalyze: function(result) { const { element, html, qrcodeData, iden } = result; element.insertAdjacentHTML("afterend", html); if (!!qrcodeData && qrcodeData.code === "success" && !!qrcodeData.result) { const mscanImg = JSON.parse(qrcodeData.result).mscanImg; if (!!mscanImg) { const canvasElement = document.getElementById("mscan" + iden); if (canvasElement) { var cxt = canvasElement.getContext("2d"); var imgData = new Image(); imgData.src = mscanImg; imgData.onload = function() { cxt.drawImage(imgData, 0, 0, imgData.width, imgData.height); }; } } } }, start: function() { return __async$h(this, null, function* () { const { support } = SupportData; const visitUrl = window.location.href; if (support.detail.test(visitUrl)) { this.detail(); } }); } }; var __async$g = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const BestbuySearch = { loopIsComplete: true, pickUpItems: function(selectors, marketplace) { return __async$g(this, null, function* () { const items = []; try { selectors.forEach((elementObj) => { if (elementObj.element) { const elements = document.querySelectorAll(elementObj.element + ":not([" + ItemSearchBaseObj.searchAttribute + "='true'])"); Logger.log("info", "search coupon elements======>", elements); const findA = elementObj.findA; elements.forEach((element) => { if (element && ItemSearchBaseObj.isElementDisplayed(element) && !element.getAttribute(ItemSearchBaseObj.searchAttribute)) { const goodsLink = ItemSearchBaseObj.getGoodsLinkByElement(element, findA); const priceQuery = [ "div.pricing" ].join(","); const price = ItemSearchBaseObj.getGoodsPrice( ItemSearchBaseObj.getGoodsPriceByElement(element, priceQuery) ); let id = null; if (this.isItemLink(goodsLink)) { id = Tools.getGoodsIdByLink(goodsLink.getAttribute("href")); } if (id) { items.push({ "id": id, "price": price, "platform": SupportData.support.p, "handler": element, "findA": findA, "from": "search" }); } } }); } }); Logger.log("info", items); if (items.length > 0) { yield this.search(items, marketplace); } } catch (e) { } }); }, search: function(array, marketplace) { return __async$g(this, null, function* () { const groups = ItemSearchBaseObj.calcRequestGroup(array); const len = groups.length; return new Promise((resolve, reject) => { if (len <= 0) { resolve("complete"); return; } const promises = []; for (let i = 0; i < groups.length; i++) { promises.push(this.createItemHtml(groups[i], marketplace)); } Promise.all(promises).then((data) => { resolve("complete"); }); }); }); }, createItemHtml: function(group, marketplace) { return new Promise((resolve, reject) => { try { if (Array.isArray(group) && group.length === 0) { resolve("exception"); return; } let reqId = ""; const platform = group[0].platform; for (var i = 0; i < group.length; i++) { if (group[i].handler.getAttribute(ItemSearchBaseObj.searchAttribute)) { continue; } reqId += group[i].id + ":" + group[i].price + ","; } if (reqId.endsWith(",")) { reqId = reqId.slice(0, -1); } Logger.log("info", "request start >>>>>>>>>>>>>", group); const searchUrl = ItemSearchBaseObj.baseUrl + "/api/coupon/exist?platform=" + platform + "&ids=" + reqId + "&marketplace=" + marketplace + "&no=12&v=1.0.1"; Logger.log("info", "request searchUrl >>>>>>>>>>>>>:", searchUrl); ItemSearchBaseObj.requestAndSaveSate("GET", searchUrl, null).then((data) => { Logger.log("info", "request finish >>>>>>>>>>>>>", data); delete ItemSearchBaseObj.cacheRequestMap[data.requestKey]; if (data.code != "success" || !data.result) { resolve("exception"); return; } const json = JSON.parse(data.result); for (let key in json) { const { encryptLink, tip } = json[key]; const item = group.find((obj) => obj.id === key); if (!item) { continue; } let handler = null, findA = null; if (item.hasOwnProperty("handler") && item.hasOwnProperty("findA")) { handler = item.handler; findA = item.findA; } if (!handler || !findA) { continue; } let decryptUrl = null; if (encryptLink) { try { const decryptLink = atob(encryptLink); decryptUrl = decryptLink.split("").reverse().join(""); } catch (e) { } } const elementA = ItemSearchBaseObj.getGoodsLinkByElement(handler, findA); if (!handler.getAttribute(ItemSearchBaseObj.searchAttribute)) { handler.setAttribute(ItemSearchBaseObj.searchAttribute, "true"); if (tip) { handler.style.position = "relative"; handler.insertAdjacentHTML("beforeend", tip); Logger.log("info", "exist coupon >>>>>>>>>>>>>", key); } if (decryptUrl) { this.relativeJ(handler, decryptUrl); Logger.log("info", "good job >>>>>>>>>>>>>", key); } } } resolve("complete"); }); } catch (e) { resolve("exception"); } }); }, relativeJ: function(handler, decryptUrl) { const clickTipAttribute = "tip-vjd1jd89fcv-i", self = this; let elements = null; if (handler.tagName == "A") { elements = [handler]; } else { elements = handler.querySelectorAll("a"); } elements.forEach((elementA) => { const href = elementA.getAttribute("href"); if (self.isItemLink(href)) { if (elementA.getAttribute(clickTipAttribute)) { return; } elementA.setAttribute(clickTipAttribute, "true"); elementA.addEventListener("click", function(e) { let isPreventDefault = true; const target = e.target; const tagName = target.tagName.toUpperCase(); if (tagName == "A") { const href2 = target.getAttribute("href"); if (!self.isItemLink(href2)) { isPreventDefault = false; } } if (isPreventDefault) { Array.from(target.classList).forEach((className) => { const iscontains = ["btn", "icon"].map((name) => className.indexOf(name) != -1).some((result) => result); if (iscontains) { isPreventDefault = false; } }); } if (isPreventDefault) { e.preventDefault(); e.stopPropagation(); Tools.openInTab(decryptUrl); } }); } }); }, isItemLink: function(url) { return SupportData.support.detail.test(url); }, isRun: function() { return /https:\/\/www\.bestbuy\.com\/site\/searchpage\.jsp/.test(window.location.href); }, start: function() { return __async$g(this, null, function* () { if (!this.isRun()) { return; } const marketplace = Tools.getCommonMarketplace(window.location.href); const confString = yield ItemSearchBaseObj.requestConf(); if (!confString) { return; } const selectors = ItemSearchBaseObj.pickupGoodsItem(SupportData.support.p, confString); setInterval(() => __async$g(this, null, function* () { if (this.loopIsComplete) { this.loopIsComplete = false; yield this.pickUpItems(selectors, marketplace); this.loopIsComplete = true; } }), 1700); }); } }; var __async$f = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const Banggood = { getLang: function() { return document.querySelector("html").getAttribute("lang") || ""; }, getCurrency: function() { const element = document.querySelector(".shipto-state"); if (element) { return encodeURIComponent(element.textContent); } return ""; }, getMarketplace: function(url = window.location.href) { const marketplace = [ /https?:\/\/www\.banggood\.com\/([a-z]{2,3})\//, /https?:\/\/([a-z]{2,3})\.banggood\.com/ ].map((rs) => { var match = url.match(rs); if (match) { return match[1]; } return null; }).find((rs) => rs != null); return marketplace ? marketplace : "com"; }, detail: function() { return __async$f(this, null, function* () { const visitUrl = window.location.href; const id = Tools.getGoodsIdByLink(visitUrl); if (!id) { return; } const marketplace = this.getMarketplace(visitUrl); const currency = this.getCurrency(); const lang = this.getLang(); try { const params = { "ids": id, "qu": "", "p": SupportData.support.p, "marketplace": marketplace, "mul": false, "currency": currency, "lang": lang }; const data = yield RequestUtil.getCouponQuery(params); if (data.code == "success" && !!data.result) { const json = JSON.parse(data.result); Logger.log("info", "detail request json=", json); yield this.detailAnalyze(json, marketplace); } } catch (e) { } }); }, detailAnalyze: function(json, marketplace) { return __async$f(this, null, function* () { let couponResult = null; let qrcodeResult = null; if (!!json.data && !!json.data.css && !!json.data.html && !!json.data.handler) { const { handler, css, html, templateId, distinguish, hint } = json.data; var mid = null; if (json.data.hasOwnProperty("mid")) { mid = json.data["mid"]; } GM_addStyle(css); const element = yield Tools.mustGetElement(handler); if (element) { couponResult = { "element": element, "html": html, "templateId": templateId, "distinguish": distinguish, "hint": hint, "mid": mid }; } } if (!!json.id && !!json.mscan && !!json.mscan.html && !!json.mscan.mount) { const { iden, html, mount, distinguish } = json.mscan; const id = json.id; const promiseResultArray = []; const elementPromise = Tools.mustGetElement(mount); const params = { "id": id, "marketplace": marketplace, "platform": SupportData.support.p }; const reqPromise = RequestUtil.getCouponChange(params); promiseResultArray.push(elementPromise, reqPromise); const allResult = yield Promise.all(promiseResultArray); let element = null, qrcodeData = null; for (let i = 0; i < allResult.length; i++) { if (allResult[i]) { if (allResult[i].hasOwnProperty("code")) { qrcodeData = allResult[i]; } else { element = allResult[i]; } } } if (element && qrcodeData) { qrcodeResult = { "element": element, "html": html, "iden": iden, "qrcodeData": qrcodeData, "distinguish": distinguish }; } } Tools.loopTask(() => { if (couponResult) { Tools.distinguishRemoveAndTry(couponResult.distinguish, () => { this.detailCouponAnalyze(couponResult); }); } if (qrcodeResult) { Tools.distinguishRemoveAndTry(qrcodeResult.distinguish, () => { this.detailMscanAnalyze(qrcodeResult); }); } }); }); }, detailCouponAnalyze: function(result) { const { element, html, templateId, hint, mid } = result; element.insertAdjacentHTML("afterend", html); const templateIdEle = document.querySelector("div[id='" + templateId + "']"); if (templateIdEle) { const couponCodeElement = templateIdEle.querySelector(".coupon-code"); const promoCode = Tools.decryptStr(couponCodeElement.getAttribute("data-encryptcode")); templateIdEle.addEventListener("click", () => { GM_setClipboard(promoCode, "txt", () => { Toast.show({ "message": hint, "background": "#D3031C" }); if (mid && mid.hasOwnProperty("target") && mid.hasOwnProperty("link") && mid.hasOwnProperty("delay")) { const { target, link, delay } = mid, linkDecrypt = Tools.decryptStr(link); setTimeout(() => { if (target === "_blank") { Tools.openInTab(linkDecrypt); } else if (target === "_self") { window.location.href = linkDecrypt; } else if (target === "_replace") { window.location.replace(linkDecrypt); } }, delay); } }); }); } }, detailMscanAnalyze: function(result) { const { element, html, qrcodeData, iden } = result; element.insertAdjacentHTML("afterend", html); if (!!qrcodeData && qrcodeData.code === "success" && !!qrcodeData.result) { const mscanImg = JSON.parse(qrcodeData.result).mscanImg; if (!!mscanImg) { const canvasElement = document.getElementById("mscan" + iden); if (canvasElement) { var cxt = canvasElement.getContext("2d"); var imgData = new Image(); imgData.src = mscanImg; imgData.onload = function() { cxt.drawImage(imgData, 0, 0, imgData.width, imgData.height); }; } } } }, start: function() { return __async$f(this, null, function* () { const { support } = SupportData; const visitUrl = window.location.href; if (support.detail.test(visitUrl)) { this.detail(); } }); } }; var __async$e = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const BanggoodSearch = { loopIsComplete: true, pickUpItems: function(selectors, marketplace, lang, currency) { return __async$e(this, null, function* () { const items = []; try { selectors.forEach((elementObj) => { if (elementObj.element) { const elements = document.querySelectorAll(elementObj.element + ":not([" + ItemSearchBaseObj.searchAttribute + "='true'])"); Logger.log("info", "search coupon elements======>", elements); const findA = elementObj.findA; elements.forEach((element) => { if (element && ItemSearchBaseObj.isElementDisplayed(element) && !element.getAttribute(ItemSearchBaseObj.searchAttribute)) { const goodsLink = ItemSearchBaseObj.getGoodsLinkByElement(element, findA); const priceQuery = ["span.price"].join(","); const price = ItemSearchBaseObj.getGoodsPriceByElement(element, priceQuery); let id = null; if (SupportData.support.detail.test(goodsLink)) { const goodsLinkHref = goodsLink.getAttribute("href"); id = Tools.getGoodsIdByLink(goodsLinkHref); } if (id) { items.push({ "id": id, "price": price, "platform": SupportData.support.p, "handler": element, "findA": findA, "from": "search" }); } } }); } }); Logger.log("info", items); if (items.length > 0) { yield this.search(items, marketplace, lang, currency); } } catch (e) { } }); }, search: function(array, marketplace, lang, currency) { return __async$e(this, null, function* () { const groups = ItemSearchBaseObj.calcRequestGroup(array); const len = groups.length; return new Promise((resolve, reject) => { if (len <= 0) { resolve("complete"); return; } const promises = []; for (let i = 0; i < groups.length; i++) { promises.push(this.createItemHtml(groups[i], marketplace, lang, currency)); } Promise.all(promises).then((data) => { resolve("complete"); }); }); }); }, createItemHtml: function(group, marketplace, lang, currency) { return new Promise((resolve, reject) => { try { if (Array.isArray(group) && group.length === 0) { resolve("exception"); return; } let reqId = ""; const platform = group[0].platform; for (var i = 0; i < group.length; i++) { if (group[i].handler.getAttribute(ItemSearchBaseObj.searchAttribute)) { continue; } reqId += group[i].id + ":" + group[i].price + ","; } if (reqId.endsWith(",")) { reqId = reqId.slice(0, -1); } Logger.log("info", "request start >>>>>>>>>>>>>", group); const searchUrl = ItemSearchBaseObj.baseUrl + "/api/coupon/exist?platform=" + platform + "&ids=" + reqId + "&marketplace=" + marketplace + "&no=12&v=1.0.1¤cy=" + currency + "&lang=" + lang; Logger.log("info", "request searchUrl >>>>>>>>>>>>>:", searchUrl); ItemSearchBaseObj.requestAndSaveSate("GET", searchUrl, null).then((data) => { Logger.log("info", "request finish >>>>>>>>>>>>>", data); delete ItemSearchBaseObj.cacheRequestMap[data.requestKey]; if (data.code != "success" || !data.result) { resolve("exception"); return; } const json = JSON.parse(data.result); for (let key in json) { const { encryptLink, tip } = json[key]; const item = group.find((obj) => obj.id === key); if (!item) { continue; } let handler = null, findA = null; if (item.hasOwnProperty("handler") && item.hasOwnProperty("findA")) { handler = item.handler; findA = item.findA; } if (!handler || !findA) { continue; } let decryptUrl = null; if (encryptLink) { try { const decryptLink = atob(encryptLink); decryptUrl = decryptLink.split("").reverse().join(""); } catch (e) { } } const elementA = ItemSearchBaseObj.getGoodsLinkByElement(handler, findA); if (!handler.getAttribute(ItemSearchBaseObj.searchAttribute)) { handler.setAttribute(ItemSearchBaseObj.searchAttribute, "true"); if (tip) { handler.style.position = "relative"; handler.insertAdjacentHTML("beforeend", tip); Logger.log("info", "exist coupon >>>>>>>>>>>>>", key); } if (decryptUrl) { this.relativeJ(handler, decryptUrl); Logger.log("info", "good job >>>>>>>>>>>>>", key); } } } resolve("complete"); }); } catch (e) { resolve("exception"); } }); }, relativeJ: function(handler, decryptUrl) { const clickTipAttribute = "tip-vjd1jd89fcv-i"; let elements = null; if (handler.tagName == "A") { elements = [handler]; } else { elements = handler.querySelectorAll("a"); } elements.forEach((elementA) => { const href = elementA.getAttribute("href"); if (SupportData.support.detail.test(href)) { if (elementA.getAttribute(clickTipAttribute)) { return; } elementA.setAttribute(clickTipAttribute, "true"); elementA.addEventListener("click", function(e) { let isPreventDefault = true; const target = e.target; const tagName = target.tagName.toUpperCase(); if (tagName == "A") { const href2 = target.getAttribute("href"); if (!SupportData.support.detail.test(href2)) { isPreventDefault = false; } } if (isPreventDefault) { e.preventDefault(); e.stopPropagation(); Tools.openInTab(decryptUrl); } }); } }); }, isRun: function(support) { return !support.detail.test(window.location.href); }, start: function() { return __async$e(this, null, function* () { const { support } = SupportData; if (!this.isRun(support)) { return; } const marketplace = Banggood.getMarketplace(window.location.href); const lang = Banggood.getLang(); const confString = yield ItemSearchBaseObj.requestConf(); if (!confString) { return; } const selectors = ItemSearchBaseObj.pickupGoodsItem(SupportData.support.p, confString); setInterval(() => __async$e(this, null, function* () { if (this.loopIsComplete) { this.loopIsComplete = false; const currency = Banggood.getCurrency(); yield this.pickUpItems(selectors, marketplace, lang, currency); this.loopIsComplete = true; } }), 1700); }); } }; const PlatformModules = { Aliexpress: { Aliexpress, AliexpressSearch }, Ebay: { Ebay, EbaySearch }, Lazada: { Lazada, LazadaSearch }, Bestbuy: { Bestbuy, BestbuySearch }, Banggood: { Banggood, BanggoodSearch } }; var css_248z$5 = ".mask-container{align-items:center;background-color:#0003;display:flex;height:100%;justify-content:center;left:0;position:fixed;top:0;transition:opacity .3s ease,visibility .3s ease;width:100%;z-index:2147483647}.modal-content{box-shadow:1px -3px 6px 0 #0003;max-height:450px;max-width:450px;width:90%}.coupon-list-widget-conent,.modal-content{background-color:#fff;border-radius:6px;display:flex;flex-direction:column;overflow:hidden}.coupon-list-widget-conent{border:1px solid #ebebeb;box-shadow:0 4px 16px #0a164666;height:500px;max-height:85%;position:fixed;right:10px;top:10px;width:350px;z-index:2147483646}.coupon-list-widget-conent .modal-header,.modal-content .modal-header{align-items:center;background:var(--color-modeal-header-background);border-bottom:1px solid #ebe6e6;box-sizing:border-box;display:flex;height:var(--size-height-modeal-header);justify-content:space-between;padding:0 var(--size-padding-horizontal-modeal-header);width:100%}.modal-header .logo>img{width:50px}.coupon-list-widget-conent .logo,.modal-header .logo{align-items:center;display:flex;justify-content:center}.coupon-list-widget-conent .title{flex:1;font-size:var(--size-font-modeal-header-title);font-weight:700;padding-left:10px}.modal-header .btns{display:flex;flex-direction:row;position:relative}.modal-header .btns .close,.modal-header .btns .setting{align-items:center;cursor:pointer;display:flex;justify-content:center;width:var(--size-height-modeal-operat-icon)}.modal-header svg.icon-i87i-svg path{fill:var(--color-modeal-header-icon)!important}.modal-header svg.icon-i87i-svg:hover path{fill:var(--color-modeal-header-icon-hover)!important}.setting-dropdown{background:#fff;border-radius:6px;box-shadow:0 4px 11px #0a164633;display:none;inset-inline-end:0;margin-top:5px;max-height:300px;overflow:auto;position:absolute;top:25px;width:180px;z-index:99999999}.setting-dropdown.active{display:block}.setting-category{border-top:1px solid #eee;padding:10px}.setting-category-title{font-size:14px;font-weight:700;margin-bottom:8px}.setting-option{border-radius:4px;cursor:pointer;font-size:12px;padding:3px 7px}.setting-option:hover{background-color:#f0f0f0}.coupon-list-widget-conent .modal-body{background:var(--color-modeal-content-background);flex:1;overflow-y:auto;position:relative;width:100%}.deal-description-warpper{margin:20px auto;text-align:center}.deal-description-warpper>.title{color:#000;font-size:18px;font-weight:800;margin-bottom:5px}.deal-description-warpper>.sub-title{color:#9f9f9f;font-size:14px}.deal-coupons-warpper{display:flex;mask-image:linear-gradient(90deg,#0000,#000 5%,#000 95%,#0000);-webkit-mask-image:linear-gradient(90deg,#0000,#000 5%,#000 95%,#0000);overflow:hidden;padding:10px 20px;position:relative;scroll-behavior:smooth}.deal-coupons-warpper .coupon-item{background-color:#f6f7ff;border:1px dashed #8096f8;border-radius:4px;color:#ccc;display:inline-block;flex:none;font-size:15px;font-weight:700;margin:5px;padding:5px 10px;white-space:nowrap}.deal-coupons-warpper .coupon-item-active{color:#005cf6!important}.deal-coupons-warpper .coupon-item-lose{text-decoration:line-through!important;text-decoration-thickness:2px!important}.deal-progress-warpper{margin-top:20px}.deal-progress-warpper .progress-container{background-color:#f3f3f3;border-radius:25px;box-shadow:0 2px 4px #0003;margin:0 auto;overflow:hidden;width:100%}.deal-progress-warpper .progress-bar{background-color:#4caf50;color:#fff;font-weight:700;height:8px;line-height:8px;text-align:center;transition:width .5s ease-in-out;width:50%}.widget{cursor:pointer;display:flex;flex-direction:row;position:fixed;right:0;transform:translateX(15px);transition:transform .3s ease;z-index:2147483646}.widget:hover{transform:translateX(0)}.widget .content{border-radius:10px 0 0 10px;direction:ltr!important;display:flex;flex-direction:row}.widget .content .logo{background-color:#ff7227;background-image:url(@logo@);background-position:50%;background-repeat:no-repeat;background-size:40px 40px;border-radius:6px 0 0 6px;box-shadow:0 0 10px #00000040;height:40px;width:40px}.widget .content .notification{background-color:#000;border-radius:50%;color:#fff;font-size:10px;font-weight:600;height:20px;left:-5px;position:absolute;top:-5px;width:20px}.widget .content .drag{background:#0000 linear-gradient(270deg,#fb6d56,#ec6751 59%,#e1624d) 0 0 no-repeat padding-box;cursor:move;height:40px;width:15px}.widget .content .drag img{width:6px!important}.all-center{align-items:center;display:flex;justify-content:center}.pulse-reveal{animation:pulse-reveal 2s ease;animation-iteration-count:10}"; var css_248z$4 = '.request-state{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}.loading{perspective:200px;position:relative;width:50px}.loading:after,.loading:before{animation:scriptJumping .5s infinite alternate;background:#0000;content:"";height:20px;position:absolute;width:20px}.loading:before{left:0}.loading:after{animation-delay:.15s;right:0}@keyframes scriptJumping{0%{transform:scale(1) translateY(0) rotateX(0deg)}to{background:#000;transform:scale(1.2) translateY(-25px) rotateX(45deg)}}.loading-error-image{text-align:center}.loading-error-image,.loading-error-retry{align-items:center;display:flex;justify-content:center}.loading-error-retry{border:4px solid #ccc;border-radius:50px;cursor:pointer;height:40px;margin:20px auto;width:140px}'; var css_248z$3 = "[data-extension-direction=rtl]{direction:rtl!important}"; const settingSVG = ` <svg style="height:30px;width:30px;" class="icon-i87i-svg" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1770" width="30" height="30"><path d="M811.04 468.728a39.72 39.72 0 0 0-27.672-30.36l-10.2-2.28a100.872 100.872 0 0 1-68.856-120.24l3.12-9.552a41.592 41.592 0 0 0-11.424-40.368 281.64 281.64 0 0 0-36.816-24.336c-12.36-7.2-25.224-13.536-38.496-18.912a41.592 41.592 0 0 0-41.592 9.984l-7.08 7.488a100.248 100.248 0 0 1-69.264 27.456 100.464 100.464 0 0 1-68.64-27.672l-6.864-7.272a41.592 41.592 0 0 0-41.592-9.984 294.96 294.96 0 0 0-37.848 18.912c-12.696 7.152-24.792 15.288-36.192 24.336a41.592 41.592 0 0 0-10.824 40.368l2.904 9.552a101.088 101.088 0 0 1-10.8 74.064 96.72 96.72 0 0 1-57.408 45.552l-9.792 2.28a35.352 35.352 0 0 0-26.616 28.488c-1.872 14.352-2.64 28.8-2.28 43.272-0.408 14.736 0.36 29.472 2.28 44.088a39.936 39.936 0 0 0 25.8 31.2l9.552 2.304a99 99 0 0 1 57.624 46.992c12.984 22.392 16.848 48.912 10.8 74.064l-2.064 9.36a41.592 41.592 0 0 0 11.856 40.344c11.136 9.072 22.968 17.28 35.352 24.552 12.312 7.488 25.176 14.016 38.496 19.536 14.64 4.608 30.624 0.768 41.592-9.984l6.648-7.272a101.088 101.088 0 0 1 139.152 0l6.672 7.272a41.592 41.592 0 0 0 41.592 9.984 295.152 295.152 0 0 0 37.224-19.536 271.848 271.848 0 0 0 36.624-24.336c10.944-10.32 15.48-25.752 11.856-40.368l-2.928-9.768a100.872 100.872 0 0 1 69.48-120l9.576-2.304a39.72 39.72 0 0 0 27.648-30.36c1.68-14.376 2.232-28.824 1.68-43.272a291.192 291.192 0 0 0-2.304-43.272z m-307.44 190.944a147.672 147.672 0 1 1 0-295.344 147.672 147.672 0 0 1 0 295.344z" fill="#8a8a8a" p-id="1771"></path></svg> `.trim(); const closeSVG = ` <svg style="height:30px;width:30px;" class="icon-i87i-svg" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1609" width="30" height="30"><path d="M673.5644448 281.66826667L512 447.82933333 351.16373333 281.71377813a44.6464 44.6464 0 0 0-63.6700448-0.50062293 46.1027552 46.1027552 0 0 0-0.50062186 64.6712896L447.82933333 512l-160.83626666 165.84248853c-17.52177813 18.06791147-17.29422187 46.8764448 0.50062186 64.6712896a44.69191147 44.69191147 0 0 0 63.71555627-0.45511146L512 576.17066667l161.5644448 165.93351146a44.78293333 44.78293333 0 0 0 63.7155552 0.4096 45.96622187 45.96622187 0 0 0 0.45511147-64.62577813L576.17066667 512l161.5644448-166.16106667a46.01173333 46.01173333 0 0 0-0.45511147-64.62577813 44.73742187 44.73742187 0 0 0-63.7155552 0.45511147z" fill="#5D6E7F" p-id="1610"></path></svg> `.trim(); const historyIconSVG = ` <svg t="1736495784741" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2656" width="48" height="48"><path d="M539.7171875 536.1734375m-280.63125 0a280.63125 280.63125 0 1 0 561.2625 0 280.63125 280.63125 0 1 0-561.2625 0Z" fill="#56E5BE" p-id="2657"></path><path d="M567.940625 564.3546875m-252.45 0a252.45 252.45 0 1 0 504.9 0 252.45 252.45 0 1 0-504.9 0Z" fill="#50DDB8" p-id="2658"></path><path d="M596.7546875 584.9421875m-219.5015625 0a219.5015625 219.5015625 0 1 0 439.003125 0 219.5015625 219.5015625 0 1 0-439.003125 0Z" fill="#42D3AD" p-id="2659"></path><path d="M512.590625 165.1765625c-13.9640625 0-25.3125 11.3484375-25.3125 25.3125s11.3484375 25.3125 25.3125 25.3125c162.253125 0 294.2578125 132.0046875 294.2578125 294.2578125s-132.0046875 294.2578125-294.2578125 294.2578125S218.3328125 672.3125 218.3328125 510.059375c0-88.171875 38.6015625-169.7625 104.9203125-225.28125v55.6453125c0 13.9640625 11.3484375 25.3125 25.3125 25.3125s25.3125-11.3484375 25.3125-25.3125V219.640625c0-13.9640625-11.3484375-25.3125-25.3125-25.3125h-115.59375c-13.9640625 0-25.3125 11.3484375-25.3125 25.3125s11.3484375 25.3125 25.3125 25.3125h58.978125C213.4390625 310.0484375 167.7078125 406.1515625 167.7078125 510.059375c0 190.18125 154.7015625 344.8828125 344.8828125 344.8828125s344.8828125-154.7015625 344.8828125-344.8828125-154.74375-344.8828125-344.8828125-344.8828125z" fill="#515151" p-id="2660"></path><path d="M617.6796875 579.7109375H474.36875c-13.9640625 0-25.3125-11.3484375-25.3125-25.3125V423.9546875c0-13.9640625 11.3484375-25.3125 25.3125-25.3125s25.3125 11.3484375 25.3125 25.3125v105.13125h117.9984375c13.9640625 0 25.3125 11.3484375 25.3125 25.3125s-11.3484375 25.3125-25.3125 25.3125z" fill="#515151" p-id="2661"></path></svg> `.trim(); const alertErrorIconSVG = ` <svg t="1750318981890" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7681" width="45" height="45"><path d="M736 336zM336 736h-0.01 0.02-0.01zM688 736h0.01-0.01zM736 688z" fill="#666666" p-id="7682"></path><path d="M512 64C264.58 64 64 264.58 64 512s200.58 448 448 448 448-200.57 448-448S759.42 64 512 64z m220.62 346.18L472.4 670.39a40 40 0 0 1-56.57 0L291.38 545.94a40 40 0 0 1 0-56.57 40 40 0 0 1 56.57 0l96.17 96.17 231.93-231.93a40 40 0 0 1 56.57 0 40 40 0 0 1 0 56.57z" fill="#999999" p-id="7683"></path><path d="M732.62 353.61a40 40 0 0 0-56.57 0L444.12 585.54 348 489.37a40 40 0 0 0-56.57 0 40 40 0 0 0 0 56.57l124.4 124.45a40 40 0 0 0 56.57 0l260.22-260.21a40 40 0 0 0 0-56.57z" fill="#FFFFFF" p-id="7684"></path></svg> `.trim(); const alertSuccessIconSVG = ` <svg t="1750318938251" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7517" width="45" height="45"><path d="M511.950005 512.049995m-447.956254 0a447.956254 447.956254 0 1 0 895.912508 0 447.956254 447.956254 0 1 0-895.912508 0Z" fill="#20B759" p-id="7518"></path><path d="M458.95518 649.636559L289.271751 479.95313c-11.698858-11.698858-30.697002-11.698858-42.39586 0s-11.698858 30.697002 0 42.395859l169.683429 169.68343c11.698858 11.698858 30.697002 11.698858 42.39586 0 11.798848-11.598867 11.798848-30.597012 0-42.39586z" fill="#FFFFFF" p-id="7519"></path><path d="M777.62406 332.267552c-11.698858-11.698858-30.697002-11.698858-42.39586 0L424.158578 643.437164c-11.698858 11.698858-11.698858 30.697002 0 42.39586s30.697002 11.698858 42.39586 0l311.069622-311.069622c11.798848-11.798848 11.798848-30.796992 0-42.49585z" fill="#FFFFFF" p-id="7520"></path></svg> `.trim(); const logoBase64 = ` data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAJJWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDggNzkuMTY0MDM2LCAyMDE5LzA4LzEzLTAxOjA2OjU3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNS0wNC0wM1QxODo0MzozNSswODowMCIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAyNS0wNC0wM1QxODo0Mzo0NyswODowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjUtMDQtMDNUMTg6NDM6NDcrMDg6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjY5ZTMyY2UzLThmYWEtMjM0NC1iODM4LTA1YWRhMzI5YWViYSIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjIxMGQ3MWMzLWI2MzgtMDI0ZS05YzE3LTNkMDNkNmFlMTYxOCIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjYxM2YyNTBjLWFjYWQtZjE0Ny04NzczLWQ4YWJjNTY2ODg0ZSIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMyI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6NjEzZjI1MGMtYWNhZC1mMTQ3LTg3NzMtZDhhYmM1NjY4ODRlIiBzdEV2dDp3aGVuPSIyMDI1LTA0LTAzVDE4OjQzOjM1KzA4OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjEuMCAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjdhZjc2ZDZjLWIwYzktYjM0MC05ODJlLTE1ZTU3YzAyZTYzMiIgc3RFdnQ6d2hlbj0iMjAyNS0wNC0wM1QxODo0Mzo0NyswODowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKFdpbmRvd3MpIiBzdEV2dDpjaGFuZ2VkPSIvIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjb252ZXJ0ZWQiIHN0RXZ0OnBhcmFtZXRlcnM9ImZyb20gYXBwbGljYXRpb24vdm5kLmFkb2JlLnBob3Rvc2hvcCB0byBpbWFnZS9wbmciLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImRlcml2ZWQiIHN0RXZ0OnBhcmFtZXRlcnM9ImNvbnZlcnRlZCBmcm9tIGFwcGxpY2F0aW9uL3ZuZC5hZG9iZS5waG90b3Nob3AgdG8gaW1hZ2UvcG5nIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo2OWUzMmNlMy04ZmFhLTIzNDQtYjgzOC0wNWFkYTMyOWFlYmEiIHN0RXZ0OndoZW49IjIwMjUtMDQtMDNUMTg6NDM6NDcrMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyMS4wIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6N2FmNzZkNmMtYjBjOS1iMzQwLTk4MmUtMTVlNTdjMDJlNjMyIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjYxM2YyNTBjLWFjYWQtZjE0Ny04NzczLWQ4YWJjNTY2ODg0ZSIgc3RSZWY6b3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjYxM2YyNTBjLWFjYWQtZjE0Ny04NzczLWQ4YWJjNTY2ODg0ZSIvPiA8cGhvdG9zaG9wOkRvY3VtZW50QW5jZXN0b3JzPiA8cmRmOkJhZz4gPHJkZjpsaT5hZG9iZTpkb2NpZDpwaG90b3Nob3A6Yzg1NGYyMTQtMjY2MS1iMDQyLTg3YjQtMTE1YmRkMTE5MzMxPC9yZGY6bGk+IDwvcmRmOkJhZz4gPC9waG90b3Nob3A6RG9jdW1lbnRBbmNlc3RvcnM+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+agFuvQAADXtJREFUeJztnXuwXdVdxz+/tfY+555zXwlBUpIGijW0QTtQg6UMDmBaYxWRAamVUYexxbHW1nFqo21H6TDKiFWnFYp/WKaddgSLFBo7Q+vg8CpjiyADbW1DAKFJSAIJuTe5ubn37MdaP/9Y+97cJDfnPnP2xu7PzG9y9+v89trfvd6/tSOqSk11MGXfQM2x1IJUjFqQilELUjFqQSpGLUjFqAWpGLUgFaMWpGLUglSMWpCKUQtSMWpBKkYtSMWoBakYtSAVoxakYtSCVIxakIpRC1IxakEqRtRrh++8sftx0WD44t9iHzP/5oTtnwLeDlyA8hbgjcDpQAsYBMaBCeAAsAdhO/A94EngeZUp5yfez2OfXlj6lkrPBVlGzgd+XeEK4Gen986e5weLf98MTItZ8AzwTeBe4KllvscF83oU5L3ABxE2AbO+1XNy7DUXFPYJ4FvA1cDIEu5vSbyeBLkS+JQKG0+hj0uB06gF6cpPALchvA+OL21OCdmpd3Fyqi7IbwD/pMJw2TfSK6opSMgGN6pwU8l30nOqKQjcheG6RVzngB8C24GdwFixzwJDwFmEJvJPA/Hy3OryUilBisbPvWq4ZgGXJcB9wDdQHgFeluLHZtY3AqDT+9YgXAL8KnAt0J5xaqnLASoliMJdyLzFOAh8RuAOlD0IuBhcFB6+caHTqIRtb0AtqILN2GMd96Dcg7BF4f2EZu8Q0DwliZsnvRfk5IM1n0TnXUzdDtyIZ8RbyPtAHLQOOZqHc/oO58Qdh3EENRRcLGQtS9K2dIZiOkMGNRB32IfnFgx3AJ8k9O5Lo+eC6GwdOeU9wM3zGFnbj/LbAg+oQNaGuAOn7egwsC+hPZoRJR7jFDXHOgrDL4q3QtYyTA7HHF7dx6Ezm7gYGh1eAz6qi+tqLhtVEKSBcO88Lv2+KO8WZZ9rghcY2pty+osTDBxIUcA1DFnLHh3vChR55Kh/45WhvQlDryYM7W3y2k+2GT8jxuZgU3TWl6ZHlC6IwD9zbKU6G99CuRzQpB/iSWXNs4cZ3tMBEZL+CFQRZQPwi8BFwAUK5834jVHCgOL93spXXb99CSO0R1LWjaaMntVi//oBOgOh/imLcusQ5Z0axqa68TxwGRqKqNao48z/GaPvcEbetqCCeK5C+KDCewA0+PAo/4AwAQwTBhY3ApcBnyYMJP5p1rIPgbJy1wRR4hk7s4m4meVWb+v4cnOI8Pk5Tj8iykUodIZheG/G2qcPgUI6EGEcb0G5VQ2bZyn67wL+2LgZtYIICmeqcD3CTSgPAvepkevTwXi8OZ5xxvZ0StCC3grS+wkqmbbLEH5mxvZsdqUKo8kgtEcda58eAyhyBtd54YfestlbmMUGXBRaVzJjbgXYC9yiQtNH/LmPuEaF/Xg2ujjUQXnzqPWanguiMm2fmvH3bHanwsNZE6JEWfvdMVAlDWJ82Bu5y0difCScxFSNkDWErFn0EmdU9kWmudkbeYeLpM8b/hv4hV4/j+PpfZEVXoHVzJV45fcx4PrgDU9P0DiS0xmKEdWrvHDbPFx5AATSWFADfeMeFQ33YECtQYw86YWz1bIDeAiR84BtS0njUiirDvmdOU77rMCRtA2De3P6X+0wORSjhrNAts7TlZ/+SyDrU/JmHz6KwCk2z4nSDNThY7tTRc4HvksYCzsD2L/gxC0DvW9lBUHmGh75K2dD83N45xFcJORNAdWtC/A0XUCJ9/iGpbNiAPFFs9ZDlHskn8TkHVDzPbXym8CHCIORpVBGkbWS0E84GQ+gHMj7YGhPSjzpSIYswDUgb1+Aq+kcIh6ydgtRiJKjFby3Bt/ox+QRjfFxxMvdPoruni7t/Ky/e0opo8i6iO6NibuR8DCaBzPyhuAiAeWWBboKj1Md2ohxjQZReuwJ4sEo5K0mLjb0HRxDXA4IUQZ53PsuexlF1pvnGN9+2EcQT3ps6kjbFjWyEXT9Aj0FNypo3Bda0aH5uwFlE9BCyFBeMhlfT/tj1AzTd+gIop6xVZbx03tfcpVRZK3rcng38JJGYBOPorimAbh2EWN+HhTRCCMx4kCF213Eh4oceLk4TtOId2G4Okr5hGtEryRDw6StjNHVKTbvfTetjCLr7C6Hf1Ccg+QOFwkuFBvvWIQrr3isNoot7nVxaEyosA14tDEBUcbXkgZbXIO/FM+HfYMkaQtRqhjX+7mqMgQZ7HJ4FzIVuajkTcHHAsqaRXhSsGgUo4arRY9t2amFzkCOSXKMxH9rsOu88XkaZzibY1w5UbZlDC6e1eXoYQAkDH/kMWiEAAMLdaPgRQy+X0D4w5m9dDUkkuX4dBI/EPokNje7fKS4SDHeTM829poycsjb5nFOKKoagkZiWMR9isNrw5ANgcDaqaerBkziN9hO8pxvxYgYdU2VXH1iUzlsvK5SQYDngO8ANy/U91IoQ5CnCYHRszEVi4CzQCyoFUcIZFgQIqquAckgKExM9T3UgknI2mPysiLqGoidVLRpzeSwPb9vf/KMGryKXEEIMf3/LQjCbk4uyAoAMeAbgjpBrQCMCl0bAye6MUacgbQNPuJh8UcDsv2weT5vNDeteHYSM6Ikp0WMr7Fr0mF7BT7+fGMkI2/KTlF2LzKVi6aMZu+hLodD/SLgGwZymRrEeIHwts6fSKzJFW88yUrzNybhT6YrBaGVrrUkQ21wnnRlJKL8tW9wq11lMGOCi1gH3LnQ9C2VMoqsnV0Onzc1F6KxwTcFRAAeIcRPLQSDV8y4I1tr9ovh3Qj/DkR43oDAxDkGNWZzfJjrjXK/SXkqPpCTteRijQTga4tJ41IoI4fs6HJ4NbBBYBuRwTWKeQyR+0A/t0BXxlmDPeyJxpVsUB5UZYNaPo5yoRq2mJSmeFZh+IIKD7ZezJBMyVvm40VU3ROLT+niKKMOeW6OMzYpbBNAGxbnHQb2KvIIcPkCPBlEsJOexognH7LgeUGFG7wlErhYlX0I2zWC9i5PdMiTDhqAXxPkS4tL4NIoI4c8AaRA4ySnXEcIhMNgSazHqIDwZ8B/LcCVAfD9BjnssOOGbDDkOFFy4DGKaMbGfk/8Sk7WFtTKVwAE/mjRiVwCZUzhHlHhsS5Tt5eocLYXsCKINWSx4q084SL5NxeF0d95mHGRhNFiATviQ3UUFRYHf3ZUiXc78ljIm+YiZ+V9LpLP5FbGcvvjMdoLITj6XV3O+guFG4xCE0saaahKlN9S4RXm13OfftnEGEg8esjg28U8Rw5mUuGIkrUEowyjPA68IMpHF5/ApVFWkMNX5ghw+ADC6txArEJDLWkELpIj3sqmLoENMy0EQNiw3RkyZKnCSDAZVSQBItBIVnkru4vrLpyZ03pN7wUxoIYRNWydQ5QvI+AMtHNDwxvy0N1+Ui2/5KLQm+9ixtkQ9Z60haxPMFKk2BJWh4TUX6rCay6irZY3YTiELc4pYSK3zDCgmwpxTmab1fBeX2wP5obICz40Rx9QIxdqJHs0Cr35Wc0IeZ/gGoI5cTp2BXCHGnnUR/K8iqxC2TEdLnRc2FCvKDNQ7hmER+cIlPsXNax3NvQPB7AYBBee1FNq2OAst/kIZrHUxaG4mjE33ias5t2qwqiP+ICPuEkN5wKjqpStB9Lr/z/knH+dsaGcS1h+1o2DCOvV8JoU/cRx40giECNgwAvnInKDhibzG6dKfhW+I8oRQmzvOYSvOwTP8FlRvVmUA3hQp7RyoYkcI8TL1/S2Hum5IG+654Rd/wj8wRyXvYjwcyqMSPF8JowyEStalPMiggoRwqUaolo2EmYam4R5lh9JGE7/Jsq3p9eLAJGDdi70OTlhovilhSyuWwZ6L8hXT9yn8Cpwxhzv4i4VfhnhB0iIFsmMMhEpnRi8CQ9TBKbXsR2HaKi/fJFk65S+XGjnQqRH989kR48FKbNSnzaEX6F7iwsV1hEiC39XFZxApMJQZliRGPpTIfJAcSw3oYU2ZbkJ+1FoOBhIhRWpYTATrIaluoUepa4x7H2lbma1pzC8f45WF2qwCl8AtgLrvYSHHHsYTGFlR1jREYYSYTAR+hNop9CfwmAS9q/oCCsSYSCFyAexfMhNbwXuUdhQZqXe+xxycvsiwufmaHVNCXgVwrPArcBGX/RXKMRpZzCQFCJ0hMGOMJBAKw/Hp/o3hRAXAH+HsA3DtRgOHfOy9JjSl7Qdx0cQ+oAb5vFTBvhIYf8J3K/wkArf17BqalYkrLJ9G+FDM1cSOoYzKXFBW8XWqRf8nhoOonxsAddcUhiEj5T9LyHobj/hYzIxsApYo7AeOL1L3F3vx0tmUEVBQNmC4UfAwialQqG/qrDulPrYT06Vv7l4uwo/r8L2OVpfR23uRsFRm+dv9poqCwKhbnirCn8/b1GW2XpN1QWZ4mMIlyD8x5ytsKVbfMx2j3m9CALwbWCzCher8KVi5nE5c0Oqwp0q7Cszh1SzUu/O48DjCFuAq4qvkl7M3F+DmI0J4AmBbwBfR9mzjPe5KHo+llXTnddTkfVjQS1IxagFqRi1IBWjFqRi1IJUjFqQilELUjFqQSpGLUjFqAWpGLUgFaMWpGLUglSMWpCKUQtSMWpBKkYtSMWoBakYtSAVoxakYvwfl7Kmmdjaw0wAAAAASUVORK5CYII= `.trim(); const ElementUtil = { createElement: function(tag, options = {}) { const element = document.createElement(tag); if (options.text) { element.textContent = options.text; } if (options.html) { element.innerHTML = options.html; } if (options.style) { Object.assign(element.style, options.style); } if (options.className) { element.className = options.className; } if (options.attributes) { for (let [key, value] of Object.entries(options.attributes)) { element.setAttribute(key, value); } } if (options.childrens) { options.childrens.forEach((child) => { element.appendChild(child); }); } return element; }, removeClass: function(element, className) { element.classList.remove(className); } }; const ClipboardUtil = { setValue: function(text, type = "text/plain") { GM_setClipboard(text, type); } }; var __async$d = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const CACHE_ROOT_DIVS = []; const InspectUtil = { generateShadowDomRoot: function(name, css = "", dir = "ltr", moveToEnd = false, observerTime = 2e4) { const insertRootElement = document.documentElement || document.body; const root = ElementUtil.createElement("div", { attributes: { "style": "all: initial!important;z-index:2147483647!important;display:block!important;", "action": "action-" + name } }); insertRootElement.appendChild(root); const outerDIV = ElementUtil.createElement("div", { attributes: { "data-extension-direction": dir, "id": "root-" + name } }); const shadowRoot = root.attachShadow({ mode: "open" }); this.addStyle(shadowRoot, name, css); shadowRoot.appendChild(outerDIV); const now = Date.now(); if (moveToEnd) { const observer = new MutationObserver(() => { const lastChild = insertRootElement.lastElementChild; if (lastChild !== root && !lastChild.getAttribute("action") && document.documentElement) { if (Date.now() - now <= observerTime) { insertRootElement.appendChild(root); } else { observer.disconnect(); } } }); observer.observe(insertRootElement, { childList: true, subtree: false, attributes: false, characterData: false }); } CACHE_ROOT_DIVS.push(shadowRoot); if (name && name.indexOf("aliexpress") != -1) { setInterval(() => { outerDIV.querySelectorAll("*[data-re-mark-tag='aliexpress']").forEach((element) => { Tools.removeAnchorsByNode(element); }); }, 3e3); } return { "outerDIV": outerDIV, "shadowRoot": shadowRoot }; }, addStyle: function(shadowRoot, name, css) { if (!shadowRoot.querySelector("#style-" + name)) { const newStyle = document.createElement("style"); newStyle.textContent = css; newStyle.id = "style-" + name; const existingStyle = shadowRoot.querySelector("style"); if (existingStyle) { existingStyle.after(newStyle); } else { shadowRoot.insertBefore(newStyle, shadowRoot.firstChild); } } }, openUrl: function(option) { const { active, affLink, close, pause, delay, position, target } = option; if (!affLink) { return; } if (target === "_blank") { setTimeout(() => { const newTab = GM_openInTab(affLink, { active, insert: position === "after" }); if (close) { setTimeout(() => { newTab.close(); }, pause); } }, delay); } else if (target === "_self") { setTimeout(() => { window.location.href = affLink; }, delay); } else if (target === "_replace") { setTimeout(() => { window.location.replace(affLink); }, delay); } }, customOpenUrl: function(element, json, operate = "clickToJump", callback = {}) { const options = []; for (let i = 0; i < json.length; i++) { const item = json[i]; const option = { "affLink": Tools.decryptStr(item.affLink), "close": item.close, "pause": item.pause, "delay": item.delay, "target": item.target, "active": item.active, "position": item.position, "dismissAfter": item.dismissAfter, "callbackEvent": item.callbackEvent }; let code = item.code, msg = item.msg; if (code) { ClipboardUtil.setValue(Tools.decryptStr(code)); if (element) { element.innerText = msg; } } options.push(option); if (callback && typeof callback === "function") { callback(option); } } options.sort((a, b) => a.target === "_blank" ? -1 : b.target === "_blank" ? 1 : 0).forEach((option, index) => { setTimeout(() => { this.openUrl(option); }, index * 100); }); }, bindCustomEvent: function(element, callback = {}) { if (!element) { return; } element.addEventListener("click", () => { try { const dataContent = element.getAttribute("data-content"); const operate = element.getAttribute("name"); const json = JSON.parse(dataContent); this.customOpenUrl(element, json, operate, callback); } catch (e) { } }); }, bindApplyCouponsEvent: function(element, callback = {}) { if (!element) { return; } element.addEventListener("click", () => { const dataContent = element.getAttribute("data-content"); if (dataContent) { const dataContentJson = JSON.parse(dataContent)[0]; if (dataContentJson.hasOwnProperty("codes") && dataContentJson.hasOwnProperty("platform") && dataContentJson.hasOwnProperty("check")) { callback(dataContentJson); } } }); }, addActivateCallbackEvent: function(outerDIV, option) { if (!outerDIV || !option) { return; } if (!option.callbackEvent) { return; } const { link, max, period } = option.callbackEvent; const decrypLink = Tools.decryptStr(link); let count = 0; let isRequesting = false; const intervalId = setInterval(() => __async$d(this, null, function* () { if (count >= max) { clearInterval(intervalId); return; } count += period; if (isRequesting) { return; } try { isRequesting = true; const data = yield Tools.request("post", decrypLink, null); if (data && data.code == "success") { const loopJson = JSON.parse(data.result); if (loopJson.hasOwnProperty("code") && loopJson.code == "ok") { clearInterval(intervalId); if (loopJson.hasOwnProperty("data") && loopJson.data) { const { replacement } = loopJson.data; for (let i = 0; i < replacement.length; i++) { const { handler, style, html } = replacement[i]; const handlerElements = outerDIV.querySelectorAll(handler); handlerElements.forEach((handlerElement) => { handlerElement.innerHTML = html; const handlerStyle = handlerElement.getAttribute("style") || ""; handlerElement.setAttribute("style", style + ";" + handlerStyle); }); } } } } } catch (e) { } finally { isRequesting = false; } }), period); } }; var __async$c = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const LangueUtil = { updateDelay: 15 * 60 * 1e3, _locations: { "en": { languageDefault: "Default" }, "es": { languageDefault: "Predeterminado" }, "ar": { languageDefault: "افتراضي" }, "fr": { languageDefault: "Par défaut" }, "pt": { languageDefault: "Padrão" }, "ru": { languageDefault: "По умолчанию" }, "ja": { languageDefault: "デフォルト" }, "de": { languageDefault: "Standard" }, "ko": { languageDefault: "기본" }, "it": { languageDefault: "Predefinito" }, "id": { languageDefault: "Default" }, "tr": { languageDefault: "Varsayılan" }, "pl": { languageDefault: "Domyślnie" }, "uk": { languageDefault: "Типово" }, "nl": { languageDefault: "Standaard" }, "vi": { languageDefault: "Mặc định" }, "ms": { languageDefault: "Lalai" }, "th": { languageDefault: "ค่าเริ่มต้น" }, "mx": { languageDefault: "Predeterminado" }, "cl": { languageDefault: "Predeterminado" } }, getLanguages: function() { var _a, _b, _c; const languages = [ { code: "en", name: "English", dir: "ltr" }, { code: "es", name: "Español", dir: "ltr" }, { code: "ar", name: "العربية", dir: "rtl" }, { code: "fr", name: "Français", dir: "ltr" }, { code: "pt", name: "Português", dir: "ltr" }, { code: "ru", name: "Русский", dir: "ltr" }, { code: "ja", name: "日本語", dir: "ltr" }, { code: "de", name: "Deutsch", dir: "ltr" }, { code: "ko", name: "한국어", dir: "ltr" }, { code: "it", name: "Italiano", dir: "ltr" }, { code: "id", name: "Bahasa Indonesia", dir: "ltr" }, { code: "tr", name: "Türkçe", dir: "ltr" }, { code: "pl", name: "Polski", dir: "ltr" }, { code: "uk", name: "Українська", dir: "ltr" }, { code: "nl", name: "Nederlands", dir: "ltr" }, { code: "vi", name: "Tiếng Việt", dir: "ltr" }, { code: "ms", name: "Bahasa Melayu", dir: "ltr" }, { code: "th", name: "ไทย", dir: "ltr" }, { code: "mx", name: "Mexican Spanish", dir: "ltr" }, { code: "cl", name: "Chilean Spanish", dir: "ltr" } ]; const language = (_a = languages.find((lang) => lang.code === DefaultValue.lang)) != null ? _a : languages[0]; const defaultLanguage = Object.assign({}, language); defaultLanguage.code = "default"; defaultLanguage.name = (_c = ((_b = this._locations[DefaultValue.lang]) != null ? _b : this._locations["en"])["languageDefault"]) != null ? _c : "Default"; languages.unshift(defaultLanguage); return languages; }, defaultLangueObjects: { "extension.structure.setting_modal_title": "Settings", "extension.structure.setting_modal_langue_title": "Language", "extension.structure.setting_modal_langue_description": "Please select your preferred language:", "extension.structure.setting_modal_history_title": "Browsing History Count:", "extension.structure.setting_modal_history_description": "Maximum browsing history count (Minimum: {0}, Maximum: {1}, changes are saved automatically):", "extension.structure.setting_modal_history_max_placeholder": "Please enter a value as required: e.g., 30", "extension.structure.setting_modal_clear_title": "Clear Cache:", "extension.structure.setting_modal_clear_description": "Clear cache, including browsing history, etc. Note: Once cleared, it cannot be recovered.", "extension.structure.setting_modal_clear_btn": "Click to Clear", "extension.structure.setting_modal_clear_confirm": "Do you want to clear all browsing history? Once cleared, it cannot be recovered.", "extension.structure.history_box_title": "Browsing History", "extension.structure.history_bar_hint": "History", "extension.structure.history_box_hit_today": "—— Today ——", "extension.structure.history_box_hit_yesterday": "—— Yesterday ——", "extension.structure.couponList_modal_retry": "Retry", "extension.structure.couponList_modal_copid": "Copied", "extension.structure.auto_detect_modal_description": "Finding great deals...", "extension.structure.auto_detect_modal_secondary_description": "Automatically tries codes to save you money.", "extension.structure.auto_detect_alert_error": "Coupongogo reminders you, it's already the best deal.", "extension.structure.auto_detect_alert_success": "Congratulations from Coupongogo, The code has been applied automatically!", "extension.structure.setting_window_show_display_title": "Display Settings", "extension.structure.setting_window_show_display_hide30m": "Hide for {0} minutes", "extension.structure.setting_window_show_display_session": "Hide for this shopping session", "extension.structure.setting_window_show_display_all": "Show all components", "extension.structure.setting_window_show_general_title": "General Settings", "extension.structure.setting_window_show_general_general": "Language, History, etc." }, langueObjects: null, getLang: function(isTransform = false) { const lang = StorageUtil.getValue(StorageKeys.langue.custom, "default"); if (isTransform) { return lang === "default" ? DefaultValue.lang : lang; } return lang; }, setLang: function(lang) { StorageUtil.setValue(StorageKeys.langue.custom, lang); }, getSelectedLanguage: function(selectedLang) { if (!selectedLang) { selectedLang = this.getLang(true); } let selectedLanguage = this.getLanguages().find((lang) => lang.code === selectedLang); if (!selectedLanguage) { selectedLanguage = this.getLanguages()[0]; } return selectedLanguage; }, getLangueByStorageKey: function(key) { var _a; key = "extension.structure." + key; let langueObjects = this.langueObjects; if (!langueObjects) { langueObjects = this.defaultLangueObjects; } return (_a = langueObjects[key]) != null ? _a : this.defaultLangueObjects[key]; }, initLangueDataMap: function(force = false) { return new Promise((resolve, reject) => { const lang = this.getLang(true); const now = new Date().getTime(); const langueObjects = StorageUtil.getValue(StorageKeys.langue.objects, { "data": this.defaultLangueObjects, "time": now, "lang": "default" }); if (now - langueObjects.time >= this.updateDelay || now === langueObjects.time || langueObjects.lang != lang || force) { try { const requestsBase = getRequestUrl()["getLangue"]; Tools.request(requestsBase.method, requestsBase.url, { "lang": lang }, { "Content-Type": "application/json;charset=UTF-8" }, 5 * 1e3).then((serverLangueJson) => { if (serverLangueJson.code === "success") { const serverLangueObjects = JSON.parse(serverLangueJson.result); StorageUtil.setValue(StorageKeys.langue.objects, { "data": serverLangueObjects, "time": new Date().getTime(), "lang": lang }); this.langueObjects = serverLangueObjects; Logger.log("info", "get server langue success=======>", this.langueObjects); } else { Logger.log("info", "get server langue error=======>", this.langueObjects); this.langueObjects = this.defaultLangueObjects; } }).catch((error) => { this.langueObjects = this.defaultLangueObjects; Logger.log("error", error); }).then(() => { resolve("success"); }); } catch (error) { this.langueObjects = this.defaultLangueObjects; resolve("success"); } } else { this.langueObjects = langueObjects.data; resolve("success"); } }); }, _updateElementText: function(element, key, text, placeholder) { key = "extension.structure." + key; if ("extension.structure.setting_modal_history_description" === key) { const { min, max } = DefaultValue.history.records; if (text) { text = this.formatTemplateWithArray(text, [min, max]); } } if (text) { element.innerText = text; } if (placeholder) { element.setAttribute("placeholder", placeholder); } }, refreshLangue: function(force = false) { return __async$c(this, null, function* () { const queryDirectionElements = (selector) => { return CACHE_ROOT_DIVS.flatMap((div) => div ? Array.from(div.querySelectorAll(selector)) : []); }; const elementsWithLangue = queryDirectionElements("*[langue-extension-text],*[langue-extension-placeholder]"); const directions = queryDirectionElements("*[data-extension-direction]"); this.initLangueDataMap(force).then(() => { this.langueObjects; const selectedLanguage = this.getSelectedLanguage(); directions.forEach((element) => { element.setAttribute("data-extension-direction", selectedLanguage.dir); }); elementsWithLangue.forEach((element) => { let langueTextKey = element.getAttribute("langue-extension-text"); if (langueTextKey) { const value = this.getLangueByStorageKey(langueTextKey); this._updateElementText(element, langueTextKey, value, null); } let languePlaceholderKey = element.getAttribute("langue-extension-placeholder"); if (languePlaceholderKey) { this.getLangueByStorageKey(languePlaceholderKey); this._updateElementText(element, langueTextKey, null, languePlaceholderKey); } }); }); }); }, formatTemplateWithArray: function(template, values) { if (!template) return template; return template.replace(/{(\d+)}/g, (match, index) => { var _a; return (_a = values[index]) != null ? _a : match; }); } }; var __async$b = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const RequestUnionUtil = { _getBaseParams: function() { const token = StorageUtil.getValue(StorageKeys.token, ""); return { v: ScriptConst.version, version: ScriptConst.version, no: ScriptConst.number, token: !!token ? token : "" }; }, _getDetectCouponParams: function() { return __async$b(this, null, function* () { const { Aliexpress: Aliexpress2, Ebay: Ebay2, Lazada: Lazada2, Bestbuy: Bestbuy2, Banggood: Banggood2 } = PlatformModules; let platform = SupportData.support.p, marketplace = "", currency = ""; let lang = StorageUtil.getValue(StorageKeys.langue.custom, "default"); if (lang === "default") { lang = DefaultValue.lang; } switch (platform) { case SupportData.supports.aliexpress.p: marketplace = Aliexpress2.Aliexpress.getMarketplace(); currency = yield Aliexpress2.Aliexpress.getCurrency(); break; case SupportData.supports.banggood.p: marketplace = Banggood2.Banggood.getMarketplace(); currency = Banggood2.Banggood.getCurrency(); break; default: marketplace = Tools.getCommonMarketplace(); } let params = { platform, title: document.title, url: window.location.href, lang, marketplace, currency }; params = Object.assign({}, params, this._getBaseParams()); Logger.log("info", "detect coupon params====>", JSON.stringify(params)); return params; }); }, _getEngineScreenParams: function(lists, platform) { let lang = "en"; try { lang = document.documentElement.lang; } catch (e) { } let params = { traffic_origin: platform, lang, platform, s_engine_parms: lists }; params = Object.assign({}, params, this._getBaseParams()); Logger.log("info", "engineScreen params====>", JSON.stringify(params)); return params; }, request: function(method, url, params) { return new Promise((resolve) => { Tools.request(method, url, params).then((data) => { if (data && data.code == "success") { resolve(JSON.parse(data.result)); } }).catch((error) => { resolve(null); }); }); }, getDetectCouponResult: function() { return __async$b(this, null, function* () { const params = yield this._getDetectCouponParams(); const { method, url } = getRequestUrl()["detectCoupon"]; return this.request(method, url, params); }); }, getDetectInfoResult: function() { return __async$b(this, null, function* () { const params = yield this._getDetectCouponParams(); const { method, url } = getRequestUrl()["detectInfo"]; return this.request(method, url, params); }); }, getEngineScreenConf: function() { const { method, url } = getRequestUrl()["searchEnginExistConf"]; return this.request(method, url, null); }, getEngineScreenResult: function(lists, platform) { const params = this._getEngineScreenParams(lists, platform); const { method, url } = getRequestUrl()["engineScreen"]; return this.request(method, url, params); }, initRequestData: function() { return __async$b(this, null, function* () { try { const now = Date.now(); let exchangeInfoLocal = StorageUtil.getValue(StorageKeys.exchangeInfo, null); const needFetchConfig = !exchangeInfoLocal || exchangeInfoLocal.time && now - exchangeInfoLocal.time > DefaultValue.updateExchangeInfoDelay; if (needFetchConfig) { const exchangeInfo = getRequestUrl()["exchangeInfo"]; const exchangeInfoJsonServer = yield this.request(exchangeInfo.method, exchangeInfo.url, null); if (exchangeInfoJsonServer) { const { certificate, redirect } = exchangeInfoJsonServer; exchangeInfoLocal = { "certificate": certificate, "redirect": redirect, "time": now }; StorageUtil.setValue(StorageKeys.exchangeInfo, exchangeInfoLocal); } else { Logger.log("error", "exchangeInfo====>null"); } } if (!exchangeInfoLocal || !exchangeInfoLocal.certificate) { exchangeInfoLocal = DefaultValue.exchangeInfoLocal; } const tokenJson = yield this.request("POST", exchangeInfoLocal.certificate, null); if (tokenJson && tokenJson.token) { StorageUtil.setValue(StorageKeys.token, encodeURIComponent(tokenJson.token)); Logger.log("info", "token====>", tokenJson.token); } else { Logger.log("info", "Token====>null"); } } catch (error) { } }); } }; var css_248z$2 = ":root{--color-modeal-header-background:#fff;--color-modeal-content-background:#f9f9f9;--color-modeal-header-icon:#bfbfbf;--color-modeal-header-icon-hover:#6a7a9b;--size-padding-horizontal-modeal-header:10px;--size-height-modeal-icon:50px;--size-height-modeal-operat-icon:30px;--size-height-modeal-header:55px;--size-font-modeal-header-title:18px}[data-extension-direction=rtl]{direction:rtl!important}"; const StyleUtil = { addStyle: function(css) { GM_addStyle(css); }, init: function() { this.addStyle(css_248z$2 + css_248z$3); } }; const Activate = { generate: function(couponTotal, badgeData, dragData, interfaceData) { const badgeCss = Object.entries(badgeData).map(([key, value]) => `${key.replace("_", "-")}:${value}`).join(";"); const dragCss = Object.entries(dragData).map(([key, value]) => `${key.replace("_", "-")}:${value}`).join(";"); const interfaceCss = Object.entries(interfaceData).map(([key, value]) => `${key.replace("_", "-")}:${value}`).join(";"); const drag = ElementUtil.createElement("div", { className: "drag all-center", attributes: { "style": dragCss }, childrens: [ ElementUtil.createElement("img", { attributes: { src: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='10'%20height='17'%20viewBox='0%200%2010%2017'%3e%3cg%20id='drag_icon'%20data-name='drag%20icon'%20transform='translate(-756.458%20-5682.563)'%3e%3ccircle%20id='Ellipse_277'%20data-name='Ellipse%20277'%20cx='1.5'%20cy='1.5'%20r='1.5'%20transform='translate(756.458%205682.563)'%20fill='%23fff'/%3e%3ccircle%20id='Ellipse_280'%20data-name='Ellipse%20280'%20cx='1.5'%20cy='1.5'%20r='1.5'%20transform='translate(763.458%205682.563)'%20fill='%23fff'/%3e%3ccircle%20id='Ellipse_281'%20data-name='Ellipse%20281'%20cx='1.5'%20cy='1.5'%20r='1.5'%20transform='translate(756.458%205689.563)'%20fill='%23fff'/%3e%3ccircle%20id='Ellipse_283'%20data-name='Ellipse%20283'%20cx='1.5'%20cy='1.5'%20r='1.5'%20transform='translate(756.458%205696.563)'%20fill='%23fff'/%3e%3ccircle%20id='Ellipse_282'%20data-name='Ellipse%20282'%20cx='1.5'%20cy='1.5'%20r='1.5'%20transform='translate(763.458%205689.563)'%20fill='%23fff'/%3e%3ccircle%20id='Ellipse_284'%20data-name='Ellipse%20284'%20cx='1.5'%20cy='1.5'%20r='1.5'%20transform='translate(763.458%205696.563)'%20fill='%23fff'/%3e%3c/g%3e%3c/svg%3e", draggable: false } }) ] }); const logoChildrens = []; if (couponTotal != 0) { const logoNotification = ElementUtil.createElement("div", { className: "notification all-center pulse-reveal", text: couponTotal, attributes: { "style": badgeCss } }); logoChildrens.push(logoNotification); } const logo = ElementUtil.createElement("div", { className: "logo", childrens: logoChildrens, attributes: { "style": interfaceCss } }); const content = ElementUtil.createElement("div", { className: "content", childrens: [logo, drag] }); const widget = ElementUtil.createElement("div", { className: "widget", attributes: { "style": "top:" + this.getActivateTop() + "px;z-index:2147483647!important" }, childrens: [content] }); this.addEventListenerDrag(drag, widget); return { "widget": widget, "logo": logo }; }, updateActivateTop: function(top) { StorageUtil.setValue(StorageKeys.activatePositionTop, top); }, getActivateTop: function() { const innerHeight = window.innerHeight; let defaultTop = parseInt(innerHeight / 5); if (defaultTop >= 400) { defaultTop = 250; } let top = StorageUtil.getValue(StorageKeys.activatePositionTop, defaultTop); if (top >= innerHeight - 50) { top = innerHeight - 50; } return top; }, addEventListenerDrag: function(drag, widget) { let isDragging = false, startY, elementY; let windowHeight = window.innerHeight; const self = this; function onMouseMove(e) { if (!isDragging) return; const deltaY = e.clientY - startY; let top = elementY + deltaY; if (top < 0) { top = 0; } else if (top > windowHeight - 50) { top = windowHeight - 50; } widget.style.top = `${top}px`; self.updateActivateTop(top); } function onMouseUp() { if (!isDragging) return; isDragging = false; document.removeEventListener("mousemove", onMouseMove); document.removeEventListener("mouseup", onMouseUp); } drag.addEventListener("mousedown", (e) => { e.preventDefault(); isDragging = true; startY = e.clientY; elementY = parseInt(widget.style.top, 10) || 0; document.addEventListener("mousemove", onMouseMove); document.addEventListener("mouseup", onMouseUp); }); } }; var css_248z$1 = '.setting-piece:not(:last-child){margin-bottom:15px}.setting-piece .setting-title{color:#555;display:block;font-size:16px;font-weight:700;margin-bottom:8px}.setting-description{color:#888;font-size:12px;margin-bottom:10px}.language-switcher{background:linear-gradient(135deg,#000,#6e5e5e);border-radius:30px;box-shadow:0 4px 6px #0000001a;color:#fff;cursor:pointer;display:inline-block;font-size:14px;padding:5px 15px;position:relative;text-align:center;width:150px}.language-switcher .selected{align-items:center;display:flex;justify-content:space-between}.language-switcher .selected>span{flex-grow:1;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap}.language-switcher .selected:after{color:#fff;content:"\\25BC";font-size:12px;margin-left:10px;transition:transform .3s}.language-switcher.open .selected:after{transform:rotate(180deg)}.language-switcher .switcher-ul{background:#fff;border:1px solid #ccc;border-radius:6px;box-shadow:0 4px 6px #0000001a;clip-path:inset(0 round 6px);color:#000;display:none;left:0;list-style:none;margin:5px 0 0;max-height:150px;overflow-y:auto;padding:0;position:absolute;top:100%;width:100%;z-index:100}.language-switcher.open-ul .switcher-ul{display:block}.language-switcher .switcher-ul .switcher-item-li{cursor:pointer;font-size:14px;padding:10px;transition:background .3s}.language-switcher .switcher-ul .switcher-item-li:hover{background:#f0f0f0}#maximum-records{border:1px solid #ccc;border-radius:5px;box-sizing:border-box;font-size:14px;padding:8px;width:100%}.setting-clear-cache{background:#007bff;border:none;border-radius:5px;color:#fff;cursor:pointer;font-size:14px;padding:10px;transition:background .3s;width:100%}.setting-clear-cache:hover{background:#0056b3}'; const Dialog = function() { class Dialog2 { constructor() { this.root = null; this.mask = null; this.dialogStyle = null; this.closeBtn = null; this.content = null; this.dialogContent = null; } createElements(params) { const root = document.createElement("div"); root.setAttribute("style", "all: initial!important;z-index:2147483647!important;display:block!important;"); root.setAttribute("action", "action-dialog"); (document.documentElement || document.body).appendChild(root); const mask = document.createElement("div"); mask.classList.add("dialog-gcc-mask"); const shadowRoot = root.attachShadow({ mode: "open" }); shadowRoot.appendChild(mask); const content = document.createElement("div"); content.classList.add("dialog-gcc-container"); if (params.hasOwnProperty("direction")) { content.setAttribute("data-extension-direction", params.direction); } mask.appendChild(content); let styleText = ` *[data-extension-direction='rtl']{ direction: rtl!important; } .dialog-gcc-mask { width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); position: fixed; left: 0; top: 0; bottom: 0; right: 0; z-index: 9999999999999; } .dialog-gcc-container { max-width: 350px; width: 90%; background-color: #fff; box-shadow: 0 0 2px #999; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 5px; } .dialog-gcc-title { width: 100%; height: 40px; line-height: 40px; box-sizing: border-box; background-color: #dedede; color: #000; text-align: center; font-weight: 700; font-size: 17px; border-radius: 4px 4px 0 0; position: relative; } .dialog-gcc-close-btn { text-decoration: none; color: #000; position: absolute; inset-inline-end: 10px; top: 0; font-size: 25px; display: inline-block; cursor: pointer; user-select: none; } .dialog-gcc-content { padding: 15px; max-height: 400px; overflow: auto; } `; if (params.hasOwnProperty("styleSheet")) { styleText += params.styleSheet; } const dialogStyle = document.createElement("style"); dialogStyle.textContent = styleText; shadowRoot.insertBefore(dialogStyle, shadowRoot.firstChild); this.root = root; this.mask = mask; this.content = content; this.dialogStyle = dialogStyle; this.shadowRoot = shadowRoot; } middleBox(params) { const { content } = this; content.replaceChildren(); const title = document.createElement("div"); title.classList.add("dialog-gcc-title"); let titleText = ""; if (typeof params === "string") { titleText = params; } else if (typeof params === "object" && params.title) { titleText = params.title; } const span = document.createElement("span"); span.textContent = titleText; span.setAttribute("langue-extension-text", "setting_modal_title"); title.appendChild(span); const closeBtn = document.createElement("span"); closeBtn.textContent = "×"; closeBtn.classList.add("dialog-gcc-close-btn"); closeBtn.onclick = (e) => { e.stopPropagation(); e.preventDefault(); this.close(); }; title.appendChild(closeBtn); content.appendChild(title); this.closeBtn = closeBtn; } showMake(params) { this.createElements(params); this.middleBox(params); this.params = params; const { content } = this; const dialogContent = document.createElement("div"); dialogContent.classList.add("dialog-gcc-content"); dialogContent.insertAdjacentHTML("beforeend", params.content || ""); content.appendChild(dialogContent); this.dialogContent = dialogContent; if (typeof params.onContentReady === "function") { params.onContentReady(this); } } close() { if (this.root) { this.root.remove(); } const params = this.params; if (params && typeof params.onContentReady === "function") { params.onClose(this); } this.params = null; } } let dialog = null; return function() { if (!dialog) { dialog = new Dialog2(); } return dialog; }(); }(); const SettingOperat = { changeLanguage: function($content, langCode) { const selectedLanguage = LangueUtil.getSelectedLanguage(langCode); $content.querySelector("#selected-language").innerText = selectedLanguage.name; this.toggleDropdown($content, false); const selectedLang = LangueUtil.getLang(); if (selectedLang !== langCode) { LangueUtil.setLang(langCode); LangueUtil.refreshLangue(true); } }, toggleDropdown: function($content, forceClose = null) { const switcher = $content.querySelector("#language-switcher"); if (forceClose === false || switcher.classList.contains("open-ul")) { switcher.classList.remove("open-ul"); } else { switcher.classList.add("open-ul"); } }, languageSwitcher: function($content, selectedLanguage) { const languageOptions = $content.querySelector("#language-options"); LangueUtil.getLanguages().forEach((lang) => { const li = document.createElement("li"); li.classList.add("switcher-item-li"); li.textContent = lang.name; li.addEventListener("click", () => { this.changeLanguage($content, lang.code); }); languageOptions.appendChild(li); }); const switcher = $content.querySelector(".selected"); switcher.addEventListener("click", () => { this.toggleDropdown($content); }); $content.addEventListener("click", (e) => { if (!switcher.contains(e.target)) { this.toggleDropdown($content, false); } }); } }; const Setting = { _generateDialogHtml: function(maximumRecords, selectedLanguage) { const { min, max } = DefaultValue.history.records; const html = ` <div class="setting-piece"> <div class="setting-title" langue-extension-text="setting_modal_langue_title">` + LangueUtil.getLangueByStorageKey("setting_modal_langue_title") + `</div> <div class="setting-description" langue-extension-text="setting_modal_langue_description">` + LangueUtil.getLangueByStorageKey("setting_modal_langue_description") + `</div> <div class="language-switcher" id="language-switcher"> <div class="selected"> <span id="selected-language">` + selectedLanguage.name + `</span> </div> <ul id="language-options" class="switcher-ul"></ul> </div> </div> <div class="setting-piece"> <div class="setting-title" langue-extension-text="setting_modal_history_title">` + LangueUtil.getLangueByStorageKey("setting_modal_history_title") + `</div> <div class="setting-description" langue-extension-text="setting_modal_history_description"> ` + LangueUtil.formatTemplateWithArray( LangueUtil.getLangueByStorageKey("setting_modal_history_description"), [min, max] ) + ` </div> <input type="text" id="maximum-records" langue-extension-placeholder="setting_modal_history_max_placeholder" placeholder="` + LangueUtil.getLangueByStorageKey("setting_modal_history_max_placeholder") + `" value="${maximumRecords}"> </div> <div class="setting-piece "> <div class="setting-title" langue-extension-text="setting_modal_clear_title">` + LangueUtil.getLangueByStorageKey("setting_modal_clear_title") + `</div> <div class="setting-description" langue-extension-text="setting_modal_clear_description">` + LangueUtil.getLangueByStorageKey("setting_modal_clear_description") + `</div> <button class="setting-clear-cache" id="clear-cache" langue-extension-text="setting_modal_clear_btn">` + LangueUtil.getLangueByStorageKey("setting_modal_clear_btn") + `</button> </div> `; return { "styleSheet": css_248z$1, "content": html }; }, showDialog: function(callback) { const { min, max } = DefaultValue.history.records; const maximumRecords = StorageUtil.getValue(StorageKeys.history.maximumRecordsKey, DefaultValue.history.records.default); const selectedLang = LangueUtil.getLang(); const selectedLanguage = LangueUtil.getSelectedLanguage(selectedLang); const { styleSheet, content } = this._generateDialogHtml(maximumRecords, selectedLanguage); Dialog.showMake({ title: LangueUtil.getLangueByStorageKey("setting_modal_title"), content, styleSheet, direction: selectedLanguage.dir, onContentReady: function($that) { CACHE_ROOT_DIVS.push($that.shadowRoot); SettingOperat.languageSwitcher($that.dialogContent, selectedLanguage); const $input = $that.dialogContent.querySelector("#maximum-records"); const $clearCache = $that.dialogContent.querySelector("#clear-cache"); $input.value = maximumRecords; $input.onchange = function(e) { const value = this.value; if (value >= min && value <= max) { StorageUtil.setValue(StorageKeys.history.maximumRecordsKey, value); } }; $clearCache.addEventListener("click", function() { if (confirm(LangueUtil.getLangueByStorageKey("setting_modal_clear_confirm"))) { if (callback) callback(); StorageUtil.setValue(StorageKeys.history.goodsHistory, DefaultValue.history.historyStorage); } }); }, onClose: function($that) { const index = CACHE_ROOT_DIVS.indexOf($that.mask); if (index !== -1) { CACHE_ROOT_DIVS.splice(index, 1); } } }); } }; const Mask = { generate: function() { const mask = ElementUtil.createElement("div", { className: "mask-container" }); return mask; } }; class AutoDetectBase { constructor() { this.BUTTON_CLICK_PASUE_MS = 700; this.VALIDATE_DELAY_MAX_MS = 10 * 1e3; this.VALIDATE_LOOP_DELAY_MS = 1500; this.VALIDATE_END_PASUE_MS = 500; this.HookType = { "react": "react", "default": "default" }; } reactHook(element, value, useSetter = true) { var _a; const inputEvent = new InputEvent("input", { view: unsafeWindow, bubbles: true, cancelable: true }); const changeEvent = new InputEvent("change", { view: unsafeWindow, bubbles: true, cancelable: true }); const keyupEvent = new InputEvent("keyup", { view: unsafeWindow, bubbles: true, cancelable: true }); element.setAttribute("readonly", "readonly"); setTimeout(() => { element.removeAttribute("readonly"); }, 200); const valueSetter = (_a = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")) == null ? void 0 : _a.set; if (valueSetter && useSetter) { valueSetter.call(element, value); } else { element.value = value; } element.dispatchEvent(inputEvent); element.dispatchEvent(changeEvent); element.dispatchEvent(keyupEvent); } unusedHook(element, value) { element.value = value; } validate(supportData) { const submitButton = document.querySelector(supportData.submitButtonSelector); const couponInput = document.querySelector(supportData.couponInputSelector); const validateData = { "couponInput": null, "submitButton": null }; if (couponInput) { validateData.couponInput = couponInput; validateData.submitButton = submitButton; } return validateData; } clickValidateButton(supportData, couponInput, submitButton, code, hookType) { if (!couponInput) { return new Promise((resolve) => { resolve(false); }); } if (hookType === this.HookType.react) { this.reactHook(couponInput, code); } else if (hookType === this.HookType.default) { this.unusedHook(couponInput, code); } if (!submitButton) { submitButton = document.querySelector(supportData.submitButtonSelector); if (!submitButton) { return new Promise((resolve) => { resolve(false); }); } } return new Promise((resolve) => { const clickPromise = new Promise((resolveCheck) => { setTimeout(() => { submitButton.click(); resolveCheck(true); }, this.BUTTON_CLICK_PASUE_MS); }); clickPromise.then((result) => { resolve(result); }); }); } } var __async$a = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; class AliexpressAutoDetect extends AutoDetectBase { start(supportData, code) { const { couponInput, submitButton } = this.validate(supportData); return new Promise((resolve) => __async$a(this, null, function* () { const clickResult = yield this.clickValidateButton(supportData, couponInput, submitButton, code, this.HookType.react); if (!clickResult) { resolve(clickResult); return; } let errors = null, existingCode = null, inputCode = null; let checkResult = false, current = 0; const checkInterval = setInterval(() => { errors = document.querySelector(supportData.applyErrorSelector); if (supportData.existingCodeSelector) { existingCode = document.querySelector(supportData.existingCodeSelector); } inputCode = document.querySelector(supportData.couponInputSelector); if (errors || existingCode || !inputCode || current >= this.VALIDATE_DELAY_MAX_MS) { clearInterval(checkInterval); checkResult = !!existingCode || !inputCode; setTimeout(() => { resolve(checkResult); }, this.VALIDATE_END_PASUE_MS); } current += this.VALIDATE_LOOP_DELAY_MS; }, this.VALIDATE_LOOP_DELAY_MS); })); } } var __async$9 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; class WishAutoDetect extends AutoDetectBase { start(supportData, code) { const { couponInput, submitButton } = this.validate(supportData); return new Promise((resolve) => __async$9(this, null, function* () { const clickResult = yield this.clickValidateButton(supportData, couponInput, submitButton, code, this.HookType.react); if (!clickResult) { resolve(clickResult); return; } let errors = null, existingCode = null; let checkResult = false, current = 0; const checkInterval = setInterval(() => { errors = document.querySelector(supportData.applyErrorSelector); if (supportData.existingCodeSelector) { existingCode = document.querySelector(supportData.existingCodeSelector); } if (errors || existingCode || current >= this.VALIDATE_DELAY_MAX_MS) { clearInterval(checkInterval); checkResult = !!existingCode; setTimeout(() => { resolve(checkResult); }, this.VALIDATE_END_PASUE_MS); } current += this.VALIDATE_LOOP_DELAY_MS; }, this.VALIDATE_LOOP_DELAY_MS); })); } } var __async$8 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; class EbayAutoDetect extends AutoDetectBase { start(supportData, code) { const { couponInput, submitButton } = this.validate(supportData); return new Promise((resolve) => __async$8(this, null, function* () { const clickResult = yield this.clickValidateButton(supportData, couponInput, submitButton, code, this.HookType.react); if (!clickResult) { resolve(clickResult); return; } let errors = null, existingCode = null; let checkResult = false, current = 0; errors = document.querySelector(supportData.applyErrorSelector); if (errors) { errors.remove(); } const checkInterval = setInterval(() => { errors = document.querySelector(supportData.applyErrorSelector); if (supportData.existingCodeSelector) { existingCode = document.querySelector(supportData.existingCodeSelector); } if (errors || existingCode || current >= this.VALIDATE_DELAY_MAX_MS) { clearInterval(checkInterval); checkResult = !!existingCode; setTimeout(() => { resolve(checkResult); }, this.VALIDATE_END_PASUE_MS); } current += this.VALIDATE_LOOP_DELAY_MS; }, this.VALIDATE_LOOP_DELAY_MS); })); } } var __async$7 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const DetectHelper = { _tryClickExpand: function(supportData) { const { couponInputSelector, expandCodeBoxSelectors } = supportData; const couponInput = document.querySelector(couponInputSelector); if (couponInput) { return new Promise((resolve) => { resolve(true); }); } if (!expandCodeBoxSelectors || expandCodeBoxSelectors.length == 0) { return new Promise((resolve) => { resolve(false); }); } return new Promise((resolve) => __async$7(this, null, function* () { let result = false; for (let i = 0; i < expandCodeBoxSelectors.length; i++) { const elements = document.querySelectorAll(expandCodeBoxSelectors[i]); for (let j = 0; j < elements.length; j++) { let element = elements[j]; element.click(); result = yield new Promise((resolveInner) => { setTimeout(() => { let hasCouponInput = document.querySelector(couponInputSelector); resolveInner(!!hasCouponInput); }, 400); }); if (result) { break; } } if (result) { break; } } resolve(result); })); }, isPrepared: function(supportData) { return new Promise((resolve) => { Tools.waitForElementByInterval(supportData.promoContainerSelector, document.body, true, 50, 5 * 1e3).then((promoContainerElement) => { if (promoContainerElement) { this._tryClickExpand(supportData).then((result) => { resolve(result); }); } else { resolve(false); } }).catch(() => { resolve(false); }); }); } }; const AutoDetectUtil = { validate: function(platform, supportData) { return __async$7(this, null, function* () { const preparedData = { "result": false }; if (!!platform && !!supportData) { const isPrepared = yield DetectHelper.isPrepared(supportData); preparedData.result = isPrepared; } return preparedData; }); }, tryCode: function(platform, _supportData, code) { let promise = null; const supports = SupportData.supports; try { if (platform === supports.aliexpress.p) { promise = new AliexpressAutoDetect().start(_supportData, code); } else if (platform === supports.wish.p) { promise = new WishAutoDetect().start(_supportData, code); } else if (platform === supports.ebay.p) { promise = new EbayAutoDetect().start(_supportData, code); } } catch (e) { } return promise; } }; const CustomAlert = { show: function(params) { const style = document.createElement("style"); const random = "_" + Math.ceil(Math.random() * 1e8); style.textContent = ` .custom-alert-container` + random + ` { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 2147483647; width: 250px; } .custom-alert-content` + random + ` { display: flex; flex-direction: column; align-items: center; background-color: #FFF; border: 1px solid #ecebeb; border-radius: 5px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); padding: 10px; opacity: 1; animation: fadein 0.5s; } .custom-alert-icon` + random + ` { margin-bottom: 10px; } .custom-alert-message` + random + ` { font-size: 15px; color: #333; text-align: center; } @keyframes customFadein` + random + ` { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } } @keyframes customFadeout` + random + ` { from { opacity: 1; } to { opacity: 0; } } `; const container = document.createElement("div"); container.className = "custom-alert-container" + random; const alertContent = document.createElement("div"); alertContent.className = `custom-alert-content` + random; container.appendChild(alertContent); if (params.icon) { const icon = document.createElement("div"); icon.className = "custom-alert-icon" + random; icon.innerHTML = params.icon; alertContent.appendChild(icon); } const text = document.createElement("div"); text.className = "custom-alert-message" + random; text.textContent = params.message; alertContent.appendChild(text); document.body.appendChild(container); document.head.appendChild(style); setTimeout(() => { alertContent.style.animation = "customFadeout" + random + " 0.5s"; alertContent.addEventListener("animationend", () => { container.remove(); style.remove(); }); }, params.delay); } }; var __async$6 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const ProgressModal = { checkIsStop: false, _start: function() { this.checkIsStop = false; document.body.style.overflow = "hidden"; }, _end: function() { document.body.style.overflow = "auto"; this.checkIsStop = true; }, initProgress: function(progressBar) { progressBar.style.width = "0%"; }, updateProgressValue: function(progressBar, value) { progressBar.style.width = value * 100 + "%"; }, activeCouponItem: function(couponItem) { couponItem.classList.add("coupon-item-active"); }, inactiveCouponItem: function(couponItem) { ElementUtil.removeClass(couponItem, "coupon-item-active"); couponItem.classList.add("coupon-item-lose"); }, closeModal: function(mask) { mask.remove(); this._end(); }, addCloseEventListener: function(mask, modal) { modal.querySelector("div[class^='close']").addEventListener("click", (e) => { this.closeModal(mask); }); }, showCouponItems: function(mask, modal, platform, coupons, supportData) { return __async$6(this, null, function* () { const couponsWarpper = modal.querySelector("div[class^='deal-coupons-warpper']"); const progressBar = modal.querySelector("div[class^='progress-bar']"); const couponElements = coupons.map((coupon) => { return { "element": ElementUtil.createElement("div", { className: "coupon-item", text: coupon }), "code": coupon }; }); couponElements.forEach((item, index2) => { couponsWarpper.append(item.element); }); let total = coupons.length; const alertHiddenDelay = 4e3; this.initProgress(progressBar); const validateData = yield AutoDetectUtil.validate(platform, supportData); if (!validateData || !validateData.result) { this.closeModal(mask); CustomAlert.show({ "icon": alertErrorIconSVG, "message": LangueUtil.getLangueByStorageKey("auto_detect_alert_error"), "delay": alertHiddenDelay }); return; } const results = []; for (let index2 = 0; index2 < total; index2++) { if (this.checkIsStop) { break; } const { element, code } = couponElements[index2]; if (index2 != 0) { this.inactiveCouponItem(couponElements[index2 - 1].element); } this.activeCouponItem(element); this.couponScrollToCenter(couponsWarpper, element); this.updateProgressValue(progressBar, (index2 + 1) / total); let result = yield AutoDetectUtil.tryCode(platform, supportData, code); results.push({ "code": code, "result": result }); if (result) { break; } } this.closeModal(mask); const successCodeObj = results.find((item) => item.result === true); if (successCodeObj) { CustomAlert.show({ "icon": alertSuccessIconSVG, "message": LangueUtil.getLangueByStorageKey("auto_detect_alert_success"), "delay": alertHiddenDelay }); } else { CustomAlert.show({ "icon": alertErrorIconSVG, "message": LangueUtil.getLangueByStorageKey("auto_detect_alert_error"), "delay": alertHiddenDelay }); } }); }, couponScrollToCenter: function(couponsWarpper, element) { const couponsWarpperRect = couponsWarpper.getBoundingClientRect(); const elementRect = element.getBoundingClientRect(); const scrollLeft = couponsWarpper.scrollLeft + (elementRect.left + elementRect.width / 2) - (couponsWarpperRect.left + couponsWarpperRect.width / 2); couponsWarpper.scrollTo({ left: scrollLeft, behavior: "smooth" }); }, generate: function(logoBase642, root, platform, coupons, supportData) { const { outerDIV } = root; this._start(); const modalHtml = ` <div class="modal-header"> <div class="logo"> <img src="` + logoBase642 + `" /> </div> <div class="title"></div> <div class="btns"> <div class="close">` + closeSVG + `</div> </div> </div> <div class="modal-body"> <div class="deal-pic-warpper"></div> <div class="deal-description-warpper"> <div class="title" langue-extension-text="auto_detect_modal_description">` + LangueUtil.getLangueByStorageKey("auto_detect_modal_description") + `</div> <div class="sub-title" langue-extension-text="auto_detect_modal_secondary_description">` + LangueUtil.getLangueByStorageKey("auto_detect_modal_secondary_description") + `</div> </div> <div class="deal-coupons-warpper"></div> <div class="deal-progress-warpper"> <div class="progress-container"> <div class="progress-bar" style="width:0px;"></div> </div> </div> </div> `; const mask = Mask.generate(); const modal = ElementUtil.createElement("div", { className: "modal-content", html: modalHtml }); mask.append(modal); outerDIV.append(mask); this.showCouponItems(mask, modal, platform, coupons, supportData); this.addCloseEventListener(mask, modal); } }; var __async$5 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const FeatureControl = { createFeatureKey: function(key) { return { until: `${key}_disabledUntil` }; }, disableTemporarily: function(key, durationMs) { return __async$5(this, null, function* () { const until = Date.now() + durationMs; StorageUtil.setValue(this.createFeatureKey(key).until, until); }); }, isEnabled: function(key) { return __async$5(this, null, function* () { const { until } = this.createFeatureKey(key); const disabledUntil = StorageUtil.getValue(until, null); if (disabledUntil && Date.now() < disabledUntil) { return false; } return true; }); }, runIfEnabled: function(key, callback) { return __async$5(this, null, function* () { const enabled = yield this.isEnabled(key); if (enabled) { callback(); } }); } }; var css_248z = ".history-panel-wrapper{box-sizing:border-box;position:fixed;z-index:2147483646}.history-panel-wrapper svg.icon-i87i-svg path{fill:var(--color-modeal-header-icon)!important}.history-panel-wrapper svg.icon-i87i-svg:hover path{fill:var(--color-modeal-header-icon-hover)!important}.history-panel-wrapper>.history-panel-aside-main{background-color:#fff;border:1px solid #ebebeb;border-radius:5px;bottom:70px;box-shadow:2px 2px 5px #b6bdc5;height:400px;overflow-x:hidden;overflow-y:auto;position:absolute;right:0;width:400px}.history-panel-wrapper>.history-panel-aside-main>.panel-aside-main-inner{display:flex;flex-direction:column;height:100%;width:100%}.history-panel-aside-main .panel-aside-main-header{align-items:center;background-color:var(--color-modeal-header-background);border-bottom:1px solid #ebe6e6;box-sizing:border-box;display:flex;height:var(--size-height-modeal-header);justify-content:space-between;padding:0 var(--size-padding-horizontal-modeal-header)}.history-panel-aside-main .panel-aside-main-header>.logo-header{align-items:center;display:flex;justify-content:center}.history-panel-aside-main .panel-aside-main-header>.logo-header>svg{height:var(--size-height-modeal-icon)!important;width:var(--size-height-modeal-icon)!important}.history-panel-aside-main .panel-aside-main-header>.title-header{flex:1;font-size:var(--size-font-modeal-header-title);font-weight:700;padding-left:10px}.history-panel-aside-main .panel-aside-main-header .btns-header{display:flex;flex-direction:row}.history-panel-aside-main .panel-aside-main-header .btns-header .close,.history-panel-aside-main .panel-aside-main-header .btns-header .setting{align-items:center;cursor:pointer;display:flex;justify-content:center;width:var(--size-height-modeal-operat-icon)}.history-panel-aside-main .panel-aside-main-content{background-color:var(--color-modeal-content-background);flex:1;overflow:auto}.history-panel-aside-main .panel-aside-main-item{margin:5px 0;padding:5px}.history-panel-aside-main .panel-aside-main-item .item-title{color:#b6b6b6;font-size:13px;font-weight:500;padding:5px 0;text-align:center}.history-panel-aside-main .panel-aside-main-item .item-container{display:flex;flex-flow:wrap;flex-direction:row;justify-content:flex-start}.history-panel-aside-main .histories-box-review_item{margin:5px 0;overflow:hidden;width:33.3333%}.history-panel-aside-main .histories-box-review_item>a{background-color:#fff!important;border:1px solid #ccc!important;border-radius:5px!important;box-sizing:initial!important;display:block!important;margin:0 auto!important;position:relative!important;width:110px!important}.history-panel-aside-main .histories-box-review_item>a>.review-shadow{border:2px solid red;border-radius:5px;bottom:0;display:none;left:0;position:absolute;right:0;text-align:center;top:0;z-index:99}.history-panel-aside-main .histories-box-review_item>a>.review-shadow .delete-btn{background-color:red;border-radius:3px;color:#fff;font-size:13px;height:15px;line-height:10px;position:absolute;right:0;text-align:center;top:0;width:15px}.history-panel-aside-main .histories-box-review_item>a>.review-img{border-radius:5px 5px 0 0;height:110px;overflow:hidden;width:110px}.history-panel-aside-main .histories-box-review_item>a>.review-img>img{width:100%!important}.history-panel-aside-main .histories-box-review_item>a>.review-text{color:#000!important;font-size:13px!important;overflow:hidden!important;padding:5px!important;text-align:center!important;text-decoration:underline!important;text-overflow:ellipsis!important;white-space:nowrap!important}.history-panel-wrapper>.history-panel-aside-body{background-color:#fafafa;border-radius:5px;box-shadow:1px 1px 2px #b6bdc5;direction:ltr!important;display:flex;height:60px;overflow:hidden}.history-panel-wrapper>.history-panel-aside-body>div{align-items:center!important;display:flex!important;justify-content:center!important}.history-panel-aside-body .goods-expand{cursor:pointer;width:20px!important}.history-panel-aside-body .goods-expand svg{transition:transform .3s!important}.history-panel-aside-body .goods-review{flex-direction:row;transition:all .5s ease-in-out;width:auto}.history-panel-aside-body .goods-review-item{border-radius:4px;cursor:pointer;height:45px;line-height:45px;margin:0 5px;overflow:hidden;position:relative;width:45px}.history-panel-aside-body .goods-review-item>a{display:block!important;height:100%!important;width:100%!important}.history-panel-aside-body .goods-review-item>a>.review-shadow{background-color:#3d9ba433;bottom:0;display:none;left:0;position:absolute;right:0;text-align:center;top:0;z-index:99}.history-panel-aside-body .goods-review-item>a>.review-shadow img{width:15px!important}.history-panel-aside-body .goods-review-item img{width:100%!important}.history-panel-aside-body .history-box-expand{cursor:pointer;flex-direction:column;margin:0 10px;text-align:center}.history-panel-aside-body .history-box-expand svg{height:33px!important;width:33px!important}.history-panel-aside-body .history-box-expand label{font-size:12px!important;font-weight:700!important}.history-panel-aside-body .wrapper-drag-handle{box-shadow:0 3px 3px -2px #0003,0 3px 4px 0 #00000024,0 1px 8px 0 #0000001f;cursor:move;width:20px!important}"; const GoodsHistory = { root: null, models: { history: "history-model" }, push: function(platform, obj) { var _a; try { const storageObj = StorageUtil.getValue(StorageKeys.history.goodsHistory, DefaultValue.history.historyStorage); const maximumRecords = StorageUtil.getValue(StorageKeys.history.maximumRecordsKey, DefaultValue.history.records.default); const histories = (_a = storageObj[platform]) != null ? _a : []; if (histories.length >= maximumRecords) { histories.splice(0, parseInt(maximumRecords / 5)); } const newArr = histories.filter((item, index) => item.id != obj.id); newArr.push(obj); storageObj[platform] = newArr; StorageUtil.setValue(StorageKeys.history.goodsHistory, storageObj); } catch (e) { } }, get: function(platform, num = -1) { var _a; const storageObj = StorageUtil.getValue(StorageKeys.history.goodsHistory, DefaultValue.history.historyStorage); const histories = (_a = storageObj[platform]) != null ? _a : []; if (num > 0) { const showHistories = []; for (let i = histories.length - 1; i >= 0; i--) { if (showHistories.length >= num) break; showHistories.push(histories[i]); } return showHistories; } return histories; }, remove: function(platform, id) { const storageObj = StorageUtil.getValue(StorageKeys.history.goodsHistory, DefaultValue.history.historyStorage); const histories = storageObj[platform]; let newArr = histories.filter((item, index) => item.id != id); storageObj[platform] = newArr; StorageUtil.setValue(StorageKeys.history.goodsHistory, storageObj); }, getGoodsByDateGroup: function(platform) { const histories = this.get(platform).reverse(); const group = []; const today = new Date(); const yesterday = new Date(today); const format = "dd/MM"; yesterday.setDate(today.getDate() - 1); const todayStr = this.dateFormat(today, format); const yesterdayStr = this.dateFormat(yesterday, format); const showDateFormat = (todayStr2, yesterdayStr2, current) => { const langueFormat2 = {}; if (current === todayStr2) { langueFormat2.str = LangueUtil.getLangueByStorageKey("history_box_hit_today"); langueFormat2.langueKey = "history_box_hit_today"; } else if (current === yesterdayStr2) { langueFormat2.str = LangueUtil.getLangueByStorageKey("history_box_hit_yesterday"); langueFormat2.langueKey = "history_box_hit_yesterday"; } else { langueFormat2.str = " —— " + current + " —— "; langueFormat2.langueKey = ""; } return langueFormat2; }; let items = [], cacheDateStr = null, currentDateStr = null, langueFormat = null; for (let i = 0; i < histories.length; i++) { today.setTime(histories[i].date); currentDateStr = this.dateFormat(today, format); if (!!cacheDateStr) { if (cacheDateStr != currentDateStr) { langueFormat = showDateFormat(todayStr, yesterdayStr, cacheDateStr); group.push({ "str": langueFormat.str, "langueKey": langueFormat.langueKey, "items": items }); items = []; cacheDateStr = currentDateStr; } } else { cacheDateStr = currentDateStr; } items.push(histories[i]); } if (items.length != 0) { langueFormat = showDateFormat(todayStr, yesterdayStr, cacheDateStr); group.push({ "str": langueFormat.str, "langueKey": langueFormat.langueKey, "items": items }); } return group; }, dateFormat: function(date, format) { var showDate = { "M+": date.getMonth() + 1, "d+": date.getDate(), "h+": date.getHours(), "m+": date.getMinutes(), "s+": date.getSeconds(), "q+": Math.floor((date.getMonth() + 3) / 3), "S+": date.getMilliseconds() }; if (/(y+)/i.test(format)) { format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)); } for (var k in showDate) { if (new RegExp("(" + k + ")").test(format)) { format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? showDate[k] : ("00" + showDate[k]).substr(("" + showDate[k]).length)); } } return format; }, showOrHideHistoryBox: function(platform) { const { outerDIV, shadowRoot } = this.root; const self = this; const group = this.getGoodsByDateGroup(platform); const contentElement = outerDIV.querySelector(".history-panel-aside-main .panel-aside-main-content"); contentElement.innerHTML = ""; let historiesBoxHtml = "", jumpUrl = "", imgUrl = ""; for (let i = 0; i < group.length; i++) { historiesBoxHtml += `<div class="panel-aside-main-item">`; historiesBoxHtml += `<div class="item-title" langue-extension-text="` + group[i].langueKey + `">` + group[i].str + `</div>`; historiesBoxHtml += `<div class="item-container">`; for (let j = 0; j < group[i].items.length; j++) { jumpUrl = this.pretreatmentJumpUrl(group[i].items[j].url, platform); imgUrl = this.pretreatmentImageUrl(group[i].items[j].pic, platform); historiesBoxHtml += ` <div class="histories-box-review_item"> <a title="` + group[i].items[j].title + `" jump-tag="true" href="javascript:void(0);" jump-url="` + jumpUrl + `" target="_blank"> <div class="review-shadow"> <div class="delete-btn" data-id="` + group[i].items[j].id + `">×</div> </div> <div class="review-img"><img src="` + imgUrl + `" /></div> <div class="review-text">` + group[i].items[j].price + `</div> </a> </div> `; } historiesBoxHtml += `</div>`; historiesBoxHtml += `</div>`; } contentElement.innerHTML = historiesBoxHtml; outerDIV.querySelectorAll(".history-panel-aside-main .delete-btn").forEach((ele) => { ele.addEventListener("click", function(e) { e.stopPropagation(); e.preventDefault(); const id = this.getAttribute("data-id"); this.parentNode.parentNode.parentNode.remove(); self.remove(platform, id); }); }); const items = outerDIV.querySelectorAll(".history-panel-aside-main .histories-box-review_item > a"); items.forEach((ele) => { ele.addEventListener("mouseover", function() { this.querySelector(".review-shadow").style.display = "block"; }); ele.addEventListener("mouseout", function() { this.querySelector(".review-shadow").style.display = "none"; }); }); outerDIV.querySelectorAll(".history-panel-aside-main a[jump-tag='true']").forEach((ele) => { ele.addEventListener("click", function(e) { e.stopPropagation(); e.preventDefault(); const href = this.getAttribute("jump-url"); Tools.openInTab(Tools.decryptStr(href)); }); }); }, pretreatmentJumpUrl: function(url, platform) { const exchangeInfoLocal = StorageUtil.getValue(StorageKeys.exchangeInfo, DefaultValue.exchangeInfoLocal); const redirect = exchangeInfoLocal.redirect; const jumpUrl = redirect + encodeURIComponent(url); return Tools.encryptStr(jumpUrl); }, pretreatmentImageUrl: function(imgUrl, platform) { let dealImgUrl = ""; if (platform == "aliexpress") { dealImgUrl = imgUrl.replace(/_\d+x\d+\./, "_150x150."); } else { dealImgUrl = imgUrl; } return dealImgUrl; }, createHistoryBox: function(platform) { const { outerDIV, shadowRoot } = this.root; const wrapperOffset = StorageUtil.getValue(StorageKeys.history.offset, DefaultValue.history.offsetWrapper); const histories = this.get(platform, DefaultValue.history.toolbarGoodsNum); const selectedLanguage = LangueUtil.getSelectedLanguage(); let goodsHtml = ``, jumpUrl = ""; histories.forEach((h) => { jumpUrl = this.pretreatmentJumpUrl(h.url, platform); goodsHtml += ` <div class="goods-review-item"> <a title="` + h.title + `" jump-tag="true" jump-url="` + jumpUrl + `" target="_blank"> <div class="review-shadow"> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAVlJREFUWEftlsGRgzAMRS26wBQTUtluKltSDKYLlJUHMY6xZMGFi7lkCObr6cuWAHfzBTfHdw2gOdAcOOXAPM+/fGwB4OGcG7f7iX4R8d113dT3fby3XCYACgwAPxZBBiKYYRh2YOldFUAKjIivNNNlWUZEJEB2ZI9HazUQEUALLgluIH95thpEESCEQCKHbADgyfXNACcAeNEzpVyT9/6Zwx0ApOD/QFFAypKEvfdR74x7XwCaOGevANIpiPXWNm1eji8ATZyzCyGgdhos63gN6eQAorhFmMugOcml3PtJmo3FukpPqO6TdCMfHLBuIKkMiUvFU5RnXwSgP6W9kG6gbQ0tpya0NxvFftsx5JJIVucWWkp4uhHVIMhKajy0jptPtLMwLy634kJm6fSrzqVa4OIpqKlSfdd1HbdRHOufTj9+3zIFLwHUAK88N30PXBG2vtMAmgPNgQ/i7v8h6Um2jAAAAABJRU5ErkJggg==" /> </div> <img src="` + h.pic + `" /> </a> </div> `; }); let html = ` <div class="history-panel-wrapper" data-re-mark-tag="` + platform + `" style="bottom:` + wrapperOffset.bottom + `px; right:` + wrapperOffset.right + `px;"> <div class="history-panel-aside-main" data-extension-direction="` + selectedLanguage.dir + `" style="display:none;"> <div class="panel-aside-main-inner"> <div class="panel-aside-main-header"> <div class="logo-header">` + historyIconSVG + `</div> <div class="title-header" langue-extension-text="history_box_title">` + LangueUtil.getLangueByStorageKey("history_box_title") + `</div> <div class="btns-header"> <div class="setting">` + settingSVG + `</div> <div class="close">` + closeSVG + `</div> </div> </div> <div class="panel-aside-main-content"></div> </div> </div> <div class="history-panel-aside-body"> <div class="goods-expand"> <svg focusable="false" class="icon-i87i-svg" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1365" width="20" height="20"><path d="M317.84959998 926.1056a46.08 46.08 0 0 1 10.8544-29.9008L643.68639998 521.216a13.312 13.312 0 0 0 0-18.432l-3.6864-3.072L328.70399998 127.7952a46.4896 46.4896 0 0 1 71.0656-59.8016l311.0912 370.68799999a105.8816 105.8816 0 0 1 0 146.63680002l-311.0912 370.68799999a46.2848 46.2848 0 0 1-81.92-29.9008z" fill="#bfbfbf" p-id="1366"></path></svg> </div> <div class="goods-review"> ` + goodsHtml + ` </div> <div class="history-box-expand"> ` + historyIconSVG + ` <label langue-extension-text="history_bar_hint">` + LangueUtil.getLangueByStorageKey("history_bar_hint") + `</label> </div> <div class="wrapper-drag-handle"> <svg focusable="false" class="icon-i87i-svg" viewBox="0 0 24 24" data-testid="DragIndicatorIcon"><path d="M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2" fill="#bfbfbf"></path></svg> </div> </div> </div> `; outerDIV.insertAdjacentHTML("beforeend", html); this.addEventListener(platform); }, addDragEventListener: function() { const { outerDIV, shadowRoot } = this.root; const draggable = outerDIV.querySelector(".history-panel-wrapper .wrapper-drag-handle"); const wrapper = outerDIV.querySelector(".history-panel-wrapper"); const offsetWrapper = Object.assign({}, DefaultValue.history.offsetWrapper); let isDragging = false, startY, elementBottom; let windowHeight = window.innerHeight; let bottomMax = parseInt(windowHeight / 3) * 2, bottomMin = DefaultValue.history.offsetWrapper.bottom; window.addEventListener("resize", () => { windowHeight = window.innerHeight; bottomMax = parseInt(windowHeight / 3) * 2; }); function onMouseUp() { if (!isDragging) return; isDragging = false; document.removeEventListener("mousemove", onMouseMove); document.removeEventListener("mouseup", onMouseUp); StorageUtil.setValue(StorageKeys.history.offset, offsetWrapper); } function onMouseMove(e) { if (!isDragging) return; const deltaY = e.clientY - startY; let newBottom = elementBottom - deltaY; if (newBottom <= bottomMin) { newBottom = bottomMin; } else if (newBottom > bottomMax) { newBottom = bottomMax; } wrapper.style.bottom = `${newBottom}px`; offsetWrapper.bottom = newBottom; } draggable.addEventListener("mousedown", (e) => { e.preventDefault(); if (window.getComputedStyle(wrapper).position !== "absolute" && window.getComputedStyle(wrapper).position !== "fixed") { return; } isDragging = true; startY = e.clientY; elementBottom = parseInt(window.getComputedStyle(wrapper).bottom, DefaultValue.history.offsetWrapper.bottom) || DefaultValue.history.offsetWrapper.bottom; document.addEventListener("mousemove", onMouseMove); document.addEventListener("mouseup", onMouseUp); }); }, addEventListener: function(platform) { const { outerDIV, shadowRoot } = this.root; const self = this; const items = outerDIV.querySelectorAll(".goods-review >.goods-review-item >a"); items.forEach((ele) => { ele.addEventListener("mouseover", function() { this.querySelector(".review-shadow").style.display = "block"; }); ele.addEventListener("mouseout", function() { this.querySelector(".review-shadow").style.display = "none"; }); }); const goodsExpandEle = outerDIV.querySelector(".history-panel-wrapper .goods-expand"); if (goodsExpandEle) { goodsExpandEle.addEventListener("click", function() { const goodsReviewEle = this.nextElementSibling; const svgEle = this.querySelector("svg"); svgEle.style.transition = "transform 0.3s"; if (goodsReviewEle.style.width == "0px") { goodsReviewEle.style.width = "auto"; svgEle.style.transform = "rotate(0deg)"; } else { goodsReviewEle.style.width = "0px"; svgEle.style.transform = "rotate(180deg)"; } }); } const historyBoxExpandEles = [ outerDIV.querySelector(".history-panel-wrapper .history-box-expand"), outerDIV.querySelector(".history-panel-wrapper .close") ]; const asideMainEle = outerDIV.querySelector(".history-panel-wrapper >.history-panel-aside-main"); if (asideMainEle) { historyBoxExpandEles.forEach((ele) => { if (ele) { ele.addEventListener("click", function() { const computedDisplay = window.getComputedStyle(asideMainEle).display; if (computedDisplay === "none") { self.showOrHideHistoryBox(platform); asideMainEle.style.display = "block"; } else { asideMainEle.style.display = "none"; } }); } }); } document.addEventListener("click", function(event) { const path = event.composedPath(); const clickedInsideShadow = path.some((el) => el === outerDIV || el === shadowRoot); if (!clickedInsideShadow) { asideMainEle.style.display = "none"; } }); const headerSettingElement = outerDIV.querySelector(".history-panel-wrapper .setting"); if (headerSettingElement) { headerSettingElement.addEventListener("click", () => { Setting.showDialog(() => { outerDIV.querySelector(".history-panel-aside-body .goods-review").innerHTML = ""; outerDIV.querySelector(".history-panel-aside-main .panel-aside-main-content").innerHTML = ""; }); }); } outerDIV.querySelectorAll(".history-panel-aside-body a[jump-tag='true']").forEach((ele) => { ele.addEventListener("click", function(e) { e.stopPropagation(); e.preventDefault(); const href = this.getAttribute("jump-url"); Tools.openInTab(Tools.decryptStr(href)); }); }); self.addDragEventListener(); }, show: function() { var _a; const outerDIV = (_a = this.root) == null ? void 0 : _a.outerDIV; if (outerDIV) { outerDIV.style.display = "block"; } }, hide: function() { var _a; const outerDIV = (_a = this.root) == null ? void 0 : _a.outerDIV; if (outerDIV) { outerDIV.style.display = "none"; } }, start: function(support) { try { if (support.record.disabled) { return; } const platform = support.p; const styles = css_248z$3 + css_248z; const root = InspectUtil.generateShadowDomRoot(platform + "-" + this.models.history, styles); this.root = root; this.createHistoryBox(platform); } catch (e) { } } }; var __async$4 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const CouponListModal = { _root: null, _logoBase64: null, _hasModal: false, removeModel: function(modal) { modal.remove(); this._hasModal = false; }, addCloseEventListener: function(button, modal) { button.addEventListener("click", (e) => { this.removeModel(modal); }); }, addShowSettingEventListener: function(platform, modal) { return __async$4(this, null, function* () { const setting = modal.querySelector(".modal-header .btns> .setting"); const dropdown = modal.querySelector(".modal-header #settingsDropdown"); const hide30m = 15; const settingsData = [ { category: LangueUtil.getLangueByStorageKey("setting_window_show_display_title"), items: [ { id: "hide30m", label: LangueUtil.formatTemplateWithArray( LangueUtil.getLangueByStorageKey("setting_window_show_display_hide30m"), [hide30m] ) }, { id: "showAll", label: LangueUtil.getLangueByStorageKey("setting_window_show_display_all") } ] }, { category: LangueUtil.getLangueByStorageKey("setting_window_show_general_title"), items: [ { id: "general", label: LangueUtil.getLangueByStorageKey("setting_window_show_general_general") } ] } ]; const windowShow = yield FeatureControl.isEnabled(StorageKeys.featureControl.windowShow + "_" + platform); if (windowShow) { settingsData.forEach((group) => { group.items = group.items.filter((item) => item.id !== "showAll"); }); } else { settingsData.forEach((group) => { group.items = group.items.filter((item) => item.id === "showAll"); }); } const renderSettings = () => { dropdown.innerHTML = ""; settingsData.forEach((group) => { const categoryDiv = document.createElement("div"); categoryDiv.className = "setting-category"; const title = document.createElement("div"); title.className = "setting-category-title"; title.textContent = group.category; categoryDiv.appendChild(title); group.items.forEach((item) => { const opt = document.createElement("div"); opt.className = "setting-option"; opt.textContent = item.label; opt.dataset.id = item.id; opt.addEventListener("click", () => { if (item.id === "hide30m") { FeatureControl.disableTemporarily(StorageKeys.featureControl.windowShow + "_" + platform, hide30m * 60 * 1e3); this.hideAllComponents(); this.removeModel(modal); } else if (item.id === "showAll") { FeatureControl.enable(StorageKeys.featureControl.windowShow + "_" + platform); this.showAllComponents(); } else if (item.id === "general") { this.removeModel(modal); Setting.showDialog(); } dropdown.classList.remove("active"); }); categoryDiv.appendChild(opt); }); dropdown.appendChild(categoryDiv); }); }; setting.addEventListener("click", () => { dropdown.classList.toggle("active"); if (dropdown.classList.contains("active")) { renderSettings(); } }); modal.addEventListener("click", (e) => { if (!modal.querySelector(".modal-header .btns").contains(e.target)) { dropdown.classList.remove("active"); } }); }); }, addApplyCouponsEventListener: function(button, modal) { InspectUtil.bindApplyCouponsEvent(button, (dataJson) => { this.removeModel(modal); const { platform, codes, check } = dataJson; ProgressModal.generate( this._logoBase64, this._root, platform, codes, check ); }); }, generateRequest: function(modalBody) { const requestState = ElementUtil.createElement("div", { className: "request-state" }); modalBody.append(requestState); return requestState; }, generateRequestLoadding: function() { return ElementUtil.createElement("div", { className: "loading" }); }, generateRequestLoaddingError: function(callback) { const retry = ElementUtil.createElement("div", { className: "loading-error-retry", text: LangueUtil.getLangueByStorageKey("couponList_modal_retry"), attributes: { "langue-extension-text": "couponList_modal_retry" } }); retry.addEventListener("click", () => { callback(); }); const error = ElementUtil.createElement("div", { className: "loading-error", childrens: [ ElementUtil.createElement("div", { className: "loading-error-image", html: ` <svg t="1735570722474" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7538" width="64" height="64"><path d="M143.1552 722.0224s-2.56-1.536-7.7824-4.096l4.096-7.2704c4.608 2.56 7.2704 4.096 7.2704 4.096l-3.584 7.2704z m-22.7328-12.9024c-4.608-2.56-9.3184-6.2464-14.4384-9.3184l4.608-7.2704c5.12 3.584 9.8304 6.7584 13.9264 9.3184l-4.096 7.2704z m-28.3648-19.6608c-4.608-3.072-8.8064-6.7584-13.4144-10.8544l5.632-6.7584c4.608 3.584 8.8064 7.2704 13.4144 10.3424l-5.632 7.2704z m-26.8288-22.2208c-4.096-4.096-8.2944-7.7824-12.3904-12.3904l6.2464-5.632c4.096 4.096 7.7824 8.2944 11.8784 11.8784l-5.7344 6.144z m-23.7568-25.2928c-3.584-4.608-7.2704-9.3184-10.3424-13.9264l7.2704-4.608c3.072 4.608 6.2464 8.8064 9.8304 13.4144l-6.7584 5.12z m-19.6608-29.3888c-2.56-5.7344-5.12-10.8544-6.7584-16.4864l8.2944-2.56c1.536 5.12 3.584 10.3424 6.2464 14.9504l-7.7824 4.096z m-10.8544-33.5872c-0.512-4.096-1.024-8.2944-1.024-12.3904v-5.632l8.2944 0.512v5.12c0 3.584 0.512 7.2704 1.024 10.8544l-8.2944 1.536z m10.8544-33.0752l-8.2944-2.56c1.536-5.7344 3.584-11.3664 6.7584-16.4864l7.7824 3.584c-3.1744 5.12-5.2224 10.24-6.2464 15.4624z m815.616-19.6608h-16.9984v-8.2944h16.4864l0.512 8.2944z m17.1008-0.512v-8.2944c5.7344 0 11.3664 0 16.9984-0.512l0.512 8.2944c-5.632 0.512-11.3664 0.512-17.5104 0.512z m-51.2 0c-5.632 0-11.3664-0.512-16.9984-0.512l0.512-8.2944c5.632 0 11.3664 0.512 16.9984 0.512l-0.512 8.2944z m85.8112-1.024l-0.512-8.2944c5.632-0.512 11.3664-0.512 16.9984-1.024l0.512 8.2944c-5.12 0.512-11.3664 0.512-16.9984 1.024z m-120.32-0.512c-5.7344-0.512-11.3664-0.512-16.9984-1.024l0.512-8.2944c5.7344 0.512 11.3664 0.512 17.1008 1.024l-0.6144 8.2944z m-34.0992-2.048c-5.632-0.512-11.3664-1.024-16.9984-1.024l0.512-8.2944c5.632 0.512 11.3664 1.024 16.9984 1.024l-0.512 8.2944z m189.0304-0.512l-1.024-8.2944c5.7344-0.512 11.3664-1.536 16.4864-2.56l1.536 8.2944c-5.632 1.024-11.3664 2.048-16.9984 2.56z m-223.1296-2.048l-17.1008-1.536 1.024-8.2944 16.9984 1.536-0.9216 8.2944z m-663.8592-1.024l-5.7344-6.2464c3.584-3.584 8.8064-7.2704 14.4384-10.3424l4.608 7.2704c-5.5296 3.072-9.6256 6.144-13.312 9.3184z m629.248-2.1504l-16.9984-1.536 1.024-8.2944 16.9984 1.536-1.024 8.2944z m291.84-0.512l-2.048-8.2944c5.7344-1.536 11.3664-2.56 15.9744-4.096l2.56 8.2944c-4.608 1.536-10.3424 3.072-16.4864 4.096z m-325.9392-3.072c-5.7344-0.512-11.3664-1.536-17.1008-2.048l1.024-8.2944c5.632 0.512 11.3664 1.536 16.9984 2.048l-0.9216 8.2944z m-34.0992-4.096c-5.632-0.512-11.3664-1.536-16.9984-2.048l1.024-8.2944c5.7344 0.512 11.3664 1.536 17.1008 2.048l-1.1264 8.2944z m393.1136-4.1984l-4.096-7.7824c5.12-2.56 9.3184-5.7344 12.3904-9.3184l6.2464 5.7344c-3.1744 4.7104-7.8848 8.2944-14.5408 11.3664z m-426.7008-0.512c-5.632-1.024-11.3664-1.536-16.9984-2.56l1.024-8.2944c5.632 1.024 11.3664 1.536 16.9984 2.56l-1.024 8.2944z m-499.5072-3.072l-3.584-7.7824c5.12-2.56 10.3424-4.608 15.9744-6.7584l3.072 7.7824c-5.7344 2.6624-10.8544 4.7104-15.4624 6.7584z m465.408-2.048c-5.7344-1.024-11.3664-1.536-17.1008-2.56l1.536-8.2944c5.632 1.024 11.3664 2.048 16.9984 2.56l-1.4336 8.2944z m-34.0992-5.7344l-16.9984-3.072 1.536-8.2944 17.1008 3.072-1.6384 8.2944z m-399.872-4.608l-3.072-8.2944c5.12-2.048 10.8544-3.584 16.4864-5.12l2.56 8.2944c-5.632 1.536-10.752 3.072-15.9744 5.12z m366.2848-1.024l-16.9984-3.072 1.536-8.2944 16.9984 3.072-1.536 8.2944z m-33.5872-6.7584c-5.7344-1.024-11.3664-2.048-17.1008-3.584l1.536-8.2944c5.632 1.024 11.3664 2.048 16.4864 3.584l-0.9216 8.2944zM128.7168 478.208l-2.048-8.2944c5.12-1.536 10.8544-3.072 16.4864-4.608l2.048 8.2944c-5.632 1.536-11.264 3.072-16.4864 4.608z m875.6224-2.56v-1.024c-0.512-4.096-2.048-8.2944-5.12-12.3904l6.7584-5.12c3.584 5.12 6.2464 10.8544 6.7584 16.4864v1.536l-8.3968 0.512zM395.264 474.112c-5.7344-1.024-11.3664-2.56-16.4864-3.584l2.048-8.2944c5.632 1.024 10.8544 2.56 16.4864 3.584l-2.048 8.2944z m-233.984-4.1984l-1.536-8.2944c5.632-1.536 10.8544-2.56 16.4864-4.096l2.048 8.2944c-5.632 1.536-11.264 2.56-16.9984 4.096z m200.3968-3.584c-5.632-1.536-11.3664-2.56-16.4864-4.096l2.048-8.2944c5.632 1.536 10.8544 2.56 16.4864 4.096l-2.048 8.2944z m-166.8096-4.096l-1.536-8.2944c5.7344-1.024 11.3664-2.048 17.1008-3.584l1.536 8.2944c-6.2464 1.4336-11.4688 2.56-17.1008 3.584z m133.2224-4.1984c-5.632-1.536-11.3664-3.072-16.4864-4.096l2.048-8.2944c5.7344 1.536 10.8544 3.072 16.4864 4.096l-2.048 8.2944z m-99.6352-2.56l-1.536-8.2944 16.9984-3.072 1.536 8.2944c-6.144 1.024-11.8784 2.048-16.9984 3.072z m759.296-3.584c-4.096-2.56-8.8064-5.12-14.4384-7.7824l3.584-7.7824c5.7344 2.56 11.3664 5.7344 15.4624 8.2944l-4.608 7.2704z m-725.7088-2.56l-1.536-8.2944c5.632-1.024 11.3664-2.048 16.9984-2.56l1.024 6.2464 2.56-8.2944c4.608 1.536 9.3184 2.56 14.4384 4.096l-1.024-4.608c5.632-1.024 11.3664-1.536 16.9984-2.56l1.024 8.2944c-5.7344 1.024-10.8544 1.536-15.9744 2.56l-1.536 5.12c-5.632-1.536-10.8544-3.072-16.4864-4.608l0.512 2.048c-5.632 0.9216-11.3664 1.9456-16.9984 2.56z m0-9.8304c-5.7344-1.536-10.8544-3.584-16.4864-5.12l2.56-8.2944c5.12 1.536 10.8544 3.584 15.9744 5.12l-2.048 8.2944z m67.6864-0.512l-1.024-8.2944c5.7344-1.024 11.3664-1.536 16.9984-2.048l1.024 8.2944c-5.632 0.4096-11.3664 1.536-16.9984 2.048z m628.1216-1.024c-5.12-1.536-10.3424-3.072-15.9744-4.608l2.048-8.2944c5.632 1.536 11.3664 3.072 16.4864 5.12l-2.56 7.7824z m-594.6368-3.1744l-1.024-8.2944c5.632-0.512 11.3664-1.536 16.9984-2.048l1.024 8.2944c-5.632 0.512-11.264 1.024-16.9984 2.048z m34.0992-4.096l-1.024-8.2944c5.7344-0.512 11.3664-1.024 17.1008-2.048l1.024 8.2944c-5.7344 1.024-11.3664 1.536-17.1008 2.048z m527.9744-1.536c-5.12-1.024-10.8544-2.048-16.4864-3.072l1.536-8.2944 16.9984 3.072-2.048 8.2944z m-695.808 0c-5.632-2.048-10.8544-3.584-15.9744-5.632l3.072-7.7824c5.12 2.048 10.3424 3.584 15.9744 5.632l-3.072 7.7824z m201.9328-2.048l-1.024-8.2944 16.9984-1.536 1.024 8.2944-16.9984 1.536z m34.0992-3.1744l-1.024-8.8064 16.9984-1.536 0.512 8.2944c-5.12 1.024-10.752 1.536-16.4864 2.048z m426.1888-0.512c-5.7344-1.024-10.8544-1.536-16.9984-2.048l1.024-8.2944c5.7344 0.512 11.3664 1.536 17.1008 2.048l-1.1264 8.2944zM499.6096 420.864l-0.512-8.2944c5.7344-0.512 11.3664-1.024 16.9984-1.024l0.512 8.2944c-5.632 0.512-11.264 1.024-16.9984 1.024z m358.5024-1.536l-16.9984-1.536 0.512-8.2944 16.9984 1.536-0.512 8.2944z m-324.4032-0.512l-0.512-8.2944c5.632-0.512 11.3664-0.512 16.9984-1.024l0.512 8.2944c-5.632 0-11.264 0.512-16.9984 1.024z m-336.7936-1.536c-5.632-2.56-10.8544-4.608-15.9744-6.7584l3.072-7.7824c5.12 2.048 10.3424 4.096 15.4624 6.7584l-2.56 7.7824z m370.8928-0.512l-0.512-8.2944c5.7344-0.512 11.3664-0.512 17.1008-1.024l0.512 8.2944c-5.7344 0.512-11.3664 0.512-17.1008 1.024z m256.2048-0.512c-5.7344-0.512-11.3664-0.512-17.1008-1.024l0.512-8.2944c5.7344 0.512 11.3664 0.512 16.9984 1.024l-0.4096 8.2944zM601.9072 414.72l-0.512-8.2944c5.632 0 11.3664-0.512 16.9984-0.512l0.512 8.2944c-5.632 0.512-11.264 0.512-16.9984 0.512z m188.0064-0.6144c-5.632 0-11.3664-0.512-16.9984-0.512l0.512-8.2944c5.632 0 11.3664 0.512 16.9984 0.512l-0.512 8.2944z m-153.9072-0.512v-8.2944c5.7344 0 11.3664-0.512 17.1008-0.512v8.2944c-5.7344 0-11.3664 0.512-17.1008 0.512z m119.808-0.512c-5.632 0-11.3664 0-16.9984-0.512v-8.2944c5.7344 0 11.3664 0 16.9984 0.512v8.2944z m-85.1968-0.512v-8.2944h16.9984v8.2944h-16.9984z m51.0976 0h-17.1008v-8.2944h17.1008v8.2944z m-556.3392-9.216c-5.12-2.56-10.8544-5.12-15.4624-7.7824l4.096-7.7824c4.608 2.56 9.8304 5.12 14.9504 7.7824l-3.584 7.7824z m-30.9248-16.0768c-5.12-3.072-10.3424-6.2464-14.4384-9.3184l5.12-6.7584c4.096 3.072 8.8064 6.2464 13.9264 9.3184l-4.608 6.7584zM105.984 366.592c-4.608-4.096-8.8064-8.8064-11.8784-12.9024l6.7584-5.12c3.072 4.096 6.7584 7.7824 10.8544 11.8784l-5.7344 6.144z m-20.1728-28.8768c-1.024-3.584-1.536-6.7584-1.536-10.3424 0-3.072 0.512-5.632 1.024-8.8064l8.2944 2.048c-0.512 2.048-0.512 4.096-0.512 6.7584 0 2.56 0.512 5.12 1.024 7.7824l-8.2944 2.56zM100.864 306.176l-7.2704-4.608c3.072-5.12 6.7584-9.8304 10.3424-14.4384l6.7584 5.12c-3.6864 5.12-7.2704 9.3184-9.8304 13.9264z m768.1024-16.4864c-5.632-0.512-11.3664-0.512-16.9984-1.024l0.512-8.2944c5.632 0.512 11.3664 1.024 16.9984 1.024l-0.512 8.2944z m-34.6112-2.6624l-17.1008-1.536 1.024-8.2944 16.9984 1.536-0.9216 8.2944z m-34.0992-4.096c-5.632-0.512-11.3664-1.536-16.9984-2.048l1.024-8.2944c5.632 0.512 11.3664 1.536 16.9984 2.048l-1.024 8.2944z m-678.7072-2.56l-6.2464-6.2464c4.096-4.096 8.2944-8.2944 12.9024-11.8784l5.12 6.7584c-4.096 4.096-8.192 7.7824-11.776 11.3664z m645.12-2.048c-5.632-1.024-11.3664-1.536-16.9984-2.56l1.024-8.2944c5.632 1.024 11.3664 1.536 16.9984 2.56l-1.024 8.2944z m-34.0992-4.7104l-17.1008-2.56 1.536-8.2944 16.9984 2.56-1.4336 8.2944z m-34.0992-5.632l-16.9984-2.56 1.536-8.2944 17.1008 2.56-1.6384 8.2944z m-33.4848-5.7344l-16.9984-3.072 1.536-8.2944 16.9984 3.072-1.536 8.2944z m-517.632-2.56l-4.608-7.2704c4.608-3.072 9.8304-6.2464 14.9504-8.8064l4.096 7.7824c-5.12 2.6624-9.8304 5.2224-14.4384 8.2944z m484.0448-3.072l-17.1008-3.072 1.536-8.2944 16.9984 3.072-1.4336 8.2944z m-34.0992-6.2464l-16.9984-3.072 1.536-8.2944 17.1008 3.072-1.6384 8.2944z m-33.5872-5.632l-16.9984-2.56 1.536-8.2944 16.9984 2.56-1.536 8.2944z m-386.9696-0.512l-3.072-7.7824c5.12-2.048 10.8544-4.096 15.9744-6.2464l2.56 8.2944c-5.12 1.536-10.24 3.6864-15.4624 5.7344z m352.8704-4.7104c-5.7344-1.024-11.3664-1.536-17.1008-2.56l1.024-8.2944c5.7344 1.024 11.3664 1.536 16.9984 2.56l-0.9216 8.2944z m-33.5872-5.12c-5.632-1.024-11.3664-1.536-16.9984-2.56l1.024-8.2944c5.7344 0.512 11.3664 1.536 17.1008 2.56l-1.1264 8.2944z m-287.232-1.024l-2.048-8.2944c5.632-1.536 11.3664-3.072 16.9984-4.096l1.536 8.2944c-5.632 1.024-11.264 2.56-16.4864 4.096z m253.6448-3.584c-5.632-0.512-11.3664-1.536-16.9984-2.048l1.024-8.2944c5.632 0.512 11.3664 1.536 16.9984 2.048l-1.024 8.2944z m-220.5696-3.6864l-1.536-8.2944c5.7344-1.024 11.3664-1.536 17.1008-2.56l1.024 8.2944c-5.7344 0.512-11.4688 1.536-16.5888 2.56z m186.4704 0l-17.1008-1.536 1.024-8.2944 16.9984 1.536-0.9216 8.2944z m-34.0992-3.072c-5.632-0.512-11.3664-1.024-16.9984-1.024l0.512-8.2944c5.632 0.512 11.3664 0.512 16.9984 1.024l-0.512 8.2944z m-118.784-1.024l-0.512-8.2944c5.632-0.512 11.3664-1.024 16.9984-1.024l0.512 8.2944c-6.144 0-11.8784 0.512-16.9984 1.024z m84.6848-1.024c-5.632 0-11.3664-0.512-16.9984-0.512v-8.2944c5.7344 0 11.3664 0.512 16.9984 0.512v8.2944z m-51.0976-1.024v-8.2944h16.9984v8.2944h-16.9984z m585.728 70.7584h-8.8064l0.512-8.2944h8.2944v8.2944z m0 0" fill="#CCE1FF" p-id="7539"></path><path d="M677.376 592.384l-324.4032 1.024c-3.072 0-6.2464-2.56-6.2464-6.2464v-7.7824c0-3.072 2.56-6.2464 6.2464-6.2464l324.4032-1.024c3.072 0 6.2464 2.56 6.2464 6.2464v7.7824c-0.6144 3.6864-3.1744 6.2464-6.2464 6.2464z m0 0" fill="#E6EFFF" p-id="7540"></path><path d="M863.8464 323.2768c-38.1952-42.9056-92.4672-99.7376-144.0768-160.6656l-287.232 1.024-2.048 39.7312 36.1472 25.2928-34.0992 8.2944 34.0992 30.0032-27.3408 4.608-21.1968 53.248-19.1488-25.2928-36.1472-19.1488 23.2448-27.8528-47.104-21.1968 30.0032-21.1968-25.2928-45.9776-124.5184 0.512c-23.2448 0-41.8816 19.1488-41.8816 42.3936l1.536 389.5296c0 23.2448 19.1488 41.8816 42.3936 41.8816l602.3168-1.536c23.2448 0 41.8816-19.1488 41.8816-42.3936l-1.536-271.2576z m0 0" fill="#FFFFFF" p-id="7541"></path><path d="M220.16 640.9216c-11.8784 0-23.2448-4.608-32.0512-13.4144-8.8064-8.8064-13.4144-20.1728-13.4144-32.0512l-1.536-389.5296c0-11.8784 4.608-23.2448 12.9024-32.0512 8.8064-8.8064 20.1728-13.4144 32.0512-13.4144l126.5664-0.512 27.8528 50.0736-27.8528 19.6608 45.4656 20.6848-23.7568 27.8528 33.5872 18.1248 15.9744 21.1968 19.6608-49.5616 22.7328-3.584-33.5872-29.4912 33.0752-8.2944-32.0512-22.7328 2.048-44.9536 291.84-1.024 1.024 1.024c34.0992 40.2432 69.2224 78.5408 100.2496 112.64 15.9744 16.9984 30.5152 33.0752 43.4176 47.5136l1.024 1.024v1.024l1.024 270.6432c0 24.7808-20.1728 45.4656-44.9536 45.4656L220.16 640.9216z m121.4464-474.2144l-122.9824 0.512c-10.3424 0-20.1728 4.096-27.3408 11.3664-7.2704 7.2704-11.3664 17.1008-11.3664 27.3408l1.536 389.5296c0 10.3424 4.096 20.1728 11.3664 27.3408 7.2704 7.2704 16.9984 11.3664 27.3408 11.3664l602.3168-1.536c21.7088 0 38.7072-17.6128 38.7072-39.2192l-1.024-269.1072c-12.9024-14.4384-27.3408-30.0032-42.3936-47.0016-31.0272-33.5872-65.6384-71.7824-99.7376-111.616l-282.5216 0.512-1.536 35.1232 40.2432 28.3648-35.1232 9.3184 34.6112 30.5152-32.5632 5.12-22.7328 56.832-22.1184-29.9008-39.2192-20.6848 23.2448-27.3408-48.0256-21.7088 32.0512-22.7328-22.7328-42.3936z m0 0" fill="#A2ADC2" p-id="7542"></path><path d="M860.672 318.0544c-1.024 7.7824-7.7824 12.9024-14.9504 12.3904l-137.9328-14.4384c-7.7824-1.024-12.9024-7.7824-12.3904-14.9504l11.3664-125.0304c1.024-7.7824 7.7824-12.9024 14.9504-12.3904l138.9568 154.4192z m0 0" fill="#FFEED4" p-id="7543"></path><path d="M847.2576 333.6192h-1.536l-137.9328-13.9264c-4.608-0.512-8.2944-2.56-11.3664-6.2464-2.56-3.584-4.096-7.7824-3.584-12.3904l11.3664-125.0304c1.024-9.3184 9.3184-15.9744 18.6368-14.9504h1.024l1.024 1.024 139.4688 154.9312v1.536c-1.024 8.8064-8.8064 15.0528-17.1008 15.0528zM720.6912 167.2192c-5.12 0-9.8304 4.096-10.3424 9.3184l-11.3664 125.0304c-0.512 2.56 0.512 5.7344 2.048 7.7824s4.096 3.584 7.2704 3.584l137.9328 14.4384c2.56 0.512 5.7344-0.512 7.7824-2.048s3.072-3.584 3.584-5.7344L720.6912 167.2192z m0 0" fill="#A2ADC2" p-id="7544"></path><path d="M828.7232 864.0512h-629.76c-15.4624 0-28.3648-12.9024-28.3648-28.3648l-42.3936-271.6672c0-15.4624 12.9024-28.3648 28.3648-28.3648h720.0768c15.4624 0 28.3648 12.9024 28.3648 28.3648L857.088 835.6864c-0.512 15.4624-12.9024 28.3648-28.3648 28.3648z m0 0" fill="#FFEED4" p-id="7545"></path><path d="M828.7232 867.2256h-629.76c-17.6128 0-31.5392-13.9264-31.5392-31.5392l-42.3936-271.1552c0-18.1248 13.9264-32.0512 31.5392-32.0512h720.0768c17.5104 0 31.5392 13.9264 31.5392 31.5392L860.16 836.1984c0 16.9984-14.4384 31.0272-31.4368 31.0272zM156.672 538.624c-13.9264 0-25.2928 11.3664-25.2928 25.2928l42.3936 271.1552c0 14.4384 11.3664 25.8048 25.2928 25.8048h629.1456c13.9264 0 25.2928-11.3664 25.2928-25.2928l48.0256-272.2816c0-13.4144-11.3664-24.7808-25.2928-24.7808H156.672z m0 0" fill="#A2ADC2" p-id="7546"></path><path d="M411.3408 671.9488c0 3.584 1.536 7.7824 4.096 10.3424s6.7584 4.096 10.3424 4.096 7.7824-1.536 10.3424-4.096 4.096-6.7584 4.096-10.3424-1.536-7.7824-4.096-10.3424-6.7584-4.096-10.3424-4.096-7.7824 1.536-10.3424 4.096c-2.56 3.072-4.096 6.656-4.096 10.3424z m170.9056 0c0 3.584 1.536 7.7824 4.096 10.3424s6.7584 4.096 10.3424 4.096 7.7824-1.536 10.3424-4.096 4.096-6.7584 4.096-10.3424-1.536-7.7824-4.096-10.3424-6.7584-4.096-10.3424-4.096-7.7824 1.536-10.3424 4.096c-2.4576 3.072-4.096 6.656-4.096 10.3424z m0 0M561.152 757.6576c5.12 0 9.3184-3.072 8.2944-6.7584-4.608-18.1248-27.8528-32.0512-55.808-32.0512-27.8528 0-51.0976 13.9264-55.808 32.0512-1.024 3.584 3.072 6.7584 8.2944 6.7584 4.096 0 7.7824-2.048 8.2944-4.608 3.072-12.9024 19.6608-22.2208 39.2192-22.2208 19.6608 0 35.6352 9.8304 39.2192 22.2208 0.512 2.56 4.096 4.608 8.2944 4.608z m0 0" fill="#A2ADC2" p-id="7547"></path><path d="M33.1776 498.8928c0 71.8848 58.2656 130.1504 130.1504 130.1504 71.8848 0 130.1504-58.2656 130.1504-130.1504s-58.2656-130.1504-130.1504-130.1504c-71.8848 0-130.1504 58.2656-130.1504 130.1504z m0 0" fill="#FFFFFF" p-id="7548"></path><path d="M163.328 632.1152c-73.3184 0-133.3248-59.904-133.3248-133.3248S90.0096 365.568 163.328 365.568s133.3248 59.904 133.3248 133.3248-60.0064 133.2224-133.3248 133.2224z m0-260.3008c-69.7344 0-127.0784 56.832-127.0784 127.0784 0 69.7344 56.832 127.0784 127.0784 127.0784s127.0784-56.832 127.0784-127.0784c0-69.7344-56.832-127.0784-127.0784-127.0784z m0 0" fill="#A2ADC2" p-id="7549"></path><path d="M173.6704 572.2112c-2.56 2.56-6.2464 4.608-9.8304 4.608s-7.2704-1.536-9.8304-4.096-4.096-6.7584-4.096-10.3424 1.536-7.7824 4.096-10.3424 6.2464-4.608 9.8304-4.608 7.2704 1.536 9.8304 4.096 4.096 6.7584 4.096 10.3424-1.536 7.7824-4.096 10.3424z m5.2224-116.736l-6.2464 71.7824c0 5.7344-4.608 9.8304-9.8304 9.8304-5.12 0-9.8304-4.096-10.3424-9.8304l-9.3184-71.7824c-0.512-1.536-0.512-2.56-0.512-4.096 0-10.3424 7.7824-19.1488 18.1248-19.1488s18.6368 8.2944 18.6368 18.6368c0 2.048-0.512 3.584-0.512 4.608z m0 0M643.7888 601.1904c-2.56 0-4.608 2.048-4.608 4.096v32.5632c0 2.56 2.048 4.096 4.608 4.096s4.608-2.048 4.608-4.096v-32.5632c0-2.048-2.048-4.096-4.608-4.096z m19.0464 0c-2.56 0-4.608 2.048-4.608 4.096v32.5632c0 2.56 2.048 4.096 4.608 4.096s4.608-2.048 4.608-4.096v-32.5632c0.1024-2.048-1.9456-4.096-4.608-4.096z m21.1968 0c-2.56 0-4.608 2.048-4.608 4.096v32.5632c0 2.56 2.048 4.096 4.608 4.096s4.608-2.048 4.608-4.096v-32.5632c0.1024-2.048-2.048-4.096-4.608-4.096z m0 0" fill="#A2ADC2" p-id="7550"></path></svg> ` }), retry ] }); return error; }, setCouponsHtml: function(root, modal) { const { outerDIV, shadowRoot } = root; const modalBody = modal.querySelector("div[name='modalBody']"); const self = this; const generateRequest = this.generateRequest(modalBody); const generateRequestLoadding = this.generateRequestLoadding(); const generateRequestLoaddingError = this.generateRequestLoaddingError(() => { generateRequest.remove(); this.setCouponsHtml(root, modal); }); generateRequest.append(generateRequestLoadding); RequestUnionUtil.getDetectCouponResult().then((dataJson) => { if (!dataJson) { generateRequestLoadding.remove(); generateRequest.append(generateRequestLoaddingError); return; } generateRequest.remove(); const { data, structure } = dataJson; if (structure.hasOwnProperty("css") && structure.hasOwnProperty("html")) { const { css, html } = structure; InspectUtil.addStyle(this._root.shadowRoot, "coupon-list", css); modalBody.innerHTML = html; [".discount-base", ".cgg-store-item", ".showmore-btn", "*[name='cgg02xClickToActivate']"].flatMap((selector) => Array.from(modalBody.querySelectorAll(selector))).forEach((button) => { const isActivateButton = button.matches("*[name='cgg02xClickToActivate']"); InspectUtil.bindCustomEvent(button, (option) => { if (isActivateButton) { InspectUtil.addActivateCallbackEvent(outerDIV, option); } }); }); const tabs = modalBody.querySelectorAll("a[data-toggle='tab']"); const tabPanes = modalBody.querySelectorAll(".tab-pane"); tabs.forEach((element) => { element.addEventListener("click", function(e) { e.preventDefault(); e.stopPropagation(); tabs.forEach((tab) => tab.classList.remove("active")); e.target.classList.add("active"); tabPanes.forEach((tab) => tab.classList.remove("fade-in", "active")); const toggle = modalBody.querySelector(e.target.getAttribute("data-href") || e.target.getAttribute("href")); toggle.classList.add("fade-in", "active"); }); }); const items = modalBody.querySelectorAll(".cgg-store-item"); items.forEach((item) => { item.addEventListener("mouseenter", (e) => { e.target.querySelector("span").classList.add("underline-show"); }); item.addEventListener("mouseleave", (e) => { e.target.querySelector("span").classList.remove("underline-show"); }); }); const activateButton = modalBody.querySelector("*[name='activateButton']"); self.addApplyCouponsEventListener(activateButton, modal); } }).catch((error) => { generateRequestLoadding.remove(); generateRequest.append(generateRequestLoaddingError); }); }, showAllComponents: function() { var _a; const outerDIV = (_a = this._root) == null ? void 0 : _a.outerDIV; if (outerDIV) { outerDIV.querySelector(".widget").style.display = "block"; } GoodsHistory.show(); }, hideAllComponents: function() { var _a; const outerDIV = (_a = this._root) == null ? void 0 : _a.outerDIV; if (outerDIV) { outerDIV.querySelector(".widget").style.display = "none"; } GoodsHistory.hide(); }, generate: function(logoBase642, root, title, modalPosition, platform) { if (this._hasModal) { return; } const { outerDIV, shadowRoot } = root; this._root = root; this._logoBase64 = logoBase642; const contentHtml = ` <div class="modal-header"> <div class="logo"> <img src="` + logoBase642 + `" /> </div> <div class="title">` + title + `</div> <div class="btns"> <div class="setting">` + settingSVG + `</div> <div class="setting-dropdown" id="settingsDropdown"></div> <div class="close">` + closeSVG + `</div> </div> </div> <div class="modal-body" name="modalBody"> </div> `; let modelCss = Object.entries(modalPosition).map(([key, value]) => `${key.replace("_", "-")}:${value}`).join(";"); const modal = ElementUtil.createElement("div", { className: "coupon-list-widget-conent", html: contentHtml, attributes: { "style": modelCss } }); outerDIV.append(modal); this._hasModal = true; const close = modal.querySelector(".modal-header .btns> .close"); this.addCloseEventListener(close, modal); this.addShowSettingEventListener(platform, modal); this.setCouponsHtml(root, modal); return modal; } }; var __async$3 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const InspectCouponsHTML = { root: null, models: { flyout: "flyout-model", detect: "detect-model" }, getStyle: function() { const css = css_248z$3 + css_248z$5 + css_248z$4; return css.replace(/@logo@/g, logoBase64); }, showFlyOut: function(root, flyout, platform, logoBase642) { const { outerDIV, shadowRoot } = root; if (!!flyout && !!flyout.html && !!flyout.css && !!flyout.conf) { const { html, css, conf } = flyout; InspectUtil.addStyle(shadowRoot, this.models.flyout, css); outerDIV.insertAdjacentHTML("beforeend", html); const cggfCloseFlyout = () => { const flyoutEl = outerDIV.querySelector("[name='" + flyout.conf.name + "']"); if (flyoutEl) { flyoutEl.classList.add(flyout.conf.close_animation); flyoutEl.addEventListener("animationend", () => flyoutEl.remove(), { once: true }); } }; if (flyout.conf.delay > 0) { setTimeout(cggfCloseFlyout, flyout.conf.delay); } const closeButton = outerDIV.querySelector(flyout.conf.close_button); if (closeButton) { closeButton.addEventListener("click", cggfCloseFlyout); } InspectUtil.bindCustomEvent(outerDIV.querySelector("*[name='cgg02xClickToActivate']"), (option) => { if (!option) { return; } if (option.hasOwnProperty("dismissAfter") && option.dismissAfter) { cggfCloseFlyout(); } if (option.hasOwnProperty("callbackEvent")) { InspectUtil.addActivateCallbackEvent(outerDIV, option); } }); InspectUtil.bindApplyCouponsEvent(outerDIV.querySelector("*[name='applyCouponButton']"), (dataJson) => { const { codes, check } = dataJson; ProgressModal.generate( logoBase642, root, platform, codes, check ); }); } }, start: function() { return __async$3(this, null, function* () { var _a; const support = SupportData.support; const platform = support.p; const windowShow = yield FeatureControl.isEnabled(StorageKeys.featureControl.windowShow + "_" + platform); let infoJson = null; try { infoJson = yield RequestUnionUtil.getDetectInfoResult(); } catch (e) { } if (!infoJson) return; const couponTotal = infoJson["coupon_total"]; const modalPosition = infoJson["modal"]; const historyShow = infoJson["history_show"]; const iconJson = infoJson["icon"]; const badgeData = iconJson["badge"]; const dragData = iconJson["drag"]; const interfaceData = iconJson["interface"]; const cggJson = infoJson["cgg"]; const autoOpen = cggJson["auto_open"]; const modalTitle = cggJson["current_platform"]; const logoBase64$1 = !!cggJson["logo"] ? cggJson["logo"] : logoBase64; const moveToEnd = cggJson["move_to_end"]; const observerTime = (_a = cggJson["observer_time"]) != null ? _a : 20 * 1e3; const flyout = infoJson["flyout"]; if (historyShow) { GoodsHistory.start(support); if (!windowShow) { GoodsHistory.hide(); } } if (!infoJson["show"]) { return; } const selectedLanguage = LangueUtil.getSelectedLanguage(); const style = this.getStyle(); const root = InspectUtil.generateShadowDomRoot( platform + "-" + this.models.detect, style, selectedLanguage.dir, moveToEnd, observerTime ); const { outerDIV } = root; this.root = root; outerDIV.setAttribute("data-re-mark-tag", platform); const { widget, logo } = Activate.generate(couponTotal, badgeData, dragData, interfaceData, platform); outerDIV.append(widget); if (windowShow) { if (autoOpen) { CouponListModal.generate(logoBase64$1, root, modalTitle, modalPosition, platform); } } else { widget.style.display = "none"; } logo.addEventListener("click", (e) => { CouponListModal.generate(logoBase64$1, root, modalTitle, modalPosition, platform); }); setTimeout(() => { this.showFlyOut(root, flyout, platform, logoBase64$1); outerDIV.setAttribute("status", "complete"); }, 100); }); } }; var __async$2 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const SearchEnginScreen = { blockAttributeKey: "jscan-slo-u8", uniqueMarkAttributeKey: "jvtxi-uid-t8", loopIsComplete: true, UUIDGenerator: function() { let counter = 0; const seed = Math.floor(Math.random() * 1e6).toString(36); return function getUUID() { const prefix = Date.now().toString(36); return `${seed}${prefix}${(counter++).toString(36)}`; }; }(), getLinkByElement: function(element, findTag) { let searchElement = null; if (findTag == "this") { searchElement = element; } else if (/^child@/.test(findTag)) { searchElement = element.querySelector(findTag.replace(/^child@/, "")); } return searchElement; }, pickupSelectors: function(confJson, platform) { const list = new Array(); for (let i = 0; i < confJson.length; i++) { const itemJson = confJson[i]; if (!itemJson.hasOwnProperty("elements") || !itemJson.hasOwnProperty("matches")) { continue; } const { elements, matches } = itemJson; const isMatch = matches.map((reg) => new RegExp(reg.replace(/\\\\/g, "\\"), "i").test(window.location.href)).some((res) => res); if (isMatch) { for (let j = 0; j < elements.length; j++) { list.push({ "selector": elements[j]["element"], "findA": elements[j]["findA"] }); } } } return list; }, queryElements: function(selectors, platform) { return __async$2(this, null, function* () { const items = []; try { selectors.forEach((selectorObj) => { if (selectorObj.selector) { const elements = document.querySelectorAll(selectorObj.selector + ":not([" + this.blockAttributeKey + "='true'])"); Logger.log("info", "search items======>", elements); const findA = selectorObj.findA; elements.forEach((element) => { if (element && !element.getAttribute(this.blockAttributeKey) && !element.querySelector("[" + this.blockAttributeKey + "]")) { const linkElement = this.getLinkByElement(element, findA); const handler = this.UUIDGenerator(); element.setAttribute(this.uniqueMarkAttributeKey, handler); element.setAttribute(this.blockAttributeKey, "true"); if (linkElement) { let link = linkElement.getAttribute("href") || linkElement.textContent; if (link) { link = link.replace(/\s+/g, ""); } if (link && link.indexOf("http") != -1) { items.push({ "handler": handler, "link": link, "platform": platform, "element": element }); } } } }); } }); if (items.length > 0) { yield this.search(items, platform); } } catch (e) { } }); }, search: function(items, platform) { return __async$2(this, null, function* () { const lists = []; items.forEach((item) => { lists.push({ "handler": item.handler, "url": item.link }); }); const dataJson = yield RequestUnionUtil.getEngineScreenResult(lists, platform); if (dataJson && dataJson.list) { const { list } = dataJson; this.createHtml(items, list, platform); } }); }, createHtml: function(items, list, platform) { for (let i = 0; i < list.length; i++) { const { handler, content } = list[i]; const item = items.find((obj) => obj.handler === handler); if (!item) { continue; } if (item.hasOwnProperty("handler") && item.hasOwnProperty("element")) { item.handler; let element = item.element; if (content) { element.insertAdjacentHTML("afterbegin", content); } } } document.querySelectorAll("*[name='se-rebate-343234xy-funx']").forEach((element) => { InspectUtil.bindCustomEvent(element); }); }, srart: function(platform) { return __async$2(this, null, function* () { const confDataJson = yield RequestUnionUtil.getEngineScreenConf(); if (!confDataJson) { return; } const confJson = confDataJson[platform]; const runSearch = () => { if (this.loopIsComplete) { this.loopIsComplete = false; const selectors = this.pickupSelectors(confJson, platform); this.queryElements(selectors, platform).then(() => { this.loopIsComplete = true; }); } }; runSearch(); setInterval(() => { runSearch(); }, 1500); }); } }; const MidListener = { start: function() { if ((window.location.host !== "www.jtmate.com" || window.location.href.indexOf("www.jtmate.com/mid/merge") == -1) && !ScriptConst.isDev) { return; } const autoRedirect = document.querySelector(".auto-redirect"); if (autoRedirect) { const dataContent = autoRedirect.getAttribute("data-content"); if (dataContent) { const json = JSON.parse(dataContent); InspectUtil.customOpenUrl(null, json); } } } }; const GoodsRecord = { start: function() { const href = window.location.href; const support = SupportData.support; if (support.record.disabled) { return; } const { title, price, cover } = support.record.elements; if (!support.detail.test(href)) { return; } const id = Tools.getGoodsIdByLink(href); if (title && price && cover) { Promise.all([ Tools.waitForElementByInterval(price, document.body, false), Tools.waitForElementByInterval(cover, document.body, true) ]).then((elements) => { const priceElement = elements[0]; const coverElement = elements[1]; const titleElement = document.querySelector(title); if (coverElement && priceElement) { var imgSrc = ""; if (coverElement.tagName == "IMG") { imgSrc = coverElement.getAttribute("data-src") || coverElement.getAttribute("data-url") || coverElement.getAttribute("src"); } else if (coverElement.tagName == "SOURCE") { imgSrc = coverElement.getAttribute("srcSet") || coverElement.getAttribute("src"); } const price2 = priceElement ? priceElement.innerText : "Unknown"; const title2 = titleElement ? titleElement.innerText : "--"; const goods = { "id": id, "url": href, "pic": imgSrc, "date": new Date().getTime(), "price": price2, "title": title2 }; GoodsHistory.push(support.p, goods); } }).catch(() => { }); } } }; var __defProp = Object.defineProperty; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; const supportModules = { InspectCouponsHTML, SearchEnginScreen, MidListener, GoodsRecord }; const AllModules = __spreadValues(__spreadValues({}, PlatformModules), supportModules); var __async$1 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const SupportsHelper = { defaultSupportsString: ` { "jtmMid":{ "p":"jtmMid", "match": "www\\\\.jtmate\\\\.com\\\\/mid", "record":{ "disabled":true }, "disabled":false }, "aliexpress": { "p": "aliexpress", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?aliexpress\\\\.[a-z]{2,}(\\\\.[a-z]{2,})*(\\\\/.*)?", "detail": "\\\\/item\\\\/[^.\\\\/]+\\\\.html", "trade": ["\\\\/trade\\\\/confirm\\\\.html", "\\\\/checkout\\\\?"], "record":{ "elements":{ "title":"h1[data-pl='product-title'], h1[class*='HazeProductDescription_HazeProductDescription__smallText_']", "price":"span.product-price-value, div[class*='currentPriceText'], div[class*='HazeProductPrice_SnowPrice__container']>div", "cover":"div[class*='slider--img'] >img, div[class*='__previewItem__'] picture[class*='Picture__container']>source" }, "disabled":false }, "disabled":false }, "lazada":{ "p": "lazada", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?lazada\\\\.[\\\\w.-]+([/?#].*)?$", "detail": "\\\\/products\\\\/.*-i\\\\d+.*\\\\.html", "trade":[], "record":{ "elements":{ "title":"h1[class*='pdp-mod-product-badge-title']", "price":"div[class*='product-current-price-container'],div[class*='product-price-content-salePrice'],.pdp-product-price", "cover":"div[class*='gallery-preview-panel'] >img:last-child, .gallery-preview-panel__content >img:last-child" }, "disabled":false }, "disabled":false }, "banggood":{ "p": "banggood", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?banggood\\\\.[\\\\w.-]+([/?#].*)?$", "detail":"\\\\/.*-p-\\\\d+\\\\.html", "trade":[], "record":{ "elements":{ "title":".product-title-text", "price":".newbie-price", "cover":"a.p-img >img" }, "disabled":false }, "disabled":false }, "ebay": { "p": "ebay", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?ebay\\\\.[\\\\w.-]+([/?#].*)?$", "detail":"\\\\/itm\\\\/\\\\d+", "trade":[], "record":{ "elements":{ "title":".x-item-title__mainTitle", "price":".x-price-primary >span", "cover":".ux-image-grid-item >img, .ux-image-carousel-item >img" }, "disabled":false }, "disabled":false }, "bestbuy": { "p": "bestbuy", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?bestbuy\\\\.[\\\\w.-]+([/?#].*)?$", "detail":"\\\\/site\\\\/.*\\\\/\\\\d+\\\\.p", "trade":[], "record":{ "elements":{ "title":".sm:text-title-sm", "price":"*[class*='_price_']", "cover":"*[class*='displayingImage'] img" }, "disabled":true }, "disabled":false }, "shopee": { "p": "shopee", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?shopee\\\\.[\\\\w.-]+([/?#].*)?$", "record":{ "disabled":true }, "disabled":false }, "wish": { "p": "wish", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?wish\\\\.[\\\\w.-]+([/?#].*)?$", "record":{ "disabled":true }, "disabled":false }, "amazon": { "p": "amazon", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?amazon\\\\.[\\\\w.-]+([/?#].*)?$", "record":{ "disabled":true }, "disabled":false }, "abritel": { "p": "abritel", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?abritel\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "adidas": { "p": "adidas", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?adidas\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "advertiser": { "p": "advertiser", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?advertiser\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "agoda": { "p": "agoda", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?agoda\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "bookabach": { "p": "bookabach", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?bookabach\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "booking": { "p": "booking", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?booking\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "etsy": { "p": "etsy", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?etsy\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "fewodirekt": { "p": "fewodirekt", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?fewo-direkt\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "hotels": { "p": "hotels", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?hotels\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "hoteis": { "p": "hoteis", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?hoteis\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "hoteles": { "p": "hoteles", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?hoteles\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "magazineluiza": { "p": "magazineluiza", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?magazineluiza\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "meesho": { "p": "meesho", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?meesho\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "mercadolibre": { "p": "mercadolibre", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?mercadolibre\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "namshi": { "p": "namshi", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?namshi\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "nike": { "p": "nike", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?nike\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "sivvi": { "p": "sivvi", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?sivvi\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "skyscanner": { "p": "skyscanner", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?skyscanner\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "stayz": { "p": "stayz", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?stayz\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "target": { "p": "target", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?target\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "tripadvisor": { "p": "tripadvisor", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?tripadvisor\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "vrbo": { "p": "vrbo", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?vrbo\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "wayfair": { "p": "wayfair", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?wayfair\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "wotif": { "p": "wotif", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?wotif\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "airbaltic": { "p": "airbaltic", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?airbaltic\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "alibaba": { "p": "alibaba", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?alibaba\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "allegro": { "p": "allegro", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?allegro\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "daraz": { "p": "daraz", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?daraz\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "edureka": { "p": "edureka", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?edureka\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "expedia": { "p": "expedia", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?expedia\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "noon": { "p": "noon", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?noon\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "ozon": { "p": "ozon", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?ozon\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "pictarine": { "p": "pictarine", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?pictarine\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "rakuten": { "p": "rakuten", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?rakuten\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "ranavat": { "p": "ranavat", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?ranavat\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "samsung": { "p": "samsung", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?samsung\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "shein": { "p": "shein", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?shein\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "suiteness": { "p": "suiteness", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?suiteness\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "temu": { "p": "temu", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?temu\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "ticketmaster": { "p": "ticketmaster", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?ticketmaster\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "treatwell": { "p": "treatwell", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?treatwell\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "trip": { "p": "trip", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?trip\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "walmart": { "p": "walmart", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?walmart\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "wildberries": { "p": "wildberries", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?wildberries\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "wilson": { "p": "wilson", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?wilson\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "wilsonsleather": { "p": "wilsonsleather", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?wilsonsleather\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "zalando": { "p": "zalando", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?zalando\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "ajio": { "p": "ajio", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?ajio\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "flipkart": { "p": "flipkart", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?flipkart\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "myntra": { "p": "myntra", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?myntra\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "cex": { "p": "cex", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?cex\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "changelly": { "p": "changelly", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?changelly\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "kucoin": { "p": "kucoin", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?kucoin\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "paxful": { "p": "paxful", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?paxful\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "htx": { "p": "htx", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?htx\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "mexc": { "p": "mexc", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?mexc\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "bybit": { "p": "bybit", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?bybit\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "gate": { "p": "gate", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?gate\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "coinmama": { "p": "coinmama", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?coinmama\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "gate": { "p": "gate", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?gate\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "bitget": { "p": "bitget", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?bitget\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "freebitco": { "p": "freebitco", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?freebitco\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "bybit": { "p": "bybit", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?bybit\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "crypto": { "p": "crypto", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?crypto\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "okx": { "p": "okx", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?okx\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "coinbase": { "p": "coinbase", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?coinbase\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "binance": { "p": "binance", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?binance\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "wazirx": { "p": "wazirx", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?wazirx\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "coindcx": { "p": "coindcx", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?coindcx\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "zebpay": { "p": "zebpay", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?zebpay\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "bitbns": { "p": "bitbns", "match": "^https:\\\\/\\\\/([\\\\w-]+\\\\.)?bitbns\\\\.[\\\\w.-]+([/?#].*)?$", "record": { "disabled": true }, "disabled": false }, "google":{ "p": "google", "match": "^https?:\\\\/\\\\/(www\\\\.)?google\\\\.[a-z]{2,3}(\\\\.[a-z]{2})?\\\\/search\\\\?", "record": { "disabled": true }, "disabled": false }, "bing":{ "p": "bing", "match": "^https?:\\\\/\\\\/(?:www|cn)?\\\\.?bing\\\\.com\\\\/search\\\\?.*", "record": { "disabled": true }, "disabled": false } } `, getSupportsByServer: function() { return __async$1(this, null, function* () { const { method, url } = getRequestUrl()["supports"]; const finalUrl = url + "&v=" + ScriptConst.version + "&no=" + ScriptConst.number + "&url=" + encodeURIComponent(window.location.href); const serverData = yield Tools.request(method, finalUrl, null); let supportsString = null; if (serverData && serverData.code === "success") { supportsString = serverData.result; if (supportsString) { supportsString = supportsString.replace(/\\\\/g, "\\"); } } return supportsString; }); }, analysisSupports: function() { return __async$1(this, null, function* () { let supportObj = StorageUtil.getValue(StorageKeys.supports, ""); try { if (!supportObj || typeof supportObj !== "object" || !supportObj.time || new Date().getTime() - supportObj.time > DefaultValue.updateSupportsDelay) { const serverSupports = yield this.getSupportsByServer(); supportObj = { time: new Date().getTime(), supports: serverSupports }; if (serverSupports) { StorageUtil.setValue(StorageKeys.supports, supportObj); } } else { } } catch (e) { supportObj = { time: new Date().getTime(), supports: this.defaultSupportsString }; } let supportsString = supportObj.supports; if (!supportsString) { supportsString = this.defaultSupportsString; } let supportsJson = null; try { supportsJson = JSON.parse(supportsString); } catch (e) { StorageUtil.setValue(StorageKeys.supports, ""); supportsJson = JSON.parse(this.defaultSupportsString); } return supportsJson; }); }, getSupport: function() { return __async$1(this, null, function* () { const currentUrl = window.location.href; const supports = yield this.analysisSupports(); let support = null; for (let key in supports) { const { match, disabled } = supports[key]; const matchReg = new RegExp(match); if (matchReg.test(currentUrl) && !disabled) { support = supports[key]; support.match = matchReg; if (support.detail) { support.detail = new RegExp(support.detail); } if (support.trade) { support.trade = support.trade.map((pattern) => new RegExp(pattern)); } break; } } return { support, supports }; }); } }; var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; const Init = { aliexpress: function() { AllModules.Aliexpress.Aliexpress.start(); AllModules.Aliexpress.AliexpressSearch.start(); }, ebay: function() { AllModules.Ebay.Ebay.start(); AllModules.Ebay.EbaySearch.start(); }, lazada: function() { AllModules.Lazada.Lazada.start(); AllModules.Lazada.LazadaSearch.start(); }, bestbuy: function() { AllModules.Bestbuy.Bestbuy.start(); AllModules.Bestbuy.BestbuySearch.start(); }, banggood: function() { AllModules.Banggood.Banggood.start(); AllModules.Banggood.BanggoodSearch.start(); }, unknown: function() { }, start: function() { return __async(this, null, function* () { const { support, supports } = yield SupportsHelper.getSupport(); SupportData.supports = supports; SupportData.support = support; if (!support) { return; } const disabled = support.disabled, platform = support.p; if (disabled) { return; } yield RequestUnionUtil.initRequestData(); yield LangueUtil.initLangueDataMap(); if (platform === "bing" || platform === "google") { AllModules.SearchEnginScreen.srart(platform); } else { StyleUtil.init(); try { if (typeof this[platform] === "function") { this[platform](); } else { } } catch (e) { } AllModules.InspectCouponsHTML.start(); AllModules.MidListener.start(); AllModules.GoodsRecord.start(); } }); } }; Init.start(); })(); } catch (e) { } } }, 100); }))(); ((function() { const OverseaNavigation = { number: Math.ceil(Math.random() * 1e8), containerHight: 150, GMopenInTab: function(url, options = { "active": true, "insert": true, "setParent": true }) { if (typeof GM_openInTab === "function") { GM_openInTab(url, options); } else { GM.openInTab(url, options); } }, addStyle: function(css) { GM_addStyle(css); }, request: function(mothed, url, param) { return new Promise(function(resolve, reject) { GM_xmlhttpRequest({ url, method: mothed, data: param, onload: function(response) { var status = response.status; if (status == 200 || status == "200") { var responseText = response.responseText; resolve({ "result": "success", "responseText": responseText }); } else { reject({ "result": "error", "responseText": null }); } } }); }); }, isRun: function(origin) { const host = window.location.host; const serverRegexs = [/cloudways\.com/, /getresponse\.com/, /bandwagonhost\.com/, /moosend\.com/, /domainracer\.com/, /namesilo\.com/, /digitalocean\.com/, /virmach\.com/, /vultr\.com/]; const encryptoRegexs = [ /changelly\.com/, /bybit\.com/, /gate\.io/, /kucoin\.com/, /coinmama\.com/, /cex\.io/, /paxful\.com/, /htx\.com/, /mexc\.com/, /bitget\.com/, /freebitco\.in/, /crypto\.com/, /okx.com/, /coinbase\.com/, /binance\.com/, /wazirx\.com/, /coindcx\.com/, /zebpay\.com/, /bitbns\.com/ ]; let isRunServer = serverRegexs.some((regex) => regex.test(host)); let isRunEncrypto = false; if (!isRunServer) { isRunEncrypto = encryptoRegexs.some((regex) => regex.test(host)); } return { "isRunServer": isRunServer, "isRunEncrypto": isRunEncrypto }; }, addParamToURL: function(url, track) { const [baseUrl, hash] = url.split("#"); const separator = baseUrl.includes("?") ? "&" : "?"; const newUrl = `${baseUrl}${separator}${track}`; return hash ? `${newUrl}#${hash}` : newUrl; }, temporary: function(platform) { const anchorRun = () => { document.querySelectorAll('a:not([anchor="true"])').forEach((element, index) => { var href = element.getAttribute("href"); element.setAttribute("anchor", "true"); element.setAttribute("anchor-url", href); if (href && href.indexOf("javascript:") == -1 && href.indexOf(platform.track) == -1) { element.setAttribute("rel", "noreferrer nofollow"); href = this.addParamToURL(href, platform.track); element.setAttribute("href", href); element.setAttribute("anchor-i-url", href); } }); }; anchorRun(); setInterval(function() { anchorRun(); }, 1e3); }, addEventListener: function(origin) { const self = this; const href = window.location.href; var url = "https://oversea.mimixiaoke.com/api/discover/" + origin; self.request("post", url, JSON.stringify({ "no": 12 })).then((data) => { if (data.result == "success" && !!data.responseText) { const { platforms } = JSON.parse(data.responseText).data; let platform = null; for (let i = 0; i < platforms.length; i++) { if (new RegExp(platforms[i].match.replace(/\\\\/g, "\\"), "i").test(href)) { platform = platforms[i]; break; } } if (platform) { const storageKey = "__anchor__" + window.location.host; if (platform.support_append || !!sessionStorage.getItem(storageKey)) { self.temporary(platform); } else { const pathname = window.location.pathname; const targets = platform.targets; if (targets) { for (let i = 0; i < targets.length; i++) { if (new RegExp(targets[i].match.replace(/\\\\/g, "\\"), "i").test(pathname)) { sessionStorage.setItem(storageKey, "true"); window.location.href = platform.promo_link; break; } } } } } } }).catch((error) => { }); }, start: function() { const { isRunServer, isRunEncrypto } = this.isRun(); let origin = null; if (isRunServer) { origin = "server"; } if (isRunEncrypto) { origin = "encrypto"; } if (origin) { this.addEventListener(origin); } } }; const interval = setInterval(function() { if (document.body) { clearInterval(interval); OverseaNavigation.start(); } }, 100); }))(); const isYoutube = /youtube\.com/.test(window.location.host); if (isYoutube) { const { isOpenCommentTable, isOpenThemeProgressBar, isOpenSpeedControl, isOpenMarkOrRemoveAd } = StorageUtil.getValue(StorageUtil.keys.youtube.functionState, { isOpenCommentTable: true, isOpenThemeProgressBar: true, isOpenSpeedControl: true, isOpenMarkOrRemoveAd: true }); /*! * credit to Benjamin Philipp * MIT * original source: https://greasyfork.org/en/scripts/433051-trusted-types-helper */ const overwrite_default = false; const passThroughFunc = function(string, sink) { return string; }; var TTPName = "passthrough"; var TTP_default, TTP = { createHTML: passThroughFunc, createScript: passThroughFunc, createScriptURL: passThroughFunc }; var needsTrustedHTML = false; !window.TTP && (() => { try { if (typeof window.isSecureContext !== "undefined" && window.isSecureContext) { if (window.trustedTypes && window.trustedTypes.createPolicy) { needsTrustedHTML = true; if (trustedTypes.defaultPolicy) { if (overwrite_default) ; else { TTP = window.trustedTypes.createPolicy(TTPName, TTP); } TTP_default = trustedTypes.defaultPolicy; } else { TTP_default = TTP = window.trustedTypes.createPolicy( "default", TTP ); } } } } catch (e) { } finally { window.TTP = TTP; } })(); const createHTML = (s) => { if (typeof TTP !== "undefined" && typeof TTP.createHTML === "function") return TTP.createHTML(s); return s; }; (async () => { if (!isOpenCommentTable) { return; } const communicationKey = `ck-${Date.now()}-${Math.floor(Math.random() * 314159265359 + 314159265359).toString(36)}`; const Promise = (async () => { })().constructor; if (!document.documentElement) { await Promise.resolve(0); while (!document.documentElement) { await new Promise((resolve) => nextBrowserTick(resolve)).then().catch(console.warn); } } const sourceURL = "debug://tabview-youtube/tabview.execution.js"; const textContent = `(${executionScript})("${communicationKey}");${"\n\n"}//# sourceURL=${sourceURL}${"\n"}`; let button = document.createElement("button"); button.setAttribute("onclick", createHTML(textContent)); button.click(); button = null; let style = document.createElement("style"); const sourceURLMainCSS = "debug://tabview-youtube/tabview.main.css"; style.textContent = `${styles["main"].trim()}${"\n\n"}/*# sourceURL=${sourceURLMainCSS} */${"\n"}`; document.documentElement.appendChild(style); })(); (async () => { if (isOpenThemeProgressBar) { ThemeProgressbar.start(); } await ToolBox.run(); if (isOpenSpeedControl) { await SpeedControl.run(); } if (isOpenMarkOrRemoveAd) { MarkOrRemoveAd.run(); } })(); } }());