您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
删除搜索结果页面右侧内容框,并添加“Bing必应”与“Google”搜索链接。同时高亮搜索关键字(试验性)。Remove the 'right' contents. Add Bing and Google search buttons. Highlight search results.
当前为
// ==UserScript== // @name Better Baidu 百度优化 // @namespace feifeihang.info // @description 删除搜索结果页面右侧内容框,并添加“Bing必应”与“Google”搜索链接。同时高亮搜索关键字(试验性)。Remove the 'right' contents. Add Bing and Google search buttons. Highlight search results. // @include http://www.baidu.com/ // @include https://www.baidu.com/ // @include http://www.baidu.com/s* // @include https://www.baidu.com/s* // @version 1 // @grant none // ==/UserScript== (function (window, document, undefined) { var hasAdded = false; // define search engines' urls. var URLS = { 'Bing': 'http://www.bing.com/search?q=', 'Google': 'http://www.google.com/#q=' }; window.addEventListener('load', function () { // now, let's go implement keywords highlighting. var resultContainerQuery = '#content_left'; var buffer = ''; watch(resultContainerQuery, buffer); }, false); var COLORS = [ '#FFFF00', '#FFCC00', '#CCCCFF', '#00CCFF', '#33CCCC', '#FF8080', '#008000', '#FFFF99', '#808000', '#FFFFCC' ]; var counter = 0; function watch(resultContainerQuery, buffer) { setInterval(function () { // first, remove the annoying right contents. if (document.querySelector('#content_right')) { document.querySelector('#content_right').remove(); } // if Bing and Google are not added yet, add them. var isNotBaiduHomepage = window.location.href.toUpperCase() !== 'HTTP://WWW.BAIDU.COM' && window.location.href.toUpperCase() !== 'HTTPS://WWW.BAIDU.COM' && window.location.href.toUpperCase() !== 'HTTP://WWW.BAIDU.COM/' && window.location.href.toUpperCase() !== 'HTTPS://WWW.BAIDU.COM/'; if (!hasAdded && isNotBaiduHomepage) { // find container and Baidu button. var container = document.querySelector('#form'); var baidu = document.querySelector('#su').parentElement; var current = baidu; // now, create and add new buttons. for (var item in URLS) { var q = document.querySelector('#kw').value || ''; var anchor = document.createElement('a'); anchor.innerHTML = item; anchor.setAttribute('href', URLS[item] + q); anchor.style = 'color: rgb(255, 255, 255);font-weight: bold; display: inline-block;' + 'text-decoration: none;background: rgb(51, 133, 255) none repeat scroll 0% 0%; text-align: center; line-height: 33px;' + 'margin-left: 2px; width: 60px; height: 33px; border-bottom: 1px solid transparent;'; container.insertBefore(anchor, current.nextSibling); current = anchor; } hasAdded = true; } var resultContainer = document.querySelector(resultContainerQuery); if (resultContainer && resultContainer.textContent !== buffer) { // update buffer. buffer = resultContainer.textContent; // first, find all 'em's. var ems = document.querySelectorAll('em'); // if there is no 'em's, do nothing. if (ems.length === 0) { return false; } // convert ems into an array. ems = Array.prototype.slice.apply(ems); var counter = 0; // get keywords. var keywords = document.querySelector('#kw').value.trim().split(' ').map(function (item) { return item.toUpperCase().trim() }); var styles = { }; // assign a color to each keyword. keywords.forEach(function (item, index) { if (styles[item] === undefined) { styles[item] = COLORS[counter++]; if (counter === COLORS.length) { counter = 0; } } }); // iterate through all the keywords in search result, // and map the predefined color to them. ems.forEach(function (em) { var text = em.innerHTML.toUpperCase().trim(); em.style.background = styles[text] || ''; em.style.color = '#000'; em.style.fontWeight = 'bold'; }); } }, 1000); } }) (this, document);
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址