MozillaZine

Stylish 0.2.1 (Now with repository!)

Talk about add-ons and extension development.
old np
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted January 18th, 2006, 10:20 am

Thumper wrote:tables not getting properly styled on refresh

Need an example (URL and style you're using).
Thumper wrote:change the default edit font to monospace

Will do. In the meantime, you could always use Stylish to style Stylish.
Code: Select all
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
@-moz-document url(chrome://stylish/content/stylish-edit.xul) {
#code { font-family: monospace !important;}
}

Thumper

User avatar
 
Posts: 8037
Joined: November 4th, 2002, 5:42 pm
Location: Linlithgow, Scotland

Post Posted January 19th, 2006, 3:50 am

That's the first thing I did. :) As for tables, I'd put up a testcase but work are pretty amazingly paranoid about where their storage interfaces with the Internet. Try removing the borders and changing padding, then reloading. It pretty reliably fails to work here.

Oh oh, and also, ctrl-Z in a freshly-opened Edit Style window deletes everything. Ironically, this isn't undoable.

- Chris

old np
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted January 19th, 2006, 8:13 am

Thumper wrote:Oh oh, and also, ctrl-Z in a freshly-opened Edit Style window deletes everything. Ironically, this isn't undoable.

It is redoable though (Ctrl+Y). That fact that it wipes it out on undo is probably because it treats me filling the values with JavaScript as a user action. I don't know if there's a way around it, but I'll check.

Bushwack
 
Posts: 144
Joined: December 4th, 2002, 12:36 pm

Post Posted January 19th, 2006, 1:37 pm

I've only set up one style so I'm not sure of the normal behaviour but I think I'm experiencing the table bug Thumper is reffuring too.

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

@-moz-document url("http://alterslash.org/") {

table {
 width: 90%;
}
* {
font-size: large;
}
}


Every time I load that page (alterslash.org) the tables aren't resized (but the font size is correct). To get the tables to resize I need to disable then re-enable the style.

old np
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted January 19th, 2006, 2:03 pm

Motohiko wrote:
np wrote:Known issues
(snip)
* Instant apply has a slightly different priority than normal apply. As long as you use !important, it shouldn't be a problem.


Adding '!important' to the rule will resolve your question.


(If you don't understand any of the following, just remember... put !important in every property you set and it'll work perfectly most of the time).

I'll explain this a bit more... there two types of styles - author styles and user styles. Author styles are everything that the web page defines, user styles is everything the user defines (user=browser for people not messing with user styles. So an example of a user style is that h1 makes big text).

Regular author styles take precedence over regular user styles. So if Firefox says that h1 should be 16px, but the author of the page says that h1 should be 12px, Firefox will render the h1 as 12px.

Styles can also be "important" or not. Important styles beat regular styles. User important styles beat author regular styles. So if Firefox said h1 should be 16px !important, and the author said h1 should be 12px !important, Firefox will render h1 as 16px.

So, in the order of "strongest" to "weakest", it's user important, author important, author regular, user regular.

Instant-apply puts styles in as author styles. Regular apply puts styles in as user styles. So as you can see, if you don't put your styles in as "important", you end up applying them as "user regular" and all the author's styles beat you. If you do put them as "important", you beat all the author's styles.

Bushwack
 
Posts: 144
Joined: December 4th, 2002, 12:36 pm

Post Posted January 19th, 2006, 3:31 pm

So sorry, I should have read the whole thread (or at least the first post) before reporting an issue. I just installed this extension, had an issue and the first post I read was Thumper's. Everything works great now, thanks so much. This extension is really sweet too, I know I used to be able to do it by modifying the content file but that was such a pain in the ass I hardly ever bothered.

"Stylish, fixing the web one page at a time."

Motohiko
 
Posts: 65
Joined: November 22nd, 2003, 8:05 pm
Location: Japan

Post Posted January 19th, 2006, 11:12 pm

np wrote:When do you get those warnings?
I can't reproduce this. If I found how to reproduce it, I'll write it.


P.S.
I updated the patch for SLD issue I said the other day. This adds a database of reserved second-level-domains.

Please take a look at this.
Thanks.

Motohiko
 
Posts: 65
Joined: November 22nd, 2003, 8:05 pm
Location: Japan

Post Posted January 20th, 2006, 2:39 am

I wrote 'Automatic Stylesheet Splitter'. Please test with your user sheets. If you have a problem with this, report it to me by PM.

test for stylishLooseCSSParser


Note:
  • This doesn't contain function for '@charset' rule.
  • Current version does not care about '@namespace'. '@namespace' at-rules should be in all of the splitted styles. (This is why I don't take the select-and-import method.)
  • Current version doesn't care about '@media'. I don't know whether rulesets in '@media' rule should be splitted or not. But I know we cannot specify '@media' at-rule with '@-moz-document' at-rule (this means you cannot specify site-specific user sheets for printing). I think this is bug.
    And there is a similar problem with '@page' at-rules and '@media' at-rules (accoding to Grammar of CSS 2.1 '@page' and '@media' should be present in top level. This means you cannot specify different '@page' rules for 'print' media and 'projection' media; both are 'paged' media. Please don't confuse that Firefox doesn't support '@page' at-rule yet).
  • IMO '@import'-ing chrome URI should be left in userChrome/userContent.css because they might be controlled by any other extensions. Sheets with file, http and https URI will be imported to Stylish.
  • Do you want to be loaded sheets with 'file' URI? In the other words, if there is an "@import url(foo.css);", there should be contents of 'foo.css' instead of at-rule? And then, should split 'foo.css'?
  • Comments are joined to next declaration/ruleset.

old np
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted January 20th, 2006, 8:49 am

Thumper wrote:Try removing the borders and changing padding, then reloading. It pretty reliably fails to work here.

Did you also forget to add !important?

old np
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted January 20th, 2006, 9:01 am

Motohiko wrote:Current version does not care about '@namespace'. '@namespace' at-rules should be in all of the splitted styles.

I think you can assume that anything in chrome should be in the XUL namespace and everything in content should be in the HTML namespace. If that assumption is wrong, they can always change it.
Motohiko wrote:Current version doesn't care about '@media'.

I think you can assume that no one cares about @media or @page. The rest of Stylish doesn't handle these things properly either. If possible, just leave it in the file.
Motohiko wrote:IMO '@import'-ing chrome URI should be left in userChrome/userContent.css because they might be controlled by any other extensions. Sheets with file, http and https URI will be imported to Stylish.[*]Do you want to be loaded sheets with 'file' URI? In the other words, if there is an "@import url(foo.css);", there should be contents of 'foo.css' instead of at-rule? And then, should split 'foo.css'?

Leave chrome and file imports alone. If someone's doing that, there's probably something we don't understand going on, so we don't wanna mess with it. As for http imports, do those even work in userChrome/content?

Thumper

User avatar
 
Posts: 8037
Joined: November 4th, 2002, 5:42 pm
Location: Linlithgow, Scotland

Post Posted January 20th, 2006, 9:29 am

np wrote:Did you also forget to add !important?


Less "forgot" as was unaware that author !importants outranked user styles. Cheers.

- Chris

old np
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted January 21st, 2006, 11:03 am

Motohiko wrote:Try this (diff v.s. stylish.js of v0.2):

With that patch, if you delete a style and then enable/disable the last style, it throws
Code: Select all
Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsITreeContentView.getItemAtIndex]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: chrome://stylish/content/stylish.js :: anonymous :: line 45"  data: no]

and some styles disappear. It looks like tree.view doesn't get updated with the new data, which I believe was the reason I had added refresh all over.

********
 
Posts: 947
Joined: August 24th, 2005, 12:23 pm

Post Posted January 21st, 2006, 8:26 pm

i often get this message when trying to save changes to one of my styles, especially if it's the last style in the list:
Code: Select all
TypeError:
containedDocShells.getNext().QueryInterface(Components.interface.nsIDocShell).contentViewer has no properties.

so i have to click the cancel button to get out.

also, if i try to create a new style, and that error comes up when i try to save it, the new style is still created, but i can't do anything to it, not even delete it.
i can enable/disable it, but the changes aren't saved.

this is very annoying, and i've had to resort to manually editting stylish.rdf sometimes, which is even more tedious than manually editting userChrome.css or userContent.css

old np
 
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post Posted January 21st, 2006, 10:29 pm

Does it work if you disable Adblock? If so, read these few posts.

Motohiko
 
Posts: 65
Joined: November 22nd, 2003, 8:05 pm
Location: Japan

Post Posted January 23rd, 2006, 2:57 am

np wrote:
Motohiko wrote:Try this (diff v.s. stylish.js of v0.2):

With that patch, if you delete a style and then enable/disable the last style, it throws
Code: Select all
Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsITreeContentView.getItemAtIndex]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: chrome://stylish/content/stylish.js :: anonymous :: line 45"  data: no]

and some styles disappear. It looks like tree.view doesn't get updated with the new data, which I believe was the reason I had added refresh all over.
OK. patch for this (function toggleNodeDisable() in stylishCommon.js):
Code: Select all
       }
       node.modifyTarget(stylishCommon.enabledURI, previousTarget, newTarget);      
       if (saveImmediately) {
          this.ds.save();
-         this.ds.refresh(true);
       }
    }


Return to Extension Development


Who is online

Users browsing this forum: No registered users and 1 guest