Y por ultimo el archivo javascript que lo he modificado. cambiando etiquetas html.
Nota: También aquí he tenido que cambiar las 3 w y el protocolo por asteriscos.
Código javascript
:
Ver original//-------------------------------------------------
// youtube playlist jquery plugin
// ***.geckonewmedia.com
//-------------------------------------------------
jQuery.fn.ytplaylist = function(options) {
// default settings
var options = jQuery.extend( {
holderId: 'video',
playerHeight: '400',
playerWidth: '500',
addThumbs: false,
thumbSize: 'small',
showInline: false,
autoPlay: true,
showRelated: false // true
},options);
return this.each(function() {
var selector = $(this);
var autoPlay = "";
var showRelated = "&rel=0";
if(options.autoPlay) autoPlay = "&autoplay=1";
if(options.showRelated) showRelated = "&rel=0";
//throw a youtube player in
function play(id)
{
var html = '';
html += '<object height="'+options.playerHeight+'" width="'+options.playerWidth+'">';
html += '<param name="movie" value="****://***.youtube.com/v/'+id+autoPlay+showRelated+'"></param>';
html += '<param name="wmode" value="transparent"></param>';
html += '<embed src="****://***.youtube.com/v/'+id+autoPlay+showRelated+'" type="application/x-shockwave-flash" wmode="transparent" height="'+options.playerHeight+'" width="'+options.playerWidth+'"></embed>';
html += '</object>';
return html;
};
//grab a youtube id from a (clean, no querystring)
function youtubeid(url) {
var ytid = url.match("[\\?&]v=([^&#]*)");
ytid = ytid[1];
return ytid;
};
//load inital video
var firstVid = selector.children("p:first-child").addClass("currentvideo").children("a").attr("href");
$("#"+options.holderId+"").html(play(youtubeid(firstVid)));
//load video on request
selector.children("p").children("a").click(function() {
if(options.showInline) {
$("div.currentvideo").removeClass("currentvideo");
$(this).parent("div").addClass("currentvideo").html(play(youtubeid($(this).attr("href"))));
}
else {
$("#"+options.holderId+"").html(play(youtubeid($(this).attr("href"))));
$(this).parent().parent("div").find("div.currentvideo").removeClass("currentvideo");
$(this).parent("div").addClass("currentvideo");
}
return false;
});
// jQuery Youtube plugin - jYouTube
if(options.addThumbs) {
selector.children().each(function(i){
var replacedText = $(this).text();
if(options.thumbSize == 'small') {
var thumbUrl = "****://img.youtube.com/vi/"+youtubeid($(this).children("a").attr("href"))+"/2.jpg";
}
else {
var thumbUrl = "****://img.youtube.com/vi/"+youtubeid($(this).children("a").attr("href"))+"/0.jpg";
}
$(this).children("a").empty().html("<img src='"+thumbUrl+"' alt='"+replacedText+"' />"+replacedText).attr("title", replacedText);
});
}
});
};