Last active
October 3, 2023 13:06
-
-
Save J2TEAM/98f5bb6967d9e01b579db240884b2a51 to your computer and use it in GitHub Desktop.
Tự động đóng tab Youtube khi hết video. Sử dụng bằng cách cài Tampermonkey nhé.
This file contains hidden or 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
// ==UserScript== | |
// @name YouTube Auto Close | |
// @namespace http://j2team.dev/ | |
// @version 0.1 | |
// @description Automatically closes YouTube videos after playback. | |
// @author JUNO_OKYO | |
// @match https://www.youtube.com/watch* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com | |
// @grant window.close | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const video = document.querySelector('.html5-main-video'); | |
if (!video) { | |
return; | |
} | |
video.addEventListener('ended', function() { | |
console.log('The video has ended.'); | |
window.close(); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment