Taimanin Screen

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

Verze ze dne 01. 12. 2022. Zobrazit nejnovější verzi.

// ==UserScript==
// @name        Taimanin Screen
// @description 対魔忍のゲーム画面以外を疎放的に非表示にするスクリプト。
// @author      Sakura_Kocho
// @namespace   https://twitter.com/Sakura_Kocho
// @version     2.2
// @match       https://pc-play.games.dmm.com/play/taimanin_rpg/
// @match       https://pc-play.games.dmm.co.jp/play/taimanin_rpgx/
// @icon        https://pbs.twimg.com/profile_images/1471673794754654208/e4U53d02_400x400.png
// ==/UserScript==
var css = function(){/*
	html {
    overflow: hidden;
  }
  #game_frame {
    position: fixed;
    width: 1280px !important;
    height: 755px !important;
    left: 0px;
    top: 0px;
    z-index: 114514;
  }
  #alert {
    width: 100% !important;
    left: 0px !important;
    top: 0px !important;
    z-index: 114515 !important;
  }
  .HiddenTaimanin {
    display: none;
  }
*/}.toString().match(/\n([\s\S]*)\n/)[1];
 
var style = document.createElement("style");
style.innerHTML = css;
document.head.appendChild(style);
 
document.querySelector('link[rel="icon"]').href = "https://www.lilith-soft.com/images/favicon.ico";

// 旧スタイル
// var game = document.querySelector('iframe[id="game_frame"]');
// document.documentElement.appendChild(game);

// for (var i = 0 ; i < document.getElementsByTagName("*").length ; i++){
//   if (document.getElementsByTagName("*")[i].tagName != "HTML" && document.getElementsByTagName("*")[i].tagName != "IFRAME") {
//     document.getElementsByTagName("*")[i].classList.add("HiddenTaimanin");
//   }
// }
 
for (var i = 0 ; i < document.getElementsByTagName("*").length ; i++){
  if (document.getElementsByTagName("*")[i].tagName != "HTML" && document.getElementsByTagName("*")[i].tagName != "BODY" && document.getElementsByTagName("*")[i] != document.querySelector('div[id="w"]') && document.getElementsByTagName("*")[i] != document.querySelector('div[id="main-ntg"]') && document.getElementsByTagName("*")[i] != document.querySelector('div[id="page"]') && document.getElementsByTagName("*")[i] != document.querySelector('div[id="page-inner"]') && document.getElementsByTagName("*")[i] != document.querySelector('div[id="area-game"]') && document.getElementsByTagName("*")[i] != document.querySelector('div[id="alert"]') && document.getElementsByTagName("*")[i] != document.querySelector('iframe[id="game_frame"]')) {
    document.getElementsByTagName("*")[i].classList.add("HiddenTaimanin");
  }
}

 
var Game = document.querySelector('iframe[id="game_frame"]');
var MarginTop = -35;
var GameWidth = 1280;
var GameHeight = 720;
Game.style.cssText += "margin-top: " + MarginTop + "px !important;";
 
var resize = function(){
  var Scale = Math.min.apply(null, [
      window.innerWidth / GameWidth,
      window.innerHeight / GameHeight,
  ]);
  Game.style.transform="scale("+Scale+")";
 
  var ChangeLeft = (GameWidth - (GameWidth * Scale)) / 2;
  var ChangeMarginTop = (Game.getBoundingClientRect().top - parseInt(Game.style.marginTop) - (MarginTop * Scale)) * -1;
  Game.style.left = -ChangeLeft + "px";
  Game.style.cssText += "margin-top: " + ChangeMarginTop + "px !important;";
};
 
window.onresize=function(){
  resize();
};
resize();