parent
8df975bbbf
commit
0893316b68
@ -0,0 +1,69 @@
|
||||
// ==UserScript==
|
||||
// @name MagicEden Auto-Refresh
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 1.0.4
|
||||
// @description Press Q to Auto-refresh
|
||||
// @author NFTHoarder (original DapperDucks script) & WTMike24 (reduced for any other ME page)
|
||||
// @match https://magiceden.io/marketplace/*
|
||||
// @match https://www.magiceden.io/marketplace/*
|
||||
// @exclude https://magiceden.io/marketplace/dapper_ducks
|
||||
// @icon https://www.google.com/s2/favicons?domain=moonrank.app
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
window.AutoRefresh = 0;
|
||||
window.OpacityBoolean = 1;
|
||||
|
||||
var i = document.createElement('iframe');
|
||||
i.style.display = 'none';
|
||||
document.body.appendChild(i);
|
||||
window.console = i.contentWindow.console;
|
||||
|
||||
var script = document.createElement('script');
|
||||
script.src = 'https://code.jquery.com/jquery-3.4.1.min.js';
|
||||
script.type = 'text/javascript';
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
setTimeout(function() {
|
||||
const newDiv = document.createElement("div");
|
||||
newDiv.setAttribute("id", "jquery_loaded");
|
||||
const currentDiv = document.getElementById("root");
|
||||
document.body.insertBefore(newDiv, currentDiv);
|
||||
}, 1000);
|
||||
|
||||
(new MutationObserver(checkForJquery)).observe(document, {childList: true, subtree: true});
|
||||
|
||||
function checkForJquery(changes, observer) {
|
||||
if(document.querySelector('#jquery_loaded')) {
|
||||
observer.disconnect();
|
||||
var oldFetch = fetch;
|
||||
$('#root').css({ background: "black"});
|
||||
$('body').keydown(function (e){
|
||||
console.log(e.keyCode);
|
||||
if(e.keyCode == 81){
|
||||
toggleAutoRefresh();
|
||||
}
|
||||
});
|
||||
setInterval(function() {
|
||||
autoRefresh();
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
function autoRefresh() {
|
||||
$(".d-flex").css({ display: "flex"});
|
||||
//$(".pt-2").css({ padding: ".5rem"});
|
||||
if(window.AutoRefresh == 1) {
|
||||
$(".me-refresh-btn")[0].click()
|
||||
}
|
||||
}
|
||||
|
||||
function toggleAutoRefresh() {
|
||||
if(window.AutoRefresh == 0) {
|
||||
window.AutoRefresh = 1;
|
||||
} else {
|
||||
window.AutoRefresh = 0;
|
||||
}
|
||||
}
|
||||
})();
|
Loading…
Reference in new issue