MDL-10405 Adding the javascript part of the patch