@@ -20,11 +20,11 @@ chrome.storage.local.get(['sidebarOpen'], (result) => {
20
20
const changeBrowserIconBadgeWithSidebarOpenStatus = ( status ) => {
21
21
if ( status ) {
22
22
chrome . browserAction . setIcon ( {
23
- path : chrome . extension . getURL ( 'icon-128-eye.png' ) ,
23
+ path : chrome . runtime . getURL ( 'icon-128-eye.png' ) ,
24
24
} ) ;
25
25
} else {
26
26
chrome . browserAction . setIcon ( {
27
- path : chrome . extension . getURL ( 'icon-128.png' ) ,
27
+ path : chrome . runtime . getURL ( 'icon-128.png' ) ,
28
28
} ) ;
29
29
}
30
30
} ;
@@ -92,6 +92,25 @@ const persistdisplayTabInFullStatus = (status) => {
92
92
} ) ;
93
93
} ;
94
94
95
+ /**
96
+ * Display Tab Preview Frame
97
+ */
98
+ let displayTabPreviewFrame = true ;
99
+
100
+ chrome . storage . sync . get ( [ 'displayTabPreviewFrame' ] , ( result ) => {
101
+ if ( result . displayTabPreviewFrame !== undefined ) {
102
+ displayTabPreviewFrame = result . displayTabPreviewFrame === true ;
103
+ } else {
104
+ persistdisplayTabPreviewFrameStatus ( true ) ; // default to display tab in full
105
+ }
106
+ } ) ;
107
+
108
+ const persistdisplayTabPreviewFrameStatus = ( status ) => {
109
+ chrome . storage . sync . set ( {
110
+ displayTabPreviewFrame : status ,
111
+ } ) ;
112
+ } ;
113
+
95
114
/**
96
115
* Auto Show Hide
97
116
*/
@@ -159,7 +178,7 @@ const toggleSidebar = (toStatus = null) => {
159
178
{
160
179
currentWindow : true ,
161
180
} ,
162
- function ( tabs ) {
181
+ function ( tabs ) {
163
182
tabs . forEach ( ( tab ) => {
164
183
chrome . tabs . sendMessage ( tab . id , {
165
184
from : 'background' ,
@@ -176,7 +195,7 @@ const updateSidebarWidth = (width) => {
176
195
{
177
196
currentWindow : true ,
178
197
} ,
179
- function ( tabs ) {
198
+ function ( tabs ) {
180
199
tabs . forEach ( ( tab ) => {
181
200
chrome . tabs . sendMessage ( tab . id , {
182
201
from : 'background' ,
@@ -193,7 +212,7 @@ const updateSidebarScrollPosition = () => {
193
212
{
194
213
currentWindow : true ,
195
214
} ,
196
- function ( tabs ) {
215
+ function ( tabs ) {
197
216
tabs . forEach ( ( tab ) => {
198
217
chrome . tabs . sendMessage ( tab . id , {
199
218
from : 'background' ,
@@ -211,7 +230,7 @@ const updateSidebarOnLeftStatus = (toStatus) => {
211
230
{
212
231
currentWindow : true ,
213
232
} ,
214
- function ( tabs ) {
233
+ function ( tabs ) {
215
234
tabs . forEach ( ( tab ) => {
216
235
chrome . tabs . sendMessage ( tab . id , {
217
236
from : 'background' ,
@@ -228,7 +247,7 @@ const updateShouldShrinkBodyStatus = (toStatus) => {
228
247
{
229
248
currentWindow : true ,
230
249
} ,
231
- function ( tabs ) {
250
+ function ( tabs ) {
232
251
tabs . forEach ( ( tab ) => {
233
252
chrome . tabs . sendMessage ( tab . id , {
234
253
from : 'background' ,
@@ -245,7 +264,7 @@ const updateDisplayTabInFullStatus = (toStatus) => {
245
264
{
246
265
currentWindow : true ,
247
266
} ,
248
- function ( tabs ) {
267
+ function ( tabs ) {
249
268
tabs . forEach ( ( tab ) => {
250
269
chrome . tabs . sendMessage ( tab . id , {
251
270
from : 'background' ,
@@ -257,12 +276,29 @@ const updateDisplayTabInFullStatus = (toStatus) => {
257
276
) ;
258
277
} ;
259
278
279
+ const updateDisplayTabPreviewFrameStatus = ( toStatus ) => {
280
+ chrome . tabs . query (
281
+ {
282
+ currentWindow : true ,
283
+ } ,
284
+ function ( tabs ) {
285
+ tabs . forEach ( ( tab ) => {
286
+ chrome . tabs . sendMessage ( tab . id , {
287
+ from : 'background' ,
288
+ msg : 'UPDATE_DISPLAY_TAB_PREVIEW_FRAME_STATUS' ,
289
+ toStatus,
290
+ } ) ;
291
+ } ) ;
292
+ }
293
+ ) ;
294
+ } ;
295
+
260
296
const updateAutoShowHideStatus = ( toStatus ) => {
261
297
chrome . tabs . query (
262
298
{
263
299
currentWindow : true ,
264
300
} ,
265
- function ( tabs ) {
301
+ function ( tabs ) {
266
302
tabs . forEach ( ( tab ) => {
267
303
chrome . tabs . sendMessage ( tab . id , {
268
304
from : 'background' ,
@@ -279,7 +315,7 @@ const updateAutoShowHideDelayStatus = (toStatus) => {
279
315
{
280
316
currentWindow : true ,
281
317
} ,
282
- function ( tabs ) {
318
+ function ( tabs ) {
283
319
tabs . forEach ( ( tab ) => {
284
320
chrome . tabs . sendMessage ( tab . id , {
285
321
from : 'background' ,
@@ -296,7 +332,7 @@ const updateDarkModeStatus = (toStatus) => {
296
332
{
297
333
currentWindow : true ,
298
334
} ,
299
- function ( tabs ) {
335
+ function ( tabs ) {
300
336
tabs . forEach ( ( tab ) => {
301
337
chrome . tabs . sendMessage ( tab . id , {
302
338
from : 'background' ,
@@ -309,7 +345,7 @@ const updateDarkModeStatus = (toStatus) => {
309
345
} ;
310
346
311
347
// chrome.browserAction.setPopup({
312
- // popup: chrome.extension .getURL('sidebar.html'),
348
+ // popup: chrome.runtime .getURL('sidebar.html'),
313
349
// });
314
350
315
351
// setTimeout(() => {
@@ -324,7 +360,7 @@ chrome.browserAction.onClicked.addListener((senderTab) => {
324
360
toggleSidebar ( ) ;
325
361
} ) ;
326
362
327
- chrome . commands . onCommand . addListener ( function ( command ) {
363
+ chrome . commands . onCommand . addListener ( function ( command ) {
328
364
if ( command === '_execute_browser_action' ) {
329
365
toggleSidebar ( ) ;
330
366
}
@@ -386,6 +422,14 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
386
422
displayTabInFull = toStatus ;
387
423
persistdisplayTabInFullStatus ( displayTabInFull ) ;
388
424
updateDisplayTabInFullStatus ( displayTabInFull ) ;
425
+ } else if (
426
+ request . from === 'settings' &&
427
+ request . msg === 'USER_CHANGE_DISPLAY_TAB_PREVIEW_FRAME'
428
+ ) {
429
+ const { toStatus } = request ;
430
+ displayTabPreviewFrame = toStatus ;
431
+ persistdisplayTabPreviewFrameStatus ( displayTabPreviewFrame ) ;
432
+ updateDisplayTabPreviewFrameStatus ( displayTabPreviewFrame ) ;
389
433
} else if (
390
434
request . from === 'settings' &&
391
435
request . msg === 'USER_CHANGE_AUTO_SHOW_HIDE'
0 commit comments