diff --git a/extras/chrome_extension/js/background.js b/extras/chrome_extension/js/background.js index 2a1ce80656..8f3b80e866 100644 --- a/extras/chrome_extension/js/background.js +++ b/extras/chrome_extension/js/background.js @@ -1,6 +1,7 @@ var refreshTimer = null; var isFetching = null; -var storedEvents=new Array(); +var storedEvents = new Array(); +var notVisited = {}; $(window).load(function() { initilise(); @@ -13,6 +14,13 @@ function fetchEvents() { return storedEvents; } +function fetchNotVisited() { + return notVisited; +} + +function removeNotVisited(eventId) { + if (notVisited[eventId] === true) delete notVisited[eventId]; +} function main() { @@ -55,31 +63,43 @@ function getEvents(reply){ // If there is no events requested, mark all as visited if (storedEvents.length == 0) { - for(var k=0;k_ + var nums = id.split('_'); + var pid = "p_" + nums[1]; + + // Mark as visited if visited + if($(this).parent().css('font-weight') == '600') { + bg.removeNotVisited(nums[2]); + $(this).parent().css('font-weight', ''); + } + + // Toggle information if($('#' + pid).css('display') == 'none') { $('#' + pid).slideDown("fast"); $(this).attr({src: 'images/minus.gif'});