]> iEval git - plack-app-gruntmaster.git/commitdiff
Highlight tracked user in standings
authorMarius Gavrilescu <marius@ieval.ro>
Fri, 12 Dec 2014 15:57:38 +0000 (17:57 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Fri, 12 Dec 2014 15:59:05 +0000 (17:59 +0200)
js/90-tracker.js

index 5c71e12c5d5a165c98f8eb71bbe1e757a8918af1..812a4777e420c0bd4c0b477f48da047007852ce2 100644 (file)
@@ -4,6 +4,11 @@
        function tick()  { return $('<span class="tick tracker-mark">✔</span>') }
        function xmark() { return $('<span class="x tracker-mark">✘</span>')    }
 
+       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');
                        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];
 
                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');
This page took 0.024404 seconds and 4 git commands to generate.