mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-25 15:53:01 +01:00
Merge pull request #270 from glenlalo/fix/268-check-if-user-signed-in
Signed-In Status Check is fixed for non English YouTube sites
This commit is contained in:
3 files changed
+12
-12
No files matched your search
@@ -91,11 +91,11 @@ function isVideoNotDisliked() {
|
||||
return getDislikeButton().classList.contains("style-text");
|
||||
}
|
||||
|
||||
function checkForSignInButton() {
|
||||
function checkForUserAvatarButton() {
|
||||
if (isMobile) {
|
||||
return;
|
||||
}
|
||||
if (document.querySelector('[aria-label="Sign in"]')) {
|
||||
if (document.querySelector('#avatar-btn')) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@@ -278,7 +278,7 @@ function setState() {
|
||||
}
|
||||
|
||||
function likeClicked() {
|
||||
if (checkForSignInButton() == false) {
|
||||
if (checkForUserAvatarButton() == true) {
|
||||
if (previousState == 1) {
|
||||
likesvalue--;
|
||||
createRateBar(likesvalue, dislikesvalue);
|
||||
@@ -299,7 +299,7 @@ function likeClicked() {
|
||||
}
|
||||
|
||||
function dislikeClicked() {
|
||||
if (checkForSignInButton() == false) {
|
||||
if (checkForUserAvatarButton() == true) {
|
||||
if (previousState == 3) {
|
||||
dislikesvalue++;
|
||||
setDislikes(numberFormat(dislikesvalue));
|
||||
|
||||
@@ -56,8 +56,8 @@ const NEUTRAL_STATE = "NEUTRAL_STATE";
|
||||
return getDislikeButton().classList.contains("style-text");
|
||||
}
|
||||
|
||||
function checkForSignInButton() {
|
||||
if (document.querySelector('[aria-label="Sign in"]')) {
|
||||
function checkForUserAvatarButton() {
|
||||
if (document.querySelector('#avatar-btn')) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@@ -132,7 +132,7 @@ const NEUTRAL_STATE = "NEUTRAL_STATE";
|
||||
}
|
||||
|
||||
function likeClicked() {
|
||||
if (checkForSignInButton() == false) {
|
||||
if (checkForUserAvatarButton() == true) {
|
||||
if (storedData.previousState == DISLIKED_STATE) {
|
||||
storedData.dislikes--;
|
||||
storedData.likes++;
|
||||
@@ -152,7 +152,7 @@ const NEUTRAL_STATE = "NEUTRAL_STATE";
|
||||
}
|
||||
|
||||
function dislikeClicked() {
|
||||
if (checkForSignInButton() == false) {
|
||||
if (checkForUserAvatarButton() == true) {
|
||||
if (storedData.previousState == NEUTRAL_STATE) {
|
||||
storedData.dislikes++;
|
||||
setDislikes(numberFormat(storedData.dislikes));
|
||||
|
||||
@@ -61,8 +61,8 @@ function isVideoNotDisliked() {
|
||||
|| getDislikeButton().querySelector('[aria-pressed="false"]') !== null;
|
||||
}
|
||||
|
||||
function checkForSignInButton() {
|
||||
if (document.querySelector('[aria-label="Sign in"]')) {
|
||||
function checkForUserAvatarButton() {
|
||||
if (document.querySelector('#avatar-btn')) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@@ -137,7 +137,7 @@ function setState() {
|
||||
}
|
||||
|
||||
function likeClicked() {
|
||||
if (checkForSignInButton() == false) {
|
||||
if (checkForUserAvatarButton() == true) {
|
||||
if (storedData.previousState == DISLIKED_STATE) {
|
||||
storedData.dislikes--;
|
||||
storedData.likes++;
|
||||
@@ -157,7 +157,7 @@ function likeClicked() {
|
||||
}
|
||||
|
||||
function dislikeClicked() {
|
||||
if (checkForSignInButton() == false) {
|
||||
if (checkForUserAvatarButton() == true) {
|
||||
if (storedData.previousState == NEUTRAL_STATE) {
|
||||
storedData.dislikes++;
|
||||
setDislikes(numberFormat(storedData.dislikes));
|
||||
|
||||
Reference in new issue
Block a user