Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/11/2012, 19:23
Mancit0
 
Fecha de Ingreso: noviembre-2012
Ubicación: San Salvador
Mensajes: 1
Antigüedad: 11 años, 6 meses
Puntos: 0
No encuentro error en codigo jquery

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
  1. ;(function($){
  2.     $.fn.youtubeChannel = function(settings) {
  3.         var version = {major:0,minor:4,build:5},
  4.             $ytEl   = $(this),
  5.             $ytList = $('<ul/>',{class:'yt-channel-list'});
  6.             options = $.extend({}, {username:'',query:'',startIndex:1,maxResults:10,orderBy:'published'}, settings),
  7.             videos  = [],
  8.             // accessory functions
  9.             getTitle    = function() {
  10.                 if (options.username!=='') {
  11.                     return ['<a href="http://www.youtube.com/user/',,'" target="_blank">',,'</a>'].join('');
  12.                 }
  13.                 else if (options.query!=='') {
  14.                     return ['<a href="http://www.youtube.com/results?',encodeURIComponent(options.query),'&aq=f" target="_blank">&quot;',options.query,'&quot;</a>'].join('');
  15.                 }
  16.                 else {
  17.                     return '<a href="http://www.youtube.com/" target="_blank">YouTube</a>';
  18.                 }
  19.             },
  20.             getVersion  = function() {
  21.                 return [version.major,version.minor,version.build].join('.');
  22.             },
  23.             buildUrl    = function() {
  24.                 var base    = 'https://gdata.youtube.com/feeds/api/videos',
  25.                     params  = ['alt=json','orderby='+options.orderBy,'start-index='+options.startIndex,'max-results='+options.maxResults];
  26.                 if (options.username!=='') {
  27.                     params.push('author='+options.username);
  28.                 }
  29.                 else if (options.query!=='') {
  30.                     params.push('q='+encodeURIComponent(options.query));
  31.                 }
  32.                 params.push('callback=?');
  33.                 return base+'?'+params.join('&');
  34.             },
  35.             parseTime   = function(secs) {
  36.                 var m,s = parseInt(secs,10);
  37.                 m = Math.floor(s / 60);
  38.                 s -= (m * 60);
  39.                 return m+':'+s;
  40.             };
  41.         // setup the html
  42.         $ytEl.addClass('yt-channel-holder');
  43.         $ytList.appendTo($ytEl);
  44.         // parse the feed
  45.         $.getJSON(buildUrl(),function(data) {
  46.             var html, vid, e, length;
  47.             // add the header
  48.             $('<li/>',{class:'yt-channel-title'}).html(getTitle()).appendTo($ytList);
  49.             if (data.feed.entry) {
  50.                 length = data.feed.entry.length;
  51.                 // add the items
  52.                 for (var i=0; i<length; i++) {
  53.                     e = data.feed.entry[i];
  54.                     vid     = {
  55.                         link:       (e ? e.media$group.media$player[0].url : ''),
  56.                         title:      (e ? e.media$group.media$title.$t : ''),
  57.                         thumb:      (e ? e.media$group.media$thumbnail[1].url : ''),
  58.                         duration:   (e ? e.media$group.yt$duration.seconds : 0),
  59.                         views:      (e && e.yt$statistics ? e.yt$statistics.viewCount : 0)
  60.                     };
  61.                     html    = $('<li/>',{class:'yt-channel-video'})
  62.                             .html([
  63.                                 '<a target="_blank" href="',vid.link,'">',
  64.                                     '<span class="thumb-wrap">',
  65.                                         '<img class="vid-thumb" alt="',vid.title,'" src="',vid.thumb,'"/>',
  66.                                         '<span class="vid-duration">',parseTime(vid.duration),'</span>',
  67.                                     '</span>',
  68.                                     '<div class="vid-details">',
  69.                                         '<span class="vid-title">',vid.title,'</span>',
  70.                                         '<span class="vid-views">',vid.views,' views</span>',
  71.                                     '</div>',
  72.                                 '</a>'
  73.                             ].join(''));
  74.                     videos.push(vid);
  75.                     html.appendTo($ytList);
  76.                 }
  77.             } else {
  78.                 $('<li/>',{class:'yt-channel-video'})
  79.                     .html('<a>NO RESULTS</a>').appendTo($ytList);
  80.             }
  81.             // finally add the copyright notice
  82.             //$('<li/>',{class:'yt-channel-copy'}).html('v'+getVersion()+' &copy; dharyk 2011').appendTo($ytList);
  83.         });
  84.         return this;
  85.     };
  86. })(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
  1. <!DOCTYPE html>
  2.     <title>(jQuery)</title>
  3.     <link rel="stylesheet" href="jquery.youtubeChannel.css" />
  4.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
  5.     <script src="jquery.youtubeChannel.js"></script>
  6. </head>
  7.     <h1></h1>
  8.     <div id="youtube-channel"></div>
  9.     <script>
  10.     $(function() {
  11.         $('#youtube-channel').youtubeChannel({
  12.             username: 'murrasaca',
  13.             startIndex: 1,
  14.             maxResults: 10,
  15.             orderBy: 'published'
  16.         });
  17.     });
  18.     </script>
  19. </body>
  20. </html>