Hide topics row in Postbox message view

I love Postbox. I talk about it a lot. However Postbox is trying to be more than a mail client and as part of that is attempting to sneak into the world of GTD with the inclusion of todos and topics.

Now call me old fashioned but I use Things for my GTD stuff and so don’t use todos or topics in Postbox.

“Not a problem really is it?” I hear you yell. Well no until you look at the amount of space the topic row of Message View takes up. Believe me on a small screen this matters:
Continue Reading… »

Fancybox left and right key problem

When you use fancybox, it automatically adds listeners which stop any other use of the Esc, Left and Right keys on your keyboard. The just don’t work in forms etc inside Fancybox.

This isn’t such an issue with the escape key, but not being able to use the left and right, for example in text inputs, is a pain.

The changes below add an additional option to Fancybox called useNextPrev which you can set to false to stop Fancybox adding listeners to these keys. I haven’t included the escape key as I think it’s far less of an issue. Continue Reading… »

Pimping Fancybox jQuery Lightbox

I love fancybox. It’s a great and flexible jQuery lightbox, but I decided there were a couple of things I needed it to do that it doesn’t, so I dived into the code head first and added a couple of features. Be warned that you need to edit the file jquery.fancybox-1.3.1.js to implement them.

Combined add and fire / show / open
Yes I know you can do this with $.fancybox(content, options)

It’s tough to add the fancybox listener and fire it at the same time, for example onclick or using a live event. That annoyed me in some circumstances. Previously I have resorted to adding fancybox to anchors on hover so it could fire onclick: Continue Reading… »

MySQL Toggle a Fields Value

UPDATE `table_name`
SET `field_name` = (SELECT CASE `field_name` WHEN 1 THEN 0 ELSE 1 END)
WHERE `id_column` = 1

Or with text strings

UPDATE `table_name`
SET `field_name` = (SELECT CASE `field_name` WHEN 'foo' THEN 'bar' ELSE 'foo' END)
WHERE `id_column` = 1

Validation of html within inline javascript

If you are finding you need to use javascript inside an html or xhtml file and it won’t validate, then here is a little tip for you.

If you surround all your javascript with <![CDATA[ and ]]> tags, all will come good.

The CDATA is seen by the validator as data which doesn’t need checking. So this:

<script>
document.getElementById('container').innerHTML('<p>hello</p>');
</script>

becomes this:

<script>
<![CDATA[
document.getElementById('container').innerHTML('<p>hello</p>');
]]>
</script>

Another option is to escape < and > characters server-side / in the file and then unescape with javascript

<script>
document.getElementById('container').innerHTML('&lt;p&gt;hello&lt;/p&gt;'.replace('/&lt;/','<').replace('/&gt;/','>'));
</script>