mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-01 18:31:24 +01:00
move setInitialState to events.js
This commit is contained in:
1 parent
ed9a950d12
commit
4342f7e36f
2 files changed
+11
-8
No files matched your search
@@ -10,6 +10,7 @@ import {
|
|||||||
isVideoLiked,
|
isVideoLiked,
|
||||||
getState,
|
getState,
|
||||||
setState,
|
setState,
|
||||||
|
setInitialState,
|
||||||
setLikes,
|
setLikes,
|
||||||
setDislikes,
|
setDislikes,
|
||||||
getLikeCountFromButton,
|
getLikeCountFromButton,
|
||||||
@@ -27,13 +28,6 @@ let storedData = {
|
|||||||
previousState: NEUTRAL_STATE,
|
previousState: NEUTRAL_STATE,
|
||||||
};
|
};
|
||||||
|
|
||||||
function setInitialState() {
|
|
||||||
setState(storedData);
|
|
||||||
setTimeout(() => {
|
|
||||||
sendVideoIds();
|
|
||||||
}, 1500);
|
|
||||||
}
|
|
||||||
|
|
||||||
let jsInitChecktimer = null;
|
let jsInitChecktimer = null;
|
||||||
|
|
||||||
function setEventListeners(evt) {
|
function setEventListeners(evt) {
|
||||||
@@ -47,7 +41,7 @@ function setEventListeners(evt) {
|
|||||||
buttons.children[1].addEventListener("click", () => dislikeClicked(storedData));
|
buttons.children[1].addEventListener("click", () => dislikeClicked(storedData));
|
||||||
window.returnDislikeButtonlistenersSet = true;
|
window.returnDislikeButtonlistenersSet = true;
|
||||||
}
|
}
|
||||||
setInitialState();
|
setInitialState(storedData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { getLikeButton, getDislikeButton, getButtons } from "./buttons";
|
import { getLikeButton, getDislikeButton, getButtons } from "./buttons";
|
||||||
import { createRateBar } from "./bar";
|
import { createRateBar } from "./bar";
|
||||||
import { getBrowser, getVideoId, cLog, numberFormat } from "./utils";
|
import { getBrowser, getVideoId, cLog, numberFormat } from "./utils";
|
||||||
|
import { sendVideoIds } from "./events";
|
||||||
|
|
||||||
const LIKED_STATE = "LIKED_STATE";
|
const LIKED_STATE = "LIKED_STATE";
|
||||||
const DISLIKED_STATE = "DISLIKED_STATE";
|
const DISLIKED_STATE = "DISLIKED_STATE";
|
||||||
@@ -96,12 +97,20 @@ function setState(storedData) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setInitialState(storedData) {
|
||||||
|
setState(storedData);
|
||||||
|
setTimeout(() => {
|
||||||
|
sendVideoIds();
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
isMobile,
|
isMobile,
|
||||||
isVideoDisliked,
|
isVideoDisliked,
|
||||||
isVideoLiked,
|
isVideoLiked,
|
||||||
getState,
|
getState,
|
||||||
setState,
|
setState,
|
||||||
|
setInitialState,
|
||||||
setLikes,
|
setLikes,
|
||||||
setDislikes,
|
setDislikes,
|
||||||
getLikeCountFromButton,
|
getLikeCountFromButton,
|
||||||
|
|||||||
Reference in new issue
Block a user