返回首頁 

Greasy Fork is available in English.

Kick.com - Auto select best quality

Auto select best quality

ของเมื่อวันที่ 11-09-2024 ดู เวอร์ชันล่าสุด

// ==UserScript==// @name         Kick.com - Auto select best quality// @namespace    https://greasyfork.org/en/users/1200587-trilla-g// @version   3.0// @author       Trilla_G// @description  Auto select best quality// @match        *://kick.com/*// @icon         https://www.google.com/s2/favicons?sz=64&domain=kick.com// @grant        GM_addStyle// @run-at       document-start// @license      MIT// ==/UserScript==(function() {'use strict';// Function to check if a quality option is selected and click it if notlet checkQuality = (quality) => {// Select all divs with the given classlet buttons = document.querySelectorAll("div[class*='betterhover\\:hover:text-primary'].relative.flex.h-\\[30px\\].cursor-pointer.select-none.items-center.rounded-\\[3px\\].px-\\[15px\\].pl-\\[20px\\].text-sm.font-medium.leading-none.text-white.outline-none");for (let button of buttons) {if (button.textContent.includes(quality)) {if (button.getAttribute('aria-checked') === 'true' && button.getAttribute('data-state') === 'checked') {return true; // Already selected, stop further checks}// Modify attributes to simulate selectionbutton.setAttribute('aria-checked', 'true');button.setAttribute('data-state', 'checked');button.click(); // Simulate the click to select the qualityreturn true;}}return false;};// Function to set the stream qualitylet setStreamQuality = () => {// Try to select the best available quality and stop the interval if successfulif (checkQuality('1080p60') ||checkQuality('1080p') ||checkQuality('936p60') ||checkQuality('720p60') ||checkQuality('720p') ||checkQuality('Auto')) {clearInterval(qualityCheckInterval); // Stop checking once the quality is setreturn true;}return false;};// Run the setStreamQuality function every 500 ms until the quality is setlet qualityCheckInterval = setInterval(() => {setStreamQuality();}, 500);})();