blob: bfaa0fa4f539b6ccdc5dbff561fa3570e0680cc0 [file] [log] [blame]
avm99963cbea3142019-03-28 00:48:15 +01001var intersectionObserver;
2
3function intersectionCallback(entries, observer) {
4 entries.forEach(entry => {
5 if (entry.isIntersecting) {
6 entry.target.click();
7 }
8 });
9};
10
11var intersectionOptions = {
12 threshold: 1.0
13}
14
15chrome.storage.sync.get(null, function(items) {
avm99963134f1ef2019-03-30 19:05:27 +010016 var redirectLink = document.querySelector(".thread-question__open-in-community-console-button");
17 if (items.redirect && redirectLink !== null) {
18 window.location = redirectLink.href;
19 } else {
20 var button = document.querySelector(".thread-all-replies__load-more-button");
21 if (items.thread && button !== null) {
22 intersectionObserver = new IntersectionObserver(intersectionCallback, intersectionOptions);
23 intersectionObserver.observe(button);
24 }
avm99963cbea3142019-03-28 00:48:15 +010025 }
26});