Template:YouTubeWithCommonsFallback: Difference between revisions

From Donate
Jump to navigation Jump to search
Content deleted Content added
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 40: Line 40:
</div><!-- /video-wrapper -->
</div><!-- /video-wrapper -->
<div class="video-caption" style="text-align:center;">
<div class="video-caption" style="text-align:center;">
<p></html>This video hosted by YouTube.com is subject to its [https://www.youtube.com/t/terms Terms of Use] and [https://www.google.com/intl/en/policies/privacy/ Privacy Policy]. If you prefer, <span id="showcommonsvideo">[{{fullurl:commons:{{{commons|File:The_Impact_Of_Wikipedia.webm}}}}} view on Wikimedia Commons].</span><html></p>
</html>{{#if:{{{caption|}}}|<p>{{{caption}}}</p>}}<html>
<p></html>This video hosted by YouTube.com is subject to its [https://www.youtube.com/t/terms Terms of Use] and [https://www.google.com/intl/en/policies/privacy/ Privacy Policy]. If you prefer, <span id="showcommonsvideo">[{{fullurl:commons:{{{commons|File:The_Impact_Of_Wikipedia.webm}}}}} view on Wikimedia Commons].<html></p>
</div>
</div>
</div><!-- /video-outer-wrapper -->
</div><!-- /video-outer-wrapper -->
<script>
<script>
var videoTemplate = {};
function inlineScriptWhenReady() {
/* Wrapper function so waits until jQuery ready - see MediaWiki:Common.js */


videoTemplate.showCommonsVideo = function() {
$('.video-youtube').remove();
$('.video-placeholder').css('display', 'none');
$('.video-commons').css('display', 'block');
};

videoTemplate.main = function() {
$(".video-placeholder").click(function () {
$(".video-placeholder").click(function () {
$(this).replaceWith(
$(this).replaceWith(
Line 64: Line 69:
$("#showcommonsvideo a").click(function(event){
$("#showcommonsvideo a").click(function(event){
event.preventDefault();
event.preventDefault();
showCommonsVideo();
videoTemplate.showCommonsVideo();
});
});


if( mw.util.getParamValue( "commons" ) == "true" ){
if( mw.util.getParamValue( "commons" ) == "true" ){
showCommonsVideo();
videoTemplate.showCommonsVideo();
}
}
}
};


videoTemplate.runWhenReady = function() {
function showCommonsVideo() {
if ( window.$ ) { // is jquery loaded yet?
$('.video-youtube').remove();
videoTemplate.main();
$('.video-placeholder').css('display', 'none');
} else {
$('.video-commons').css('display', 'block');
window.setTimeout( videoTemplate.runWhenReady, 200 );
}
}
};

videoTemplate.runWhenReady();
</script>
</script>
</html><noinclude><pre>{{YouTubeWithCommonsFallback
</html><noinclude><pre>{{YouTubeWithCommonsFallback
Line 82: Line 91:
| youtube = 3Knv6D6Thi0
| youtube = 3Knv6D6Thi0
| commons = File:The_Impact_Of_Wikipedia.webm
| commons = File:The_Impact_Of_Wikipedia.webm
| caption = Caption
| width = 640
| width = 640
}}</pre></noinclude>
}}</pre>
[[Category:Utility templates]]</noinclude>

Latest revision as of 14:57, 27 February 2019

This video hosted by YouTube.com is subject to its Terms of Use and Privacy Policy. If you prefer, view on Wikimedia Commons.

{{YouTubeWithCommonsFallback
| placeholder = Wikipedia_Puzzle_Globe.jpg
| youtube     = 3Knv6D6Thi0
| commons     = File:The_Impact_Of_Wikipedia.webm
| width       = 640
}}