Cara Membuat Featured Anime Random V.2 (Acak setelah di refresh)
Tapi inget, kalo mau ngubah ukuran jangan asal ubah. Takutnya nanti kode nya malah berantakan, kalo mau ngubah yang lain komen aja deh. Saya lagi males ngetik, udah malem lagi.
Maaf belakangan ini saya jarang posting. Udah lama, soalnya tadi baru beres UN, Sekarang udah bebas. Jadi, ini posting pertama saya setelah sekian lama.
Ok, Tanpa basa-basi lagi langsung ajah kopas kode di bawah ini:
Ganti Anime jadi Lebel kamu
DEMO
<style>
.rdpost {
margin: 0px;
padding: 0px;
list-style: outside none none;
display: block;
}
.rdpost li {
float: left;
width: 119px;
margin-right: 2px;
overflow: hidden;
position: relative;
height: 164px;
padding: 1px !important;
border: 1px solid #DDD;
margin-left: 2px;
}
.rdpost li .rdthumbs {
display: block;
line-height: 0;
}
.rdtitle a {
position: absolute;
bottom: 0px;
color: #FFF;
display: inline-block;
padding: 4px 4px 3px;
width: 111px;
font-size: 11px;
line-height: 16px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
z-index: 10;
}
.rdtitle::after {
content: "";
background: rgba(0, 0, 0, 0.5);
position: absolute;
bottom: 1px;
width: 99%;
height: 18px;
}
.rdsnippet {
display: none;
}
</style>
<script type="text/javascript">
var rdnumposts=5;
var rdsnippet_length=150;
var rdcomment='Comments';
var rddisable='Comments Disabled';
var rdinfo='no';
var rdcurpost=[];
var rdtotal_posts=0;
var rdcurpost=new Array(rdnumposts);function totalposts(json){rdtotal_posts=json.feed.openSearch$totalResults.$t}document.write('<scr'+'ipt type="text/javascript" src="/feeds/posts/default/-/Anime?alt=json-in-script&max-results=0&callback=totalposts"></scr'+'ipt>');function getvalue(){for(var i=0;i<rdnumposts;i++){var found=false;var rndValue=get_random();for(var j=0;j<rdcurpost.length;j++){if(rdcurpost[j]==rndValue){found=true;break}};if(found){i--}else{rdcurpost[i]=rndValue}}};function get_random(){var ranNum=1+Math.round(Math.random()*(rdtotal_posts-1));return ranNum};
document.write('<ul class="rdpost">');
</script>
<script type="text/javascript">
function random_posts(json){for(var i=0;i<rdnumposts;i++){var entry=json.feed.entry[i];var rdposttitle=entry.title.$t;if('content'in entry){var rdget_snippet=entry.content.$t}else{if('summary'in entry){var rdget_snippet=entry.summary.$t}else{var rdget_snippet=entry.title.$t;}};rdget_snippet=rdget_snippet.replace(/<[^>]*>/g,"");if(rdget_snippet.length<rdsnippet_length){var rdsnippet=rdget_snippet}else{rdget_snippet=rdget_snippet.substring(0,rdsnippet_length);var space=rdget_snippet.lastIndexOf(" ");rdsnippet=rdget_snippet.substring(0,space)+"…";};for(var j=0;j<entry.link.length;j++){if('thr$total'in entry){var rdcommentsNum=entry.thr$total.$t+' '+rdcomment}else{rdcommentsNum=rddisable};if(entry.link[j].rel=='alternate'){var rdposturl=entry.link[j].href;var rdpostdate=entry.published.$t;if('media$thumbnail'in entry){var rdthumb=entry.media$thumbnail.url}else{rdthumb="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSqci6rB8akxyxjHzXcVA9yq44hCaCE32F-MVRfCJB7bv5dFXkUx-fvn3agcKnhY4k4MnUiZEefFN_m37fKe63lSR2WmfTCgeccpv9oJi9IZhS1fsXEw8346nP6A6yxzbfKCu3StEY7xU/s72/noimage.png"}}};var monthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var mname=rdpostdate.substring(5,7);E=monthNames[parseInt(mname,10)-1];document.write('<li>');document.write('<a class="rdthumbs" href="'+rdposturl+'" title="'+rdposttitle+'"><img class="rdthumb" title="'+rdposttitle+'" alt="'+rdposttitle+'" src="'+rdthumb+'"/></a>');document.write('<strong class="rdtitle"><a href="'+rdposturl+'" title="'+rdposttitle+'">'+rdposttitle+'</a></strong>');if(rdinfo=='yes'){document.write('<span class="date">'+rdpostdate.substring(8,10)+' '+E+' '+rdpostdate.substring(0,4)+' | '+rdcommentsNum+'</span>')}document.write('<p class="rdsnippet">'+rdsnippet+'</p></li>')}};getvalue();for(var i=0;i<rdnumposts;i++){document.write('<scr'+'ipt type=\"text/javascript\" src=\"/feeds/posts/default/-/Anime?alt=json-in-script&start-index='+rdcurpost[i]+'&max-results=1&callback=random_posts\"></scr'+'ipt>')};document.write('<span class="clear"/></ul>');</script>
<script type='text/javascript'>
function resizeThumb(el, from, to) {
$(el).each(function() {
$(this).attr({
'src': $(this).attr('src').replace('/s'+from+'/', '/'+to+'/')
});
});
}
$(function() {
resizeThumb('.rdthumb', '72-c', 'w119-h164-c');
});
</script>
Cara Membuat Featured Anime Random V.2 (Acak setelah di refresh)
Reviewed by Michael William J
on
Rabu, April 15, 2015
Rating:
Tidak ada komentar
Terima Kasih