Open sukima opened 10 years ago
clear()
method.Since this saves to localStorage
it is entirely possible to use an instance of StylesConfig
to make changes while on the splash screen not just when the devtools page is active.
StylesConfig
to the splash page's JavaScript environment.help()
method to print out usage info to a new user?Thanks a lot for this PR. Hopefully next week I'll be able to review it properly.
Most welcome. I love contributing. Would you like me to look into the above two tasks I outlined or wait till this merges and make another Pull Request?
Since a theme is nothing more then a CSS file linked into the iframe this pull request offers a
StylesConfig
object to manage a list of user defined CSS. Either through thedevtools_theme
when the user first uses the application or manually as the user adds or removes CSS URLs. The preferences are save tolocalStorage
for future use.When the application loads it will attach an instance of
StylesConfig
toTiInspector.preferences.styles
which has the following methods:<head>
with<link>
tags.<link>
tags.(*)
means hasn't been saved (appendChild
) to the page yet.All the above methods are chainable. Internally this is a singleton class which can be grabbed with
StylesConfig.getInstance()
.Usage would be to open the console
Command-Option-J
while debugging a session and manipulateTiInspector.preferences.styles
:Order of precedence is preserved (including the
inspector-overrides.css
as last). Further manipulation can be done by mutating the underlying array manually withthis.styles
which is an array of objects that have aurl
property. Thesaved
property is an internal flag managed automatically.