Saiba como fazer: "Slide com atualizações automáticas 2"
Autor: Edilene brandao da silva | Publicado: 2011-03-13T11:38:00-07:00

fonte e créditos:
Templates &amp; Acessórios


Saiba como fazer: "Slide com atualizações automáticas 2"









"&nbsp; Não  se esqueça de  antes de começar salvar uma cópia de seu template, caso  não dê certo, é  só reinstalá-lo. Estas dicas se aplicam aos templates  feitos até junho  de 2010. Para reinstalar o antigo template clique AQUI "





"Copie o código e cole no&nbsp;


HTML/Javascript, cole o&nbsp;


endereço de seu blog no local&nbsp;


indicado e salve."









&lt;b:if cond='data:blog.pagetype == &amp;quot;item&amp;quot;'&gt;
&lt;div class="widget-content"&gt;
&lt;style&gt;
#slideshow {
width: 980px; /*aqui o comprimento do slide*/
margin: 5px 5px 5px 0;
padding:0;
background:#292929;
height:380px;
overflow:hidden;
border: 1px solid #000;
&nbsp;&nbsp;-moz-border-radius:4px;
&nbsp;&nbsp;-webkit-border-radius:4px;
box-shadow: 0px 0px 1em #3A3B4C;
-webkit-box-shadow: 0px 0px 1em #3A3B4C;
-moz-box-shadow: 0px 0px 1em #3A3B4C;
padding: 1px 2px 1px 2px;
}
#slideshow ul {
background:transparent;
margin: 0;
padding: 0;
list-style-type: none;
}
#slideshow .slides {/*maior*/
width:640px;
overflow: hidden;
float:left;
color: #fff;
}
#slideshow .slides ul {/*maior*/
float:left;
overflow: hidden;
width:640px;
height:400px;
}
#slideshow .slides li {
display:none;
left:-99999em;
width:565px;
height:400px;
display:block;
overflow: hidden;
background:#fff;
position:relative;
z-index:1;
}
.js #slideshow .slides li {/*maior*/
margin: 0;
padding: 0;
list-style-type: none;
width:640px;/*area maior*/
height:400px;
display:block;
overflow: hidden;
background:#fff;
position:relative;
z-index:1;
}
.js #slideshow .slides li .entry {/*area maior*/
width:630px;
color: #fff;
height: 100px;/*area inscrição tarja grande*/
padding: 85px 5px 5px 5px;
overflow: hidden;
position:absolute;
bottom:0;
left:0;
background:#000;
filter:alpha(opacity=70);
-moz-opacity:0.7;
-khtml-opacity: 0.7;
opacity: 0.7;
}
#slideshow .slides li .entry p {
margin: 0;
}
#slideshow .slides li .entry h2 ,
#slideshow .slides li .entry h2 a,
#slideshow .slides li .entry h2 a:link,
#slideshow .slides li .entry h2 a:visited,
#slideshow .slides li .entry h2 a:hover,
#slideshow .slides li .entry h2 a:active &nbsp;{
font-size: 20px;
line-height: 1.1em;
margin:0;
color: #808080;

margin: 0;
letter-spacing:0;
border:none !important;
}
#slideshow &nbsp;ul.slides-nav {/*Menor*/
height:400px;
width:335px;/*area menor*/
margin:0;
padding: 0;
float:right;
overflow:hidden;
}
#slideshow .slides-nav li {
display:block;
margin:0;
padding:0;
list-style-type:none;
display:block;
}
#slideshow .slides-nav li a {/*area slide menor*/
width:330px;/*area tarja menor*/
font-family:arial,helvetica,sans-serif;
display:block;
margin:0;
padding:7px;
text-align: left;
list-style-type:none;
display:block;
height:25px;
color: #ccc;
font-size:14px;
overflow:hidden;
background: transparent;
line-height:1.35em;
}
slides.ul li {
background-attachment:scroll;
background-color:transparent;
background-position:center top;
background-repeat:no-repeat;
display:block;
height:400px;
left:0;
opacity:1;
position:absolute;
top:0;
width:540px;
z-index:6;
}
.js #slideshow .slides-nav li.on a {/*area tarja menor*/
background: url(http://1.bp.blogspot.com/-XOUEo5foa9I/TWWKpYR0qGI/AAAAAAAAEUs/QelSPRmrb60/s1600/back.png) ;
color: #000;
}
.js #slideshow .slides-nav li a:hover,
.js #slideshow .slides-nav li a:active {
color:#fff;
}
#slideshow .slides-nav li a img.post-thum,
#slideshow .slides-nav li a img.thumbnail {
float:left;
margin: -6px 10px 0 18px;
padding:2px;
border: 1px solid #aaa;
width:70px;
height:35px;
}
.js #slideshow .slides-nav li.on a img.post-thum,
.js #slideshow .slides-nav li.on a img.thumbnail {
background:#fff !important;
}
&lt;/style&gt;
&lt;script language="JavaScript"&gt;
imgr = new Array();
imgr[0] = "http://3.bp.blogspot.com/_BaCxSD9NFn8/TFImJ3xTRpI/AAAAAAAABpQ/CM1uyut9_R0/s320/templatesww.png";
showRandomImg = true;
aBold = true;
summaryPost = 00; //
summaryTitle = 25; //
numposts = 10; //
home_page = "ENDEREÇO DE SEU BLOG";
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 showrecentposts(json) {
j = (showRandomImg) ? Math.floor((imgr.length+1)*Math.random()) : 0;
img = new Array();
document.write('&lt;ul class="slides-nav"&gt;');
for (var i = 0; i &lt; numposts; 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;}
else
if ("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] = 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;' : '';
posttitle = (aBold) ? ""+posttitle+"" : posttitle;
var trtd = ' &lt;li id="post-'+i+'" class="clearfix"&gt; &lt;a  href="#main-post-'+i+'" class=""&gt;&lt;img height="150px" width="150px"  class="post_thumbnail thumbnail thumbnail post_thumbnail" alt=""  src="'+img[i]+'"/&gt;'+posttitle+'&lt;/a&gt; &lt;/li&gt; ';
document.write(trtd);
j++;
}
document.write('&lt;/ul&gt;');
}
function showrecentposts1(json) {
j = (showRandomImg) ? Math.floor((imgr.length+1)*Math.random()) : 0;
img = new Array();
document.write('&lt;ul class="clearfix" style="position: relative;"&gt;');
for (var i = 0; i &lt; numposts; 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;}
else
if ("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] = 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;' : '';
posttitle = (aBold) ? ""+posttitle+"" : posttitle;
var trtd = '&lt;li style="background: transparent url('+img[i]+')"  id="main-post-'+i+'"&gt;&lt;div class="entry"&gt;&lt;h2  class="post-title"&gt;&lt;a href="'+posturl+'"&gt;'+posttitle+'&lt;/a&gt;&lt;/h2&gt; &lt;p&gt;'+removeHtmlTag(postcontent,summaryPost)+'&lt;/p&gt;&lt;/div&gt;&lt;/li&gt; ';
document.write(trtd);
j++;
}
document.write('&lt;/ul&gt;');
}
&lt;/script&gt;
&lt;script src="http://sites.google.com/site/menuhorizontal2/slidefeed/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="https://sites.google.com/site/motoslide/cycle/jquery.cycle.js" type="text/javascript"&gt;
&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$slideshow = {
context: false,
tabs: false,
timeout: 7000,
slideSpeed: 1000,
tabSpeed: 1000,
fx: 'toss',
init: function() {
this.context = $('#slideshow');
this.tabs = $('ul.slides-nav li', this.context);
this.prepareSlideshow();
},
prepareSlideshow: function() {
$('div.slides &gt; ul', $slideshow.context).cycle({
fx: $slideshow.fx,
timeout: $slideshow.timeout,
speed: $slideshow.slideSpeed,
fastOnEvent: $slideshow.tabSpeed,
pager: $('ul.slides-nav', $slideshow.context),
pagerAnchorBuilder: $slideshow.prepareTabs,
before: $slideshow.activateTab,
pauseOnPagerHover: true,
pause: true
});
},
prepareTabs: function(i, slide) {
return $slideshow.tabs.eq(i);
},
activateTab: function(currentSlide, nextSlide) {
var activeTab = $('a[href="#' + nextSlide.id + '"]', $slideshow.context);
if(activeTab.length) {
$slideshow.tabs.removeClass('on');
activeTab.parent().addClass('on');
}
}
};
$(function() {
$('body').addClass('js');
$slideshow.init();
});
&lt;/script&gt;


&lt;div id="slideshow" class="clearfix"&gt;
&lt;div class="slides"&gt;
&lt;script language="JavaScript"&gt;
document.write("&lt;script src=\""+home_page+"feeds/posts/default/?max-results="+numposts+"&amp;orderby=published&amp;alt=json-in-script&amp;callback=showrecentposts1\"&gt;&lt;\/script&gt;");
&lt;/script&gt;&lt;/div&gt;
&lt;div class="slides-nav"&gt;
&lt;script language="JavaScript"&gt;
document.write("&lt;script src=\""+home_page+"feeds/posts/default/?max-results="+numposts+"&amp;orderby=published&amp;alt=json-in-script&amp;callback=showrecentposts\"&gt;&lt;\/script&gt;");
&lt;/script&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/b:if&gt;