Stylish-Custom

1356781

Comments

  • edited May 2009
    Stylish-Custom-0.1.1.xpi
    auto!important doesn't get re-enabled after changing the key
    UnComment ignores starting/ending whitespace chars in selected text (by ignore i mean remove)

    @BoffinbraiN if your regexp skills can suggest something better
    var selectedText = selectedText.replace(/^[&#0092s]*&#0092/&#0092*/, "");
    var selectedText = selectedText.replace(/&#0092*&#0092/[&#0092s]*$/, "");
  • edited May 2009
    Actually, #2 - Uncomment ... happened to me once. But when i highlighted the same block again, it worked all right.
    Can i change those iconds to my own? Like the window icon? Looked in about:config for the image location, thought i can 're-locate' it, didn't find it.
  • you need to goto the extension folder then chrome&#92icons&#92default (you can't change the location)
  • Sure, thanks! ChoGGi, what's the Merge button is for again? Doesn't seem to be doing anything here (0.0.10)
  • it merges separate lines into a single line
  • Right, i remember now. It (style or a portion) needs to be highlighted. 'Merge' seems to be a bit out of place, IMO. Maybe something like Compress or Compact?
  • edited May 2009
    Posted By: ChoGGi
    var selectedText = selectedText.replace(/^[\s]*\/\*/, "");
    var selectedText = selectedText.replace(/\*\/[\s]*$/, "");
    Have you tried this:
    var selectedText = selectedText.replace(/\/\*(.*?)\*\//g,"$1");
    Should actually uncomment all comments in selectedText, regardless where they appear. Only thing which could go wrong here: If there's something like "/* blabla /* bla */ bla */" (i.e. a comment inside of a comment), it would break - and make it " bla */". Hm. Could be this one is better:
    var selectedText = selectedText.replace(/\/\*([^\*]*?)\*\//g,"$1");
    which should, given above example, first remove the inner comment markers, and then the outer (because of the "g" = "global" at the end).

    Just "out of my mind", not tested - please try first or check with the references. "$1" is a so called back-reference and will be replaced by the first parenthesis term - just as an explanation.

    (Remark: Quoting RegExps here is a pain in the `echo app|sed 's/p/s/g'`- the preview suggests you need to double-escape, and after posting it turns out to not be the case...)

    Edit: Could be it does not work like that due to the "global" replace (not sure whether you would need a loop over matches for that). If you just want to remove one tuple per time, simply try omitting the "g" then.
  • Posted By: makondoMaybe something like Compress or Compact?
    that doesn't sound like what it does though :)

    @Izzy it's easy enough to remove all comments, i'm trying to get just the outer ones (the /* is easy, it's that */ that is annoying)
    i'll go give your regexp a try, btw you can add &#92 with (which i'm guessing you did)&#92
  • Stylish-Custom-0.1.2.xpi
    UnComment ignores starting/ending whitespace chars in selected text without removing whitespace

    @Izzy they didn't really work but your mention of parenthesis fixed the problem i was having, so thank you :)
    if anyone is interested
    var selectedText = selectedText.replace(/^([&#92s]*)&#92/&#92*([&#92s&#92S]*)&#92*&#92/([&#92s]*)$/gm,"$1$2$3");
  • It's Geaaat

    if you can, add "Open in external editor" button too.
  • Posted By: ChoGGiStylish-Custom-0.1.2.xpi
    Fast as usual - "our daily update give us today" Angel
    @Izzy they didn't really work but your mention of parenthesis fixed the problem i was having, so thank you :)
    I wasn't expecting it to work out-of-the-box - but as I see, you got the idea behind it (i.e. masking the whole string and using back-references), so it was somehow useful at last.
    var selectedText = selectedText.replace(/^([\s]*)\/\*([\s\S]*)\*\/([\s]*)$/gm,"$1$2$3");
    Jepp - sounds fine. The only irritating thing is the "[\s\S]" part - i.e. "all whitespaces and non-whitespaces". On a quick look, this should be identical to ".*" (all characters). But probably there's some side-effect involved - such as ".*" not matching dots if you do not explicitly tell it to ("/.*/s" AFAIR)? Just out of curiosity.

    The other question left: Did you try that on my fine "bla" string ("/* blabla /* bla */ bla */"), i.e. a comment inside the comment? Ooops - yes, should work (since it's greedy). But what about "/* blabla /* bla */"? Could probably happen if one is a bit careless marking the correct block. As long as the outer "/*" has a matching part somewhere behind that string, there should be no problem with the resulting " blabla /* bla ", as the comment would be closed. But probably it's hard to find a "perfect solution" for this:
    • as it is, it may cause an error (if there's no other closing "*/" behind)
    • removing it "syntactically correct" (i.e. the inner comment only) could have the same result
    • running a syntax check first and warn the user ("this may cause..since... Proceed nevertheless?") would probably be not a bad idea, but a huge overhead OhMy
    ChoGGi, please don't count this a "request" - I'm just brainstorming and pointing. Decide however you like, it will be fine for me (concerning this issue and for now Whistle).
  • finaly.. :)
    a much needed addition to Stylish :)
    maybe a chance of merging it to upstream stylish release or as a fork?
  • @purpler: It started as a kind of "fork", but was decided to continue as "addon for the addon". This way both projects have their profits: The original Stylish can be extended with the features of this Stylish-Custom - and Stylish-Custom automatically uses fixes and new features of new Stylish versions. To me, this looks like the best way - the only little "disadvantage" is you have to install two extensions instead of one. I can live with that Cool
  • edited May 2009
    Posted By: Alirezaaaif you can, add "Open in external editor" button too.
    it's already there, but you need itsalltext
    Posted By: IzzyThe only irritating thing is the "[\s\S]" part - i.e. "all whitespaces and non-whitespaces". On a quick look, this should be identical to ".*" (all characters).
    (The decimal point) matches any single character except the newline characters: \n \r \u2028 or \u2029. ([\s\S] can be used to match any character including newlines.)
    https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/RegExp
    But what about "/* blabla /* bla */"?
    it leaves the one in the middle and some space on the outside

    it goes from the start till the first /* then everything in the middle then the last */ and any whitespace, then joins the whitespaces with the middle
    if someone runs it on just a /* or */ it doesn't change anything
    Posted By: purplermaybe a chance of merging it to upstream stylish release or as a fork?
    it's staying separate from stylish. it was a fork, but overlays should be less work when stylish is upgraded (or none at all)
  • Posted By: ChoGGi
    Posted By: IzzyThe only irritating thing is the "[\s\S]" part - i.e. "all whitespaces and non-whitespaces". On a quick look, this should be identical to ".*" (all characters).
    (The decimal point) matches any single character except the newline characters: \n \r \u2028 or \u2029. ([\s\S] can be used to match any character including newlines.)
    See - I knew there was something. And now I know what it is - thank you again, ChoGGi: You taught me something important to keep in mind!
    But what about "/* blabla /* bla */"?
    it leaves the one in the middle and some space on the outside
    Meaning it returns something like " blabla /* bla ", if I got this right - which means a single "/*" is left, as I guessed already. So what. A warning would be nice in this case, I guess, since the result may break the script. Not sure how the original comment would be treated by JS - but I assume JS would not choke on the "inner comment open" but treat it as part of the comment instead - so after removing the outer comment marks, the problem arises.

    You may say that's up to the style writer, and I'm with you. Though it would be nice to be warned in such a case - do you agree? So maybe you count it as a "suggestion" for stylish-custom 0.2.5 or the like? RollEyes
  • well it'd only be in the style if the author added it so :)
  • OK, I can live with that. But could you tell me what happened here:
    ImageHost.org
    First two items map to the same function. But the second arrow seems to go nowhere. Latest Stylish (1.0.1) and latest Stylish-Custom (0.1.1).
  • edited May 2009
    not sure what os/ff version are you running

    also can you get a screen shot of those menuitems in domi?
    and anything in the error console?
  • Posted By: Izzy... and latest Stylish-Custom (0.1.1).
    Izzy, you're slow! - we're at 0.1.2 as of 18hrs ago ;-)

    That shot above, could be a theme but it appears to be the default, right?
  • @ChoGGi: All that you wish. First: FF3.0.10 on KUbuntu 8.04. Then (@makondo: right you are) default theme. DOMi Screenshot: DOMi Stylish

    @makondo: ChoGGi didn't announce a 0.1.2, so you probably offering me some spyware Stop
  • edited May 2009
    In my opinion, using replace(/\/\*([\s\S]*?)\*\//g, '$1') is the best option. You don't need to specify anything to the left or right of the comment because those are untouched by the replacer. Using the *? means it will match as little as possible and thus work like a real CSS parser will, stopping at the first */, no matter how many /* go before it. Using /g and using [\s\S] have already been explained above. If anyone has code that contains nested or unmatching numbers of comment openings/closings, their syntax is most likely invalid already and so it's not our responsibility to fix it. We just want to remove matching comment boundaries. (Currently in 0.1.2, trying to un-comment a string like boffi/*n*/brain doesn't work at all.)

    PS. I still don't see the difference between the Stylish standard 'Turn All Styles On/Off' and the custom 'Disable/Restore Stylish Rules'.
  • i don't want it to remove boffi/*n*/brain, i was trying to remove them from the outside with maybe some whitespace (the opposite of the Comment button)
    PS. I still don't see the difference between the Stylish standard 'Turn All Styles On/Off' and the custom 'Disable/Restore Stylish Rules'.
    if you use turn all off you won't be able to work on another style, you will be able to with disable rules
    Posted By: Izzy@makondo: ChoGGi didn't announce a 0.1.2, so you probably offering me some spywareStop
    :), i'll get a copy going in virtualbox and see
  • edited May 2009
    Posted By: ChoGGi right in the mid. of this page:Stylish-Custom-0.1.2.xpi
    UnComment ignores starting/ending whitespace chars in selected text without removing whitespace...
    Am i the only one who see this ^ ? Izzy, are you toying with me?!
  • ChoGGi did announce a 0.1.2. I see the post as well.
  • @makondo: Oh well - and I even replied to that post ... Ninja
  • i've added an update all button for 0.1.3 (little problem though you need to close then open the manage window or the update styles won't change)
    i'm going to see about an option to change the window icons before i release 0.1.3
  • edited October 2016
    Izzy! I think ChoGGi is now warning you before posting a new version! .....
  • I made a couple of extra icons for you. :)
  • ah beauty, thank you boff

    @makondo :) miight be a little bit before the next one. got a new cpu today, but the mb is having a bit of an issue
  • That's not good! Hope you'll get it working all right w/out loosing anything. I'm not in a rush ... don't know about Izzy though ;-)
Sign In or Register to comment.