Redgifs watch page view only video

watch page show only video

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name            	Redgifs watch page view only video
// @namespace       	https://greasyfork.org/users/821661
// @match           	https://*.redgifs.com/watch/*
// @match           	https://*.redgifs.com/ifr/*
// @grant           	none
// @version         	1.1
// @author          	hdyzen
// @description     	watch page show only video
// @license         	MIT
// @run-at              document-start
// ==/UserScript==
'use strict';

function getUrlGif(json) {
    if (typeof json === 'string' && json.includes('"gif"')) {
        const parsed = originalParse(json);
        const htmlToUse = `<img src="${parsed.gif.urls.poster}" style="position: fixed;width: 100%;z-index: -1;filter: blur(90px);"><video controls src=${parsed.gif.urls.hd || parsed.gif.urls.sd} poster="${parsed.gif.urls.poster}" style="max-height: calc(100vh - 20px); border-radius: 10px; cursor: pointer; max-width: calc(100vw - 20px);"></video>`;

        document.body.innerHTML = htmlToUse;
        document.body.style = 'display: flex; justify-content: center; align-items: center; height: 100vh;';
    }
}

const originalParse = JSON.parse;

JSON.parse = function (json, ...args) {
    getUrlGif(json);
    return originalParse(json, ...args);
};