am 698fff02: add style and script to play videos in a shadowbox anytime that a link appears in the page with class "video-shadowbox-button" the link must also have the youtube video set in the href with the ?v parameter
* commit '698fff028ab6e58c45c7356922beaa7c6a2e9006': add style and script to play videos in a shadowbox anytime that a link appears in the page with class "video-shadowbox-button" the link must also have the youtube video set in the href with the ?v parameter
|
@ -6955,30 +6955,67 @@ a.landing-button:visited {
|
|||
}
|
||||
|
||||
#video-frame {
|
||||
width:940px;
|
||||
height:526.4px;
|
||||
margin:80px auto 0;
|
||||
width:948px;
|
||||
height:529px;
|
||||
margin:32px auto 0;
|
||||
display:none;
|
||||
}
|
||||
|
||||
.video-close {
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
left: 940px;
|
||||
top: 0;
|
||||
pointer-events: all;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
left: 948px;
|
||||
top: -8px;
|
||||
pointer-events: all;
|
||||
}
|
||||
|
||||
#icon-video-close {
|
||||
background-image: url("../images/close.png");
|
||||
background-position: 0 0;
|
||||
height: 36px;
|
||||
width: 36px;
|
||||
display:block;
|
||||
background-image: url("../images/close-white.png");
|
||||
background-image: -webkit-image-set(url(../images/close-white.png) 1x, url(../images/close-white_2x.png) 2x);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
background-size: 36px 36px;
|
||||
height: 36px;
|
||||
width: 36px;
|
||||
display:block;
|
||||
}
|
||||
|
||||
#icon-video-close:hover {
|
||||
background-image: url("../images/close-grey.png");
|
||||
background-image: -webkit-image-set(url(../images/close-grey.png) 1x, url(../images/close-grey_2x.png) 2x);
|
||||
}
|
||||
|
||||
/* Preload the hover images */
|
||||
a.video-shadowbox-button.white:after {
|
||||
display:none;
|
||||
content:url("../images/close-grey.png") url("../images/close-grey_2x.png");
|
||||
}
|
||||
|
||||
a.video-shadowbox-button.white {
|
||||
background-image: url("../images/play-circle-white.png");
|
||||
background-image: -webkit-image-set(url(../images/play-circle-white.png) 1x, url(../images/play-circle-white_2x.png) 2x);
|
||||
background-size: 36px 36px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: right;
|
||||
padding: 16px 42px 16px 8px;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
line-height: 24px;
|
||||
color: #fff;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
a.video-shadowbox-button.white:hover {
|
||||
color:#bababa !important;
|
||||
background-image: url("../images/play-circle-grey.png");
|
||||
background-image: -webkit-image-set(url(../images/play-circle-grey.png) 1x, url(../images/play-circle-grey_2x.png) 2x);
|
||||
}
|
||||
|
||||
/* Preload the hover images */
|
||||
a.video-shadowbox-button.white:after {
|
||||
display:none;
|
||||
content:url("../images/play-circle-grey.png") url("../images/play-circle-grey_2x.png");
|
||||
}
|
||||
|
||||
/******************
|
||||
Styles for d.a.c/index:
|
||||
|
|
After Width: | Height: | Size: 379 B |
After Width: | Height: | Size: 830 B |
After Width: | Height: | Size: 292 B |
After Width: | Height: | Size: 586 B |
After Width: | Height: | Size: 880 B |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 670 B |
After Width: | Height: | Size: 1.7 KiB |
|
@ -20,7 +20,7 @@ $.ajaxSetup({
|
|||
/****** ON LOAD SET UP STUFF *********/
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
// show lang dialog if the URL includes /intl/
|
||||
//if (location.pathname.substring(0,6) == "/intl/") {
|
||||
// var lang = location.pathname.split('/')[2];
|
||||
|
@ -558,10 +558,74 @@ false; // navigate across topic boundaries only in design docs
|
|||
cookiePath = "distribute_";
|
||||
}
|
||||
|
||||
|
||||
/* setup shadowbox for any videos that want it */
|
||||
var $videoLinks = $("a.video-shadowbox-button");
|
||||
if ($videoLinks.length) {
|
||||
// if there's at least one, add the shadowbox HTML to the body
|
||||
$('body').prepend(
|
||||
'<div id="video-container">'+
|
||||
'<div id="video-frame">'+
|
||||
'<div class="video-close">'+
|
||||
'<span id="icon-video-close" onclick="closeVideo()"> </span>'+
|
||||
'</div>'+
|
||||
'<div id="youTubePlayer"></div>'+
|
||||
'</div>'+
|
||||
'</div>');
|
||||
|
||||
// loads the IFrame Player API code asynchronously.
|
||||
$.getScript("https://www.youtube.com/iframe_api");
|
||||
|
||||
$videoLinks.each(function() {
|
||||
var videoId = $(this).attr('href').split('?v=')[1];
|
||||
$(this).click(function(event) {
|
||||
event.preventDefault();
|
||||
startYouTubePlayer(videoId);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
// END of the onload event
|
||||
|
||||
|
||||
var youTubePlayer;
|
||||
function onYouTubeIframeAPIReady() {
|
||||
}
|
||||
|
||||
function startYouTubePlayer(videoId) {
|
||||
if (youTubePlayer == null) {
|
||||
youTubePlayer = new YT.Player('youTubePlayer', {
|
||||
height: '529',
|
||||
width: '940',
|
||||
videoId: videoId,
|
||||
events: {
|
||||
'onReady': onPlayerReady
|
||||
}
|
||||
});
|
||||
} else {
|
||||
youTubePlayer.playVideo();
|
||||
}
|
||||
$("#video-container").fadeIn(200, function(){$("#video-frame").show()});
|
||||
}
|
||||
|
||||
function onPlayerReady(event) {
|
||||
event.target.playVideo();
|
||||
}
|
||||
|
||||
function closeVideo() {
|
||||
try {
|
||||
youTubePlayer.stopVideo();
|
||||
$("#video-container").fadeOut(200);
|
||||
} catch(e) {
|
||||
console.log('Video not available');
|
||||
$("#video-container").fadeOut(200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function initExpandableNavItems(rootTag) {
|
||||
$(rootTag + ' li.nav-section .nav-section-header').click(function() {
|
||||
var section = $(this).closest('li.nav-section');
|
||||
|
|