Greasy Fork 支持简体中文。

AO3: [Wrangling] Empty Bin links to Previous Page

adds a button to the previous page, if there are no more tags on this page

  1. // ==UserScript==
  2. // @name AO3: [Wrangling] Empty Bin links to Previous Page
  3. // @namespace https://greasyfork.org/en/users/906106-escctrl
  4. // @version 1.1
  5. // @description adds a button to the previous page, if there are no more tags on this page
  6. // @author escctrl
  7. // @license MIT
  8. // @match https://archiveofourown.org/tags/*/wrangle?*
  9. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function($) {
  14. 'use strict';
  15.  
  16. // if there are no tags to be wrangled on this page
  17. if (!$('#main.wrangle-tags form#wrangulator').length) {
  18.  
  19. let search = new URLSearchParams(window.location.search);
  20. let page = parseInt(search.get('page')) || 0;
  21.  
  22. // if we're not on the first page, create a button to jump to the previous page
  23. if (page > 1) {
  24. search.set('page', page-1);
  25. $('.notes')
  26. .text($('.notes').text().replace(/(.*tags) (in.*)/i, "$1 on page "+page+" $2"))
  27. .after(`<p><a href="${window.location.pathname}?${search.toString()}" class="action">Go to Page ${page-1}</a></p>`);
  28. }
  29. }
  30.  
  31. })(jQuery);