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 提交的版本。查看 最新版本

// ==UserScript==
// @name         AO3: Disable Hover in Main Menu
// @description  Ao3 main menu dropdowns are no longer visible at hover, you have to click the menu entry instead
// @version      1.0
// @author       escctrl
// @namespace    https://greasyfork.org/en/users/906106-escctrl
// @match        https://archiveofourown.org/*
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js
// @grant        none
// @license      MIT
// ==/UserScript==

(function($) {
    'use strict';

    // AO3 original menus seem to be built with Bootstrap JS, assumption based on existance of data-* attributes
    // Dropdown-on-hover doesn't seem to be native to Bootstrap, AO3 may have additional JS to make that work
    // hack inspired by this comment: https://stackoverflow.com/a/19191435/22187458
    // when a li.dropdown is being hovered over, Ao3 tries to show its ul.dropdown-menu entries -> we force-hide them again
    // tested in Firefox: when clicking on the (still visible) a.dropdown-toggle inside of li.dropdown, ul.dropdown-menu appears (per native Bootstrap, probably)
    $('ul.primary.navigation.actions li.dropdown').hover(function() {
        $(this).find('.dropdown-menu').hide();
    });

})(jQuery);