Skip to content

Instantly share code, notes, and snippets.

@rEtSaMfF

rEtSaMfF/fixMEGA.user.js

Last active Apr 9, 2021
Embed
What would you like to do?
Fix MEGA.nz stuff
// ==UserScript==
// @name fixMEGA
// @namespace fixMEGA
// @version 2017-03-08
// @description Fix MEGA.nz stuff
// @include https://mega.nz/*
// @run-at document-idle
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.slim.min.js
// ==/UserScript==
function fixMEGA() {
$('.nw-fm-tree-header.folder-link').find('input')
.val($('.nw-tree-panel-header span').text().trim())
.attr('readonly', false)
.css('color', 'black')
.css('background-color', 'white')
.css('font-size', '8px')
.css('text-align', 'center');
}
function checkReady() {
if ($('.nw-fm-tree-header.folder-link').length &&
$('.nw-tree-panel-header span').length) {
if ($('.nw-tree-panel-header span').text().trim() == "My folders") {
return setTimeout(checkReady, 1000);
}
return fixMEGA();
} else {
return setTimeout(checkReady, 2000);
}
}
setTimeout(checkReady, 3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment