Created
March 27, 2013 15:18
-
-
Save tzi/5255011 to your computer and use it in GitHub Desktop.
FBFilterVideo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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