diff --git a/cf_giftcode/cf_giftcode.user.js b/cf_giftcode/cf_giftcode.user.js index 79315ba..ae861b7 100644 --- a/cf_giftcode/cf_giftcode.user.js +++ b/cf_giftcode/cf_giftcode.user.js @@ -4,8 +4,8 @@ // @namespace https://lelinhtinh.github.io // @description Auto enter Crossfire Gift Code. // @description:vi Tự động nhập Gift Code Đột Kích. -// @version 1.2.0 -// @icon https://i.imgur.com/ga9bS6c.png +// @version 1.3.0 +// @icon https://raw.githubusercontent.com/lelinhtinh/Userscript/master/cf_giftcode/icon.png // @author lelinhtinh // @oujs:author baivong // @license MIT; https://baivong.mit-license.org/license.txt @@ -106,12 +106,12 @@ const $helpText = $('
', { }); const $gcInput = $('#input_giftcode'); -const $gcForm = $('.bx-giftcode'); -const $gcSubmit = $('.btn-accept'); +const $gcForm = $gcInput.closest('form'); +const $gcSubmit = $gcForm.find('a'); -const userInfo = $('#navbarCollapse').find('[href="https://goplay.vn/"]').text().split(/:|-/); -const userName = userInfo[1].trim(); -const userId = userInfo[3].trim(); +const userInfo = $('[class="text-[#47bac1]"]').text().split(/:|-/); +const userName = userInfo[4].trim(); +const userId = userInfo[6].trim(); console.log(userName, userId); $gcForm.append($helpText); @@ -130,3 +130,10 @@ $gcInput.on('keydown', (e) => { }); $gcSubmit.on('click', onSubmit); $gcForm.on('submit', onSubmit); + +$('head').append(``); diff --git a/yt_copy_comment/icon.png b/yt_copy_comment/icon.png new file mode 100644 index 0000000..a2f3b9e Binary files /dev/null and b/yt_copy_comment/icon.png differ diff --git a/yt_copy_comment/yt_copy_comment.user.js b/yt_copy_comment/yt_copy_comment.user.js new file mode 100644 index 0000000..a12b38f --- /dev/null +++ b/yt_copy_comment/yt_copy_comment.user.js @@ -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); + }, + ); +});