Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Anarios/return-youtube-dislike.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitrii Selivanov <selivano.d@gmail.com>2022-04-26 20:00:09 +0300
committerGitHub <noreply@github.com>2022-04-26 20:00:09 +0300
commit43380c83c3b62f25cdeb1a68e503aa9de4dff905 (patch)
tree728467f67c678b7d2528b4536f1a9506b8933e8d
parent75e98a1e6e57c6bed6f5cd4ba044f06460a9598e (diff)
parent8bb6ef73fb7ff7516136dcf65fb70a63b8c70bfb (diff)
Merge branch 'main' into extOptionFormatLikes
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--Docs/FAQ.md10
-rw-r--r--Docs/Guide__Installing.md3
-rw-r--r--Docs/Guide__Troubleshooting.md16
-rw-r--r--Docs/SECURITY-FAQ.md4
-rw-r--r--Extensions/UserScript/Return Youtube Dislike.user.js47
-rw-r--r--Extensions/combined/_locales/de/messages.json50
-rw-r--r--Extensions/combined/_locales/en/messages.json6
-rw-r--r--Extensions/combined/_locales/fr/messages.json6
-rw-r--r--Extensions/combined/_locales/gr/manifest.json50
-rw-r--r--Extensions/combined/_locales/it/messages.json50
-rw-r--r--Extensions/combined/_locales/ru/messages.json2
-rw-r--r--Extensions/combined/manifest-chrome.json2
-rw-r--r--Extensions/combined/manifest-firefox.json2
-rw-r--r--Extensions/combined/ryd.background.js12
-rw-r--r--Extensions/combined/src/bar.js9
-rw-r--r--Extensions/combined/src/state.js90
-rw-r--r--Extensions/combined/src/utils.js5
-rw-r--r--README.md4
-rw-r--r--Website/README.md1
-rw-r--r--Website/pages/faq.vue7
-rw-r--r--Website/pages/index.vue2
-rw-r--r--extension-description-store-russian.txt20
-rw-r--r--extension-description-store.txt4
24 files changed, 352 insertions, 52 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e9248df..d05c308 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -34,6 +34,8 @@ npm run build // to create the build file(s) once
Congratulations, You are now ready to develop!
+If you are new to developing Chrome extensions, or need extra help, please see [this YouTube tutorial](https://www.youtube.com/watch?v=mdOj6HYE3_0)
+
### Issues
#### Opening a new issue
diff --git a/Docs/FAQ.md b/Docs/FAQ.md
index c0f1744..02336f4 100644
--- a/Docs/FAQ.md
+++ b/Docs/FAQ.md
@@ -1,13 +1,13 @@
-# Frquently Asked Questions
+# Frequently Asked Questions
## Before asking a question on GitHub or Discord, please refer to this.
-### **1. Where does extension get data?**
-Combination of GoogleAPI data and scraped data.
+### **1. Where does this extension get the data?**
+A Combination of Google APIs and scraped data.
-We save all available data to our DB for it to be available after google shuts down dislike counts in their API.
+We save all available data to our DB for it to be available after Google shuts down dislike counts in their API.
### **2. Video dislike count doesn't update**
-Right now video dislikes are cached, and arent updated very frequenly. Once in 2-3 days, not more often.
+Right now video dislikes are cached, and aren't updated very frequenly. Once every 2-3 days, not more often.
Yeah, it's not ideal, but it is what it is. Working on improving how often we can update them.
diff --git a/Docs/Guide__Installing.md b/Docs/Guide__Installing.md
index bcb3698..bd03fcd 100644
--- a/Docs/Guide__Installing.md
+++ b/Docs/Guide__Installing.md
@@ -191,7 +191,8 @@ For now, you can try this
##### App from Play Store
-- Although app(s) which use this API exists but aren't they official.
+- Although app(s) which use this API exist, they aren't official.
+
##### On Firefox
diff --git a/Docs/Guide__Troubleshooting.md b/Docs/Guide__Troubleshooting.md
index eb18610..62f2d39 100644
--- a/Docs/Guide__Troubleshooting.md
+++ b/Docs/Guide__Troubleshooting.md
@@ -12,7 +12,7 @@ Troubleshooting Guide
- [Check for conflicting extensions](#check-for-conflicting-extensions)
- [Known conflicts](#known-conflicts)
- [iOS app](#ios-app)
-- [YouTube Vanced app](#youtube-vanced--app)
+- [YouTube Vanced app](#youtube-vanced--app)
- [Contact in Discord Server](#contact-in-discord-server)
- [Useful Links](#useful-links)
@@ -41,7 +41,7 @@ If the basic checks didn't resolve anything
- If you **don't see something like** this, then the **API is down** and **everything is fine on your side**.
`{"id":"QOFEgexls14","dateCreated":"2021-12-28T02:53:20.995329Z","likes":2968,"dislikes":204,"rating":4.725047080979285,"viewCount":29157,"deleted":false}`
-- If you see some responses but not in the above format (with likes and dislikes) then probably you are being rate-limited. It is done to prevent bot attacks and database vandalization. It depends on IP (its hash - which is never stored in non-volatile storage) for its countermeasures. If many people are accessing the server from the same IP (as in the case of public/institutional Wi-Fi) then it's possible that the IP is being rate-limited. If that's the case, There's no way for us to differentiate you from a bot/attacker.
+- If you see some responses but not in the above format (with likes and dislikes) then probably you are being rate-limited. It is done to prevent bot attacks and database vandalization. It depends on IP (its hash - which is never stored in non-volatile storage) for its countermeasures. If many people are accessing the server from the same IP (as in the case of public/institutional Wi-Fi) then it's possible that the IP is being rate-limited. If that's the case, there's no way for us to differentiate you from a bot/attacker.
**If you see "Certificate error" and [if you are on Windows 7 (or earlier) read this](#install-certificates)**
@@ -63,12 +63,12 @@ You can follow this guide:
[Fix error NET::ERR CERT DATE INVALID - Your connection is not private - Windows 7 - 2021](https://youtu.be/JYZLxP2Z8G4)
-If you don't want to install the certificate from Google drive
+If you don't want to install the certificate from Google Drive
- Here is the official link to the certificate [**x1.i.lencr.org**](http://x1.i.lencr.org/).
- **You will have to close all the tabs** before downloading this certificate.
-**The thumb print of real certificate is `cabd2a79a1076a31f21d253635cb039d4329a5e8`**
+**The thumbprint of real certificate is `cabd2a79a1076a31f21d253635cb039d4329a5e8`**
**To make sure that you have installed the correct certificate, you should consider checking if the thumbprints match.** To do this you can follow this guide: [How to check a certificate's thumbprint](https://knowledge.digicert.com/solution/SO9840.html)
@@ -117,7 +117,7 @@ If it does, find the extension(s) preventing RYD from working correctly and re-c
>
> **Solution:** Trust `returnyoutubedislikeapi.com` manually
>
-> ![rust returnyoutubedislikeapi.com manually](https://cdn.discordapp.com/attachments/821116437720334397/929814357708247060/unknown.png)
+> ![trust returnyoutubedislikeapi.com manually](https://cdn.discordapp.com/attachments/821116437720334397/929814357708247060/unknown.png)
<br>
@@ -139,7 +139,7 @@ Coming soon. Please have patience.
<br>
-## YouTube Vanced app
+## YouTube Vanced app
Coming soon. Please have patience.
@@ -153,11 +153,11 @@ Coming soon. Please have patience.
[Discord server link: https://discord.gg/mYnESY4Md5][3]
-0. Join the discord server if haven't already
+0. Join the discord server if you haven't already
1. Go to the #Bugs-and-problems channel
2. There, thoroughly describe:
- your problem
- - what you have tried & what didn't work
+ - what you have tried and what didn't work
- results of the troubleshooting steps
<!-- {
diff --git a/Docs/SECURITY-FAQ.md b/Docs/SECURITY-FAQ.md
index a8e27fc..b9eb259 100644
--- a/Docs/SECURITY-FAQ.md
+++ b/Docs/SECURITY-FAQ.md
@@ -6,7 +6,7 @@ No. The extension's code is public and you can see it for yourself. The only inf
### Can you uniquely identify me if I dislike?
-Yes. When you dislike a video, we create a randomly generated unique ID for you that is not tied to your Google account. This is done to prevent botting. But there is no way to tie this random Id to you or your personal youtube account.
+Yes. When you dislike a video, we create a randomly generated unique ID for you that is not tied to your Google account. This is done to prevent botting. But there is no way to tie this random Id to you or your personal YouTube account.
### What information do you have, exactly?
@@ -18,7 +18,7 @@ The backend keeps unhashed IP addresses in volatile memory (RAM) only. These add
### I heard some discussion over OAuth, and access to my YouTube account!
-This feature will be optional, and very much opt-in. If you are a YouTube creator, and would like to share your dislike stats with us, you can. The way [OAuth](https://en.wikipedia.org/wiki/OAuth#:~:text=but%20without%20giving%20them%20the%20passwords.) was structured, is it's actually very secure. You can revoke access to your account at any time, and can give very specific permissions to us. We will not ask for any permissions that aren't required. We'll only ask for permissions to view your video stats.
+This feature will be optional, and very much opt-in. If you are a YouTube creator, and would like to share your dislike stats with us, you can. The way [OAuth](https://en.wikipedia.org/wiki/OAuth#:~:text=but%20without%20giving%20them%20the%20passwords.) was structured, it's actually very secure. You can revoke access to your account at any time, and can give very specific permissions to us. We will not ask for any permissions that aren't required. We'll only ask for permissions to view your video stats.
### How can I trust this dislike count?
diff --git a/Extensions/UserScript/Return Youtube Dislike.user.js b/Extensions/UserScript/Return Youtube Dislike.user.js
index 923ccb7..3056e6f 100644
--- a/Extensions/UserScript/Return Youtube Dislike.user.js
+++ b/Extensions/UserScript/Return Youtube Dislike.user.js
@@ -97,6 +97,36 @@ function getDislikeButton() {
return getButtons().children[1];
}
+let mutationObserver = new Object();
+
+if (isShorts() && mutationObserver.exists !== true) {
+ cLog('initializing mutation observer')
+ mutationObserver.options = {
+ childList: false,
+ attributes: true,
+ subtree: false
+ };
+ mutationObserver.exists = true;
+ mutationObserver.observer = new MutationObserver( function(mutationList, observer) {
+ mutationList.forEach( (mutation) => {
+ if (mutation.type === 'attributes' &&
+ mutation.target.nodeName === 'TP-YT-PAPER-BUTTON' &&
+ mutation.target.id === 'button') {
+ cLog('Short thumb button status changed');
+ if (mutation.target.getAttribute('aria-pressed') === 'true') {
+ mutation.target.style.color =
+ (mutation.target.parentElement.parentElement.id === 'like-button') ?
+ getColorFromTheme(true) : getColorFromTheme(false);
+ } else {
+ mutation.target.style.color = 'unset';
+ }
+ return;
+ }
+ cLog('unexpected mutation observer event: ' + mutation.target + mutation.type);
+ });
+ });
+}
+
function isVideoLiked() {
if (isMobile) {
return (
@@ -303,8 +333,21 @@ function setState() {
}
createRateBar(likes, dislikes);
if (extConfig.coloredThumbs === true) {
- getLikeButton().style.color = getColorFromTheme(true);
- getDislikeButton().style.color = getColorFromTheme(false);
+ if (isShorts()) { // for shorts, leave deactived buttons in default color
+ let shortLikeButton = getLikeButton().querySelector('tp-yt-paper-button#button');
+ let shortDislikeButton = getDislikeButton().querySelector('tp-yt-paper-button#button');
+ if (shortLikeButton.getAttribute('aria-pressed') === 'true') {
+ shortLikeButton.style.color = getColorFromTheme(true);
+ }
+ if (shortDislikeButton.getAttribute('aria-pressed') === 'true') {
+ shortDislikeButton.style.color = getColorFromTheme(false);
+ }
+ mutationObserver.observer.observe(shortLikeButton, mutationObserver.options);
+ mutationObserver.observer.observe(shortDislikeButton, mutationObserver.options);
+ } else {
+ getLikeButton().style.color = getColorFromTheme(true);
+ getDislikeButton().style.color = getColorFromTheme(false);
+ }
}
}
});
diff --git a/Extensions/combined/_locales/de/messages.json b/Extensions/combined/_locales/de/messages.json
new file mode 100644
index 0000000..b8588eb
--- /dev/null
+++ b/Extensions/combined/_locales/de/messages.json
@@ -0,0 +1,50 @@
+{
+ "extensionName": {
+ "message": "Return YouTube Dislike"
+ },
+ "extensionDesc": {
+ "message": "Macht Dislikes wieder sichtbar"
+ },
+ "textDeveloper": {
+ "message": "von Dmitry Selivanov & Community"
+ },
+ "linkWebsite": {
+ "message": "Website"
+ },
+ "linkFAQ": {
+ "message": "FAQ"
+ },
+ "linkDonate": {
+ "message": "Spenden"
+ },
+ "linkHelp": {
+ "message": "Hilfe"
+ },
+ "legendSettings": {
+ "message": "Einstellungen"
+ },
+ "textSettings": {
+ "message": "Deaktiviere Like/Dislike-Übermittlung"
+ },
+ "textSettingsHover": {
+ "message": "Stoppt deine Likes und Dislikes zu zählen."
+ },
+ "textUpdate": {
+ "message": "aktualisieren auf"
+ },
+ "version30installed": {
+ "message": "Version 4.0.0.0 installiert"
+ },
+ "whatsnew": {
+ "message": "Was ist neu"
+ },
+ "shortsSupport": {
+ "message": "YouTube Shorts Unterstützung"
+ },
+ "customColors": {
+ "message": "Benutzerdefinierte Farben für Dislike-Leiste und Buttons"
+ },
+ "customNumberFormats": {
+ "message": "Benutzerdefinierte Zahlenformate"
+ }
+}
diff --git a/Extensions/combined/_locales/en/messages.json b/Extensions/combined/_locales/en/messages.json
index 8493b52..f937645 100644
--- a/Extensions/combined/_locales/en/messages.json
+++ b/Extensions/combined/_locales/en/messages.json
@@ -26,9 +26,15 @@
"textSettings": {
"message": "Disable like/dislike submission"
},
+ "textLikesDisabled": {
+ "message": "disabled by owner"
+ },
"textSettingsHover": {
"message": "Stops counting your likes and dislikes."
},
+ "textTempUnavailable": {
+ "message": "temporarily unavailable"
+ },
"textUpdate": {
"message": "update to"
},
diff --git a/Extensions/combined/_locales/fr/messages.json b/Extensions/combined/_locales/fr/messages.json
index 78878f0..1fc16cb 100644
--- a/Extensions/combined/_locales/fr/messages.json
+++ b/Extensions/combined/_locales/fr/messages.json
@@ -23,12 +23,18 @@
"legendSettings": {
"message": "Paramètres"
},
+ "textLikesDisabled": {
+ "message": "Désactivé par le créateur"
+ },
"textSettings": {
"message": "Désactiver l'envoi des likes/dislikes"
},
"textSettingsHover": {
"message": "Arrête de compter les likes et les dislikes mis sur les vidéos."
},
+ "textTempUnavailable": {
+ "message": "temporairement indisponible"
+ },
"textUpdate": {
"message": "mettre à jour vers"
}
diff --git a/Extensions/combined/_locales/gr/manifest.json b/Extensions/combined/_locales/gr/manifest.json
new file mode 100644
index 0000000..80e64fb
--- /dev/null
+++ b/Extensions/combined/_locales/gr/manifest.json
@@ -0,0 +1,50 @@
+{
+ "extensionName": {
+ "message": "Επιστροφή του YouTube Dislike"
+ },
+ "extensionDesc": {
+ "message": "Επιστρέφει τα dislikes"
+ },
+ "textDeveloper": {
+ "message": "από τον Dmitry Selivanov & την κοινότητα"
+ },
+ "linkWebsite": {
+ "message": "Ιστοσελίδα"
+ },
+ "linkFAQ": {
+ "message": "Γρήγορες Ερωτήσιες & Απαντήσεις"
+ },
+ "linkDonate": {
+ "message": "Στηρίξτε"
+ },
+ "linkHelp": {
+ "message": "Βοήθεια"
+ },
+ "legendSettings": {
+ "message": "Ρυθμίσεις"
+ },
+ "textSettings": {
+ "message": "Διακοπή υποβολής like/dislike"
+ },
+ "textSettingsHover": {
+ "message": "Σταματάει να μετράει τα likes & dislikes που κάνεις."
+ },
+ "textUpdate": {
+ "message": "ενημέρωση σε"
+ },
+ "version30installed": {
+ "message": "Εκδοση 4.0.0.0 εγκαταστάθηκε"
+ },
+ "whatsnew": {
+ "message": "Τι είναι νέο;"
+ },
+ "shortsSupport": {
+ "message": "Υποστήριξη για YouTube Shorts"
+ },
+ "customColors": {
+ "message": "Προσαρμοζόμενα χρώματα για τα κουμπιά και την μπάρα dislike"
+ },
+ "customNumberFormats": {
+ "message": "Προσαρμοζόμενη μορφή αριθμών."
+ }
+} \ No newline at end of file
diff --git a/Extensions/combined/_locales/it/messages.json b/Extensions/combined/_locales/it/messages.json
new file mode 100644
index 0000000..9031ce0
--- /dev/null
+++ b/Extensions/combined/_locales/it/messages.json
@@ -0,0 +1,50 @@
+{
+ "extensionName": {
+ "message": "Return YouTube Dislike"
+ },
+ "extensionDesc": {
+ "message": "Ripristina la possibilità di vedere i dislikes"
+ },
+ "textDeveloper": {
+ "message": "di Dmitry Selivanov e la Community"
+ },
+ "linkWebsite": {
+ "message": "Sito web"
+ },
+ "linkFAQ": {
+ "message": "Domande frequenti"
+ },
+ "linkDonate": {
+ "message": "Fai una donazione"
+ },
+ "linkHelp": {
+ "message": "Aiuto"
+ },
+ "legendSettings": {
+ "message": "Impostazioni"
+ },
+ "textSettings": {
+ "message": "Disabilita l'invio di like/dislike"
+ },
+ "textSettingsHover": {
+ "message": "Interrompe il conteggio dei tuoi likes e dislikes."
+ },
+ "textUpdate": {
+ "message": "aggiorna a"
+ },
+ "version30installed": {
+ "message": "Versione 4.0.0.0 installata"
+ },
+ "whatsnew": {
+ "message": "Cosa c'è di nuovo"
+ },
+ "shortsSupport": {
+ "message": "Supporto per YouTube Shorts"
+ },
+ "customColors": {
+ "message": "Colori personalizzati per la barra dei dislike e i bottoni"
+ },
+ "customNumberFormats": {
+ "message": "Formati numerici personalizzati"
+ }
+}
diff --git a/Extensions/combined/_locales/ru/messages.json b/Extensions/combined/_locales/ru/messages.json
index 0c1cc5b..1a2f59c 100644
--- a/Extensions/combined/_locales/ru/messages.json
+++ b/Extensions/combined/_locales/ru/messages.json
@@ -42,7 +42,7 @@
"message": "Поддержка YouTube Shorts"
},
"customColors": {
- "message": "Выбор цветов дизлайк бара и кнопок"
+ "message": "Выбор цветов панели дизлайков и кнопок"
},
"customNumberFormats": {
"message": "Выбор формата чисел"
diff --git a/Extensions/combined/manifest-chrome.json b/Extensions/combined/manifest-chrome.json
index 1f0b953..53b0213 100644
--- a/Extensions/combined/manifest-chrome.json
+++ b/Extensions/combined/manifest-chrome.json
@@ -2,7 +2,7 @@
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDesc__",
"default_locale": "en",
- "version": "2.1.0.3",
+ "version": "3.0.0.0",
"manifest_version": 3,
"background": {
"service_worker": "ryd.background.js"
diff --git a/Extensions/combined/manifest-firefox.json b/Extensions/combined/manifest-firefox.json
index 54989be..07846f4 100644
--- a/Extensions/combined/manifest-firefox.json
+++ b/Extensions/combined/manifest-firefox.json
@@ -2,7 +2,7 @@
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDesc__",
"default_locale": "en",
- "version": "2.1.0.3",
+ "version": "3.0.0.0",
"manifest_version": 2,
"background": {
"scripts": ["ryd.background.js"]
diff --git a/Extensions/combined/ryd.background.js b/Extensions/combined/ryd.background.js
index e1eb0be..10b08d2 100644
--- a/Extensions/combined/ryd.background.js
+++ b/Extensions/combined/ryd.background.js
@@ -73,12 +73,16 @@ api.runtime.onMessage.addListener((request, sender, sendResponse) => {
}
});
-api.storage.sync.get(['newInstallation'], (result) => {
- if (result.newInstallation !== false) {
- api.tabs.create({url: api.runtime.getURL("/changelog/3/changelog_3.0.html")});
+api.storage.sync.get(['lastShowChangelogVersion'], (details) => {
+ if (extConfig.showUpdatePopup === true &&
+ details.lastShowChangelogVersion !== chrome.runtime.getManifest().version
+ ) {
+ // keep it inside get to avoid race condition
+ api.storage.sync.set({'lastShowChangelogVersion ': chrome.runtime.getManifest().version});
+ // wait until async get runs & don't steal tab focus
+ api.tabs.create({url: api.runtime.getURL("/changelog/3/changelog_3.0.html"), active: false});
}
});
-api.storage.sync.set({'newInstallation': false});
async function sendVote(videoId, vote) {
api.storage.sync.get(null, async (storageResult) => {
diff --git a/Extensions/combined/src/bar.js b/Extensions/combined/src/bar.js
index dbd4c68..c56ab57 100644
--- a/Extensions/combined/src/bar.js
+++ b/Extensions/combined/src/bar.js
@@ -1,8 +1,9 @@
import { getButtons } from "./buttons";
-import { likesDisabledState, extConfig, isMobile } from "./state";
+import { extConfig, isMobile, isLikesDisabled } from "./state";
import { cLog, getColorFromTheme } from "./utils";
+
function createRateBar(likes, dislikes) {
- if (!likesDisabledState) {
+ if (!isLikesDisabled()) {
let rateBar = document.getElementById("ryd-bar-container");
const widthPx =
@@ -61,7 +62,9 @@ function createRateBar(likes, dislikes) {
} else {
cLog("removing bar");
let ratebar = document.getElementById("ryd-bar-container");
- ratebar.parentNode.removeChild(ratebar);
+ if(ratebar) {
+ ratebar.parentNode.removeChild(ratebar);
+ }
}
}
diff --git a/Extensions/combined/src/state.js b/Extensions/combined/src/state.js
index b70866e..87b3b06 100644
--- a/Extensions/combined/src/state.js
+++ b/Extensions/combined/src/state.js
@@ -8,6 +8,7 @@ import {
getColorFromTheme,
} from "./utils";
import { sendVideoIds } from "./events";
+import { localize } from "./utils";
//TODO: Do not duplicate here and in ryd.background.js
const apiUrl = "https://returnyoutubedislikeapi.com";
@@ -15,8 +16,6 @@ const LIKED_STATE = "LIKED_STATE";
const DISLIKED_STATE = "DISLIKED_STATE";
const NEUTRAL_STATE = "NEUTRAL_STATE";
-const DISLIKES_DISABLED_TEXT = "DISLIKES DISABLED";
-
let extConfig = {
disableVoteSubmission: false,
coloredThumbs: false,
@@ -33,8 +32,6 @@ let storedData = {
previousState: NEUTRAL_STATE,
};
-let likesDisabledState = true;
-
function isMobile() {
return location.hostname == "m.youtube.com";
}
@@ -43,6 +40,46 @@ function isShorts() {
return location.pathname.startsWith("/shorts");
}
+
+let mutationObserver = new Object();
+
+if (isShorts() && mutationObserver.exists !== true) {
+ cLog('initializing mutation observer')
+ mutationObserver.options = {
+ childList: false,
+ attributes: true,
+ subtree: false
+ };
+ mutationObserver.exists = true;
+ mutationObserver.observer = new MutationObserver( function(mutationList, observer) {
+ mutationList.forEach( (mutation) => {
+ if (mutation.type === 'attributes' &&
+ mutation.target.nodeName === 'TP-YT-PAPER-BUTTON' &&
+ mutation.target.id === 'button') {
+ // cLog('Short thumb button status changed');
+ if (mutation.target.getAttribute('aria-pressed') === 'true') {
+ mutation.target.style.color =
+ (mutation.target.parentElement.parentElement.id === 'like-button') ?
+ getColorFromTheme(true) : getColorFromTheme(false);
+ } else {
+ mutation.target.style.color = 'unset';
+ }
+ return;
+ }
+ cLog('unexpected mutation observer event: ' + mutation.target + mutation.type);
+ });
+ });
+
+function isLikesDisabled() {
+ // return true if the like button's text doesn't contain any number
+ if (isMobile()) {
+ return /^\D*$/.test(
+ getButtons().children[0].querySelector(".button-renderer-text").innerText
+ );
+ }
+ return /^\D*$/.test(getButtons().children[0].querySelector("#text").innerText);
+}
+
function isVideoLiked() {
if (isMobile()) {
return (
@@ -79,7 +116,7 @@ function setLikes(likesCount) {
}
function setDislikes(dislikesCount) {
- if (!likesDisabledState) {
+ if (!isLikesDisabled()) {
if (isMobile()) {
getButtons().children[1].querySelector(
".button-renderer-text"
@@ -92,11 +129,12 @@ function setDislikes(dislikesCount) {
if (isMobile()) {
getButtons().children[1].querySelector(
".button-renderer-text"
- ).innerText = DISLIKES_DISABLED_TEXT;
+ ).innerText = localize("TextLikesDisabled");
return;
}
- getButtons().children[1].querySelector("#text").innerText =
- DISLIKES_DISABLED_TEXT;
+ getButtons().children[1].querySelector("#text").innerText = localize(
+ "TextLikesDisabled"
+ );
}
}
@@ -126,11 +164,31 @@ function processResponse(response, storedData) {
storedData.likes = getLikeCountFromButton() || parseInt(response.likes);
createRateBar(storedData.likes, storedData.dislikes);
if (extConfig.coloredThumbs === true) {
- getLikeButton().style.color = getColorFromTheme(true);
- getDislikeButton().style.color = getColorFromTheme(false);
+ if (isShorts()) { // for shorts, leave deactived buttons in default color
+ let shortLikeButton = getLikeButton().querySelector('tp-yt-paper-button#button');
+ let shortDislikeButton = getDislikeButton().querySelector('tp-yt-paper-button#button');
+ if (shortLikeButton.getAttribute('aria-pressed') === 'true') {
+ shortLikeButton.style.color = getColorFromTheme(true);
+ }
+ if (shortDislikeButton.getAttribute('aria-pressed') === 'true') {
+ shortDislikeButton.style.color = getColorFromTheme(false);
+ }
+ mutationObserver.observer.observe(shortLikeButton, mutationObserver.options);
+ mutationObserver.observer.observe(shortDislikeButton, mutationObserver.options);
+ } else {
+ getLikeButton().style.color = getColorFromTheme(true);
+ getDislikeButton().style.color = getColorFromTheme(false);
+ }
}
}
+// Tells the user if the API is down
+function displayError(error) {
+ getButtons().children[1].querySelector("#text").innerText = localize(
+ "textTempUnavailable"
+ );
+}
+
async function setState(storedData) {
storedData.previousState = isVideoDisliked()
? DISLIKED_STATE
@@ -151,14 +209,14 @@ async function setState(storedData) {
},
}
)
+ .then((response) => {
+ if (!response.ok) displayError(response.error);
+ return response;
+ })
.then((response) => response.json())
- .catch();
+ .catch(displayError);
cLog("response from api:");
cLog(JSON.stringify(response));
- likesDisabledState =
- numberFormat(response.dislikes) == 0 &&
- numberFormat(response.likes) == 0 &&
- numberFormat(response.viewCount) == 0;
if (response !== undefined && !("traceId" in response) && !statsSet) {
processResponse(response, storedData);
}
@@ -268,5 +326,5 @@ export {
extConfig,
initExtConfig,
storedData,
- likesDisabledState,
+ isLikesDisabled
};
diff --git a/Extensions/combined/src/utils.js b/Extensions/combined/src/utils.js
index 7cedc21..b1acc54 100644
--- a/Extensions/combined/src/utils.js
+++ b/Extensions/combined/src/utils.js
@@ -29,6 +29,10 @@ function numberFormat(numberState) {
);
}
+function localize(localeString) {
+ return chrome.i18n.getMessage(localeString);
+}
+
function getNumberFormatter(optionSelect) {
let formatterNotation;
let formatterCompactDisplay;
@@ -151,4 +155,5 @@ export {
isVideoLoaded,
cLog,
getColorFromTheme,
+ localize,
};
diff --git a/README.md b/README.md
index 369af4e..9e5fcc2 100644
--- a/README.md
+++ b/README.md
@@ -33,12 +33,10 @@ With the removal of dislike stats from the YouTube API, our backend switched to
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 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.
@@ -79,7 +77,7 @@ You can view all documentation on our website.
## Contributing
-Please read the [contribution guide.](https://github.com/Anarios/return-youtube-dislike/blob/main/CONTRIBUTING.md)
+Please read the [contribution guide](https://github.com/Anarios/return-youtube-dislike/blob/main/CONTRIBUTING.md).
## Support this project!
diff --git a/Website/README.md b/Website/README.md
index cc42b01..f59e39a 100644
--- a/Website/README.md
+++ b/Website/README.md
@@ -58,7 +58,6 @@ Layouts are a great help when you want to change the look and feel of your Nuxt
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/layouts).
-
### `pages`
This directory contains your application views and routes. Nuxt will read all the `*.vue` files inside this directory and setup Vue Router automatically.
diff --git a/Website/pages/faq.vue b/Website/pages/faq.vue
index 1df8900..af0741d 100644
--- a/Website/pages/faq.vue
+++ b/Website/pages/faq.vue
@@ -36,7 +36,7 @@ export default {
{
question: "Where does the extension get its data?",
answer:
- "A combination of archived data from before the offical YouTube dislike API shut down, and extrapolated extension user behavior.",
+ "A combination of archived data from before the official YouTube dislike API shut down, and extrapolated extension user behavior.",
},
{
question: "Why isn't the dislike count updating?",
@@ -44,6 +44,11 @@ export default {
"Right now video dislikes are cached and they aren't updated very frequently. It varies depending on a video's popularity but can take anywhere between a few hours and a few days to update.",
},
{
+ question: "Why is the dislike count on my videos inaccurate?",
+ answer:
+ "Extrapolated data tends to get better with the increase in diversity and the quantity of voters. \nTo ensure and increase the accuracy of the extrapolated vote data for your videos, you can encourage your viewers to use this extension (or any app that submits votes to returnyoutubedislikeapi.com) ",
+ },
+ {
question: "How does this work?",
answer:
"The extension collects the video ID of the video you are watching, fetches the dislike (and other fields like views, likes etc) using our API. The extension then displays the dislike count and ratio on the page. If you like or dislike a video, that is recorded and sent to the database so an accurate dislike count can be extrapolated.",
diff --git a/Website/pages/index.vue b/Website/pages/index.vue
index 713cad4..f1a26a6 100644
--- a/Website/pages/index.vue
+++ b/Website/pages/index.vue
@@ -123,7 +123,7 @@ export default {
};
},
mounted() {
- const YOUTUBE_REGEX = /(?:http:|https:)*?\/\/(?:www\.|)(?:youtube\.com|m\.youtube\.com|youtu\.|youtube-nocookie\.com).*(?:v=|v%3D|v\/|(?:a|p)\/(?:a|u)\/\d.*\/|watch\?|vi(?:=|\/)|\/embed\/|oembed\?|be\/|e\/)([^&?%#\/\n]*)/;
+ const YOUTUBE_REGEX = /(?:http:|https:)*?\/\/(?:www\.|)(?:youtube\.com|m\.youtube\.com|youtu\.|youtube-nocookie\.com).*(?:v=|v%3D|v\/|(?:a|p)\/(?:a|u)\/\d.*\/|watch\?|vi(?:=|\/)|\/embed\/|oembed\?|be\/|e\/)([^&?%#/\n]*)/;
let lastVideoId = "";
window.oninput = (e) => {
const videoId = (e.target.value.match(YOUTUBE_REGEX) || {})[1] || e.target.value;
diff --git a/extension-description-store-russian.txt b/extension-description-store-russian.txt
new file mode 100644
index 0000000..ec36a92
--- /dev/null
+++ b/extension-description-store-russian.txt
@@ -0,0 +1,20 @@
+Return YouTube Dislike восстанавливает возвращает возможность видеть отметки «Не нравится» на YouTube.
+
+Если не работает: откройте вкладку расширений (chrome://extensions/), отключите это расширение и включите его снова. Это ошибка в chromium, которая в некоторых случаях приводит к сбою расширения. Это должно устранить большинство проблем. Надеюсь, команда chromium скоро исправит это
+
+Начиная с 13 декабря 2021 года YouTube удалил возможность видеть отметки «Не нравится» из своего API.
+Это расширение призвано вернуть власть пользователям, используя сочетание архивных данных о отметках «Нравится» и «Не нравится», а также «Нравится» и «Не нравится», сделанных пользователями расширения, чтобы показать наиболее точные рейтинги.
+
+В настоящее время более 200 миллионов данных об отметках «Нравится» и «Не нравится» к видео хранятся до 13 декабря 2021 года
+
+Активно растёт и обновляется с новыми загрузками видео после 13 декабря 2021 года
+
+Чем больше пользователей используют расширение, тем точнее оно будет
+
+Непопулярные видео, загруженные после 13 декабря 2021 года, могут содержать менее точные данные, чем более популярные видео.
+
+Это расширение в настоящее время находится в активной стадии разработки, поэтому, если у вас возникнут какие-либо проблемы, не стесняйтесь сообщать о них на нашей странице GitHub или на нашем сервере Discord.
+
+Больше возможностей появится в ближайшее время!
+
+https://github.com/Anarios/return-youtube-dislike \ No newline at end of file
diff --git a/extension-description-store.txt b/extension-description-store.txt
index b8b7a58..f02403e 100644
--- a/extension-description-store.txt
+++ b/extension-description-store.txt
@@ -1,6 +1,6 @@
Return YouTube Dislike restores the ability to see dislikes on YouTube.
-If it doesn't work: open extensions tab (chrome://extensions/) disable this extension and enable it again. This is a bug in chromium that breaks the extension in some cases. This should fix most of the problems. Hopefully chromium team will fix this soon
+If it doesn't work: open extensions tab (chrome://extensions/) disable this extension and enable it again. This is a bug in chromium that breaks the extension in some cases. This should fix most of the problems. Hopefully the chromium team will fix this soon.
Starting December 13th 2021, YouTube removed the ability to see dislikes from their API.
This extension aims to restore power to users by using a combination of archived like and dislike data, as well as the likes and dislikes made by extension users to show the most accurate ratings.
@@ -9,7 +9,7 @@ Currently has 200+ million videos likes/dislikes data stored before December 13t
Actively growing and keeping up to date with uploads after December 13th, 2021
-The more users that use the extension, the more accurate it will be
+The more users that use the extension, the more accurate it will be.
Unpopular videos uploaded after December 13th, 2021 may have less accurate data shown than more popular videos.