Created
August 6, 2012 05:11
-
-
Save shunsugai/3270902 to your computer and use it in GitHub Desktop.
removeAd
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
var classes = [ | |
'plugin-free_area plugin-box', | |
'maist' | |
]; | |
var ids = [ | |
'ad' | |
]; | |
var removeAdByClass = function(className) { | |
var list = document.getElementsByClassName(className); | |
for(var i = 0; i < list.length; i++) { | |
var elem = list.item(i); | |
elem.parentNode.removeChild(elem); | |
} | |
} | |
var removeAdById = function(id) { | |
(var elem = document.getElementById(id)).parentNode.removeChild(elem); | |
} | |
var map = function(array, method) { | |
for (var i = 0; i < array.length; i++) { | |
method(array[i]); | |
} | |
} | |
map(classes, removeAdByClass); | |
map(ids , removeAdById); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment