Berikut adalah hasil dari script Random Post untuk blogger :
Cara Membuat Random Post javascript untuk Blogger
Berikut adalah code CSS dan Script cara membuat random post blogger:
<h3 style="text-align: left;"><span style="color: #2b00fe;">Random </span>Post javascript untuk Blogger</h3>
<style>
#rp img{border-radius:10px;float:left;margin-right:5px;height:75px;transition:all 0.2s linear 0s}#rp img:hover{transform:scale(1.1)}ul#rp{padding:0;list-style-type:none}#rp a{padding:0px auto 5px}#rp a:hover{text-decoration:none}.rs{padding:5px;margin-right:8px}#rp li{margin-bottom:10px;border-bottom:1px solid#EEE}
</style>
<ul id="rp">
<script type="text/javaScript">
var num = 6;
var cha = 230;
var comm='Comments';var commd='Comments Disabled';var cur=[];var tot=0;var cur=new Array(num);function ranp(json){tot=json.feed.openSearch$totalResults.$t}document.write('<script type=\"text/javascript\" src=\"/feeds/posts/default?alt=json-in-script&max-results=0&callback=ranp\"><\/script>');function getv(){for(var i=0;i<num;i++){var found=false;var rndValue=get_r();for(var j=0;j<cur.length;j++){if(cur[j]==rndValue){found=true;break}};if(found){i--}else{cur[i]=rndValue}}};function get_r(){var ranNum=1+Math.round(Math.random()*(tot-1));return ranNum};</script><script type="text/javaScript">function ran_p(json){for(var i=0;i<num;i++){var entry=json.feed.entry[i];var ranptitle=entry.title.$t;if('content'in entry){var ranpnippet=entry.content.$t}else{if('summary'in entry){var ranpnippet=entry.summary.$t}else{var ranpnippet=""}};ranpnippet=ranpnippet.replace(/<[^>]*>/g,"");if(ranpnippet.length<cha){var ranp_snippet=ranpnippet}else{ranpnippet=ranpnippet.substring(0,cha);var whitespace=ranpnippet.lastIndexOf(" ");ranp_snippet=ranpnippet.substring(0,whitespace)+"…"};for(var j=0;j<entry.link.length;j++){if('thr$total'in entry){var commnum=entry.thr$total.$t+' '+comm}else{commnum=commd};if(entry.link[j].rel=='alternate'){var ranpurl=entry.link[j].href;var ranp_date=entry.published.$t;if('media$thumbnail'in entry){var ranpthumb=entry.media$thumbnail.url}else{ranpthumb="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv10Y-zSFHZBzUd0Y_GCDqr_v9ualhbQ9cKfq9G8_Ju9BFkf5OjF9xeRPZwForbnW41sEm7ROBelvBjS11pI-4IdMD0L-ngbaR42xr8ihxybLM06X4HziivD_5rwsmRbKuHF-e7STcR2U/s72-c/4+pencarian+cari+search+icon+call+%252823%2529.png"}}};document.write('<li>');document.write('<a target="_blank" href="'+ranpurl+'" rel="nofollow"><img alt="'+ranptitle+'" src="'+ranpthumb+'"/></a>');document.write('<div><a target="_blank" href="'+ranpurl+'" rel="nofollow">'+ranptitle+'</a></div>');document.write('<div class="rs">'+ranp_snippet+'</div><div style="clear:both"></div></li>')}};getv();for(var i=0;i<num;i++){document.write('<script type=\"text/javascript\" src=\"/feeds/posts/default?alt=json-in-script&start-index='+cur[i]+'&max-results=1&callback=ran_p\"><\/script>')};
</script>
</ul>
Semoga berguna.
[dibuka]
<script type="text/javaScript">
var num=6;
var cha=230;
var comm='Comments';
var commd='Comments Disabled';
var cur=[];
var tot=0;
var cur=new Array(num);
function ranp(json) {
tot=json.feed.openSearch$totalResults.$t
}
document.write('<script type=\"text/javascript\" src=\"/feeds/posts/default?alt=json-in-script&max-results=0&callback=ranp\"><\/script>');
function getv() {
for(var i=0;
i<num;
i++) {
var found=false;
var rndValue=get_r();
for(var j=0;
j<cur.length;
j++) {
if(cur[j]==rndValue) {
found=true;
break
}
}
;
if(found) {
i--
}
else {
cur[i]=rndValue
}
}
}
;
function get_r() {
var ranNum=1+Math.round(Math.random()*(tot-1));
return ranNum
}
;
</script><script type="text/javaScript">function ran_p(json) {
for(var i=0;
i<num;
i++) {
var entry=json.feed.entry[i];
var ranptitle=entry.title.$t;
if('content'in entry) {
var ranpnippet=entry.content.$t
}
else {
if('summary'in entry) {
var ranpnippet=entry.summary.$t
}
else {
var ranpnippet=""
}
}
;
ranpnippet=ranpnippet.replace(/<[^>]*>/g, "");
if(ranpnippet.length<cha) {
var ranp_snippet=ranpnippet
}
else {
ranpnippet=ranpnippet.substring(0, cha);
var whitespace=ranpnippet.lastIndexOf(" ");
ranp_snippet=ranpnippet.substring(0, whitespace)+"…"
}
;
for(var j=0;
j<entry.link.length;
j++) {
if('thr$total'in entry) {
var commnum=entry.thr$total.$t+' '+comm
}
else {
commnum=commd
}
;
if(entry.link[j].rel=='alternate') {
var ranpurl=entry.link[j].href;
var ranp_date=entry.published.$t;
if('media$thumbnail'in entry) {
var ranpthumb=entry.media$thumbnail.url
}
else {
ranpthumb="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv10Y-zSFHZBzUd0Y_GCDqr_v9ualhbQ9cKfq9G8_Ju9BFkf5OjF9xeRPZwForbnW41sEm7ROBelvBjS11pI-4IdMD0L-ngbaR42xr8ihxybLM06X4HziivD_5rwsmRbKuHF-e7STcR2U/s72-c/4+pencarian+cari+search+icon+call+%252823%2529.png"
}
}
}
;
document.write('<li>');
document.write('<a target="_blank" href="'+ranpurl+'" rel="nofollow"><img alt="'+ranptitle+'" src="'+ranpthumb+'"/></a>');
document.write('<div><a target="_blank" href="'+ranpurl+'" rel="nofollow">'+ranptitle+'</a></div>');
document.write('<div class="rs">'+ranp_snippet+'</div><div style="clear:both"></div></li>')
}
}
;
getv();
for(var i=0;
i<num;
i++) {
document.write('<script type=\"text/javascript\" src=\"/feeds/posts/default?alt=json-in-script&start-index='+cur[i]+'&max-results=1&callback=ran_p\"><\/script>')
}
;
</script>
</ul>
Karena template blog saya ini lebar, agar bisa menjadi dua kolom, saya tembahkan di css atau dalam kode <style> code sebagai berikut :
0 comments:
Posting Komentar