Skip to content

Instantly share code, notes, and snippets.

@flowWT
Created September 19, 2022 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flowWT/e60ac4bde93deafb5db63a4fda971ff2 to your computer and use it in GitHub Desktop.
Save flowWT/e60ac4bde93deafb5db63a4fda971ff2 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Gofile_Btn_Download
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://gofile.io/d/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=gofile.io
// @grant GM_addStyle
// ==/UserScript==
var zNode= document.createElement ('div');
zNode.innerHTML = '<button id="myButton" type="button">Download All</button>';
zNode.setAttribute ('id', 'myContainer');
document.body.appendChild (zNode);
// event-listener on the new button
document.getElementById ("myButton").addEventListener (
"click", ButtonClickAction, false
);
function ButtonClickAction (zEvent) {
var allElements, thisElement;
allElements = document.evaluate(
'//*[@class="dropdown-item"]',
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (var i = 0; i < allElements.snapshotLength; i++) {
thisElement = allElements.snapshotItem(i);
console.log(thisElement.href);
window.open(thisElement.href);
}
}
//--- Style for added elements using CSS.
GM_addStyle ( `
#myContainer {
position: absolute;
top: 105px;
left: 460px;
font-size: 18px;
background: #3a4047;
border: 0.1px outset white;
z-index: 1100;
}
#myButton {
cursor: pointer;
background: #3a4047;
border: 1px outset #3a4047;
color: white;
}
#myContainer p {
color: red;
background: white;
}
` );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment