Tagged: ,

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #16257
    my add
    Keymaster

    Hello. I have a website where I post videos. I want a template automatically displays a thumbnail for the YouTube video that I posted on the website. This feature has many templates, but not that I like. In my favorite template code looks like this:

    function showgalleryposts(e){var t=e.feed.openSearch$totalResults.$t;var n=new Array;document.write(&quot;<ul>&quot;);for(var r=0;r<t;++r){n[r]=r}if(random_posts==true){n.sort(function(){return.5-Math.random()})}if(numposts_gal>t){numposts_gal=t}for(r=0;r<numposts_gal;++r){var i=e.feed.entry[n[r]];var o=i.title.$t;for(var u=0;u<i.link.length;u++){if(i.link[u].rel==&quot;alternate&quot;){posturl_gal=i.link[u].href;break}}if(&quot;content&quot;in i){var f=i.content.$t}s=f;a=s.indexOf(&quot;<img&quot;);b=s.indexOf('src=&quot;',a);c=s.indexOf('&quot;',b+5);d=s.substr(b+5,c-b-5);if(a!=-1&&b!=-1&&c!=-1&&d!=&quot;&quot;){var l=d}else var l=&quot;http://i1133.photobucket.com/albums/m596/abu-farhan/Images_no_image.gif&quot;;document.write('<li><div id=&quot;slide-container&quot;><span class=&quot;slide-desc&quot;><h2 style=&quot;margin:10px 0px;&quot;>');document.write(o+&quot;</h2>&quot;);var h=/<\S[^>]*>/g;f=f.replace(h,&quot;&quot;);if(showpostsummary_gal==true){if(f.length<numchars_gal){document.write(f);document.write(&quot;</span>&quot;)}else{f=f.substring(0,numchars_gal);var p=f.lastIndexOf(&quot; &quot;);f=f.substring(0,p);document.write(f+&quot;...&quot;);document.write(&quot;</span>&quot;)}}document.write('<a href=&quot;'+posturl_gal+'&quot;><img src=&quot;'+l+'&quot; width=&quot;480px&quot; height=&quot;360&quot;/></a></div>');document.write(&quot;</li>&quot;)}document.write(&quot;</ul>&quot;)}var showpostthumbnails_gal=true;var showpostsummary_gal=true;var random_posts=false;var numchars_gal=150;var numposts_gal=10
    

    And so

    function labelthumbs(e){document.write('<div class=&quot;label_with_thumbs2&quot;>');for(var t=0;t<numposts;t++){var n=e.feed.entry[t];var r=n.title.$t;var i;if(t==e.feed.entry.length)break;for(var o=0;o<n.link.length;o++){if(n.link[o].rel==&quot;replies&quot;&&n.link[o].type==&quot;text/html&quot;){var u=n.link[o].title;var f=n.link[o].href}if(n.link[o].rel==&quot;alternate&quot;){i=n.link[o].href;break}}var l;try{l=&quot;media$thumbnail&quot;in n[t]?n[t].media$thumbnail.url:pblank}catch(h){s=n.content.$t;a=s.indexOf(&quot;<img&quot;);b=s.indexOf('src=&quot;',a);c=s.indexOf('&quot;',b+5);d=s.substr(b+5,c-b-5);if(a!=-1&&b!=-1&&c!=-1&&d!=&quot;&quot;){l=d}else l=&quot;http://www11.0zz0.com/2011/12/05/21/513081769.gif&quot;}var p=n.published.$t;var v=p.substring(0,4);var m=p.substring(5,7);var g=p.substring(8,10);var y=new Array;y[1]=&quot;Jan&quot;;y[2]=&quot;Feb&quot;;y[3]=&quot;Mar&quot;;y[4]=&quot;Apr&quot;;y[5]=&quot;May&quot;;y[6]=&quot;Jun&quot;;y[7]=&quot;Jul&quot;;y[8]=&quot;Aug&quot;;y[9]=&quot;Sep&quot;;y[10]=&quot;Oct&quot;;y[11]=&quot;Nov&quot;;y[12]=&quot;Dec&quot;;document.write('<div class=&quot;clearfix&quot;>');if(showpostthumbnails==true)document.write('<a href=&quot;'+i+'&quot; target =&quot;_top&quot;><img class=&quot;label_thumb&quot; src=&quot;'+l.replace(/s1600/g,&quot;s297&quot;)+'&quot; width=&quot;'+img_thumb_width+'px&quot; height=&quot;'+img_thumb_height+'px&quot;/></a>');document.write('<a href=&quot;'+i+'&quot; target =&quot;_top&quot;>'+r+&quot;</a><br><span/>&quot;);if(&quot;content&quot;in n){var w=n.content.$t}else if(&quot;summary&quot;in n){var w=n.summary.$t}else var w=&quot;&quot;;var E=/<\S[^>]*>/g;w=w.replace(E,&quot;&quot;);if(showpostsummary==true){if(w.length<numchars){document.write(&quot;&quot;);document.write(w);document.write(&quot;&quot;)}else{document.write(&quot;&quot;);w=w.substring(0,numchars);var S=w.lastIndexOf(&quot; &quot;);w=w.substring(0,S);document.write(w+&quot;...&quot;);document.write(&quot;&quot;)}}var x=&quot;&quot;;var T=0;document.write(&quot;<br>&quot;);if(showpostdate==true){x=x+y[parseInt(m,10)]+&quot;-&quot;+g+&quot; - &quot;+v;T=1}if(showcommentnum==true){if(T==1){x=x+&quot; | &quot;}if(u==&quot;1 Comments&quot;)u=&quot;1 Comment&quot;;if(u==&quot;0 Comments&quot;)u=&quot;No Comments&quot;;u='<a href=&quot;'+f+'&quot; target =&quot;_top&quot;>'+u+&quot;</a>&quot;;x=x+u;T=1;}if(displaymore==true){if(T==1)x=x+&quot; | &quot;;x=x+'<a href=&quot;'+i+'&quot; class=&quot;url&quot; target =&quot;_top&quot;>More »</a>';T=1;}document.write(x);document.write(&quot;</div>&quot;);if(displayseparator==true)if(t!=numposts-1)document.write(&quot;&quot;)}document.write(&quot;</div>&quot;)}
    

    exmpl to change this script to automatic show this thumbnail
    http://img.youtube.com/vi/G081hD0nwWE/hqdefault.jpg
    for this video

    and etc,

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.