From: Marius Gavrilescu Date: Fri, 12 Dec 2014 15:57:38 +0000 (+0200) Subject: Highlight tracked user in standings X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=c0672e69e5ddca0808d0fe5cc3302886e69bcbe3;p=plack-app-gruntmaster.git Highlight tracked user in standings --- 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');