Imgur auto resize

Automatically resizes imgur videos to fit the screen height

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Imgur auto resize
// @namespace    https://greasyfork.org/en/scripts/434744-imgur-auto-resize
// @version      1.3
// @description  Automatically resizes imgur videos to fit the screen height
// @icon         https://imgur.com/favicon.ico
// @author       NotJ3st3r
// @license      MIT
// @match        https://i.imgur.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    addGlobalStyle('body { overflow: hidden !important; }');
  
    try {
        var video = document.getElementsByTagName('video');  
        video[0].style.height = "100vh";
        video[0].style.width = "auto";
        video[0].muted = false;
        setInterval(function(){
            if(video[0]){
                video[0].setAttribute("controls", "controls");
            }
        }, 100);
    }
    catch{}
    
    try {
        var image = document.getElementsByTagName("img");
        image[0].style.height = "100vh";
        image[0].style.width = "auto";
    }
    catch{}
})();

function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}