Greasy Fork

Greasy Fork is available in English.

치지직 1080p 해상도 고정

치지직 1080p 해상도로 고정합니다

当前为 2024-11-02 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         치지직 1080p 해상도 고정
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  치지직 1080p 해상도로 고정합니다
// @match        *://chzzk.naver.com/*
// @match        https://chzzk.naver.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 해상도 설정 함수
    function setResolution() {
        const settingsButton = document.querySelector('.pzp-pc-setting-button');

        if (settingsButton) {
            settingsButton.click();

            setTimeout(() => {
                const qualityMenu = document.querySelector('.pzp-pc-setting-intro-quality');
                if (qualityMenu) {
                    qualityMenu.click();

                    setTimeout(() => {
                        const options = document.querySelectorAll('.pzp-pc-ui-setting-quality-item');
                        const option1080p = Array.from(options).find(option => option.textContent.includes('1080p'));
                        const option720p = Array.from(options).find(option => option.textContent.includes('720p'));

                        if (option1080p && !option1080p.classList.contains('pzp-pc-ui-setting-item--checked')) {
                            option1080p.click();
                        } else if (option720p && !option720p.classList.contains('pzp-pc-ui-setting-item--checked')) {
                            option720p.click();
                        }
                    }, 500);
                }
            }, 500);
        }
    }

    // 스크롤 오류 수정 함수
    function fixScrollIssue() {
        document.body.style.overflow = 'auto';
        document.documentElement.style.overflow = 'auto';

        // `position: fixed` 속성 제거
        document.body.style.position = '';
        document.documentElement.style.position = '';

        // `height` 속성 재설정
        document.body.style.height = 'auto';
        document.documentElement.style.height = 'auto';
    }

    // URL이 특정 페이지인지 확인하고 설정 및 스크롤 수정 적용
    function checkAndApplySettings() {
        if (location.href.startsWith('https://chzzk.naver.com/live/')) {
            setTimeout(setResolution, 1000);
            fixScrollIssue();
        } else {
            fixScrollIssue(); // 다른 페이지에서도 스크롤 문제 해결
        }
    }

    // URL 변화 감지하여 설정 및 스크롤 재적용
    let lastUrl = location.href;
    setInterval(() => {
        if (location.href !== lastUrl) {
            lastUrl = location.href;
            checkAndApplySettings();
        }
    }, 1000);

    // 페이지 처음 로드 시 설정 및 스크롤 문제 확인
    window.addEventListener('load', () => {
        checkAndApplySettings();
    });
})();