mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-23 06:43:02 +01:00
Merge pull request #323 from himanshudabas/cleanup
remove unused functions from extension code
This commit is contained in:
2 files changed
-39
No files matched your search
@@ -131,37 +131,6 @@ api.storage.sync.get(null, (res) => {
|
||||
const sentIds = new Set();
|
||||
let toSend = [];
|
||||
|
||||
function getDislikesFromYoutubeResponse(htmlResponse) {
|
||||
let start =
|
||||
htmlResponse.indexOf('"videoDetails":') + '"videoDetails":'.length;
|
||||
let end =
|
||||
htmlResponse.indexOf('"isLiveContent":false}', start) +
|
||||
'"isLiveContent":false}'.length;
|
||||
if (end < start) {
|
||||
end =
|
||||
htmlResponse.indexOf('"isLiveContent":true}', start) +
|
||||
'"isLiveContent":true}'.length;
|
||||
}
|
||||
let jsonStr = htmlResponse.substring(start, end);
|
||||
let jsonResult = JSON.parse(jsonStr);
|
||||
let rating = jsonResult.averageRating;
|
||||
|
||||
start = htmlResponse.indexOf('"topLevelButtons":[', end);
|
||||
start =
|
||||
htmlResponse.indexOf('"accessibilityData":', start) +
|
||||
'"accessibilityData":'.length;
|
||||
end = htmlResponse.indexOf("}", start);
|
||||
let likes = +htmlResponse.substring(start, end).replace(/\D/g, "");
|
||||
let dislikes = (likes * (5 - rating)) / (rating - 1);
|
||||
let result = {
|
||||
likes,
|
||||
dislikes: Math.abs(Math.round(dislikes)),
|
||||
rating,
|
||||
viewCount: +jsonResult.viewCount,
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
function sendUserSubmittedStatisticsToApi(statistics) {
|
||||
fetch(`${apiUrl}/votes/user-submitted`, {
|
||||
method: "POST",
|
||||
|
||||
@@ -67,14 +67,6 @@ function RYD() {
|
||||
return getDislikeButton().classList.contains("style-default-active");
|
||||
}
|
||||
|
||||
function isVideoNotLiked() {
|
||||
return getLikeButton().classList.contains("style-text");
|
||||
}
|
||||
|
||||
function isVideoNotDisliked() {
|
||||
return getDislikeButton().classList.contains("style-text");
|
||||
}
|
||||
|
||||
function checkForSignInButton() {
|
||||
if (
|
||||
document.querySelector(
|
||||
|
||||
Reference in new issue
Block a user