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 FavoriteFlipper = false;
|
||||||
let BoostFlipper = false;
|
let BoostFlipper = false;
|
||||||
|
let Favoritable = false;
|
||||||
|
let Boostable = false;
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
let website = document.location.href.split("website=")[1];
|
let website = document.location.href.split("website=")[1];
|
||||||
|
@ -25,6 +27,10 @@ let EmbedCounter = 0;
|
||||||
|
|
||||||
// Button stuff
|
// Button stuff
|
||||||
Favorite.onclick = (event) => {
|
Favorite.onclick = (event) => {
|
||||||
|
if (Favoritable == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Favoritable = false;
|
||||||
if (website == "Mastodon") {
|
if (website == "Mastodon") {
|
||||||
MastodonAPI.CreateFavorite(post.id, post.favourited);
|
MastodonAPI.CreateFavorite(post.id, post.favourited);
|
||||||
} else if (website == "Bluesky") {
|
} else if (website == "Bluesky") {
|
||||||
|
@ -34,6 +40,10 @@ Favorite.onclick = (event) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
Boost.onclick = (event) => {
|
Boost.onclick = (event) => {
|
||||||
|
if (Boostable == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Boostable = false;
|
||||||
if (website == "Mastodon") {
|
if (website == "Mastodon") {
|
||||||
MastodonAPI.CreateReblog(post.id, post.reblogged);
|
MastodonAPI.CreateReblog(post.id, post.reblogged);
|
||||||
} else if (website == "Bluesky") {
|
} else if (website == "Bluesky") {
|
||||||
|
@ -271,6 +281,7 @@ function SetFavorite() {
|
||||||
} else {
|
} else {
|
||||||
Favorite.innerHTML = "Unfavorite...";
|
Favorite.innerHTML = "Unfavorite...";
|
||||||
}
|
}
|
||||||
|
Favoritable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetBoost() {
|
function SetBoost() {
|
||||||
|
@ -280,6 +291,7 @@ function SetBoost() {
|
||||||
} else {
|
} else {
|
||||||
Boost.innerHTML = "Unboost...";
|
Boost.innerHTML = "Unboost...";
|
||||||
}
|
}
|
||||||
|
Boostable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Functions stolen form elsewhere
|
// Functions stolen form elsewhere
|
||||||
|
|
Loading…
Add table
Reference in a new issue