// ==UserScript== // @name SOOP - 채팅창 좌우정렬 // @namespace https://www.afreecatv.com/ // @version 1.0.4 // @description 채팅창 정렬 변경을 클릭하면 변경됩니다. // @author hakkutakku // @match https://www.sooplive.com/* // @match https://play.sooplive.com/*/* // @icon https://www.google.com/s2/favicons?sz=64&domain=play.sooplive.co.kr // @grant GM_addStyle // @grant GM_getValue // @grant GM_setValue // @run-at document-end // @license MIT // @downloadURL https://update.greasyfork.icu/scripts/512717/SOOP%20-%20%EC%B1%84%ED%8C%85%EC%B0%BD%20%EC%A2%8C%EC%9A%B0%EC%A0%95%EB%A0%AC.user.js // @updateURL https://update.greasyfork.icu/scripts/512717/SOOP%20-%20%EC%B1%84%ED%8C%85%EC%B0%BD%20%EC%A2%8C%EC%9A%B0%EC%A0%95%EB%A0%AC.meta.js // ==/UserScript== (function() { 'use strict'; // 아이콘 변경 GM_addStyle(` .area_header ul li.chatLeftRight a { background-image: url("data:image/svg+xml,"); background-size: 25px 25px } [dark=true] .area_header ul li.chatLeftRight a { background-image: url("data:image/svg+xml,"); background-size: 25px 25px } `); function insertButton() { const chatLeftRight = `
  • 채팅창 위치 변경
  • `; const settingButton = document.querySelector(".set"); // 다시보기 페이지는 시청자 목록 아이콘이 없으므로 찾는 아이콘 변경 if(settingButton === null) { // 다시보기에서 채팅창 로드가 느리므로 반복찾기 setTimeout(insertButton, 100); } else { if(GM_getValue('isChatLeft', false) === true) { // 채팅창 좌우 설정 불러오기 toggleChatLocation(); } settingButton.insertAdjacentHTML('afterend', chatLeftRight); document.querySelector('.chatLeftRight').addEventListener("click", toggleChatLocation); } } function toggleChatLocation() { const webplayer_contents = document.querySelector('#webplayer_contents'); console.log(webplayer_contents.style.flexDirection); if(webplayer_contents.style.flexDirection === "") { webplayer_contents.style.flexDirection = 'row-reverse'; GM_setValue('isChatLeft', true); // 설정 저장 } else { webplayer_contents.style.removeProperty('flex-direction'); GM_setValue('isChatLeft', false); // 설정 저장 } } insertButton(); })();