NRKCinemaMode

Forbedre videoavspillingsopplevelsen på NRK ved å få den til å fylle hele fanen

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         NRKCinemaMode
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Forbedre videoavspillingsopplevelsen på NRK ved å få den til å fylle hele fanen
// @author       H3rl
// @match        https://tv.nrk.no/*/avspiller
// @icon         https://www.google.com/s2/favicons?sz=64&domain=nrk.no
// @license      MIT
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    window.onload = function () {
        applyCinemaMode();
    };

    function applyCinemaMode() {
        let episodelist = document.querySelector('#episode-list');

        if (!episodelist) {
            handleLoadFailure();
            return;
        }

        // Patch the episode list
        episodelist.classList.remove('tv-series-season-episode__list--sticky');
        episodelist.style.width = '300px';
        episodelist.style.marginLeft = 'auto';
        episodelist.style.marginRight = 'auto';

        // Apply custom styles
        applyStyles();
    }

    function applyStyles() {
        let style = document.createElement('style');
        style.innerHTML = `
            .tv-series-season-grid {
                display: block !important;
                margin: 5px !important;
            }
            ::-webkit-scrollbar {
                display: none;
            }
        `;

        document.head.appendChild(style);

        let grid = document.querySelector('.tv-series-season-grid');
        if (!grid) {
            handleLoadFailure();
            return;
        }
        grid.style.display = 'block';

        console.log("Success!");
    }

    function handleLoadFailure() {
        console.log("Could not apply patch, trying again!");
        setTimeout(applyCinemaMode, 100);
    }
})();