Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. document.querySelectorAll(".directory-listing-table tr").forEach(r => { //Loop through table
  2.     let f = r.firstElementChild; //Alternate: .children[0] but can't .children.pop() over lastElementChild, consistency!
  3.     let i = f.innerText;
  4.  
  5.     if (/\.(zip|rar)$/.test(i)) //Put preview shortcut on filesize when applicable.
  6.         r.children[2].innerHTML = `<a href='${encodeURIComponent(i)}/'>${r.children[2].innerText}</a>`;
  7.    
  8.     if (!r.matches("[class$=restricted-file]")) return;  
  9.     r.classList.remove("directory-listing-table__restricted-file")  //Remove class safely, otherwise set to []
  10.     f.innerHTML = `<a href='${encodeURIComponent(i)}'>${i}</a>`;    //Create link
  11.     r.lastElementChild.innerHTML = "";                              //Remove lock icon
  12. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement