Advertisement
Guest User

Dynasty Scans Preload + Long Strip Bookmarklet (Parallel)

a guest
Aug 13th, 2023
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.42 KB | Source Code | 0 0
  1. javascript:
  2. (() => {
  3.     let imageDiv = document.querySelector("#image");
  4.  
  5.     let linksDiv = imageDiv.appendChild(document.createElement("div"));
  6.     linksDiv.appendChild(document.querySelector("#image>.pages-list>#prev_link"));
  7.     linksDiv.appendChild(document.createTextNode("\xa0".repeat(40)));
  8.     linksDiv.appendChild(document.querySelector("#image>.pages-list>#next_link"));
  9.  
  10.     let numLoaded = 0;
  11.     let numLoadedDiv = imageDiv.appendChild(document.createElement("div"));
  12.     numLoadedDiv.textContent = `Loaded 0/${pages.length}`;
  13.  
  14.     let pagesDiv = imageDiv.appendChild(document.createElement("div"));
  15.  
  16.     let topButton = imageDiv.appendChild(document.createElement("div")).appendChild(document.createElement("button"));
  17.     topButton.textContent = "Scroll to Top";
  18.     topButton.onclick = () => {
  19.         window.scrollTo({top: 0, behavior: "smooth"});
  20.     };
  21.  
  22.     for (const node of document.querySelectorAll("#image>.pages-list, #image>.left, #image>.right, #image>img")) {
  23.         node.parentNode.removeChild(node);
  24.     }
  25.  
  26.     for (const page of pages) {
  27.         let newImg = document.createElement("img");
  28.         newImg.onload = newImg.onerror = () => {
  29.             numLoadedDiv.textContent = `Loaded ${++numLoaded}/${pages.length}`;
  30.         };
  31.         newImg.alt = page.name;
  32.         newImg.src = page.image;
  33.         pagesDiv.appendChild(document.createElement("div")).appendChild(newImg);
  34.     }
  35. })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement