Include JavaScript just if NodeType in use

Hi Guys,

I’ve got a custom NodeType “GammaGallery” witch needs some JavaScript to run. The NodeType is capsuled in a plugin and has his own Template and Typoscript. I’d like to include the JavaScript just if the NodeType is in use in the content. Otherwise i don’t like to fill the DOM with unused Scripts. Is there a possibility to do that?

Root.ts2

prototype(TYPO3.Neos:Page) { body { javascripts.gammaGallery = TYPO3.TypoScript:Template { @position = 'end' templatePath = 'resource://Skar.GammaGallery/Private/Templates/NodeTypes/Gallery.html' sectionName = 'javascripts' } } }

Gallery.html

[code]<f:section name=“javascripts”>

</f:section>

<f:section name=“Content”>

</f:section>
[/code]

Thank’s for your help

Ben

I answered a similar question some time ago … Access page property by a content node

Feel free to ask if you still have trouble with this. Regards Martin