Advertisement
Guest User

Untitled

a guest
Apr 26th, 2011
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. <script type="text/javascript">
  2. nmax = 90;
  3. n = tumblr_api_read["posts-total"];
  4. if (n > nmax) n = nmax;
  5. for (i = 0; i < n; i++) {
  6.  
  7. switch (tumblr_api_read["posts"][i]["type"]) {
  8. case "regular":
  9. kind = "text";
  10. label = tumblr_api_read["posts"][i]["regular-title"];
  11. col = "background: #fff";
  12. photourl = "";
  13. source = "";
  14. videoplayer = "";
  15. break;
  16.  
  17. case "photo":
  18. kind = "photo";
  19. label = tumblr_api_read["posts"][i]["photo-caption"];
  20. photourl = "<img style='display: block; border:0px;' src='" + tumblr_api_read["posts"][i]["photo-url-400"] + "' />";
  21. col = "background: #fff";
  22. source = "";
  23. videoplayer = "";
  24. break;
  25.  
  26. case "quote":
  27. kind = "quote";
  28. label = '"' + tumblr_api_read["posts"][i]["quote-text"] + '"';
  29. col = "background: #fff";
  30. source = tumblr_api_read["posts"][i]["quote-source"];
  31. photourl = "";
  32. videoplayer = "";
  33. break;
  34.  
  35. case "link":
  36. kind = "link";
  37. label = tumblr_api_read["posts"][i]["link-text"];
  38. col = "background: #fff";
  39. photourl = "";
  40. source = "";
  41. videoplayer = "";
  42. break;
  43.  
  44. case "chat":
  45. kind = "chat";
  46. label = "";
  47. col = "background: #fff";
  48. photourl = "";
  49. source = "";
  50. videoplayer = "";
  51. break;
  52.  
  53. case "audio":
  54. kind = "audio";
  55. label = tumblr_api_read["posts"][i]["audio-caption"];
  56. col = "background: #fff";
  57. photourl = "";
  58. source = "";
  59. videoplayer = "";
  60. break;
  61.  
  62. case "video":
  63. kind = "video";
  64. label = tumblr_api_read["posts"][i]["video-caption"];
  65. col = "background: #fff";
  66. photourl = "";
  67. source = "";
  68. videoplayer = tumblr_api_read["posts"][i]["video-player"] + "<br />";
  69. break;
  70.  
  71. }
  72. // HTML ?????????
  73. label = label.replace(/<[^>]*?>/gi,"");
  74. // "(via )" ??????????
  75. //label = label.replace("(via )","");
  76.  
  77. url = tumblr_api_read["posts"][i]["url"];
  78.  
  79. document.write(
  80. '<div class="tumblr_post" class="', kind , '" style="', col, '">',
  81. '<a href="', url, '"><span class="tumblr_kind">',
  82. ' ', kind, ' </span>' ,
  83. '<div class="blackblack ', kind, '">',
  84. photourl, ' ',
  85. videoplayer, '',
  86. label, '<br /><br />',
  87. source,
  88. '</div></a></div>',
  89. " "
  90. );
  91.  
  92. }
  93. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement