Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 1 | import {injectScript, injectStyles, injectStylesheet} from '../../common/contentScriptsUtils.js'; |
Adrià Vilanova Martínez | 4d59925 | 2023-02-04 20:54:54 +0100 | [diff] [blame] | 2 | import {getOptions} from '../../common/optionsUtils.js'; |
Adrià Vilanova Martínez | 825888a | 2023-07-23 01:53:48 +0200 | [diff] [blame] | 3 | import XHRProxyKillSwitchHandler from '../../xhrInterceptor/killSwitchHandler.js'; |
Adrià Vilanova Martínez | 1f65252 | 2021-10-14 00:23:23 +0200 | [diff] [blame] | 4 | import {injectPreviousPostsLinksUnifiedProfileIfEnabled} from '../utilsCommon/unifiedProfiles.js'; |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 5 | |
Adrià Vilanova Martínez | 27c6996 | 2021-07-17 23:32:51 +0200 | [diff] [blame] | 6 | import AvatarsHandler from './avatars.js'; |
Adrià Vilanova Martínez | 462280f | 2021-08-07 22:59:02 +0200 | [diff] [blame] | 7 | import {batchLock} from './batchLock.js'; |
Adrià Vilanova Martínez | 968e93c | 2024-03-11 23:18:16 +0100 | [diff] [blame] | 8 | import {injectDarkThemeButton, isDarkThemeOn} from './darkTheme/darkTheme.js'; |
Adrià Vilanova Martínez | f472d49 | 2024-03-05 21:26:53 +0100 | [diff] [blame] | 9 | import ReportDialogColorThemeFix from './darkTheme/reportDialog.js'; |
Adrià Vilanova Martínez | 968e93c | 2024-03-11 23:18:16 +0100 | [diff] [blame] | 10 | import {unifiedProfilesFix} from './darkTheme/unifiedProfiles.js'; |
Adrià Vilanova Martínez | eebc0ac | 2022-01-05 14:45:53 +0100 | [diff] [blame] | 11 | // #!if ['chromium', 'chromium_mv3'].includes(browser_target) |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 12 | import {applyDragAndDropFixIfEnabled} from './dragAndDropFix.js'; |
Adrià Vilanova Martínez | eebc0ac | 2022-01-05 14:45:53 +0100 | [diff] [blame] | 13 | // #!endif |
Adrià Vilanova Martínez | 115e3d8 | 2023-01-10 21:50:06 +0100 | [diff] [blame] | 14 | import {default as FlattenThreads, kMatchingSelectors as kFlattenThreadMatchingSelectors} from './flattenThreads/flattenThreads.js'; |
Adrià Vilanova Martínez | 2d9be8d | 2022-12-28 00:50:14 +0100 | [diff] [blame] | 15 | import {kRepliesSectionSelector} from './threadToolbar/constants.js'; |
| 16 | import ThreadToolbar from './threadToolbar/threadToolbar.js'; |
Adrià Vilanova Martínez | 2788d12 | 2022-10-10 22:06:25 +0200 | [diff] [blame] | 17 | import Workflows from './workflows/workflows.js'; |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 18 | |
Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 19 | var mutationObserver, options, avatars, workflows, |
Adrià Vilanova Martínez | f472d49 | 2024-03-05 21:26:53 +0100 | [diff] [blame] | 20 | threadToolbar, flattenThreads, reportDialogColorThemeFix; |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 21 | |
| 22 | const watchedNodesSelectors = [ |
| 23 | // App container (used to set up the intersection observer and inject the dark |
| 24 | // mode button) |
| 25 | 'ec-app', |
| 26 | |
Adrià Vilanova Martínez | a7ae3db | 2022-01-28 11:57:27 +0100 | [diff] [blame] | 27 | // Scrollable content (used for the intersection observer) |
| 28 | '.scrollable-content', |
| 29 | |
| 30 | // Load more bar and buttons |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 31 | '.load-more-bar', |
Adrià Vilanova Martínez | a7ae3db | 2022-01-28 11:57:27 +0100 | [diff] [blame] | 32 | '.scTailwindThreadMorebuttonbutton', |
Adrià Vilanova Martínez | 8885497 | 2022-08-28 11:57:12 +0200 | [diff] [blame] | 33 | '.scTailwindThreadMessagegapbutton', |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 34 | |
Adrià Vilanova Martínez | 7e8796c | 2022-01-23 21:46:46 +0100 | [diff] [blame] | 35 | // User profile card inside ec-unified-user |
| 36 | 'ec-unified-user .scTailwindUser_profileUsercardmain', |
| 37 | |
Adrià Vilanova Martínez | 531cd07 | 2021-12-05 20:15:43 +0100 | [diff] [blame] | 38 | // Username span/editor inside ec-unified-user (user profile view) |
Adrià Vilanova Martínez | 1f65252 | 2021-10-14 00:23:23 +0200 | [diff] [blame] | 39 | 'ec-unified-user .scTailwindUser_profileUsercarddetails', |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 40 | |
| 41 | // Rich text editor |
| 42 | 'ec-movable-dialog', |
| 43 | 'ec-rich-text-editor', |
| 44 | |
| 45 | // Read/unread bulk action in the list of thread, for the batch lock feature |
| 46 | 'ec-bulk-actions material-button[debugid="mark-read-button"]', |
| 47 | 'ec-bulk-actions material-button[debugid="mark-unread-button"]', |
| 48 | |
Adrià Vilanova Martínez | 66836fd | 2024-05-04 22:43:06 +0200 | [diff] [blame] | 49 | // Thread list items (used to inject the avatars) |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 50 | 'li', |
| 51 | |
| 52 | // Thread list (used for the autorefresh feature) |
| 53 | 'ec-thread-list', |
| 54 | |
Adrià Vilanova Martínez | f472d49 | 2024-03-05 21:26:53 +0100 | [diff] [blame] | 55 | // Unified profile iframe and report dialog iframe |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 56 | 'iframe', |
Adrià Vilanova Martínez | 74a2520 | 2022-01-23 23:36:58 +0100 | [diff] [blame] | 57 | |
Adrià Vilanova Martínez | 46ecb98 | 2024-01-30 22:02:17 +0100 | [diff] [blame] | 58 | // Canned response tags (for the "import CR" popup for the workflows feature) |
Adrià Vilanova Martínez | 6e4a68d | 2022-01-24 21:44:32 +0100 | [diff] [blame] | 59 | 'ec-canned-response-row .tags', |
Adrià Vilanova Martínez | 6e4a68d | 2022-01-24 21:44:32 +0100 | [diff] [blame] | 60 | |
Adrià Vilanova Martínez | 5a8055b | 2022-09-29 13:05:19 +0200 | [diff] [blame] | 61 | // Thread page main content |
| 62 | 'ec-thread > .page > .material-content > div[role="list"]', |
Adrià Vilanova Martínez | 2d9be8d | 2022-12-28 00:50:14 +0100 | [diff] [blame] | 63 | |
| 64 | // Thread page reply section (for the thread page toolbar) |
| 65 | kRepliesSectionSelector, |
Adrià Vilanova Martínez | 412b758 | 2022-12-30 01:35:30 +0100 | [diff] [blame] | 66 | |
| 67 | // Reply payload (for the flatten threads UI) |
Adrià Vilanova Martínez | 115e3d8 | 2023-01-10 21:50:06 +0100 | [diff] [blame] | 68 | ...kFlattenThreadMatchingSelectors, |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 69 | ]; |
| 70 | |
| 71 | function handleCandidateNode(node) { |
| 72 | if (typeof node.classList !== 'undefined') { |
| 73 | if (('tagName' in node) && node.tagName == 'EC-APP') { |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 74 | // Inject the dark mode button |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 75 | // TODO(avm99963): make this feature dynamic. |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 76 | if (options.ccdarktheme && options.ccdarktheme_mode == 'switch') { |
| 77 | var rightControl = node.querySelector('header .right-control'); |
| 78 | if (rightControl !== null) |
Adrià Vilanova Martínez | 968e93c | 2024-03-11 23:18:16 +0100 | [diff] [blame] | 79 | injectDarkThemeButton( |
| 80 | rightControl, options.ccdarktheme_switch_status); |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 81 | } |
| 82 | } |
| 83 | |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 84 | // Show the "previous posts" links if the option is currently enabled. |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 85 | // Here we're selecting the 'ec-user > div' element (unique child) |
Adrià Vilanova Martínez | 1f65252 | 2021-10-14 00:23:23 +0200 | [diff] [blame] | 86 | if (node.matches( |
| 87 | 'ec-unified-user .scTailwindUser_profileUsercarddetails')) { |
| 88 | injectPreviousPostsLinksUnifiedProfileIfEnabled( |
| 89 | /* isCommunityConsole = */ true); |
| 90 | } |
| 91 | |
Adrià Vilanova Martínez | eebc0ac | 2022-01-05 14:45:53 +0100 | [diff] [blame] | 92 | // #!if ['chromium', 'chromium_mv3'].includes(browser_target) |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 93 | // Fix the drag&drop issue with the rich text editor if the option is |
| 94 | // currently enabled. |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 95 | // |
| 96 | // We target both tags because in different contexts different |
| 97 | // elements containing the text editor get added to the DOM structure. |
| 98 | // Sometimes it's a EC-MOVABLE-DIALOG which already contains the |
| 99 | // EC-RICH-TEXT-EDITOR, and sometimes it's the EC-RICH-TEXT-EDITOR |
| 100 | // directly. |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 101 | if (('tagName' in node) && |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 102 | (node.tagName == 'EC-MOVABLE-DIALOG' || |
| 103 | node.tagName == 'EC-RICH-TEXT-EDITOR')) { |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 104 | applyDragAndDropFixIfEnabled(node); |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 105 | } |
Adrià Vilanova Martínez | eebc0ac | 2022-01-05 14:45:53 +0100 | [diff] [blame] | 106 | // #!endif |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 107 | |
Adrià Vilanova Martínez | 2788d12 | 2022-10-10 22:06:25 +0200 | [diff] [blame] | 108 | // Inject the worflows menu in the thread list if the option is currently |
| 109 | // enabled. |
| 110 | if (workflows.shouldAddThreadListBtn(node)) { |
| 111 | workflows.addThreadListBtnIfEnabled(node); |
| 112 | } |
| 113 | |
Adrià Vilanova Martínez | b06c13d | 2022-06-20 17:30:14 +0000 | [diff] [blame] | 114 | // Inject the batch lock button in the thread list if the option is |
| 115 | // currently enabled. |
Adrià Vilanova Martínez | 4107b5e | 2022-10-09 23:11:11 +0200 | [diff] [blame] | 116 | if (batchLock.shouldAddButton(node)) { |
Adrià Vilanova Martínez | b06c13d | 2022-06-20 17:30:14 +0000 | [diff] [blame] | 117 | batchLock.addButtonIfEnabled(node); |
| 118 | } |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 119 | |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 120 | // Inject avatar links to threads in the thread list. injectIfEnabled is |
| 121 | // responsible of determining whether it should run or not depending on its |
| 122 | // current setting. |
| 123 | if (('tagName' in node) && (node.tagName == 'LI') && |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 124 | node.querySelector('ec-thread-summary') !== null) { |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 125 | avatars.injectIfEnabled(node); |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 126 | } |
| 127 | |
Adrià Vilanova Martínez | f472d49 | 2024-03-05 21:26:53 +0100 | [diff] [blame] | 128 | if (node.tagName == 'IFRAME') { |
| 129 | // Redirect unified profile iframe to dark version if applicable |
| 130 | if (isDarkThemeOn(options) && unifiedProfilesFix.checkIframe(node)) { |
| 131 | unifiedProfilesFix.fixIframe(node); |
| 132 | } |
| 133 | |
| 134 | // Set report dialog iframe's theme to the appropriate theme |
| 135 | reportDialogColorThemeFix.fixThemeIfReportDialogIframeAndApplicable(node); |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 136 | } |
Adrià Vilanova Martínez | 74a2520 | 2022-01-23 23:36:58 +0100 | [diff] [blame] | 137 | |
Adrià Vilanova Martínez | 46ecb98 | 2024-01-30 22:02:17 +0100 | [diff] [blame] | 138 | // Add the "import" button in the canned responses view for the workflows |
| 139 | // feature if applicable. |
Adrià Vilanova Martínez | 74a2520 | 2022-01-23 23:36:58 +0100 | [diff] [blame] | 140 | if (node.matches('ec-canned-response-row .tags')) { |
Adrià Vilanova Martínez | e0d65f2 | 2022-11-06 18:49:35 +0100 | [diff] [blame] | 141 | window.TWPTWorkflowsImport.addButtonIfEnabled(node); |
Adrià Vilanova Martínez | 74a2520 | 2022-01-23 23:36:58 +0100 | [diff] [blame] | 142 | } |
Adrià Vilanova Martínez | 6e4a68d | 2022-01-24 21:44:32 +0100 | [diff] [blame] | 143 | |
Adrià Vilanova Martínez | 2d9be8d | 2022-12-28 00:50:14 +0100 | [diff] [blame] | 144 | // Inject old thread page design warning if applicable |
Adrià Vilanova Martínez | d2344c4 | 2022-09-30 13:14:29 +0200 | [diff] [blame] | 145 | if (node.matches( |
| 146 | 'ec-thread > .page > .material-content > div[role="list"]')) { |
| 147 | window.TWPTThreadPageDesignWarning.injectWarningIfApplicable(node); |
Adrià Vilanova Martínez | 5a8055b | 2022-09-29 13:05:19 +0200 | [diff] [blame] | 148 | } |
Adrià Vilanova Martínez | 2d9be8d | 2022-12-28 00:50:14 +0100 | [diff] [blame] | 149 | |
| 150 | // Inject thread toolbar |
| 151 | if (threadToolbar.shouldInject(node)) { |
| 152 | threadToolbar.injectIfApplicable(node); |
| 153 | } |
Adrià Vilanova Martínez | 412b758 | 2022-12-30 01:35:30 +0100 | [diff] [blame] | 154 | |
| 155 | // Inject parent reply quote |
Adrià Vilanova Martínez | 115e3d8 | 2023-01-10 21:50:06 +0100 | [diff] [blame] | 156 | if (flattenThreads.shouldInjectQuote(node)) { |
| 157 | flattenThreads.injectQuoteIfApplicable(node); |
| 158 | } |
| 159 | |
| 160 | // Inject reply button in non-nested view |
| 161 | if (flattenThreads.shouldInjectReplyBtn(node)) { |
| 162 | flattenThreads.injectReplyBtnIfApplicable(node); |
Adrià Vilanova Martínez | 412b758 | 2022-12-30 01:35:30 +0100 | [diff] [blame] | 163 | } |
Adrià Vilanova Martínez | 4d59925 | 2023-02-04 20:54:54 +0100 | [diff] [blame] | 164 | |
| 165 | // Delete additional info in the edit message box |
| 166 | if (flattenThreads.isAdditionalInfoElement(node)) { |
| 167 | flattenThreads.deleteAdditionalInfoElementIfApplicable(node); |
| 168 | } |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 169 | } |
| 170 | } |
| 171 | |
Adrià Vilanova Martínez | 115e3d8 | 2023-01-10 21:50:06 +0100 | [diff] [blame] | 172 | function handleRemovedNode(mutation, node) { |
| 173 | if (!('tagName' in node)) return; |
| 174 | |
Adrià Vilanova Martínez | 115e3d8 | 2023-01-10 21:50:06 +0100 | [diff] [blame] | 175 | // Readd reply button when the Community Console removes it |
| 176 | if (node.tagName == 'TWPT-FLATTEN-THREAD-REPLY-BUTTON') { |
| 177 | flattenThreads.injectReplyBtn( |
| 178 | mutation.target, JSON.parse(node.getAttribute('extraInfo'))); |
| 179 | } |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 180 | } |
| 181 | |
Adrià Vilanova Martínez | 115e3d8 | 2023-01-10 21:50:06 +0100 | [diff] [blame] | 182 | function mutationCallback(mutationList) { |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 183 | mutationList.forEach((mutation) => { |
| 184 | if (mutation.type == 'childList') { |
| 185 | mutation.addedNodes.forEach(function(node) { |
| 186 | handleCandidateNode(node); |
| 187 | }); |
| 188 | |
| 189 | mutation.removedNodes.forEach(function(node) { |
Adrià Vilanova Martínez | 115e3d8 | 2023-01-10 21:50:06 +0100 | [diff] [blame] | 190 | handleRemovedNode(mutation, node); |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 191 | }); |
| 192 | } |
| 193 | }); |
| 194 | } |
| 195 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 196 | var observerOptions = { |
| 197 | childList: true, |
| 198 | subtree: true, |
| 199 | }; |
| 200 | |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 201 | getOptions(null).then(items => { |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 202 | options = items; |
| 203 | |
Adrià Vilanova Martínez | 27c6996 | 2021-07-17 23:32:51 +0200 | [diff] [blame] | 204 | // Initialize classes needed by the mutation observer |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 205 | avatars = new AvatarsHandler(); |
Adrià Vilanova Martínez | 2788d12 | 2022-10-10 22:06:25 +0200 | [diff] [blame] | 206 | workflows = new Workflows(); |
Adrià Vilanova Martínez | 2d9be8d | 2022-12-28 00:50:14 +0100 | [diff] [blame] | 207 | threadToolbar = new ThreadToolbar(); |
Adrià Vilanova Martínez | 412b758 | 2022-12-30 01:35:30 +0100 | [diff] [blame] | 208 | flattenThreads = new FlattenThreads(); |
Adrià Vilanova Martínez | f472d49 | 2024-03-05 21:26:53 +0100 | [diff] [blame] | 209 | reportDialogColorThemeFix = new ReportDialogColorThemeFix(options); |
Adrià Vilanova Martínez | 27c6996 | 2021-07-17 23:32:51 +0200 | [diff] [blame] | 210 | |
Adrià Vilanova Martínez | 66836fd | 2024-05-04 22:43:06 +0200 | [diff] [blame] | 211 | // threadPageDesignWarning and workflowsImport are |
Adrià Vilanova Martínez | e0d65f2 | 2022-11-06 18:49:35 +0100 | [diff] [blame] | 212 | // initialized in start.js |
avm99963 | d3f4ac0 | 2021-08-12 18:36:58 +0200 | [diff] [blame] | 213 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 214 | // Before starting the mutation Observer, check whether we missed any |
| 215 | // mutations by manually checking whether some watched nodes already |
| 216 | // exist. |
| 217 | var cssSelectors = watchedNodesSelectors.join(','); |
| 218 | document.querySelectorAll(cssSelectors) |
| 219 | .forEach(node => handleCandidateNode(node)); |
| 220 | |
| 221 | mutationObserver = new MutationObserver(mutationCallback); |
| 222 | mutationObserver.observe(document.body, observerOptions); |
| 223 | |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 224 | // TODO(avm99963): The following features are not dynamic. Make them be. |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 225 | if (options.fixedtoolbar) { |
| 226 | injectStyles( |
Adrià Vilanova | e8ba09a | 2024-02-29 19:25:39 +0000 | [diff] [blame] | 227 | 'ec-bulk-actions{position: sticky; top: 0; background: var(--TWPT-primary-background, #fff); z-index: 96;}'); |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | if (options.increasecontrast) { |
| 231 | injectStyles( |
| 232 | '.thread-summary.read:not(.checked){background: var(--TWPT-thread-read-background, #ecedee)!important;}'); |
| 233 | } |
| 234 | |
| 235 | if (options.stickysidebarheaders) { |
| 236 | injectStyles( |
| 237 | 'material-drawer .main-header{background: var(--TWPT-drawer-background, #fff)!important; position: sticky; top: 0; z-index: 1;}'); |
| 238 | } |
| 239 | |
| 240 | if (options.enhancedannouncementsdot) { |
| 241 | injectStylesheet( |
| 242 | chrome.runtime.getURL('css/enhanced_announcements_dot.css')); |
| 243 | } |
| 244 | |
| 245 | if (options.repositionexpandthread) { |
Adrià Vilanova Martínez | 27c6996 | 2021-07-17 23:32:51 +0200 | [diff] [blame] | 246 | injectStylesheet(chrome.runtime.getURL('css/reposition_expand_thread.css')); |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 247 | } |
| 248 | |
Adrià Vilanova Martínez | 9d27c21 | 2021-12-05 13:54:10 +0100 | [diff] [blame] | 249 | if (options.imagemaxheight) { |
| 250 | injectStylesheet(chrome.runtime.getURL('css/image_max_height.css')); |
| 251 | } |
| 252 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 253 | if (options.ccforcehidedrawer) { |
| 254 | var drawer = document.querySelector('material-drawer'); |
| 255 | if (drawer !== null && drawer.classList.contains('mat-drawer-expanded')) { |
| 256 | document.querySelector('.material-drawer-button').click(); |
| 257 | } |
| 258 | } |
| 259 | |
Adrià Vilanova Martínez | d269c62 | 2021-09-04 18:35:55 +0200 | [diff] [blame] | 260 | // Batch lock |
| 261 | injectScript(chrome.runtime.getURL('batchLockInject.bundle.js')); |
| 262 | injectStylesheet(chrome.runtime.getURL('css/batchlock_inject.css')); |
| 263 | // Thread list avatars |
| 264 | injectStylesheet(chrome.runtime.getURL('css/thread_list_avatars.css')); |
Adrià Vilanova Martínez | 2d9be8d | 2022-12-28 00:50:14 +0100 | [diff] [blame] | 265 | // Workflows, Thread toolbar |
| 266 | injectScript(chrome.runtime.getURL('litComponentsInject.bundle.js')); |
| 267 | // Thread toolbar |
| 268 | injectStylesheet(chrome.runtime.getURL('css/thread_toolbar.css')); |
Adrià Vilanova Martínez | 115e3d8 | 2023-01-10 21:50:06 +0100 | [diff] [blame] | 269 | // Flatten threads |
| 270 | injectStylesheet(chrome.runtime.getURL('css/flatten_threads.css')); |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 271 | }); |
Adrià Vilanova Martínez | 825888a | 2023-07-23 01:53:48 +0200 | [diff] [blame] | 272 | |
| 273 | new XHRProxyKillSwitchHandler(); |