Files
return-youtube-dislike/Extensions/combined/ryd.content-script.js
T
Dmitrii Selivanov 40fda6dd32 Advanced stats for patreon supporters (#1222)
* auth works

* Works after review.

* switched to auth flow

* all works well in chrome

* all works well in chrome and firefox

* translations harmonized

* translations harmonized

* website translations

* Translations harmonized.

* Everything kinda works

* Almost works

* all works

* all works

* all works #2

* Streamline premium analytics range handling

* Restore premium analytics selection flow

* Fix analytics zoom interactions

* Add per-section expansion controls to premium analytics

* Adjust map legend visibility for premium analytics

* Add missing country synonyms for premium map

* Remove legacy premium badge overlay

* Polish premium analytics controls for light theme

* Refresh map legend when toggling sections

* Improve light-mode styling for range selectors

* Fix map mode switching regression

* Fix for panel expand

* Typo fix

* webpack fix

* before next steps.

* split, zero-buckets

* bucket size indicated on UI

* all works

* first/last toggle

* breadcrumbs

* release
2025-10-20 18:43:06 +02:00

51 lines
1.6 KiB
JavaScript

import { getButtons } from "./src/buttons";
import { isShorts, setInitialState, initExtConfig } from "./src/state";
import { getBrowser, isVideoLoaded } from "./src/utils";
import { addLikeDislikeEventListener, createSmartimationObserver, storageChangeHandler } from "./src/events";
import { initPatreonFeatures } from "./src/patreon";
await initExtConfig();
initPatreonFeatures();
let jsInitChecktimer = null;
let isSetInitialStateDone = false;
async function setEventListeners(evt) {
async function checkForJS_Finish() {
try {
if ((isShorts() && isVideoLoaded()) || (getButtons()?.offsetParent && isVideoLoaded())) {
clearInterval(jsInitChecktimer);
jsInitChecktimer = null;
createSmartimationObserver();
addLikeDislikeEventListener();
await setInitialState();
isSetInitialStateDone = true;
getBrowser().storage.onChanged.addListener(storageChangeHandler);
}
} catch (exception) {
if (!isSetInitialStateDone) {
console.log("error");
await setInitialState();
}
}
}
if (jsInitChecktimer !== null) clearInterval(jsInitChecktimer);
jsInitChecktimer = setInterval(await checkForJS_Finish, 111);
}
await setEventListeners();
document.addEventListener("yt-navigate-finish", async function (event) {
if (jsInitChecktimer !== null) clearInterval(jsInitChecktimer);
await setEventListeners();
});
const s = document.createElement("script");
s.src = chrome.runtime.getURL("menu-fixer.js");
s.onload = function () {
this.remove();
};
(document.head || document.documentElement).appendChild(s);