// ==UserScript==
// @name ADIPHY Bot
// @namespace http://adiphy.com/
// @version 1.0
// @description Start and Stop button to bot on Adiphy
// @author Mariechan
// @match http://adiphy.com/
// @grant none
// ==/UserScript==
(function() {
'use strict';
$(document).ready(function(){
var flag=0;
var token;
var site;
var alias;
$('.infostop:first').prepend('<li><button id="stop" type="button" class="btn btn-danger" style="height:50px;width:80px;">Stop</button></li>');
$('.infostop:first').prepend('<li><button id="start" type="button" class="btn btn-primary" style="height:50px;width:80px;">Start</button></li>');
$('#start').click(function(){
flag=1;
run();
});
$('#stop').click(function(){
flag=0;
});
function run(){
var interval_obj = setInterval(function(){
token=$("#user-token").text();
site=$('.item-site:first').text();
alias=$('.item-site:first').parent().find(".item-alias").text();
e=window.open(site+"/"+alias+"/"+token,"botvn","width=50,height=50,top=20000,left=100000,status=0,toolbar=no");
if(flag===0)
clearInterval(interval_obj);
}, 4000);
}
});
})();