-
Notifications
You must be signed in to change notification settings - Fork 51
Ideas #1
Comments
Two issues with style installation and likely theming:
|
I was thinking that we could add an "override" to styles... like maybe define a block like this: body:not(.customized) .something { color: red !important; } then when we add a custom style, add a "customized" class name to the body. |
That'd of course work, but you'd have to add |
Ugh, you're right... ok, we can just do what we do with grunt. Add some extra comments at the start & end of blocks we want to remove... /* grunt-remove-block-below */
...
/* grunt-remove-block-above */ I ended up using this method in the Stackoverflow style... here is the grunt replacement: // remove default syntax theme
pattern: /\s+\/\* grunt-remove-block-below (.*(\n|\r))+\s+\/\* grunt-remove-block-above \*\//m,
replacement: '' |
I think the approach with the body classes is fine as long as we only toggle a few select things. We just can't do a full style replacement for above reasons. If only we could access a userstyle through things like |
Oh, I thought you said we could load the "github-dark.css" file using |
We could do that, yeah. My point is, as long as the userstyle is loaded, it will interfere (in terms of style weight) with any style we add to the page. Class toggle seems the only way to go I'm afraid. |
I've been working on a basic structure. So far I have this idea for the script sequence:
If the user chooses a different setting, the script will need to load in a new syntax theme (if needed) and trigger the Process function again. |
Sounds good. It's certainly is easier to maintain than a class toggle (and more flexible). The drawbacks are likely these:
You could do the update check by writing saving a timestamp and then check if at least 24 hours passed. |
Ok, I've pushed a very basic setup to the master... It still has a few issues that I was going to work on today, but some things have come up, so I thought I'd at least share my progress:
Please feel free to make whatever tweaks or adjustments you desire. |
Added some more tweaks, the silly enable checkbox still isn't working - ugh. I forgot to mention, if you add |
Made a few tweaks. Here's the deal with the loading delay: There's @run-at which can make the script execute before the site's own script when set to You can actually load both JS and CSS from metadata blocks like this: // @require https://url/something.js
// @resource something https://url/something.css And then apply the named style: GM_addStyle(GM_getResourceText("something")); The benefit of that method is the Greasemonkey loads and caches scripts/styles each time the script itself is updated. Greasemonkey also does a daily update check to I'll leave changing that up to you ;) |
Oh, and by the way: It's nice for userscript development if you symlink the script from your git repo to the browser's storage directory (works in Firefox at least, as it just stores the script under |
I'm thinking we should apply the style asap on |
Sounds good... I'll include that change in my updates. I have a bunch of stuff done locally that I haven't pushed to the master yet. |
By the way, do we really need to load another version of jQuery? |
Yes, I wasn't able to access the site's jQuery presumably because of Greasemonkey's sandbox. |
Ok, I got most everything working now. I could not get the I left the version checking and loading of the script because I don't know how to access |
LOL, I just realized I forgot to add in a "toggle code wrap" option. I'll do that tomorrow! I'll let you mess around with the code for a while 😉 |
I probably won't be able to do much til weekend, go ahead :) |
Ok, I added the toggle of long code button. The color between active & not active was subtle, so I made it turn green when active & red with disabled (only on hover). You might be able to come up with a better idea, so please feel free to change it. The wrap is active by default, when a "nowrap" class is added to the Issues that still need to be addressed added to the first post. |
Nice! I'd actually prefer it to be on a per-box basis instead of on/off for all boxes on the page. I think a inline style with Also added todo for Firefox checkboxes in OP. |
The only problem with that is that if you want to save the state, you'll need to save the url, code block index and state. |
No need to save a state. I'd say the checkbox in option controls the user's primary preference and the buttons override it through an toggled inline style. Once the page reloads, that style will be gone and the user's preference will take over. |
Ok, so just a temporary toggle then. You working on that, or do you want me to do it? |
Go ahead, I'm a bit busy today! |
And I'm a bit lazy today 😉 |
Hmm, maybe just make that a regular text input then. |
Yeah, that'd work I guess. |
Hmm, that wrap code change is a bit more than I wanted to tackle today... we can't use the I opened a new issue. |
In this last update, you can now use a keyboard shortcut to open the panel... g + 0 (within 1 second of each other). This combo is similar to the GitHub shortcuts available - press ? to see them. |
So I ended making these changes:
Hmm, maybe we should make a change log? LOL |
Would be nice if this ALREADY massive list had a small addition.
This would be ideal especially for those who like me, like to test the changes quickly via the browser editor/preview and also being able to update script on the fly from GitHub... Atm its using stylish for testing fixes before submitting PR and you cant really edit the script updated via here as its stored in some compressed non-editable manner. |
Actually as @silverwind shared above about symlinks, Firefox adds the userscript to a
In there you'll find a I have to investigate more to find where Chrome stores its data, but it probably won't make much difference either. |
Why does it even have to go there? why cant it be same place stylish uses? It would even be better is GH Dark Script had a edit button and it opened on your preferred editor 🐫 Camel unrelated.... |
Because Stylish is a separate addon/extension from Greasemonkey/Tampermonkey. For security reasons, you don't want an addon to be able to figure out what other addons are installed. |
what a drag well unlesss you add ability to read from databases or find a way to make the github.dark.css not be stored inside a database this idea of mine is dead or way too much work to implement... how about adding some logic that detects if github dark is installed from stylish comparing the version and then updating that form this script, then one could update both and use the stylish installed file to test any fixes before making any pr... for extra credits even open the ff editor with that on. |
Stylish doesn't appear to have an API to allow that type of interaction. |
but the rest is possible or am I barking up the wrong tree? |
Rest of what? Every browser does something a little different. I use the code paste textarea all the time, once you get the hang of it, it's easy. |
its not a simple thing, need to copy and paste the whole lot even if you change a single character all the navigation in between is time consuming. The ideal situation would be to grab the very latest code and edit that test and do changes ontop of latest., as is you cant paste the latest github dark css into this script, as you explained they are both incompatible. I think the best then is to have travis deploy stylish updates to stylish.org on the fly after each commit. But these are suggestions, anyway Ive nothing else to suggest this side... love the work though. |
What? Travis can interface with userstyles.org? Tell me more.
Yes, I strongly prefer the Greasemonkey workflow of just saving in the editor and reloading too, but I'm afraid things aren't going to change unless someone starts working on external editor support for Stylish, which basically means replacing the SQLite storage with plain files (Should do it for the Chrome extension, because long-term, it's going to be in Firefox too). |
@silverwind check out this issue - stylish-userstyles/stylish#218 - I'm not sure how to change that extension setting. |
Issues to be addressed:
Implemented:
@run-at document-start
to work consistently.@include
is copied straight from GitHub-Dark so I don't know why it's not working.Ideas for the future:
AceCodeMirror editor.The text was updated successfully, but these errors were encountered: