Add AO3 Mark for Later Button to works list

Puts the "Marked for Later" button in a fic blurb when browsing AO3.

  1. // ==UserScript==
  2. // @name Add AO3 Mark for Later Button to works list
  3. // @namespace https://greasyfork.org
  4. // @version 0.1
  5. // @description Puts the "Marked for Later" button in a fic blurb when browsing AO3.
  6. // @author JaneBuzJane but indebted to Bat, always
  7. // @match http://archiveofourown.org/tags*
  8. // @match https://archiveofourown.org/tags*
  9. // @match http://archiveofourown.org/works*
  10. // @match https://archiveofourown.org/works*
  11. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js
  12. // @require https://code.jquery.com/jquery-2.2.4.js
  13. // @run-at document-idle
  14. // @grant none
  15. // ==/UserScript==
  16.  
  17. var $j = jQuery.noConflict();
  18.  
  19. $j(document).ready(function() {
  20.  
  21. for (var i = 0, link, links = $("li[role=article] > .header > .heading:first-child > a[href*='/works']"); i < links.length; i++) {
  22.  
  23. (link = $(links[i])).closest(".header")
  24. .nextAll(".stats")
  25. .before("<span class=\"actions\" style=\"float: left; clear: right;\"><a href=\"" + link.attr("href") + "/mark_for_later\">Mark For Later</a></span>");
  26. }
  27.  
  28. });