-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ee808d5
Showing
12 changed files
with
648 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# <img src="./icons/default48.png" /> DescriCookie – Cookie descriptor! | ||
This extensions list the cookies in the active tab and describe them with information from the [Open-Cookie-Database](https://github.com/jkwakman/Open-Cookie-Database). | ||
|
||
## How to use | ||
1. Download the latest release of that repository. | ||
2. <img src="https://design.firefox.com/product-identity/firefox/firefox/firefox-logo.png" height=16px /> Firefox: [Follow these instructions](https://extensionworkshop.com/documentation/publish/distribute-sideloading/#install-addon-from-file). | ||
3. <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Google_Chrome_icon_%28September_2014%29.svg/2048px-Google_Chrome_icon_%28September_2014%29.svg.png" height="16px" /> Chrome: [Follow these instructions](https://www.howtogeek.com/120743/how-to-install-extensions-from-outside-the-chrome-web-store/). | ||
|
||
## Credits | ||
- Cookie descriptions from [Open-Cookie-Database](https://github.com/jkwakman/Open-Cookie-Database). | ||
- Squeleton for the project from [webextensions-examples](https://github.com/mdn/webextensions-examples). | ||
- Example of [Papa Parse](https://www.papaparse.com/) from [Reading csv file using JavaScript and HTML5](https://www.js-tutorials.com/javascript-tutorial/reading-csv-file-using-javascript-html5/). | ||
- Icon from [Game-icons.net](https://game-icons.net/) and a little bit of magic. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
html, body { | ||
width: 500px; | ||
} | ||
|
||
.panel { | ||
padding: 5px; | ||
} | ||
|
||
li { | ||
margin-bottom: 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="stylesheet" href="cookies.css"/> | ||
<script src="papaparse.min.js"></script> | ||
</head> | ||
|
||
<body> | ||
<div class="panel"> | ||
<div class="panel-section panel-section-header"> | ||
<div class="text-section-header" id="header-title"></div> | ||
</div> | ||
<ul id="cookie-list"></ul> | ||
</div> | ||
<script src="cookies.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
var resultingData; | ||
|
||
function getDatabase() { | ||
var retour; | ||
Papa.parse("https://raw.githubusercontent.com/jkwakman/Open-Cookie-Database/master/open-cookie-database.csv", { | ||
header: true, | ||
download: true, | ||
before: function(file, inputElem) | ||
{ | ||
console.log("Parsing file...", file); | ||
}, | ||
error: function(err, file) | ||
{ | ||
console.log("ERROR:", err, file); | ||
}, | ||
complete: function(results) | ||
{ | ||
retour = results["data"]; | ||
showCookiesForTab(retour); | ||
} | ||
}); | ||
} | ||
|
||
async function showCookiesForTab(retour) { | ||
let tabs = await getActiveTab(); | ||
let tab = tabs.pop(); | ||
|
||
var gettingAllCookies = browser.cookies.getAll({url: tab.url}); | ||
gettingAllCookies.then((cookies) => { | ||
var cookieList = document.getElementById('cookie-list'); | ||
|
||
if (cookies.length > 0) { | ||
var found = 0; | ||
var counter = 0; | ||
for (let cookie of cookies) { | ||
copie = []; | ||
retour.forEach(function(item) { | ||
if (item["Cookie / Data Key name"] == cookie.name) { | ||
copie.push(item); | ||
} | ||
}); | ||
|
||
if (copie.length == 1) { | ||
found += 1; | ||
|
||
let li = document.createElement("li"); | ||
let content = document.createTextNode(cookie.name + ": "); | ||
|
||
let infos = document.createElement("ul"); | ||
|
||
let platform = document.createElement("li"); | ||
let platform_infos = document.createTextNode("Platform: " + copie[0]["Platform"]); | ||
platform.appendChild(platform_infos); | ||
infos.appendChild(platform); | ||
|
||
let category = document.createElement("li"); | ||
let category_infos = document.createTextNode("Category: " + copie[0]["Category"]); | ||
category.appendChild(category_infos); | ||
infos.appendChild(category); | ||
|
||
let description = document.createElement("li"); | ||
let description_infos = document.createTextNode("Description: " + copie[0]["Description"]); | ||
description.appendChild(description_infos); | ||
infos.appendChild(description); | ||
|
||
let period = document.createElement("li"); | ||
let period_infos = document.createTextNode("Retention period: " + copie[0]["Retention period"]); | ||
period.appendChild(period_infos); | ||
infos.appendChild(period); | ||
|
||
li.appendChild(content); | ||
li.appendChild(infos); | ||
cookieList.appendChild(li); | ||
} else { | ||
counter += 1; | ||
} | ||
} | ||
if (counter > 0) { | ||
let li = document.createElement("li"); | ||
var content; | ||
if (found > 0) { | ||
content = document.createTextNode("... And " + counter + " more cookies with no infos found."); | ||
} else { | ||
content = document.createTextNode(counter + " cookies with no infos found."); | ||
} | ||
li.appendChild(content); | ||
cookieList.appendChild(li); | ||
} | ||
} else { | ||
let li = document.createElement("li"); | ||
let content = document.createTextNode("No cookies found in this tab."); | ||
li.appendChild(content); | ||
cookieList.appendChild(li); | ||
} | ||
|
||
var activeTabUrl = document.getElementById('header-title'); | ||
var text = document.createTextNode("Found " + (found + counter) + " cookies on " + tab.title); | ||
activeTabUrl.appendChild(text); | ||
}); | ||
} | ||
|
||
function getActiveTab() { | ||
return browser.tabs.query({currentWindow: true, active: true}); | ||
} | ||
|
||
getDatabase(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"browser_action": { | ||
"browser_style": true, | ||
"default_title": "List cookies in the active tab", | ||
"default_popup": "cookies.html", | ||
"default_icon": { | ||
"19": "icons/default19.png", | ||
"38": "icons/default38.png" | ||
} | ||
}, | ||
"description": "List cookies in the active tab.", | ||
"icons": { | ||
"48": "icons/default48.png", | ||
"96": "icons/default96.png" | ||
}, | ||
"homepage_url": "https://github.com/hestiaAI/DescriCookie", | ||
"manifest_version": 2, | ||
"name": "DescriCookie – Cookie descriptor!", | ||
"version": "1.0", | ||
"permissions": ["cookies","<all_urls>","tabs"] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.