From 7d742a7ea682efe690f2dfe71b566127d1195cda Mon Sep 17 00:00:00 2001 From: Anton Bershanskiy <8knots@protonmail.com> Date: Wed, 20 Apr 2022 23:06:06 +0300 Subject: [PATCH 01/11] Fix: do not open changelog if not needed --- Extensions/combined/ryd.background.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Extensions/combined/ryd.background.js b/Extensions/combined/ryd.background.js index 18eb0fa..d89f39d 100644 --- a/Extensions/combined/ryd.background.js +++ b/Extensions/combined/ryd.background.js @@ -74,9 +74,19 @@ api.runtime.onMessage.addListener((request, sender, sendResponse) => { } }); -api.runtime.onInstalled.addListener(() => { - api.tabs.create({url: api.runtime.getURL("/changelog/3/changelog_3.0.html")}); -}) +api.runtime.onInstalled.addListener((details) => { + if ( + // No need to show changelog if its was a browser update (and not extension update) + details.reason === "browser_update" || + // No need to show changelog if developer just reloaded the extension + (details.reason === "update" && + details.previousVersion === chrome.runtime.getManifest().version) + ) + return; + api.tabs.create({ + url: api.runtime.getURL("/changelog/3/changelog_3.0.html"), + }); +}); async function sendVote(videoId, vote) { api.storage.sync.get(null, async (storageResult) => { From bdc46fae6f5df20cf337ab65adf7e6c86ce1335f Mon Sep 17 00:00:00 2001 From: Anton Bershanskiy <8knots@protonmail.com> Date: Wed, 20 Apr 2022 23:25:49 +0300 Subject: [PATCH 02/11] Smaller diff --- Extensions/combined/ryd.background.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Extensions/combined/ryd.background.js b/Extensions/combined/ryd.background.js index d89f39d..a26f082 100644 --- a/Extensions/combined/ryd.background.js +++ b/Extensions/combined/ryd.background.js @@ -83,10 +83,8 @@ api.runtime.onInstalled.addListener((details) => { details.previousVersion === chrome.runtime.getManifest().version) ) return; - api.tabs.create({ - url: api.runtime.getURL("/changelog/3/changelog_3.0.html"), - }); -}); + api.tabs.create({url: api.runtime.getURL("/changelog/3/changelog_3.0.html")}); +}) async function sendVote(videoId, vote) { api.storage.sync.get(null, async (storageResult) => { From aa4b4b4c3d1abca3186623d628e82d23f5a8cfa7 Mon Sep 17 00:00:00 2001 From: Dmitrii Selivanov Date: Tue, 26 Apr 2022 20:33:19 +0200 Subject: [PATCH 03/11] Update Return Youtube Dislike.user.js --- Extensions/UserScript/Return Youtube Dislike.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/UserScript/Return Youtube Dislike.user.js b/Extensions/UserScript/Return Youtube Dislike.user.js index 3056e6f..7db29ad 100644 --- a/Extensions/UserScript/Return Youtube Dislike.user.js +++ b/Extensions/UserScript/Return Youtube Dislike.user.js @@ -2,7 +2,7 @@ // @name Return YouTube Dislike // @namespace https://www.returnyoutubedislike.com/ // @homepage https://www.returnyoutubedislike.com/ -// @version 0.9.0 +// @version 3.0.0 // @encoding utf-8 // @description Return of the YouTube Dislike, Based off https://www.returnyoutubedislike.com/ // @icon https://github.com/Anarios/return-youtube-dislike/raw/main/Icons/Return%20Youtube%20Dislike%20-%20Transparent.png From bdc28cad33e38e1cc48a891ad799419b62cd9df9 Mon Sep 17 00:00:00 2001 From: Dmitrii Selivanov Date: Tue, 26 Apr 2022 22:05:36 +0200 Subject: [PATCH 04/11] Update README.md --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9e5fcc2..4f7e082 100644 --- a/README.md +++ b/README.md @@ -88,13 +88,9 @@ You can support this project by donating to us on the link below: ## Sponsors [Piepacker](https://piepacker.com) -[nodetube](https://github.com/mayeaux/nodetube) - -trig404 - -[Peter33](https://www.youtube.com/watch?v=G5kzUpWAusI) - [Seed4.Me VPN](https://www.seed4.me/users/register?gift=ReturnYoutubeDislike) [PocketTube](https://yousub.info/?utm_source=returnyoutubedislike) +[Become our sponsor](https://www.patreon.com/join/returnyoutubedislike/checkout?rid=8008601) + From a4806c1f478c444d365c06c45000a3c2143b2ed4 Mon Sep 17 00:00:00 2001 From: Dmitrii Selivanov Date: Tue, 26 Apr 2022 23:05:26 +0200 Subject: [PATCH 05/11] sendVideoIds removed, sponsor links updated --- .../gr/{manifest.json => messages.json} | 0 Extensions/combined/manifest-chrome.json | 2 +- Extensions/combined/manifest-firefox.json | 2 +- Extensions/combined/ryd.background.js | 20 ++--- Extensions/combined/ryd.content-script.js | 3 - Extensions/combined/src/events.js | 27 ------- Extensions/combined/src/state.js | 74 +++++++++++-------- Website/pages/index.vue | 11 +-- Website/pages/links.vue | 2 +- 9 files changed, 62 insertions(+), 79 deletions(-) rename Extensions/combined/_locales/gr/{manifest.json => messages.json} (100%) diff --git a/Extensions/combined/_locales/gr/manifest.json b/Extensions/combined/_locales/gr/messages.json similarity index 100% rename from Extensions/combined/_locales/gr/manifest.json rename to Extensions/combined/_locales/gr/messages.json diff --git a/Extensions/combined/manifest-chrome.json b/Extensions/combined/manifest-chrome.json index 53b0213..82ea6ea 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": "3.0.0.0", + "version": "3.0.0.1", "manifest_version": 3, "background": { "service_worker": "ryd.background.js" diff --git a/Extensions/combined/manifest-firefox.json b/Extensions/combined/manifest-firefox.json index 07846f4..c80e98f 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": "3.0.0.0", + "version": "3.0.0.1", "manifest_version": 2, "background": { "scripts": ["ryd.background.js"] diff --git a/Extensions/combined/ryd.background.js b/Extensions/combined/ryd.background.js index 10b08d2..944c57a 100644 --- a/Extensions/combined/ryd.background.js +++ b/Extensions/combined/ryd.background.js @@ -73,16 +73,16 @@ api.runtime.onMessage.addListener((request, sender, sendResponse) => { } }); -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.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}); +// } +// }); async function sendVote(videoId, vote) { api.storage.sync.get(null, async (storageResult) => { diff --git a/Extensions/combined/ryd.content-script.js b/Extensions/combined/ryd.content-script.js index 02370ed..a07dd99 100644 --- a/Extensions/combined/ryd.content-script.js +++ b/Extensions/combined/ryd.content-script.js @@ -34,7 +34,6 @@ import { } from "./src/utils"; import { createRateBar } from "./src/bar"; import { - sendVideoIds, sendVote, likeClicked, dislikeClicked, @@ -67,5 +66,3 @@ document.addEventListener("yt-navigate-finish", function (event) { window.returnDislikeButtonlistenersSet = false; setEventListeners(); }); - -setTimeout(() => sendVideoIds(), 2500); diff --git a/Extensions/combined/src/events.js b/Extensions/combined/src/events.js index b56b142..99c7d14 100644 --- a/Extensions/combined/src/events.js +++ b/Extensions/combined/src/events.js @@ -21,32 +21,6 @@ function sendVote(vote) { } } -function sendVideoIds() { - let links = Array.from( - document.getElementsByClassName( - "yt-simple-endpoint ytd-compact-video-renderer" - ) - ).concat( - Array.from( - document.getElementsByClassName("yt-simple-endpoint ytd-thumbnail") - ) - ); - // Also try mobile - if (links.length < 1) - links = Array.from( - document.querySelectorAll( - ".large-media-item-metadata > a, a.large-media-item-thumbnail-container" - ) - ); - const ids = links - .filter((x) => x.href && x.href.indexOf("/watch?v=") > 0) - .map((x) => getVideoId(x.href)); - getBrowser().runtime.sendMessage({ - message: "send_links", - videoIds: ids, - }); -} - function likeClicked() { if (checkForSignInButton() === false) { if (storedData.previousState === DISLIKED_STATE) { @@ -166,7 +140,6 @@ function handleNumberDisplayReformatLikesChangeEvent(value) { export { sendVote, - sendVideoIds, likeClicked, dislikeClicked, addLikeDislikeEventListener, diff --git a/Extensions/combined/src/state.js b/Extensions/combined/src/state.js index 87b3b06..df9d561 100644 --- a/Extensions/combined/src/state.js +++ b/Extensions/combined/src/state.js @@ -7,7 +7,6 @@ import { numberFormat, getColorFromTheme, } from "./utils"; -import { sendVideoIds } from "./events"; import { localize } from "./utils"; //TODO: Do not duplicate here and in ryd.background.js @@ -40,35 +39,43 @@ function isShorts() { return location.pathname.startsWith("/shorts"); } - let mutationObserver = new Object(); if (isShorts() && mutationObserver.exists !== true) { - cLog('initializing mutation observer') + cLog("initializing mutation observer"); mutationObserver.options = { childList: false, attributes: true, - subtree: false + 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') { + 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') { + if (mutation.target.getAttribute("aria-pressed") === "true") { mutation.target.style.color = - (mutation.target.parentElement.parentElement.id === 'like-button') ? - getColorFromTheme(true) : getColorFromTheme(false); + mutation.target.parentElement.parentElement.id === "like-button" + ? getColorFromTheme(true) + : getColorFromTheme(false); } else { - mutation.target.style.color = 'unset'; + mutation.target.style.color = "unset"; } return; } - cLog('unexpected mutation observer event: ' + mutation.target + mutation.type); + cLog( + "unexpected mutation observer event: " + mutation.target + mutation.type + ); }); }); +} function isLikesDisabled() { // return true if the like button's text doesn't contain any number @@ -77,7 +84,9 @@ function isLikesDisabled() { getButtons().children[0].querySelector(".button-renderer-text").innerText ); } - return /^\D*$/.test(getButtons().children[0].querySelector("#text").innerText); + return /^\D*$/.test( + getButtons().children[0].querySelector("#text").innerText + ); } function isVideoLiked() { @@ -132,9 +141,8 @@ function setDislikes(dislikesCount) { ).innerText = localize("TextLikesDisabled"); return; } - getButtons().children[1].querySelector("#text").innerText = localize( - "TextLikesDisabled" - ); + getButtons().children[1].querySelector("#text").innerText = + localize("TextLikesDisabled"); } } @@ -164,17 +172,28 @@ function processResponse(response, storedData) { storedData.likes = getLikeCountFromButton() || parseInt(response.likes); createRateBar(storedData.likes, storedData.dislikes); if (extConfig.coloredThumbs === true) { - 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') { + 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') { + if (shortDislikeButton.getAttribute("aria-pressed") === "true") { shortDislikeButton.style.color = getColorFromTheme(false); } - mutationObserver.observer.observe(shortLikeButton, mutationObserver.options); - mutationObserver.observer.observe(shortDislikeButton, mutationObserver.options); + mutationObserver.observer.observe( + shortLikeButton, + mutationObserver.options + ); + mutationObserver.observer.observe( + shortDislikeButton, + mutationObserver.options + ); } else { getLikeButton().style.color = getColorFromTheme(true); getDislikeButton().style.color = getColorFromTheme(false); @@ -224,9 +243,6 @@ async function setState(storedData) { function setInitialState() { setState(storedData); - setTimeout(() => { - sendVideoIds(); - }, 1500); } function initExtConfig() { @@ -326,5 +342,5 @@ export { extConfig, initExtConfig, storedData, - isLikesDisabled + isLikesDisabled, }; diff --git a/Website/pages/index.vue b/Website/pages/index.vue index f1a26a6..900727a 100644 --- a/Website/pages/index.vue +++ b/Website/pages/index.vue @@ -67,7 +67,7 @@ -
+

mdi-heart Sponsors @@ -105,12 +105,6 @@ export default { discordLink: "https://discord.gg/mYnESY4Md5", sponsors: [ { name: "Piepacker", link: "https://piepacker.com/" }, - { name: "nodetube", link: "https://github.com/mayeaux/nodetube" }, - { name: "trig404" }, - { - name: "Peter33", - link: "https://www.youtube.com/watch?v=G5kzUpWAusI", - }, { name: "Seed4.Me VPN", link: "https://www.seed4.me/users/register?gift=ReturnYoutubeDislike", @@ -118,6 +112,9 @@ export default { { name: "PocketTube", link: "https://yousub.info/?utm_source=returnyoutubedislike" + }, { + name: "Become our sponsor", + link: "https://www.patreon.com/join/returnyoutubedislike/checkout?rid=8008601" } ], }; diff --git a/Website/pages/links.vue b/Website/pages/links.vue index eacfee9..5a0ebde 100644 --- a/Website/pages/links.vue +++ b/Website/pages/links.vue @@ -22,7 +22,7 @@ mdi-email - Email + selivano.d@gmail.com

From 0df5bb75e7f291797c62130a81ca64421611f179 Mon Sep 17 00:00:00 2001 From: Dmitrii Selivanov Date: Wed, 27 Apr 2022 00:56:05 +0200 Subject: [PATCH 06/11] 3.0.0.1 --- Extensions/combined/_locales/de/messages.json | 2 +- Extensions/combined/_locales/en/messages.json | 5 +- Extensions/combined/_locales/gr/messages.json | 4 +- Extensions/combined/_locales/it/messages.json | 2 +- Extensions/combined/_locales/ru/messages.json | 5 +- .../combined/changelog/3/changelog_3.0.html | 4 +- Extensions/combined/manifest-firefox.json | 7 + Extensions/combined/ryd.background.js | 132 ++++++++---------- Extensions/combined/src/utils.js | 8 ++ 9 files changed, 92 insertions(+), 77 deletions(-) diff --git a/Extensions/combined/_locales/de/messages.json b/Extensions/combined/_locales/de/messages.json index b8588eb..cd7e3e3 100644 --- a/Extensions/combined/_locales/de/messages.json +++ b/Extensions/combined/_locales/de/messages.json @@ -33,7 +33,7 @@ "message": "aktualisieren auf" }, "version30installed": { - "message": "Version 4.0.0.0 installiert" + "message": "Version 3.0.0.1 installiert" }, "whatsnew": { "message": "Was ist neu" diff --git a/Extensions/combined/_locales/en/messages.json b/Extensions/combined/_locales/en/messages.json index f937645..24c6c69 100644 --- a/Extensions/combined/_locales/en/messages.json +++ b/Extensions/combined/_locales/en/messages.json @@ -39,7 +39,7 @@ "message": "update to" }, "version30installed": { - "message": "Version 4.0.0.0 installed" + "message": "Version 3.0.0.1 installed" }, "whatsnew": { "message": "What's new" @@ -52,5 +52,8 @@ }, "customNumberFormats": { "message": "Custom number formats" + }, + "considerDonating": { + "message": "The only thing that keeps the extension running is your donations, please consider supporting the project." } } diff --git a/Extensions/combined/_locales/gr/messages.json b/Extensions/combined/_locales/gr/messages.json index 80e64fb..92b810d 100644 --- a/Extensions/combined/_locales/gr/messages.json +++ b/Extensions/combined/_locales/gr/messages.json @@ -33,7 +33,7 @@ "message": "ενημέρωση σε" }, "version30installed": { - "message": "Εκδοση 4.0.0.0 εγκαταστάθηκε" + "message": "Εκδοση 3.0.0.1 εγκαταστάθηκε" }, "whatsnew": { "message": "Τι είναι νέο;" @@ -47,4 +47,4 @@ "customNumberFormats": { "message": "Προσαρμοζόμενη μορφή αριθμών." } -} \ No newline at end of file +} diff --git a/Extensions/combined/_locales/it/messages.json b/Extensions/combined/_locales/it/messages.json index 9031ce0..4008a53 100644 --- a/Extensions/combined/_locales/it/messages.json +++ b/Extensions/combined/_locales/it/messages.json @@ -33,7 +33,7 @@ "message": "aggiorna a" }, "version30installed": { - "message": "Versione 4.0.0.0 installata" + "message": "Versione 3.0.0.1 installata" }, "whatsnew": { "message": "Cosa c'è di nuovo" diff --git a/Extensions/combined/_locales/ru/messages.json b/Extensions/combined/_locales/ru/messages.json index 1a2f59c..ce7002b 100644 --- a/Extensions/combined/_locales/ru/messages.json +++ b/Extensions/combined/_locales/ru/messages.json @@ -33,7 +33,7 @@ "message": "обновление до" }, "version30installed": { - "message": "Версия 4.0.0.0 установлена" + "message": "Версия 3.0.0.1 установлена" }, "whatsnew": { "message": "Что нового" @@ -46,5 +46,8 @@ }, "customNumberFormats": { "message": "Выбор формата чисел" + }, + "considerDonating": { + "message": "Единственный источник доходов позволяющий расширению продолжать работу - ваши пожертвования. Пожалуйста, поддержите нас и помогите нам развиваться." } } diff --git a/Extensions/combined/changelog/3/changelog_3.0.html b/Extensions/combined/changelog/3/changelog_3.0.html index d10562e..5cf4d58 100644 --- a/Extensions/combined/changelog/3/changelog_3.0.html +++ b/Extensions/combined/changelog/3/changelog_3.0.html @@ -31,7 +31,7 @@

__MSG_whatsnew__:

-
+
  • __MSG_shortsSupport__
  • __MSG_customColors__
  • @@ -40,6 +40,8 @@
  • __MSG_customNumberFormats__
+ +

__MSG_considerDonating__