Yaml - Jonius7/SteamUI-OldGlory GitHub Wiki
YAML is a file configuration format that is similar to JSON, but more human readable and editable.
This page has an excellent summary of how strings work in a YAML file: http://blogs.perl.org/users/tinita/2018/03/strings-in-yaml---to-quote-or-not-to-quote.html
Old JS Tweaks were in fixes.txt
. We'll call this version 1
New JS Tweaks are now using YAML: js_tweaks.yml
. We'll call this version 2
in JS Tweaks v1, it was using a simple but custom format for listing out the JS tweaks.
Each tweak was under a Section Heading formatted like so: ### === [TWEAK NAME] ===
The lines under each section would be in the format: [original js]
██[tweaked js]
A tweak would be disabled if its lines started with ###
, and enabled if they were removed.
Over time, this format revealed many limitations.
If you are familiar with JSON, then the YAML format will be easy to pick up.
For JS Tweaks v2, each tweak gets its own section
Each tweak's "Section Name" is now without spaces and each word is capitalised
eg: HomePageGridSpacing
, Landscape Game Images
This name corresponds to the same name in OldGlory config (oldglory_config2.cfg
)
Within each tweak section are properties:
name
: Tweak's name.
Spaces allowed! This will be the name displayed within the OldGlory app.
desc
: Tweak's description.
Gives you more info on what the tweak is about. This will be displayed by hovering over the tweak name in the OldGlory app
category
(not implemented yet): Tweak's category.
If there are many tweaks, this will help sort out into which part of the Steam Library they change.
file
: Which (.js
) file to apply the tweak in. (Default: libraryroot.js
)
More recently, JS code has been moving to Steam's library.js
file instead of being all in libraryroot.js
. If there is no file
property, the tweak defaults to libraryroot.js
values
(not implemented yet): Numbers that can be changed to customise the tweak.
A good example is ChangeGameImageGridSizes
. It has 3 values SmallGridSize
, MediumGridSize
, LargeGridSize
When implemented, the find and replace strings (see strings
) will have these values as @SmallGridSize@
, @MediumGridSize@
, @LargeGridSize@
strings
: The meat of the JS Tweaks. strings
is a list of find/replace pairs under find
and repl
.
For each pair, OldGlory will look in the JS file for the original JS
in find
and replace it with the tweaked JS
in repl
.
For the most part, much of what you see in strings
will be the JS code that you are wanting to find/replace, with some enhancements that give extra meaning:
Symbol | Meaning |
---|---|
~~ |
This uses the previous line of jS code to find the right line to modify. Was available in JS Tweaks v1. Format: [previous line JS]~~[original JS] .Eg: in PressEnterToLaunchGames you are searching for case 38: but there are multiple case 38: in the JS, so you can use the previous line switch (t) { to narrow down the search to the right one. |
-x-> |
(not implemented yet) Similar to ~~ but if you need to find a (unique) line of JS from multiple lines back. x is the number of lines to go back. Eg: -3-> will search 3 lines back. x is planned to go up to 5.Format: [line of JS to find]-3->[original JS 3 lines later]
|
%1% , %2% , etc |
Represents a letter variable (usually 1-2 letters) that is usually part of minified/obfuscated JavaScript. For find , these get translated into the Regex ([A-Za-z]+) : look for 1-2 letter variables and put it into a capturing group. For repl , these get translated into backreferences \1 , \2 , etcNote: All the usual characters that have special meaning in Regex (eg: ()[]()?*+^$ ) are escaped when running JS Tweaks, so you don't have to worry about doing it yourself.Eg: the JS code Object(a.c)([E.a], instead of changing letters every Steam update and requiring manual updating, can use Object(%1%.%2%)([%3%.%4%], the letters can change between Steam updates and the JS Tweak should still work.(unimplemented) However if those letters are not present in the find but need to be added in the repl may need another solution to read other parts of the file and get the correct letters, otherwise needs manual updating.Eg: in StickyBackgroundImage S.a.currentGameListSelection.nAppId the letters are not present in the find string |
@value@ |
represents a value set by the tweak's values property.eg: values: [SmallGridSize,MediumGridSize,LargeGridSize] will mean that @SmallGridSize@ , @MediumGridSize@ , @LargeGridSize@ will want to be used in the repl strings. These values are set in OldGlory's config file (oldglory_config2.cfg ) |