mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-25 07:43:01 +01:00
3.0.0.13 release - dynamic selectors config loading from server added.
This commit is contained in:
1 parent
0105c6c141
commit
b6367ae334
11 files changed
+3107
-6568
No files matched your search
@@ -1,77 +1,62 @@
|
||||
//--- Import Button Functions ---//
|
||||
import {
|
||||
getButtons,
|
||||
getLikeButton,
|
||||
getDislikeButton,
|
||||
checkForSignInButton,
|
||||
|
||||
|
||||
|
||||
} from "./src/buttons";
|
||||
|
||||
//--- Import State Functions ---//
|
||||
import {
|
||||
isMobile,
|
||||
isShorts,
|
||||
isVideoDisliked,
|
||||
isVideoLiked,
|
||||
getState,
|
||||
setState,
|
||||
setInitialState,
|
||||
setLikes,
|
||||
setDislikes,
|
||||
getLikeCountFromButton,
|
||||
LIKED_STATE,
|
||||
DISLIKED_STATE,
|
||||
NEUTRAL_STATE,
|
||||
initExtConfig,
|
||||
} from "./src/state";
|
||||
|
||||
//--- Import Video & Browser Functions ---//
|
||||
import {
|
||||
numberFormat,
|
||||
getBrowser,
|
||||
getVideoId,
|
||||
isVideoLoaded,
|
||||
cLog,
|
||||
} from "./src/utils";
|
||||
import { createRateBar } from "./src/bar";
|
||||
import {
|
||||
sendVote,
|
||||
likeClicked,
|
||||
dislikeClicked,
|
||||
addLikeDislikeEventListener,
|
||||
storageChangeHandler,
|
||||
} from "./src/events";
|
||||
|
||||
initExtConfig();
|
||||
await initExtConfig();
|
||||
|
||||
let jsInitChecktimer = null;
|
||||
let isSetInitialStateDone = false;
|
||||
|
||||
function setEventListeners(evt) {
|
||||
function checkForJS_Finish() {
|
||||
async function setEventListeners (evt) {
|
||||
async function checkForJS_Finish () {
|
||||
try {
|
||||
if (isShorts() || (getButtons()?.offsetParent && isVideoLoaded())) {
|
||||
addLikeDislikeEventListener();
|
||||
setInitialState();
|
||||
isSetInitialStateDone = true;
|
||||
getBrowser().storage.onChanged.addListener(storageChangeHandler);
|
||||
clearInterval(jsInitChecktimer);
|
||||
jsInitChecktimer = null;
|
||||
}
|
||||
} catch(exception) {
|
||||
if(!isSetInitialStateDone) {
|
||||
setInitialState();
|
||||
addLikeDislikeEventListener();
|
||||
await setInitialState();
|
||||
isSetInitialStateDone = true;
|
||||
getBrowser().storage.onChanged.addListener(storageChangeHandler);
|
||||
}
|
||||
} catch (exception) {
|
||||
if (!isSetInitialStateDone) {
|
||||
cLog("error");
|
||||
await setInitialState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jsInitChecktimer = setInterval(checkForJS_Finish, 111);
|
||||
if (jsInitChecktimer !== null) clearInterval(jsInitChecktimer);
|
||||
jsInitChecktimer = setInterval(await checkForJS_Finish, 111);
|
||||
}
|
||||
|
||||
setEventListeners();
|
||||
await setEventListeners();
|
||||
|
||||
document.addEventListener("yt-navigate-finish", function (event) {
|
||||
document.addEventListener("yt-navigate-finish", async function (event) {
|
||||
if (jsInitChecktimer !== null) clearInterval(jsInitChecktimer);
|
||||
window.returnDislikeButtonlistenersSet = false;
|
||||
setEventListeners();
|
||||
await setEventListeners();
|
||||
});
|
||||
Reference in new issue
Block a user