From c0672e69e5ddca0808d0fe5cc3302886e69bcbe3 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Fri, 12 Dec 2014 17:57:38 +0200 Subject: [PATCH] Highlight tracked user in standings --- js/90-tracker.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/js/90-tracker.js b/js/90-tracker.js index 5c71e12..812a477 100644 --- a/js/90-tracker.js +++ b/js/90-tracker.js @@ -4,6 +4,11 @@ function tick() { return $('✔') } function xmark() { return $('✘') } + function clean_tracker(){ + $('.tracker-mark').detach(); + $('.tracker-info').removeClass('tracker-info info'); + } + function update_tracker(){ var data = localStorage.getItem('tracker_data'); var user = localStorage.getItem('tracker_username'); @@ -29,12 +34,12 @@ contests[e.contest] = 1; }); + clean_tracker(); $('#tracker_userlink').html(data.name); $('#tracker_solved').html(solvednr); $('#tracker_attempted').html(attemptednr); $('#tracker_contests').html(data.contests.length); - $('.tracker-mark').detach(); if(location.pathname == '/pb/') $('table').find('.name').find('a').each(function() { var id = $(this).attr('href').split('?', 2)[0]; @@ -53,10 +58,16 @@ if(location.pathname == '/log/') $('table').find('tbody').find('tr').each(function() { - if($(this).find('.owner').find('a').attr('href') != "/us/" + user) + if($(this).find('.owner').find('a').attr('href') != '/us/' + user) return; $(this).find('.id').append($(this).find('.r0').size() ? tick() : xmark()); }); + + if(location.pathname.match(/^\/st\//) || location.pathname == '/us/') + $('table').find('tbody').find('tr').each(function() { + if($(this).find('.user').find('a').attr('href') == '/us/' + user) + $(this).addClass('info tracker-info'); + }); } function start_tracking(user){ @@ -76,7 +87,7 @@ } function stop_tracking(){ - $('.tracker-mark').detach(); + clean_tracker(); localStorage.removeItem('tracker_username'); localStorage.removeItem('tracker_data'); $('#tracker_tracking').addClass('hidden'); -- 2.39.2