Gheotic / LikeEssential

// ==UserScript==
// @name         LikeEssential
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Nothing really
// @author       You
// @match        https://www.facebook.com/*
// @require    http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
// @grant        *

// ==/UserScript==
/* jshint -W097 */

'use strict';
var count = 0;

var id = '1511400362';


var master_unlike = "red";
var master_like = "pink";
var like_activate = true;
var dislike_activate = false;


function findLikeButtons() {

    $( ".UFILikeLink" ).each(function() {
        
        if ( $(this).is( ".checked" )) {

            
        } 
        else 
        {
            $(this).addClass( "checked" );

           

            if ($(this).parents().eq(7).hasClass("uiScrollableAreaContent")) 
            {
                                
                if ($(this).parents().eq(7).find(".fbPhotoContributorName").find('a').attr('data-hovercard').indexOf(id) != -1)
                {

                }

                if ($(this).attr('aria-label') == 'Unlike this')
                {

                    if (dislike_activate) {
                                $(this)[0].click();
                            
                    }
                }
                else 
                {

                    if (like_activate) {
                        $(this)[0].click();
                    }
                }
            }

            
            else  if($(this).attr('title') == 'Like this comment' || $(this).attr('title') == 'Unlike this comment'  )
            {
                if ($(this).parents('.UFICommentActions').siblings(".UFICommentContent").find('a').attr('data-hovercard').indexOf(id) != -1)
                {
                    if ($(this).attr('title') == 'Unlike this comment')
                    {
                        if (dislike_activate) {
                                $(this)[0].click();
                        }
                    }
                    else 
                    {

                        if (like_activate) {
                                $(this)[0].click();
                        }
                        

                    }
                }
               

            } 
            else                
            {
 
                if ($(this).parents('.userContentWrapper').find('._5pb8').attr('data-hovercard').indexOf(id) != -1)
                    {
                        if ($(this).attr('aria-label') == 'Unlike this')
                        {

                            if (dislike_activate) {
                                $(this)[0].click();
                        }
                        }
                        else 
                        {
                            if (like_activate) {
                                $(this)[0].click();
                            }
                        }
                    }         
            }
            

            count++;
        }
        });
}

$(document).ready(function(){ 
    setInterval(findLikeButtons, 2000);    
});