diff options
author | Dmitrii Selivanov <selivano.d@gmail.com> | 2022-04-27 00:05:26 +0300 |
---|---|---|
committer | Dmitrii Selivanov <selivano.d@gmail.com> | 2022-04-27 00:07:05 +0300 |
commit | a4806c1f478c444d365c06c45000a3c2143b2ed4 (patch) | |
tree | 5bb233294d7c1bc2a9d42f9e0f467d63f37e98c4 | |
parent | bdc28cad33e38e1cc48a891ad799419b62cd9df9 (diff) |
sendVideoIds removed, sponsor links updated
-rw-r--r-- | Extensions/combined/_locales/gr/messages.json (renamed from Extensions/combined/_locales/gr/manifest.json) | 0 | ||||
-rw-r--r-- | Extensions/combined/manifest-chrome.json | 2 | ||||
-rw-r--r-- | Extensions/combined/manifest-firefox.json | 2 | ||||
-rw-r--r-- | Extensions/combined/ryd.background.js | 20 | ||||
-rw-r--r-- | Extensions/combined/ryd.content-script.js | 3 | ||||
-rw-r--r-- | Extensions/combined/src/events.js | 27 | ||||
-rw-r--r-- | Extensions/combined/src/state.js | 74 | ||||
-rw-r--r-- | Website/pages/index.vue | 11 | ||||
-rw-r--r-- | Website/pages/links.vue | 2 |
9 files changed, 62 insertions, 79 deletions
diff --git a/Extensions/combined/_locales/gr/manifest.json b/Extensions/combined/_locales/gr/messages.json index 80e64fb..80e64fb 100644 --- a/Extensions/combined/_locales/gr/manifest.json +++ b/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 @@ </h3> </div> - <div id="cool-people" class="d-flex flex-column items-center py-8"> + <div id="biggest-supporters" class="d-flex flex-column items-center py-8"> <h3 class="mb-4"> <v-icon class="mb-2">mdi-heart</v-icon> 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 @@ <v-btn class="mainAltButton" :href="emailLink" target="_blank"> <v-icon style="margin-right: 0.5em">mdi-email</v-icon> - Email + selivano.d@gmail.com </v-btn> <p id="credits" class="flex-row no-wrap"> |