mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-29 09:27:54 +01:00
Merge branch 'main' into fix-onInstalled
This commit is contained in:
29 files changed
+615
-147
No files matched your search
@@ -9,10 +9,9 @@ let extConfig = {
|
||||
coloredThumbs: false,
|
||||
coloredBar: false,
|
||||
colorTheme: "classic", // classic, accessible, neon
|
||||
// coloredThumbs: false,
|
||||
// coloredBar: false,
|
||||
numberDisplayFormat: "compactShort", // compactShort, compactLong, standard
|
||||
numberDisplayRoundDown: true, // locale 'de' shows exact numbers by default
|
||||
numberDisplayReformatLikes: false, // use existing (native) likes number
|
||||
};
|
||||
|
||||
if (isChrome()) api = chrome;
|
||||
@@ -86,6 +85,18 @@ api.runtime.onInstalled.addListener((details) => {
|
||||
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});
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
async function sendVote(videoId, vote) {
|
||||
api.storage.sync.get(null, async (storageResult) => {
|
||||
if (!storageResult.userId || !storageResult.registrationConfirmed) {
|
||||
@@ -271,6 +282,9 @@ function storageChangeHandler(changes, area) {
|
||||
if (changes.numberDisplayFormat !== undefined) {
|
||||
handleNumberDisplayFormatChangeEvent(changes.numberDisplayFormat.newValue);
|
||||
}
|
||||
if (changes.numberDisplayReformatLikes !== undefined) {
|
||||
handleNumberDisplayReformatLikesChangeEvent(changes.numberDisplayReformatLikes.newValue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleDisableVoteSubmissionChangeEvent(value) {
|
||||
@@ -313,6 +327,10 @@ function handleColorThemeChangeEvent(value) {
|
||||
extConfig.colorTheme = value;
|
||||
}
|
||||
|
||||
function handleNumberDisplayReformatLikesChangeEvent(value) {
|
||||
extConfig.numberDisplayReformatLikes = value;
|
||||
}
|
||||
|
||||
api.storage.onChanged.addListener(storageChangeHandler);
|
||||
|
||||
function initExtConfig() {
|
||||
@@ -322,6 +340,7 @@ function initExtConfig() {
|
||||
initializeColorTheme();
|
||||
initializeNumberDisplayFormat();
|
||||
initializeNumberDisplayRoundDown();
|
||||
initializeNumberDisplayReformatLikes();
|
||||
}
|
||||
|
||||
function initializeDisableVoteSubmission() {
|
||||
@@ -385,6 +404,16 @@ function initializeNumberDisplayFormat() {
|
||||
});
|
||||
}
|
||||
|
||||
function initializeNumberDisplayReformatLikes() {
|
||||
api.storage.sync.get(["numberDisplayReformatLikes"], (res) => {
|
||||
if (res.numberDisplayReformatLikes === undefined) {
|
||||
api.storage.sync.set({ numberDisplayReformatLikes: false });
|
||||
} else {
|
||||
extConfig.numberDisplayReformatLikes = res.numberDisplayReformatLikes;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function isChrome() {
|
||||
return typeof chrome !== "undefined" && typeof chrome.runtime !== "undefined";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user