blob: 38b56ce25969f058abbcd70232c2fb02c1e3beff [file] [log] [blame]
avm99963cbea3142019-03-28 00:48:15 +01001var intersectionObserver;
2
avm99963847ee632019-03-27 00:57:44 +01003function intersectionCallback(entries, observer) {
avm99963847ee632019-03-27 00:57:44 +01004 entries.forEach(entry => {
5 if (entry.isIntersecting) {
6 entry.target.click();
7 }
8 });
9};
10
11var intersectionOptions = {
avm99963b69eb3d2020-08-20 02:03:44 +020012 threshold: 1.0,
13};
avm99963847ee632019-03-27 00:57:44 +010014
avm99963cbea3142019-03-28 00:48:15 +010015chrome.storage.sync.get(null, function(items) {
avm99963b69eb3d2020-08-20 02:03:44 +020016 var button = document.querySelector('.thread-list-threads__load-more-button');
avm99963cbea3142019-03-28 00:48:15 +010017 if (items.list && button !== null) {
avm99963b69eb3d2020-08-20 02:03:44 +020018 intersectionObserver =
19 new IntersectionObserver(intersectionCallback, intersectionOptions);
avm99963cbea3142019-03-28 00:48:15 +010020 intersectionObserver.observe(button);
21 }
22});