PageSourceSearch

https://dossier.center/wp-content/themes/nova/js/scrollTop.js?ver=1.1

js dossier.center collected 2026-09-24 08:25:46 UTC 2,013 bytes, 56 lines download raw bytes

1//scroll to TOP
2document.addEventListener("DOMContentLoaded", function(){
3  // When the user scrolls down 20px from the top of the document, show the button
4
5
6  var incutArticles = document.getElementsByClassName('incutArticle');
7  for (var i = 0; i < incutArticles.length; i++) {
8    incutArticles[i].previousElementSibling.id = 'incutArticle' + i;
9    // console.log(incutArticles[i].previousElementSibling.id)
10    let articleLink = incutArticles[i].querySelector('.closeIncut');
11    articleLink.querySelector('a').href = '#incutArticle' + i;
12
13  }
14  let mainContent = document.querySelector('.mainContent');
15  if (mainContent) {
16    mainContent.addEventListener('click' , toggleIncutArticle);
17    mainContent.addEventListener('click' , closeIncutHandle);
18  }
19
20  let body = document.querySelector('body');
21  let toTopBtn = document.createElement('a');
22  toTopBtn.onclick = topFunction;
23  toTopBtn.id= 'toTopBtn';
24  toTopBtn.href = '#';
25  toTopBtn.innerHTML = `<i class="fas fa-caret-up"></i>`;
26  body.prepend(toTopBtn);
27    window.onscroll = function() {scrollFunction()};
28});
29
30function toggleIncutArticle(event){
31  event.target.closest('.incutArticle')?event.target.closest('.incutArticle').classList.add('toggled'): null;
32}
33
34//Get the button:
35function closeIncutHandle(event){
36  // event.preventDefault();
37  if (event.target.closest('.closeIncut')) {
38    event.target.closest('.incutArticle').classList.remove('toggled');
39    // event.currentTarget.preventDefault();
40
41  }
42}
43function scrollFunction() {
44  let toTopBtn = document.getElementById("toTopBtn");
45  if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
46    toTopBtn.style.display = "block";
47  } else {
48    toTopBtn.style.display = "none";
49  }
50}
51
52// When the user clicks on the button, scroll to the top of the document
53function topFunction() {
54  document.body.scrollTop = 0; // For Safari
55  document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
56}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.