Viewing 1 post (of 1 total)
-
AuthorPosts
-
09/04/2015 at 7:28 pm #16257my addKeymaster
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("<ul>");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=="alternate"){posturl_gal=i.link[u].href;break}}if("content"in i){var f=i.content.$t}s=f;a=s.indexOf("<img");b=s.indexOf('src="',a);c=s.indexOf('"',b+5);d=s.substr(b+5,c-b-5);if(a!=-1&&b!=-1&&c!=-1&&d!=""){var l=d}else var l="http://i1133.photobucket.com/albums/m596/abu-farhan/Images_no_image.gif";document.write('<li><div id="slide-container"><span class="slide-desc"><h2 style="margin:10px 0px;">');document.write(o+"</h2>");var h=/<\S[^>]*>/g;f=f.replace(h,"");if(showpostsummary_gal==true){if(f.length<numchars_gal){document.write(f);document.write("</span>")}else{f=f.substring(0,numchars_gal);var p=f.lastIndexOf(" ");f=f.substring(0,p);document.write(f+"...");document.write("</span>")}}document.write('<a href="'+posturl_gal+'"><img src="'+l+'" width="480px" height="360"/></a></div>');document.write("</li>")}document.write("</ul>")}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="label_with_thumbs2">');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=="replies"&&n.link[o].type=="text/html"){var u=n.link[o].title;var f=n.link[o].href}if(n.link[o].rel=="alternate"){i=n.link[o].href;break}}var l;try{l="media$thumbnail"in n[t]?n[t].media$thumbnail.url:pblank}catch(h){s=n.content.$t;a=s.indexOf("<img");b=s.indexOf('src="',a);c=s.indexOf('"',b+5);d=s.substr(b+5,c-b-5);if(a!=-1&&b!=-1&&c!=-1&&d!=""){l=d}else l="http://www11.0zz0.com/2011/12/05/21/513081769.gif"}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]="Jan";y[2]="Feb";y[3]="Mar";y[4]="Apr";y[5]="May";y[6]="Jun";y[7]="Jul";y[8]="Aug";y[9]="Sep";y[10]="Oct";y[11]="Nov";y[12]="Dec";document.write('<div class="clearfix">');if(showpostthumbnails==true)document.write('<a href="'+i+'" target ="_top"><img class="label_thumb" src="'+l.replace(/s1600/g,"s297")+'" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></a>');document.write('<a href="'+i+'" target ="_top">'+r+"</a><br><span/>");if("content"in n){var w=n.content.$t}else if("summary"in n){var w=n.summary.$t}else var w="";var E=/<\S[^>]*>/g;w=w.replace(E,"");if(showpostsummary==true){if(w.length<numchars){document.write("");document.write(w);document.write("")}else{document.write("");w=w.substring(0,numchars);var S=w.lastIndexOf(" ");w=w.substring(0,S);document.write(w+"...");document.write("")}}var x="";var T=0;document.write("<br>");if(showpostdate==true){x=x+y[parseInt(m,10)]+"-"+g+" - "+v;T=1}if(showcommentnum==true){if(T==1){x=x+" | "}if(u=="1 Comments")u="1 Comment";if(u=="0 Comments")u="No Comments";u='<a href="'+f+'" target ="_top">'+u+"</a>";x=x+u;T=1;}if(displaymore==true){if(T==1)x=x+" | ";x=x+'<a href="'+i+'" class="url" target ="_top">More »</a>';T=1;}document.write(x);document.write("</div>");if(displayseparator==true)if(t!=numposts-1)document.write("")}document.write("</div>")}
exmpl to change this script to automatic show this thumbnail
http://img.youtube.com/vi/G081hD0nwWE/hqdefault.jpg
for this videoand etc,
-
AuthorPosts
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.