我正在嘗試爲Greasemonkey寫一個小腳本,但它不起作用,因爲我沒有什麼經驗。如何使用Greasemonkey更改CSS樣式?
需要用(背景:#e8e8e8;)上的值(background:#fff;)替換所有屬性CSS。
我正在嘗試爲Greasemonkey寫一個小腳本,但它不起作用,因爲我沒有什麼經驗。如何使用Greasemonkey更改CSS樣式?
需要用(背景:#e8e8e8;)上的值(background:#fff;)替換所有屬性CSS。
// ==UserScript==
// @name Background color change
// @namespace https://website here
// @description Changes the background color
// @version 1
// @grant none
// ==/UserScript==
document.body.style.background = "white";
只需添加,
GM_addStyle("body { background-color: #fff !
important; }");
重要的可能並不需要。
「從Greasemonkey 4.0開始,此方法已被刪除。」 (https://wiki.greasespot.net/GM_addStyle) –
要改變你使用Stylish的CSS代替。 –