Create icon for each indicating state in the toolbar(HTTPS, Bittorrent, HTTPS+Bittorrent, X-I2P-Location) with our own lock icons for .i2p sites, https .i2p sites
This commit is contained in:
59
scrub.js
59
scrub.js
@@ -677,10 +677,17 @@ var coolheadersSetup = function (e) {
|
||||
tabId: e.tabId,
|
||||
popup: "torrent.html",
|
||||
});
|
||||
browser.pageAction.setIcon({
|
||||
path: "icons/i2plogo.png",
|
||||
tabId: e.tabId,
|
||||
});
|
||||
if (tab.url.startsWith("https")){
|
||||
browser.pageAction.setIcon({
|
||||
path: "icons/infotoopiesbt.png",
|
||||
tabId: e.tabId,
|
||||
});
|
||||
}else{
|
||||
browser.pageAction.setIcon({
|
||||
path: "icons/infotoopiebpt.png",
|
||||
tabId: e.tabId,
|
||||
});
|
||||
}
|
||||
browser.pageAction.setTitle({
|
||||
tabId: e.tabId,
|
||||
title: header.value,
|
||||
@@ -698,6 +705,18 @@ var coolheadersSetup = function (e) {
|
||||
|
||||
function getTabURL(tab) {
|
||||
if (tab.url.startsWith("https")) {
|
||||
console.log(tab.url)
|
||||
if (tab.url.endsWith(".i2p/")){
|
||||
browser.pageAction.setPopup({
|
||||
tabId: tab.id,
|
||||
popup: "security.html",
|
||||
});
|
||||
browser.pageAction.setIcon({
|
||||
path: "icons/infotoopies.png",
|
||||
tabId: tab.id,
|
||||
});
|
||||
//console.log("(background) tabinfo", tabInfo[0].id)
|
||||
}
|
||||
try {
|
||||
browser.tabs
|
||||
.sendMessage(tab.id, { req: "i2p-location" })
|
||||
@@ -710,7 +729,35 @@ function getTabURL(tab) {
|
||||
popup: "location.html",
|
||||
});
|
||||
browser.pageAction.setIcon({
|
||||
path: "icons/toopies.png",
|
||||
path: "icons/i2plogo.png",
|
||||
tabId: tab.id,
|
||||
});
|
||||
browser.pageAction.setTitle({
|
||||
tabId: tab.id,
|
||||
title: response.content,
|
||||
});
|
||||
browser.pageAction.show(tab.id);
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log("(pageaction)", tab.id, tab.url);
|
||||
} catch (e) {
|
||||
console.log("(pageaction)", e);
|
||||
}
|
||||
|
||||
try {
|
||||
browser.tabs
|
||||
.sendMessage(tab.id, { req: "i2p-torrentlocation" })
|
||||
.then((response) => {
|
||||
if (response != undefined) {
|
||||
console.log("(scrub) i2p-location response object", response);
|
||||
if (response.content.toUpperCase() != "NO-ALT-LOCATION") {
|
||||
browser.pageAction.setPopup({
|
||||
tabId: tab.id,
|
||||
popup: "torrent.html",
|
||||
});
|
||||
browser.pageAction.setIcon({
|
||||
path: "icons/infotoopiesbt.png",
|
||||
tabId: tab.id,
|
||||
});
|
||||
browser.pageAction.setTitle({
|
||||
@@ -738,7 +785,7 @@ function getTabURL(tab) {
|
||||
popup: "torrent.html",
|
||||
});
|
||||
browser.pageAction.setIcon({
|
||||
path: "icons/i2plogo.png",
|
||||
path: "icons/infotoopiebt.png",
|
||||
tabId: tab.id,
|
||||
});
|
||||
browser.pageAction.setTitle({
|
||||
|
Reference in New Issue
Block a user