Add "MxJ" option to dropdown menu - MAL

Adds "MxJ" option to MAL's dropdown menu. (for mobile and desktop)

当前为 2023-04-03 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Add "MxJ" option to dropdown menu - MAL
  3. // @namespace https://myanimelist.net/profile/kyoyatempest
  4. // @version 1.2
  5. // @description Adds "MxJ" option to MAL's dropdown menu. (for mobile and desktop)
  6. // @author kyoyacchi
  7. // @match https://myanimelist.net/*
  8. // @grant none
  9. // @run-at document-end
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16.  
  17. const option = document.createElement('li');
  18. option.classList.add('link');
  19. const optionLink = document.createElement('a');
  20. optionLink.href = 'https://mxj.myanimelist.net/about-me/';
  21. const optionIcon = document.createElement('i');
  22. optionIcon.classList.add('fas', 'fa-table-list');
  23. optionLink.appendChild(optionIcon);
  24. optionLink.appendChild(document.createTextNode(' MxJ Settings'));
  25. option.appendChild(optionLink);
  26. const mdropdown = document.querySelector('.menu-list');
  27. const ddropdown = document.querySelector('.arrow_box.header-profile-dropdown.header-menu-dropdown > ul');
  28. if (mdropdown){
  29.  
  30.  
  31. mdropdown.appendChild(option)
  32. } else if (ddropdown){
  33.  
  34.  
  35.  
  36. const option1 = document.createElement('li');
  37. const optionLink1 = document.createElement('a');
  38. optionLink1.href = 'https://mxj.myanimelist.net/about-me/';
  39. const optionIcon1 = document.createElement('i');
  40. optionIcon1.classList.add('fas', 'fa-table-list');
  41. const optionText1 = document.createTextNode(' MxJ Settings');
  42. optionLink1.appendChild(optionIcon1);
  43. optionLink1.appendChild(optionText1);
  44. option1.appendChild(optionLink1);
  45. const ddropdown = document.querySelector('.arrow_box.header-profile-dropdown.header-menu-dropdown > ul');
  46. const bookshelf = Array.from(ddropdown.children).find((child) => child.textContent.trim() === 'Bookshelf');
  47.  
  48. if (!bookshelf) {
  49.  
  50. }
  51. ddropdown.insertBefore(option1, bookshelf.nextSibling);
  52.  
  53. }
  54.  
  55. })();