Skip to content

Instantly share code, notes, and snippets.

View atommarvel's full-sized avatar

Atom Raiff atommarvel

View GitHub Profile
@atommarvel
atommarvel / Goodbye Buzzfeed
Created November 13, 2013 19:04
Remove any post that contains the strings in strings2block. Initially it contains buzz, feed, and buzzfeed.
var posts = document.getElementsByClassName("userContent");
var strings2block = ["buzz","feed","buzzfeed"]
var doesPostContainBlock = function(postContent, blockContent){
for (y in blockContent){
if(postContent.search(blockContent[y])>0)
return true;
}
return false;
}
updateWidget: function(e){
//should be able to replace all these if statements by accessing the variable being changed which is identical to the target's name attribute
if(e.target.getAttribute("name")=="name"){
this.state.widget.setState({name: e.target.value});
return false;
}
else if(e.target.getAttribute("name")=="phone"){
this.state.widget.setState({phone: e.target.value});
return false;
}
var songs = document.getElementsByClassName("track-list ui-sortable")[1].children;
var final = "";
var trackInfo = "";
var artistName = "";
var trackName = "";
for (var track=0;track<songs.length;track++) {
trackInfo = songs[track].getElementsByClassName("track-info")[0];
artistName = trackInfo.getElementsByClassName("album-name")[0].textContent.trim();
trackName = trackInfo.getElementsByClassName("name")[0].textContent.trim();
final += artistName + " - " + trackName + "\n";