blob: 5edc95490e81d480ec5623dfd3c72f318abd924c [file] [log] [blame]
avm99963847ee632019-03-27 00:57:44 +01001function mutationCallback(mutationList, observer) {
2 mutationList.forEach((mutation) => {
3 if (mutation.type == "childList") {
4 mutation.addedNodes.forEach(function (node) {
5 if ((typeof node.classList !== "undefined") && node.classList.contains("view-more-button-container")) {
6 intersectionObserver.observe(node.querySelector(".view-more-button"));
7 }
8 });
9 }
10 });
11}
12
13function intersectionCallback(entries, observer) {
14 entries.forEach(entry => {
15 if (entry.isIntersecting) {
16 entry.target.click();
17 }
18 });
19};
20
21var observerOptions = {
22 childList: true,
23 attributes: true,
24 subtree: true
25}
26
27var mutationObserver = new MutationObserver(mutationCallback);
28mutationObserver.observe(document.querySelector(".scrollable-content"), observerOptions);
29
30var intersectionOptions = {
31 root: document.querySelector('.scrollable-content'),
32 rootMargin: '0px',
33 threshold: 1.0
34}
35
36var intersectionObserver = new IntersectionObserver(intersectionCallback, intersectionOptions);