PhantomGamers / SFP

This utility is designed to allow you to apply skins to the modern Steam client
MIT License
572 stars 11 forks source link

Add feature to inject JavaScript code to steam ui #84

Closed CoelacanthusHex closed 1 year ago

CoelacanthusHex commented 1 year ago

Since steam 2023-04-27 beta version, SFP use CEF devtools to inject code. This way also supports JS besides CSS. Steam has many elements with id like somethingFixed_someHash, JS code inject is suitable for this situation but pure CSS is difficult to match this thing. Even if it is successfully matched, once the hash changes, the user needs to manually find and fix it again. JS, on the other hand, can provide more flexible matching and modification capabilities.

https://github.com/ShadowMonster99/millennium-steam-patcher has supported this feature, and some theme like https://github.com/AikoMidori/SteamSkins has used it.

PhantomGamers commented 1 year ago

Steam has many elements with id like somethingFixed_someHash, JS code inject is suitable for this situation but pure CSS is difficult to match this thing. Even if it is successfully matched, once the hash changes, the user needs to manually find and fix it again

JS should not be used for this purpose. Instead, use attribute value selectors like so: https://github.com/AikoMidori/steam-library/pull/23

image

As mentioned in the README.md of this repo, js support is coming but I suggest not using js when it is unnecessary as js injection will be disabled by default and users will be warned when enabling it as it can potentially result in users downloading malicious code onto their system.

CoelacanthusHex commented 1 year ago

Ok, I close it.

PhantomGamers commented 1 year ago

JS support has been added in 0.0.30-alpha, with 0.0.31-alpha fixing js support for webkit.js