useless_buttons

Удаляет при просмотре боя кнопку `вернуться назад` и `вернуться на страницу героя`, в десктоп клиенте убирает кнопку `информация`

  1. // ==UserScript==
  2. // @name useless_buttons
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.3
  5. // @description Удаляет при просмотре боя кнопку `вернуться назад` и `вернуться на страницу героя`, в десктоп клиенте убирает кнопку `информация`
  6. // @author Something begins
  7. // @license University of Sugma
  8. // @match https://www.heroeswm.ru/war*
  9. // @match https://my.lordswm.com/war*
  10. // @match https://www.lordswm.com/war*
  11. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  12. // @grant unsafeWindow
  13. // ==/UserScript==
  14.  
  15. function observeDisplay(el){
  16. const observer = new MutationObserver((mutationsList) => {
  17. for (const mutation of mutationsList) {
  18. if (mutation.type === "attributes" && mutation.attributeName === "style" && el.style.display !== "none") {
  19. el.style.display = "none";
  20. }
  21. }
  22. });
  23. observer.observe(el, {
  24. attributes: true,
  25. attributeFilter: ["style"]
  26. });
  27.  
  28. }
  29. const mobileInterval = setInterval(() => {
  30. if ([typeof android, typeof iOS].includes("undefined")) return;
  31. clearInterval(mobileInterval);
  32. const selectors = ["back_to_game", "back_to_home"];
  33. if (!android && !iOS) selectors.push("info_on");
  34. const buttonsLoadedInterval = setInterval(()=>{
  35.  
  36. selectors.forEach(selector=>{
  37. const el = document.querySelector("#"+selector);
  38. if (el) {
  39. el.style.display = "none";
  40. observeDisplay(el);
  41. clearInterval(buttonsLoadedInterval);
  42. }
  43. })
  44. }, 100);
  45. }, 100);
  46.  
  47.  
  48.