incaner / Ask.fm AutoLiker

// ==UserScript==
// @name			Ask.fm AutoLiker
// @version			1.2
// @description		Auto Like Ask.fm
// @include			*://ask.fm/*
// @require https://code.jquery.com/jquery-3.3.1.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/notify/0.4.2/notify.min.js
// @ressource notify https://cdnjs.cloudflare.com/ajax/libs/notify/0.4.2/styles/metro/notify-metro.min.css
// @grant       GM_addStyle
// @grant       GM_getResourceText
// @copyright 2019, incaner (https://openuserjs.org//users/incaner)
// @license MIT
// ==/UserScript==
// ==Profile==

var notifyCSS = GM_getResourceText ("notify");
GM_addStyle (notifyCSS);


// ==============
// ==Like All==
var body = document.body;
if(body != null) {
    var div = document.createElement("div");
    div.setAttribute('id','like2');
    div.style.position = "fixed";
    div.style.display = "block";
    div.style.opacity= 0.90;
    div.style.bottom = "+42px";
    div.style.left = "+6px";
    div.style.padding = "2px";
    div.innerHTML = "<button id='autoLikeBtn' class='btn-primary' onclick='autoLike()'>Like everything</button>";
    body.appendChild(div);

    unsafeWindow.autoLike = function() {
        var buttons = $("a.icon-like:not(.active)");
        var counter = 0;

        for(counter = 0; counter < buttons.length; counter++) {
                buttons[counter].click();
        }

        $("#autoLikeBtn").notify("Liked: " + counter, { position:"top center" } );

    };
}