update for i2p-location

This commit is contained in:
idk
2020-09-24 20:06:33 -04:00
parent 09de46cadf
commit 87f9df4af7

21
script.js Normal file
View File

@@ -0,0 +1,21 @@
browser.runtime.onMessage.addListener(request => {
var response = '';
if (request.req === 'i2p-location') {
response = 'no-alt-location';
const metas = document.getElementsByTagName('meta');
for (let i = 0; i < metas.length; i++) {
try {
tag = metas[i].getAttribute('http-equiv');
if (tag.toUpperCase() === 'I2P-LOCATION') {
response = metas[i].getAttribute('content');
}
if (tag.toUpperCase() === 'X-I2P-LOCATION') {
response = metas[i].getAttribute('content');
}
}catch{
};
}
}
return Promise.resolve({content: response});
});