如何让bing的搜索结果居中显示?
首先安装油猴插件(现在官方叫“篡改猴”)
然后安装以下脚本:
// ==UserScript==
// @name 搜索内容居中显示
// @namespace Violentmonkey Scripts
// @version 0.0.5
// @description 各大搜索引擎内容在屏幕居中显示,解放你的脖子!
// @include *bing.com*
// @author mordom0404
// ==/UserScript==
(function() {
if(window.location.href.match(/cn\.bing\.com/)){
var timer = setInterval(function(){
if(document.getElementById('b_content')){
if(document.getElementById('b_content').style.float!=="left"){
document.getElementById('b_content').style.float="left";
document.getElementById('b_content').style.paddingLeft="0";
document.getElementById('b_content').style.transform="translate(-90%, 0)";
document.getElementById('b_content').style.position="relative";
document.getElementById('b_content').style.left="90%";
document.getElementById('b_header').style.marginLeft="auto";
document.getElementById('b_header').style.marginRight="auto";
console.log("尝试居中")
}else{
clearInterval(timer)
console.log("居中成功")
}
}
},1000)
document.getElementById('b_content').style.float="left";
document.getElementById('b_content').style.paddingLeft="0";
document.getElementById('b_content').style.transform="translate(-90%, 0)";
document.getElementById('b_content').style.position="relative";
document.getElementById('b_content').style.left="90%";
document.getElementById('b_header').style.marginLeft="auto";
document.getElementById('b_header').style.marginRight="auto";
}
})()
然后就居中了
问题
可能需要手动设置下脚本上的偏移量,对于这个脚本来说是更改那几个90%的位置,需要自己设置一个合适的。
2023年11月5日
