AO3: Disable Hover in Main Menu

Ao3 main menu dropdowns are no longer visible at hover, you have to click the menu entry instead

目前为 2024-02-10 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name AO3: Disable Hover in Main Menu
  3. // @description Ao3 main menu dropdowns are no longer visible at hover, you have to click the menu entry instead
  4. // @version 1.0
  5. // @author escctrl
  6. // @namespace https://greasyfork.org/en/users/906106-escctrl
  7. // @match https://archiveofourown.org/*
  8. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function($) {
  14. 'use strict';
  15.  
  16. // AO3 original menus seem to be built with Bootstrap JS, assumption based on existance of data-* attributes
  17. // Dropdown-on-hover doesn't seem to be native to Bootstrap, AO3 may have additional JS to make that work
  18. // hack inspired by this comment: https://stackoverflow.com/a/19191435/22187458
  19. // when a li.dropdown is being hovered over, Ao3 tries to show its ul.dropdown-menu entries -> we force-hide them again
  20. // tested in Firefox: when clicking on the (still visible) a.dropdown-toggle inside of li.dropdown, ul.dropdown-menu appears (per native Bootstrap, probably)
  21. $('ul.primary.navigation.actions li.dropdown').hover(function() {
  22. $(this).find('.dropdown-menu').hide();
  23. });
  24.  
  25. })(jQuery);