mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-22 14:23:01 +01:00
refactor: extract hardcoded values to const
This commit is contained in:
1 parent
c1a12b0bf7
commit
599f35a185
3 files changed
+33
-21
No files matched your search
@@ -19,6 +19,10 @@
|
||||
// @grant GM_addStyle
|
||||
// @run-at document-end
|
||||
// ==/UserScript==
|
||||
const LIKED_STATE = "LIKED_STATE";
|
||||
const DISLIKED_STATE = "DISLIKED_STATE";
|
||||
const NEUTRAL_STATE = "NEUTRAL_STATE";
|
||||
|
||||
function cLog(text, subtext = '') {
|
||||
subtext = subtext.trim() === '' ? '' : `(${subtext})`;
|
||||
console.log(`[Return YouTube Dislikes] ${text} ${subtext}`);
|
||||
@@ -60,12 +64,12 @@ function isVideoNotDisliked() {
|
||||
|
||||
function getState() {
|
||||
if (isVideoLiked()) {
|
||||
return "liked";
|
||||
return LIKED_STATE;
|
||||
}
|
||||
if (isVideoDisliked()) {
|
||||
return "disliked";
|
||||
return DISLIKED_STATE;
|
||||
}
|
||||
return "neutral";
|
||||
return NEUTRAL_STATE;
|
||||
}
|
||||
|
||||
function setLikes(likesCount) {
|
||||
|
||||
Reference in new issue
Block a user