You can just pass this function directly into wgAfterContentAndJS.push, no need to define it.