Skip to content

Commit

Permalink
updated: Iterate through the iframe array only once.
Browse files Browse the repository at this point in the history
  • Loading branch information
gf3 committed May 3, 2010
1 parent ee00093 commit 708d9bc
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions blocker.js
Expand Up @@ -15,15 +15,12 @@
head.appendChild(ss);

// for some reason qSA throws an error on selecting iframes by src.
Array.prototype.slice.call(document.querySelectorAll('iframe')).filter(function(v,k,arra){
if (v.src.indexOf('http://www.facebook.com/plugins/like.php') === 0) return true;
}).forEach(function(v,k,arr){

Array.prototype.slice.call(document.querySelectorAll('iframe')).forEach(function(v,k,arra){
if (v.src.indexOf('http://www.facebook.com/plugins/like.php') === 0) {
// kill the iframe to avoid the 12 resources from downloading.
// thx @raycmorgan
// Yes, that's 12 requests PER like button: http://bit.ly/fblikeperfisbad (see Act Three)
v.parentNode.removeChild(v);
})
}
});



0 comments on commit 708d9bc

Please sign in to comment.