Warning: fopen(/www/sites/update.greasyfork.icu/index/store/forever/ab7c81937063caf8d367634e9a248ca2.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript==
// @name 치지직 1080p 고정 + 광고 팝업 삭제 + 자동 재생
// @namespace http://tampermonkey.net/
// @version 1.0.1
// @description 치지직 1080p 고정 및 SVG 버튼 클릭 추가, 각 기능 별도로 실행 후 종료
// @match *://chzzk.naver.com/*
// @grant none
// @license MIT
// @downloadURL none
// ==/UserScript==
(function () {
'use strict';
let previousChannelId = null;
let scriptRunning = false;
// URL 변화를 감지하는 함수
const detectChannelChange = () => {
const currentUrl = window.location.href;
const channelIdMatch = currentUrl.match(/live\/([a-f0-9]{32})/);
const currentChannelId = channelIdMatch ? channelIdMatch[1] : null;
if (currentChannelId && currentChannelId !== previousChannelId) {
previousChannelId = currentChannelId;
console.log("채널 변경 감지, 스크립트 재실행");
if (!scriptRunning) {
executeScripts();
}
}
};
// 주기적으로 URL 변경 확인 (5000ms마다 확인)
setInterval(detectChannelChange, 5000);
// 각 기능을 수행하는 스크립트 실행 함수
function executeScripts() {
scriptRunning = true;
// 랜덤 지연 시간 생성 함수 (500ms ~ 1500ms 사이 랜덤)
function getRandomDelay() {
return Math.floor(Math.random() * 1000) + 500;
}
// 중복 실행 방지를 위한 플래그
let qualitySet = false;
let svgClicked = false;
let adRemoved = false;
// 모든 작업이 완료되었는지 확인하고 스크립트를 종료하는 함수
function checkAndTerminate() {
if (qualitySet && svgClicked && adRemoved) {
console.log("모든 작업 완료, 스크립트 종료");
scriptRunning = false;
previousChannelId = null; // 이전 채널 ID 초기화하여 재실행 방지
return true;
}
return false;
}
// 품질 설정을 1080p로 고정하는 코드
const qualityInterval = setInterval(() => {
if (qualitySet) {
clearInterval(qualityInterval); // 플래그가 true이면 인터벌 종료
return;
}
const qualityElement = document.querySelector(
`.pzp-pc-setting-quality-pane__list-container > li:first-child:not(.pzp-pc-ui-setting-item--checked)`
);
if (qualityElement) {
setTimeout(() => {
qualityElement.click();
console.log("1080p 고정");
qualitySet = true; // 작업 완료 플래그 설정
clearInterval(qualityInterval);
console.log("품질 설정 인터벌 종료");
if (checkAndTerminate()) {
return;
}
}, getRandomDelay());
}
}, 500);
// SVG 버튼 클릭 코드
const svgInterval = setInterval(() => {
if (svgClicked) {
clearInterval(svgInterval); // 플래그가 true이면 인터벌 종료
return;
}
const svgElement = document.querySelector(
`svg.pzp-ui-icon__svg[viewBox="0 0 49 49"]`
);
if (svgElement) {
// 마우스 클릭 이벤트 생성
const clickEvent = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
});
setTimeout(() => {
svgElement.dispatchEvent(clickEvent); // SVG 요소에 클릭 이벤트 전송
console.log("