Skip to content

Instantly share code, notes, and snippets.

@ajvpot

ajvpot/full.js

Created Nov 4, 2012
Embed
What would you like to do?
Facebook Blurrer
function getElementsByClassName(className){
var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)");
var allElements = document.getElementsByTagName("*");
var results = [];
var element;
for (var i = 0; (element = allElements[i]) != null; i++) {
var elementClass = element.className;
if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass))
results.push(element);
}
return results;
}
var classes = ["img","uiLinkSubtle","UFICommentActorName", "fwb", "-cx-PRIVATE-uiImageBlock__smallContent"];
for (var i=0;i<classes.length;i++){
console.log("doing "+classes[i])
elems = getElementsByClassName(classes[i]);
for (var x=0;x<elems.length;x++){
elems[x].setAttribute('style','-webkit-filter: blur(5px);');
}
}

Before

Before

##After After

function getElementsByClassName(e){var t=new RegExp("(?:^|\\s)"+e+"(?:$|\\s)");var n=document.getElementsByTagName("*");var r=[];var i;for(var s=0;(i=n[s])!=null;s++){var o=i.className;if(o&&o.indexOf(e)!=-1&&t.test(o))r.push(i)}return r}var classes=["img","uiLinkSubtle","UFICommentActorName","fwb","-cx-PRIVATE-uiImageBlock__smallContent"];for(var i=0;i<classes.length;i++){console.log("doing "+classes[i]);elems=getElementsByClassName(classes[i]);for(var x=0;x<elems.length;x++){elems[x].setAttribute("style","-webkit-filter: blur(5px);")}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.