mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-10-28 07:40:27 +01:00
2.1.0 release
This commit is contained in:
@@ -5,4 +5,4 @@ const extension = chrome.runtime.getManifest();
|
||||
const ver = document.getElementById("extension-version");
|
||||
|
||||
//--- Set Debug Elements ---//
|
||||
ver.innerHTML = extension.version;
|
||||
ver.innerHTML = extension.version;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Return YouTube Dislike",
|
||||
"description": "Returns ability to see dislikes",
|
||||
"version": "2.0.0.3",
|
||||
"version": "2.1.0.0",
|
||||
"manifest_version": 3,
|
||||
"background": {
|
||||
"service_worker": "ryd.background.js"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Return YouTube Dislike",
|
||||
"description": "Returns ability to see dislikes",
|
||||
"version": "2.0.0.3",
|
||||
"version": "2.1.0.0",
|
||||
"manifest_version": 2,
|
||||
"background": {
|
||||
"scripts": ["ryd.background.js"]
|
||||
|
||||
@@ -20,31 +20,48 @@
|
||||
/>
|
||||
<path d="m8 12.5 5.1-2.9L8 6.7v5.8z" fill="#fff" />
|
||||
</svg>
|
||||
<h1 style="margin-bottom: .75rem;">Return YouTube Dislike</h1>
|
||||
<p style="color: var(--lightGrey);">by Dmitrii Selivanov & Community</p>
|
||||
|
||||
<h1 style="margin-bottom: 0.75rem">Return YouTube Dislike</h1>
|
||||
<p style="color: var(--lightGrey)">by Dmitrii Selivanov & Community</p>
|
||||
|
||||
<button id="link_website">Website</button>
|
||||
<button id="link_github">GitHub</button>
|
||||
<button id="link_discord">Discord</button>
|
||||
|
||||
|
||||
<br />
|
||||
|
||||
<button style="margin-top: .3rem" id="link_faq">FAQ</button>
|
||||
<button style="margin-top: .3em" id="link_donate">Donate</button>
|
||||
<button style="margin-top: 0.3rem" id="link_faq">FAQ</button>
|
||||
<button style="margin-top: 0.3em" id="link_donate">Donate</button>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<p style="display: inline-block;">API Status: <b id="status"></b></p>
|
||||
<img id="server-status" style="display: inline-block; width: .75rem; height: .75rem;" src="./icons/server.svg" alt="" />
|
||||
|
||||
|
||||
<p style="display: none">API Status: <b id="status"></b></p>
|
||||
<img
|
||||
id="server-status"
|
||||
style="display: none; width: 0.75rem; height: 0.75rem"
|
||||
src="./icons/server.svg"
|
||||
alt=""
|
||||
/>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
</center>
|
||||
|
||||
<!-- top-right -->
|
||||
<button id="advancedToggle">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"><rect fill="none" height="24" width="24"/><path d="M19.5,12c0-0.23-0.01-0.45-0.03-0.68l1.86-1.41c0.4-0.3,0.51-0.86,0.26-1.3l-1.87-3.23c-0.25-0.44-0.79-0.62-1.25-0.42 l-2.15,0.91c-0.37-0.26-0.76-0.49-1.17-0.68l-0.29-2.31C14.8,2.38,14.37,2,13.87,2h-3.73C9.63,2,9.2,2.38,9.14,2.88L8.85,5.19 c-0.41,0.19-0.8,0.42-1.17,0.68L5.53,4.96c-0.46-0.2-1-0.02-1.25,0.42L2.41,8.62c-0.25,0.44-0.14,0.99,0.26,1.3l1.86,1.41 C4.51,11.55,4.5,11.77,4.5,12s0.01,0.45,0.03,0.68l-1.86,1.41c-0.4,0.3-0.51,0.86-0.26,1.3l1.87,3.23c0.25,0.44,0.79,0.62,1.25,0.42 l2.15-0.91c0.37,0.26,0.76,0.49,1.17,0.68l0.29,2.31C9.2,21.62,9.63,22,10.13,22h3.73c0.5,0,0.93-0.38,0.99-0.88l0.29-2.31 c0.41-0.19,0.8-0.42,1.17-0.68l2.15,0.91c0.46,0.2,1,0.02,1.25-0.42l1.87-3.23c0.25-0.44,0.14-0.99-0.26-1.3l-1.86-1.41 C19.49,12.45,19.5,12.23,19.5,12z M12.04,15.5c-1.93,0-3.5-1.57-3.5-3.5s1.57-3.5,3.5-3.5s3.5,1.57,3.5,3.5S13.97,15.5,12.04,15.5z"/></svg>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
enable-background="new 0 0 24 24"
|
||||
height="24px"
|
||||
viewBox="0 0 24 24"
|
||||
width="24px"
|
||||
fill="currentColor"
|
||||
>
|
||||
<rect fill="none" height="24" width="24" />
|
||||
<path
|
||||
d="M19.5,12c0-0.23-0.01-0.45-0.03-0.68l1.86-1.41c0.4-0.3,0.51-0.86,0.26-1.3l-1.87-3.23c-0.25-0.44-0.79-0.62-1.25-0.42 l-2.15,0.91c-0.37-0.26-0.76-0.49-1.17-0.68l-0.29-2.31C14.8,2.38,14.37,2,13.87,2h-3.73C9.63,2,9.2,2.38,9.14,2.88L8.85,5.19 c-0.41,0.19-0.8,0.42-1.17,0.68L5.53,4.96c-0.46-0.2-1-0.02-1.25,0.42L2.41,8.62c-0.25,0.44-0.14,0.99,0.26,1.3l1.86,1.41 C4.51,11.55,4.5,11.77,4.5,12s0.01,0.45,0.03,0.68l-1.86,1.41c-0.4,0.3-0.51,0.86-0.26,1.3l1.87,3.23c0.25,0.44,0.79,0.62,1.25,0.42 l2.15-0.91c0.37,0.26,0.76,0.49,1.17,0.68l0.29,2.31C9.2,21.62,9.63,22,10.13,22h3.73c0.5,0,0.93-0.38,0.99-0.88l0.29-2.31 c0.41-0.19,0.8-0.42,1.17-0.68l2.15,0.91c0.46,0.2,1,0.02,1.25-0.42l1.87-3.23c0.25-0.44,0.14-0.99-0.26-1.3l-1.86-1.41 C19.49,12.45,19.5,12.23,19.5,12z M12.04,15.5c-1.93,0-3.5-1.57-3.5-3.5s1.57-3.5,3.5-3.5s3.5,1.57,3.5,3.5S13.97,15.5,12.04,15.5z"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<!-- bottom-right -->
|
||||
@@ -78,7 +95,6 @@
|
||||
<span class="switchLabel">5-star Rating Bar</span>
|
||||
</label>
|
||||
<br /> -->
|
||||
|
||||
|
||||
<!-- <label class="switch">
|
||||
<input type="checkbox" id="disable_api_unlisted" />
|
||||
|
||||
@@ -28,12 +28,17 @@ api.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
} else if (request.message == "set_state") {
|
||||
// chrome.identity.getAuthToken({ interactive: true }, function (token) {
|
||||
let token = "";
|
||||
fetch(`${apiUrl}/votes?videoId=${request.videoId}&likeCount=${request.likeCount || ''}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
},
|
||||
})
|
||||
fetch(
|
||||
`${apiUrl}/votes?videoId=${request.videoId}&likeCount=${
|
||||
request.likeCount || ""
|
||||
}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((response) => response.json())
|
||||
.then((response) => {
|
||||
sendResponse(response);
|
||||
@@ -271,4 +276,4 @@ function isChrome() {
|
||||
|
||||
function isFirefox() {
|
||||
return typeof browser !== "undefined" && typeof browser.runtime !== "undefined";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ import { createRateBar } from "./bar";
|
||||
import { getBrowser, getVideoId, cLog, numberFormat } from "./utils";
|
||||
import { sendVideoIds } from "./events";
|
||||
|
||||
//TODO: Do not duplicate here and in ryd.background.js
|
||||
const apiUrl = "https://returnyoutubedislikeapi.com";
|
||||
const LIKED_STATE = "LIKED_STATE";
|
||||
const DISLIKED_STATE = "DISLIKED_STATE";
|
||||
const NEUTRAL_STATE = "NEUTRAL_STATE";
|
||||
@@ -98,7 +100,7 @@ function processResponse(response, storedData) {
|
||||
createRateBar(storedData.likes, storedData.dislikes);
|
||||
}
|
||||
|
||||
function setState(storedData) {
|
||||
async function setState(storedData) {
|
||||
storedData.previousState = isVideoDisliked()
|
||||
? DISLIKED_STATE
|
||||
: isVideoLiked()
|
||||
@@ -106,25 +108,29 @@ function setState(storedData) {
|
||||
: NEUTRAL_STATE;
|
||||
let statsSet = false;
|
||||
|
||||
getBrowser().runtime.sendMessage(
|
||||
let videoId = getVideoId(window.location.href);
|
||||
let likeCount = getLikeCountFromButton() || null;
|
||||
|
||||
let response = await fetch(
|
||||
`${apiUrl}/votes?videoId=${videoId}&likeCount=${likeCount || ""}`,
|
||||
{
|
||||
message: "set_state",
|
||||
videoId: getVideoId(window.location.href),
|
||||
state: getState(storedData).current,
|
||||
likeCount: getLikeCountFromButton() || null,
|
||||
},
|
||||
function (response) {
|
||||
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);
|
||||
}
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
)
|
||||
.then((response) => response.json())
|
||||
.catch();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
function setInitialState() {
|
||||
|
||||
+12
-4
@@ -13,7 +13,7 @@ module.exports = {
|
||||
minimize: false,
|
||||
},
|
||||
watchOptions: {
|
||||
ignored: "./Extensions/combined/dist/*"
|
||||
ignored: "./Extensions/combined/dist/*",
|
||||
},
|
||||
plugins: [
|
||||
// exclude locale files in moment
|
||||
@@ -50,15 +50,23 @@ module.exports = {
|
||||
{
|
||||
from: "./Extensions/combined/manifest-firefox.json",
|
||||
to: "./firefox/manifest.json",
|
||||
}
|
||||
},
|
||||
],
|
||||
}),
|
||||
new FileManagerPlugin({
|
||||
events: {
|
||||
onEnd: {
|
||||
copy: [
|
||||
{ source: "./Extensions/combined/dist/bundled-content-script.js", destination: "./Extensions/combined/dist/firefox/bundled-content-script.js" },
|
||||
{ source: "./Extensions/combined/dist/bundled-content-script.js", destination: "./Extensions/combined/dist/chrome/bundled-content-script.js" },
|
||||
{
|
||||
source: "./Extensions/combined/dist/bundled-content-script.js",
|
||||
destination:
|
||||
"./Extensions/combined/dist/firefox/bundled-content-script.js",
|
||||
},
|
||||
{
|
||||
source: "./Extensions/combined/dist/bundled-content-script.js",
|
||||
destination:
|
||||
"./Extensions/combined/dist/chrome/bundled-content-script.js",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user