veja como se faz: "Widget de últimas postagens no blog estilo ss de jornalismoit"
Autor: edilene bds | Publicado: 2014-09-01T16:09:00-07:00



demonstração:


fonte:
templateseacessorios


Veja como se faz: "Widget de últimas postagens no blog estilo ss de jornalismoit"



"Widget de últimas postagens no blog estilo ss de jornalismoit"





..."este código o script ficará hospedado no próprio blog."Passo-a-passoVá até o "Modelo de seu blog", clique em "Editar HTML"&nbsp;






"&nbsp;Hack para o template do Blogger,&nbsp;

implementado em&nbsp;abril de 2013."














Clique no botão "Editar modelo" e&nbsp;



depois nas teclas Ctrl e F.&nbsp;



Ao abrir a janela, procure pelo seguinte trecho:



Procure por&nbsp;]]&gt;&lt;/b:skin&gt;&nbsp;



Ao encontrá-lo,



abaixo dele, cole o próximo código:



&lt;script type='text/javascript'&gt;//&lt;![CDATA[imgr=new Array();imgr[0]="http://2.bp.blogspot.com/-uitX7ROPtTU/Tyv-G4NA_uI/AAAAAAAAFBY/NcWLPVnYEnU/s1600/no+image.jpg";showRandomImg=true;aBold=true;summaryPost=150;summaryPost1=20;summaryTitle=15;numposts=6;numposts1=6;numposts2=3;numposts3=6;numposts4=5;numposts5=12;function removeHtmlTag(strx,chop){var s=strx.split("&lt;");for(var i=0;i&lt;s.length;i++){if(s[i].indexOf("&gt;")!=-1){s[i]=s[i].substring(s[i].indexOf("&gt;")+1,s[i].length)}}s=s.join("");s=s.substring(0,chop-1);return s}function showrecentposts2(json){j=(showRandomImg)?Math.floor((imgr.length+1)*Math.random()):0;img=new Array();if(numposts1&lt;=json.feed.entry.length){maxpost=numposts4}else{maxpost=json.feed.entry.length}for(var i=0;i&lt;maxpost;i++){var entry=json.feed.entry[i];var posttitle=entry.title.$t;var pcm;var posturl;if(i==json.feed.entry.length)break;for(var k=0;k&lt;entry.link.length;k++){if(entry.link[k].rel=='alternate'){posturl=entry.link[k].href;break}}for(var k=0;k&lt;entry.link.length;k++){if(entry.link[k].rel=='replies'&amp;&amp;entry.link[k].type=='text/html'){pcm=entry.link[k].title.split(" ")[0];break}}if("content"in entry){var postcontent=entry.content.$t}elseif("summary"in entry){var postcontent=entry.summary.$t}else var postcontent="";postdate=entry.published.$t;if(j&gt;imgr.length-1)j=0;img[i]="";s=postcontent;a=s.indexOf("&lt;img");b=s.indexOf("src=\"",a);c=s.indexOf("\"",b+5);d=s.substr(b+5,c-b-5);if((a!=-1)&amp;&amp;(b!=-1)&amp;&amp;(c!=-1)&amp;&amp;(d!="")){if(i==0){img[i]='&lt;img width="295" height="180" class="alignone" src="'+d+'"/&gt;'}else{img[i]='&lt;img class="alignright" height="70" src="'+d+'" width="70"/&gt;'}}var month=[1,2,3,4,5,6,7,8,9,10,11,12];var month2=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var day=postdate.split("-")[2].substring(0,2);var m=postdate.split("-")[1];var y=postdate.split("-")[0];for(var u2=0;u2&lt;month.length;u2++){if(parseInt(m)==month[u2]){m=month2[u2];break}}var daystr=day+' '+m+' '+y;if(i==0){var trtd='&lt;div class="mastoras_wide left"&gt;&lt;div class="thumb"&gt;&lt;a href="'+posturl+'"&gt;'+img[i]+'&lt;/a&gt;&lt;/div&gt;&lt;div class="featuredPost lastPost"&gt;&lt;h2 class="postTitle"&gt;&lt;a href="'+posturl+'"&gt;'+posttitle+'&lt;/a&gt;&lt;/h2&gt; &lt;p&gt;'+removeHtmlTag(postcontent,summaryPost)+'...&lt;/p&gt;&lt;div class="clear"&gt;&lt;/div&gt;&lt;span class="featuredPostMeta"&gt;&lt;a href="'+posturl+'"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="mastoras_narrow right"&gt;';&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;document.write(trtd)}if((i&gt;0)&amp;&amp;(i&lt;maxpost)){var trtd='&lt;div class="mastoras_narrow"&gt;&lt;div class="thumb"&gt;&lt;a href="'+posturl+'"&gt;'+img[i]+'&lt;/a&gt;&lt;/div&gt;&lt;div class="featuredTitle"&gt;&lt;a href="'+posturl+'"&gt;'+posttitle+'&lt;/a&gt;&lt;/div&gt;'+removeHtmlTag(postcontent,summaryPost1)+'...&lt;div class="clear"&gt;&lt;/div&gt;&lt;/div&gt;';document.write(trtd)}j++}document.write('&lt;/div&gt;')}function showrecentposts(json) { j = (showRandomImg) ? Math.floor((imgr.length+1)*Math.random()) : 0; img &nbsp;= new Array();&nbsp;&nbsp; for (var i = 0; i &lt; numposts; i++) {&nbsp; &nbsp;&nbsp; var entry = json.feed.entry[i];&nbsp; &nbsp;&nbsp; var posttitle = entry.title.$t;  var pcm;&nbsp; &nbsp;&nbsp; var posturl;&nbsp; &nbsp;&nbsp; if (i == json.feed.entry.length) break;&nbsp; &nbsp;&nbsp; for (var k = 0; k &lt; entry.link.length; k++) {&nbsp; &nbsp; &nbsp;&nbsp;  if (entry.link[k].rel == 'alternate') {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  posturl = entry.link[k].href;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  break;&nbsp; &nbsp; &nbsp;&nbsp;  }&nbsp; &nbsp;&nbsp; }    for (var k = 0; k &lt; entry.link.length; k++) {&nbsp; &nbsp; &nbsp;&nbsp;  if (entry.link[k].rel == 'replies' &amp;&amp; entry.link[k].type == 'text/html') {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  pcm = entry.link[k].title.split(" ")[0];&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  break;&nbsp; &nbsp; &nbsp;&nbsp;  }&nbsp; &nbsp;&nbsp; }  &nbsp; &nbsp;&nbsp; if ("content" in entry) {&nbsp; &nbsp; &nbsp;&nbsp;  var postcontent = entry.content.$t;}&nbsp; &nbsp;&nbsp; else&nbsp; &nbsp;&nbsp; if ("summary" in entry) {&nbsp; &nbsp; &nbsp;&nbsp;  var postcontent = entry.summary.$t;}&nbsp; &nbsp;&nbsp; else var postcontent = "";&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; postdate = entry.published.$t;  if(j&gt;imgr.length-1) j=0; img[i] = imgr[j];  s = postcontent ; a = s.indexOf("&lt;img"); b = s.indexOf("src=\"",a); c = s.indexOf("\"",b+5); d = s.substr(b+5,c-b-5); if((a!=-1)&amp;&amp;(b!=-1)&amp;&amp;(c!=-1)&amp;&amp;(d!="")) img[i] = d; //cmtext = (text != 'no') ? '&lt;i&gt;&lt;font color="'+acolor+'"&gt;('+pcm+' '+text+')&lt;/font&gt;&lt;/i&gt;' : ''; var month = [1,2,3,4,5,6,7,8,9,10,11,12]; var month2 = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; var day = postdate.split("-")[2].substring(0,2); var m = postdate.split("-")[1]; var y = postdate.split("-")[0]; for(var u2=0;u2&lt;month.length;u2++){  if(parseInt(m)==month[u2]) {   m = month2[u2] ; break;  } } var daystr = day+ ' ' + m + ' ' + y ;  var trtd = '&lt;li style="position:relative;"&gt;&lt;div class="imgauto"&gt;&lt;a href="'+posturl+'"&gt;&lt;img &nbsp;src="'+img[i]+'"/&gt;&lt;/a&gt;&lt;/div&gt;&lt;h3&gt;&lt;a href="'+posturl+'"&gt;'+posttitle+'&lt;/a&gt;&lt;p&gt;'+removeHtmlTag(postcontent,summaryPost)+'... &lt;/p&gt;&lt;/h3&gt;&lt;/li&gt;';       document.write(trtd); &nbsp; &nbsp;        &nbsp;&nbsp;j++; } }function showrecentposts1(json) { j = (showRandomImg) ? Math.floor((imgr.length+1)*Math.random()) : 0; img &nbsp;= new Array();&nbsp; &nbsp;&nbsp; for (var i = 0; i &lt; numposts; i++) {&nbsp; &nbsp;&nbsp; var entry = json.feed.entry[i];&nbsp; &nbsp;&nbsp; var posttitle = entry.title.$t;  var pcm;&nbsp; &nbsp;&nbsp; var posturl;&nbsp; &nbsp;&nbsp; if (i == json.feed.entry.length) break;&nbsp; &nbsp;&nbsp; for (var k = 0; k &lt; entry.link.length; k++) {&nbsp; &nbsp; &nbsp;&nbsp;  if (entry.link[k].rel == 'alternate') {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  posturl = entry.link[k].href;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  break;&nbsp; &nbsp; &nbsp;&nbsp;  }&nbsp; &nbsp;&nbsp; }    for (var k = 0; k &lt; entry.link.length; k++) {&nbsp; &nbsp; &nbsp;&nbsp;  if (entry.link[k].rel == 'replies' &amp;&amp; entry.link[k].type == 'text/html') {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  pcm = entry.link[k].title.split(" ")[0];&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  break;&nbsp; &nbsp; &nbsp;&nbsp;  }&nbsp; &nbsp;&nbsp; }  &nbsp; &nbsp;&nbsp; if ("content" in entry) {&nbsp; &nbsp; &nbsp;&nbsp;  var postcontent = entry.content.$t;}&nbsp; &nbsp;&nbsp; else&nbsp; &nbsp;&nbsp; if ("summary" in entry) {&nbsp; &nbsp; &nbsp;&nbsp;  var postcontent = entry.summary.$t;}&nbsp; &nbsp;&nbsp; else var postcontent = "";&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; postdate = entry.published.$t;  if(j&gt;imgr.length-1) j=0; img[i] = imgr[j];  s = postcontent ; a = s.indexOf("&lt;img"); b = s.indexOf("src=\"",a); c = s.indexOf("\"",b+5); d = s.substr(b+5,c-b-5); if((a!=-1)&amp;&amp;(b!=-1)&amp;&amp;(c!=-1)&amp;&amp;(d!="")) img[i] = d; //cmtext = (text != 'no') ? '&lt;i&gt;&lt;font color="'+acolor+'"&gt;('+pcm+' '+text+')&lt;/font&gt;&lt;/i&gt;' : ''; var month = [1,2,3,4,5,6,7,8,9,10,11,12]; var month2 = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; var day = postdate.split("-")[2].substring(0,2); var m = postdate.split("-")[1]; var y = postdate.split("-")[0]; for(var u2=0;u2&lt;month.length;u2++){  if(parseInt(m)==month[u2]) {   m = month2[u2] ; break;  } } var daystr = day+ ' ' + m + ' ' + y ;  var trtd = '&lt;li&gt;&lt;div&gt;&lt;img class="alignnone" src="'+img[i]+'"/&gt;&lt;/div&gt;&lt;/li&gt;';       document.write(trtd); &nbsp; &nbsp;        &nbsp;&nbsp;j++; } }function showrecentposts4(json) { j = (showRandomImg) ? Math.floor((imgr.length+1)*Math.random()) : 0; img &nbsp;= new Array();&nbsp; &nbsp;&nbsp; for (var i = 0; i &lt; numposts; i++) {&nbsp; &nbsp;&nbsp; var entry = json.feed.entry[i];&nbsp; &nbsp;&nbsp; var posttitle = entry.title.$t;  var pcm;&nbsp; &nbsp;&nbsp; var posturl;&nbsp; &nbsp;&nbsp; if (i == json.feed.entry.length) break;&nbsp; &nbsp;&nbsp; for (var k = 0; k &lt; entry.link.length; k++) {&nbsp; &nbsp; &nbsp;&nbsp;  if (entry.link[k].rel == 'alternate') {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  posturl = entry.link[k].href;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  break;&nbsp; &nbsp; &nbsp;&nbsp;  }&nbsp; &nbsp;&nbsp; }    for (var k = 0; k &lt; entry.link.length; k++) {&nbsp; &nbsp; &nbsp;&nbsp;  if (entry.link[k].rel == 'replies' &amp;&amp; entry.link[k].type == 'text/html') {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  pcm = entry.link[k].title.split(" ")[0];&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  break;&nbsp; &nbsp; &nbsp;&nbsp;  }&nbsp; &nbsp;&nbsp; }  &nbsp; &nbsp;&nbsp; if ("content" in entry) {&nbsp; &nbsp; &nbsp;&nbsp;  var postcontent = entry.content.$t;}&nbsp; &nbsp;&nbsp; else&nbsp; &nbsp;&nbsp; if ("summary" in entry) {&nbsp; &nbsp; &nbsp;&nbsp;  var postcontent = entry.summary.$t;}&nbsp; &nbsp;&nbsp; else var postcontent = "";&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; postdate = entry.published.$t;  if(j&gt;imgr.length-1) j=0; img[i] = imgr[j];  s = postcontent ; a = s.indexOf("&lt;img"); b = s.indexOf("src=\"",a); c = s.indexOf("\"",b+5); d = s.substr(b+5,c-b-5); if((a!=-1)&amp;&amp;(b!=-1)&amp;&amp;(c!=-1)&amp;&amp;(d!="")) img[i] = d; //cmtext = (text != 'no') ? '&lt;i&gt;&lt;font color="'+acolor+'"&gt;('+pcm+' '+text+')&lt;/font&gt;&lt;/i&gt;' : ''; var month = [1,2,3,4,5,6,7,8,9,10,11,12]; var month2 = ["January","February","March","April","May","June","July","August","September","October","November","December"]; var day = postdate.split("-")[2].substring(0,2); var m = postdate.split("-")[1]; var y = postdate.split("-")[0]; for(var u2=0;u2&lt;month.length;u2++){  if(parseInt(m)==month[u2]) {   m = month2[u2] ; break;  } } var daystr = m+ ' ' + day + ' ' + y ;  var trtd = '&lt;a href="'+posturl+'"&gt;&lt;span&gt;&amp;#187; &lt;/span&gt;'+posttitle+'&lt;/a&gt;';       document.write(trtd); &nbsp; &nbsp;        &nbsp;&nbsp;j++; } }function showrecentposts7(json) { j = (showRandomImg) ? Math.floor((imgr.length+1)*Math.random()) : 0; img &nbsp;= new Array();&nbsp;&nbsp; for (var i = 0; i &lt; numposts3; i++) {&nbsp; &nbsp;&nbsp; var entry = json.feed.entry[i];&nbsp; &nbsp;&nbsp; var posttitle = entry.title.$t;  var pcm;&nbsp; &nbsp;&nbsp; var posturl;&nbsp; &nbsp;&nbsp; if (i == json.feed.entry.length) break;&nbsp; &nbsp;&nbsp; for (var k = 0; k &lt; entry.link.length; k++) {&nbsp; &nbsp; &nbsp;&nbsp;  if (entry.link[k].rel == 'alternate') {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  posturl = entry.link[k].href;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  break;&nbsp; &nbsp; &nbsp;&nbsp;  }&nbsp; &nbsp;&nbsp; }    for (var k = 0; k &lt; entry.link.length; k++) {&nbsp; &nbsp; &nbsp;&nbsp;  if (entry.link[k].rel == 'replies' &amp;&amp; entry.link[k].type == 'text/html') {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  pcm = entry.link[k].title.split(" ")[0];&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  break;&nbsp; &nbsp; &nbsp;&nbsp;  }&nbsp; &nbsp;&nbsp; }  &nbsp; &nbsp;&nbsp; if ("content" in entry) {&nbsp; &nbsp; &nbsp;&nbsp;  var postcontent = entry.content.$t;}&nbsp; &nbsp;&nbsp; else&nbsp; &nbsp;&nbsp; if ("summary" in entry) {&nbsp; &nbsp; &nbsp;&nbsp;  var postcontent = entry.summary.$t;}&nbsp; &nbsp;&nbsp; else var postcontent = "";&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; postdate = entry.published.$t;  if(j&gt;imgr.length-1) j=0; img[i] = imgr[j];  s = postcontent ; a = s.indexOf("&lt;img"); b = s.indexOf("src=\"",a); c = s.indexOf("\"",b+5); d = s.substr(b+5,c-b-5); if((a!=-1)&amp;&amp;(b!=-1)&amp;&amp;(c!=-1)&amp;&amp;(d!="")) img[i] = d; //cmtext = (text != 'no') ? '&lt;i&gt;&lt;font color="'+acolor+'"&gt;('+pcm+' '+text+')&lt;/font&gt;&lt;/i&gt;' : ''; var month = [1,2,3,4,5,6,7,8,9,10,11,12]; var month2 = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; var day = postdate.split("-")[2].substring(0,2); var m = postdate.split("-")[1]; var y = postdate.split("-")[0]; for(var u2=0;u2&lt;month.length;u2++){  if(parseInt(m)==month[u2]) {   m = month2[u2] ; break;  } } var daystr = day+ ' ' + m + ' ' + y ;  var trtd = '&lt;li&gt;&lt;a title=" '+posttitle+' " href="'+posturl+'"&gt;&lt;img width="90" height="70" &nbsp;title=" '+posttitle+' " class=" " src="'+img[i]+'"/&gt;&lt;/a&gt;&lt;/li&gt;';       document.write(trtd); &nbsp; &nbsp;        &nbsp;&nbsp;j++; } }//]]&gt;&lt;/script&gt;

Agora procure por:&nbsp;&lt;div class='content-inner'&gt;&nbsp;Abaixo dele cole:





&lt;div style='clear:both;'/&gt;&lt;div class='headline-wrapper'&gt;&lt;div class='headline'&gt;&nbsp; &lt;div style='float:left; background:#F7550D; padding:4px 18px 3px 20px; font-size: 14px; font-family: Oswald, sans-serif; color:#fff; overflow: hidden;'&gt;Ultimas &lt;/div&gt;&lt;div class='headline-left'&gt;&lt;marquee behavior='scroll' bgcolor='' direction='left' onmouseout='this.start()' onmouseover='this.stop()' scrollamount='4'&gt;&lt;script&gt;document.write(&amp;quot;&amp;lt;script src=\&amp;quot;/feeds/posts/default?max-results=&amp;quot;+numposts5+&amp;quot;&amp;amp;orderby=published&amp;amp;alt=json-in-script&amp;amp;callback=showrecentposts4\&amp;quot;&amp;gt;&amp;lt;\/script&amp;gt;&amp;quot;);     &nbsp;&lt;/script&gt;&lt;/marquee&gt;&nbsp; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&lt;div style='clear:both;'/&gt;





Salve !















E, para dar estilo (css)"Implementar CSS &nbsp; "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No modelo de seu blog", clique em "Personalizar"





















Ao abrir essa janela, vá em&nbsp;Avançado&nbsp; -------&gt;&nbsp;Adicionar CSS&nbsp;









Copie o código abaixo e cole no local indicado.

/* Headline---------------------------------*/.headline-wrapper{background: #442108;width:100%;height: 35px;color:#fff;margin:&nbsp;-30px 0&nbsp;30px 0;&nbsp;/*Mude os números para subir os descer o menu de postagens aqui */}.headline{width: 1000px;line-height: 1.8em;text-align: left;font-family: 'Arial', sans-serif;font-weight: normal;color: #151515;text-transform: none;overflow: hidden;clear: both;margin: 0 auto;padding: 10px auto}.headline a{color: #fff;font-size: 13px;font-weight: normal;text-decoration: none;margin-left: 20px}.headline a:hover{color: #000;text-decoration: none}.headline-left{float:left;width:88%;padding:2px 0;position:relative;overflow:hidden;}


Depois, clique em "Aplicar ao blog",&nbsp;

no canto direito de seu monitor,&nbsp;

na parte superior para salvar.


///

Mensagem do formulário de comentário:


"comentários de anônimos, não serão publicados,
e aqui...&nbsp;
...não é local para desentendimentos e discórdias!&nbsp;
Seja bastante educado!
Frequenta qual escola, ou frequentou?
&nbsp;...ou a educação vem de berço?