Simplify favorites link JS
Make use of the "is favorited" data to determine if the post is favorited instead of relying on the entire list of favorites.
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
}
|
||||
|
||||
Danbooru.Favorite.hide_or_show_add_to_favorites_link = function() {
|
||||
var favorites = Danbooru.meta("favorites");
|
||||
var current_user_id = Danbooru.meta("current-user-id");
|
||||
if (current_user_id == "") {
|
||||
$("#add-to-favorites").hide();
|
||||
@@ -17,8 +16,7 @@
|
||||
$("#remove-fav-button").hide();
|
||||
return;
|
||||
}
|
||||
var regexp = new RegExp("\\bfav:" + current_user_id + "\\b");
|
||||
if ((favorites != undefined) && (favorites.match(regexp))) {
|
||||
if ($("#image-container").length && $("#image-container").data("is-favorited") == true) {
|
||||
$("#add-to-favorites").hide();
|
||||
$("#add-fav-button").hide();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user