From 87f9df4af715e41c978a714ec3083926736b3d72 Mon Sep 17 00:00:00 2001 From: idk Date: Thu, 24 Sep 2020 20:06:33 -0400 Subject: [PATCH] update for i2p-location --- script.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 script.js diff --git a/script.js b/script.js new file mode 100644 index 0000000..a63904b --- /dev/null +++ b/script.js @@ -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}); +});