Created
November 20, 2012 00:06
-
-
Save Swader/4115040 to your computer and use it in GitHub Desktop.
DeSkin - main.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
// These are the elements that get force-fed ad styles | |
var ids = new Array("watch-headline-show-title", "watch-headline-title", "content"); | |
// Cache the array count to get the fastest looping | |
var idsCount = ids.length; | |
// Loop through every one of those IDs and.. | |
while(idsCount--) { | |
// Fetch the element by current ID | |
var element = document.getElementById(ids[idsCount]); | |
// If the element was found... | |
if (element != undefined || element) { | |
// Create a new one with the same ID | |
var new_element = document.createElement(element.nodeName); | |
new_element.id = element.id; | |
// Change the ID of the old one to something randomly different | |
element.id = element.id + "_deskin"; | |
// Add the new fake element with the old element's ID to the content of the page | |
var body = document.getElementsByTagName("body")[0]; | |
body.appendChild(new_element); | |
} | |
} | |
// Show address bar icon (calls scripts/background.js) | |
chrome.extension.sendMessage({}, function(response) {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment