From f95ada4908b9cec6302d8a817c74ef484003d209 Mon Sep 17 00:00:00 2001
From: AndrewUnderscore <71723495+UnderscoreX5@users.noreply.github.com>
Date: Sun, 19 Dec 2021 16:08:44 +0100
Subject: [PATCH 01/16] Add version number to extension's menu
I added the version number I found in the manifest. Currently testing different text sizes and placements but I think this placement can work.
---
Extensions/combined/popup.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/Extensions/combined/popup.html b/Extensions/combined/popup.html
index 9264240..7187bfb 100644
--- a/Extensions/combined/popup.html
+++ b/Extensions/combined/popup.html
@@ -13,6 +13,7 @@
Return YouTube Dislike
by Dmitrii Selivanov & Community
+
v2.0.0.3
From 722ed0e8b7ee104767aebdaa97af73a60f62a7f1 Mon Sep 17 00:00:00 2001
From: AndrewUnderscore <71723495+UnderscoreX5@users.noreply.github.com>
Date: Mon, 20 Dec 2021 13:25:08 +0100
Subject: [PATCH 02/16] working on implementation of non-hardcoded version
---
Extensions/combined/popup.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Extensions/combined/popup.html b/Extensions/combined/popup.html
index 7187bfb..950c6e7 100644
--- a/Extensions/combined/popup.html
+++ b/Extensions/combined/popup.html
@@ -13,7 +13,7 @@
Return YouTube Dislike
by Dmitrii Selivanov & Community
-
v2.0.0.3
+
From 69d207b113cbef28a7e67193a281274673b702dd Mon Sep 17 00:00:00 2001
From: AndrewUnderscore <71723495+UnderscoreX5@users.noreply.github.com>
Date: Mon, 20 Dec 2021 13:29:02 +0100
Subject: [PATCH 03/16] Update popup.js
---
Extensions/combined/popup.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/Extensions/combined/popup.js b/Extensions/combined/popup.js
index fbdf776..ca5e5a0 100644
--- a/Extensions/combined/popup.js
+++ b/Extensions/combined/popup.js
@@ -10,6 +10,7 @@ const config = {
github: "https://github.com/Anarios/return-youtube-dislike",
discord: "https://discord.gg/mYnESY4Md5",
donate: 'https://returnyoutubedislike.com/donate'
+ wip
},
};
From 10c2f10e5c046b4eed23fb7ad693d0da93e0463c Mon Sep 17 00:00:00 2001
From: AndrewUnderscore <71723495+UnderscoreX5@users.noreply.github.com>
Date: Mon, 20 Dec 2021 13:30:51 +0100
Subject: [PATCH 04/16] adding popup.js
---
Extensions/combined/popup.js | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/Extensions/combined/popup.js b/Extensions/combined/popup.js
index ca5e5a0..1f2a7e3 100644
--- a/Extensions/combined/popup.js
+++ b/Extensions/combined/popup.js
@@ -9,8 +9,8 @@ const config = {
website: "https://returnyoutubedislike.com",
github: "https://github.com/Anarios/return-youtube-dislike",
discord: "https://discord.gg/mYnESY4Md5",
- donate: 'https://returnyoutubedislike.com/donate'
- wip
+ donate: 'https://returnyoutubedislike.com/donate',
+ faq: 'https://returnyoutubedislike.com/faq'
},
};
@@ -27,10 +27,15 @@ document.getElementById("link_discord").addEventListener("click", () => {
chrome.tabs.create({ url: config.links.discord });
});
+document.getElementById("link_faq").addEventListener("click", () => {
+ chrome.tabs.create({ url: config.links.faq });
+});
+
document.getElementById("link_donate").addEventListener("click", () => {
chrome.tabs.create({ url: config.links.donate });
});
+
document.getElementById("disable_vote_submission").addEventListener("click", (ev) => {
chrome.storage.sync.set({ disableVoteSubmission: ev.target.checked });
});
@@ -81,6 +86,7 @@ document.querySelector('#login')
chrome.runtime.sendMessage({ message: 'get_auth_token' });
});
+
document.querySelector("#log_off").addEventListener("click", function () {
chrome.runtime.sendMessage({ message: "log_off" });
});
From 559a2e8305fad68500f2b5c96b34a051994d4cef Mon Sep 17 00:00:00 2001
From: AndrewUnderscore <71723495+UnderscoreX5@users.noreply.github.com>
Date: Mon, 20 Dec 2021 13:35:01 +0100
Subject: [PATCH 05/16] taking the chrome manifest's version
It seems to work on firefox 95 but stable compatibility is not yet confirmed. Furthermore FF is not the only browser to use the 'browser' namespace, there's also safari. A cross-compatible version is to be preferred.
---
Extensions/combined/popup.js | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Extensions/combined/popup.js b/Extensions/combined/popup.js
index 1f2a7e3..c0e7b78 100644
--- a/Extensions/combined/popup.js
+++ b/Extensions/combined/popup.js
@@ -4,7 +4,17 @@ const config = {
showAdvancedMessage: "Show Settings",
hideAdvancedMessage: "Hide Settings",
disableVoteSubmission: false,
+}
+ function initConfig() {
+ initializeVersionNumber();
+ }
+
+ function initializeVersionNumber() {
+ const version = chrome.runtime.getManifest().version;
+ document.getElementById('ext-version').innerHTML = 'v' + version;
+}
+
links: {
website: "https://returnyoutubedislike.com",
github: "https://github.com/Anarios/return-youtube-dislike",
From 3be5051f53e84f07da109c74323d125c823bd1ab Mon Sep 17 00:00:00 2001
From: simon
Date: Mon, 20 Dec 2021 19:59:24 +0700
Subject: [PATCH 06/16] add API documentation with get vote example
---
README.md | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/README.md b/README.md
index fc347e4..d7506bb 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,37 @@ and estimates based on view\like ratios.
You can learn more at our website at: [returnyoutubedislike.com](https://www.returnyoutubedislike.com/)
+## API documentation
+
+Third party use of this open API is allowed with the following restrictions:
+
+- **Attribution**: This project should be clearly attributed with either a link to this repo or a link to [returnyoutubedislike.com](https://returnyoutubedislike.com/).
+- **Rate Limiting**: There are per client rate limits in place of 100 per minute and 10'000 per day. This will return a *429* status code indicating that your application should back off.
+
+The API is accessible over the following base URL:
+https://returnyoutubedislikeapi.com
+
+List of available endpoints is available here:
+https://returnyoutubedislikeapi.com/swagger/index.html
+
+### Get votes
+Example to get votes of a given YouTube video ID:
+`/votes?videoId=kxOuG8jMIgI`
+
+```json
+{
+ "id": "kxOuG8jMIgI",
+ "dateCreated": "2021-12-20T12:25:54.418014Z",
+ "likes": 27326,
+ "dislikes": 498153,
+ "rating": 1.212014408444885,
+ "viewCount": 3149885,
+ "deleted": false
+}
+```
+
+None existing YouTube ID will return status code *404* "Not Found".
+Wrong formed YouTube ID will return *400* "Bad Request".
## Contributing
From 86f1a39189d5509506e853fac643161bee051a5f Mon Sep 17 00:00:00 2001
From: TheSusian
Date: Thu, 23 Dec 2021 20:37:35 +0300
Subject: [PATCH 07/16] change dislike filed removal to "has been removed"
changing that the dislike field in the YouTube API from "will be removed" to "has been removed"
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index eb81915..a1a6a3d 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@
On November 10th, 2021, Google [announced](https://blog.youtube/news-and-events/update-to-youtube/) that the YouTube dislike count would be removed.
-Additionally, the `dislike` field in the YouTube API will be [removed](https://support.google.com/youtube/thread/134791097/update-to-youtube-dislike-counts) on December 13th, 2021, removing any ability to judge the quality of content before watching.
+Additionally, the `dislike` field in the YouTube API has been [removed](https://support.google.com/youtube/thread/134791097/update-to-youtube-dislike-counts) on December 13th, 2021, removing any ability to judge the quality of content before watching.
## What it Does
From a4916110a034c17268915b99d9dfa0969b56f730 Mon Sep 17 00:00:00 2001
From: oSumAtrIX
Date: Thu, 23 Dec 2021 20:28:12 +0100
Subject: [PATCH 08/16] Format numbers the same way as the extension for the
UserScript
---
.../UserScript/Return Youtube Dislike.user.js | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/Extensions/UserScript/Return Youtube Dislike.user.js b/Extensions/UserScript/Return Youtube Dislike.user.js
index 6b3e576..71e926d 100644
--- a/Extensions/UserScript/Return Youtube Dislike.user.js
+++ b/Extensions/UserScript/Return Youtube Dislike.user.js
@@ -311,22 +311,22 @@ function roundDown(num) {
}
function numberFormat(numberState) {
- let localeURL = Array.from(document.querySelectorAll("head > link[rel='search']"))
- ?.find((n) => n?.getAttribute("href")?.includes("?locale="))
- ?.getAttribute("href");
-
- const userLocales = localeURL ? new URL(localeURL)?.searchParams?.get("locale") : document.body.lang;
-
+ let userLocales;
+ try {
+ userLocales = new URL(
+ Array.from(document.querySelectorAll("head > link[rel='search']"))
+ ?.find((n) => n?.getAttribute("href")?.includes("?locale="))
+ ?.getAttribute("href")
+ )?.searchParams?.get("locale");
+ } catch {}
const formatter = Intl.NumberFormat(
document.documentElement.lang || userLocales || navigator.language,
{
notation: "compact",
- minimumFractionDigits: 1,
- maximumFractionDigits: 1,
}
);
- return formatter.format(roundDown(numberState)).replace(/\.0|,0/, "");
+ return formatter.format(roundDown(numberState));
}
function setEventListeners(evt) {
From 20e3cb8626e91f605bfbbe3e4b18eac7e533c61b Mon Sep 17 00:00:00 2001
From: thesusian
Date: Fri, 24 Dec 2021 14:19:49 +0300
Subject: [PATCH 09/16] changed (has been) to (was)
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a1a6a3d..e868131 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@
On November 10th, 2021, Google [announced](https://blog.youtube/news-and-events/update-to-youtube/) that the YouTube dislike count would be removed.
-Additionally, the `dislike` field in the YouTube API has been [removed](https://support.google.com/youtube/thread/134791097/update-to-youtube-dislike-counts) on December 13th, 2021, removing any ability to judge the quality of content before watching.
+Additionally, the `dislike` field in the YouTube API was [removed](https://support.google.com/youtube/thread/134791097/update-to-youtube-dislike-counts) on December 13th, 2021, removing any ability to judge the quality of content before watching.
## What it Does
From 5ab9e6c29d39eeeb2c75410e138f59e69cce60ca Mon Sep 17 00:00:00 2001
From: Front <27463495+Frontesque@users.noreply.github.com>
Date: Fri, 24 Dec 2021 13:27:17 -0500
Subject: [PATCH 10/16] comment main file
---
Extensions/combined/ryd.content-script.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Extensions/combined/ryd.content-script.js b/Extensions/combined/ryd.content-script.js
index d1bd9b5..3614fe3 100644
--- a/Extensions/combined/ryd.content-script.js
+++ b/Extensions/combined/ryd.content-script.js
@@ -1,9 +1,12 @@
+//--- Import Button Functions ---//
import {
getButtons,
getLikeButton,
getDislikeButton,
checkForSignInButton,
} from "./src/buttons";
+
+//--- Import State Functions ---//
import {
isMobile,
isVideoDisliked,
@@ -19,10 +22,13 @@ import {
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 { sendVideoIds, sendVote, likeClicked, dislikeClicked, addLikeDislikeEventListener, storageChangeHandler } from "./src/events"
+
initExtConfig()
let jsInitChecktimer = null;
From f540b7ef835b7f6b2dfa3218c46163bc49256789 Mon Sep 17 00:00:00 2001
From: Kippenhof <54744977+Kippenhof@users.noreply.github.com>
Date: Sun, 26 Dec 2021 21:43:09 +0100
Subject: [PATCH 11/16] Updated Readme
Updated Readme in favor of the New Calculation Process
---
README.md | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/README.md b/README.md
index eb81915..ac66c6b 100644
--- a/README.md
+++ b/README.md
@@ -25,9 +25,7 @@ Additionally, the `dislike` field in the YouTube API will be [removed](https://s
## What it Does
-This plugin will re-enable the visibility of the dislike count, fetching the total number of dislikes via our API, which in turn relies upon YouTube's [Data API](https://developers.google.com/youtube/v3).
-
-With the removal of dislike stats from the YouTube API, our backend will switch to using a combination of scraped dislike stats, estimates extrapolated from extension user data
+With the removal of dislike stats from the YouTube API, our backend switched to using a combination of scraped dislike stats, estimates extrapolated from extension user data
and estimates based on view\like ratios.
[FAQ](https://github.com/Anarios/return-youtube-dislike/blob/main/FAQ.md)
From c076eecbb5f1e0d63c24c210794c0645d3812e8a Mon Sep 17 00:00:00 2001
From: Front <27463495+Frontesque@users.noreply.github.com>
Date: Sun, 26 Dec 2021 17:18:27 -0500
Subject: [PATCH 12/16] fix compile issues
---
.gitignore | 7 ++++++-
package-lock.json | 1 -
package.json | 5 +++--
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/.gitignore b/.gitignore
index 85f9dce..d0c5794 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*cert
*Backend
.DS_Store
+package-lock.json
# Website node modules and build output
Website/package-lock.json
@@ -31,4 +32,8 @@ yarn-error.log*
node_modules
# Build files
-Extensions/combined/bundled-content-script.js
\ No newline at end of file
+Extensions/combined/bundled-content-script.js
+
+# Dist Files
+Extensions/combined/dist/*
+package-lock.json
diff --git a/package-lock.json b/package-lock.json
index 4126809..a3efdd0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,7 +5,6 @@
"requires": true,
"packages": {
"": {
- "name": "return-youtube-dislike",
"version": "2.0.0",
"devDependencies": {
"@babel/core": "^7.16.5",
diff --git a/package.json b/package.json
index 07388b7..5aad85a 100644
--- a/package.json
+++ b/package.json
@@ -4,8 +4,9 @@
"description": "Chrome extension to return youtube dislikes",
"main": "ryd.content-script.js",
"scripts": {
- "start": "webpack \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined/dist/\" --watch",
- "build": "webpack \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined\"",
+ "start": "echo To build for development, please use \"npm run dev\". To build for production, please use \"npm run build\".",
+ "dev": "webpack \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined/dist/\" --watch",
+ "build": "webpack --mode=development \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined\"",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
From 3cee9a4bfd16b9bf5a5c3e99ce5c1c521482b7ae Mon Sep 17 00:00:00 2001
From: Front <27463495+Frontesque@users.noreply.github.com>
Date: Sun, 26 Dec 2021 17:21:31 -0500
Subject: [PATCH 13/16] fix development mode
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 5aad85a..57c339e 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
"main": "ryd.content-script.js",
"scripts": {
"start": "echo To build for development, please use \"npm run dev\". To build for production, please use \"npm run build\".",
- "dev": "webpack \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined/dist/\" --watch",
+ "dev": "webpack --mode=development \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined/dist/\" --watch",
"build": "webpack --mode=development \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined\"",
"test": "echo \"Error: no test specified\" && exit 1"
},
From 58b718f02f63a742f32a81c070797bbf58d82302 Mon Sep 17 00:00:00 2001
From: Front <27463495+Frontesque@users.noreply.github.com>
Date: Sun, 26 Dec 2021 17:21:48 -0500
Subject: [PATCH 14/16] fix production
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 57c339e..276e730 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"scripts": {
"start": "echo To build for development, please use \"npm run dev\". To build for production, please use \"npm run build\".",
"dev": "webpack --mode=development \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined/dist/\" --watch",
- "build": "webpack --mode=development \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined\"",
+ "build": "webpack --mode=production \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined\"",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
From e313db4e77810a17120af3e1f1794116e9beca18 Mon Sep 17 00:00:00 2001
From: Front <27463495+Frontesque@users.noreply.github.com>
Date: Sun, 26 Dec 2021 21:52:24 -0500
Subject: [PATCH 15/16] add compile guide to extension
---
Extensions/combined/readme.md | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 Extensions/combined/readme.md
diff --git a/Extensions/combined/readme.md b/Extensions/combined/readme.md
new file mode 100644
index 0000000..ee827c0
--- /dev/null
+++ b/Extensions/combined/readme.md
@@ -0,0 +1,16 @@
+# Extension Source
+## Guide to Compiling
+
+## Compiling to Development (Testing)
+
+
Go to the root directory of the project
+
Run npm i to install all project dependancies (if not done so already)
+
run npm run dev to compile the extension to the ~/Extensions/combined/dist/ folder.
+
+
+## Compiling to Production (Final Release)
+
+
Go to the root directory of the project
+
Run npm i to install all project dependancies (if not done so already)
+
run npm run build to compile the extension to the ~/Extensions/combined/dist/ folder.