I got a crazy idea when I was working with some AJAX interfaces – a quick and painless jQuery undo plugin.
What does that mean? I’m not entirely sure.
(Demo)
Here’s the goal…
I want to be easily able to add a function to the undo queue. When I press the undo key combination, that function will run again and it will be placed in the redo queue:
$().undoable(function(){ $('#sample' + n).toggle(); });
This is really not ideal. While some functions toggle correctly, not all do.
What I really is to be able to define a function for undo and a function for redo:
$().undoable(function(){ $('#sample' + n).hide(); }, function(){ $('#sample' + n).show(); });
I really think I can get away with both of them.
Check out the demo and let me know what you think. (Hint: Open the Firebug console)
Not bad… but right now it seems more like a toggle rather than an undo (and the demo won’t work in IE)
Yeah, the demo just toggles the divs with one exception – console logging. If you open the Firebug console, you’ll see that it’s actually running different functions for undo and redo.
I guess I’ll need to check IE too. =)
Doesn’t work in IE because of the console.log
Doesn’t work for me!
CTRL+Z does nothing, CTRL+Y brings up the download-manager (as it should).
Environment: FF 3.0.7, Ubuntu 8.10, Keyboard German Layout
Great idea, anyway!
Ok, my fault!
I had to activate the console-tab in firebug. Now it works.