aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/options/imgur
diff options
context:
space:
mode:
authorBobIsMyManager <ahoumatt@yahoo.com>2022-04-13 14:51:36 +0000
committerGitHub <noreply@github.com>2022-04-13 17:51:36 +0300
commitf05e1b996a2b74c1d4e34038f4d2debb145ff841 (patch)
tree9981f15990efb6220ab7b8a38d062c4984f3bf1b /src/pages/options/imgur
parentMerge branch 'master' of https://github.com/libredirect/libredirect (diff)
downloadlibredirect-f05e1b996a2b74c1d4e34038f4d2debb145ff841.zip
I2P support for search, Imgur and Wikipedia (#189)
Diffstat (limited to 'src/pages/options/imgur')
-rw-r--r--src/pages/options/imgur/imgur.html32
-rw-r--r--src/pages/options/imgur/imgur.js30
2 files changed, 54 insertions, 8 deletions
diff --git a/src/pages/options/imgur/imgur.html b/src/pages/options/imgur/imgur.html
index a769bd06..b00c7d71 100644
--- a/src/pages/options/imgur/imgur.html
+++ b/src/pages/options/imgur/imgur.html
@@ -139,6 +139,7 @@
<select id="protocol">
<option value="normal" data-localise="__MSG_normal__">Normal</option>
<option value="tor" data-localise="__MSG_tor__">Tor</option>
+ <option value="i2p" data-localise="__MSG_i2p__">I2P</option>
</select>
</div>
@@ -167,6 +168,7 @@
</form>
<div class="checklist custom-checklist"></div>
</div>
+
<div class="tor">
<div class="some-block option-block">
<h4 data-localise="__MSG_defaultInstances__">Default Instances</h4>
@@ -178,7 +180,7 @@
</div>
<form class="custom-instance-form">
<div class="some-block option-block">
- <input class="custom-instance" placeholder="https://rimgo.com" type="url" />
+ <input class="custom-instance" placeholder="http://rimgo.onion" type="url" />
<button type="submit" class="add add-instance">
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
fill="currentColor">
@@ -190,13 +192,37 @@
</form>
<div class="checklist custom-checklist"></div>
</div>
+
+ <div class="i2p">
+ <div class="some-block option-block">
+ <h4 data-localise="__MSG_defaultInstances__">Default Instances</h4>
+ </div>
+ <div class="checklist checklist"></div>
+ <hr>
+ <div class="some-block option-block">
+ <h4 data-localise="__MSG_customInstances__">Custom Instances</h4>
+ </div>
+ <form class="custom-instance-form">
+ <div class="some-block option-block">
+ <input class="custom-instance" placeholder="http://rimgo.i2p" type="url" />
+ <button type="submit" class="add add-instance">
+ <svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
+ fill="currentColor">
+ <path d="M0 0h24v24H0V0z" fill="none" />
+ <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
+ </svg>
+ </button>
+ </div>
+ </form>
+ <div class="checklist custom-checklist"></div>
+ </div>
+
</div>
</section>
-
<script type="module" src="../init.js"></script>
<script type="module" src="./imgur.js"></script>
<script type="module" src="../../../assets/javascripts/localise.js"></script>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/src/pages/options/imgur/imgur.js b/src/pages/options/imgur/imgur.js
index 9742bfd2..26a7d417 100644
--- a/src/pages/options/imgur/imgur.js
+++ b/src/pages/options/imgur/imgur.js
@@ -18,13 +18,21 @@ protocolElement.addEventListener("change",
function changeProtocolSettings(protocol) {
let normalDiv = document.getElementsByClassName("normal")[0];
let torDiv = document.getElementsByClassName("tor")[0];
+ let i2pDiv = document.getElementsByClassName("i2p")[0];
if (protocol == 'normal') {
- normalDiv.style.display = 'block';
- torDiv.style.display = 'none';
+ normalDiv.style.display = 'block';
+ torDiv.style.display = 'none';
+ i2pDiv.style.display = 'none';
}
else if (protocol == 'tor') {
- normalDiv.style.display = 'none';
- torDiv.style.display = 'block';
+ normalDiv.style.display = 'none';
+ torDiv.style.display = 'block';
+ i2pDiv.style.display = 'none';
+ }
+ else if (protocol == 'i2p') {
+ normalDiv.style.display = 'none';
+ torDiv.style.display = 'none';
+ i2pDiv.style.display = 'block';
}
}
@@ -32,6 +40,7 @@ imgurHelper.init().then(() => {
disableImgurElement.checked = !imgurHelper.getDisable();
let protocol = imgurHelper.getProtocol();
+ console.log('protocol', protocol);
protocolElement.value = protocol;
changeProtocolSettings(protocol);
@@ -56,4 +65,15 @@ imgurHelper.init().then(() => {
imgurHelper.getRimgoTorCustomRedirects,
imgurHelper.setRimgoTorCustomRedirects
);
-}); \ No newline at end of file
+
+ commonHelper.processDefaultCustomInstances(
+ 'rimgo',
+ 'i2p',
+ imgurHelper,
+ document,
+ imgurHelper.getRimgoI2pRedirectsChecks,
+ imgurHelper.setRimgoI2pRedirectsChecks,
+ imgurHelper.getRimgoI2pCustomRedirects,
+ imgurHelper.setRimgoI2pCustomRedirects
+ );
+});