Kancolle Scaler

艦これのゲーム画面をウィンドウと同じサイズに拡大/縮小するスクリプト

As of 21.12.2020. See ბოლო ვერსია.

// ==UserScript==
// @name         Kancolle Scaler
// @namespace    http://hisaruki.tumblr.com/
// @version      1.0
// @description  艦これのゲーム画面をウィンドウと同じサイズに拡大/縮小するスクリプト
// @author       hisaruki
// @match        http://www.dmm.com/netgame/social/-/gadgets/=/app_id=854854/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    $("*").css("overflow", "hidden");
    $("#game_frame").css("position", "fixed");
    $("#game_frame").css("left", 0);
    $("#game_frame").css("top", 0);
    $("#game_frame").css("z-index", 32768);
    $("#game_frame").css("transform-origin-x", "left");
    $("#game_frame").css("transform-origin-y", "top");
    $("#game_frame").css("height", "inherit");

    let resize = function(){
        let scale = Math.min.apply(null, [
            window.innerWidth / $("#game_frame").width(),
            window.innerHeight / $("#game_frame").height(),
        ]);
        //console.log(scale, (window.innerWidth - ($("#game_frame").width() * scale))/2);
        $("#game_frame").css("transform", "scale("+scale+")");
        $("#game_frame").css("left", (window.innerWidth - ($("#game_frame").width() * scale))/2);
    }
    setTimeout(function(){
        resize();
    }, 8000);
    $(window).resize(function() {
        resize();
    });
})();