race condition potential fix
This commit is contained in:
parent
0195462b55
commit
2401f9b958
1 changed files with 12 additions and 0 deletions
|
@ -10,6 +10,8 @@ let Reply = document.getElementsByClassName("Reply")[0];
|
|||
|
||||
let FavoriteFlipper = false;
|
||||
let BoostFlipper = false;
|
||||
let Favoritable = false;
|
||||
let Boostable = false;
|
||||
|
||||
// Variables
|
||||
let website = document.location.href.split("website=")[1];
|
||||
|
@ -25,6 +27,10 @@ let EmbedCounter = 0;
|
|||
|
||||
// Button stuff
|
||||
Favorite.onclick = (event) => {
|
||||
if (Favoritable == false) {
|
||||
return;
|
||||
}
|
||||
Favoritable = false;
|
||||
if (website == "Mastodon") {
|
||||
MastodonAPI.CreateFavorite(post.id, post.favourited);
|
||||
} else if (website == "Bluesky") {
|
||||
|
@ -34,6 +40,10 @@ Favorite.onclick = (event) => {
|
|||
}
|
||||
|
||||
Boost.onclick = (event) => {
|
||||
if (Boostable == false) {
|
||||
return;
|
||||
}
|
||||
Boostable = false;
|
||||
if (website == "Mastodon") {
|
||||
MastodonAPI.CreateReblog(post.id, post.reblogged);
|
||||
} else if (website == "Bluesky") {
|
||||
|
@ -271,6 +281,7 @@ function SetFavorite() {
|
|||
} else {
|
||||
Favorite.innerHTML = "Unfavorite...";
|
||||
}
|
||||
Favoritable = true;
|
||||
}
|
||||
|
||||
function SetBoost() {
|
||||
|
@ -280,6 +291,7 @@ function SetBoost() {
|
|||
} else {
|
||||
Boost.innerHTML = "Unboost...";
|
||||
}
|
||||
Boostable = true;
|
||||
}
|
||||
|
||||
// Functions stolen form elsewhere
|
||||
|
|
Loading…
Add table
Reference in a new issue