Fanfiction.net - Customize Default Result Filter

Override Fanfiction.net's default choices for result filters

当前为 2015-11-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Fanfiction.net - Customize Default Result Filter
  3. // @namespace ssokolow.com
  4. // @description Override Fanfiction.net's default choices for result filters
  5. // @version 1
  6. // @license MIT
  7. //
  8. // @grant GM_getValue
  9. // @grant GM_setValue
  10. // @grant GM_registerMenuCommand
  11. //
  12. // @noframes
  13. // @match *://www.fanfiction.net/*
  14. // ==/UserScript==
  15.  
  16. // TODO: Try to find a way to safely URL-match so I can minimize the number
  17. // of cases where I need to redirect and use @run-at document-start
  18. // for the rest.
  19. var has_filters = document.getElementById('filters') !== null;
  20. var preferred_filter = GM_getValue('preferred_filter');
  21.  
  22. if (preferred_filter && window.location.search === "" && has_filters) {
  23. window.location.search = preferred_filter;
  24. }
  25.  
  26. if (has_filters) {
  27. GM_registerMenuCommand("Save Current Filters as Default", function() {
  28. GM_setValue('preferred_filter', window.location.search);
  29. }, 'S');
  30. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址