Add amd support, getCookie function and return $$