Skip to content

{ Monthly Archives } August 2008

Making $.metadata Extensible

With the support for HTML5 data- attributes in jQuery 1.4.3 this plugin is largely obsolete. Metadata I put the idea that the metadata plugin should be extensible out on the jquery discussion group, but it got no attention, so I'm documenting it here.

Extending jQuery UI Widgets, The Final Chapter

This page is obsolete (it uses jQuery UI 1.5). Please see the updated page. OK, this is the final update to the widget subclassing. Rather than creating a new method, $.widget.subclass, I created a single base widget $.ui.widget that does nothing but includes the Aspect-Oriented-Programming code and a subclassing method. I put everything in the [...]

The $.fn.sendkeys Plugin

This post is obsolete. Please see the updated post. The phone pad below is messed up in Internet Explorer. I know. I don't care anymore. The plugin, however, works. $('div.test input:button').click(function(){ $('.output').sendkeys($('div.test input:text').val()); }); $('.phonepad input').click(function(){ $('.output').sendkeys(this.name || this.value); }); $('.output:first').bind('keypress', function(evt){ $('#keypress').text($('#keypress').text()+' '+evt.which); }).bind('sendkeys', function(evt){ $('#sendkeys').text($('#sendkeys').text()+' '+evt.which); }); <div> <textarea class="output"></textarea> <br/> <input type="text" [...]

Testing demo insertion

I added some potentially dangerous code to automatically turn code examples (things in <code> elements with class demo into actual HTML or javascript that are added to the post. The javascript part works; I used it in the last post; here's testing the HTML insertion: <div style="background: purple; margin: 2px">This is a test</div> And more [...]

Extending jQuery UI Widgets Revisited

This page is obsolete (it uses jQuery UI 1.5). Please see the updated page. This is an updated version of a tutorial I wrote a bit back, improved thanks to conversations with Scott Gonzalez of the jQuery UI team. Thanks! Avoiding Bloat in Widgets A while back, Justin Palmer wrote an excellent article on "Avoiding [...]

Testing Chili

I like the idea of syntax coloring, so let's see if Chili works: alert('Hello, world'); and another: <div>Hello, <em>world</em></div> I'm trying to be as HTML5-compliant as possible, at least in the sense of using their standards rather than making up my own, so the Chili setup I'm using is: $.extend(ChiliBook, { automatic: false, codeLanguage: function(el){ [...]

Namespaces in jQuery

jQuery encourages using namespaces for methods in the $ namespace, like $.foo.bar() rather than $.bar(). This works for $ because methods don't expect this to refer to anything specific, and the way javascript works is to assign this to the last-named object, so in $.foo.bar(), this refers to $.foo. This idea fails for plugins, however, [...]

Extending jQuery UI Widgets

This page is obsolete (it uses jQuery UI 1.5). Please see the updated page. Avoiding Bloat in Widgets A while back, Justin Palmer wrote an excellent article on "Avoiding Bloat in Widgets." The basic premise (no suprise to anyone who's ever dealt with object-oriented programming) is that your widgets should not do everything possible; they [...]

jQuery UI Widgets

This page is obsolete (it uses jQuery UI 1.5). Please see the updated page. This was written largely to help me make sense of using UI to create my own widgets, but I hope it may help others. "Widget" to me means a user-interface element, like a button or something more complicated like a popup [...]

Testing Whether jQuery works

Unfortunately, only the administrator seems to be able to use unfiltered HTML. I also needed to use the Text Control plugin and set formatting to "No Formatting" to prevent escaping the single quotes. But it seems to work.