mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-24 07:13:02 +01:00
Update like number when like/dislike button is clicked
When like button is clicked, YT will update like count. This conflicts with user option "re-format like numbers". Force update like number. attn #561 #584
This commit is contained in:
1 parent
df742d0566
commit
260798d1a8
2 files changed
+33
No files matched your search
@@ -372,6 +372,14 @@ function likeClicked() {
|
||||
createRateBar(likesvalue, dislikesvalue);
|
||||
previousState = 1;
|
||||
}
|
||||
if (extConfig.numberDisplayReformatLikes === true) {
|
||||
const nativeLikes = getLikeCountFromButton();
|
||||
if (nativeLikes !== false) {
|
||||
setLikes(numberFormat(nativeLikes));
|
||||
} else {
|
||||
setLikes(numberFormat(storedData.likes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,6 +401,14 @@ function dislikeClicked() {
|
||||
setDislikes(numberFormat(dislikesvalue));
|
||||
createRateBar(likesvalue, dislikesvalue);
|
||||
previousState = 2;
|
||||
if (extConfig.numberDisplayReformatLikes === true) {
|
||||
const nativeLikes = getLikeCountFromButton();
|
||||
if (nativeLikes !== false) {
|
||||
setLikes(numberFormat(nativeLikes));
|
||||
} else {
|
||||
setLikes(numberFormat(storedData.likes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
extConfig,
|
||||
storedData,
|
||||
setLikes,
|
||||
getLikeCountFromButton,
|
||||
} from "./state";
|
||||
import { createRateBar } from "./bar";
|
||||
|
||||
@@ -41,6 +42,14 @@ function likeClicked() {
|
||||
createRateBar(storedData.likes, storedData.dislikes);
|
||||
storedData.previousState = NEUTRAL_STATE;
|
||||
}
|
||||
if (extConfig.numberDisplayReformatLikes === true) {
|
||||
const nativeLikes = getLikeCountFromButton();
|
||||
if (nativeLikes !== false) {
|
||||
setLikes(numberFormat(nativeLikes));
|
||||
} else {
|
||||
setLikes(numberFormat(storedData.likes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +74,14 @@ function dislikeClicked() {
|
||||
setDislikes(numberFormat(storedData.dislikes));
|
||||
createRateBar(storedData.likes, storedData.dislikes);
|
||||
storedData.previousState = DISLIKED_STATE;
|
||||
if (extConfig.numberDisplayReformatLikes === true) {
|
||||
const nativeLikes = getLikeCountFromButton();
|
||||
if (nativeLikes !== false) {
|
||||
setLikes(numberFormat(nativeLikes));
|
||||
} else {
|
||||
setLikes(numberFormat(storedData.likes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user