Last active
August 29, 2015 14:15
-
-
Save yuvallanger/b60176e21581c61726a5 to your computer and use it in GitHub Desktop.
Removes IMDB descriptions
This file contains hidden or 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
| // ==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