替换V2EX搜索为百度
// ==UserScript==
// @name V2EX搜索替换
// @description 替换V2EX搜索为百度
// @namespace Violentmonkey Scripts
// @match https://www.v2ex.com/*
// @grant none
// @version 1.2
// ==/UserScript==
;(function() {
function exec() {
// 覆盖原有方法
window.dispatch = function () {
var value = document.getElementById('q').value
if ( value) {
var url = "https://www.baidu.com/s?wd=site%3Av2ex.com+" + encodeURIComponent(value);
if (window.open) {
window.open(url, '_blank')
} else{
location.href = url
}
return false
}
return false
}
}
window.addEventListener('load', exec, false)
})()