diff --git a/js/imgur.js b/js/imgur.js
index f743bc3..3162cbc 100644
--- a/js/imgur.js
+++ b/js/imgur.js
@@ -153,7 +153,7 @@ weechat.factory('imgur', ['$rootScope', 'settings', function($rootScope, setting
xhttp.onload = function() {
// Check state and response status
if(xhttp.status === 200) {
- callback();
+ callback(deletehash);
} else {
showErrorMsg();
}
diff --git a/js/inputbar.js b/js/inputbar.js
index f84afac..b2725f9 100644
--- a/js/inputbar.js
+++ b/js/inputbar.js
@@ -280,12 +280,20 @@ weechat.directive('inputBar', function() {
}
};
- var deleteCallback = function () {
+ var deleteCallback = function (deleteHash) {
// Image got sucessfully deleted.
// Show toast with delete link
var toastDeleted = $compile('
Successfully deleted.
')($scope)[0];
document.body.appendChild(toastDeleted);
setTimeout(function() { document.body.removeChild(toastDeleted); }, 5000);
+
+ // Try to remove the toast with the deletion link (it stays 15s
+ // instead of the 5 of the deletion notification, so it could
+ // come back beneath it, which would be confusing)
+ var pasteToast = document.querySelector("[data-imgur-deletehash='" + deleteHash + "']");
+ if (!!pasteToast) {
+ document.body.removeChild(pasteToast);
+ }
}
$scope.imgurDelete = function (deleteHash) {
@@ -774,7 +782,7 @@ weechat.directive('inputBar', function() {
}
// Show toast with delete link
- var toastImgur = $compile('')($scope)[0];
+ var toastImgur = $compile('')($scope)[0];
document.body.appendChild(toastImgur);
setTimeout(function() { document.body.removeChild(toastImgur); }, 15000);