mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-02 19:01:21 +01:00
remove confusing RYD class structure and make everything function
This commit is contained in:
1 parent
f1daa81686
commit
f1e15b076c
1 file changed
+12
-25
@@ -1,4 +1,3 @@
|
|||||||
function RYD() {
|
|
||||||
const LIKED_STATE = "LIKED_STATE";
|
const LIKED_STATE = "LIKED_STATE";
|
||||||
const DISLIKED_STATE = "DISLIKED_STATE";
|
const DISLIKED_STATE = "DISLIKED_STATE";
|
||||||
const NEUTRAL_STATE = "NEUTRAL_STATE";
|
const NEUTRAL_STATE = "NEUTRAL_STATE";
|
||||||
@@ -146,12 +145,12 @@ function RYD() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendVote(vote) {
|
function sendVote(vote) {
|
||||||
RYDTools.getBrowser().runtime.sendMessage({
|
getBrowser().runtime.sendMessage({
|
||||||
message: "send_vote",
|
message: "send_vote",
|
||||||
vote: vote,
|
vote: vote,
|
||||||
videoId: getVideoId(window.location.href)
|
videoId: getVideoId(window.location.href),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function likeClicked() {
|
function likeClicked() {
|
||||||
@@ -344,10 +343,10 @@ function RYD() {
|
|||||||
const ids = links
|
const ids = links
|
||||||
.filter((x) => x.href && x.href.indexOf("/watch?v=") > 0)
|
.filter((x) => x.href && x.href.indexOf("/watch?v=") > 0)
|
||||||
.map((x) => getVideoId(x.href));
|
.map((x) => getVideoId(x.href));
|
||||||
RYDTools.getBrowser().runtime.sendMessage({
|
getBrowser().runtime.sendMessage({
|
||||||
message: "send_links",
|
message: "send_links",
|
||||||
videoIds: ids,
|
videoIds: ids,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setEventListeners();
|
setEventListeners();
|
||||||
@@ -360,17 +359,7 @@ function RYD() {
|
|||||||
|
|
||||||
setTimeout(() => sendVideoIds(), 2500);
|
setTimeout(() => sendVideoIds(), 2500);
|
||||||
|
|
||||||
this.init = function () {};
|
function getBrowser() {
|
||||||
}
|
|
||||||
|
|
||||||
RYD.getInstance = function () {
|
|
||||||
if (typeof RYD.instance == "undefined") RYD.instance = new RYD();
|
|
||||||
return RYD.instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
RYDTools = {};
|
|
||||||
|
|
||||||
RYDTools.getBrowser = function () {
|
|
||||||
if (typeof chrome !== "undefined" && typeof chrome.runtime !== "undefined") {
|
if (typeof chrome !== "undefined" && typeof chrome.runtime !== "undefined") {
|
||||||
return chrome;
|
return chrome;
|
||||||
} else if (
|
} else if (
|
||||||
@@ -382,6 +371,4 @@ RYDTools.getBrowser = function () {
|
|||||||
console.log("browser is not supported");
|
console.log("browser is not supported");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
RYD.getInstance().init();
|
|
||||||
Reference in new issue
Block a user