Are you sure you want to go to an external site to donate a monetary value?
WARNING: Some countries laws may supersede the payment processors policy such as the GDPR and PayPal. While it is highly appreciated to donate, please check with your countries privacy and identity laws regarding privacy of information first. Use at your utmost discretion.
Script throws error because jquery library is not referenced. Fixed by adding @require to jquery CDN:
// ==UserScript== // @name Auto-Claim Itch.io Bundles // @author jnaskali // @copyright 2020, Juhani Naskali (www.naskali.fi) // @license MIT // @version 1.0 // @namespace https://www.naskali.fi // @downloadURL https://openuserjs.org/install/jnaskali/Auto-Claim_Itch.io_Bundles // // @match https://itch.io/bundle/download/* // @grant none // // @require https://code.jquery.com/jquery-3.5.1.min.js // // @description Automatically clicks all claim links on itch.io bundle download pages. Especially useful to (semi)automatically claim the over 1,500 games in Itch.io Bundle for Racial Justice and Equality. Just add the userscript and visit all download pages to claim the items to your library. // ==/UserScript== $(document).ready(function() { var clicked = 0; $('button[value="claim"').each(function() { $(this).parent().attr('target','_blank'); // change claim links to open in new tab(s) $(this).click(); clicked++; }); console.log("Auto-claimed " + clicked + " buttons."); });
(Also added
$(document).ready(function() {...});
)Big thanks for pointing this out and for the DM conversation on Twitter! While I ran this succesfully with ViolentMonkey, it seems Greasemonkey needs to be told explicitly to use unsafeWindow's jQuery. I added the necessary line to the script.
I think userscripts have a @run-at default of document-end, so wrapping it in a ready function doesn't seem necessary, but someone please let me know if something like this is best-practice.
@jnaskali
Re:
GM's
@run-at
currently states:jQuery's
$(document).ready
currently states:... and also states ...
So if you need complete page load the latter jQuery reference is what to use... otherwise the former and/or GM's
@run-at
should be okay if the DOM is all you are looking for.But... Note some types of CSS can add content on the fly with a style sheet. I don't see you using a MutationObserver so it's probably okay for now.
May want to have the
noConflict
option put in mentioned here for .user.js engines that may need that.Depends on the GM version and Firefox version. Sandboxing comes and goes (both are facing long term growing pains from Moz and changes) which is why one should always use an IIFE for best practices on ones code.
Sites Cross Origin policy could have changed too, along with Firefox version, to prevent certain things from being shared/utilized.