Guest User

megascript

a guest
May 1st, 2020
15,504
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name MEGA.nz Ultimately Import
  3. // @name:zh-TW MEGA.nz Ultimately Import /
  4. // @name:zh-CN MEGA.nz Ultimately Import
  5. // @namespace methusela
  6. // @version 0.1
  7. // @description Bypass import limit on Mega Web client & remove warning about the space usage
  8. // @author d0gkiller87
  9. // @match chrome-extension://bigefpfhnfcobdlfbedofhhaibnlghod/*
  10. // @match http://mega.co.nz/*
  11. // @match http://mega.io/*
  12. // @match http://mega.is/*
  13. // @match http://mega.nz/*
  14. // @match https://mega.co.nz/*
  15. // @match https://mega.io/*
  16. // @match https://mega.is/*
  17. // @match https://mega.nz/*
  18. // @icon https://mega.nz/favicon.ico?v=3
  19. // @run-at document-end
  20. // @grant none
  21. // ==/UserScript==
  22.  
  23. (function() {
  24. 'use strict';
  25. // Reference [Augular loaded detect]: https://stackoverflow.com/a/31970556/9182265
  26. var initWatcher = setInterval(function () {
  27. if (window.MegaUtils) {
  28. clearInterval(initWatcher);
  29. hookImport();
  30. hookFull();
  31. console.info('FUNtions Hooked!');
  32. }
  33. }, 500);
  34. })();
  35.  
  36. var hookImport = function () {
  37. MegaUtils.prototype.checkGoingOverStorageQuota = function(opSize) {
  38. var promise = new MegaPromise();
  39. loadingDialog.pshow();
  40.  
  41. M.getStorageQuota()
  42. .always(function() {
  43. loadingDialog.phide();
  44. })
  45. .fail(promise.reject.bind(promise))
  46. .done(function(data) {
  47.  
  48. /*
  49. if (opSize === -1) {
  50. opSize = data.mstrg;
  51. }
  52.  
  53. if (opSize > data.mstrg - data.cstrg) {
  54. var options = {custom: 1, title: l[882], body: l[16927]};
  55.  
  56. M.showOverStorageQuota(data, options)
  57. .always(function() {
  58. promise.reject();
  59. });
  60. }
  61. else {
  62. */
  63. promise.resolve();
  64. });
  65. return promise;
  66. };
  67. }
  68.  
  69. var hookFull = function () {
  70. FileManager.prototype.showOverStorageQuota = null;
  71. }
RAW Paste Data