Data URIs and line breaks

Firefox strips out line breaks in URLs when they’re used as HTML attributes and when they’re pasted into the location bar. Firefox does not allow strip out line breaks in URLs when they’re used in CSS – they cause a syntax error.

Pre-1.0 Stylish strips out line breaks from stylesheets before applying them. Stylish 1.0 to 1.0.5 also does this, but does not strip out line breaks when it does its error check, so they’re still reported as errors.

Some tools generate data URIs with line breaks in them. Many styles posted on userstyles.org contain data URIs with line breaks in them.

Putting all the pieces together: starting in Stylish 1.0.6, data URIs with line breaks in them will no longer work. This is to ensure consistency in how the CSS is applied; what works and what is reported as an error in Stylish will now be the same as what works and what is reported as an error on web pages in this respect. Before Stylish 1.0.6 is released, I will run a script that will update all styles posted on userstyles.org to strip out the whitespace in data URIs. After Stylish 1.0.6 is released, if you have styles installed that include line breaks in data URIs, they will stop working (completely or partially). If you install updates for them, they should work again.

More styles available as user scripts and as plain CSS

I’ve updated the site to make even more styles available as user scripts for Greasemonkey, Chrome and Opera users. Now, all styles except for app styles (which are impossible in a user script) are available in user script form. Additionally, some styles are available as plain CSS, which strips out the -moz-document sections, which works with Opera’s user CSS and Site Preferences features.

Keep in mind, though, that even though the site can generate styles in a format that other browsers can use, it doesn’t mean that the other browsers will understand the CSS or make the display changes as intended. For example, if a style is using -moz-column-count, which only works in Mozilla apps, if you tried to install that style as a user script in Chrome, it won’t apply correctly.

If you have any suggestions for additional formats the the site could generate or any improvements to make to the current formats, let me know.

Introducing SomeScript

SomeScript is a new extension by Tung Nguyen based off my YesScript, which was created in response to NoScript. A history lesson is in order.

NoScript came first. It’s an extension designed to make your Firefox more secure. It has all sorts of anti-bad stuff filters, including a feature that turns JavaScript off. I wanted to use NoScript to turn off JavaScript on sites that had annoying pop-up windows. I found that it took too many steps to configure NoScript the way I wanted. I was also mildly insulted by its assertion that browsing with JavaScript on is “dangerous” and its frequent updates that send you to the developer’s home page, among other things.

So I made YesScript. YesScript is designed to make the web less annoying; it doesn’t make anything more secure. It’s a JavaScript blacklist. The only configuration required is that you click on the icon when you want to turn off a site’s ability to run JavaScript. Click again to turn on. Nice and simple, does what I want.

A month ago, there was a kerfuffle between the developers of Adblock Plus and NoScript. As a result, SomeScript was created based on YesScript’s code to replace NoScript. SomeScript is a JavaScript whitelist, so it’s only a replacement for the blocking JavaScript portion of NoScript, not for the anti-bad stuff filters.

So, history lesson over. I’m glad that YesScript was used to create SomeScript. The developer had some kind words describing my code, too, like “clear”, “easy to read”, and “simple”. I’m going to stick with YesScript, but if you’re interested in a reverse-YesScript without all the additional baggage of NoScript, I recommend giving SomeScript a try.

I would actually be interested in a simplified extension that implemented the anti-bad stuff portion of NoScript. Something that would block common attack vectors automatically, without requiring configuration, and without breaking sites. I imagine this would be much more difficult.

Stylish 1.0 is out

Stylish 1.0 is available, if you haven’t heard yet. The feedback so far has been interesting:

Among the non-contradictory feedback, people have reported that sometimes styles get stuck in the “on” position, requiring them to restart Firefox. This sucks, and this is Stylish’s core functionality, so I’m looking into this problem.

People also miss the fact that Stylish used to check CSS for errors when you were editing it. I miss this too.

And there’s quite a few suggestions for interface tweaks like “double-clicking here should do X”. In general, I’m going to try to implement stuff like this where it offers an improvement and it’s at least somewhat expected behaviour.

There’s quite a bit of discussion on the forum and that’s the best place to get your voice heard. It’s also a good place to learn how to get Stylish to use a stand-alone window or the sidebar, and how to switch the icons back. Stylish 1.0.1 will be out within a week.

Stylish 1.0 is nearly here – I need your help

Stylish 1.0 is nearly complete. Stylish 1.0b2 is the latest development release. Here are the things left to do:

  • Many languages that Stylish 0.5.x was available in aren’t yet available in 1.0. These are Danish, English (British), Spanish, Finnish, Hebrew, Korean, Dutch, Polish, Portuguese (Brazil), Russian, Slovak, Ukrainian, and Chinese (Traditional). Head over to Babelzilla to translate it.
  • There’s a rendering bug on Mac. The User Styles entry in the add-on dialog isn’t supposed to have an icon on Mac. You can see the problem in this user style. If you see this problem on Mac, please this alternate version may or may not help.
  • I’m still looking for some new icons. t1470258 made icons I like:

    But there are a few problems. I need them with transparent backgrounds; in 32×32, 24×24, and 16×16 sizes (I tried resizing those images and it looks like crap); and with less space between the edge of the image and the object in the image (but with the inner square still lined up across all icons).
  • General bug-hunting.

If you have something to contribute, please mail me at jason.barnabe@gmail.com, post in the forum, or comment in this blog. Thanks!

Orkut Background Style Generator

For all you Orkut fans, I’ve made an Orkut Background Style Generator. This lets you create styles that put a custom background on Orkut; you don’t even have to know how to code!

For all you Orkut non-fans, this means I will be removing the over 1,500 styles that people have posted that do this very thing and will be prohibiting creation of further styles that do this. That should make the site somewhat less messy.

Stylish 1.0b1

Stylish 1.0b1 is now available. What is Stylish 1.0b1? It’s the first beta of Stylish 1.0, of course! Among the new features:

  • An updated manage window that integrates with Firefox’s add-ons dialog. It includes tagging, grouping, and sorting.
  • A feature to turn all styles off. This is useful for when you’re troubleshooting or doing web development.
  • The Stylish icon changes depending on whether the current site has styles.
  • A bunch more stuff!

This version currently only supports Firefox 3 and is only available in English, but the final release will support other apps and languages.

Try it out and let me know what you think in the forum.

1000 days of user styles

userstyles.org just passed its 1000th day in business (or at least, its 1000th day of recording install counts). To commemorate, here’s a list of the top styles on each day of its existence.

Fixing strip_attributes for Rails 2.2.2

Upon upgrading my local box to Rails 2.2.2, I found that the strip_attributes plugin stopped working. strip_attributes is a handy little plugin, stripping leading and trailing whitespace from attributes before they’re saved to the database. Fortunately, the fix is easy if you don’t make use of the options parameter that takes :o nly or :except. Just open up strip_attributes.rb and change:

attributes = record.attributes(options)
to
attributes = record.attributes

If you use those parameters, you should be able to throw something together as suggested here.

One for all those lost users out there

I finally got tired of resetting passwords manually and put together a lost password form. Now you can be more efficient at being forgetful.

Adventures in development – Web standards and Firefox extensions