This commit is contained in:
thereaper90917 committed 2021-12-27 20:19:56 +02:00
commit 55a350c761
9 files changed
+84 -19

No files matched your search

@@ -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) {
+1
View File
@@ -24,6 +24,7 @@
<img id="server-status" src="./icons/server.svg" alt="" />
<p>API Status: <span id="status"></span></p>
<p>by Dmitrii Selivanov & Community</p>
<p id="ext-version"></p>
<button id="link_website">Website</button>
<button id="link_github">GitHub</button>
+10
View File
@@ -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",
+16
View File
@@ -0,0 +1,16 @@
# Extension Source
## Guide to Compiling
## Compiling to Development (Testing)
<ol>
<li>Go to the root directory of the project</li>
<li>Run <code>npm i</code> to install all project dependancies (if not done so already)</li>
<li>run <code>npm run dev</code> to compile the extension to the <code>~/Extensions/combined/dist/</code> folder.</li>
</ol>
## Compiling to Production (Final Release)
<ol>
<li>Go to the root directory of the project</li>
<li>Run <code>npm i</code> to install all project dependancies (if not done so already)</li>
<li>run <code>npm run build</code> to compile the extension to the <code>~/Extensions/combined/dist/</code> folder.</li>
</ol>
@@ -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;