post tooltips: add disable button inside tooltip.
This commit is contained in:
@@ -83,6 +83,8 @@ Danbooru.PostTooltip.initialize = function () {
|
|||||||
Danbooru.PostTooltip.lostFocus = true;
|
Danbooru.PostTooltip.lostFocus = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on("click", ".post-tooltip-disable", Danbooru.PostTooltip.on_disable_tooltips);
|
||||||
|
|
||||||
// Hide tooltips when pressing keys or clicking thumbnails.
|
// Hide tooltips when pressing keys or clicking thumbnails.
|
||||||
$(document).on("keydown", Danbooru.PostTooltip.hide);
|
$(document).on("keydown", Danbooru.PostTooltip.hide);
|
||||||
$(document).on("click", Danbooru.PostTooltip.POST_SELECTOR, Danbooru.PostTooltip.hide);
|
$(document).on("click", Danbooru.PostTooltip.POST_SELECTOR, Danbooru.PostTooltip.hide);
|
||||||
@@ -106,4 +108,22 @@ Danbooru.PostTooltip.disabled = function (event) {
|
|||||||
return Danbooru.PostTooltip.isTouching || Danbooru.meta("disable-post-tooltips") === "true";
|
return Danbooru.PostTooltip.isTouching || Danbooru.meta("disable-post-tooltips") === "true";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Danbooru.PostTooltip.on_disable_tooltips = function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$(event.target).parents(".qtip").qtip("hide");
|
||||||
|
|
||||||
|
if (Danbooru.meta("current-user-id") === "") {
|
||||||
|
Danbooru.notice('<a href="/session/new">Login</a> to disable tooltips permanently');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax("/users/" + Danbooru.meta("current-user-id") + ".json", {
|
||||||
|
method: "PUT",
|
||||||
|
data: { "user[disable_post_tooltips]": "true" },
|
||||||
|
}).then(function() {
|
||||||
|
Danbooru.notice("Tooltips disabled; check your account settings to re-enable.");
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$(document).ready(Danbooru.PostTooltip.initialize);
|
$(document).ready(Danbooru.PostTooltip.initialize);
|
||||||
|
|||||||
@@ -66,6 +66,13 @@ $tooltip-height: 112px;
|
|||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post-tooltip-footer {
|
||||||
|
.post-tooltip-disable {
|
||||||
|
float: right;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:hover) a {
|
&:not(:hover) a {
|
||||||
|
|||||||
@@ -7,4 +7,8 @@
|
|||||||
<%= link_to "toptagger:#{@post.keeper.name}", user_path(@post.keeper) %>
|
<%= link_to "toptagger:#{@post.keeper.name}", user_path(@post.keeper) %>
|
||||||
<%= link_to_search "rating:#{@post.pretty_rating.downcase}" %>
|
<%= link_to_search "rating:#{@post.pretty_rating.downcase}" %>
|
||||||
<%= link_to_search "score:#{@post.score}" %>
|
<%= link_to_search "score:#{@post.score}" %>
|
||||||
|
|
||||||
|
<%= link_to "#", class: "post-tooltip-disable", title: "Disable enhanced tooltips" do %>
|
||||||
|
<i class="fas fa-times-circle"></i>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user