I have been trying to migrate an userScript into my own extension but for some reason I am not able to run the following code:
// ==/UserScript==
console.info('BEFORE Hooked! MONKEY');
(function() {
'use strict';
// Reference [Augular loaded detect]: https://stackoverflow.com/a/31970556/9182265
var initWatcher = setInterval(function () {
if (window.MegaUtils) {
console.info(window.MegaUtils);
clearInterval(initWatcher);
hookImport();
hookFull();
console.info('FUNtions Hooked! MONKEY');
}
}, 500);
})();
But for some reason the IF statement is never TRUE, but the same exact code is run from ViolentMonkey, it works right away.
So window.MegaUtils is not been detected at all and i have no idea why. I was told that my extension might not have access to the DOM object but why ViolentMonkey does have access to it.
This is the manifest i am using when importing the extension in Chrome:
{
"manifest_version": 2,
"content_scripts": [ {
"exclude_globs": [ ],
"include_globs": [ "*" ],
"js": [ "mega.user.js" ],
"matches": [ "https://mega.nz/*",
"http://mega.nz/*" ],
"run_at": "document_end"
} ],
"converted_from_user_script": true,
"description": "testing extension",
"permissions": [],
"name": "MegaByPass",
"icons": {
"16": "images/mega-cloud-icon.png",
"32": "images/mega-cloud-icon.png",
"48": "images/download.png",
"128": "images/873133.png"
},
"version": "1.0"
}
Thanks in advance.