fixup the links replacer
This commit is contained in:
@@ -97,10 +97,11 @@ Usage:
|
||||
console URL's and placing applications under their own origin.
|
||||
* 
|
||||
* [Done] **Handle Torrents** by talking to i2psnark-rpc plugin and then
|
||||
adding them directly into the Firefox downloads drop-downs, menus, etc. If I
|
||||
can.
|
||||
adding them directly into the Firefox downloads drop-downs, menus, etc. Enable
|
||||
the use of I2PSnark as a peer-to-peer delivery mechanism for media files.
|
||||
* 
|
||||
* 
|
||||
* 
|
||||
* [Started] **Indicate** the level of authenticity provided by TLS. TLS is
|
||||
optional on I2P for now, but some sites offer it anyway. TLS support is
|
||||
experimental and in the works.
|
||||
|
||||
61
script.js
61
script.js
@@ -35,6 +35,36 @@ browser.runtime.onMessage.addListener(request => {
|
||||
};
|
||||
}
|
||||
}
|
||||
var links = document.getElementsByTagName('a');
|
||||
console.log('Listing link', links);
|
||||
for (let link of links) {
|
||||
console.log('(Changing Link)', link);
|
||||
let tmpsrc = new URL(link.href);
|
||||
// console.log("link", tmpsrc.host, tmpsrc.pathname)
|
||||
if (tmpsrc.host == location.host) {
|
||||
if (!tmpsrc.pathname.endsWith('html') && !tmpsrc.pathname.endsWith('htm') &&
|
||||
!tmpsrc.pathname.endsWith('php') && !tmpsrc.pathname.endsWith('jsp') &&
|
||||
!tmpsrc.pathname.endsWith('asp') && !tmpsrc.pathname.endsWith('aspx') &&
|
||||
!tmpsrc.pathname.endsWith('atom') && !tmpsrc.pathname.endsWith('rss') &&
|
||||
!tmpsrc.pathname.endsWith('\/') && tmpsrc.pathname.includes('.')) {
|
||||
console.log('link', tmpsrc.host, tmpsrc.pathname);
|
||||
link.href = 'http://127.0.0.1:7657/i2psnark/' + tmpsrc.host + tmpsrc.pathname;
|
||||
link.onerror = function() {
|
||||
window.location.href = tmpsrc.href;
|
||||
};
|
||||
}
|
||||
//if (!tmpsrc.pathname.endsWith('html')) { // && !tmpsrc.pathname.endsWith('htm') &&
|
||||
// !tmpsrc.pathname.endsWith('php') && !tmpsrc.pathname.endsWith('jsp') &&
|
||||
// !tmpsrc.pathname.endsWith('asp') && !tmpsrc.pathname.endsWith('aspx') &&
|
||||
// tmpsrc.pathname.includes('.') && !tmpsrc..pathname.endsWith('/')) {
|
||||
//console.log('http://127.0.0.1:7657/i2psnark/' + tmpsrc.host + tmpsrc.pathname;)
|
||||
//link.href = 'http://127.0.0.1:7657/i2psnark/' + tmpsrc.host + tmpsrc.pathname;
|
||||
//link.onerror = function() {
|
||||
//link.src = tmpsrc;
|
||||
//};
|
||||
//}
|
||||
}
|
||||
}
|
||||
var videos = document.getElementsByTagName('video');
|
||||
for (let video of videos) {
|
||||
let tmpsrc = new URL(video.currentSrc);
|
||||
@@ -62,6 +92,7 @@ browser.runtime.onMessage.addListener(request => {
|
||||
response = metas[i].getAttribute('content');
|
||||
var imgs = document.getElementsByTagName('img');
|
||||
for (let img of imgs) {
|
||||
let tmpsrc = new URL(img.src);
|
||||
if (tmpsrc.host == location.host) {
|
||||
img.src = 'http://127.0.0.1:7657/i2psnark/' + tmpsrc.host + tmpsrc.pathname;
|
||||
img.onerror = function() {
|
||||
@@ -69,6 +100,36 @@ browser.runtime.onMessage.addListener(request => {
|
||||
};
|
||||
}
|
||||
}
|
||||
var links = document.getElementsByTagName('a');
|
||||
console.log('Listing link', links);
|
||||
for (let link of links) {
|
||||
console.log('(Changing Link)', link);
|
||||
let tmpsrc = new URL(link.href);
|
||||
//console.log("link", tmpsrc.host, tmpsrc.pathname)
|
||||
if (tmpsrc.host == location.host) {
|
||||
if (!tmpsrc.pathname.endsWith('html') && !tmpsrc.pathname.endsWith('htm') &&
|
||||
!tmpsrc.pathname.endsWith('php') && !tmpsrc.pathname.endsWith('jsp') &&
|
||||
!tmpsrc.pathname.endsWith('asp') && !tmpsrc.pathname.endsWith('aspx') &&
|
||||
!tmpsrc.pathname.endsWith('atom') && !tmpsrc.pathname.endsWith('rss') &&
|
||||
!tmpsrc.pathname.endsWith('\/') && tmpsrc.pathname.includes('.')) {
|
||||
console.log('link', tmpsrc.host, tmpsrc.pathname);
|
||||
link.href = 'http://127.0.0.1:7657/i2psnark/' + tmpsrc.host + tmpsrc.pathname;
|
||||
link.onerror = function() {
|
||||
window.location.href = tmpsrc.href;
|
||||
};
|
||||
}
|
||||
//if (!tmpsrc.pathname.endsWith('html')) { // && !tmpsrc.pathname.endsWith('htm') &&
|
||||
// !tmpsrc.pathname.endsWith('php') && !tmpsrc.pathname.endsWith('jsp') &&
|
||||
// !tmpsrc.pathname.endsWith('asp') && !tmpsrc.pathname.endsWith('aspx') &&
|
||||
// tmpsrc.pathname.includes('.') && !tmpsrc..pathname.endsWith('/')) {
|
||||
//console.log('http://127.0.0.1:7657/i2psnark/' + tmpsrc.host + tmpsrc.pathname;)
|
||||
//link.href = 'http://127.0.0.1:7657/i2psnark/' + tmpsrc.host + tmpsrc.pathname;
|
||||
//link.onerror = function() {
|
||||
//link.src = tmpsrc;
|
||||
//};
|
||||
//}
|
||||
}
|
||||
}
|
||||
var videos = document.getElementsByTagName('video');
|
||||
for (let video of videos) {
|
||||
let tmpsrc = new URL(video.currentSrc);
|
||||
|
||||
1
scrub.js
1
scrub.js
@@ -753,7 +753,6 @@ function getClearTab(tobj) {
|
||||
console.log("(pageaction)", tab.id, tab.url)
|
||||
}
|
||||
}
|
||||
console.log(tobj)
|
||||
if (typeof(tobj) == "number"){
|
||||
browser.tabs.get(tobj).then(getTabURL, onError)
|
||||
}else{
|
||||
|
||||
BIN
x-i2p-torrentlocation.png
Normal file
BIN
x-i2p-torrentlocation.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 294 KiB |
Reference in New Issue
Block a user