簡體   English   中英

這段代碼有什么作用?

[英]What does this code do?

抱怨缺乏不喜歡按鈕的行為在Facebook上風行一時,各種各樣的團體如雨后春筍般涌現,提供不喜歡按鈕,但前提是您邀請了x個朋友。

其中一個(可能是偽造的?)組之一要求您在加入過程中運行Javascript。 我從來沒有做過網絡編碼,所以我想知道是否有人可以告訴我下面的代碼做什么?

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

該群組的鏈接在這里: |►OFFICEIALDislike Button™終於在這里◄| 立即添加,它可以正常工作! 該代碼在“最新新聞”部分的3個步驟下列出。

// 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]); 
     } 
} 

基本上,此代碼會引起您所有朋友團體邀請 ;-)

這將獲取id為'friends'的元素中的所有li元素,然后遍歷它們,如果是'object',則執行fs.click(elms [fid])

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM