Reddit image-preview / gallery fixer (old and new)

For both the "new" and "old" reddit, allows the image previews to be set to almost be fullscreen (so that the images are big but fit within your screen).

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name Reddit image-preview / gallery fixer (old and new)
// @description For both the "new" and "old" reddit, allows the image previews to be set to almost be fullscreen (so that the images are big but fit within your screen).
// @match https://www.reddit.com/*
// @match https://old.reddit.com/*
// @version 1.0.1
// @namespace https://greasyfork.org/users/1260957
// ==/UserScript==


(function() {

    // Sets the height to 900px. Choose a height that fits well within your screen. I have a 1440 vertical resolution, and 900px works well for me (it fits almost the full screen).

    // for the new reddit
    const style = document.createElement('style');
    style.textContent = `

          /* for the new reddit */
          figure > div, figure > div > img, figure > a > div, figure > a > div > img { height:900px; width:auto; }
          figure > a > div > div { display:none;}


          /* for the old reddit */
          div.media-preview-content:not(.gallery-tile-content) img.preview { height:900px; width:auto;}
          div.media-preview { max-width:100% !important;}
      `;
    document.head.appendChild(style);

    document.querySelector('div[style="height:700px"]').setAttribute("style", "height:900px; width:auto;");


})();