File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed
Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ class Activity {
66 if ( tab . id && ( tab . id != 0 ) ) {
77 tabs = tabs || [ ] ;
88 var domain = this . extractHostname ( tab . url ) ;
9+ this . setCurrentActiveTab ( domain ) ;
910 if ( this . isNewUrl ( domain ) ) {
1011 var favicon = tab . favIconUrl ;
1112 if ( favicon === undefined ) {
@@ -16,6 +17,7 @@ class Activity {
1617 }
1718 }
1819 }
20+ else this . clearCurrentActiveTab ( ) ;
1921 }
2022
2123 isValidPage ( tab ) {
@@ -65,4 +67,12 @@ class Activity {
6567 }
6668 }
6769 }
70+
71+ setCurrentActiveTab ( domain ) {
72+ currentTab = domain ;
73+ }
74+
75+ clearCurrentActiveTab ( ) {
76+ currentTab = '' ;
77+ }
6878} ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
33var tabs = [ ] ;
4+ var currentTab ;
45var activity = new Activity ( ) ;
56var storage = new LocalStorage ( ) ;
67
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ function getTabsFromStorage(tabs) {
1818
1919 totalTime = setTotalTime ( tabs ) ;
2020
21+ var currentTab = getCurrentTab ( ) ;
22+
2123 for ( var i = 0 ; i < tabs . length ; i ++ ) {
2224 var div = document . createElement ( 'div' ) ;
2325 div . classList . add ( 'inline-flex' ) ;
@@ -30,6 +32,9 @@ function getTabsFromStorage(tabs) {
3032 var spanUrl = document . createElement ( 'span' ) ;
3133 spanUrl . classList . add ( 'span-url' ) ;
3234 spanUrl . innerText = tabs [ i ] . url ;
35+ if ( tabs [ i ] . url == currentTab ) {
36+ spanUrl . classList . add ( 'span-active-url' ) ;
37+ }
3338
3439 var spanPercentage = document . createElement ( 'span' ) ;
3540 spanPercentage . classList . add ( 'span-percentage' ) ;
@@ -57,4 +62,8 @@ function setTotalTime(tabs) {
5762
5863function setPercentage ( time ) {
5964 return ( ( time / totalTime ) * 100 ) . toFixed ( 2 ) + '%' ;
65+ }
66+
67+ function getCurrentTab ( ) {
68+ return chrome . extension . getBackgroundPage ( ) . currentTab ;
6069}
Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ body {
2020 cursor : pointer;
2121}
2222
23+ .span-active-url {
24+ font-weight : 700 ;
25+ }
26+
2327.span-url : hover {
2428 color : rgb (107 , 107 , 107 );
2529}
You can’t perform that action at this time.
0 commit comments