Middle clicking the search on youtube opens the results in a new tab
当前为
// ==UserScript==
// @name Youtube Middle Click Search
// @version 1.2
// @description Middle clicking the search on youtube opens the results in a new tab
// @include http*://www.youtube.com*
// @namespace https://greasyfork.org/users/649
// ==/UserScript==
var button = document.querySelector("#search-btn"),
input = document.querySelector('#masthead-search-term'),
form = document.querySelector('#masthead-search');
button.removeAttribute("onclick");
button.onclick = function(e) {
e.preventDefault();
if (input.value.trim() === '') return false;
form.removeAttribute('target');
if (e.which === 2) form.setAttribute('target', '_blank');
form.submit();
return false;
};