avm99963 | cbea314 | 2019-03-28 00:48:15 +0100 | [diff] [blame] | 1 | var intersectionObserver; |
| 2 | |
| 3 | function intersectionCallback(entries, observer) { |
| 4 | entries.forEach(entry => { |
| 5 | if (entry.isIntersecting) { |
| 6 | entry.target.click(); |
| 7 | } |
| 8 | }); |
| 9 | }; |
| 10 | |
| 11 | var intersectionOptions = { |
| 12 | threshold: 1.0 |
| 13 | } |
| 14 | |
| 15 | chrome.storage.sync.get(null, function(items) { |
avm99963 | adf9086 | 2020-04-12 13:27:45 +0200 | [diff] [blame] | 16 | var redirectLink = document.querySelector(".community-console"); |
avm99963 | 134f1ef | 2019-03-30 19:05:27 +0100 | [diff] [blame] | 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 | } |
avm99963 | 6d9c5fe | 2019-06-04 00:35:53 +0200 | [diff] [blame] | 25 | var allbutton = document.querySelector(".thread-all-replies__load-all-button"); |
| 26 | if (items.threadall && button !== null) { |
| 27 | intersectionObserver = new IntersectionObserver(intersectionCallback, intersectionOptions); |
| 28 | intersectionObserver.observe(allbutton); |
| 29 | } |
avm99963 | cbea314 | 2019-03-28 00:48:15 +0100 | [diff] [blame] | 30 | } |
| 31 | }); |