first working version
This commit is contained in:
commit
4d6d63bf19
7 changed files with 106 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.idea/
|
38
background.js
Normal file
38
background.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
function handleMessage(request, sender, sendResponse) {
|
||||
var tabId = sender.tab.id;
|
||||
if (request.typo3) {
|
||||
chrome.storage.local.get(request.url, function (result) {
|
||||
var data = result[request.url];
|
||||
if (!data || Date.now() - data.updated > 1000 * 60) {
|
||||
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);
|
||||
}
|
||||
var data = {};
|
||||
data[request.url] = {found: found, modified: false, updated: Date.now()};
|
||||
chrome.storage.local.set(data);
|
||||
};
|
||||
xmlHttp.open("GET", request.url + "/typo3conf/ext/mask/ext_icon.gif", true);
|
||||
xmlHttp.send();
|
||||
} else {
|
||||
if (data.found) {
|
||||
chrome.browserAction.enable(tabId);
|
||||
console.info("found");
|
||||
} else {
|
||||
chrome.browserAction.disable(tabId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
chrome.browserAction.disable(tabId);
|
||||
}
|
||||
}
|
||||
|
||||
chrome.runtime.onMessage.addListener(handleMessage);
|
4
contentscript.js
Normal file
4
contentscript.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
chrome.runtime.sendMessage({
|
||||
typo3: document.head.innerHTML.indexOf("This website is powered by TYPO3") !== -1,
|
||||
url: window.location.protocol + "//" + window.location.host
|
||||
});
|
BIN
logo.128.png
Normal file
BIN
logo.128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
18
logo.svg
Normal file
18
logo.svg
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="156px" height="156px" viewBox="0 0 156 156" enable-background="new 0 0 156 156" xml:space="preserve">
|
||||
<g id="Ebene_5">
|
||||
<rect y="-0.006" fill="#D4372F" width="156" height="156.006"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M78.832,65.861c-42.577,0-65.75-22.59-66,6c1.163,30.728,21.47,28.14,29,26
|
||||
c7.157-2.033,31.357-9.361,31.357-9.361c2.418-0.967,5.561-1.209,8.611-0.125c8.367,2.971,20.537,8.066,29.863,10.176
|
||||
c15.066,3.117,29.117-2.301,30.17-26.695C143.091,42.707,121.409,65.861,78.832,65.861z"/>
|
||||
<path fill="#D4372F" d="M55.448,81.583c-10.5,4.498-20.952,3.875-21.113,3.758c-7.063-5.137-6.995-13.083-6.995-13.083
|
||||
c0.164,0,32.771,4.275,35.103,4.923C62.892,77.306,59.981,79.642,55.448,81.583z"/>
|
||||
<path fill="#D4372F" d="M120.249,85.21c0,0-9.066,1.166-21.762-4.275c-1.471-0.631-6.9-3.883-6.08-4.051
|
||||
c0.104-0.021,34.709-4.541,34.727-4.755C127.134,72.128,128.374,78.192,120.249,85.21z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
35
manifest.json
Normal file
35
manifest.json
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Mask Detector",
|
||||
"short_name": "mask-detector",
|
||||
"version": "0.0.1",
|
||||
"author": "Lukas Winkler",
|
||||
"description": "find sites using the mask Typo3 extension",
|
||||
"icons": {
|
||||
"128": "logo.128.png"
|
||||
},
|
||||
"browser_action": {
|
||||
"default_icon": {
|
||||
"128": "logo.128.png"
|
||||
},
|
||||
"default_popup": "popup.html"
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["<all_urls>"],
|
||||
"js": ["contentscript.js"]
|
||||
}
|
||||
],
|
||||
|
||||
"permissions": [
|
||||
"storage",
|
||||
"http://*/",
|
||||
"https://*/",
|
||||
"tabs"
|
||||
],
|
||||
"background": {
|
||||
"scripts": [
|
||||
"background.js"
|
||||
]
|
||||
}
|
||||
}
|
10
popup.html
Normal file
10
popup.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
Reference in a new issue