Sort Mega.nz files by size

It will sort Mega.nz files by size by auto clicking required buttons after interval of few seconds

当前为 2021-12-22 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Sort Mega.nz files by size
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description It will sort Mega.nz files by size by auto clicking required buttons after interval of few seconds
  6. // @author JethaLal_420
  7. // @match https://mega.nz/folder/*
  8. // @icon https://www.google.com/s2/favicons?domain=mega.nz
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. var listViewBtn, blockViewBtn
  15.  
  16. function checkDataLoaded() {
  17. listViewBtn = document.getElementsByClassName('listing-view')[0]
  18. blockViewBtn = document.getElementsByClassName('block-view')[0]
  19. }
  20. function clickBtn() {
  21. clearInterval(intervalId)
  22. setTimeout(() => {
  23. listViewBtn.click()
  24. console.log('List View btn Clicked')
  25. var sizeBtn = document.getElementsByClassName('size')[0]
  26. setTimeout(()=>{
  27. sizeBtn.click()
  28. console.log('Sort By Size btn Clicked')
  29. },1200)
  30. setTimeout(()=>{
  31. blockViewBtn.click()
  32. console.log('Block View btn Clicked')
  33. },2100)
  34.  
  35. }, 4500)
  36. }
  37. let intervalId = setInterval(() => {
  38. checkDataLoaded()
  39.  
  40. if (listViewBtn && blockViewBtn){
  41. clickBtn()
  42. }
  43. }, 1000)
  44. })();