@@ -4,7 +4,7 @@ const logTabs = (tabs) => {
4
4
5
5
// get all tab URLs and render list
6
6
for ( let tab of tabs ) {
7
- createTabList ( tab , popupList ) ;
7
+ createTabList ( tab , popupList ) ;
8
8
}
9
9
10
10
// creat eventListeners
@@ -37,22 +37,22 @@ const createTabList = (tab, popupList) => {
37
37
const listItems = parsed . getElementsByTagName ( 'div' ) ;
38
38
for ( const item of listItems ) {
39
39
popupList . appendChild ( item ) ;
40
- } ;
40
+ } ;
41
41
} ;
42
42
43
43
// create all needed event listeners
44
44
const tabListEvents = ( ) => {
45
45
// add event listener on wrapper and check for class?
46
46
const toggleSelect = document . getElementById ( 'selectAll' ) ,
47
- deleteBtn = document . querySelector ( '.tablist-delete-btn' ) ,
48
- exportBtn = document . querySelector ( '.tablist-export-btn' )
47
+ deleteBtn = document . querySelector ( '.tablist-delete-btn' ) ,
48
+ exportBtn = document . querySelector ( '.tablist-export-btn' )
49
49
50
50
// check or uncheck all items in tablist
51
51
toggleSelect . addEventListener ( 'click' , ( event ) => {
52
52
const checkAllItems = event . target . checked ;
53
53
const checkboxes = Array . from ( document . getElementsByName ( 'tab' ) ) ;
54
54
checkboxes . map ( checkbox => {
55
- if ( checkAllItems ) {
55
+ if ( checkAllItems ) {
56
56
checkbox . checked = true ;
57
57
} else {
58
58
checkbox . checked = false ;
@@ -65,7 +65,7 @@ const tabListEvents = () => {
65
65
const checkboxes = Array . from ( document . getElementsByName ( 'tab' ) ) ;
66
66
let selectedTabIds = [ ] ;
67
67
checkboxes . map ( checkbox => {
68
- if ( checkbox . checked ) {
68
+ if ( checkbox . checked ) {
69
69
console . log ( checkbox ) ;
70
70
selectedTabIds . push ( parseInt ( checkbox . id ) ) ;
71
71
}
@@ -80,33 +80,33 @@ const tabListEvents = () => {
80
80
let selectedTabUrls = {
81
81
urls : [ ]
82
82
} ;
83
-
83
+
84
84
checkboxes . map ( checkbox => {
85
- if ( checkbox . checked ) {
85
+ if ( checkbox . checked ) {
86
86
selectedTabUrls . urls . push ( checkbox . value ) ;
87
87
}
88
88
} ) ;
89
89
90
90
// save urls in storage to retrieve in new tab
91
- browser . storage . local . set ( { selectedTabUrls} )
91
+ browser . storage . local . set ( { selectedTabUrls } )
92
92
. then ( createNewTab , onError ) ;
93
93
} ) ;
94
94
} ;
95
95
96
96
// open new tab with extension page as target
97
97
const createNewTab = ( ) => {
98
98
browser . tabs . create ( {
99
- url :'../tablist/tablist.html'
99
+ url : '../tablist/tablist.html'
100
100
} )
101
101
. then ( closePopup , onError ) ;
102
102
} ;
103
103
104
104
const closePopup = ( ) => {
105
- window . close ( ) ;
105
+ window . close ( ) ;
106
106
} ;
107
107
108
108
const onError = ( error ) => {
109
- console . log ( `Error: ${ error } ` ) ;
109
+ console . log ( `Error: ${ error } ` ) ;
110
110
} ;
111
111
112
112
browser . tabs . query ( { } )
0 commit comments