Instagram auto like Bookmarklet

Instagram Like (heart) automatic click Bookmark

Purpose: Click Serious Heart at http://www.gramfeed.com/instagram/tags#photo

Here is the code I worked with. It worked on another site,

var a = document.getElementsByTagName('a'); var b = []; for(var i=0, len = a.length; i < len; i++){ if(a[i].id.indexOf('like') !== -1){b.push(a[i]) } }; for(var i=0, len = b.length; i < len; i++){ b[i].click() }; 
+2
javascript like bookmarklet instagram
source share
1 answer

The following should work; I tested it at my end and he likes hearts (although this does not work, since I have not logged in, etc.).

 javascript:(function(){for(i=0;i<document.getElementsByTagName('img').length;i++){if((' '+document.getElementsByTagName('img')[i].className+' ').indexOf(' liker ')> -1){document.getElementsByTagName('img')[i].click();}}})(); 

As for the verification of the class β€œfunction”, then the loan for which the loan should be obtained, in relation to this answer.

Update

 javascript:(function(){for(i=0;i<document.getElementsByTagName('img').length;i++){if((' '+document.getElementsByTagName('img')[i].className+' ').indexOf(' liker ')>-1){var t=document.getElementsByTagName('img')[i];if(document.dispatchEvent){var o=document.createEvent('MouseEvents');o.initMouseEvent('click',true,true,window,1,1,1,1,1,false,false,false,false,0,t);t.dispatchEvent(o)}else if(document.fireEvent){t.fireEvent('onclick')}else if(t.click()){t.click()}}}})(); 

I'm still not sure if this code really works, but it still 'worked' in jsfiddle (drag the link to the bar button, click the link in the button bar, watch the console).

0
source share

All Articles