This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a5b7eb
commit 5738b54
Showing
3 changed files
with
55 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// ==UserScript== | ||
// @name Youtube Copy Comment | ||
// @name:vi Sao Chép Bình Luận Youtube | ||
// @namespace https://lelinhtinh.github.io | ||
// @description Copy comment from Youtube to clipboard. If there is a "See more" button here, click it. | ||
// @description:vi Sao chép bình luận từ Youtube vào bộ nhớ đệm. Nếu có nút "Xem thêm" ở đây, nhấn vào nó. | ||
// @version 1.0.1 | ||
// @icon https://raw.githubusercontent.com/lelinhtinh/Userscript/master/yt_copy_comment/icon.png | ||
// @author lelinhtinh | ||
// @oujs:author baivong | ||
// @license MIT; https://baivong.mit-license.org/license.txt | ||
// @match https://www.youtube.com/live_chat | ||
// @supportURL https://github.com/lelinhtinh/Userscript/issues | ||
// @run-at document-idle | ||
// @grant none | ||
// ==/UserScript== | ||
|
||
document.addEventListener("click", (e) => { | ||
const mess = e.target.closest('span[dir="auto"]'); | ||
if (!mess?.classList?.contains("yt-live-chat-text-message-renderer")) return; | ||
|
||
const commendText = mess.innerText; | ||
// console.log(commendText); | ||
if (!commendText) return; | ||
|
||
navigator.clipboard.writeText(commendText).then( | ||
() => { | ||
document.title = commendText; | ||
document.body.style.cursor = 'wait' | ||
setTimeout(() => { | ||
document.body.style.cursor = 'initial' | ||
}, 200); | ||
}, | ||
() => { | ||
document.body.style.cursor = 'not-allowed' | ||
setTimeout(() => { | ||
document.body.style.cursor = 'initial' | ||
}, 200); | ||
}, | ||
); | ||
}); |