add images and videos to the content replacer script for the bittorrent-as-cdn thing

This commit is contained in:
idk
2020-10-08 22:51:02 -04:00
parent 7e97ab766a
commit 4c2a7978f2

View File

@@ -35,6 +35,24 @@ browser.runtime.onMessage.addListener(request => {
};
}
}
var videos = document.getElementsByTagName('video');
for (let video of videos) {
let tmpsrc = new URL(video.currentSrc);
if (tmpsrc.host == location.host) {
innerHTML = video.innerHTML;
topInnerHTML = video.innerHTML.replace('src=\"', 'src=\"http://127.0.0.1:7657/i2psnark/' + location.host + '/');
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) {
innerHTML = audio.innerHTML;
topInnerHTML = audio.innerHTML.replace('src=\"', 'src=\"http://127.0.0.1:7657/i2psnark/' + location.host + '/');
audio.innerHTML = topInnerHTML + innerHTML;
}
}
}
if (tag.toUpperCase() === 'X-I2P-TORRENTLOCATION') {
response = metas[i].getAttribute('content');
@@ -47,6 +65,24 @@ browser.runtime.onMessage.addListener(request => {
};
}
}
var videos = document.getElementsByTagName('video');
for (let video of videos) {
let tmpsrc = new URL(video.currentSrc);
if (tmpsrc.host == location.host) {
innerHTML = video.innerHTML;
topInnerHTML = video.innerHTML.replace('src=\"', 'src=\"http://127.0.0.1:7657/i2psnark/' + location.host + '/');
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) {
innerHTML = audio.innerHTML;
topInnerHTML = audio.innerHTML.replace('src=\"', 'src=\"http://127.0.0.1:7657/i2psnark/' + location.host + '/');
audio.innerHTML = topInnerHTML + innerHTML;
}
}
}
}catch{
};