From 88f302c648027e973cf8290486d6288c1dbab074 Mon Sep 17 00:00:00 2001
From: xamgore <xamgore@ya.ru>
Date: Wed, 19 Aug 2015 12:15:55 +0300
Subject: [PATCH] Interface improvements of event inspector

---
 media/js/event_inspector/eventInspector.js | 70 ++++++++++++----------
 1 file changed, 38 insertions(+), 32 deletions(-)

diff --git a/media/js/event_inspector/eventInspector.js b/media/js/event_inspector/eventInspector.js
index 5bbe6e802..51ee6d719 100644
--- a/media/js/event_inspector/eventInspector.js
+++ b/media/js/event_inspector/eventInspector.js
@@ -23,36 +23,42 @@ $(function()
 
 });
 
-
-
-
-function EventInspector_ShowMsg(text, type)
-{
-	if (inspectorCounter >= inspectorMax)
-		inspectorList.children().first().remove();
-
-	++inspectorCounter;
-
-	var MsgDiv = inspectorList.append('<div class="EventItem '+ type +'">' + text + '</div>').children().last();
-	setTimeout(
-		function(){
-			--inspectorCounter;
-			MsgDiv.animate(
-				{opacity: 0}, 
-				1000, 
-				function()
-				{
-					$(this).remove();
-
-				} 
-			);	
-		},
-		4000
-	);
-
-
+var EventInspector = {
+    TYPE: {
+        SUCCESS: 'success',
+        ERROR: 'error'
+    },
+
+    show: function (text, type) {
+        if (inspectorCounter >= inspectorMax)
+            inspectorList.children().first().remove();
+
+        ++inspectorCounter;
+
+        var MsgDiv = inspectorList.append('<div class="EventItem ' + type + '">' + text + '</div>').children().last();
+
+        setTimeout(
+            function () {
+                --inspectorCounter;
+                MsgDiv.animate({ opacity: 0 }, 1000,
+                    function () {
+                        $(this).remove();
+                    });
+            }, 4000);
+    },
+
+    error: function (text) {
+        this.show(text, 'error');
+    },
+
+    success: function (text) {
+        this.show(text, 'success');
+    }
+};
+
+/**
+ * @deprecated use EventInspector.show() instead
+ */
+function EventInspector_ShowMsg(text, type) {
+    EventInspector.show(text, type);
 }
-
-
-
-
-- 
GitLab