简体   繁体   中英

What does this code do?

Moaning about the lack of a dislike button is all the rage on Facebook at the moment and various groups have sprung up offering a dislike button, but only after you've invited x amount of your friends.

One of the more (possibly devious?) groups requires you to run Javascript as part of the joining process. I haven't ever done web coding so I'm wondering if someone can tell me what the following code does?

javascript:elms=document.getElementById('friends').getElementsByTagName('li');
for(var fid in elms){
     if(typeof elms[fid] === 'object'){
          fs.click(elms[fid]);
     }
}

The link to the group is here: |►OFFICIAL Dislike Button™ is Finally Here◄| Add it Now, it ACTUALLY WORKS! . The code is listed under the 3 steps in the recent news section.

// Find the Element in the webpage that has the ID "friends", which is the list of your friends ;-)
javascript:elms=document.getElementById('friends').getElementsByTagName('li'); 
// Iterate over every friend in the list
for(var fid in elms){ 
     // just a validation
     if(typeof elms[fid] === 'object'){ 
          // Click on the invite to Group button
          fs.click(elms[fid]); 
     } 
} 

Basically, this code causes a group invitation for all of your friends ;-)

这将获取id为'friends'的元素中的所有li元素,然后遍历它们,如果是'object',则执行fs.click(elms [fid])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM