Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!observer.isConnected()) {
- setTimeout(() => {
- let postsContainer = document.querySelectorAll('ui-layout.ng-isolate-scope');
- if (typeof postsContainer[0] != 'undefined') {
- observer.observe(postsContainer[0], {childList: true, subtree: true});
- }
- }, 0);
- }
- --- CHANGE TO ---
- // check if pageObserver is connected or is currently trying to connect
- var bConnecting = false;
- if (!observer.isConnected() && !bConnecting) {
- // check if current page is feed
- if (window.location.pathname.indexOf('/feed') > -1) {
- // check if main feed exists on page
- var feedWrapper = document.getElementsByClassName('main-feed-wrapper');
- if (typeof feedWrapper[0] != 'undefined') {
- console.log('Connecting pageObserver');
- bConnecting = true;
- let postContainer = document.querySelectorAll('ui-layout.ng-isolate-scope');
- if (typeof postContainer[0] != 'undefined') {
- observer.observe(postContainer[0], { childList: true, subtree: true });
- } else {
- bConnecting = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement