Possible to apply styles by tab in Firefox?

edited November 2008 in Stylish
I just started using Stylish. I would use this much, except that when I invoke a CSS it applies to all open tabs (I use the tabmixplus extension, but I doubt that matters). Some styles are good for some pages, and not for others.

I would like to apply certain style sheets to certain tabs, or even to prespecify the use of certain style sheets to certain URLs. Is either of these possible in Stylish or Firefox?

Thanks,
Paul

Comments

  • You bet, Paul.

    At the top of Stylish you'll see "Insert" you can use that to specify a wide range of URL selectors including anything at a certain domain, a URL that starts with, etc.

    Cheers,

    Michael
  • Ok cool. Then I can preset domains that I want to apply a certain style to.

    Is there any way to apply a style to a tab? I would use this when I wanted to give my eyes a break from long reading. Opera works that way. Only the focused tab and its children take on style sheet changes made on the fly.

    Thanks,
    p.
  • >> Only the focused tab and its children take on style sheet changes made on the fly.

    As far as I know Stylish can't access the window of the curent tab. All that Stylish can change in the "current tab" - is, literally, the tab itself. In fact I have a Style that changes the current tab to blue.

    A started a thread a while ago:

    Style for the current tab only - possible? - userstyles.org
    http://forum.userstyles.org/comments.php?DiscussionID=1838

    I was disappointed to learn that Stylish can't access the current tab so I tried to get Greasemonkey to do it. But Greasemonkey is similar - it isn't designed to be aware of the current tab. People gave me hacks for Greasemonkey - but I'm crap at javasctipt - so I have yet to try them out.

    Today - yet, again - I'm going to try to figure out a lazy/easy way - maybe via a bookmarklet to work on something "like" the current tab. My ideas are probably silly, but if I actually make progress - I'll post in this thread.
  • Yep, your thread gets exactly at what I mean here.

    I currently am changing background color via a bookmarklet on the toolbar:

    javascript:(function(){function%20getRGBColor(node,prop){var%20rgb=getComputedStyle(node,null).getPropertyValue(prop);var%20r,g,b;if(/rgb\((\d+),\s(\d+),\s(\d+)\)/.exec(rgb)){r=parseInt(RegExp.$1,10);g=parseInt(RegExp.$2,10);b=parseInt(RegExp.$3,10);return[r/255,g/255,b/255];}return%20rgb;}%20R(document.documentElement);%20function%20R(n){var%20i,x,color;if(n.nodeType==Node.ELEMENT_NODE%20&&%20n.tagName.toLowerCase()!=%22input%22%20&&%20n.tagName.toLowerCase()!=%22select%22%20&&%20n.tagName.toLowerCase!=%22textarea%22){for(i=0;x=n.childNodes[i];++i)R(x);%20color=getRGBColor(n,%22background-color%22);if(%20(typeof(color)!=%22string%22%20&&%20color[0]%20+%20color[1]%20+%20color[2]%20>=%202.8)%20||%20(n==document.documentElement%20&&%20color==%22transparent%22))%20{%20n.style.backgroundColor%20=%20%22#C1BE9D%22;/*Moz%201.0*/%20n.style.setProperty(%22background-color%22,%20%22#FDFADD%22,%20%22important%22);/*Moz%201.4%20after%20zap%20colors*/%20}%20}}})()

    Works great, except it has to be reapplied every time I navigate or refresh. Residing in the tab, as Opera does, would be nice.
  • edited November 2008
    This colorizes the current tab (to my liking):

    @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul); .tabbrowser-tab[selected="true"] > hbox, .tabbrowser-tab[selected="true"] > .tab-close-button { background-color: #00f !important; color: #00f !important; }

    It's based on this

    Colorize Firefox 2 Active Tab | userstyles.org
    http://userstyles.org/styles/1179

    for all other tab stuff - I use Tab Mix Plus

    Tab Mix Plus
    https://addons.mozilla.org/en-US/firefox/addon/1122

    ---

    By they way - use code tags for code.

    ---

    Edit

    I just checked - Tab Mix Plus *still* doesn't allow you to set the background color of the current tab.
  • Ok, just to be clear, I'm talking about the background of the page itself, not the tab. I think we understand that, but just to be sure.

    As for CODE, I'm not sure how to implement it in these comments.
  • edited November 2008
    Right - we're on the same wavelength - or in the same "window" if you will. I just showed you the limits of what Stylish can do - which is nothing inside the current tab window.

    I didn't know until I read this thread that it was possible in Opera. I guess that's one more thing Firefox could "borrow" from Opera.

    ---

    code example

    <code>As for CODE, I'm not sure how to implement it in these comments.</code>

    As for CODE, I'm not sure how to implement it in these comments.

    ---

    Have a look at a new thread I just started...

    a hack to hide/show stuff - userstyles.org
    http://forum.userstyles.org/comments.php?DiscussionID=1964&page=1#Item_1

    It might allow you to fool around with some things in the current tab - if you set the greasemonkey script to include all pages. It's a method I just came up with just today after weeks and weeks of trying. I'm still not sure what it can and can't do.
  • BTW, thanks for that tab coloring script. Very nice. It is amazing that TMP doesn't do that, considering how great that extension is.

    As for code, I tried



    test



    and it didn't work. There's nothing in documentation
  • test

    I see. HTML must be selected. Got it.
  • >> HTML must be selected.

    Where is that option? Oh... Sorry - I've posted so often here - I don't even notice the "Format comments" line anymore. In fact

    There's also an edit link.

    The one thing the site doesn't offer is a way to delete your own posts - you have to ask a mod to do it.
Sign In or Register to comment.