SOOP(숲) 채팅창에서 복사/붙여넣기를 활성화하도록 변경합니다. (Made by 도연)
// ==UserScript==
// @name SOOP(숲) 채팅창 복사/붙여넣기 활성화 (by 도연)
// @namespace http://tampermonkey.net/
// @version 1.0.5
// @description SOOP(숲) 채팅창에서 복사/붙여넣기를 활성화하도록 변경합니다. (Made by 도연)
// @author https://github.com/dokdo2013
// @license MIT
// @match https://play.sooplive.co.kr/*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
const update = () => {
$("#write_area").off("cut copy paste");
$("#write_area").on("cut copy", function(event) {
event.stopPropagation();
event.preventDefault();
// 복사할 텍스트 가져오기
const writtenText = $("#write_area").text();
// 복사 처리
if (navigator.clipboard) {
navigator.clipboard.writeText(writtenText)
.then(() => {
console.log('복사 완료:', writtenText);
})
.catch(err => {
console.error('복사 실패:', err);
});
} else {
// Clipboard API가 지원되지 않는 경우
document.execCommand('copy');
console.log('복사 처리: execCommand 사용');
}
});
$("#write_area").on("paste", function(event) {
// 기본 동작을 허용
event.stopPropagation(); // 다른 이벤트 전파 방지
event.preventDefault(); // 이벤트 기본 동작 방지
const clipboardData = event.originalEvent.clipboardData || window.clipboardData;
const pastedData = clipboardData.getData('text');
// 붙여넣기 텍스트를 수동으로 입력
document.execCommand("insertText", false, pastedData);
});
console.log("enable copy/paste");
};
const interval = setInterval(update, 500);
setTimeout(() => {
clearInterval(interval)
}, 30000);
})();