fix: dont run explorer scripts on non-explorer pages (closes #596)
This commit is contained in:
		
							parent
							
								
									727b9b5d72
								
							
						
					
					
						commit
						ea08c0511a
					
				
					 1 changed files with 7 additions and 6 deletions
				
			
		| 
						 | 
					@ -120,9 +120,9 @@ function setupExplorer() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  } else {
 | 
					  } else if (explorer?.dataset.tree) {
 | 
				
			||||||
    // If tree is not in localStorage or config is disabled, use tree passed from Explorer as dataset
 | 
					    // If tree is not in localStorage or config is disabled, use tree passed from Explorer as dataset
 | 
				
			||||||
    explorerState = JSON.parse(explorer?.dataset.tree as string)
 | 
					    explorerState = JSON.parse(explorer.dataset.tree)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -130,12 +130,13 @@ window.addEventListener("resize", setupExplorer)
 | 
				
			||||||
document.addEventListener("nav", () => {
 | 
					document.addEventListener("nav", () => {
 | 
				
			||||||
  setupExplorer()
 | 
					  setupExplorer()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const explorerContent = document.getElementById("explorer-ul")
 | 
					  observer.disconnect()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // select pseudo element at end of list
 | 
					  // select pseudo element at end of list
 | 
				
			||||||
  const lastItem = document.getElementById("explorer-end")
 | 
					  const lastItem = document.getElementById("explorer-end")
 | 
				
			||||||
 | 
					  if (lastItem) {
 | 
				
			||||||
  observer.disconnect()
 | 
					    observer.observe(lastItem)
 | 
				
			||||||
  observer.observe(lastItem as Element)
 | 
					  }
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue