NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name 치지직 1080p
// @namespace http://tampermonkey.net/
// @version 0.4
// @description 치지직 1080p
// @match *://chzzk.naver.com/live/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
function dispatchClickEvent(selector) {
const button = document.querySelector(selector);
if (button) {
const event = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
});
button.dispatchEvent(event);
console.log(`Dispatched click event: ${selector}`);
} else {
console.log(`Element not found: ${selector}`);
// Retry after a short delay if the element is not found
setTimeout(() => dispatchClickEvent(selector), 100);
}
}
function autoClick() {
dispatchClickEvent('body > div.popup_dimmed__zs78t.popup_dimmed_transparent__uMy0d > div > div.popup_footer__2eudK > div > div > button');
dispatchClickEvent('#live_player_layout > div > div.pzp-pc__bottom > div.pzp-pc__bottom-buttons > div.pzp-pc__bottom-buttons-right > button.pzp-button.pzp-setting-button.pzp-pc-setting-button.pzp-pc__setting-button > span.pzp-ui-icon.pzp-setting-button__icon');
dispatchClickEvent('#live_player_layout > div > div.pzp-settings.pzp-pc-settings.pzp-pc__settings > div.pzp-ui-setting-home-item.pzp-setting-intro-quality.pzp-pc-setting-intro-quality');
dispatchClickEvent('#live_player_layout > div > div.pzp-setting-quality-pane.pzp-pc-setting-quality-pane.pzp-pc__setting-quality-pane.pzp-pc__setting-quality-pane > div.pzp-setting-quality-pane__list-container > ul > li:nth-child(1)');
// Wait for 1 second before clicking the playback button
setTimeout(() => {
dispatchClickEvent('#live_player_layout > div > button.pzp-button.pzp-brand-playback-button.pzp-pc__brand-playback-button');
}, 1000);
}
function observeUrlChange(callback) {
let oldHref = document.location.href;
const body = document.querySelector("body");
const observer = new MutationObserver(mutations => {
mutations.forEach(() => {
if (oldHref !== document.location.href) {
oldHref = document.location.href;
callback();
}
});
});
observer.observe(body, { childList: true, subtree: true });
}
// Wait for 1 second before starting to click buttons
setTimeout(() => {
autoClick();
// Observe URL changes and rerun the autoClick function
observeUrlChange(autoClick);
}, 1000); // 1 second delay
})();