Skip to content

Instantly share code, notes, and snippets.

@tzi
Created March 27, 2013 15:18
Show Gist options
  • Save tzi/5255011 to your computer and use it in GitHub Desktop.
Save tzi/5255011 to your computer and use it in GitHub Desktop.
FBFilterVideo.js
(function filterArticle() {
var querySettings = [
[".uiUnifiedStory", ".shareRedesignVideo"],
[".fbTimelineUnit", "._1xz"]
];
var keepVideoContainer = function keepVideoContainer(articles, queryEmbedVideo) {
for ( var i = 0; i < articles.length; i++) {
var video = articles[i].querySelectorAll(queryEmbedVideo);
if (video.length == 0) {
articles[i].parentNode.removeChild(articles[i]);
}
}
}
var filterArticleType = function filterArticleType(queryArticle, queryEmbedVideo) {
var articles = document.querySelectorAll(queryArticle);
if (articles) {
keepVideoContainer(articles, queryEmbedVideo);
setTimeout(function(){filterArticle(queryArticle, queryEmbedVideo)}, 1000);
}
}
for ( var i = 0; i < querySettings.length; i++) {
filterArticleType(querySettings[i][0], querySettings[i][1]);
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment