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

SecurePaste 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.

hostcare.ml