twinkle.js: Move collapsible tabs logic to the right place

I think it makes more sense here, in the function that actually adds the
portlet links.