Greasy Fork is available in English.

討論 » 建立請求

求一个bing搜索居中的脚本

§
發表於:2022-06-30

现在结果都是靠左边显示,求一个居中的。谢谢有大神能提供。

NotYou管理員
§
發表於:2022-07-01

Easy-peasy:

let style = document.createElement('style')
style.textContent =  `
#b_content {
  display: grid;
  place-content: center;
}`
document.head.appendChild(style)

Program to make Bing search result in center.
Centered Bing Search (c) 2022 NotYou
License - GNU General Public License 3.0 only

§
發表於:2022-07-01

Easy-peasy:

let style = document.createElement('style')
style.textContent =  `
#b_content {
  display: grid;
  place-content: center;
}`
document.head.appendChild(style)


Program to make Bing search result in center.

Centered Bing Search (c) 2022 NotYou

License - GNU General Public License 3.0 only

// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://cn.bing.com/
// @icon https://www.google.com/s2/favicons?sz=64&domain=bing.com
// @grant none
// ==/UserScript==

(function() {
let style = document.createElement('style')
style.textContent = `
#b_content {
display: grid;
place-content: center;
}`
document.head.appendChild(style)
})();
这样吗?

NotYou管理員
§
發表於:2022-07-04

Easy-peasy:

let style = document.createElement('style')
style.textContent =  `
#b_content {
  display: grid;
  place-content: center;
}`
document.head.appendChild(style)


Program to make Bing search result in center.

Centered Bing Search (c) 2022 NotYou

License - GNU General Public License 3.0 only

// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://cn.bing.com/
// @icon https://www.google.com/s2/favicons?sz=64&domain=bing.com
// @grant none
// ==/UserScript==

(function() {
let style = document.createElement('style')
style.textContent = `
#b_content {
display: grid;
place-content: center;
}`
document.head.appendChild(style)
})();
这样吗?

You better use something like that match to make sure that script will match in http, and also other languages: // @match ://*bing.com*.

NotYou管理員
§
發表於:2022-07-04

Also, I don't think you need to use SEAF (Self Executing Anonymous function) to make script work, but if it's more readable for you like that, you can use it.

發表回覆

登入以回復