LmaoAyy Drive Enhancer

Adds various enhancements to LmaoAyy's FileBoard

  1. // ==UserScript==
  2. // @name LmaoAyy Drive Enhancer
  3. // @namespace http://lmaoayy.ml/Drive/
  4. // @description Adds various enhancements to LmaoAyy's FileBoard
  5. // @include http://lmaoayy.ml/Drive/*
  6. // @version 0.1.2
  7. // @grant GM_log
  8. // @grant GM_addStyle
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12.  
  13. function main() {
  14. images = document.querySelectorAll('a[href$="jpg"]>img,a[href$="png"]>img,a[href$="gif"]>img');
  15. for (n = 0; n < images.length; ++n) {
  16. images[n].src = images[n].parentElement.href;
  17. images[n].parentElement.addEventListener("click", toggleExpanded);
  18. }
  19. }
  20.  
  21. function toggleExpanded(event) {
  22. this.classList.toggle("expanded");
  23. event.preventDefault();
  24. }
  25.  
  26. GM_addStyle([
  27. 'a[href*="fileUploads"] > img {',
  28. ' max-width: 100px;',
  29. ' max-height: 100px;',
  30. '}',
  31. 'a.expanded > img{',
  32. ' max-width: 100%;',
  33. ' max-height: 100%;',
  34. ' height: auto;'
  35. ].join('\n'));
  36.  
  37. setTimeout(main, 0);