AutoAuth, Comment Snob, Feed Sidebar, Links Like This, Mozilla, Mozilla Add-ons, Mozilla Firefox, OPML Support, RSS Ticker, YouTube Comment Snob

My Future of Developing Firefox Add-ons

Note: AutoAuth is now being developed by Steffan Schlein. If you would like to leave feedback, please create an issue on GitHub.

Mozilla announced today that add-ons that depend on XUL, XPCOM, or XBL will be deprecated and subsequently incompatible with future versions of Firefox:

Consequently, we have decided to deprecate add-ons that depend on XUL, XPCOM, and XBL. We don’t have a specific timeline for deprecation, but most likely it will take place within 12 to 18 months from now. We are announcing the change now so that developers can prepare and offer feedback.

In response to this announcement, I’ve taken the step of discontinuing all of my Firefox add-ons. They all depend on XUL or XPCOM, so there’s no sense in developing them for the next year only to see them become non-functional. AutoAuth, Comment Snob, Feed Sidebar, Links Like This, OPML Support, RSS Ticker, and Tab History Redux should be considered unsupported as of now. (If for any reason, you’d like to take over development of any of them, e-mail me.)

While I don’t like Mozilla’s decision (and I don’t think it’s the best thing for the future of Firefox), I understand it; there’s a lot of innovation that could happen in Web browser technology that is stifled because of a decade-old add-on model. I only hope that the strides a lighter-weight Firefox can make will outweigh the loss of the thousands of add-ons that made it as popular as it is today.

Standard
Browser Add-ons, Comment Snob, Google Chrome, JavaScript, Mozilla, Mozilla Firefox, Programming, Software, Technology, YouTube Comment Snob

Announcing Typo.js: Client-side JavaScript Spellchecking

When I first ported YouTube Comment Snob to Chrome, Chrome’s lack of a spellchecking API for extensions meant that I would be unable to implement Comment Snob’s most popular and distinguishing feature: the ability to filter out comments based on spelling mistakes. That, my friend, is about to change.

I’ve finished work on the first version of a client-side spellchecker written entirely in JavaScript, and I’m calling it Typo.js. Its express purpose is to allow Chrome extensions to perform spellchecking, although there’s no reason it wouldn’t work in other JavaScript environments. (Don’t use it for Firefox extensions though; use Firefox’s native spellchecking API.)

How does it work?

Typo.js uses Hunspell-style dictionaries – the same ones used in the spellcheckers of OpenOffice.org and Firefox. (Typo.js ships with the latest American English dictionary, but you could add any number of other dictionary files to it yourself.) You initialize a Typo.js instance in one of two ways:

Method #1

var dictionary = new Typo("en_US");

This tells Typo.js to load the dictionary represented by two files in the dictionaries/en_US/ directory: en_US.aff and en_US.dic. The .aff file is an affix file: a list of rules for creating multiple forms of a word by adding prefixes and suffixes. The .dic file is the dictionary file: a list of root words and the affix rules that apply to them. Typo parses these files and generates a complete dictionary by applying the applicable affix rules to the list of root words.

Method #2

var dictionary = new Typo("en_US", affData, dicData);

With this initialization method, you supply the data from the affix and dictionary files. This method is preferable if you wish to change the location of the affix and dictionary files or if you are using Typo.js in an environment other than a Chrome extension, such as in a webpage or in a server-side JavaScript environment.

Once you’ve initialized a Typo instance, you can use it to check whether a word is misspelled:

var is_correct_spelling = dictionary.check("mispelled");

Customization

Depending on your needs, you can configure Typo.js to perform word lookups in one of two ways:

  1. hash: Stores the dictionary words as the keys of a hash and does a key existence check to determine whether a word is spelled correctly. Lookups are very fast, but this method uses more memory.
  2. binary search: Concatenates dictionary words of identical length into sets of long strings and uses binary search in these strings to check whether a word exists in the dictionary. It uses less memory than the hash implementation, but lookups are slower. This method was abandoned as it became impractical to implement for some features.

See this blog post by John Resig for a more detailed exploration of possible dictionary representations in JavaScript.

Practice vs. Theory

Typo.js is already in use in my Comment Snob extension. You can install it today to experience Typo.js in action, filtering comments on YouTube based on the number of spelling mistakes in each one.

What’s next for Typo.js?

The next step is adding support for returning spelling suggestions; right now, all Typo.js can do is tell you whether a word is spelled correctly or not. It also needs to support Hunspell’s compound word rules. These are the rules that a spellchecker uses to determine whether words like “100th”, “101st”, “102th” are correct spellings (yes, yes, and no, for those of you keeping track) since it would be impossible to precompute a list of all possible words of these forms.

The Typo.js code is available on GitHub. I welcome any and all suggestions or code contributions.

Standard
Browser Add-ons, Comment Snob, Google Chrome, Programming, Yahoo!, YouTube, YouTube Comment Snob

YouTube Comment Snob is now Comment Snob

In 2007, I wrote a Firefox add-on called YouTube Comment Snob. Its main function was to filter out the inanity from YouTube comment threads, and it worked (and still works) very well, but the comment I heard most frequently from people who tried it out was “Can you make this for the entire Web?” Until now, my answer has been, “No, not yet.” But now, my answer is “Very yes.”

Announcing Comment Snob

Comment Snob is an extension for Google Chrome that filters out undesirable comments from comment threads all over the Web.

Before: After:
YouTube (before Comment Snob) YouTube (after Comment Snob)

You can install it here. It still comes with support for YouTube built in, but you can add support for many other sites by installing Comment Snob rules.

What are Comment Snob Rules?

Comment Snob rules are JSON objects that dictate how Comment Snob finds and filters comments on different websites. Here’s the rule for YouTube that ships with Comment Snob:

{
	"id": "youtube@chrisfinke.com",
	"label": "YouTube",
	"url": "^http://www\\.youtube\\.com/.*$",
	"allCommentsSelector": "#comments-view",
	"commentContainerSelector": "li.comment",
	"commentTextSelector": "div.comment-text",
	"commentHideSelector": "> div",
	"statusElementTag": "div",
	"statusElementAttributes": {
		"class": "content",
		"style": "color: #666;"
	},
	"ajaxInitiatorSelector": ".comments-pagination button, .comments-pagination a, .comments-pagination button > span",
	"updateURL": "/comment-snob/rules/youtube.snob"
}

If you know HTML and understand how to use jQuery, you can write rules for Comment Snob. (Full instructions for writing rules are available here.)

For each rule that you install, you can choose a unique set of filtering rules:

Where Can I Install Rules?

I’ve written eight rules myself and made them available on this page (scroll down to “Featured Comment Snob Rules”); as other people write rules, I’ll link to them from that page as well. Eventually, I’ll have a proper site put together for showcasing the most popular rules.

Where Can I Install It?

Install it from the Google Chrome Extensions Gallery. It’s not available for Firefox yet, but I’ll most likely be releasing the next version for Chrome and Firefox simultaneously.

What’s Next?

This version of Comment Snob is just a shell of what my final vision is for comment filtering on the Web; right now, it’s all very manual, and the chances of false positives are too high for my taste. Adding a proper spellcheck filter will help that somewhat (Chrome doesn’t yet have a spellcheck API like Firefox does), but imagine a future where all comments on all websites could be filtered automatically based on their content, grammar, and keyword frequency, without having to account for personality differences between different websites. (e.g., The expected quality of a YouTube comment is much lower than the expected quality of a Hacker News comment, so Hacker News comments should be judged more stringently.) That starts to get close to what I want Comment Snob to be.

Standard
AutoAuth, Browser Add-ons, Mozilla, Mozilla Add-ons, Mozilla Fennec, Mozilla Firefox, Slashdotter, TwitterBar, YouTube Comment Snob

Four More Fennec Add-ons

Update: TwitterBar for Firefox was sold to HootSuite and renamed HootBar in March of 2011. TwitterBar for Chrome was discontinued in October of 2012.

Note: AutoAuth is now being developed by Steffan Schlein. If you would like to leave feedback, please create an issue on GitHub.

I got some great feedback after I updated URL Fixer to be compatible with Fennec, Mozilla’s mobile browser, and I’m happy to announce that I’ve been able to add Fennec compatibility to four more add-ons:

So far, I’ve found it pretty easy to port add-ons to Fennec, with the following caveats:

  • You can’t install add-ons in Fennec by opening them from your computer; I wrote a script to copy the add-on directly into the Fennec profile, much like an add-on IV drip – straight into the bloodstream!
  • There’s no easy access to the error console , but you can open it manually if you grab the address from Firefox.
  • No DOM Inspector. For now, just browse the source.

It seems that all of these issues could be solved with a “Fennec Add-on Development” extension; maybe that will be my next project, unless easier solutions already exist.

Standard
Browser Add-ons, Mozilla Firefox, YouTube, YouTube Comment Snob

YouTube Comment Snob updated

YouTube Comment Snob is an extension for the Firefox Web browser that allows you to filter YouTube comments based on spelling, capitalization, and punctuation usage.

I’ve updated YouTube Comment Snob to work with YouTube’s latest redesign, as well as to add compatibility for Firefox 3. It’s available for download from the Mozilla Add-ons sandbox until it is approved by an AMO editor for mass consumption.

Standard
Browser Add-ons, YouTube, YouTube Comment Snob

Filter YouTube comments by spelling mistakes

I’m sure that I’m not the only one who has noticed that the discussion threads at YouTube typically contain a low percentage of quality comments. Earlier this week, I remarked to a co-worker that it wouldn’t be a bad idea to be able to filter the comments based on the number of spelling mistakes made by the author. Inspired by that thought, I’ve written a Firefox extension that makes that kind of filtering possible.

With the YouTube Comment Snob Firefox extension, you can hide comments that meet any of these criteria:

  • More than # spelling mistakes: The number of mistakes is customizable, and the extension uses Firefox’s built-in spell checker.
  • All capital letters
  • No capital letters
  • Doesn’t start with a capital letter
  • Excessive punctuation (!!!! ????)
  • Excessive capitalization

For example, here’s part of a typical YouTube comment thread:

YouTube Comments

And here’s how that same section looks when using YouTube Comment Snob:

Example of YouTube Comment Snob’s work

(You’ll notice how foreign languages are categorized as spelling mistakes; if you speak a different language and have that dictionary installed for Firefox’s spellchecker, you can choose to have YouTube Comment Snob use that dictionary instead.)

You can install YouTube Comment Snob from its homepage. It is compatible with Firefox 1.5 through 3.0a7, Netscape Navigator 9, and Flock.

Standard