Added a bypass watch on twitter button. Renamed some things
This commit is contained in:
parent
243c305e5a
commit
40e15e3570
|
@ -94,6 +94,14 @@ function setProtocol(val) {
|
||||||
console.log("twitterProtocol: ", val)
|
console.log("twitterProtocol: ", val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let bypassWatchOnTwitter;
|
||||||
|
const getBypassWatchOnTwitter = () => bypassWatchOnTwitter;
|
||||||
|
function setBypassWatchOnTwitter(val) {
|
||||||
|
bypassWatchOnTwitter = val;
|
||||||
|
browser.storage.local.set({ bypassWatchOnTwitter })
|
||||||
|
console.log("bypassWatchOnTwitter: ", bypassWatchOnTwitter)
|
||||||
|
}
|
||||||
|
|
||||||
function redirect(url, initiator) {
|
function redirect(url, initiator) {
|
||||||
|
|
||||||
if (disable) return null;
|
if (disable) return null;
|
||||||
|
@ -103,6 +111,7 @@ function redirect(url, initiator) {
|
||||||
if (url.pathname.split("/").includes("home")) return null;
|
if (url.pathname.split("/").includes("home")) return null;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
bypassWatchOnTwitter &&
|
||||||
initiator && (
|
initiator && (
|
||||||
[...redirects.nitter.normal,
|
[...redirects.nitter.normal,
|
||||||
...redirects.nitter.tor,
|
...redirects.nitter.tor,
|
||||||
|
@ -176,6 +185,8 @@ async function init() {
|
||||||
|
|
||||||
protocol = result.twitterProtocol ?? "normal";
|
protocol = result.twitterProtocol ?? "normal";
|
||||||
|
|
||||||
|
bypassWatchOnTwitter = result.bypassWatchOnTwitter ?? true;
|
||||||
|
|
||||||
redirects.nitter = dataJson.nitter;
|
redirects.nitter = dataJson.nitter;
|
||||||
if (result.twitterRedirects) redirects = result.twitterRedirects;
|
if (result.twitterRedirects) redirects = result.twitterRedirects;
|
||||||
|
|
||||||
|
@ -212,6 +223,9 @@ export default {
|
||||||
getNitterTorCustomRedirects,
|
getNitterTorCustomRedirects,
|
||||||
setNitterTorCustomRedirects,
|
setNitterTorCustomRedirects,
|
||||||
|
|
||||||
|
getBypassWatchOnTwitter,
|
||||||
|
setBypassWatchOnTwitter,
|
||||||
|
|
||||||
getProtocol,
|
getProtocol,
|
||||||
setProtocol,
|
setProtocol,
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="some-block option-block">
|
<div class="some-block option-block">
|
||||||
<h4>Bypass Watch On Reddit</h4>
|
<h4>Bypass Read on Reddit</h4>
|
||||||
<input id="bypass-watch-on-reddit" type="checkbox" checked />
|
<input id="bypass-watch-on-reddit" type="checkbox" checked />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,11 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="some-block option-block">
|
||||||
|
<h4>Bypass Watch on Twitter</h4>
|
||||||
|
<input id="bypass-watch-on-twitter" type="checkbox" checked />
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div id="normal">
|
<div id="normal">
|
||||||
|
|
|
@ -29,8 +29,14 @@ function changeProtocolSettings(protocol) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let bypassWatchOnTwitterElement = document.getElementById("bypass-watch-on-twitter")
|
||||||
|
bypassWatchOnTwitterElement.addEventListener("change",
|
||||||
|
event => twitterHelper.setBypassWatchOnTwitter(event.target.checked)
|
||||||
|
);
|
||||||
|
|
||||||
twitterHelper.init().then(() => {
|
twitterHelper.init().then(() => {
|
||||||
disableTwitterElement.checked = !twitterHelper.getDisable();
|
disableTwitterElement.checked = !twitterHelper.getDisable();
|
||||||
|
bypassWatchOnTwitterElement.checked = twitterHelper.getBypassWatchOnTwitter();
|
||||||
|
|
||||||
let protocol = twitterHelper.getProtocol();
|
let protocol = twitterHelper.getProtocol();
|
||||||
protocolElement.value = protocol;
|
protocolElement.value = protocol;
|
||||||
|
|
Loading…
Reference in New Issue