MyAnimeList(MAL) - Hover List, Notifications and Profile dropdown

Why click on the icons when you can hover?

当前为 2016-04-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name MyAnimeList(MAL) - Hover List, Notifications and Profile dropdown
  3. // @version 1.0.3
  4. // @description Why click on the icons when you can hover?
  5. // @author Cpt_mathix
  6. // @match http://myanimelist.net/*
  7. // @exclude http://myanimelist.net/animelist*
  8. // @exclude http://myanimelist.net/mangalist*
  9. // @grant none
  10. // @namespace https://greasyfork.org/users/16080
  11. // ==/UserScript==
  12.  
  13. if (typeof jQuery == 'undefined') $ = unsafeWindow.$;
  14.  
  15. var properties = {
  16. sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
  17. interval: 0, // number = milliseconds for onMouseOver polling interval
  18. over: showInfo, // function = onMouseOver callback (required)
  19. timeout: 300, // number = milliseconds delay before onMouseOut
  20. out: hideInfo // function = onMouseOut callback (required)
  21. };
  22.  
  23. $('#header-menu > div.header-menu-unit.header-list.js-header-menu-unit').hoverIntent(properties);
  24.  
  25. $('#header-menu > div.header-menu-unit.header-notification.js-header-notification').hoverIntent(properties);
  26.  
  27. $('#header-menu > div.header-menu-unit.header-profile.js-header-menu-unit').hoverIntent(properties);
  28.  
  29. function showInfo() {
  30. if (! $(this).hasClass('on')) {
  31. $('.header-list-dropdown').hide();
  32. $('.header-notification-dropdown').hide();
  33. $('.header-menu-dropdown').hide();
  34. $(this).find('.header-list-dropdown').show();
  35. $(this).find('.header-notification-dropdown').show();
  36. $(this).find('.header-menu-dropdown').show();
  37. $(this).addClass('on');
  38. }
  39. }
  40.  
  41. function hideInfo() {
  42. $(this).find('.header-list-dropdown').hide();
  43. $(this).find('.header-notification-dropdown').hide();
  44. $(this).find('.header-menu-dropdown').hide();
  45. $(this).removeClass('on');
  46. }