File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 1+ const boardUrl = 'trello.com/b/' ;
2+
13chrome . tabs . onUpdated . addListener ( function ( tabId , changeInfo , tab ) {
24 // Match Trello board pages only
3- var regex = new RegExp ( / .* : \/ \/ t r e l l o \. c o m \/ b \/ .* / ) ;
4- var match = regex . exec ( tab . url ) ;
5+ const match = tab . url . includes ( boardUrl ) ;
56
67 // Setup page for layout changes and show page action
78 if ( match ) {
89 chrome . tabs . executeScript ( null , {
910 file : 'js/setup-css.js'
1011 } ) ;
11- chrome . pageAction . show ( tabId ) ;
12- } else {
13- chrome . pageAction . hide ( tabId ) ;
1412 }
1513} ) ;
1614
@@ -19,3 +17,20 @@ chrome.pageAction.onClicked.addListener(function(tab) {
1917 file : 'js/toggle-layout.js'
2018 } ) ;
2119} ) ;
20+
21+ chrome . runtime . onInstalled . addListener ( function ( details ) {
22+ chrome . declarativeContent . onPageChanged . removeRules ( undefined , function ( ) {
23+ chrome . declarativeContent . onPageChanged . addRules ( [ {
24+ conditions : [
25+ new chrome . declarativeContent . PageStateMatcher ( {
26+ pageUrl : {
27+ urlContains : boardUrl
28+ }
29+ } )
30+ ] ,
31+ actions : [
32+ new chrome . declarativeContent . ShowPageAction ( )
33+ ]
34+ } ] ) ;
35+ } ) ;
36+ } ) ;
Original file line number Diff line number Diff line change 1515 },
1616 "permissions" : [
1717 " *://trello.com/b/*" ,
18+ " declarativeContent" ,
1819 " tabs" ,
1920 " storage"
2021 ],
You can’t perform that action at this time.
0 commit comments