Skip to content

{ Category Archives } jQuery

Unit testing

I've finally decided to join the 21st century and use automated testing on my bililiteRange code; I'm using QUnit, with tests on github. I want to bililiteRange test on all three types of editable elements, <input type=text>, <textarea>, and <div contenteditable>, so I created a convenience function to run each test on each type of […]

New jQuery plugin, savemonitor

Playing with the kavanot editor, I wanted some way to encapsulate the process of noting that the text is "dirty"—meaning has been changed but not yet saved, and using a Promise to express the idea that the text is soon-to-be-saved, then saved. I created a plugin that simply represents a state machine with four states, […]

Update status

As promised, I have updated the status plugin to use Promises. Unfortunately, that required a small change to the parameters. Since I doubt anyone is using it, that will not likely affect anyone but me. The version is now 1.1.

New jQuery plugin, status

Updated 2015-01-19 to allow $(console).status(). Now at version 1.4. Updated 2013-12-18 to use Promises. This necessitated removing the result option and adding the returnPromise. Updated 2014-01-09 to add initialText option and to document the markup used. For the Kavanot editor I wanted to have a way to display messages (like "Text saved successfully") that would […]

New Version of keymap Hotkeys

I never really liked how my hotkeys plugin (that allows things like $('body').on('keydown', {keys: '^A'}, function() {alert ('Control-A!'); })) worked internally, and it didn't allow multiple handlers on a single element for a given key combination, and required initialization. I went back and looked at it some more, and studied John Resig's hotkeys, and came […]

Timer events for jQuery

Code and demo are on github. I wanted to have a simple word count on the Kavanot editor, and this: $('span.wordcount').text($('#editor').val().split(/\s+/).length+' words'); is enough for me. Keeping it live is straightforward: $('#editor').on('input', function(){ $('span.wordcount').text(this.value.split(/\s+/).length+' words'); }); But that won't show the word count when the page is first loaded. The ready event only works on […]

Bugfix for keymap

Turns out Firefox uses a different keycode for the ;/: key from Chrome. I thought jQuery was supposed to normalize everything across browsers! Added the correct keycodes for that key to the keymap plugin. It's now at version 1.2.

Bug fix for sendkeys

Fixed a bug where the selection was not set correctly (a regression from when I updated bililiteRange). It's now at version 2.2.

hotkeys with keymap

This post is obsolete; the $.keymap has changed significantly. Documentation is now at Inspired by John Resig's hotkeys, I created a version that uses the modern on, and uses an object rather than a string for the keys (which would be confused with a selector). It also uses my $.keymap codes. It's written as […]

New jQuery plugin, livesearch

Edited 2013-12-11 to use focusout rather than blur event Continuing my adventures in developing an online editor, I wanted to be able to do "live" searching: having the text scroll to the sought string as it is being typed. I can use my bililiteRange utilities to find an arbitrary regular expression, but after much hair-pulling, […]