blob: 0cfbeae884b26641861adb604150477206fc0e99 [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) {
avm999635fe510b2019-03-27 01:23:06 +01005 if ((typeof node.classList !== "undefined") && node.classList.contains("view-more-button-container")) {
avm99963847ee632019-03-27 00:57:44 +01006 intersectionObserver.observe(node.querySelector(".view-more-button"));
7 }
Nico Sinisterra4ae1c572019-03-27 12:57:13 -03008
9 if ((typeof node.classList !== "undefined") && node.classList.contains("load-more-bar")) {
10 intersectionObserver.observe(node.querySelector(".load-more-button"));
11 }
avm99963847ee632019-03-27 00:57:44 +010012 });
13 }
14 });
15}
16
17function intersectionCallback(entries, observer) {
18 entries.forEach(entry => {
19 if (entry.isIntersecting) {
20 entry.target.click();
21 }
22 });
23};
24
25var observerOptions = {
26 childList: true,
27 attributes: true,
28 subtree: true
29}
30
31var mutationObserver = new MutationObserver(mutationCallback);
32mutationObserver.observe(document.querySelector(".scrollable-content"), observerOptions);
33
34var intersectionOptions = {
35 root: document.querySelector('.scrollable-content'),
36 rootMargin: '0px',
37 threshold: 1.0
38}
39
avm999635fe510b2019-03-27 01:23:06 +010040var intersectionObserver = new IntersectionObserver(intersectionCallback, intersectionOptions);