Revision 85848 of "Template:FR2012/Video" on foundationwiki

<html>
<div class="thumb tright">
<div class="commons-video" style="display:none;">
</html>[[{{{commons|File:The_Impact_Of_Wikipedia.webm}}}|{{{width|400}}}px]]<html>
</div>
<div class="thumbinner" style="width:</html>{{#expr: {{{width|400}}}+2 }}<html>px;">
<img id="video2012" alt="" src="</html>{{filepath:{{{placeholder|Wikipedia_Puzzle_Globe.jpg}}}|{{{width|400}}}}}<html>" width="</html>{{{width|400}}}<html>" class="thumbimage">
<div class="thumbcaption" style="text-align:center;"><p>This video is hosted by <a class="external text" href="//youtube.com">YouTube.com</a> subject to its <a class="external text" href="//www.youtube.com/t/terms">Terms of Use</a> and <a class="external text" href="//www.google.com/intl/en/policies/privacy/">Privacy Policy</a>. If you prefer, <a id="showcommonsvideo" onclick="return false;" href="">view on Wikimedia Commons</a>.</p></div>
</div>
</div>

<script type='text/javascript'>
mw.setConfig( 'EmbedPlayer.RewriteSelector', null );
//$("div.commons-video").css('display', 'none');

var playerW = parseInt('</html>{{{width|400}}}<html>');
var playerH = playerW * 0.5625; //aspect ratio

$("#video2012").click(function () {
    $(this).replaceWith(
        $("<iframe></iframe>", {
            id : "youtube-video",
            width : playerW,
            height : playerH,
            frameborder : 0,
            allowfullscreen : 1,
            cc_load_policy : 1,
            show_info : 0,
            enablejsapi : 1,
            src : "https://www.youtube-nocookie.com/embed/" + "</html>{{{youtube|3Knv6D6Thi0}}}<html>" + "?rel=0&autoplay=1&origin=wikimediafoundation.org&theme=light&modestbranding=1&color=white"
        })
    );
});

$("a#showcommonsvideo").click(function(event){
    event.preventDefault();
    $("div.thumbinner").css('display', 'none');
    $("div.commons-video").css('display', 'block');
    $('#mwe_player_0').embedPlayer(function(){
        // play the video once ready:
        $('#mwe_player_0')[0].play();
    });
});
</script>
</html>