blob: b9c7f58832d4a49753c395d9c29e2e61e86fc1e8 [file] [log] [blame]
Adrià Vilanova Martínezd7951b22024-05-25 22:13:32 +02001import {injectStylesheet} from '../../common/contentScriptsUtils';
Adrià Vilanova Martínezb523be92024-05-25 19:14:19 +02002import {getOptions} from '../../common/options/optionsUtils.js';
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +02003
Adrià Vilanova Martínez72a4ea42024-02-09 22:35:32 +01004import FlattenThreadsReplyActionHandler from './flattenThreads/replyActionHandler.js';
avm99963b6f68b62021-08-12 23:13:06 +02005
Adrià Vilanova Martínezd269c622021-09-04 18:35:55 +02006getOptions(null).then(options => {
Adrià Vilanova Martínezd2ac4ce2021-06-11 16:41:43 +02007 /* IMPORTANT NOTE: Remember to change this when changing the "ifs" below!! */
Adrià Vilanova Martínez879d44a2024-05-17 15:30:03 +02008 if (options.fixpekb269560789) {
avm99963b69eb3d2020-08-20 02:03:44 +02009 var startup =
Adrià Vilanova Martínez8423dfd2024-05-16 22:15:55 +020010 JSON.parse(document.querySelector('html').getAttribute('data-startup'));
Adrià Vilanova Martínez66dba7c2024-05-15 22:38:20 +020011
12 if (options.fixpekb269560789) {
13 if (startup[1]?.[1]?.[8]?.[7]) {
14 delete startup[1]?.[1]?.[8]?.[7];
15 }
16 }
avm99963c19497f2019-08-23 00:15:11 +020017
avm99963b69eb3d2020-08-20 02:03:44 +020018 document.querySelector('html').setAttribute(
19 'data-startup', JSON.stringify(startup));
avm999636d9c5fe2019-06-04 00:35:53 +020020 }
avm999630bc113a2020-09-07 13:02:11 +020021
Adrià Vilanova Martíneza2f79512022-07-10 15:32:32 +020022 if (options.uispacing) {
23 injectStylesheet(chrome.runtime.getURL('css/ui_spacing/shared.css'));
24 injectStylesheet(chrome.runtime.getURL('css/ui_spacing/console.css'));
25 }
Adrià Vilanova Martínez72a4ea42024-02-09 22:35:32 +010026
Adrià Vilanova Martínez66836fd2024-05-04 22:43:06 +020027 const flattenThreadsReplyActionHandler =
28 new FlattenThreadsReplyActionHandler(options);
Adrià Vilanova Martínez72a4ea42024-02-09 22:35:32 +010029 flattenThreadsReplyActionHandler.handleIfApplicable();
avm999636d9c5fe2019-06-04 00:35:53 +020030});