Skip to content

Instantly share code, notes, and snippets.

@yuvallanger
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save yuvallanger/b60176e21581c61726a5 to your computer and use it in GitHub Desktop.

Select an option

Save yuvallanger/b60176e21581c61726a5 to your computer and use it in GitHub Desktop.
Removes IMDB descriptions
// ==UserScript==
// @name imdb de-spoiler
// @namespace yuval.langer@gmail.com
// @description removes imdb descriptions
// @include http://imdb.com/title/*
// @include http://*.imdb.com/title/*
// @version 0.3
// @grant none
// ==/UserScript==
function getTagsWithAttribute(tagName, tagAttribute, tagAttributeContent) {
var ourTags = document.getElementsByTagName(tagName);
var retTags = [
];
for (var i = 0; i < ourTags.length; i++) {
if (ourTags[i].getAttribute(tagAttribute) == tagAttributeContent) {
retTags.push(ourTags[i]);
}
}
return retTags;
}
function removeTagsWithAttribute(tagName, tagAttribute, tagAttributeContent) {
var ourTags = getTagsWithAttribute(tagName, tagAttribute, tagAttributeContent);
for (var i = 0; i < ourTags.length; i++) {
ourTags[i].parentNode.removeChild(ourTags[i]);
}
}
function removeTagAttrAttrContentList(tagAttrAttrContentList) {
for (var i = 0; i < tagAttrAttrContentList.length; i++) {
var tagName = tagAttrAttrContentList[i][0];
var tagAttribute = tagAttrAttrContentList[i][1];
var tagAttributeContent = tagAttrAttrContentList[i][2];
removeTagsWithAttribute(tagName, tagAttribute, tagAttributeContent);
}
}
var tagAttrAttrContentList = [
[
'p',
'itemprop',
'description'
],
[
'div',
'itemprop',
'description'
],
[
'div',
'class',
'rec-outline'
],
[
'p',
'itemprop',
'reviewBody'
]
];
removeTagAttrAttrContentList(tagAttrAttrContentList);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment