useless_buttons

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

当前为 2025-04-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name useless_buttons
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.1
  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. console.log("activated");
  18. for (const mutation of mutationsList) {
  19. if (mutation.type === "attributes" && mutation.attributeName === "style" && el.style.display !== "none") {
  20. el.style.display = "none";
  21. }
  22. }
  23. });
  24. observer.observe(el, {
  25. attributes: true,
  26. attributeFilter: ["style"]
  27. });
  28.  
  29. }
  30.  
  31. const mobileInterval = setInterval(() => {
  32. if ([typeof android, typeof iOS].includes("undefined")) return;
  33. clearInterval(mobileInterval);
  34. if (!android && !iOS) return;
  35. const buttonsLoadedInterval = setInterval(()=>{
  36. ["back_to_game", "back_to_home"].forEach(selector=>{
  37. const el = document.querySelector("#"+selector);
  38. if (el) {
  39. el.style.display = "none";
  40. console.log("get nonned");
  41. observeDisplay(el);
  42. clearInterval(buttonsLoadedInterval);
  43. }
  44. })
  45. }, 100);
  46. }, 100);