JAVASCRIPT 214
RSS script By Tom on 14th August 2017 03:55:49 AM
  1.  
  2. <script type='text/javaScript'>
  3. //#################### Defaults
  4. var ListBlogLink = "http://www.techyo.ga";
  5. var ListCount = 5;
  6. var ChrCount = 85;
  7. var TitleCount = 70;
  8. var ImageSize = 450;
  9. var showcomments = "off";
  10. var showdate = "off";
  11. var showauthor = "off";
  12. var showthumbnail = "on";
  13. var showlabel = "off";
  14. var showcontent = "on";
  15. var RandomArray = [];
  16. var TotalPosts  = 0;
  17. var RandomArray = new Array(ListCount);
  18. function TotalCount(json) {
  19.     TotalPosts   = json.feed.openSearch$totalResults.$t
  20. }
  21. document.write('<script type=\"text/javascript\" src=\"http://www.techyo.ga/feeds/posts/default?alt=json-in-script&callback=TotalCount\"><\/script>');
  22. function GenerateNum() {
  23.     for (var i = 0; i < ListCount ; i++) {
  24.     for (var j = 0; j < RandomArray.length; j++){
  25.     var RandomNum = Math.floor(Math.random() * (TotalPosts ) + 1);
  26.     RandomArray[i] = RandomNum; }
  27.                                                                   }
  28. }
  29. </script>
  30. <script type='text/javaScript'>
  31. document.write('<ul class="mbtlist">');
  32. //################ Function Start
  33. function mbtrandom(json) {
  34. for (var i = 0; i < ListCount; i++)
  35. {
  36.    
  37. //################### Variables Declared
  38. 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 =  "";
  39. //################### Category
  40. if (json.feed.entry[i].category != null)
  41. {
  42. for (var k = 0; k < json.feed.entry[i].category.length; k++) {
  43. ListTag += "<a href='"+ListBlogLink+"/search/label/"+json.feed.entry[i].category[k].term+"'>"+json.feed.entry[i].category[k].term+"</a>";
  44. if(k < json.feed.entry[i].category.length-1)
  45. { ListTag += " ";}
  46. }
  47. }
  48. //################### URL
  49. for (var j = 0; j < json.feed.entry[i].link.length; j++) {
  50.       if (json.feed.entry[i].link[j].rel == 'alternate') {
  51.         break;
  52.       }
  53.     }
  54. ListUrl= "'" + json.feed.entry[i].link[j].href + "'";
  55. //################### Info
  56. TotalPosts = json.feed.openSearch$totalResults.$t;
  57. if (json.feed.entry[i].title!= null)
  58. {
  59. ListTitle= json.feed.entry[i].title.$t.substr(0, TitleCount);
  60. }
  61. if (json.feed.entry[i].thr$total)
  62. {
  63. ListComments= "<a href='"+json.feed.entry[i].link[j].href+"#comment-form'>"+json.feed.entry[i].thr$total.$t+"</a>";
  64. }
  65. ListAuthor= json.feed.entry[i].author[0].name.$t.split(" ");
  66. ListAuthor=ListAuthor.slice(0, 1).join(" ");
  67. AuthorPic = json.feed.entry[i].author[0].gd$image.src;
  68. //################### Content Check
  69. ListConten = json.feed.entry[i].content.$t;
  70. ListContent= ListConten.replace(/(<([^>]+)>)/ig,"").substring(0, ChrCount);
  71. //################### Date Format
  72. ListMonth= ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  73. ListDate= json.feed.entry[i].published.$t.substring(0,10);
  74.                          Y = ListDate.substring(0, 4);
  75.                         m = ListDate.substring(5, 7);
  76.                          D = ListDate.substring(8, 10);
  77.                          M = ListMonth[parseInt(m - 1)];                      
  78. ListUpdate= json.feed.entry[i].updated.$t.substring(0, 16);
  79.                          YY = ListUpdate.substring(0, 4);
  80.                         mm = ListUpdate.substring(5, 7);
  81.                          DD = ListUpdate.substring(8, 10);
  82.                          TT = ListUpdate.substring(11, 16);
  83.                          MM = ListMonth[parseInt(mm - 1)];  
  84. //################### Thumbnail Check
  85. // YouTube scan
  86. if (json.feed.entry[i].content.$t.match(/youtube\.com.*(\?v=|\/embed\/)(.{11})/) != null)
  87. {
  88.     var youtube_id = json.feed.entry[i].content.$t.match(/youtube\.com.*(\?v=|\/embed\/)(.{11})/).pop();
  89.    
  90.     if (youtube_id.length == 11) {
  91.         var ListImage = "'//img.youtube.com/vi/"+youtube_id+"/0.jpg'";
  92.         }
  93. }
  94. else if (json.feed.entry[i].media$thumbnail)
  95. {
  96. thumbUrl = json.feed.entry[i].media$thumbnail.url;
  97. sk= thumbUrl.replace("/s72-c/","/s"+ImageSize+"/");
  98. ListImage= "'" + sk.replace("?imgmax=800","") + "'";
  99. }
  100. else if (json.feed.entry[i].content.$t.match(/src=(.+?[\.jpg|\.gif|\.png]")/) != null)
  101. {
  102. // Support For 3rd Party Images
  103. ListImage =  json.feed.entry[i].content.$t.match(/src=(.+?[\.jpg|\.gif|\.png]")/)[1];
  104. }
  105. else
  106. {
  107. ListImage= "'http://4.bp.blogspot.com/-HALLtgFeep0/VfryhQ0C5oI/AAAAAAAAPcY/77mSGND4q84/s200/Icon.png'";
  108. }
  109. //################### Printing List
  110. document.write( "<li style='margin:0px auto 10px auto!important; padding:0px!important;' class='node"+[i]+"' >");
  111. if (showthumbnail == 'on'){
  112. document.write("<div class='iFeatured'><a  href="
  113. + ListUrl+
  114.   "><img src="
  115. +ListImage+
  116. "/></a></div>");
  117. }
  118. if (showlabel == 'on'){
  119. document.write("<span class='itag'>"
  120. +ListTag +
  121. "</span>");
  122. }
  123. document.write("<a class='mbttitle' href="
  124. + ListUrl+
  125. ">"
  126. + ListTitle+
  127. "</a><div class='iline'>");
  128. if (showauthor == 'on'){
  129. document.write("<span class='iauthor'><img class='iauthorpic' src='"+AuthorPic+"'/>"
  130. +ListAuthor+
  131. "</span>");
  132. }
  133. if (showcomments == 'on'){
  134. document.write("<span class='icomments'>"
  135. +ListComments +
  136. "</span> ");
  137. }
  138. if (showdate == 'on'){
  139. document.write("<span class='idate'>"
  140. + M +
  141. " "
  142. + D +
  143. "</span>");
  144. }
  145.  
  146. document.write("</div>");
  147. if (showcontent == 'on'){
  148. document.write("<div class='icontent'>"
  149. +ListContent +
  150. "...</div> ");
  151. }
  152. document.write("</li>");
  153. }
  154. document.write("<div class='itotal'><span> <a href='"+ListBlogLink+"'>View all <font>"+TotalPosts+"</font> posts in  ─  "+ListLabel+" </a></span></div>");
  155. }
  156. <!-- ######### Invoking the Callback Function ######## -->
  157. for (var i = 0; i < ListCount ; i++) {
  158. GenerateNum();
  159.     document.write('<script type=\"text/javascript\" src=\"http://www.techyo.ga/feeds/posts/default?alt=json-in-script&start-index=' + RandomArray[i] + '&max-results=1&callback=mbtrandom\"><\/script>')
  160. };
  161. document.write('</ul>');
  162. </script>

MyClipy is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.