Taimanin Screen

対魔忍のゲーム画面以外を疎放的に非表示にするスクリプト。

  1. // ==UserScript==
  2. // @name Taimanin Screen
  3. // @description 対魔忍のゲーム画面以外を疎放的に非表示にするスクリプト。
  4. // @author Ginoa AI
  5. // @namespace https://greasyfork.org/ja/users/119008-ginoa-ai
  6. // @version 4.1
  7. // @match https://pc-play.games.dmm.com/play/taimanin_rpg/
  8. // @match https://pc-play.games.dmm.co.jp/play/taimanin_rpgx/
  9. // @match https://play.games.dmm.co.jp/game/taimanin_rpgx
  10. // @icon https://www.lilith-soft.com/images/favicon.ico
  11. // ==/UserScript==
  12. var css = function(){/*
  13. html {
  14. margin: 0;
  15. padding: 0;
  16. overflow: hidden;
  17. }
  18. #game_frame {
  19. scrolling: no;
  20. position: fixed;
  21. width: 1280px !important;
  22. height: 751px !important;
  23. left: 0px;
  24. top: 0px;
  25. z-index: 2147483646 !important;
  26. }
  27. dialog {
  28. overflow: scroll;
  29. width: 98% !important;
  30. height: 100vh !important;
  31. padding: 1% !important;
  32. left: 0px !important;
  33. top: 0px !important;
  34. z-index: 2147483647 !important;
  35. }
  36. */}.toString().match(/\n([\s\S]*)\n/)[1];
  37. var style = document.createElement("style");
  38. style.innerHTML = css;
  39. document.head.appendChild(style);
  40.  
  41. document.querySelector('link[rel="icon"]').href = "https://www.lilith-soft.com/images/favicon.ico";
  42.  
  43. var canvas = "<div style=\"background-color: #FFFFFF; z-index: 2147483645; width: 100%; height: 100vh; left: 0%; top: 0%;\"></div>";
  44. document.documentElement.insertAdjacentHTML("afterbegin", canvas);
  45.  
  46. var game;
  47. var MarginTop;
  48. var GameWidth;
  49. var GameHeight;
  50. var observer = new MutationObserver(() => {
  51. game = document.querySelector('iframe[id="game_frame"]');
  52. if (game) {
  53. observer.disconnect();
  54. MarginTop = -31;
  55. GameWidth = 1280;
  56. GameHeight = 720;
  57. game.style.cssText += "margin-top: " + MarginTop + "px !important;";
  58. game.setAttribute("scrolling", "no");
  59. resize();
  60. }
  61. });
  62. observer.observe(document.body, { childList: true, subtree: true });
  63.  
  64. var resize = function(){
  65. var Scale = Math.min.apply(null, [
  66. window.innerWidth / GameWidth,
  67. window.innerHeight / GameHeight,
  68. ]);
  69. game.style.transform = "scale(" + Scale + ")";
  70.  
  71. var ChangeLeft = (GameWidth - (GameWidth * Scale)) / 2;
  72. var ChangeMarginTop = (game.getBoundingClientRect().top - parseInt(game.style.marginTop) - (MarginTop * Scale)) * -1;
  73. game.style.left = -ChangeLeft + "px";
  74. game.style.cssText += "margin-top: " + ChangeMarginTop + "px !important;";
  75. };
  76.  
  77. window.onresize=function(){
  78. resize();
  79. };