Commit 8c42996d authored by Ren, Ian's avatar Ren, Ian

Update content.js

parent a5702ff6
var priceBox = document.getElementsByClassName('prices___1JkR4');
for(var i = 0; i < priceBox.length; i++){
priceBox[i].style.backgroundColor = "lightblue";
}
\ No newline at end of file
// Unique ID for the className.
var MOUSE_VISITED_CLASSNAME = 'crx_mouse_visited';
var srcName;
// Previous dom, that we want to track, so we can remove the previous styling.
//var prevDOM = null;
// Mouse listener for any move event on the current document.
document.addEventListener('mousemove', function (e) {
let srcElement = e.srcElement;
// Lets check if our underlying element is a IMG.
if (srcElement.nodeName == 'IMG') {
//if (srcElement.nodeName == 'DIV' && srcElement.className == "content___1O9rr") {
//prevDOM != srcElement &&
srcName = srcElement.alt;
// For NPE checking, we check safely. We need to remove the class name
// Since we will be styling the new one after.
// if (prevDOM != null) {
// prevDOM.classList.remove(MOUSE_VISITED_CLASSNAME);
// }
// Add a visited class name to the element. So we can style it.
// if (srcName == "Waitrose coffee & walnut cake") {
// srcElement.classList.add(MOUSE_VISITED_CLASSNAME);
// }
srcElement.classList.add(MOUSE_VISITED_CLASSNAME);
// The current element is now the previous. So we can remove the class
// during the next ieration.
//prevDOM = srcElement;
console.info(srcElement.currentSrc);
console.dir(srcElement);
}
}, false);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment