From 76dfd3cfa0855d446e07be0030514f34f8aa696e Mon Sep 17 00:00:00 2001 From: fermin831 Date: Tue, 28 Nov 2017 10:36:38 +0100 Subject: [PATCH] Display not visited events bold on chrome extension --- extras/chrome_extension/js/background.js | 42 +++++++++++++++++------- extras/chrome_extension/js/popup.js | 22 ++++++++++--- 2 files changed, 49 insertions(+), 15 deletions(-) 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'});