Notice: The devs are no longer actively involved in the forum, so any bug reports regarding the Stylish extension or this website should be sent to them directly at contact@userstyles.org.
Changing your Avatar.
The only way to currently change a forum avatar is through Gravatar.com. The email address used for your Userstyles.org account must be one of the email addresses that is registered to your Gravatar account.

Changing style based on title (not domain)

edited February 2007 in Style Requests
Hi,
I recently came across this wonderful extension "Stylish".

I don't know how to write styles, and I am trying to learn.

I want to be able to write styles for all sites that have a particular title string for eg "Start a new discussion - userstyles.org".

Basically, I don't want to write styles for any particular domain, but for all sites that contain a particular title.

Please advise something.

Thanks for all the help,
Bits

Comments

  • edited February 2007
    Pretty sure that's not possible with userstyles, but I imagine you could do it with Greasemonkey if you know javascript.

    If you explain what you want to do in more detail, maybe we can come up with a way to do it with Stylish using a url or url prefix along with something specific about the page(s) you want to modify.
  • Actually in my workplace, most of the internet sites are blocked by sonicwall. Thus always whenever I access a forbidden site like gmail, napster, etc... I get a particular page from the proxy. But the url is never same, i.e. URL will be whatever site I tried to open.

    All I want it to change the look and feel of that standard "web site Blocked" page. The URL is never same. But title of the page is always "SonicWALL - Web Site Blocked".

    Is it possible to change the look and feel in this scenario? I am new to Greasemonkey also.

    If anyone knows a way out. Please let me know.


    Below is the source of the standard "blocked" page:





    SonicWALL - Web Site Blocked


    SonicWALL - Web Site Blocked












    Your access to this Site is restricted.

    Please contact system admin if you need further clarification.





    <!--
    var blockedURL = new String(document.URL);
    if (blockedURL.length < 100) document.write('URL: ' + blockedURL);
    else document.write('URL: ' + blockedURL.substring(0,100) + '...');
    //-->




    Reason for restriction: Administrative Custom List settings
  • While you can't select on the title, you can select on a unique combination of elements and attributes. In the example you've given,
    body[bgcolor="#011b4a"][text="#FFFFFF"]
    is likely to be unique to the blocked page. So if you wanted to do something, you would start with that selector. E.g.
    body[bgcolor="#011b4a"][text="#FFFFFF"] b { font-weight: normal !important;}
    to drop the bolding.
  • Here's something to get you started (I got a bit carried away [screenshot])...

    @namespace url(http://www.w3.org/1999/xhtml); body[bgcolor="#011b4a"][text="#FFFFFF"] { background-color: #abbd92 !important; } /* remove all table cell borders */ body[bgcolor="#011b4a"][text="#FFFFFF"] td { border: none !important; } /* outter table */ body[bgcolor="#011b4a"][text="#FFFFFF"] table[border="2"][bgcolor="#9CBACE"] { background-color: #58614b !important; border: .2em solid #434a39 !important; -moz-border-radius: 1.5em !important; width: auto !important; } /* inner table */ body[bgcolor="#011b4a"][text="#FFFFFF"] table[border="2"][bgcolor="#9CBACE"] table { background-color: #faffd0 !important; border: .5em solid #d0d5a1 !important; -moz-border-radius: 1.5em !important; } /* URL and Restriction reason text */ body[bgcolor="#011b4a"][text="#FFFFFF"] font { color: red !important; } /* change text that's normally in bold */ body[bgcolor="#011b4a"][text="#FFFFFF"] font b { color: black !important; font-family: Georgia, "Times New Roman", Times, serif !important; font-weight: normal !important; }

    This style applies globally to all sites you visit (since you can't use a URL or anything). So, if any web site you visit had that same exact dark blue background and white text, then this style would be applied. If that ever happened, you could be a little more specific...maybe prefix everything with:

    body[bgcolor="#011b4a"][text="#FFFFFF"] > br + br + br + br + br
  • Ty Jasona & Valacar,

    This is exactly what I wanted.

    In fact I got to learn a lot from this.

    Just do me another favor. Being mostly a c/c++ guy, all these things are greek to me. Tell me some tutorial site where I can learn this "style" stuff from very basics.

    I already am trying to begin with these 2 sites. If there is any other link, plz let me know.
    http://www.w3.org/TR/REC-CSS2/
    http://developer.mozilla.org/en/docs/CSS_Reference:Mozilla_Extensions

    Thanks once again.
  • http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#selectors

    Careful with the Structural pseudo-classes, only a few are supported.
Sign In or Register to comment.