Add instances to popup menu

This commit is contained in:
SimonBrazell 2019-10-30 16:48:38 +11:00
parent fc3f10de4c
commit eeef7f052b
8 changed files with 49 additions and 18 deletions

View File

@ -3,7 +3,11 @@
- [Chrome Extension](https://chrome.google.com/webstore/detail/privacy-redirect/pmcmeagblkinmogikoikkdjiligflglb)
- [Firefox Add-on](https://addons.mozilla.org/en-US/firefox/addon/privacy-redirect/)
A simple browser extension to redirect Twitter & Youtube requests to [Nitter](https://nitter.net/about) & [Invidious](https://www.invidio.us/), works when navigating to the site, or opening links.
A simple browser extension that redirects Twitter & Youtube requests to privacy friendly alternatives - [Nitter](https://github.com/zedeus/nitter) & [Invidious](https://github.com/omarroth/invidious).
No unnecessary permissions required, only listens for and redirects requests made to twitter.com, www.twitter.com, mobile.twitter.com, youtube.com, www.youtube.com, youtube-nocookie.com, www.youtube-nocookie.com, and m.youtube.com, nothing else.
Allows for setting custom [Nitter](https://github.com/zedeus/nitter/wiki/Instances) & [Invidious](https://github.com/omarroth/invidious/wiki/Invidious-Instances) instances and toggling redirects on & off.
## Build

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 KiB

After

Width:  |  Height:  |  Size: 373 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 792 KiB

After

Width:  |  Height:  |  Size: 786 KiB

BIN
images/Screen Shot 3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

View File

@ -1,7 +1,7 @@
{
"name": "Privacy Redirect",
"description": "Redirects Twitter & Youtube requests to privacy friendly alternatives (Nitter & Invidious).",
"version": "1.1.1",
"version": "1.1.2",
"manifest_version": 2,
"background": {
"scripts": [

View File

@ -14,7 +14,7 @@
<img src="../../images/logo.png" alt="Privacy Redirect logo">
</div>
<small>
<span>Version</span>: 1.1.1</span>
<span>Version</span>: 1.1.2</span>
</small>
</header>
@ -36,9 +36,12 @@
</div>
</section>
<footer>
<a class="button" id="options" target="_blank">Options</a>
</footer>
<section class="options settings_block">
<h1>Nitter Instance</h1>
<input id="nitterInstance" type="url" placeholder="https://nitter.net">
<h1>Invidious Instance</h1>
<input id="invidiousInstance" type="url" placeholder="https://invidio.us">
</section>
<script src="./popup.js"></script>

View File

@ -2,27 +2,50 @@
let disableNitter = document.querySelector('#disableNitter');
let disableInvidious = document.querySelector('#disableInvidious');
let nitterInstance = document.querySelector('#nitterInstance');
let invidiousInstance = document.querySelector('#invidiousInstance');
chrome.storage.sync.get(
['disableNitter', 'disableInvidious'],
(result) => {
['disableNitter', 'disableInvidious', 'nitterInstance', 'invidiousInstance'],
result => {
disableNitter.checked = !result.disableNitter;
disableInvidious.checked = !result.disableInvidious;
nitterInstance.value = result.nitterInstance || '';
invidiousInstance.value = result.invidiousInstance || '';
}
);
disableNitter.addEventListener('change', (event) => {
function debounce(func, wait, immediate) {
let timeout;
return function () {
let context = this, args = arguments;
let later = function () {
timeout = null;
if (!immediate) func.apply(context, args);
};
let callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
};
let nitterInstanceChange = debounce(() => {
chrome.storage.sync.set({ nitterInstance: nitterInstance.value });
}, 500);
nitterInstance.addEventListener('input', nitterInstanceChange);
let invidiousInstanceChange = debounce(() => {
chrome.storage.sync.set({ invidiousInstance: invidiousInstance.value });
}, 500);
invidiousInstance.addEventListener('input', invidiousInstanceChange);
disableNitter.addEventListener('change', event => {
chrome.storage.sync.set({ disableNitter: !event.target.checked });
});
disableInvidious.addEventListener('change', (event) => {
disableInvidious.addEventListener('change', event => {
chrome.storage.sync.set({ disableInvidious: !event.target.checked });
});
document.querySelector('#options').addEventListener('click', () => {
if (chrome.runtime.openOptionsPage) {
chrome.runtime.openOptionsPage();
} else {
window.open(chrome.runtime.getURL('../options/options.html'));
}
});

View File

@ -1,5 +1,6 @@
module.exports = {
ignoreFiles: [
'images/Screen*.png',
'images/small-tile.png'
],
};