您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
switches the download buttons and colors the inline button red
- // ==UserScript==
- // @name mega dl button fix
- // @version 0.2
- // @match https://mega.nz/*
- // @description switches the download buttons and colors the inline button red
- // @grant none
- // @namespace https://greasyfork.org/users/29657
- // ==/UserScript==
- waitForButton();
- function doEverything() {
- msbut = document.getElementsByClassName("with-megasync")[0];
- inbut = document.getElementsByClassName("throught-browser")[0];
- // msbut.style.display = "none";
- msbut.className = msbut.className.replace( /(?:^|\s)red(?!\S)/g , '' );
- inbut.className += " red";
- swapElements(msbut, inbut);
- }
- function waitForButton() {
- buttons = document.getElementsByClassName("throught-browser").length;
- if(buttons > 0) {
- doEverything();
- } else {
- setTimeout(waitForButton, 50);
- }
- }
- function swapElements(obj1, obj2) {
- // from http://stackoverflow.com/a/10717422/4504269
- var parent2 = obj2.parentNode;
- var next2 = obj2.nextSibling;
- if (next2 === obj1) {
- parent2.insertBefore(obj1, obj2);
- } else {
- obj1.parentNode.insertBefore(obj2, obj1);
- if (next2) {
- parent2.insertBefore(obj1, next2);
- } else {
- parent2.appendChild(obj1);
- }
- }
- }