I have some comments:

* Move all this logic to a new file (context_menu.js) or other name
* Maybe innerHTML is faster but is ugly and difficult to maintain (all shared components development in Gaia use createElement, ...)
* Perhaps you can take a look to a library developed by myself that implements the action_menu bb behavior for Telefonica (feel free to copy this to homescreen/js/components like status.js if you want).

https://github.com/telefonicaid/B2G-Utility-Libraries.JS/tree/master/components/action_menu