Greasy Fork is available in English.
치지직 1080p 해상도로 고정합니다
当前为
// ==UserScript==
// @name chzzk-1080p
// @namespace http://tampermonkey.net/
// @version 1.0
// @description 치지직 1080p 해상도로 고정합니다
// @match *://chzzk.naver.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
function setResolution() {
const qualityItems = document.querySelectorAll(
'.pzp-pc-setting-quality-pane__list-container li'
);
if (!qualityItems) {
console.error("해상도 설정 요소를 찾을 수 없습니다.");
return;
}
// 1080p 항목 찾기 (없을 수도 있음)
let targetQuality = qualityItems.item(0);
//1080p 또는 720p 항목 찾기
for (let i = 0; i < qualityItems.length; i++) {
const item = qualityItems[i];
if (item.textContent.includes("1080p")) {
targetQuality = item;
break;
} else if (item.textContent.includes("720p")) {
targetQuality = item;
}
}
if (targetQuality) {
targetQuality.click();
console.log("해상도가 설정되었습니다. (" + targetQuality.textContent + ")");
} else {
console.error("1080p 또는 720p 해상도를 찾을 수 없습니다.");
}
}
function fixScrollIssue() {
// overflow 속성 조정
try {
document.body.style.overflow = 'auto';
document.documentElement.style.overflow = 'auto';
} catch(e){
console.error("overflow 속성 조정 실패:", e);
}
try {
// position 속성 조정
document.body.style.position = 'relative';
document.documentElement.style.position = 'relative';
} catch(e) {
console.error("position 속성 조정 실패:", e);
}
try {
// height 속성 조정
document.body.style.height = 'auto';
document.documentElement.style.height = 'auto';
} catch(e) {
console.error("height 속성 조정 실패:", e);
}
console.log("스크롤 문제가 수정되었습니다.");
}
function applySettingsOnSpecificPages() {
if (
location.href.startsWith("https://chzzk.naver.com/live/") ||
location.href.startsWith("https://chzzk.naver.com/video")
) {
// 1초 간격으로 반복. 페이지 로딩 속도에 따라 조정 필요
setTimeout(() => {
setResolution();
}, 1000);
fixScrollIssue();
} else {
fixScrollIssue();
}
}
// 페이지 로드 시 설정 적용
window.addEventListener("load", applySettingsOnSpecificPages);
// URL 변경 감지하여 설정 재적용 - 더 안정적인 방법
let lastUrl = location.href;
const urlCheckInterval = setInterval(() => {
if (location.href !== lastUrl) {
lastUrl = location.href;
applySettingsOnSpecificPages();
}
}, 2000); // 2초 간격으로 확인. 너무 짧으면 성능 저하 가능.
})();