This commit is contained in:
EvolvedCode
2016-10-17 21:09:51 +03:00
parent f8b539ea7a
commit 23d5da2ffc
3 changed files with 12 additions and 14 deletions

View File

@@ -10,7 +10,7 @@ html, body {
cursor: pointer;
}
.button:hover {
.beast:hover {
background-color: #CFF2F2;
}
@@ -25,8 +25,3 @@ html, body {
.clear:hover {
background-color: #EAEA9D;
}
.inactive {
opacity: 0;
pointer-events: none;
}

View File

@@ -12,18 +12,18 @@ function beastNameToURL(beastName) {
}
}
/*
Listen for clicks in the popup.
If the click is not on one of the beasts, return early.
If the click is on one of the beasts:
Inject the "beastify.js" content script in the active tab.
Otherwise, the text content of the node is the name of the beast we want.
Then get the active tab and send "beastify.js" a message
containing the URL to the chosen beast's image.
Inject the "beastify.js" content script in the active tab.
Then get the active tab and send "beastify.js" a message
containing the URL to the chosen beast's image.
If it's on a button wich contains class "clear":
Reload the page.
Close the popup. This is needed, as the content script malfunctions after page reloads.
*/
document.addEventListener("click", function(e) {
if (e.target.classList.contains("beast")) {
@@ -37,7 +37,7 @@ document.addEventListener("click", function(e) {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {beastURL: chosenBeastURL});
});
return;
}
else if (e.target.classList.contains("clear")) {