Tuesday, 13 May 2014

RANDOM POST WIDGET IN BLOG

RANDOM POST WIDGET IN BLOG



-------------------------------------------------------------------------------
1- ADD HTML/JAVA WIDGET IN BLOG LAYOUT
2- COPY AND PASTE BELOW CODE IN WIDGET
--------------------------------------------------------------------------------


<style>

#random-posts img {
float:left;
margin-right:10px;
width:65px;
height:50px;
background-color:#F5F5F5;
padding:3px;
}
ul#random-posts {
list-style-type: none;
}

</style>

<ul id='random-posts'>

<script type='text/javaScript'>
var rdp_numposts=5;
var rdp_snippet_length=150;
var rdp_info='yes';
var rdp_comment='Comments';
var rdp_disable='Comments Disabled';
var rdp_current=[];var rdp_total_posts=0;var rdp_current=new Array(rdp_numposts);function totalposts(json){rdp_total_posts=json.feed.openSearch$totalResults.$t}document.write('<script type=\"text/javascript\" src=\"/feeds/posts/default?alt=json-in-script&max-results=0&callback=totalposts\"><\/script>');function getvalue(){for(var i=0;i<rdp_numposts;i++){var found=false;var rndValue=get_random();for(var j=0;j<rdp_current.length;j++){if(rdp_current[j]==rndValue){found=true;break}};if(found){i--}else{rdp_current[i]=rndValue}}};function get_random(){var ranNum=1+Math.round(Math.random()*(rdp_total_posts-1));return ranNum};
</script>

<script type='text/javaScript'>
function random_posts(json){for(var i=0;i<rdp_numposts;i++){var entry=json.feed.entry[i];var rdp_posttitle=entry.title.$t;if('content'in entry){var rdp_get_snippet=entry.content.$t}else{if('summary'in entry){var rdp_get_snippet=entry.summary.$t}else{var rdp_get_snippet="";}};rdp_get_snippet=rdp_get_snippet.replace(/<[^>]*>/g,"");if(rdp_get_snippet.length<rdp_snippet_length){var rdp_snippet=rdp_get_snippet}else{rdp_get_snippet=rdp_get_snippet.substring(0,rdp_snippet_length);var space=rdp_get_snippet.lastIndexOf(" ");rdp_snippet=rdp_get_snippet.substring(0,space)+"&#133;";};for(var j=0;j<entry.link.length;j++){if('thr$total'in entry){var rdp_commentsNum=entry.thr$total.$t+' '+rdp_comment}else{rdp_commentsNum=rdp_disable};if(entry.link[j].rel=='alternate'){var rdp_posturl=entry.link[j].href;var rdp_postdate=entry.published.$t;if('media$thumbnail'in entry){var rdp_thumb=entry.media$thumbnail.url}else{rdp_thumb="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjudwosPPRsLutOywnBQbW_ZMRoqoahihP8mZile9w_v4ZlMLLYTJhc2S1IRDtvorZQorRHPV2dgCGlBjIOrJSeEIpVEWs6cak1X-VELgclUe9BeiK2V1W6fsTKlgY8ckvTR1yZMiFt-0c/s1600/no_thumb.png"}}};document.write('<li>');document.write('<img alt="'+rdp_posttitle+'" src="'+rdp_thumb+'"/>');document.write('<div><a href="'+rdp_posturl+'" rel="nofollow" title="'+rdp_snippet+'">'+rdp_posttitle+'</a></div>');if(rdp_info=='yes'){document.write('<span>'+rdp_postdate.substring(8,10)+'/'+rdp_postdate.substring(5,7)+'/'+rdp_postdate.substring(0,4)+' - '+rdp_commentsNum)+'</span>'}document.write('<div style="clear:both"></div></li>')}};getvalue();for(var i=0;i<rdp_numposts;i++){document.write('<script type=\"text/javascript\" src=\"/feeds/posts/default?alt=json-in-script&start-index='+rdp_current[i]+'&max-results=1&callback=random_posts\"><\/script>')};
</script>

</ul>

--------------------------------------------------------------------------------------
RAINBOW RANDOM POST CODE WITH BLOG URL BUT NO IMAGE:
ADD HTML/JAVA WIDGET AND PASTE BELOW CODE
COPY AND PASTE BELOW CODE
CHANGE BLOG URL
--------------------------------------------------------------------------------------




------------------------------------------------------------------------------------------------------------
COPY AND PASTE BELOW CODE
------------------------------------------------------------------------------------------------------------

<style type="text/css">
.FBGaddgets-random-posts ul li {
list-style-image:none;
}
.FBGaddgets-random-posts ul {
list-style-type: none;
margin: 0;
padding: 5px 0;
}
.FBGaddgets-random-posts ul li {
border: 0 none;
margin: 5px 0;
padding: 10px;
position: relative;
}
.FBGaddgets-random-posts ul li:first-child {
background: none repeat scroll 0 0 #FF4C54;
width: 97%;
}
.FBGaddgets-random-posts ul li:first-child:after {
content: "1";
}
.FBGaddgets-random-posts ul li:first-child + li {
background: none repeat scroll 0 0 #FF764C;
width: 87%;
}
.FBGaddgets-random-posts ul li:first-child + li:after {
content: "2";
}
.FBGaddgets-random-posts ul li:first-child + li + li {
background: none repeat scroll 0 0 #FFDE4C;
width: 84%;
}
.FBGaddgets-random-posts ul li:first-child + li + li:after {
content: "3";
}
.FBGaddgets-random-posts ul li:first-child + li + li + li {
background: none repeat scroll 0 0 #C7F25F;
width: 81%;
}
.FBGaddgets-random-posts ul li:first-child + li + li + li:after {
content: "4";
}
.FBGaddgets-random-posts ul li:first-child + li + li + li + li {
background: none repeat scroll 0 0 #33C9F7;
width: 78%;
}
.FBGaddgets-random-posts ul li:first-child + li + li + li + li:after {
content: "5";
}
.FBGaddgets-random-posts ul li:first-child + li + li + li + li + li {
background: none repeat scroll 0 0 #7EE3C7;
width: 75%;
}
.FBGaddgets-random-posts ul li:first-child + li + li + li + li + li:after {
content: "6";
}
.FBGaddgets-random-posts ul li:first-child + li + li + li + li + li + li {
background: none repeat scroll 0 0 #F6993D;
width: 72%;
}
.FBGaddgets-random-posts ul li:first-child + li + li + li + li + li + li:after {
content: "7";
}
.FBGaddgets-random-posts ul li:first-child + li + li + li + li + li + li + li {
background: none repeat scroll 0 0 #F59095;
width: 69%;
}
.FBGaddgets-random-posts ul li:first-child + li + li + li + li + li + li + li:after {
content: "8";
}
.FBGaddgets-random-posts ul li:first-child + li + li + li + li + li + li + li + li {
background: none repeat scroll 0 0 #C7F25F;
width: 66%;
}
.FBGaddgets-random-posts ul li:first-child + li + li + li + li + li + li + li + li:after {
content: "9";
}
.FBGaddgets-random-posts ul li:first-child:after, .FBGaddgets-random-posts ul li:first-child + li:after, .FBGaddgets-random-posts ul li:first-child + li + li:after, .FBGaddgets-random-posts ul li:first-child + li + li + li:after, .FBGaddgets-random-posts ul li:first-child + li + li + li + li:after, .FBGaddgets-random-posts ul li:first-child + li + li + li + li + li:after, .FBGaddgets-random-posts ul li:first-child + li + li + li + li + li + li:after, .FBGaddgets-random-posts ul li:first-child + li + li + li + li + li + li + li:after, .FBGaddgets-random-posts ul li:first-child + li + li + li + li + li + li + li + li:after {
background: none repeat scroll 0 0 #353535;
border-radius: 50% 50% 50% 50%;
color: #FFFFFF;
font-size: 25px;
height: 30px;
position: absolute;
right: -17px;
text-align: center;
top: 1px;
width: 30px;
}
.FBGaddgets-random-posts ul li a {
color: #444444;
font-size: 13px;
text-decoration: none;
}
</style>


<div class="FBGaddgets-random-posts">

<script type="text/javascript">
var randarray = new Array();var l=0;var flag;
var numofpost=9;function randomposts(json){
var total = parseInt(json.feed.openSearch$totalResults.$t,10);
for(i=0;i < numofpost;){flag=0;randarray.length=numofpost;l=Math.floor(Math.random()*total);for(j in randarray){if(l==randarray[j]){ flag=1;}}
if(flag==0&&l!=0){randarray[i++]=l;}}document.write('<ul>');
for(n in randarray){ var p=randarray[n];var entry=json.feed.entry[p-1];
for(k=0; k < entry.link.length; k++){if(entry.link[k].rel=='alternate'){var item = "<li>" + "<a href=" + entry.link[k].href + ">" + entry.title.$t + "</a> </li>";
document.write(item);}}
}document.write('</ul>');}
</script>
<script src="http://fbgadgets.blogspot.co.uk/feeds/posts/default?alt=json-in-script&start-index=1&max-results=1000&callback=randomposts" type="text/javascript"></script>

</div>

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

FB Gadgets | Template Designed by Fatakat PhotosCoolBThemes.com
Code by : paid web directory

https://www.google.co.uk/search?q=site%3Ablogspot.com+fbgadgets