small fixes
This commit is contained in:
parent
e7c94a0f8b
commit
e55fc889bc
3 changed files with 16 additions and 9 deletions
|
@ -7,12 +7,16 @@ function handleMessage(request, sender, sendResponse) {
|
|||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = function () {
|
||||
var found;
|
||||
if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {
|
||||
found = true;
|
||||
chrome.browserAction.enable(tabId);
|
||||
} else {
|
||||
found = false;
|
||||
chrome.browserAction.disable(tabId);
|
||||
if (xmlHttp.readyState === 4) {
|
||||
if (xmlHttp.status === 200) {
|
||||
found = true;
|
||||
chrome.browserAction.enable(tabId);
|
||||
} else {
|
||||
found = false;
|
||||
chrome.browserAction.disable(tabId);
|
||||
chrome.browserAction.setBadgeText({text: "t3", tabId: tabId});
|
||||
chrome.browserAction.setBadgeBackgroundColor({color: "#FF8700", tabId: tabId});
|
||||
}
|
||||
}
|
||||
var data = {};
|
||||
data[request.url] = {
|
||||
|
@ -27,9 +31,10 @@ function handleMessage(request, sender, sendResponse) {
|
|||
} else {
|
||||
if (data.found) {
|
||||
chrome.browserAction.enable(tabId);
|
||||
console.info("found");
|
||||
} else {
|
||||
chrome.browserAction.disable(tabId);
|
||||
chrome.browserAction.setBadgeText({text: "t3", tabId: tabId});
|
||||
chrome.browserAction.setBadgeBackgroundColor({color: "#FF8700", tabId: tabId});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"short_name": "mask-detector",
|
||||
"version": "0.0.1",
|
||||
"author": "Lukas Winkler",
|
||||
"description": "find sites using the mask Typo3 extension",
|
||||
"description": "find websites using the mask Typo3 extension",
|
||||
"icons": {
|
||||
"128": "logo.128.png"
|
||||
},
|
||||
|
|
4
popup.js
4
popup.js
|
@ -2,7 +2,9 @@ chrome.tabs.query({active: true}, function (tabs) {
|
|||
var url = new URL(tabs[0].url);
|
||||
var key = url.protocol + "//" + url.host;
|
||||
chrome.storage.local.get(key, function (result) {
|
||||
document.getElementById("lastModified").innerText = result[key].modified;
|
||||
if(result[key]) {
|
||||
document.getElementById("lastModified").innerText = result[key].modified;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Reference in a new issue