Thread:Project:Support desk/Can JavaScript be used on a wiki page in order to access the YouTube API?

MediaWiki: 1.16.5 PHP: 5.2.12-pl0-gentoo (apache2handler) MySQL: 5.0.84-log URL: http://www.xmswiki.com/xms/GMS:Videos

I am creating a page on my wiki that lists tutorial videos available on YouTube. I would like the length (duration) of each video displayed next to the link. I could do this manually for each video, but these videos might change and it would be nice if the duration info was dynamic. My searching seems to suggest that the duration can be obtained using the YouTube API and some JavaScript or PHP code, but I don't think you can just put JavaScript on a wiki page like you might on a non-wiki web page.

Or can you?

I only do basic wiki editing and know next to nothing about JavaScript, but some Googling makes me think that the JavaScript would be something like:

 function youtubeFeedCallback( data ) {   document.writeln( 'Duration: ' + Math.floor( data.entry[ "media$group" ][ "yt$duration" ].seconds / 60 ) + ':' + ( data.entry[ "media$group" ][ "yt$duration" ].seconds % 60 ) + ' (' + data.entry[ "media$group" ][ "yt$duration" ].seconds + ' seconds) ' ); } 