Merge branch 'themes-again' into 'master'

Themes again

See merge request idk/I2P-in-Private-Browsing-Mode-Firefox!21
This commit is contained in:
idk
2021-02-05 18:00:58 +00:00
3 changed files with 94 additions and 84 deletions

View File

@@ -37,11 +37,11 @@ clean: rc clean-artifacts
## EVEN RELEASES are AMO RELEASES
## ODD RELEASES are SELFHOSTED RELEASES
MOZ_VERSION=0.96
VERSION=0.95
MOZ_VERSION=0.98
VERSION=0.97
## INCREMENT THIS EVERY TIME YOU DO A RELEASE
LAST_VERSION=0.93
LAST_VERSION=0.95
YELLOW=F7E59A
ORANGE=FFC56D
@@ -354,6 +354,7 @@ ndtest:
-u http://idk.i2p/video.html \
-u http://idk.i2p \
-u http://stats.i2p \
-u http://tvndxxkxcstbtqfxg7iigco6bj22ff2y6jxikmk7wqkyadkhrd4a.b32.i2p \
-u https://ramble.pw \
-u https://ramble.pw/f/i2p \

View File

@@ -262,8 +262,11 @@ function themeWindow(window) {
if (Object.keys(them).length > 0) {
try {
browser.theme.update(window.id, them.originalTheme);
}catch(e){
console.log("Original theme set error. Your theme must have an SVG in it.", e)
} catch (e) {
console.log(
"Original theme set error. Your theme must have an SVG in it.",
e
);
}
} else {
browser.theme.update(window.id, { colors: null });
@@ -375,26 +378,36 @@ function handleUpdated(updateInfo) {
function maybeSet(them) {
console.log("original theme found:", them, Object.keys(them).length);
try {
console.log("testing theme", updateInfo.theme.colors.toolbar, "!=", btheme.colors.toolbar);
console.log("testing theme", updateInfo.theme.colors.toolbar, "!=", dtheme.colors.toolbar);
if (
updateInfo.theme.colors.toolbar != dtheme.colors.toolbar &&
updateInfo.theme.colors.toolbar != btheme.colors.toolbar
) {
function onSet() {
console.log("stored theme:", updateInfo.theme);
}
/*if (
console.log(
"testing theme",
updateInfo.theme.colors.toolbar,
"!=",
btheme.colors.toolbar
);
console.log(
"testing theme",
updateInfo.theme.colors.toolbar,
"!=",
dtheme.colors.toolbar
);
if (
updateInfo.theme.colors.toolbar != dtheme.colors.toolbar &&
updateInfo.theme.colors.toolbar != btheme.colors.toolbar
) {
function onSet() {
console.log("stored theme:", updateInfo.theme);
}
/*if (
updateInfo.theme.colors != null &&
updateInfo.theme.images != null &&
updateInfo.theme.properties != null
) {*/
console.log("storing theme:", updateInfo.theme);
browser.storage.local
.set({ originalTheme: updateInfo.theme })
.then(onSet, onError);
//}
}
console.log("storing theme:", updateInfo.theme);
browser.storage.local
.set({ originalTheme: updateInfo.theme })
.then(onSet, onError);
//}
}
} catch (e) {
console.log("theme storage error", e);
}

122
scrub.js
View File

@@ -624,73 +624,69 @@ var coolheadersSetup = function (e) {
browser.pageAction.show(e.tabId);
}
break;
} else {
if (header.name.toUpperCase().endsWith("I2P-TORRENTLOCATION")) {
var imgs = document.getElementsByTagName("img");
for (let img of imgs) {
if (tmpsrc.host == location.host) {
img.src =
"http://127.0.0.1:7657/i2psnark/" +
tmpsrc.host +
tmpsrc.pathname;
img.onerror = function () {
img.src = tmpsrc;
}
if (header.name.toUpperCase().endsWith("I2P-TORRENTLOCATION")) {
console.log("(scrub) checking header torrentlocation", header);
var imgs = document.getElementsByTagName("img");
for (let img of imgs) {
if (tmpsrc.host == location.host) {
img.src =
"http://127.0.0.1:7657/i2psnark/" +
tmpsrc.host +
tmpsrc.pathname;
img.onerror = function () {
img.src = tmpsrc;
};
}
}
var videos = document.getElementsByTagName("video");
for (let video of videos) {
let tmpsrc = new URL(video.currentSrc);
if (tmpsrc.host == location.host) {
if (!video.innerHTML.includes("127.0.0.1")) {
innerHTML = video.innerHTML;
topInnerHTML = video.innerHTML.replace(
'src="',
'src="http://127.0.0.1:7657/i2psnark/' + location.host + "/"
);
video.innerHTML = topInnerHTML; // + innerHTML;
video.onerror = function () {
video.innerHTML = topInnerHTML + innerHTML;
};
}
}
var videos = document.getElementsByTagName("video");
for (let video of videos) {
let tmpsrc = new URL(video.currentSrc);
if (tmpsrc.host == location.host) {
if (!video.innerHTML.includes("127.0.0.1")) {
innerHTML = video.innerHTML;
topInnerHTML = video.innerHTML.replace(
'src="',
'src="http://127.0.0.1:7657/i2psnark/' +
location.host +
"/"
);
video.innerHTML = topInnerHTML; // + innerHTML;
video.onerror = function () {
video.innerHTML = topInnerHTML + innerHTML;
};
}
}
}
var audios = document.getElementsByTagName("audio");
for (let audio of audios) {
let tmpsrc = new URL(audio.currentSrc);
if (tmpsrc.host == location.host) {
if (!audio.innerHTML.includes("127.0.0.1")) {
innerHTML = audio.innerHTML;
topInnerHTML = audio.innerHTML.replace(
'src="',
'src="http://127.0.0.1:7657/i2psnark/' +
location.host +
"/"
);
audio.innerHTML = topInnerHTML; // + innerHTML;
audio.onerror = function () {
audio.innerHTML = topInnerHTML + innerHTML;
};
}
}
}
browser.pageAction.setPopup({
tabId: tabId.id,
popup: "torrent.html",
});
browser.pageAction.setIcon({
path: "icons/i2plogo.png",
tabId: e.tabId,
});
browser.pageAction.setTitle({
tabId: e.tabId,
title: header.value,
});
browser.pageAction.show(e.tabId);
break;
}
var audios = document.getElementsByTagName("audio");
for (let audio of audios) {
let tmpsrc = new URL(audio.currentSrc);
if (tmpsrc.host == location.host) {
if (!audio.innerHTML.includes("127.0.0.1")) {
innerHTML = audio.innerHTML;
topInnerHTML = audio.innerHTML.replace(
'src="',
'src="http://127.0.0.1:7657/i2psnark/' + location.host + "/"
);
audio.innerHTML = topInnerHTML; // + innerHTML;
audio.onerror = function () {
audio.innerHTML = topInnerHTML + innerHTML;
};
}
}
}
browser.pageAction.setPopup({
tabId: e.tabId,
popup: "torrent.html",
});
browser.pageAction.setIcon({
path: "icons/i2plogo.png",
tabId: e.tabId,
});
browser.pageAction.setTitle({
tabId: e.tabId,
title: header.value,
});
browser.pageAction.show(e.tabId);
break;
}
}
}