ASKER
//***********************************
// ShowVideo
//***********************************
function ShowVideo(sHref,sTitle)
{
$.fancybox({
'type' : 'iframe',
// hide the related video suggestions and autoplay the video
'href' : sHref.replace(new RegExp('watch\\?v=', 'i'), 'embed/') + '?rel=0&autoplay=1',
'overlayShow' : false,
'centerOnScroll' : true,
'speedIn' : 100,
'speedOut' : 50,
'width' : 640,
'height' : 480,
'titlePosition' : 'inside', // 'float', 'outside', 'inside' or 'over'
'title' : sTitle,
'swf': {'allowfullscreen':'true', 'wmode':'transparent'}
}); // $.fancybox
}
// Read a page's GET URL variables and return them as an associative array.
function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
var v = getUrlVars()["v"];
if (v.length>0){
ShowVideo(document.URL,'some title')
}
//***********************************
// CustomPageInitContent
//***********************************
function CustomPageInitContent()
{
$('a.videogallery').on('click', function(event) {
event.preventDefault();
$.fancybox({
'type' : 'iframe',
// hide the related video suggestions and autoplay the video
'href' : this.href.replace(new RegExp('watch\\?v=', 'i'), 'embed/') + '?rel=0&autoplay=1',
'overlayShow' : false,
'centerOnScroll' : true,
'speedIn' : 100,
'speedOut' : 50,
'width' : 640,
'height' : 480,
'titlePosition' : 'inside', // 'float', 'outside', 'inside' or 'over'
'title' : $(this).attr('rel'),
'swf': {'allowfullscreen':'true', 'wmode':'transparent'}
}); // $.fancybox
}); // $('a.more')
// auto invoke the video if passed in a querystring
}
ASKER
ASKER
ASKER
<script type="text/javascript">
//***********************************
// ShowVideo
//***********************************
function ShowVideo(sHref,sTitle)
{
$.fancybox({
'type' : 'iframe',
// hide the related video suggestions and autoplay the video
'href' : sHref.replace(new RegExp('watch\\?v=', 'i'), 'embed/') + '?rel=0&autoplay=1',
'overlayShow' : false,
'centerOnScroll' : true,
'speedIn' : 100,
'speedOut' : 50,
'width' : 640,
'height' : 480,
'titlePosition' : 'inside', // 'float', 'outside', 'inside' or 'over'
'title' : sTitle,
'swf': {'allowfullscreen':'true', 'wmode':'transparent'}
}); // $.fancybox
}
//***********************************
// CheckQuerystring
//***********************************
function CheckQuerystring()
{
// auto invoke the video if passed in a querystring
<?php
$sQSVideoID = strtolower(trim($_REQUEST['v']));
if (strlen($sQSVideoID)>0) {
?>
$('a.videogallery').each(function() {
var sVideoID = $(this).attr('href');
var sRel = $(this).attr('rel');
if (sVideoID.toLowerCase().indexOf('<?php echo $sQSVideoID;?>') > -1)
{
ShowVideo(sVideoID,sRel);
return false; // break out of the loop
} // if (sVideoID.toLowerCase().indexOf('<?php echo $sQSVideoID;?>') > -1)
}); // $('a.each')
<?php
} // if (strlen($sQSVideoID)>0)
?>
}
//***********************************
// CustomPageInitContent
//***********************************
function CustomPageInitContent()
{
$('a.videogallery').on('click', function(event) {
event.preventDefault();
$.fancybox({
'type' : 'iframe',
// hide the related video suggestions and autoplay the video
'href' : this.href.replace(new RegExp('watch\\?v=', 'i'), 'embed/') + '?rel=0&autoplay=1',
'overlayShow' : false,
'centerOnScroll' : true,
'speedIn' : 100,
'speedOut' : 50,
'width' : 640,
'height' : 480,
'titlePosition' : 'inside', // 'float', 'outside', 'inside' or 'over'
'title' : $(this).attr('rel'),
'swf': {'allowfullscreen':'true', 'wmode':'transparent'}
}); // $.fancybox
}); // $('a.more')
setTimeout('CheckQuerystring()',1000);
}
</script>
ASKER
ASKER
ASKER
ASKER
ASKER
jQuery (Core) is a cross-browser JavaScript library that provides abstractions for common client-side tasks such as Document Object Model (DOM) traversal, DOM manipulation, event handling, animation and Ajax. jQuery also provides a platform to create plugins that extend jQuery's capabilities beyond those already provided by the library.
TRUSTED BY
Open in new window