Advertisement
dahnnyel1

Untitled

Jun 25th, 2020
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. print("tumblr.js por dane ha sido cargado correctamente!");
  2.  
  3. var ntr = "";
  4. var pro = [];
  5. var last = "";
  6. var limit = 120;
  7. var cycle = 0;
  8.  
  9.  
  10. var tm = ["thevuas","orionfalls","vividessentials","hevildorns","skate-roots"];
  11.  
  12.  
  13. function rnd(min, max)
  14. {
  15. min = Math.ceil(min);
  16. max = Math.floor(max);
  17. return Math.floor(Math.random() * (max - min + 1)) + min;
  18. }
  19.  
  20. function random(arg)
  21. {
  22. return arg[Math.floor(Math.random() * arg.length)];
  23. }
  24.  
  25. function getBlog(bn)
  26. {
  27.  
  28. var ix;
  29. pro = [];
  30.  
  31. var blg = new HttpRequest();
  32.  
  33. blg.src = "https://api.tumblr.com/v2/blog/"+bn+".tumblr.com/posts/photo?limit=1&api_key=fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4";
  34.  
  35. blg.oncomplete = function()
  36. {
  37. ix = JSON.parse(this.page);
  38.  
  39. var int = 0;
  40. int = ix.response.total_posts;
  41. int = parseInt(int/12);
  42.  
  43. int = rnd(0, int);
  44.  
  45. blog(bn, int);
  46.  
  47.  
  48. //pro.push("<a href=\""+ix.response.posts[i].photos[0].original_size.url+"\"><img src=\""+ix.response.posts[i].photos[0].alt_sizes[3].url+"\" width=\"100\" /><a/>");
  49.  
  50.  
  51. }
  52.  
  53. blg.download();
  54.  
  55. }
  56.  
  57.  
  58. function blog(name, page)
  59. {
  60.  
  61. var final = [];
  62.  
  63. var req = new HttpRequest();
  64. req.src = "https://"+name+".tumblr.com/page/"+page;
  65. req.utf = true;
  66. req.oncomplete = function()
  67. {
  68.  
  69. var result = this.page;
  70.  
  71. var rest = result.split('<img src="');
  72.  
  73. for(x in rest)
  74. {
  75. if(rest[x].split('"')[0].indexOf("media") > -1)
  76. {
  77. if(rest[x].split('"')[0].indexOf("pnj") != 0)
  78. {
  79. final.push(rest[x].split('"')[0])
  80. }
  81. }
  82. }
  83.  
  84. image(random(final));
  85.  
  86. }
  87.  
  88. req.download();
  89.  
  90. }
  91.  
  92.  
  93. function showme()
  94. {
  95. var url = random(tm);
  96.  
  97.  
  98. if (url == last)
  99. {
  100. url = random(tm);
  101. getBlog(url);
  102. last = url;
  103. }
  104. else
  105. {
  106. getBlog(url);
  107. last = url;
  108. }
  109. }
  110.  
  111.  
  112.  
  113. function onCommand(userobj, command, target, args)
  114. {
  115.  
  116. if(command.indexOf("tumb") == 0 && userobj.level > 0)
  117. {
  118. showme();
  119. }
  120. if(command.indexOf("cada") == 0 && userobj.level > 0)
  121. {
  122. if(command.substr(5)!="" && !isNaN(command.substr(5)))
  123. {
  124. limit = parseInt(command.substr(5));
  125. print(userobj, "\x0314"+userobj.name+" cambiaste el tiempo a "+limit);
  126. }
  127. }
  128.  
  129. if(command.indexOf("tumblr on") == 0 && userobj.level > 0)
  130. {
  131. tiempo();
  132. print("\x0314tumblr encendido por "+userobj.name);
  133. }
  134. if(command.indexOf("tumblr off") == 0 && userobj.level > 0)
  135. {
  136. delete onTimer;
  137. print("\x0314tumblr detenido por "+userobj.name);
  138.  
  139. }
  140.  
  141. }
  142.  
  143. function tiempo()
  144. {
  145. onTimer = function()
  146. {
  147. if(cycle++ > limit)
  148. {
  149. showme();
  150. cycle = 0;
  151. }
  152. }
  153. }
  154.  
  155. function image(url)
  156. {
  157.  
  158. if(url == "" || url == null)
  159. {
  160. return;
  161. }
  162.  
  163. var img_obj = new Scribble();
  164. img_obj.src = url;
  165.  
  166. img_obj.oncomplete = function()
  167. {
  168.  
  169. var scribble = this;
  170.  
  171. Users.local(function(t)
  172. {
  173. if(!t.version.includes("cb0t") && t.canHTML)
  174. {
  175. t.sendHTML("<img src='" + url + "' style='max-width: 350px;max-height: 450px;border-radius: 25px;' />");
  176. }
  177. else
  178. {
  179. t.scribble(scribble);
  180. }
  181. });
  182. print("\x0314image posted at :"+new Date().toLocaleTimeString())
  183. }
  184.  
  185. img_obj.download();
  186.  
  187. }
  188.  
  189.  
  190. function onHelp(userobj)
  191. {
  192. print(userobj, "/tumblr [on/off]");
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement