Greasy Fork

Greasy Fork is available in English.

치지직 1080p 해상도 고정

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(function () {
    'use strict';

    // 해상도 설정 함수 (1080p 시도, 없으면 720p 시도)
    function setResolution() {
        const qualityItem = document.querySelector(
            `.pzp-pc-setting-quality-pane__list-container > li:first-child:not(.pzp-pc-ui-setting-item--checked)`
        );

        if (qualityItem) {
            qualityItem.click();
            console.log("1080p 해상도로 설정되었습니다.");
        } else {
            console.log("1080p 해상도를 사용할 수 없습니다.");
        }
    }

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

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

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

        console.log("스크롤 오류가 수정되었습니다.");
    }

    // 특정 페이지에서 해상도 및 스크롤 설정 적용
    function applySettingsOnSpecificPages() {
        if (
            location.href.startsWith("https://chzzk.naver.com/live/") ||
            location.href.startsWith("https://chzzk.naver.com/video")
        ) {
            const interval = setInterval(() => {
                setResolution();
                clearInterval(interval); // 해상도 설정 후 간격 해제
            }, 500);
            fixScrollIssue(); // 스크롤 문제 해결
        } else {
            fixScrollIssue(); // 다른 페이지에서도 스크롤 문제 해결
        }
    }

    // 페이지 로드 시 설정 적용
    window.addEventListener("load", () => {
        applySettingsOnSpecificPages();
    });

    // URL 변경 감지하여 설정 재적용
    let lastUrl = location.href;
    setInterval(() => {
        if (location.href !== lastUrl) {
            lastUrl = location.href;
            applySettingsOnSpecificPages();
        }
    }, 1000);
})();