Check this out: https://github.com/owncloud/core/blob/master/settings/js/apps-custom.php