-
Notifications
You must be signed in to change notification settings - Fork 5
Integrating Other UserScripts
If you are the author of a UserScript that creates torrent DL (Download) buttons on a page that is also serviced by quiCKIE, you can very easily add quiCKIE integration so that your DL elements receive their very own and fully functioning BunnyButton 🐰
This will allow folks who are using both your UserScript and quiCKIE to send your download links directly to their torrent client, with all the options a BunnyButton provides.
Integration can be done in as little as a single line by adding the special dataset attribute data-quickie_torrenturl to your existing DL elements, with the value of the attribute being a valid torrentURL or magnetLink
let torrentURL = 'https://passthepopcorn.me/torrents.php?action=download&id=12345&authkey=abc123&torrent_pass=abc123'
yourElement.addAttribute('data-quickie_torrenturl', torrentURL)That's it! With just that one attribute, quiCKIE users who have enabled the '🤝' option for that tracker will begin seeing BunnyButtons alongside each of your DL elements!
Keep in mind that after quiCKIE generates the BunnyButton, the special data-quickie_torrenturl attribute will be removed from your DL element, so don't expect that attribute to be around for other tasks.
To avoid race issues between UserScripts when the page is first loaded, quiCKIE will wait a bit to allow all UserScripts to finish their work. After that brief delay, quiCKIE will query the document for all elements containing the special data-quickie_torrenturl attribute...
let allThirdPartyDownloadElements = document.querySelectorAll('[data-quickie_torrenturl]')For every element that is matched, the value of the data-quickie_torrenturl attribute will be used to generate a working BunnyButton, which will then be placed alongside your DL element.
This process will then loop every 5 seconds thereafter, just in case any new third-party elements are added to the page after the initial load, as might be the case when dealing with pagination. This loop is the reason the data-quickie_torrenturl attribute is removed from your DL element, so that it will not be repeatedly matched and acted on.
This simple approach makes it easy to integrate third-party UserScripts into quiCKIE, while at the same time being non-destructive for both parties.
For further details on this process, search for and jump to the @thirdPartyIntegrations section of the quiCKIE codebase.
Only the data-quickie_torrenturl attribute is required for quiCKIE integration. However, there are some optional attributes you may include in your DL element that quiCKIE will check for and act on...
Acceptable Value: A Tracker Name as listed in the quiCKIE settings panel OR the primaryDomain of the trackers website
Including this attribute will allow users that have enabled On + 🌎 to use the BunnyButton settings of the specified tracker. This is useful if your DL elements link to a tracker other than the one being browsed from. If this attribute is not included or is for a tracker not yet supported by quiCKIE, the BunnyButton for your DL elements will use the same settings as the default BunnyButtons on the page.
Here are examples of identifying the primaryDomain of a trackers website. This can be used to identify a tracker that does not yet have quiCKIE support, but will in the future become a valid match if\when that tracker is added to quiCKIE...
https://broadcasthe.net/ --> broadcasthe
https://www.myanonamouse.net/ --> myanonamouse
https://sukebei.nyaa.si/ --> nyaa
Acceptable Value: Any String
This attribute will specify what the separator between your DL element and the generated BunnyButton will be. Common separators include |, , | , etc. If this attribute is not specified, quiCKIE will use the same separator as all the other BunnyButtons that have already been created. This is useful if your DL elements are presented differently than the rest and would look weird if they used the default separator.
Acceptable Value: true
Normally, quiCKIE will check every torrentURL against a regex to determine if it the url has authentication or is a magnet link. If the torrentURL passes this regex check, then the torrentURL will be sent directly to the users torrent client. If it is determined that the torrentURL does not have authentication, quiCKIE will download the .torrent file through the browser and then forward the .torrent file itself to the client.
Setting this optional attribute to true allows you to override that behavior so that the .torrent file is always downloaded through the browser and then forwarded to the client, regardless of whether or not the torrentURL has authentication. This is useful if for whatever reason the authentication in your torrentURL does not work, as I've seen be the case on a couple trackers.