AO3: Disable Hover in Main Menu

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

Verze ze dne 10. 02. 2024. Zobrazit nejnovější verzi.

// ==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);