-
-
Save lovmoon3k/5429907e2bc74d3901d960c79a4950db 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