convert scripts in jquery plugin