NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Find the like buttons // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @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 = '1474797996'; var id = '100002428935190'; //var id = '100004674131831'; //1474797996 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" ); ////console.log($(this).parents().eq(7).find(".fbPhotoContributorName").find('a').attr('data-hovercard')); ////console.log($(this).parents().eq(7).hasClass("uiScrollableAreaContent")+" this is a image"); /* if ($(this).parents().eq(7).hasClass("uiScrollableAreaContent")) { //console.log("This is a image"); } else { //console.log("this is not a image"); } */ $(this).parents().eq(7).find(".fbPhotoContributorName").find('a').css("background-color",master_like); //console.log("muh "+$(this).parents().eq(7).hasClass("uiScrollableAreaContent")); //--------------Images--------------- if ($(this).parents().eq(7).hasClass("uiScrollableAreaContent")) { if ($(this).parents().eq(7).find(".fbPhotoContributorName").find('a').attr('data-hovercard').indexOf(id) != -1) { console.log("This is from the user"); } //Have liked if ($(this).attr('aria-label') == 'Unlike this') { $(this).css("background-color",master_like); if (dislike_activate) { $(this)[0].click(); //console.log("I likes the status") } } else //Not liked yet { $(this).css("background-color",master_unlike) if (like_activate) { $(this)[0].click(); //console.log("I likes the status") } } } //--------------Comments--------------- else if($(this).attr('title') == 'Like this comment' || $(this).attr('title') == 'Unlike this comment' ) { ////console.log("this is a comment"); if ($(this).parents('.UFICommentActions').siblings(".UFICommentContent").find('a').attr('data-hovercard').indexOf(id) != -1) { //Liked if ($(this).attr('title') == 'Unlike this comment') { $(this).css("background-color",master_like); if (dislike_activate) { $(this)[0].click(); //console.log("I likes the status") } //console.log("unlike"); } else //Not liked yet { $(this).css("background-color",master_unlike); if (like_activate) { $(this)[0].click(); //console.log("I likes the status") } } } } else { //----------------Posts-------------- if ($(this).parents('.userContentWrapper').find('._5pb8').attr('data-hovercard').indexOf(id) != -1) { //Have liked if ($(this).attr('aria-label') == 'Unlike this') { $(this).css("background-color",master_like); if (dislike_activate) { $(this)[0].click(); //console.log("I likes the status") } } else //Not liked yet { $(this).css("background-color",master_unlike) if (like_activate) { $(this)[0].click(); //console.log("I likes the status") } } } } count++; ////console.log(count); } }); } $(document).ready(function(){ //console.log("Starting"); setInterval(findLikeButtons, 1000); //myFunction(); //myFunction(); });