Disable all blacklists link: only create one cookie

#2518
This commit is contained in:
Toks
2015-10-07 00:02:04 -04:00
parent 49b8f6ca43
commit f92cfe3b43

View File

@@ -40,7 +40,9 @@
match.disabled = !match.disabled; match.disabled = !match.disabled;
var hash = tags.hash(); var hash = tags.hash();
if (match.disabled) { if (match.disabled) {
Danbooru.Cookie.put("b" + hash, "1", "session"); if (Danbooru.Cookie.get("dab") !== "1") {
Danbooru.Cookie.put("b" + hash, "1", "session");
}
$(e.target).addClass("blacklisted-active"); $(e.target).addClass("blacklisted-active");
} else { } else {
Danbooru.Cookie.remove("b" + hash); Danbooru.Cookie.remove("b" + hash);
@@ -91,10 +93,10 @@
$("#disable-all-blacklists").click(function(e) { $("#disable-all-blacklists").click(function(e) {
$("#disable-all-blacklists").hide(); $("#disable-all-blacklists").hide();
$("#re-enable-all-blacklists").show(); $("#re-enable-all-blacklists").show();
$("#blacklist-list a:not(.blacklisted-active)").click();
Danbooru.Cookie.put("dab", "1"); Danbooru.Cookie.put("dab", "1");
$("#blacklist-list a:not(.blacklisted-active)").click();
$.each(Danbooru.Blacklist.entries, function(i, entry) { $.each(Danbooru.Blacklist.entries, function(i, entry) {
Danbooru.Cookie.put("b" + entry.tags.hash(), "1", "session"); Danbooru.Cookie.remove("b" + entry.tags.hash());
}); });
e.preventDefault(); e.preventDefault();
}); });
@@ -102,8 +104,8 @@
$("#re-enable-all-blacklists").click(function(e) { $("#re-enable-all-blacklists").click(function(e) {
$("#disable-all-blacklists").show(); $("#disable-all-blacklists").show();
$("#re-enable-all-blacklists").hide(); $("#re-enable-all-blacklists").hide();
$("#blacklist-list a.blacklisted-active").click();
Danbooru.Cookie.put("dab", "0"); Danbooru.Cookie.put("dab", "0");
$("#blacklist-list a.blacklisted-active").click();
$.each(Danbooru.Blacklist.entries, function(i, entry) { $.each(Danbooru.Blacklist.entries, function(i, entry) {
Danbooru.Cookie.remove("b" + entry.tags.hash()); Danbooru.Cookie.remove("b" + entry.tags.hash());
}); });