Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("tumblr.js por dane ha sido cargado correctamente!");
- var ntr = "";
- var pro = [];
- var last = "";
- var limit = 120;
- var cycle = 0;
- var tm = ["thevuas","orionfalls","vividessentials","hevildorns","skate-roots"];
- function rnd(min, max)
- {
- min = Math.ceil(min);
- max = Math.floor(max);
- return Math.floor(Math.random() * (max - min + 1)) + min;
- }
- function random(arg)
- {
- return arg[Math.floor(Math.random() * arg.length)];
- }
- function getBlog(bn)
- {
- var ix;
- pro = [];
- var blg = new HttpRequest();
- blg.src = "https://api.tumblr.com/v2/blog/"+bn+".tumblr.com/posts/photo?limit=1&api_key=fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4";
- blg.oncomplete = function()
- {
- ix = JSON.parse(this.page);
- var int = 0;
- int = ix.response.total_posts;
- int = parseInt(int/12);
- int = rnd(0, int);
- blog(bn, int);
- //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/>");
- }
- blg.download();
- }
- function blog(name, page)
- {
- var final = [];
- var req = new HttpRequest();
- req.src = "https://"+name+".tumblr.com/page/"+page;
- req.utf = true;
- req.oncomplete = function()
- {
- var result = this.page;
- var rest = result.split('<img src="');
- for(x in rest)
- {
- if(rest[x].split('"')[0].indexOf("media") > -1)
- {
- if(rest[x].split('"')[0].indexOf("pnj") != 0)
- {
- final.push(rest[x].split('"')[0])
- }
- }
- }
- image(random(final));
- }
- req.download();
- }
- function showme()
- {
- var url = random(tm);
- if (url == last)
- {
- url = random(tm);
- getBlog(url);
- last = url;
- }
- else
- {
- getBlog(url);
- last = url;
- }
- }
- function onCommand(userobj, command, target, args)
- {
- if(command.indexOf("tumb") == 0 && userobj.level > 0)
- {
- showme();
- }
- if(command.indexOf("cada") == 0 && userobj.level > 0)
- {
- if(command.substr(5)!="" && !isNaN(command.substr(5)))
- {
- limit = parseInt(command.substr(5));
- print(userobj, "\x0314"+userobj.name+" cambiaste el tiempo a "+limit);
- }
- }
- if(command.indexOf("tumblr on") == 0 && userobj.level > 0)
- {
- tiempo();
- print("\x0314tumblr encendido por "+userobj.name);
- }
- if(command.indexOf("tumblr off") == 0 && userobj.level > 0)
- {
- delete onTimer;
- print("\x0314tumblr detenido por "+userobj.name);
- }
- }
- function tiempo()
- {
- onTimer = function()
- {
- if(cycle++ > limit)
- {
- showme();
- cycle = 0;
- }
- }
- }
- function image(url)
- {
- if(url == "" || url == null)
- {
- return;
- }
- var img_obj = new Scribble();
- img_obj.src = url;
- img_obj.oncomplete = function()
- {
- var scribble = this;
- Users.local(function(t)
- {
- if(!t.version.includes("cb0t") && t.canHTML)
- {
- t.sendHTML("<img src='" + url + "' style='max-width: 350px;max-height: 450px;border-radius: 25px;' />");
- }
- else
- {
- t.scribble(scribble);
- }
- });
- print("\x0314image posted at :"+new Date().toLocaleTimeString())
- }
- img_obj.download();
- }
- function onHelp(userobj)
- {
- print(userobj, "/tumblr [on/off]");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement