您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Opens a separate window for YouTube video playback on Tinychat.
当前为
This userscript enables users to play YouTube videos in a separate window while on Tinychat. The script is compatible with webpages that match the URL pattern https://tinychat.com/room/*. Key features of the script include the creation of a search bar for YouTube videos, a video button to play the selected video, and integration with the YouTube API for search functionality.
The script starts by defining a regular expression for matching YouTube URLs and a function to fetch the YouTube API key securely.
It then defines a function openVideoWindow to open a separate window for video playback, setting parameters such as window size and autoplay.
Custom CSS styles are added for the video button using GM_addStyle. A menu command is created to clear the stored video URL using GM_registerMenuCommand.
The script checks for a stored video URL and displays the video button if found. The createSearchBar function is defined to create the YouTube search bar, including: Creating a search input field and datalist element for search suggestions. Adding an event listener to fetch search results using the YouTube API when the input is updated. Creating a search button to play the selected video and store its URL. Adding the search bar to the document body. Finally, the search bar is created by invoking the createSearchBar function.
This userscript enhances the Tinychat experience by allowing users to conveniently search and play YouTube videos without leaving the Tinychat platform.
Edit the 'ADD_YOUR_API_KEY' with your own key on line 26
Get your API Key here: https://console.cloud.google.com
Step 1. Create New Project
Step 2. Go To Credentials Screen
Step 3. Click Create Credentials
Step 4. Click Enabled APIs
Step 5. Search & Choose YouTube V3 API
Step 6. Go to Credentials, Edit API Key, API Restrictions, Choose YouTube V3 API