Improve notice autohide behavior
Formerly it would act strangely when multiple notices were displayed in succession.
This commit is contained in:
@@ -21,17 +21,28 @@
|
|||||||
$('html, body').animate({scrollTop: top}, 300, "linear", function() {Danbooru.scrolling = false;});
|
$('html, body').animate({scrollTop: top}, 300, "linear", function() {Danbooru.scrolling = false;});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Danbooru.notice_timeout_id = undefined;
|
||||||
|
|
||||||
Danbooru.notice = function(msg, permanent) {
|
Danbooru.notice = function(msg, permanent) {
|
||||||
$('#notice').addClass("ui-state-highlight").removeClass("ui-state-error").fadeIn("fast").children("span").html(msg);
|
$('#notice').addClass("ui-state-highlight").removeClass("ui-state-error").fadeIn("fast").children("span").html(msg);
|
||||||
|
|
||||||
|
if (Danbooru.notice_timeout_id !== undefined) {
|
||||||
|
clearTimeout(Danbooru.notice_timeout_id)
|
||||||
|
}
|
||||||
if (!permanent) {
|
if (!permanent) {
|
||||||
setTimeout(function() {
|
Danbooru.notice_timeout_id = setTimeout(function() {
|
||||||
$("#close-notice-link").click();
|
$("#close-notice-link").click();
|
||||||
|
Danbooru.notice_timeout_id = undefined;
|
||||||
}, 6000);
|
}, 6000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.error = function(msg) {
|
Danbooru.error = function(msg) {
|
||||||
$('#notice').removeClass("ui-state-highlight").addClass("ui-state-error").fadeIn("fast").children("span").html(msg);
|
$('#notice').removeClass("ui-state-highlight").addClass("ui-state-error").fadeIn("fast").children("span").html(msg);
|
||||||
|
|
||||||
|
if (Danbooru.notice_timeout_id !== undefined) {
|
||||||
|
clearTimeout(Danbooru.notice_timeout_id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.is_subset = function(array, subarray) {
|
Danbooru.is_subset = function(array, subarray) {
|
||||||
|
|||||||
Reference in New Issue
Block a user