diff --git a/~dev_rating/media/js/event_inspector/event_inspector.js b/~dev_rating/media/js/event_inspector/event_inspector.js index fb18eb43293de7979a875ea3093757370174334c..050d6a4563180789daaa685240b7aac68d23e38f 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){ } }); } + + + +