Royal Road - Follow List Button When No More Chapters

Adds a 'Follow List' button to the bottom-nav when you're on the last available chapter

  1. // ==UserScript==
  2. // @name Royal Road - Follow List Button When No More Chapters
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-02-08
  5. // @description Adds a 'Follow List' button to the bottom-nav when you're on the last available chapter
  6. // @author You
  7. // @match https://www.royalroad.com/fiction/*/*/chapter/*/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=royalroad.com
  9. // @require http://code.jquery.com/jquery-3.4.1.min.js
  10. // @grant none
  11. // @run-at document-end
  12. // ==/UserScript==
  13.  
  14. (function() {
  15.  
  16. var followUrl = "https://www.royalroad.com/my/follows";
  17.  
  18. var nextChapterButton = $('button[disabled="disabled"].btn-primary')[1];
  19. if(nextChapterButton != null){
  20.  
  21. var button = document.createElement('BUTTON');
  22. button.innerHTML = "Follow<br class='visible-xs'>List";
  23. button.id = "btnFollowListCustom";
  24. button.classList.add("btn");
  25. button.classList.add("btn-primary");
  26. button.classList.add("col-xs-2");
  27. nextChapterButton.parentElement.append(button);
  28.  
  29. $('#btnFollowListCustom').click(function() {
  30. window.location.href = followUrl;
  31. });
  32.  
  33. nextChapterButton.outerHTML = nextChapterButton.outerHTML.replace("col-xs-4","col-xs-2");
  34. }
  35.  
  36. })();