Most Dynamic Random Posts Widget For Blogger [Quick Guide]


<script type=’text/javaScript’>
//#################### Defaults
var ListBlogLink = “https://href.li/?http://techgoviral.blogspot.com/?”;
var ListCount = 3;
var ChrCount = 85;
var TitleCount = 70;
var ImageSize = 150;
var showcomments = “on“;
var showdate = “off“;
var showauthor = “on“;
var showthumbnail = “on“;
var showlabel = “on“;
var showcontent = “off“;


var RandomArray = [];
var TotalPosts  = 0;
var RandomArray = new Array(ListCount);


function TotalCount(json)
    TotalPosts   = json.feed.openSearch$totalResults.$t

document.write(‘<script type=”text/javascript” src=”https://href.li/?http://www.techgoviral.blogspot.com/?/feeds/posts/default?alt=json-in-script&callback=TotalCount”></script>’);


function GenerateNum()
    for (var i = 0; i < ListCount ; i++)
    for (var j = 0; j < RandomArray.length; j++)
    var RandomNum = Math.floor(Math.random() * (TotalPosts ) + 1);
    RandomArray[i] = RandomNum;
                                                                 

</script>
<script type=’text/javaScript’>


document.write(‘<ul class=”mbtlist”>’);
//################ Function Start
function mbtrandom(json)
for (var i = 0; i < ListCount; i++)

  
//################### Variables Declared
var listing= ListImage = ListUrl = ListTitle = ListImage = ListContent = ListConten = ListAuthor = ListTag = ListDate = ListUpdate = ListComments = thumbUrl = TotalPosts = sk = AuthorPic= ListMonth = Y = D = M = m = YY = DD = MM = mm = TT =  “https://href.li/?http://www.techgoviral.blogspot.com/?/”;


//################### Category
if (json.feed.entry[i].category != null)

for (var k = 0; k < json.feed.entry[i].category.length; k++)
ListTag += “<a href=”https://href.li/?http://www.techgoviral.blogspot.com/?/”+ListBlogLink+”/search/label/”+json.feed.entry[i].category[k].term+”https://href.li/?http://www.techgoviral.blogspot.com/?/”>”+json.feed.entry[i].category[k].term+”</a>”;
if(k < json.feed.entry[i].category.length-1)
ListTag += “https://href.li/?http://www.techgoviral.blogspot.com/?/”;


//################### URL
for (var j = 0; j < json.feed.entry[i].link.length; j++)
      if (json.feed.entry[i].link[j].rel == ‘alternate’)
        break;
     
   
ListUrl= “https://href.li/?http://www.techgoviral.blogspot.com/?/”” + json.feed.entry[i].link[j].href + “https://href.li/?http://www.techgoviral.blogspot.com/?/””;


//################### Info
TotalPosts = json.feed.openSearch$totalResults.$t;
if (json.feed.entry[i].title!= null)

ListTitle= json.feed.entry[i].title.$t.substr(0, TitleCount);

if (json.feed.entry[i].thr$total)

ListComments= “<a href=”https://href.li/?http://www.techgoviral.blogspot.com/?/”+json.feed.entry[i].link[j].href+”#comment-form’>”+json.feed.entry[i].thr$total.$t+”</a>”;

ListAuthor= json.feed.entry[i].author[0].name.$t.split(“https://href.li/?http://www.techgoviral.blogspot.com/?/”);
ListAuthor=ListAuthor.slice(0, 1).join(“https://href.li/?http://www.techgoviral.blogspot.com/?/”);


AuthorPic = json.feed.entry[i].author[0].gd$image.src;
//################### Content Check


ListConten = json.feed.entry[i].content.$t;
ListContent= ListConten.replace(/(<([^>]+)>)/ig,”https://href.li/?http://www.techgoviral.blogspot.com/?/”).substring(0, ChrCount);


//################### Date Format


ListMonth= [“Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”, “Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec”];


ListDate= json.feed.entry[i].published.$t.substring(0,10);


                         Y = ListDate.substring(0, 4);
                        m = ListDate.substring(5, 7);
                         D = ListDate.substring(8, 10);
                         M = ListMonth[parseInt(m – 1)];                       


ListUpdate= json.feed.entry[i].updated.$t.substring(0, 16);


                         YY = ListUpdate.substring(0, 4);
                        mm = ListUpdate.substring(5, 7);
                         DD = ListUpdate.substring(8, 10);
                         TT = ListUpdate.substring(11, 16);
                         MM = ListMonth[parseInt(mm – 1)];   


//################### Thumbnail Check
// YouTube scan


if (json.feed.entry[i].content.$t.match(/youtube.com.*(?v=
document.write(“<div class=’itotal’><span> <a href=”https://href.li/?http://www.techgoviral.blogspot.com/?/”+ListBlogLink+”https://href.li/?http://www.techgoviral.blogspot.com/?/”>View all <font>”+TotalPosts+”</font> posts in  ─  “+ListLabel+” </a></span></div>”);


<!– ######### Invoking the Callback Function ######## –>
for (var i = 0; i < ListCount ; i++)
GenerateNum();


    document.write(‘<script type=”text/javascript” src=”https://href.li/?http://www.techgoviral.blogspot.com/?/feeds/posts/default?alt=json-in-script&start-index=’ + RandomArray[i] + ‘&max-results=1&callback=mbtrandom”></script>’)
;
document.write(‘</ul>’);
</script>


No comments:

Powered by Blogger.