From c54c48b3fac27816f7acba19b71960d173888cc2 Mon Sep 17 00:00:00 2001
From: PavelBegunkov <asml.Silence@gmail.com>
Date: Tue, 23 Sep 2014 18:54:43 +0400
Subject: [PATCH] inspectors

---
 .../js/event_inspector/event_inspector.js     | 54 ++++++++++++++++---
 1 file changed, 48 insertions(+), 6 deletions(-)

diff --git a/~dev_rating/media/js/event_inspector/event_inspector.js b/~dev_rating/media/js/event_inspector/event_inspector.js
index fb18eb432..050d6a456 100644
--- a/~dev_rating/media/js/event_inspector/event_inspector.js
+++ b/~dev_rating/media/js/event_inspector/event_inspector.js
@@ -1,17 +1,55 @@
 var $ = jQuery;
-$(function() {
+var inspectorCounter = 0;
+var inspectorMax = 10;
+var inspectorList;
+
+$(function() 
+{
 	$('body').append('<div class="EventInspectorList"></div>');
+	inspectorList = $('div.EventInspectorList');
+	inspectorList.on('click', 'div.EventItem', function() 
+	{
+		$(this).remove();
+		--inspectorCounter;
+	})
+	.on('mouseenter', 'div.EventItem.success', function() 
+	{
+		$(this).css('border-color', '#96e186');
+	})
+	.on('mouseleave', 'div.EventItem.success', function(){ 
+		$(this).css('border-color', '#d6e9c6');
+	})
+	.on('mouseenter', 'div.EventItem.error', function() 
+	{
+		$(this).css('border-color', '#f0aeae');
+	})
+	.on('mouseleave', 'div.EventItem.error', function(){ 
+		$(this).css('border-color', '#f2dede');
+	});
+
 });
 
-function EventInspector_ShowMsg(text, type){
-	var MsgDiv = $('.EventInspectorList').append('<div class="EventItem '+ type +'">' + text + '</div>').children().last();
+
+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(){
-			MsgDiv.animate({opacity: 0}, 1000, function() {$(this).remove()});
+			--inspectorCounter;
+			MsgDiv.animate(
+				{opacity: 0}, 
+				1000, 
+				function(){$(this).remove();} 
+			);	
 		},
-		5000
+		4000
 	);
-	
+
     $(window).scroll(function () {
         if ($(this).scrollTop() > 40) {
 			$('.EventInspectorList').css('top', '20px');
@@ -20,3 +58,7 @@ function EventInspector_ShowMsg(text, type){
         }
     });
 }
+
+
+
+
-- 
GitLab