refactor: migrate infinite scroll feature to a new architecture
This CL introduces a new architecture for the features source code.
Bug: twpowertools:176
Change-Id: I9abc4df2fb67f9bb0c9114aaffc6916d34f1b7ff
diff --git a/src/contentScripts/communityConsole/main.js b/src/contentScripts/communityConsole/main.js
index 0200394..ea9cb8c 100644
--- a/src/contentScripts/communityConsole/main.js
+++ b/src/contentScripts/communityConsole/main.js
@@ -12,12 +12,11 @@
import {applyDragAndDropFixIfEnabled} from './dragAndDropFix.js';
// #!endif
import {default as FlattenThreads, kMatchingSelectors as kFlattenThreadMatchingSelectors} from './flattenThreads/flattenThreads.js';
-import InfiniteScroll from './infiniteScroll.js';
import {kRepliesSectionSelector} from './threadToolbar/constants.js';
import ThreadToolbar from './threadToolbar/threadToolbar.js';
import Workflows from './workflows/workflows.js';
-var mutationObserver, options, avatars, infiniteScroll, workflows,
+var mutationObserver, options, avatars, workflows,
threadToolbar, flattenThreads, reportDialogColorThemeFix;
const watchedNodesSelectors = [
@@ -88,8 +87,6 @@
function handleCandidateNode(node) {
if (typeof node.classList !== 'undefined') {
if (('tagName' in node) && node.tagName == 'EC-APP') {
- infiniteScroll.setUpIntersectionObserver(node, false);
-
// Inject the dark mode button
// TODO(avm99963): make this feature dynamic.
if (options.ccdarktheme && options.ccdarktheme_mode == 'switch') {
@@ -100,21 +97,6 @@
}
}
- // To set up infinite scroll
- if (node.classList.contains('scrollable-content')) {
- infiniteScroll.setUpIntersectionObserver(node, true);
- }
-
- // Start the intersectionObserver for the "load more"/"load all" buttons
- // inside a thread if the option is currently enabled.
- if (node.classList.contains('load-more-bar')) {
- infiniteScroll.observeLoadMoreBar(node);
- }
- if (node.classList.contains('scTailwindThreadMorebuttonbutton') ||
- node.classList.contains('scTailwindThreadMessagegapbutton')) {
- infiniteScroll.observeLoadMoreInteropBtn(node);
- }
-
// Show additional details in the profile view.
if (node.matches('ec-unified-user .scTailwindUser_profileUsercardmain')) {
window.TWPTExtraInfo.injectAbuseChipsAtProfileIfEnabled(node);
@@ -284,7 +266,6 @@
// Initialize classes needed by the mutation observer
avatars = new AvatarsHandler();
- infiniteScroll = new InfiniteScroll();
workflows = new Workflows();
threadToolbar = new ThreadToolbar();
flattenThreads = new FlattenThreads();