Is it possible to apply for a Hong Kong Visa from the Hong Kong Embassy in Jakarta while I am staying in Indonesia on a visitors visa? Or do I have to go to my home country to apply for the visa directly from the Hong Kong embassy?
Rules on the residence requirements vary between the competent authorities of a given country. That being said, most require you to apply for visas from your country of legal residence. This generally prevents visitors from applying while on vacation, UNLESS you can prove to them that it is an extraordinary circumstance.
All in all, you'll likely have to apply when you get back home.