Mini Youtube Window

Opens A tiny window for background music

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Mini Youtube Window
// @namespace    https://greasyfork.org/en/scripts/409994-mini-youtube-window
// @version      1.0.1
// @description  Opens A tiny window for background music
// @author       Konghe Won
// @include      *
// @exclude      https://www.youtube.com*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
	function ask(){
	var answer = prompt("Do you want to put in the video ID of the Youtube video, just open Youtube home, search on Youtube, or don't open anything? (1,2,3,4)",1);
	if(answer != 1 && answer != 2 && answer != 3){
		ask()
	}else{
		if(answer == 1){
			var id = prompt("What is the video ID?","dQw4w9WgXcQ");
			window.open("https://www.youtube.com/watch?v="+id, "_blank", "toolbar=yes,top=500,left=500,width=600,height=400");
		}else if(answer == 2){
			window.open("https://www.youtube.com", "_blank", "toolbar=yes,top=500,left=500,width=600,height=400");
		}else if(answer == 3){
			var search = prompt("What do you want to search up?","Never Gonna Give You Up");
			search.replace(/ /g,"+");
			window.open("https://www.youtube.com/results?search_query="+search, "_blank", "toolbar=yes,top=500,left=500,width=600,height=400");
	    }else if(answer == 4){
		    return
		}
	}
	}
	ask()
})();