Making a Firefox Dev Tools Add-On Look Native

UPDATE: This is now obsolete, with the adoption of WebExtensions.

Now that Firefox has built-in developer tools, it makes sense for developer add-ons integrate with them. MDN has some examples on creating a developer tools panel, but the examples do not look anything like the built-in tools, and do not offer any information on how to do so.

The examples use HTML/CSS/JavaScript to create the panel, however the built-in tools actually use XUL/CSS/JavaScript. Additionally the built-in tools depend on privileged JavaScript files to handle things like theme switching, such as theme-switching.js.

In order to make an add-on look just like the built-in tools, these are the technologies we will have to use.

Continue reading

wheellistener – Cross-browser wheel event listener

If you ever wanted to use scroll events in your web app, you’ve probably found what a mess it is, I know I did when I was developing this the theme used on this website. There are snippets out there to try to resolve legacy browser issues, but all of them are half-baked and missing basic functionality such as proper feature-detection and the ability to remove an event listener. All of these issues seems simple, but are actually quite complex to implement properly, and without memory leaks.

We can do better! That’s why I created this library.

Continue reading

WordPress Revisional Metabox Library Now Available

Revisional metaboxes in WordPress made easy.

Today, I present to you WordPress Revisional Metabox, a WordPress PHP library to make revisional metaboxes dead-simple, released as open-source on GitHub. This library is even easier to use than the usual procedural methods for registering custom metaboxes, so I have provided an option to disable revisions on a metabox in case revisions are not appropriate for all your metaboxes.

WordPress 2.6 introduced post revisions for the editor so that authors could save revisions of their content. While this feature has been great for storing revisions of the built-in post title, content, and excerpt fields, it was not very flexible for use by developers to store other data.

In WordPress 4.1, the necessary actions and filters were added to facilitate custom metabox revisions, so that developers can hook into this new functionality, but unfortunately the feature remains prohibitively difficult to use.

That is, unless you use this class to abstract away all the difficulties.

Now WordPress developers can use this amazing functionality for their own projects with ease, and improve the user experience for all.

jQuery ajaxreadystate plugin

Today I’ve released a new open source library, so I figured what better time to post a new entry in my blog.

My latest open source contribution to the world is jquery-ajaxreadystate, a jQuery plugin which adds a new AJAX function with readystatechange capabilities, available for download on GitHub, NPM, and Bower.

The jQuery AJAX implementation is somewhat limited in that it does not provide a way of responding to the readystatechange events that fire during the AJAX request. The jQuery.ajax API documentation actually states the following.

No onreadystatechange mechanism is provided, however, since done, fail, always, and statusCode cover all conceivable requirements.

While this statement is true for most use cases, what if you want to access the response headers or status code before the entire request completes, or access the response body as it streams?

Evidently jQuery does not provide this functionality due to browser compatibility issues, so this plugin adds this extra functionality for browsers that support these features (see compatibility notes below).

This plugin works by adding a new method jQuery.ajaxreadystate method, which acts as a wrapper for jQuery.ajax, extending the functionality and updating the jqXHR object to remove the limitations and update properties as the readyState changes.