Can't make Stylish script site specific

2.2k views Asked by At

I have a Stylish script on Firefox that moves the Search button on Starting Page, but the problem is that it will move the Search button on other pages, as well.

The lines

@-moz-document url("http://startingpage.com/eng/advanced-search.html?&cat=web&query=")

OR

@-moz-document domain("http://startingpage.com/eng/advanced-search.html?&cat=web&query=")

do not work. The Search button will move on any page that has it.

Any ideas to make it site-specific?

Here’s the script:

@-moz-document url("http://startingpage.com/eng/advanced-search.html?&cat=web&query="){

}
  input[value="Search"] /*isolates button*/
  {
   position: absolute;
   top: 311px;
   left: 660px;
  }

Firefox 3.6.14, Win 2K

2

There are 2 answers

1
Brock Adams On BEST ANSWER

General answer:

That first line (@-moz-document url("http://startingpage.com/eng/advanced-search.html?&cat=web&query=")) should work. Does it only fail because other pages are also affected or does it fail because it never fires?

Anyway, things to check:

  1. Was the opening brace omitted? Usually those lines are like:

    @-moz-document url("http://www.google.com/hl=en&q=foo&aq=f") {
    

    Note the brace at the end (But editing for the brace on the next line is fine, too.

  2. Are the next pages, after the Starting Page, being loaded in by AJAX? For example, Google does this. You will notice that after entering a search term, the entire page does NOT reload.
    If this is the case, then Stylish will still have the overwritten styles in effect; there is no help for it in Stylish.

So, confirm the problem with your first line. It would also be good to include exact links to the target pages and the full script.

If it is an AJAX issue, then you can easily convert the Stylish script to a Greasemonkey script -- which can, with a little logic, apply styles correctly, even on Ajaxified pages. (If that is the case: mark this question answered and open a new question, providing the full Stylish script and the desired results.)


Specific Answer, based on new information from the OP:

Based on the script provided, the error is that the braces are mispositioned. Also, you should provide a namespace.

So replace the script text with:

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url("http://startingpage.com/eng/advanced-search.html?&cat=web&query=")
{
    input[value="Search"] /*isolates button*/
    {
        position: absolute;
        top: 311px;
        left: 660px;
    }
}
0
tsu1980 On
@-moz-document url-prefix("http://startingpage.com/eng")

or

@-moz-document domain(startingpage.com)