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