I got irritated by all the Untitled.ahk files cluttering my downloads folder and made a little userscript to fix the download names once and for all.
It works primarily on Tampermonkey and I have tested it out with Greasemonkey with no issues as well.
Features:
- The Download Button will use a filename generated from the topic name and a suffix to avoid clashing.
- Adds a "Download As Button" that prompts you for a file name. The script will try to add the appropriate extension if you didn't add it
- When the content in the codeblocks are downloaded, (if it is an ahk file) the script will add a link to the post, topic, and the full title as a comment.
There are two versions of the script:
- Standard Version(no dependencies): uses the length of the content in the code block as a suffix
- MD5 Version: (depends on CryptoJS)One that uses the first 5 characters of the md5sum of the content in the code block
Any improvements on the default formatting of the filenames or the sanitization process is welcome. Right now, the default formats are suited to my personal preference.
This script works very well in conjunction with an extension/addon that prevents duplicate files from downloading. I'm using No More Duplicates
To Install:
- Make sure you have Greasemonkey/Tampermonkey installed
- Head over to the gist
- Pick the variant you want. titled.user.js or titled_md5.user.js
- Click on the Raw Button. Tampermonkey/GreaseMonkey should intercept it and prompt an install.
Links:
Here's another unrelated userscript that makes the logo button redirect to the boards instead of the landing page:
Spoiler