Skip to content

{ Monthly Archives } September 2013

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 […]

Fun with ::before and ::after

I've noted in the past that the CSS pseudoelements represent inserted content in the element (i.e. span::before refers to a virtual element inserted within the <span> before the rest of its contents, not to content that is inserted before the <span> itself. That makes it useful for things like decorative guillemets for next and prev […]

Using <blockquote>

Typography Butterick has a few rules for block quotations: Reduce the point size and line spacing slightly, and indent the text block be­tween half an inch and a full inch on the left side, and op­tion­al­ly the same on the right. Since I'm using both Hebrew and English quotes, I'll indent on both sides. Rather […]