finish implementation

This commit is contained in:
Yvon Cui committed 2022-01-19 00:40:06 -05:00
1 parent 3cd5b93b56
commit 54e9267655
5 files changed
+111 -17

No files matched your search

+42 -2
View File
@@ -1,6 +1,12 @@
import { getLikeButton, getDislikeButton, getButtons } from "./buttons";
import { createRateBar } from "./bar";
import { getBrowser, getVideoId, cLog, numberFormat } from "./utils";
import {
getBrowser,
getVideoId,
cLog,
numberFormat,
getColorFromTheme,
} from "./utils";
import { sendVideoIds } from "./events";
//TODO: Do not duplicate here and in ryd.background.js
@@ -102,7 +108,8 @@ function processResponse(response, storedData) {
storedData.likes = getLikeCountFromButton() || parseInt(response.likes);
createRateBar(storedData.likes, storedData.dislikes);
if (extConfig.coloredThumbs === true) {
// TODO: colorize thumbs
getLikeButton().style.color = getColorFromTheme(true);
getDislikeButton().style.color = getColorFromTheme(false);
}
}
@@ -163,6 +170,39 @@ function initializeDisableVoteSubmission() {
});
}
function initializeColoredThumbs() {
getBrowser().storage.sync.get(['coloredThumbs'], (res) => {
if (res.coloredThumbs === undefined) {
getBrowser().storage.sync.set({coloredThumbs: false});
}
else {
extConfig.coloredThumbs = res.coloredThumbs;
}
});
}
function initializeColoredBar() {
getBrowser().storage.sync.get(['coloredBar'], (res) => {
if (res.coloredBar === undefined) {
getBrowser().storage.sync.set({coloredBar: false});
}
else {
extConfig.coloredBar = res.coloredBar;
}
});
}
function initializeColorTheme() {
getBrowser().storage.sync.get(['colorTheme'], (res) => {
if (res.colorTheme === undefined) {
getBrowser().storage.sync.set({colorTheme: false});
}
else {
extConfig.colorTheme = res.colorTheme;
}
});
}
export {
isMobile,
isVideoDisliked,