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 but开发者_运维技巧ton, 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 ;-)
This will fetch all the li elements in the element with the id 'friends' and then loop through them and if it's an 'object' perform fs.click(elms[fid])
精彩评论