// ==UserScript== // @name 一键下载youtube高清视频plus版 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 在YouTube视频浏览页的左下角生成一个下载按钮,点击可以一键下载Youtube1080P高清视频 // @author Cantan Tam // @match https://www.youtube.com/watch* // @grant GM_addStyle // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Create SVG element var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); svgElement.setAttribute("width", "30px"); svgElement.setAttribute("height", "30px"); svgElement.setAttribute("viewBox", "93.3979 161.13086 4.2560406 5.1727986"); svgElement.innerHTML = ` `; // Create button element var buttonElement = document.createElement("button"); buttonElement.style.border = "none"; // Remove the border buttonElement.style.background = "none"; // Remove the background buttonElement.appendChild(svgElement); // Style the button buttonElement.style.position = "fixed"; buttonElement.style.bottom = "10px"; buttonElement.style.left = "5px"; buttonElement.style.zIndex = "9999"; buttonElement.style.display = "none"; // Initially hide the button // Append the button to the body document.body.appendChild(buttonElement); // Add custom styles GM_addStyle(` svg { display: block; } `); // Add mousemove event listener document.addEventListener("mousemove", function(event) { var mouseX = event.clientX; var mouseY = event.clientY; if (mouseX < 100 && mouseY > window.innerHeight - 100) { buttonElement.style.display = "block"; } else { buttonElement.style.display = "none"; } }); // Add click event listener buttonElement.addEventListener("click", function() { // Get the current YouTube URL var currentUrl = window.location.href; // Replace www.youtube.com/watch?v= with tomp3.cc/youtube-downloader/ var newUrl = currentUrl.replace("www.youtube.com/watch?v=", "tomp3.cc/youtube-downloader/"); // Open the new URL in a new tab window.open(newUrl, "_blank"); }); })();