Template:YouTubeWithCommonsFallback: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 40:
</div><!-- /video-wrapper -->
<div class="video-caption" style="text-align:center;">
<p></html>This video hosted by YouTube.com is subject to its <a class="external text" href="[https://www.youtube.com/t/terms"> Terms of Use</a>] and <a class="external text" href="[https://www.google.com/intl/en/policies/privacy/"> Privacy Policy</a>]. If you prefer, <aspan id="showcommonsvideo" href="</html>[{{fullurl:commons:{{{commons|File:The_Impact_Of_Wikipedia.webm}}}}}<html>"> view on Wikimedia Commons].</aspan><html>.</p>
</html>{{#if:{{{caption|}}}|<p>{{{caption}}}</p>}}<html>
<p>This video hosted by YouTube.com is 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" href="</html>{{fullurl:commons:{{{commons|File:The_Impact_Of_Wikipedia.webm}}}}}<html>">view on Wikimedia Commons</a>.</p>
</div>
</div><!-- /video-outer-wrapper -->
<script>
var videoTemplate = {};
function inlineScriptWhenReady() {
/* Wrapper function so waits until jQuery ready - see MediaWiki:Common.js */
 
function videoTemplate.showCommonsVideo = function() {
$('.video-youtube').remove();
$('.video-placeholder').css('display', 'none');
$('.video-commons').css('display', 'block');
};
 
videoTemplate.main = function() {
$(".video-placeholder").click(function () {
$(this).replaceWith(
Line 62 ⟶ 67:
});
 
$("a#showcommonsvideo a").click(function(event){
event.preventDefault();
videoTemplate.showCommonsVideo();
});
 
if( mw.util.getParamValue( "commons" ) == "true" ){
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>
</html><noinclude><pre>{{YouTubeWithCommonsFallback
Line 82 ⟶ 91:
| youtube = 3Knv6D6Thi0
| commons = File:The_Impact_Of_Wikipedia.webm
| caption = Caption
| width = 640
}}</pre></noinclude>
[[Category:Utility templates]]</noinclude>