I think I am having trouble visualizing what code goes where and what requests and responses go where.
Let's say I want to alter all <img>
tags in the body of a document. I am sure I would adjust there styling in the inject.js file,...but would I still need to send a request to background.html? If so,...I am not sure what the response would be.
Thanks for your help!
(CONT)
Does this code make any sense? I am trying to grab <div>
tags and make them disappear. Then reload them one by one (fifo) after each press of the command and semi-colon keys. Here is the .js file I wanted to inject.
var hideShowElements = document.getElementsByTagName('div');
var queue = [];
var active = false;
function hide(){
for (var i = 0; i < hideShowElements.length; i++) {
hideShowElements[i].style.visibility == "hidden";
queue.push(hideShowElements[i]);
}
}
hide();
document.onkeydown = function(k){
if(k.isCtrl || k.keyCode == 91) active = true;
if(active && k.keyCode == 186){
for (var i = 0; i < queue.length; i++){
queue[i].style.visibility == "visible";
}
}
}
document.onkeyup = function(k){
if(k.isCtrl || k.keyCode == 91) active = false;
}