x4eg / x4egfollow

// ==UserScript==
// @name                        x4egfollow
// @namespace       http://userscripts.org/scripts/show/*
// @version                     2.3
// @copyright           http://ask.fm/clll0
// @description         Auto Like Ask.fm
// @author                      (http://userscripts.org/users/*)
// @include                     http://ask.fm/*
// @icon                        http://s3.amazonaws.com/uso_ss/icon/138450/large.gif?1342345458
// ==/UserScript==
// ==Profile==
var token = document.head.innerHTML.split("AUTH_TOKEN = ")[1].split(";")[0].replace(/"/g,"");
 
body = document.body;
if(body != null) {
        div = document.createElement("div");
        div.setAttribute('id','like1');
        div.style.position = "fixed";
        div.style.display = "block";
        div.style.width = "125px";
        div.style.opacity= 1.00;
        div.style.bottom = "+105px";
        div.style.left = "+6px";
        div.style.backgroundColor = "#ff00ae";
        div.style.border = "1px solid #555";
        div.style.padding = "2px";
        div.innerHTML = "<div style='background-color: #00a2ff; color: #FFFFFF; border: 1px solid #00a2ff;'><center><a style='color: #000000;' <a href='http://userscripts.org/' target='_blank' title='Get updates there'> Userscript Page </a></div>"
        div2 = document.createElement("div");
        div2.setAttribute('id','spoiler');
        div2.style.position = "fixed";
        div2.style.width = "125px";
        div2.style.opacity= 0.90;
        div2.style.bottom = "+65px";
        div2.style.left = "+6px";
        div2.style.backgroundColor = "#ff00ae";
        div2.style.border = "1px solid #555";
        div2.style.padding = "2px";
        div2.innerHTML = "<div style='background-color: #00a2ff; color: #FFFFFF; border: 1px solid #00a2ff;'><a style='color: #FFFFFF;' onclick='spoiler()' title='Click to hide'>&laquo;</a> &#8226; <a href='http://ask.fm/clll0' title='My ask.fm' style='color: #FFFFFF;' onclick='alert(\'Thanks for installing this script\');'>My ask.fm</a></div> "
       
        body.appendChild(div);
        body.appendChild(div2);
       
        unsafeWindow.spoiler = function() {
                var i;
        for(i=1;i<=20;i++) {
                var x=document.getElementById('like'+i);
                if (x.style.display=="none") {
                x.style.display="block";
                div2.innerHTML = "<a onclick='spoiler()' title='Ask me something'>&laquo;</a> &#8226; <a href='http://ask.fm/clll0' title='clll0'>Ask me</a>"
                }
                else {
                        x.style.display="none";
                        div2.innerHTML = "<a onclick='spoiler()' title='Click to like all'> Auto like page &raquo;</a>"
                }
        }
        };
}
function follow(user){
        jQuery.ajax({
                url: "http://ask.fm/" + user + "/follow",
                type: "POST",
                data: { "authenticity_token":token},
        });
}
// ==============
// ==Like All==
body = document.body;
if(body != null) {
        div = document.createElement("div");
        div.setAttribute('id','like2');
        div.style.position = "fixed";
        div.style.display = "block";
        div.style.width = "125px";
        div.style.opacity= 0.90;
        div.style.bottom = "+42px";
        div.style.left = "+6px";
        div.style.backgroundColor = "#eceff5";
        div.style.border = "1px solid #94a3c4";
        div.style.padding = "2px";
        div.innerHTML = "<img src='https://lh4.googleusercontent.com/-D1HYuLwPnNQ/TxPK6cm_THI/AAAAAAAAAIE/ynATGaxGbv0/s16/Facebook%252520Like%252520Small.jpg' width='16' height='14' align='absmiddle' />&nbsp;&nbsp;<a onclick='LikeAll()'>Click to like all!</a>"
       
        body.appendChild(div);
       
        unsafeWindow.LikeAll = function() {
                document.getElementsByClassName("submit-button-more")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
                document.getElementsByClassName("link-green")[0].click();
 
                buttons = document.getElementsByTagName("button");
                for(i = 0; i < buttons.length; i++) {
                        myClass = buttons[i].getAttribute("class");
                        if(myClass != null && myClass.indexOf("like") >= 0)
                                if(buttons[i].getAttribute("name") == "likern false;")
                                        buttons[i].click();
                }
               
        };
}