Explorar o código

remove unused functions from extension

himanshudabas %!s(int64=3) %!d(string=hai) anos
pai
achega
7d3ab78ef1

+ 0 - 31
Extensions/combined/ryd.background.js

@@ -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",

+ 0 - 8
Extensions/combined/ryd.content-script.js

@@ -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(