Open Youtube search results in new page

Opens Youtube search results in a new page when clicking the + search button

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name           Open Youtube search results in new page
// @namespace      http://userscripts.org/users/497008
// @description    Opens Youtube search results in a new page when clicking the + search button
// @include        http://www.youtube.com/*
// @include        https://www.youtube.com/*
// @author         ...
// @grant          GM_addStyle
// @version        2.1
// ==/UserScript==

searchButton = document.getElementById("search-btn")||document.getElementById("sb");

newWindowButton = searchButton.cloneNode(true);
newWindowButton.id="search-btn-new-page";
newWindowButton.value="+";
//Icon by  P.J. Onori - http://www.somerandomdude.com Creative Commons Attribution-Share Alike 3.0 Unported License
GM_addStyle("#search-btn-new-page .yt-uix-button-content{ background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADNJREFUKM9jYMAE9UD8H4rrGYgAg0BDPRrej6RhPxZ5uCSxmHQN+9HwfSTJ+1jkh3w8AACTa0Dx7zcROAAAAABJRU5ErkJggg==') no-repeat scroll 1px 1px transparent !important; }");


searchButton.parentNode.insertBefore(newWindowButton, searchButton);

searchForm=document.getElementById("masthead-search")||document.getElementById("se")
newWindowButton.onclick=function(){
	searchForm.setAttribute("target", "_blank");
}

searchButton.onmouseup=function(){
	searchForm.removeAttribute("target");
}