Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
feat: update CF Gift Code
Browse files Browse the repository at this point in the history
  • Loading branch information
lelinhtinh committed Aug 21, 2023
1 parent 5a5b7eb commit 5738b54
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 7 deletions.
21 changes: 14 additions & 7 deletions cf_giftcode/cf_giftcode.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -106,12 +106,12 @@ const $helpText = $('<pre />', {
});

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);
Expand All @@ -130,3 +130,10 @@ $gcInput.on('keydown', (e) => {
});
$gcSubmit.on('click', onSubmit);
$gcForm.on('submit', onSubmit);

$('head').append(`<style>
#myModal,
#myModal + .modal-backdrop {
display: none !important;
}
</style>`);
Binary file added yt_copy_comment/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions yt_copy_comment/yt_copy_comment.user.js
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);
},
);
});

0 comments on commit 5738b54

Please sign in to comment.