Last active
September 20, 2024 18:48
-
-
Save ErkHal/f15af2b62732bb7ac13c3add78a1375d to your computer and use it in GitHub Desktop.
UPDATED 18.10.2023: TamperMonkey script that allows you to download Thingiverse files without the pop-up and 5 second wait time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Thingiverse speed downloader | |
// @namespace http://tampermonkey.net/ | |
// @version 0.4 | |
// @description Just straight up download the .zip and not having to wait for 5 secs or be stopped by anti-adblock. Thanks to Deses, scoutman57, kohrar and quantumfrost for updates ! | |
// @author ErkHal | |
// @include https://www.thingiverse.com/thing:* | |
// @exclude https://www.thingiverse.com/thing:*/edit* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// @grant none | |
// ==/UserScript== | |
// UPDATE THESE SELECTORS IF THIS SCRIPT DOESN'T WORK ANYMORE | |
const BUTTON_SELECTOR = '#react-app > div > div > div.Layout__content--H4y81.ThingPage__thingPage--j9upp > div.ThingPage__thingPageContentWrapper--qHQro > div.ThingPage__thingPageContent--gMLfM > div.Card__card--k0alX.flex.flex--column.flex-gap--md > div.DetailPageTitle__thingTitle--WCfWi > button.um-button.um-button--primary.um-button--icon-right.um-button--rounded.Button__button--vu8l5.Button__large--r5Q9z'; | |
const MODAL_SELECTOR = 'body > div.ReactModalPortal > div > div'; | |
const MODAL_BG_SELECTOR = 'body > div.ReactModalPortal > div'; | |
// EDIT THESE TO STYLE THE DOWNLOAD BUTTON | |
const DOWNLOAD_BUTTON_TEXT = 'DOWNLOAD FILES'; | |
const DOWNLOAD_BUTTON_STYLES = `-webkit-box-direction: normal; | |
-webkit-box-align: center; | |
-webkit-box-pack: center; | |
-webkit-font-smoothing: antialiased; | |
align-items: center; | |
appearance: none; | |
border: 2px solid transparent; | |
display: inline-flex; | |
font: inherit; | |
justify-content: center; | |
margin: 0; | |
outline: 2px solid transparent; | |
text-decoration: none; | |
user-select: none; | |
white-space: nowrap; | |
background-color: #196ef0; | |
color: #fff; | |
flex-shrink: 0; | |
outline-offset: -2px; | |
transition: background-color .15s ease-in-out,color .15s ease-in-out,outline-color .15s ease-in-out,border-color .15s ease-in-out; | |
cursor: pointer; | |
border-radius: 36px; | |
min-height: 48px; | |
min-width: 48px; | |
padding: 10px 22px; | |
font-weight: bold` | |
//Wait for elements to appear on page | |
waitForKeyElements(BUTTON_SELECTOR, noBullshit); | |
function noBullshit() { | |
'use strict'; | |
const downloadElement = document.querySelector(BUTTON_SELECTOR); | |
const downloadElementText = downloadElement.querySelector('span'); | |
const newBtnText = document.createTextNode('GET IT'); | |
downloadElementText.textContent = 'GET IT'; | |
var URL = window.location.href; | |
//Checking if we're on the Details tab or somewhere else | |
if(URL.split("/").length - 1 > 3) { | |
URL = URL.substring(0, URL.lastIndexOf("/")); | |
} | |
const downloadZip = () => { | |
window.location.href = URL + '/zip' | |
} | |
// Create new download button | |
const newDownloadBtn = document.createElement('button'); | |
newDownloadBtn.addEventListener("click", downloadZip); | |
newDownloadBtn.style = DOWNLOAD_BUTTON_STYLES; | |
newDownloadBtn.textContent = DOWNLOAD_BUTTON_TEXT; | |
// Replace the original button | |
downloadElement.replaceWith(newDownloadBtn); | |
}; |
Thanks @scoutman57 and @kohrar, I've updated the gist with your inputs and mentioned you guys in the description :)
Awesome!
…On Mon, Jan 16, 2023 at 04:21 Erkki ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Thanks @scoutman57 <https://github.com/scoutman57> and @kohrar
<https://github.com/kohrar>, I've updated the gist with your inputs and
mentioned you guys in the description :)
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/f15af2b62732bb7ac13c3add78a1375d#gistcomment-4438385>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGYFVMTNLADJWRMKAA23HTWSUOI3BFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTAOBVGA3DCOBTU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you were mentioned.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
They've changed the div name again, here's the new code that works:
// ==UserScript==
// @name Thingiverse speed downloader
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Just straight up download the .zip and not having to wait for 5 secs or be stopped by anti-adblock. Thanks to Deses, scoutman57 and kohrar for updates !
// @author ErkHal
// @include https://www.thingiverse.com/thing:*
// @exclude https://www.thingiverse.com/thing:*/edit*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
// ==/UserScript==
waitForKeyElements ("div.SidebarMenu__sideMenuTop--vJNxy > button", noBullshit);
function noBullshit() {
'use strict';
const downloadElement = document.querySelector('div.SidebarMenu__sideMenuTop--vJNxy > button');
var URL = window.location.href;
//Checking if we're on the Details tab or somewhere else
if(URL.split("/").length - 1 > 3) {
URL = URL.substring(0, URL.lastIndexOf("/"));
}
downloadElement.onclick=function() {
window.location.href = URL + '/zip'
};
downloadElement.innerHTML = '<div class="button button-primary">DOWNLOAD</div>'
};
@quantumfrost updated, thx ! <3
UPDATE 18.10.2023: Simplified the code: now the button is just replaced with a new one with completely different event listener, since the the updated pages now still displayed the modal and also triggered the download. Now the modal as well as the download countdown etc. is completely ignored !
Also added the selectors and the styling to the top of the userscript, so these are easier to update once Thingiverse changes these again. You can also now customize the text to your liking if you want !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@scoutman57 Thanks for the fix; it works for me.
Here's the updated script formatted properly for any one else needing it. I included @idle-user's change too.