misc-etc/scripts/sunset-archive-shake-gift.txt

37 lines
1.7 KiB
Text
Raw Normal View History

//
// For use in Tampermonkey. Install and select the plus button from the dashboard, or create new script from the dropdown, paste this in.
==UserScript==
// @name Sunset Archive: Shake Gift
// @author nonethefewer original; agnes the alien
// @match *://sunset.femslash.club/users/*/gifts
// @version 1.1.3.0
// @grant none
// @description Shake gifts on Sunset Archive
// @license MIT
// @icon https://sunset.femslash.club/images/ao3_logos/logo_42.png
// @downloadURL for the original https://update.greasyfork.org/scripts/475546/AO3%3A%20Shake%20Gift.user.js
// @updateURL for the original https://update.greasyfork.org/scripts/475546/AO3%3A%20Shake%20Gift.meta.js
// ==/UserScript==
(function($) {
$(document).ready(function() {
if ( !$('body').hasClass('logged-in') ) { return; }
var $base_url = "https://sunset.femslash.club/collections/$COLLECTION$/works?commit=Sort+and+Filter&work_search%5Bquery%5D=id%3A$ID$";
var $main = $( '#main' );
var $thurl = "";
$('.index.group li.work', $main).each( function() {
var work_id = this.id.replace('work_', '');
var collection = "";
if ( work_id !== '' ) {
var $dove = $('div.mystery', this);
if ($dove.length > 0)
{
collection = $('h5 a', this)[0].getAttribute("href").split("/")[2];
$thurl = $base_url.replace("$COLLECTION$", collection).replace("$ID$", work_id);
$('.actions', this).append('<a style="right: 0; position: absolute; margin-right: 10px;" href="' + $thurl + '">Shake Gift</a>');
}
}
});
});
})(window.jQuery);