Open
Conversation
Makes the code a little less verbose and still maintain radability.
This is the workhorse who's responsibility it is to manage multiple CSS links. It will save the preferred URLs to `localStorage` since these are user defined preferences. The override CSS is a special case and will always be managed outside the user's preferred settings.
You can manipulate the settings via `TiInspector.preferences.styles`.
Author
TODO:
|
Seemed silly to force a pending save at the end of a chain as the use case usually won't use chaning all that much. The gain for ending a chain like that is miniscual for the average use case of this class. Chaining will still work but is no longer a requirement from the user's stand point.
Author
|
Since this saves to
|
Owner
|
Thanks a lot for this PR. Hopefully next week I'll be able to review it properly. |
Author
|
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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since a theme is nothing more then a CSS file linked into the iframe this pull request offers a
StylesConfigobject to manage a list of user defined CSS. Either through thedevtools_themewhen the user first uses the application or manually as the user adds or removes CSS URLs. The preferences are save tolocalStoragefor future use.When the application loads it will attach an instance of
StylesConfigtoTiInspector.preferences.styleswhich 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-Jwhile debugging a session and manipulateTiInspector.preferences.styles:Order of precedence is preserved (including the
inspector-overrides.cssas last). Further manipulation can be done by mutating the underlying array manually withthis.styleswhich is an array of objects that have aurlproperty. Thesavedproperty is an internal flag managed automatically.