Saludos colegas.
Tengo un problema similar, desde el IE me da el siguiente error...
Mensaje: Se esperaba un identificador, una cadena o un número
Línea: 5
Carácter: 25
Código: 0
Código Javascript
:
Ver original;(function($){
$.fn.youtubeChannel = function(settings) {
var version = {major:0,minor:4,build:5},
$ytEl = $(this),
$ytList = $('<ul/>',{class:'yt-channel-list'});
options = $.extend({}, {username:'',query:'',startIndex:1,maxResults:10,orderBy:'published'}, settings),
videos = [],
// accessory functions
getTitle = function() {
if (options.username!=='') {
return ['<a href="http://www.youtube.com/user/',,'" target="_blank">',,'</a>'].join('');
}
else if (options.query!=='') {
return ['<a href="http://www.youtube.com/results?',encodeURIComponent(options.query),'&aq=f" target="_blank">"',options.query,'"</a>'].join('');
}
else {
return '<a href="http://www.youtube.com/" target="_blank">YouTube</a>';
}
},
getVersion = function() {
return [version.major,version.minor,version.build].join('.');
},
buildUrl = function() {
var base = 'https://gdata.youtube.com/feeds/api/videos',
params = ['alt=json','orderby='+options.orderBy,'start-index='+options.startIndex,'max-results='+options.maxResults];
if (options.username!=='') {
params.push('author='+options.username);
}
else if (options.query!=='') {
params.push('q='+encodeURIComponent(options.query));
}
params.push('callback=?');
return base+'?'+params.join('&');
},
parseTime = function(secs) {
var m,s = parseInt(secs,10);
m = Math.floor(s / 60);
s -= (m * 60);
return m+':'+s;
};
// setup the html
$ytEl.addClass('yt-channel-holder');
$ytList.appendTo($ytEl);
// parse the feed
$.getJSON(buildUrl(),function(data) {
var html, vid, e, length;
// add the header
$('<li/>',{class:'yt-channel-title'}).html(getTitle()).appendTo($ytList);
if (data.feed.entry) {
length = data.feed.entry.length;
// add the items
for (var i=0; i<length; i++) {
e = data.feed.entry[i];
vid = {
link: (e ? e.media$group.media$player[0].url : ''),
title: (e ? e.media$group.media$title.$t : ''),
thumb: (e ? e.media$group.media$thumbnail[1].url : ''),
duration: (e ? e.media$group.yt$duration.seconds : 0),
views: (e && e.yt$statistics ? e.yt$statistics.viewCount : 0)
};
html = $('<li/>',{class:'yt-channel-video'})
.html([
'<a target="_blank" href="',vid.link,'">',
'<span class="thumb-wrap">',
'<img class="vid-thumb" alt="',vid.title,'" src="',vid.thumb,'"/>',
'<span class="vid-duration">',parseTime(vid.duration),'</span>',
'</span>',
'<div class="vid-details">',
'<span class="vid-title">',vid.title,'</span>',
'<span class="vid-views">',vid.views,' views</span>',
'</div>',
'</a>'
].join(''));
videos.push(vid);
html.appendTo($ytList);
}
} else {
$('<li/>',{class:'yt-channel-video'})
.html('<a>NO RESULTS</a>').appendTo($ytList);
}
// finally add the copyright notice
//$('<li/>',{class:'yt-channel-copy'}).html('v'+getVersion()+' © dharyk 2011').appendTo($ytList);
});
return this;
};
})(jQuery);
Y cuando hago el llamado de la función, me da al siguiente error.
Detalles de error de página web
Mensaje: El objeto no acepta esta propiedad o método
Línea: 14
Carácter: 3
Código HTML:
Ver original<!DOCTYPE html>
<link rel="stylesheet" href="jquery.youtubeChannel.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <div id="youtube-channel"></div> $(function() {
$('#youtube-channel').youtubeChannel({
username: 'murrasaca',
startIndex: 1,
maxResults: 10,
orderBy: 'published'
});
});