brunops
-
Intercepting jQueryUI calls
01 Dec 2012Recently I had to perform some actions before opening and before closing a dialog in a website. I had multiple dialogs throughout the website, the thing in common among them, was that all dialogs used the awesome jQueryUI dialog plugin, so I could take advantage of that..
Understanding the innards of JavaScript allows us to do some cool things. Not saying they’re should be done, or that they are the right thing to do, just saying you can :)
So.. prototypes…
Digging a bit into the jQueryUI source code, we can find the open and close dialog methods, they are responsible for showing and hiding the dialogs, respectively. Overriding their behavior, without losing any functionality is easy by simply setting them again, and calling the old method again, with all previous parameteres.
In order to be able to perform the interception successfully, we can use the call() method, more information about it can be found in Mozillas JavaScript Reference.
The idea is simple, store the old open and close methods in a variable, redefine the dialog methods, do whatever we want to and call the old method again, using the stored methods, with the same parameters and scope, keeping all functionality.
» Read full post -
utf8 MySQL database
26 Nov 2012How to create a utf8 MySQL database from the command line
» Read full post -
Drupal folder permissions on Linux
26 Nov 2012Every time after starting a new fresh install of Drupal in my Linux box I always have to set some permissions to the hierarchy structure to make it work properly.
As I always need to hunt the commands over again, I’ve decided to put everything in one place so I can easily remember.
Latest version of the code can be checked in my Gist.
» Read full post