diff --git a/src/static/css/pad/gritter.css b/src/static/css/pad/gritter.css
index 07606233..e17367ef 100644
--- a/src/static/css/pad/gritter.css
+++ b/src/static/css/pad/gritter.css
@@ -14,13 +14,15 @@
.gritter-item.popup {
position: relative;
- max-width: 450px;
visibility: visible;
right: auto !important;
left: auto !important;
top: auto;
bottom: auto;
}
+.gritter-item.popup:not(.error) {
+ max-width: 450px;
+}
.gritter-item .popup-content {
display: flex;
diff --git a/src/static/js/pad_utils.js b/src/static/js/pad_utils.js
index d42cbb02..fbbefdae 100644
--- a/src/static/js/pad_utils.js
+++ b/src/static/js/pad_utils.js
@@ -526,12 +526,30 @@ function setupGlobalExceptionHandler() {
{
var errorId = randomString(20);
var userAgent = padutils.escapeHtml(navigator.userAgent);
- if ($("#editorloadingbox").attr("display") != "none"){
- //show javascript errors to the user
- $("#editorloadingbox").css("padding", "10px");
- $("#editorloadingbox").css("padding-top", "45px");
- $("#editorloadingbox").html("
An error occurredThe error was reported with the following id: '" + errorId + "'
Please press and hold Ctrl and press F5 to reload this page, if the problem persists please send this error message to your webmaster: '"
- + "ErrorId: " + errorId + "
URL: " + padutils.escapeHtml(window.location.href) + "
UserAgent: " + userAgent + "
" + msg + " in " + url + " at line " + linenumber + "'
");
+
+ var msgAlreadyVisible = false;
+ $('.gritter-item .error-msg').each(function() {
+ if ($(this).text() === msg) {
+ msgAlreadyVisible = true;
+ }
+ });
+
+ if (!msgAlreadyVisible) {
+ errorMsg = "Please press and hold Ctrl and press F5 to reload this page \
+ If the problem persists please send this error message to your webmaster: \
+ \
+ ErrorId: " + errorId + "
\
+ URL: " + padutils.escapeHtml(window.location.href) + "
\
+ UserAgent: " + userAgent + "
\
+ "+ msg + " in " + url + " at line " + linenumber + '
';
+
+ $.gritter.add({
+ title: "An error occurred",
+ text: errorMsg,
+ class_name: "error",
+ position: 'bottom',
+ sticky: true,
+ });
}
//send javascript errors to the server