Greasy Fork is available in English.

Inject stylus in Shadow DOM

inject stylus to shadowRoot

作者
hdyzen
今日安裝
0
安裝總數
12
評價
1 0 0
版本
0.1.2b
建立日期
2024-02-07
更新日期
2024-02-28
授權條款
MIT
腳本執行於

Add styles of stylus addon in shadowRoot

⚠️Warning - Use this on sites like sh.reddit.com that has hundreds of shadowRoots, may cause some performance issues


Modify the match metadata for the site you want to execute the inject or add through the script manager in the script tab, example for match:

// @match           https:/www.reddit.com/*
// @match           https:/www.wikipedia.com/*
// @match           https:/www.anothersite.com/*
// @match           https:/greasyfork.org/*

To apply styles only to elements within shadowRoot use the :host pseudo-class, example:

:host [selector] {
  border: 1px solid red;
}
:host * {
  border: 1px solid blue;
}

Version [0.1.1a] supports live updating, no longer need to reload the page to apply the changes

The script monkey patches attachShadow to add the stylus, it is not recommended, but it is functional, if you really need to add styling to elements inside the shadowR oot, this will work.