mirror of
https://github.com/mmjee/privacy-redirect.git
synced 2024-12-06 19:16:32 +01:00
Standardize and update
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": [
|
||||
"standard"
|
||||
],
|
||||
"globals": {
|
||||
"browser": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 12,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
}
|
||||
}
|
||||
+227
@@ -2,3 +2,230 @@ web-ext-artifacts/
|
||||
.DS_Store
|
||||
nod
|
||||
node_modules
|
||||
|
||||
### Intellij+iml ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# AWS User-specific
|
||||
.idea/**/aws.xml
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
### Intellij+iml Patch ###
|
||||
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
|
||||
|
||||
*.iml
|
||||
modules.xml
|
||||
.idea/misc.xml
|
||||
*.ipr
|
||||
|
||||
### Node ###
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
### Node Patch ###
|
||||
# Serverless Webpack directories
|
||||
.webpack/
|
||||
|
||||
# Optional stylelint cache
|
||||
|
||||
# SvelteKit build / generate output
|
||||
.svelte-kit
|
||||
|
||||
Generated
+5
@@ -0,0 +1,5 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6584
-82
File diff suppressed because it is too large
Load Diff
+5
-4
@@ -9,10 +9,6 @@
|
||||
"build": "web-ext build --overwrite-dest --source-dir ./src/",
|
||||
"test": "web-ext lint --source-dir ./src/ || true"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/SimonBrazell/privacy-redirect.git"
|
||||
},
|
||||
"author": "SimonBrazell",
|
||||
"license": "GPL-3.0-only",
|
||||
"bugs": {
|
||||
@@ -20,6 +16,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/SimonBrazell/privacy-redirect#readme",
|
||||
"devDependencies": {
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-standard": "^16.0.3",
|
||||
"eslint-plugin-import": "^2.25.4",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^5.2.0",
|
||||
"web-ext": "^6.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
function filterInstances(instances) {
|
||||
return instances.filter((instance) => !instance.includes(".onion"));
|
||||
function filterInstances (instances) {
|
||||
return instances.filter((instance) => !instance.includes('.onion'))
|
||||
}
|
||||
|
||||
function getRandomInstance(instances) {
|
||||
return instances[~~(instances.length * Math.random())];
|
||||
function getRandomInstance (instances) {
|
||||
return instances[~~(instances.length * Math.random())]
|
||||
}
|
||||
|
||||
export default {
|
||||
filterInstances,
|
||||
getRandomInstance,
|
||||
};
|
||||
getRandomInstance
|
||||
}
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
const targets = /https?:\/\/(((www|maps)\.)?(google\.).*(\/maps)|maps\.(google\.).*)/;
|
||||
const redirects = ["https://openstreetmap.org"];
|
||||
const mapCentreRegex = /@(-?\d[0-9.]*),(-?\d[0-9.]*),(\d{1,2})[.z]/;
|
||||
const dataLatLngRegex = /(!3d|!4d)(-?[0-9]{1,10}.[0-9]{1,10})/g;
|
||||
const placeRegex = /\/place\/(.*)\//;
|
||||
const targets = /https?:\/\/(((www|maps)\.)?(google\.).*(\/maps)|maps\.(google\.).*)/
|
||||
const redirects = ['https://openstreetmap.org']
|
||||
const mapCentreRegex = /@(-?\d[0-9.]*),(-?\d[0-9.]*),(\d{1,2})[.z]/
|
||||
const dataLatLngRegex = /(!3d|!4d)(-?[0-9]{1,10}.[0-9]{1,10})/g
|
||||
const placeRegex = /\/place\/(.*)\//
|
||||
const travelModes = {
|
||||
driving: "fossgis_osrm_car",
|
||||
walking: "fossgis_osrm_foot",
|
||||
bicycling: "fossgis_osrm_bike",
|
||||
transit: "fossgis_osrm_car", // not implemented on OSM, default to car.
|
||||
};
|
||||
driving: 'fossgis_osrm_car',
|
||||
walking: 'fossgis_osrm_foot',
|
||||
bicycling: 'fossgis_osrm_bike',
|
||||
transit: 'fossgis_osrm_car' // not implemented on OSM, default to car.
|
||||
}
|
||||
const layers = {
|
||||
none: "S",
|
||||
transit: "T",
|
||||
traffic: "S", // not implemented on OSM, default to standard.
|
||||
bicycling: "C",
|
||||
};
|
||||
function addressToLatLng(address, callback) {
|
||||
const xmlhttp = new XMLHttpRequest();
|
||||
none: 'S',
|
||||
transit: 'T',
|
||||
traffic: 'S', // not implemented on OSM, default to standard.
|
||||
bicycling: 'C'
|
||||
}
|
||||
function addressToLatLng (address, callback) {
|
||||
const xmlhttp = new XMLHttpRequest()
|
||||
xmlhttp.onreadystatechange = () => {
|
||||
if (xmlhttp.readyState === XMLHttpRequest.DONE) {
|
||||
if (xmlhttp.status === 200) {
|
||||
const json = JSON.parse(xmlhttp.responseText)[0];
|
||||
const json = JSON.parse(xmlhttp.responseText)[0]
|
||||
if (json) {
|
||||
callback(
|
||||
`${json.lat}%2C${json.lon}`,
|
||||
`${json.boundingbox[2]},${json.boundingbox[1]},${json.boundingbox[3]},${json.boundingbox[0]}`
|
||||
);
|
||||
)
|
||||
}
|
||||
} else {
|
||||
console.info("Error: Status is " + xmlhttp.status);
|
||||
console.info('Error: Status is ' + xmlhttp.status)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlhttp.open(
|
||||
"GET",
|
||||
'GET',
|
||||
`https://nominatim.openstreetmap.org/search/${address}?format=json&limit=1`,
|
||||
false
|
||||
);
|
||||
xmlhttp.send();
|
||||
)
|
||||
xmlhttp.send()
|
||||
}
|
||||
|
||||
export default {
|
||||
@@ -48,5 +48,5 @@ export default {
|
||||
placeRegex,
|
||||
travelModes,
|
||||
layers,
|
||||
addressToLatLng,
|
||||
};
|
||||
addressToLatLng
|
||||
}
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
const targets = /https?:\/\/(((www|maps)\.)?(google\.).*(\/search)|search\.(google\.).*)/;
|
||||
const targets = /https?:\/\/(((www|maps)\.)?(google\.).*(\/search)|search\.(google\.).*)/
|
||||
const redirects = [
|
||||
{ link: "https://duckduckgo.com", q: "/" },
|
||||
{ link: "https://startpage.com", q: "/search/" },
|
||||
{ link: "https://www.ecosia.org", q: "/search" },
|
||||
{ link: "https://www.qwant.com", q: "/" },
|
||||
{ link: "https://www.mojeek.com", q: "/search" },
|
||||
{ link: "https://search.snopyta.org", q: "/" },
|
||||
{ link: "https://searx.info", q: "/" },
|
||||
{ link: "https://searx.be", q: "/" },
|
||||
{ link: "https://search.disroot.org", q: "/" },
|
||||
{ link: "https://searx.tuxcloud.net", q: "/" },
|
||||
{ link: "https://searx.ninja", q: "/" },
|
||||
{ link: "https://tromland.org/searx", q: "/search" },
|
||||
{ link: "https://engine.presearch.org", q: "/search" },
|
||||
{ link: "https://searx.silkky.cloud", q: "/" },
|
||||
{ link: "https://search.trom.tf", q: "/" },
|
||||
{ link: "https://whooglesearch.net", q: "/search" },
|
||||
{ link: "https://whoogle.sdf.org", q: "/search" },
|
||||
{ link: "https://whoogle.himiko.cloud", q: "/search" },
|
||||
{ link: "https://whoogle-search.zeet.app", q: "/search" },
|
||||
];
|
||||
{ link: 'https://duckduckgo.com', q: '/' },
|
||||
{ link: 'https://startpage.com', q: '/search/' },
|
||||
{ link: 'https://www.ecosia.org', q: '/search' },
|
||||
{ link: 'https://www.qwant.com', q: '/' },
|
||||
{ link: 'https://www.mojeek.com', q: '/search' },
|
||||
{ link: 'https://search.snopyta.org', q: '/' },
|
||||
{ link: 'https://searx.info', q: '/' },
|
||||
{ link: 'https://searx.be', q: '/' },
|
||||
{ link: 'https://search.disroot.org', q: '/' },
|
||||
{ link: 'https://searx.tuxcloud.net', q: '/' },
|
||||
{ link: 'https://searx.ninja', q: '/' },
|
||||
{ link: 'https://tromland.org/searx', q: '/search' },
|
||||
{ link: 'https://engine.presearch.org', q: '/search' },
|
||||
{ link: 'https://searx.silkky.cloud', q: '/' },
|
||||
{ link: 'https://search.trom.tf', q: '/' },
|
||||
{ link: 'https://whooglesearch.net', q: '/search' },
|
||||
{ link: 'https://whoogle.sdf.org', q: '/search' },
|
||||
{ link: 'https://whoogle.himiko.cloud', q: '/search' },
|
||||
{ link: 'https://whoogle-search.zeet.app', q: '/search' }
|
||||
]
|
||||
|
||||
export default {
|
||||
targets,
|
||||
redirects,
|
||||
};
|
||||
redirects
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const targets = ["translate.google.com", "translate.google.no"];
|
||||
const targets = ['translate.google.com', 'translate.google.no']
|
||||
|
||||
const redirects = ["https://translate.metalune.xyz"];
|
||||
const redirects = ['https://translate.metalune.xyz']
|
||||
|
||||
export default {
|
||||
targets,
|
||||
redirects,
|
||||
};
|
||||
redirects
|
||||
}
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
const targets = [
|
||||
"instagram.com",
|
||||
"www.instagram.com",
|
||||
"help.instagram.com",
|
||||
"about.instagram.com",
|
||||
];
|
||||
'instagram.com',
|
||||
'www.instagram.com',
|
||||
'help.instagram.com',
|
||||
'about.instagram.com'
|
||||
]
|
||||
const redirects = [
|
||||
"https://bibliogram.art",
|
||||
"https://bibliogram.snopyta.org",
|
||||
"https://bibliogram.pussthecat.org",
|
||||
"https://bibliogram.nixnet.services",
|
||||
"https://bibliogram.ethibox.fr",
|
||||
"https://bibliogram.hamster.dance",
|
||||
"https://insta.trom.tf",
|
||||
"https://bib.actionsack.com"
|
||||
];
|
||||
'https://bibliogram.art',
|
||||
'https://bibliogram.snopyta.org',
|
||||
'https://bibliogram.pussthecat.org',
|
||||
'https://bibliogram.nixnet.services',
|
||||
'https://bibliogram.ethibox.fr',
|
||||
'https://bibliogram.hamster.dance',
|
||||
'https://insta.trom.tf',
|
||||
'https://bib.actionsack.com'
|
||||
]
|
||||
const reservedPaths = [
|
||||
"about",
|
||||
"explore",
|
||||
"support",
|
||||
"press",
|
||||
"api",
|
||||
"privacy",
|
||||
"safety",
|
||||
"admin",
|
||||
"graphql",
|
||||
"accounts",
|
||||
"help",
|
||||
"terms",
|
||||
"contact",
|
||||
"blog",
|
||||
"igtv",
|
||||
"u",
|
||||
"p",
|
||||
"fragment",
|
||||
"imageproxy",
|
||||
"videoproxy",
|
||||
".well-known",
|
||||
"tv",
|
||||
"reel",
|
||||
];
|
||||
const bypassPaths = /\/(accounts\/|embeds?.js)/;
|
||||
'about',
|
||||
'explore',
|
||||
'support',
|
||||
'press',
|
||||
'api',
|
||||
'privacy',
|
||||
'safety',
|
||||
'admin',
|
||||
'graphql',
|
||||
'accounts',
|
||||
'help',
|
||||
'terms',
|
||||
'contact',
|
||||
'blog',
|
||||
'igtv',
|
||||
'u',
|
||||
'p',
|
||||
'fragment',
|
||||
'imageproxy',
|
||||
'videoproxy',
|
||||
'.well-known',
|
||||
'tv',
|
||||
'reel'
|
||||
]
|
||||
const bypassPaths = /\/(accounts\/|embeds?.js)/
|
||||
|
||||
export default {
|
||||
targets,
|
||||
redirects,
|
||||
reservedPaths,
|
||||
bypassPaths,
|
||||
};
|
||||
bypassPaths
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
const targets = [
|
||||
"www.reddit.com",
|
||||
"np.reddit.com",
|
||||
"new.reddit.com",
|
||||
"amp.reddit.com",
|
||||
"i.redd.it",
|
||||
"redd.it",
|
||||
"old.reddit.com",
|
||||
];
|
||||
'www.reddit.com',
|
||||
'np.reddit.com',
|
||||
'new.reddit.com',
|
||||
'amp.reddit.com',
|
||||
'i.redd.it',
|
||||
'redd.it',
|
||||
'old.reddit.com'
|
||||
]
|
||||
const redirects = [
|
||||
// libreddit: privacy w/ modern UI
|
||||
"https://libredd.it",
|
||||
"https://libreddit.spike.codes",
|
||||
"https://libreddit.kavin.rocks",
|
||||
"https://libreddit.insanity.wtf",
|
||||
"https://libreddit.dothq.co",
|
||||
"https://libreddit.silkky.cloud",
|
||||
"https://libreddit.himiko.cloud",
|
||||
"https://reddit.artemislena.eu",
|
||||
'https://libredd.it',
|
||||
'https://libreddit.spike.codes',
|
||||
'https://libreddit.kavin.rocks',
|
||||
'https://libreddit.insanity.wtf',
|
||||
'https://libreddit.dothq.co',
|
||||
'https://libreddit.silkky.cloud',
|
||||
'https://libreddit.himiko.cloud',
|
||||
'https://reddit.artemislena.eu',
|
||||
// teddit: privacy w/ old UI
|
||||
"https://teddit.net",
|
||||
"https://teddit.ggc-project.de",
|
||||
"https://teddit.kavin.rocks",
|
||||
"https://snew.notabug.io",
|
||||
];
|
||||
const bypassPaths = /\/(gallery\/poll\/rpan\/settings\/topics)/;
|
||||
'https://teddit.net',
|
||||
'https://teddit.ggc-project.de',
|
||||
'https://teddit.kavin.rocks',
|
||||
'https://snew.notabug.io'
|
||||
]
|
||||
const bypassPaths = /\/(gallery\/poll\/rpan\/settings\/topics)/
|
||||
|
||||
export default {
|
||||
targets,
|
||||
redirects,
|
||||
bypassPaths,
|
||||
};
|
||||
bypassPaths
|
||||
}
|
||||
|
||||
@@ -4,41 +4,41 @@
|
||||
when updating this list:
|
||||
*/
|
||||
const targets = [
|
||||
"twitter.com",
|
||||
"www.twitter.com",
|
||||
"mobile.twitter.com",
|
||||
"pbs.twimg.com",
|
||||
"video.twimg.com",
|
||||
];
|
||||
'twitter.com',
|
||||
'www.twitter.com',
|
||||
'mobile.twitter.com',
|
||||
'pbs.twimg.com',
|
||||
'video.twimg.com'
|
||||
]
|
||||
/*
|
||||
Please remember to also update the
|
||||
src/assets/javascripts/remove-twitter-sw.js file
|
||||
(const nitterInstances) when updating this list:
|
||||
*/
|
||||
const redirects = [
|
||||
"https://nitter.net",
|
||||
"https://nitter.snopyta.org",
|
||||
"https://nitter.42l.fr",
|
||||
"https://nitter.nixnet.services",
|
||||
"https://nitter.pussthecat.org",
|
||||
"https://nitter.dark.fail",
|
||||
"https://nitter.tedomum.net",
|
||||
"https://nitter.cattube.org",
|
||||
"https://nitter.fdn.fr",
|
||||
"https://nitter.1d4.us",
|
||||
"https://nitter.kavin.rocks",
|
||||
"https://tweet.lambda.dance",
|
||||
"https://nitter.cc",
|
||||
"https://nitter.vxempire.xyz",
|
||||
"https://nitter.unixfox.eu",
|
||||
"https://bird.trom.tf",
|
||||
"http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion",
|
||||
"http://nitter.l4qlywnpwqsluw65ts7md3khrivpirse744un3x7mlskqauz5pyuzgqd.onion",
|
||||
"http://nitterlgj3n5fgwesu3vxc5h67ruku33nqaoeoocae2mvlzhsu6k7fqd.onion",
|
||||
"http://npf37k3mtzwxreiw52ccs5ay4e6qt2fkcs2ndieurdyn2cuzzsfyfvid.onion",
|
||||
];
|
||||
'https://nitter.net',
|
||||
'https://nitter.snopyta.org',
|
||||
'https://nitter.42l.fr',
|
||||
'https://nitter.nixnet.services',
|
||||
'https://nitter.pussthecat.org',
|
||||
'https://nitter.dark.fail',
|
||||
'https://nitter.tedomum.net',
|
||||
'https://nitter.cattube.org',
|
||||
'https://nitter.fdn.fr',
|
||||
'https://nitter.1d4.us',
|
||||
'https://nitter.kavin.rocks',
|
||||
'https://tweet.lambda.dance',
|
||||
'https://nitter.cc',
|
||||
'https://nitter.vxempire.xyz',
|
||||
'https://nitter.unixfox.eu',
|
||||
'https://bird.trom.tf',
|
||||
'http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion',
|
||||
'http://nitter.l4qlywnpwqsluw65ts7md3khrivpirse744un3x7mlskqauz5pyuzgqd.onion',
|
||||
'http://nitterlgj3n5fgwesu3vxc5h67ruku33nqaoeoocae2mvlzhsu6k7fqd.onion',
|
||||
'http://npf37k3mtzwxreiw52ccs5ay4e6qt2fkcs2ndieurdyn2cuzzsfyfvid.onion'
|
||||
]
|
||||
|
||||
export default {
|
||||
targets,
|
||||
redirects,
|
||||
};
|
||||
redirects
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const targets = /wikipedia.org/;
|
||||
const targets = /wikipedia.org/
|
||||
|
||||
const redirects = ["https://wikiless.org"];
|
||||
const redirects = ['https://wikiless.org']
|
||||
|
||||
export default {
|
||||
targets,
|
||||
redirects,
|
||||
};
|
||||
redirects
|
||||
}
|
||||
|
||||
@@ -1,45 +1,25 @@
|
||||
const targets = [
|
||||
"m.youtube.com",
|
||||
"youtube.com",
|
||||
"img.youtube.com",
|
||||
"www.youtube.com",
|
||||
"youtube-nocookie.com",
|
||||
"www.youtube-nocookie.com",
|
||||
"youtu.be",
|
||||
"s.ytimg.com",
|
||||
"music.youtube.com",
|
||||
];
|
||||
'm.youtube.com',
|
||||
'youtube.com',
|
||||
'img.youtube.com',
|
||||
'www.youtube.com',
|
||||
'youtube-nocookie.com',
|
||||
'www.youtube-nocookie.com',
|
||||
'youtu.be',
|
||||
's.ytimg.com',
|
||||
'music.youtube.com'
|
||||
]
|
||||
/*
|
||||
Please remember to also update the manifest.json file
|
||||
(content_scripts > matches, 'persist-invidious-prefs.js')
|
||||
when updating this list:
|
||||
*/
|
||||
const redirects = [
|
||||
"https://invidious.snopyta.org",
|
||||
"https://invidious.xyz",
|
||||
"https://invidious.kavin.rocks",
|
||||
"https://tube.connect.cafe",
|
||||
"https://invidious.zapashcanon.fr",
|
||||
"https://invidiou.site",
|
||||
"https://vid.mint.lgbt",
|
||||
"https://invidious.site",
|
||||
"https://yewtu.be",
|
||||
"https://invidious.tube",
|
||||
"https://invidious.silkky.cloud",
|
||||
"https://invidious.himiko.cloud",
|
||||
"https://inv.skyn3t.in",
|
||||
"https://tube.incognet.io",
|
||||
"https://invidious.tinfoil-hat.net",
|
||||
"https://invidious.namazso.eu",
|
||||
"https://vid.puffyan.us",
|
||||
"https://dev.viewtube.io",
|
||||
"https://invidious.048596.xyz",
|
||||
"http://fz253lmuao3strwbfbmx46yu7acac2jz27iwtorgmbqlkurlclmancad.onion",
|
||||
"http://c7hqkpkpemu6e7emz5b4vyz7idjgdvgaaa3dyimmeojqbgpea3xqjoid.onion",
|
||||
"http://w6ijuptxiku4xpnnaetxvnkc5vqcdu7mgns2u77qefoixi63vbvnpnqd.onion",
|
||||
];
|
||||
'https://piped-material.১.net',
|
||||
'https://piped-staging.ftp.sh'
|
||||
]
|
||||
|
||||
export default {
|
||||
targets,
|
||||
redirects,
|
||||
};
|
||||
redirects
|
||||
}
|
||||
|
||||
@@ -1,35 +1,37 @@
|
||||
window.browser = window.browser || window.chrome;
|
||||
window.browser = window.browser || window.chrome
|
||||
|
||||
function getMessage(tag) {
|
||||
function getMessage (tag) {
|
||||
return tag.replace(/__MSG_(\w+)__/g, function (_match, v1) {
|
||||
return v1 ? browser.i18n.getMessage(v1) : null;
|
||||
});
|
||||
return v1 ? browser.i18n.getMessage(v1) : null
|
||||
})
|
||||
}
|
||||
|
||||
function localisePage() {
|
||||
let elements = document.querySelectorAll("[data-localise]");
|
||||
function localisePage () {
|
||||
const elements = document.querySelectorAll('[data-localise]')
|
||||
|
||||
for (let i in elements)
|
||||
for (const i in elements) {
|
||||
if (elements.hasOwnProperty(i)) {
|
||||
let obj = elements[i];
|
||||
let tag = obj.getAttribute("data-localise").toString();
|
||||
const obj = elements[i]
|
||||
const tag = obj.getAttribute('data-localise').toString()
|
||||
|
||||
let msg = getMessage(tag);
|
||||
const msg = getMessage(tag)
|
||||
|
||||
if (msg && msg !== tag) obj.textContent = msg;
|
||||
if (msg && msg !== tag) obj.textContent = msg
|
||||
}
|
||||
}
|
||||
|
||||
let placeholders = document.querySelectorAll("[data-localise-placeholder]");
|
||||
const placeholders = document.querySelectorAll('[data-localise-placeholder]')
|
||||
|
||||
for (let i in placeholders)
|
||||
for (const i in placeholders) {
|
||||
if (placeholders.hasOwnProperty(i)) {
|
||||
let obj = placeholders[i];
|
||||
let tag = obj.getAttribute("data-localise-placeholder").toString();
|
||||
const obj = placeholders[i]
|
||||
const tag = obj.getAttribute('data-localise-placeholder').toString()
|
||||
|
||||
let msg = getMessage(tag);
|
||||
const msg = getMessage(tag)
|
||||
|
||||
if (msg && msg !== tag) obj.placeholder = msg;
|
||||
if (msg && msg !== tag) obj.placeholder = msg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
localisePage();
|
||||
localisePage()
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
"use strict";
|
||||
'use strict'
|
||||
|
||||
window.browser = window.browser || window.chrome;
|
||||
window.browser = window.browser || window.chrome
|
||||
|
||||
function getCookie() {
|
||||
let ca = document.cookie.split(";");
|
||||
function getCookie () {
|
||||
const ca = document.cookie.split(';')
|
||||
for (let i = 0; i < ca.length; i++) {
|
||||
let c = ca[i];
|
||||
while (c.charAt(0) == " ") c = c.substring(1, c.length);
|
||||
if (c.indexOf("PREFS=") == 0) {
|
||||
let c = ca[i]
|
||||
while (c.charAt(0) == ' ') c = c.substring(1, c.length)
|
||||
if (c.indexOf('PREFS=') == 0) {
|
||||
return JSON.parse(
|
||||
decodeURIComponent(c.substring("PREFS=".length, c.length))
|
||||
);
|
||||
decodeURIComponent(c.substring('PREFS='.length, c.length))
|
||||
)
|
||||
}
|
||||
}
|
||||
return {};
|
||||
return {}
|
||||
}
|
||||
|
||||
browser.storage.sync.get(
|
||||
["alwaysProxy", "videoQuality", "invidiousDarkMode", "persistInvidiousPrefs"],
|
||||
['alwaysProxy', 'videoQuality', 'invidiousDarkMode', 'persistInvidiousPrefs'],
|
||||
(result) => {
|
||||
if (result.persistInvidiousPrefs) {
|
||||
const prefs = getCookie();
|
||||
prefs.local = result.alwaysProxy;
|
||||
prefs.quality = result.videoQuality;
|
||||
prefs.dark_mode = result.invidiousDarkMode;
|
||||
document.cookie = `PREFS=${encodeURIComponent(JSON.stringify(prefs))}`;
|
||||
const prefs = getCookie()
|
||||
prefs.local = result.alwaysProxy
|
||||
prefs.quality = result.videoQuality
|
||||
prefs.dark_mode = result.invidiousDarkMode
|
||||
document.cookie = `PREFS=${encodeURIComponent(JSON.stringify(prefs))}`
|
||||
}
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
@@ -1,113 +1,113 @@
|
||||
"use strict";
|
||||
'use strict'
|
||||
|
||||
const nitterInstances = [
|
||||
"https://nitter.net",
|
||||
"https://nitter.snopyta.org",
|
||||
"https://nitter.42l.fr",
|
||||
"https://nitter.nixnet.services",
|
||||
"https://nitter.pussthecat.org",
|
||||
"https://nitter.dark.fail",
|
||||
"https://nitter.tedomum.net",
|
||||
"https://nitter.cattube.org",
|
||||
"https://nitter.fdn.fr",
|
||||
"https://nitter.1d4.us",
|
||||
"https://nitter.kavin.rocks",
|
||||
"https://tweet.lambda.dance",
|
||||
"https://nitter.cc",
|
||||
"https://nitter.vxempire.xyz",
|
||||
"https://nitter.unixfox.eu",
|
||||
"https://bird.trom.tf"
|
||||
];
|
||||
'https://nitter.net',
|
||||
'https://nitter.snopyta.org',
|
||||
'https://nitter.42l.fr',
|
||||
'https://nitter.nixnet.services',
|
||||
'https://nitter.pussthecat.org',
|
||||
'https://nitter.dark.fail',
|
||||
'https://nitter.tedomum.net',
|
||||
'https://nitter.cattube.org',
|
||||
'https://nitter.fdn.fr',
|
||||
'https://nitter.1d4.us',
|
||||
'https://nitter.kavin.rocks',
|
||||
'https://tweet.lambda.dance',
|
||||
'https://nitter.cc',
|
||||
'https://nitter.vxempire.xyz',
|
||||
'https://nitter.unixfox.eu',
|
||||
'https://bird.trom.tf'
|
||||
]
|
||||
|
||||
let disableNitter;
|
||||
let nitterInstance;
|
||||
let redirectBypassFlag;
|
||||
let exceptions;
|
||||
let disableNitter
|
||||
let nitterInstance
|
||||
let redirectBypassFlag
|
||||
let exceptions
|
||||
|
||||
window.browser = window.browser || window.chrome;
|
||||
window.browser = window.browser || window.chrome
|
||||
|
||||
function getRandomInstance() {
|
||||
return nitterInstances[~~(nitterInstances.length * Math.random())];
|
||||
function getRandomInstance () {
|
||||
return nitterInstances[~~(nitterInstances.length * Math.random())]
|
||||
}
|
||||
|
||||
function isNotException(url) {
|
||||
return !exceptions.some((regex) => regex.test(url.href));
|
||||
function isNotException (url) {
|
||||
return !exceptions.some((regex) => regex.test(url.href))
|
||||
}
|
||||
|
||||
function shouldRedirect(url) {
|
||||
function shouldRedirect (url) {
|
||||
return (
|
||||
!redirectBypassFlag &&
|
||||
isNotException(url) &&
|
||||
!disableNitter &&
|
||||
url.host !== nitterInstance &&
|
||||
!url.pathname.includes("/home")
|
||||
);
|
||||
!url.pathname.includes('/home')
|
||||
)
|
||||
}
|
||||
|
||||
function redirectTwitter(url) {
|
||||
if (url.host.split(".")[0] === "pbs") {
|
||||
return `${nitterInstance}/pic/${encodeURIComponent(url.href)}`;
|
||||
} else if (url.host.split(".")[0] === "video") {
|
||||
return `${nitterInstance}/gif/${encodeURIComponent(url.href)}`;
|
||||
function redirectTwitter (url) {
|
||||
if (url.host.split('.')[0] === 'pbs') {
|
||||
return `${nitterInstance}/pic/${encodeURIComponent(url.href)}`
|
||||
} else if (url.host.split('.')[0] === 'video') {
|
||||
return `${nitterInstance}/gif/${encodeURIComponent(url.href)}`
|
||||
} else {
|
||||
return `${nitterInstance}${url.pathname}${url.search}`;
|
||||
return `${nitterInstance}${url.pathname}${url.search}`
|
||||
}
|
||||
}
|
||||
|
||||
browser.storage.sync.get(
|
||||
[
|
||||
"nitterInstance",
|
||||
"disableNitter",
|
||||
"removeTwitterSW",
|
||||
"redirectBypassFlag",
|
||||
"exceptions",
|
||||
'nitterInstance',
|
||||
'disableNitter',
|
||||
'removeTwitterSW',
|
||||
'redirectBypassFlag',
|
||||
'exceptions'
|
||||
],
|
||||
(result) => {
|
||||
redirectBypassFlag = result.redirectBypassFlag;
|
||||
redirectBypassFlag = result.redirectBypassFlag
|
||||
browser.storage.sync.set({
|
||||
redirectBypassFlag: false,
|
||||
});
|
||||
redirectBypassFlag: false
|
||||
})
|
||||
if (!result.removeTwitterSW) {
|
||||
disableNitter = result.disableNitter;
|
||||
nitterInstance = result.nitterInstance || getRandomInstance();
|
||||
disableNitter = result.disableNitter
|
||||
nitterInstance = result.nitterInstance || getRandomInstance()
|
||||
exceptions = result.exceptions
|
||||
? result.exceptions.map((e) => {
|
||||
return new RegExp(e);
|
||||
return new RegExp(e)
|
||||
})
|
||||
: [];
|
||||
: []
|
||||
navigator.serviceWorker.getRegistrations().then((registrations) => {
|
||||
for (let registration of registrations) {
|
||||
if (registration.scope === "https://twitter.com/") {
|
||||
registration.unregister();
|
||||
console.log("Unregistered Twitter SW", registration);
|
||||
for (const registration of registrations) {
|
||||
if (registration.scope === 'https://twitter.com/') {
|
||||
registration.unregister()
|
||||
console.log('Unregistered Twitter SW', registration)
|
||||
}
|
||||
}
|
||||
});
|
||||
const url = new URL(window.location);
|
||||
})
|
||||
const url = new URL(window.location)
|
||||
if (shouldRedirect(url)) {
|
||||
const redirect = redirectTwitter(url);
|
||||
console.info("Redirecting", `"${url.href}"`, "=>", `"${redirect}"`);
|
||||
window.location = redirect;
|
||||
const redirect = redirectTwitter(url)
|
||||
console.info('Redirecting', `"${url.href}"`, '=>', `"${redirect}"`)
|
||||
window.location = redirect
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
// Keeping this here until https://bugzilla.mozilla.org/show_bug.cgi?id=1536094 is fixed...
|
||||
//
|
||||
//"use strict";
|
||||
// "use strict";
|
||||
//
|
||||
//let disableNitter;
|
||||
//let nitterInstance;
|
||||
//let redirectBypassFlag;
|
||||
//let exceptions;
|
||||
// let disableNitter;
|
||||
// let nitterInstance;
|
||||
// let redirectBypassFlag;
|
||||
// let exceptions;
|
||||
//
|
||||
//window.browser = window.browser || window.chrome;
|
||||
// window.browser = window.browser || window.chrome;
|
||||
//
|
||||
//Promise.all([
|
||||
// Promise.all([
|
||||
// import(browser.extension.getURL("src/assets/javascripts/helpers/common.js")),
|
||||
// import(browser.extension.getURL("src/assets/javascripts/helpers/twitter.js")),
|
||||
//]).then(
|
||||
// ]).then(
|
||||
// (helpers) => {
|
||||
// let commonHelper;
|
||||
// let twitterHelper;
|
||||
@@ -183,4 +183,4 @@ browser.storage.sync.get(
|
||||
// (error) => {
|
||||
// console.error(error);
|
||||
// }
|
||||
//);
|
||||
// );
|
||||
|
||||
+387
-391
File diff suppressed because it is too large
Load Diff
+400
-401
@@ -1,584 +1,583 @@
|
||||
"use strict";
|
||||
'use strict'
|
||||
|
||||
import commonHelper from "../../assets/javascripts/helpers/common.js";
|
||||
import twitterHelper from "../../assets/javascripts/helpers/twitter.js";
|
||||
import youtubeHelper from "../../assets/javascripts/helpers/youtube.js";
|
||||
import instagramHelper from "../../assets/javascripts/helpers/instagram.js";
|
||||
import mapsHelper from "../../assets/javascripts/helpers/google-maps.js";
|
||||
import redditHelper from "../../assets/javascripts/helpers/reddit.js";
|
||||
import searchHelper from "../../assets/javascripts/helpers/google-search.js";
|
||||
import googleTranslateHelper from "../../assets/javascripts/helpers/google-translate.js";
|
||||
import wikipediaHelper from "../../assets/javascripts/helpers/wikipedia.js";
|
||||
import commonHelper from '../../assets/javascripts/helpers/common.js'
|
||||
import twitterHelper from '../../assets/javascripts/helpers/twitter.js'
|
||||
import youtubeHelper from '../../assets/javascripts/helpers/youtube.js'
|
||||
import instagramHelper from '../../assets/javascripts/helpers/instagram.js'
|
||||
import mapsHelper from '../../assets/javascripts/helpers/google-maps.js'
|
||||
import redditHelper from '../../assets/javascripts/helpers/reddit.js'
|
||||
import searchHelper from '../../assets/javascripts/helpers/google-search.js'
|
||||
import googleTranslateHelper from '../../assets/javascripts/helpers/google-translate.js'
|
||||
import wikipediaHelper from '../../assets/javascripts/helpers/wikipedia.js'
|
||||
|
||||
const nitterInstances = twitterHelper.redirects;
|
||||
const invidiousInstances = youtubeHelper.redirects;
|
||||
const bibliogramInstances = instagramHelper.redirects;
|
||||
const osmInstances = mapsHelper.redirects;
|
||||
const redditInstances = redditHelper.redirects;
|
||||
const searchEngineInstances = searchHelper.redirects;
|
||||
const simplyTranslateInstances = googleTranslateHelper.redirects;
|
||||
const wikipediaInstances = wikipediaHelper.redirects;
|
||||
const nitterInstances = twitterHelper.redirects
|
||||
const invidiousInstances = youtubeHelper.redirects
|
||||
const bibliogramInstances = instagramHelper.redirects
|
||||
const osmInstances = mapsHelper.redirects
|
||||
const redditInstances = redditHelper.redirects
|
||||
const searchEngineInstances = searchHelper.redirects
|
||||
const simplyTranslateInstances = googleTranslateHelper.redirects
|
||||
const wikipediaInstances = wikipediaHelper.redirects
|
||||
const autocompletes = [
|
||||
{ id: "nitter-instance", instances: nitterInstances },
|
||||
{ id: "invidious-instance", instances: invidiousInstances },
|
||||
{ id: "bibliogram-instance", instances: bibliogramInstances },
|
||||
{ id: "osm-instance", instances: osmInstances },
|
||||
{ id: "reddit-instance", instances: redditInstances },
|
||||
{ id: 'nitter-instance', instances: nitterInstances },
|
||||
{ id: 'invidious-instance', instances: invidiousInstances },
|
||||
{ id: 'bibliogram-instance', instances: bibliogramInstances },
|
||||
{ id: 'osm-instance', instances: osmInstances },
|
||||
{ id: 'reddit-instance', instances: redditInstances },
|
||||
{
|
||||
id: "search-engine-instance",
|
||||
instances: searchEngineInstances.map((instance) => instance.link),
|
||||
id: 'search-engine-instance',
|
||||
instances: searchEngineInstances.map((instance) => instance.link)
|
||||
},
|
||||
{ id: "simply-translate-instance", instances: simplyTranslateInstances },
|
||||
{ id: "wikipedia-instance", instances: wikipediaInstances },
|
||||
];
|
||||
const domparser = new DOMParser();
|
||||
{ id: 'simply-translate-instance', instances: simplyTranslateInstances },
|
||||
{ id: 'wikipedia-instance', instances: wikipediaInstances }
|
||||
]
|
||||
const domparser = new DOMParser()
|
||||
|
||||
let nitterInstance = document.getElementById("nitter-instance");
|
||||
let invidiousInstance = document.getElementById("invidious-instance");
|
||||
let bibliogramInstance = document.getElementById("bibliogram-instance");
|
||||
let osmInstance = document.getElementById("osm-instance");
|
||||
let redditInstance = document.getElementById("reddit-instance");
|
||||
let searchEngineInstance = document.getElementById("search-engine-instance");
|
||||
let simplyTranslateInstance = document.getElementById(
|
||||
"simply-translate-instance"
|
||||
);
|
||||
let wikipediaInstance = document.getElementById("wikipedia-instance");
|
||||
let disableNitter = document.getElementById("disable-nitter");
|
||||
let disableInvidious = document.getElementById("disable-invidious");
|
||||
let disableBibliogram = document.getElementById("disable-bibliogram");
|
||||
let disableOsm = document.getElementById("disable-osm");
|
||||
let disableReddit = document.getElementById("disable-reddit");
|
||||
let disableSearchEngine = document.getElementById("disable-search-engine");
|
||||
let disableSimplyTranslate = document.getElementById(
|
||||
"disable-simply-translate"
|
||||
);
|
||||
let disableWikipedia = document.getElementById("disable-wikipedia");
|
||||
let alwaysProxy = document.getElementById("always-proxy");
|
||||
let onlyEmbeddedVideo = document.getElementById("only-embed");
|
||||
let videoQuality = document.getElementById("video-quality");
|
||||
let removeTwitterSW = document.getElementById("remove-twitter-sw");
|
||||
let invidiousDarkMode = document.getElementById("invidious-dark-mode");
|
||||
let persistInvidiousPrefs = document.getElementById("persist-invidious-prefs");
|
||||
let invidiousVolume = document.getElementById("invidious-volume");
|
||||
let invidiousPlayerStyle = document.getElementById("invidious-player-style");
|
||||
let invidiousSubtitles = document.getElementById("invidious-subtitles");
|
||||
let invidiousAutoplay = document.getElementById("invidious-autoplay");
|
||||
let theme = document.getElementById("theme");
|
||||
let useFreeTube = document.getElementById("use-freetube");
|
||||
let nitterRandomPool = document.getElementById("nitter-random-pool");
|
||||
let invidiousRandomPool = document.getElementById("invidious-random-pool");
|
||||
let bibliogramRandomPool = document.getElementById("bibliogram-random-pool");
|
||||
let exceptions;
|
||||
const nitterInstance = document.getElementById('nitter-instance')
|
||||
const invidiousInstance = document.getElementById('invidious-instance')
|
||||
const bibliogramInstance = document.getElementById('bibliogram-instance')
|
||||
const osmInstance = document.getElementById('osm-instance')
|
||||
const redditInstance = document.getElementById('reddit-instance')
|
||||
const searchEngineInstance = document.getElementById('search-engine-instance')
|
||||
const simplyTranslateInstance = document.getElementById(
|
||||
'simply-translate-instance'
|
||||
)
|
||||
const wikipediaInstance = document.getElementById('wikipedia-instance')
|
||||
const disableNitter = document.getElementById('disable-nitter')
|
||||
const disableInvidious = document.getElementById('disable-invidious')
|
||||
const disableBibliogram = document.getElementById('disable-bibliogram')
|
||||
const disableOsm = document.getElementById('disable-osm')
|
||||
const disableReddit = document.getElementById('disable-reddit')
|
||||
const disableSearchEngine = document.getElementById('disable-search-engine')
|
||||
const disableSimplyTranslate = document.getElementById(
|
||||
'disable-simply-translate'
|
||||
)
|
||||
const disableWikipedia = document.getElementById('disable-wikipedia')
|
||||
const alwaysProxy = document.getElementById('always-proxy')
|
||||
const onlyEmbeddedVideo = document.getElementById('only-embed')
|
||||
const videoQuality = document.getElementById('video-quality')
|
||||
const removeTwitterSW = document.getElementById('remove-twitter-sw')
|
||||
const invidiousDarkMode = document.getElementById('invidious-dark-mode')
|
||||
const persistInvidiousPrefs = document.getElementById('persist-invidious-prefs')
|
||||
const invidiousVolume = document.getElementById('invidious-volume')
|
||||
const invidiousPlayerStyle = document.getElementById('invidious-player-style')
|
||||
const invidiousSubtitles = document.getElementById('invidious-subtitles')
|
||||
const invidiousAutoplay = document.getElementById('invidious-autoplay')
|
||||
const theme = document.getElementById('theme')
|
||||
const useFreeTube = document.getElementById('use-freetube')
|
||||
const nitterRandomPool = document.getElementById('nitter-random-pool')
|
||||
const invidiousRandomPool = document.getElementById('invidious-random-pool')
|
||||
const bibliogramRandomPool = document.getElementById('bibliogram-random-pool')
|
||||
let exceptions
|
||||
|
||||
window.browser = window.browser || window.chrome;
|
||||
window.browser = window.browser || window.chrome
|
||||
|
||||
function prependExceptionsItem(item, index) {
|
||||
const li = document.createElement("li");
|
||||
li.appendChild(document.createTextNode(item.toString()));
|
||||
const button = document.createElement("button");
|
||||
li.appendChild(button);
|
||||
document.getElementById("exceptions-items").prepend(li);
|
||||
function prependExceptionsItem (item, index) {
|
||||
const li = document.createElement('li')
|
||||
li.appendChild(document.createTextNode(item.toString()))
|
||||
const button = document.createElement('button')
|
||||
li.appendChild(button)
|
||||
document.getElementById('exceptions-items').prepend(li)
|
||||
const svg = `<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 512 512'>
|
||||
<line x1='368' y1='368' x2='144' y2='144'
|
||||
style='fill:none;stroke:#FFF;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px' />
|
||||
<line x1='368' y1='144' x2='144' y2='368'
|
||||
style='fill:none;stroke:#FFF;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px' />
|
||||
</svg>`;
|
||||
</svg>`
|
||||
button.appendChild(
|
||||
domparser.parseFromString(svg, "image/svg+xml").documentElement
|
||||
);
|
||||
button.addEventListener("click", () => {
|
||||
exceptions.splice(index, 1);
|
||||
domparser.parseFromString(svg, 'image/svg+xml').documentElement
|
||||
)
|
||||
button.addEventListener('click', () => {
|
||||
exceptions.splice(index, 1)
|
||||
browser.storage.sync.set({
|
||||
exceptions: exceptions,
|
||||
});
|
||||
li.remove();
|
||||
});
|
||||
exceptions: exceptions
|
||||
})
|
||||
li.remove()
|
||||
})
|
||||
}
|
||||
|
||||
browser.storage.sync.get(
|
||||
[
|
||||
"nitterInstance",
|
||||
"invidiousInstance",
|
||||
"bibliogramInstance",
|
||||
"osmInstance",
|
||||
"redditInstance",
|
||||
"searchEngineInstance",
|
||||
"simplyTranslateInstance",
|
||||
"wikipediaInstance",
|
||||
"disableNitter",
|
||||
"disableInvidious",
|
||||
"disableBibliogram",
|
||||
"disableOsm",
|
||||
"disableReddit",
|
||||
"disableSearchEngine",
|
||||
"disableSimplyTranslate",
|
||||
"disableWikipedia",
|
||||
"alwaysProxy",
|
||||
"onlyEmbeddedVideo",
|
||||
"videoQuality",
|
||||
"removeTwitterSW",
|
||||
"invidiousDarkMode",
|
||||
"persistInvidiousPrefs",
|
||||
"invidiousVolume",
|
||||
"invidiousPlayerStyle",
|
||||
"invidiousSubtitles",
|
||||
"invidiousAutoplay",
|
||||
"exceptions",
|
||||
"theme",
|
||||
"useFreeTube",
|
||||
"nitterRandomPool",
|
||||
"invidiousRandomPool",
|
||||
"bibliogramRandomPool",
|
||||
'nitterInstance',
|
||||
'invidiousInstance',
|
||||
'bibliogramInstance',
|
||||
'osmInstance',
|
||||
'redditInstance',
|
||||
'searchEngineInstance',
|
||||
'simplyTranslateInstance',
|
||||
'wikipediaInstance',
|
||||
'disableNitter',
|
||||
'disableInvidious',
|
||||
'disableBibliogram',
|
||||
'disableOsm',
|
||||
'disableReddit',
|
||||
'disableSearchEngine',
|
||||
'disableSimplyTranslate',
|
||||
'disableWikipedia',
|
||||
'alwaysProxy',
|
||||
'onlyEmbeddedVideo',
|
||||
'videoQuality',
|
||||
'removeTwitterSW',
|
||||
'invidiousDarkMode',
|
||||
'persistInvidiousPrefs',
|
||||
'invidiousVolume',
|
||||
'invidiousPlayerStyle',
|
||||
'invidiousSubtitles',
|
||||
'invidiousAutoplay',
|
||||
'exceptions',
|
||||
'theme',
|
||||
'useFreeTube',
|
||||
'nitterRandomPool',
|
||||
'invidiousRandomPool',
|
||||
'bibliogramRandomPool'
|
||||
],
|
||||
(result) => {
|
||||
theme.value = result.theme || "";
|
||||
if (result.theme) document.body.classList.add(result.theme);
|
||||
nitterInstance.value = result.nitterInstance || "";
|
||||
invidiousInstance.value = result.invidiousInstance || "";
|
||||
bibliogramInstance.value = result.bibliogramInstance || "";
|
||||
osmInstance.value = result.osmInstance || "";
|
||||
redditInstance.value = result.redditInstance || "";
|
||||
theme.value = result.theme || ''
|
||||
if (result.theme) document.body.classList.add(result.theme)
|
||||
nitterInstance.value = result.nitterInstance || ''
|
||||
invidiousInstance.value = result.invidiousInstance || ''
|
||||
bibliogramInstance.value = result.bibliogramInstance || ''
|
||||
osmInstance.value = result.osmInstance || ''
|
||||
redditInstance.value = result.redditInstance || ''
|
||||
searchEngineInstance.value =
|
||||
(result.searchEngineInstance && result.searchEngineInstance.link) || "";
|
||||
simplyTranslateInstance.value = result.simplyTranslateInstance || "";
|
||||
wikipediaInstance.value = result.wikipediaInstance || "";
|
||||
disableNitter.checked = !result.disableNitter;
|
||||
disableInvidious.checked = !result.disableInvidious;
|
||||
disableBibliogram.checked = !result.disableBibliogram;
|
||||
disableOsm.checked = !result.disableOsm;
|
||||
disableReddit.checked = !result.disableReddit;
|
||||
disableSearchEngine.checked = !result.disableSearchEngine;
|
||||
disableSimplyTranslate.checked = !result.disableSimplyTranslate;
|
||||
disableWikipedia.checked = !result.disableWikipedia;
|
||||
alwaysProxy.checked = result.alwaysProxy;
|
||||
onlyEmbeddedVideo.checked = result.onlyEmbeddedVideo;
|
||||
videoQuality.value = result.videoQuality || "";
|
||||
removeTwitterSW.checked = !result.removeTwitterSW;
|
||||
invidiousDarkMode.checked = result.invidiousDarkMode;
|
||||
persistInvidiousPrefs.checked = result.persistInvidiousPrefs;
|
||||
exceptions = result.exceptions || [];
|
||||
exceptions.forEach(prependExceptionsItem);
|
||||
invidiousVolume.value = result.invidiousVolume;
|
||||
document.querySelector("#volume-value").textContent = result.invidiousVolume
|
||||
(result.searchEngineInstance && result.searchEngineInstance.link) || ''
|
||||
simplyTranslateInstance.value = result.simplyTranslateInstance || ''
|
||||
wikipediaInstance.value = result.wikipediaInstance || ''
|
||||
disableNitter.checked = !result.disableNitter
|
||||
disableInvidious.checked = !result.disableInvidious
|
||||
disableBibliogram.checked = !result.disableBibliogram
|
||||
disableOsm.checked = !result.disableOsm
|
||||
disableReddit.checked = !result.disableReddit
|
||||
disableSearchEngine.checked = !result.disableSearchEngine
|
||||
disableSimplyTranslate.checked = !result.disableSimplyTranslate
|
||||
disableWikipedia.checked = !result.disableWikipedia
|
||||
alwaysProxy.checked = result.alwaysProxy
|
||||
onlyEmbeddedVideo.checked = result.onlyEmbeddedVideo
|
||||
videoQuality.value = result.videoQuality || ''
|
||||
removeTwitterSW.checked = !result.removeTwitterSW
|
||||
invidiousDarkMode.checked = result.invidiousDarkMode
|
||||
persistInvidiousPrefs.checked = result.persistInvidiousPrefs
|
||||
exceptions = result.exceptions || []
|
||||
exceptions.forEach(prependExceptionsItem)
|
||||
invidiousVolume.value = result.invidiousVolume
|
||||
document.querySelector('#volume-value').textContent = result.invidiousVolume
|
||||
? `${result.invidiousVolume}%`
|
||||
: " - ";
|
||||
invidiousPlayerStyle.value = result.invidiousPlayerStyle || "";
|
||||
invidiousSubtitles.value = result.invidiousSubtitles || "";
|
||||
invidiousAutoplay.checked = result.invidiousAutoplay;
|
||||
useFreeTube.checked = result.useFreeTube;
|
||||
: ' - '
|
||||
invidiousPlayerStyle.value = result.invidiousPlayerStyle || ''
|
||||
invidiousSubtitles.value = result.invidiousSubtitles || ''
|
||||
invidiousAutoplay.checked = result.invidiousAutoplay
|
||||
useFreeTube.checked = result.useFreeTube
|
||||
nitterRandomPool.value =
|
||||
result.nitterRandomPool || commonHelper.filterInstances(nitterInstances);
|
||||
result.nitterRandomPool || commonHelper.filterInstances(nitterInstances)
|
||||
invidiousRandomPool.value =
|
||||
result.invidiousRandomPool ||
|
||||
commonHelper.filterInstances(invidiousInstances);
|
||||
commonHelper.filterInstances(invidiousInstances)
|
||||
bibliogramRandomPool.value =
|
||||
result.bibliogramRandomPool ||
|
||||
commonHelper.filterInstances(bibliogramInstances);
|
||||
commonHelper.filterInstances(bibliogramInstances)
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
function openTab(tab, event) {
|
||||
let i, tabcontent, tablinks;
|
||||
tabcontent = document.getElementsByClassName("tabcontent");
|
||||
function openTab (tab, event) {
|
||||
let i, tabcontent, tablinks
|
||||
tabcontent = document.getElementsByClassName('tabcontent')
|
||||
for (i = 0; i < tabcontent.length; i++) {
|
||||
tabcontent[i].style.display = "none";
|
||||
tabcontent[i].style.display = 'none'
|
||||
}
|
||||
tablinks = document.getElementsByClassName("tablinks");
|
||||
tablinks = document.getElementsByClassName('tablinks')
|
||||
for (i = 0; i < tablinks.length; i++) {
|
||||
tablinks[i].className = tablinks[i].className.replace(" active", "");
|
||||
tablinks[i].className = tablinks[i].className.replace(' active', '')
|
||||
}
|
||||
document.getElementById(tab).style.display = "block";
|
||||
event.currentTarget.className += " active";
|
||||
document.getElementById(tab).style.display = 'block'
|
||||
event.currentTarget.className += ' active'
|
||||
}
|
||||
|
||||
document
|
||||
.getElementById("general-tab")
|
||||
.addEventListener("click", openTab.bind(null, "general"));
|
||||
.getElementById('general-tab')
|
||||
.addEventListener('click', openTab.bind(null, 'general'))
|
||||
document
|
||||
.getElementById("advanced-tab")
|
||||
.addEventListener("click", openTab.bind(null, "advanced"));
|
||||
.getElementById('advanced-tab')
|
||||
.addEventListener('click', openTab.bind(null, 'advanced'))
|
||||
document
|
||||
.getElementById("exceptions-tab")
|
||||
.addEventListener("click", openTab.bind(null, "exceptions"));
|
||||
.getElementById('exceptions-tab')
|
||||
.addEventListener('click', openTab.bind(null, 'exceptions'))
|
||||
|
||||
document.getElementById("general-tab").click();
|
||||
document.getElementById('general-tab').click()
|
||||
|
||||
function addToExceptions() {
|
||||
const input = document.getElementById("new-exceptions-item");
|
||||
const type = document.querySelector('input[name="type"]:checked').value;
|
||||
function addToExceptions () {
|
||||
const input = document.getElementById('new-exceptions-item')
|
||||
const type = document.querySelector('input[name="type"]:checked').value
|
||||
if (input.value) {
|
||||
try {
|
||||
let value = input.value;
|
||||
new RegExp(input.value);
|
||||
if (type === "URL") {
|
||||
value = value.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
||||
let value = input.value
|
||||
new RegExp(input.value)
|
||||
if (type === 'URL') {
|
||||
value = value.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||
}
|
||||
exceptions.push(value);
|
||||
exceptions.push(value)
|
||||
browser.storage.sync.set({
|
||||
exceptions: exceptions,
|
||||
});
|
||||
prependExceptionsItem(value, exceptions.indexOf(value));
|
||||
input.value = "";
|
||||
exceptions: exceptions
|
||||
})
|
||||
prependExceptionsItem(value, exceptions.indexOf(value))
|
||||
input.value = ''
|
||||
} catch (error) {
|
||||
input.setCustomValidity("Invalid RegExp");
|
||||
input.setCustomValidity('Invalid RegExp')
|
||||
}
|
||||
} else {
|
||||
input.setCustomValidity("Invalid RegExp");
|
||||
input.setCustomValidity('Invalid RegExp')
|
||||
}
|
||||
}
|
||||
|
||||
document
|
||||
.getElementById("add-to-exceptions")
|
||||
.addEventListener("click", addToExceptions);
|
||||
.getElementById('add-to-exceptions')
|
||||
.addEventListener('click', addToExceptions)
|
||||
|
||||
function debounce(func, wait, immediate) {
|
||||
let timeout;
|
||||
function debounce (func, wait, immediate) {
|
||||
let timeout
|
||||
return () => {
|
||||
let context = this,
|
||||
args = arguments;
|
||||
let later = () => {
|
||||
timeout = null;
|
||||
if (!immediate) func.apply(context, args);
|
||||
};
|
||||
let callNow = immediate && !timeout;
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(later, wait);
|
||||
if (callNow) func.apply(context, args);
|
||||
};
|
||||
const context = this
|
||||
const args = arguments
|
||||
const later = () => {
|
||||
timeout = null
|
||||
if (!immediate) func.apply(context, args)
|
||||
}
|
||||
const callNow = immediate && !timeout
|
||||
clearTimeout(timeout)
|
||||
timeout = setTimeout(later, wait)
|
||||
if (callNow) func.apply(context, args)
|
||||
}
|
||||
}
|
||||
|
||||
function parseURL(urlString) {
|
||||
function parseURL (urlString) {
|
||||
if (urlString) {
|
||||
try {
|
||||
const url = new URL(urlString);
|
||||
const url = new URL(urlString)
|
||||
if (url.username && url.password) {
|
||||
return `${url.protocol}//${url.username}:${url.password}@${url.host}`;
|
||||
return `${url.protocol}//${url.username}:${url.password}@${url.host}`
|
||||
} else {
|
||||
return url.origin;
|
||||
return url.origin
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return "";
|
||||
console.log(error)
|
||||
return ''
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
const nitterInstanceChange = debounce(() => {
|
||||
if (nitterInstance.checkValidity()) {
|
||||
browser.storage.sync.set({
|
||||
nitterInstance: parseURL(nitterInstance.value),
|
||||
});
|
||||
nitterInstance: parseURL(nitterInstance.value)
|
||||
})
|
||||
}
|
||||
}, 500);
|
||||
nitterInstance.addEventListener("input", nitterInstanceChange);
|
||||
}, 500)
|
||||
nitterInstance.addEventListener('input', nitterInstanceChange)
|
||||
|
||||
const invidiousInstanceChange = debounce(() => {
|
||||
if (invidiousInstance.checkValidity()) {
|
||||
browser.storage.sync.set({
|
||||
invidiousInstance: parseURL(invidiousInstance.value),
|
||||
});
|
||||
invidiousInstance: parseURL(invidiousInstance.value)
|
||||
})
|
||||
}
|
||||
}, 500);
|
||||
invidiousInstance.addEventListener("input", invidiousInstanceChange);
|
||||
}, 500)
|
||||
invidiousInstance.addEventListener('input', invidiousInstanceChange)
|
||||
|
||||
const bibliogramInstanceChange = debounce(() => {
|
||||
if (bibliogramInstance.checkValidity()) {
|
||||
browser.storage.sync.set({
|
||||
bibliogramInstance: parseURL(bibliogramInstance.value),
|
||||
});
|
||||
bibliogramInstance: parseURL(bibliogramInstance.value)
|
||||
})
|
||||
}
|
||||
}, 500);
|
||||
bibliogramInstance.addEventListener("input", bibliogramInstanceChange);
|
||||
}, 500)
|
||||
bibliogramInstance.addEventListener('input', bibliogramInstanceChange)
|
||||
|
||||
const osmInstanceChange = debounce(() => {
|
||||
if (osmInstance.checkValidity()) {
|
||||
browser.storage.sync.set({
|
||||
osmInstance: parseURL(osmInstance.value),
|
||||
});
|
||||
osmInstance: parseURL(osmInstance.value)
|
||||
})
|
||||
}
|
||||
}, 500);
|
||||
osmInstance.addEventListener("input", osmInstanceChange);
|
||||
}, 500)
|
||||
osmInstance.addEventListener('input', osmInstanceChange)
|
||||
|
||||
const redditInstanceChange = debounce(() => {
|
||||
if (redditInstance.checkValidity()) {
|
||||
browser.storage.sync.set({
|
||||
redditInstance: parseURL(redditInstance.value),
|
||||
});
|
||||
redditInstance: parseURL(redditInstance.value)
|
||||
})
|
||||
}
|
||||
}, 500);
|
||||
redditInstance.addEventListener("input", redditInstanceChange);
|
||||
}, 500)
|
||||
redditInstance.addEventListener('input', redditInstanceChange)
|
||||
|
||||
const searchEngineInstanceChange = debounce(() => {
|
||||
const instance = searchEngineInstances.find(
|
||||
(instance) => instance.link === searchEngineInstance.value
|
||||
);
|
||||
)
|
||||
if (instance || !searchEngineInstance.value) {
|
||||
browser.storage.sync.set({
|
||||
searchEngineInstance: instance || searchEngineInstance.value,
|
||||
});
|
||||
searchEngineInstance: instance || searchEngineInstance.value
|
||||
})
|
||||
} else {
|
||||
searchEngineInstance.setCustomValidity("Must be an instance from the list");
|
||||
searchEngineInstance.setCustomValidity('Must be an instance from the list')
|
||||
}
|
||||
}, 500);
|
||||
searchEngineInstance.addEventListener("input", searchEngineInstanceChange);
|
||||
}, 500)
|
||||
searchEngineInstance.addEventListener('input', searchEngineInstanceChange)
|
||||
|
||||
const simplyTranslateInstanceChange = debounce(() => {
|
||||
if (simplyTranslateInstance.checkValidity()) {
|
||||
browser.storage.sync.set({
|
||||
simplyTranslateInstance: parseURL(simplyTranslateInstance.value),
|
||||
});
|
||||
simplyTranslateInstance: parseURL(simplyTranslateInstance.value)
|
||||
})
|
||||
}
|
||||
}, 500);
|
||||
}, 500)
|
||||
simplyTranslateInstance.addEventListener(
|
||||
"input",
|
||||
'input',
|
||||
simplyTranslateInstanceChange
|
||||
);
|
||||
)
|
||||
|
||||
const wikipediaInstanceChange = debounce(() => {
|
||||
if (wikipediaInstance.checkValidity()) {
|
||||
browser.storage.sync.set({
|
||||
wikipediaInstance: parseURL(wikipediaInstance.value),
|
||||
});
|
||||
wikipediaInstance: parseURL(wikipediaInstance.value)
|
||||
})
|
||||
}
|
||||
}, 500);
|
||||
}, 500)
|
||||
wikipediaInstance.addEventListener(
|
||||
"input",
|
||||
'input',
|
||||
wikipediaInstanceChange
|
||||
);
|
||||
)
|
||||
|
||||
disableNitter.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableNitter: !event.target.checked });
|
||||
});
|
||||
disableNitter.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableNitter: !event.target.checked })
|
||||
})
|
||||
|
||||
disableInvidious.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableInvidious: !event.target.checked });
|
||||
});
|
||||
disableInvidious.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableInvidious: !event.target.checked })
|
||||
})
|
||||
|
||||
disableBibliogram.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableBibliogram: !event.target.checked });
|
||||
});
|
||||
disableBibliogram.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableBibliogram: !event.target.checked })
|
||||
})
|
||||
|
||||
disableOsm.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableOsm: !event.target.checked });
|
||||
});
|
||||
disableOsm.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableOsm: !event.target.checked })
|
||||
})
|
||||
|
||||
disableReddit.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableReddit: !event.target.checked });
|
||||
});
|
||||
disableReddit.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableReddit: !event.target.checked })
|
||||
})
|
||||
|
||||
disableSearchEngine.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableSearchEngine: !event.target.checked });
|
||||
});
|
||||
disableSearchEngine.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableSearchEngine: !event.target.checked })
|
||||
})
|
||||
|
||||
disableSimplyTranslate.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableSimplyTranslate: !event.target.checked });
|
||||
});
|
||||
disableSimplyTranslate.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableSimplyTranslate: !event.target.checked })
|
||||
})
|
||||
|
||||
disableWikipedia.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableWikipedia: !event.target.checked });
|
||||
});
|
||||
disableWikipedia.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableWikipedia: !event.target.checked })
|
||||
})
|
||||
|
||||
alwaysProxy.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ alwaysProxy: event.target.checked });
|
||||
});
|
||||
alwaysProxy.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ alwaysProxy: event.target.checked })
|
||||
})
|
||||
|
||||
onlyEmbeddedVideo.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ onlyEmbeddedVideo: event.target.checked });
|
||||
});
|
||||
onlyEmbeddedVideo.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ onlyEmbeddedVideo: event.target.checked })
|
||||
})
|
||||
|
||||
videoQuality.addEventListener("change", (event) => {
|
||||
videoQuality.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({
|
||||
videoQuality: event.target.options[videoQuality.selectedIndex].value,
|
||||
});
|
||||
});
|
||||
videoQuality: event.target.options[videoQuality.selectedIndex].value
|
||||
})
|
||||
})
|
||||
|
||||
removeTwitterSW.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ removeTwitterSW: !event.target.checked });
|
||||
});
|
||||
removeTwitterSW.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ removeTwitterSW: !event.target.checked })
|
||||
})
|
||||
|
||||
invidiousDarkMode.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ invidiousDarkMode: event.target.checked });
|
||||
});
|
||||
invidiousDarkMode.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ invidiousDarkMode: event.target.checked })
|
||||
})
|
||||
|
||||
persistInvidiousPrefs.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ persistInvidiousPrefs: event.target.checked });
|
||||
});
|
||||
persistInvidiousPrefs.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ persistInvidiousPrefs: event.target.checked })
|
||||
})
|
||||
|
||||
useFreeTube.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ useFreeTube: event.target.checked });
|
||||
});
|
||||
useFreeTube.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ useFreeTube: event.target.checked })
|
||||
})
|
||||
|
||||
const invidiousVolumeChange = debounce(() => {
|
||||
document.querySelector(
|
||||
"#volume-value"
|
||||
).textContent = `${invidiousVolume.value}%`;
|
||||
'#volume-value'
|
||||
).textContent = `${invidiousVolume.value}%`
|
||||
browser.storage.sync.set({
|
||||
invidiousVolume: invidiousVolume.value,
|
||||
});
|
||||
}, 500);
|
||||
invidiousVolume.addEventListener("input", invidiousVolumeChange);
|
||||
invidiousVolume: invidiousVolume.value
|
||||
})
|
||||
}, 500)
|
||||
invidiousVolume.addEventListener('input', invidiousVolumeChange)
|
||||
|
||||
invidiousPlayerStyle.addEventListener("change", (event) => {
|
||||
invidiousPlayerStyle.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({
|
||||
invidiousPlayerStyle:
|
||||
event.target.options[invidiousPlayerStyle.selectedIndex].value,
|
||||
});
|
||||
});
|
||||
event.target.options[invidiousPlayerStyle.selectedIndex].value
|
||||
})
|
||||
})
|
||||
|
||||
const invidiousSubtitlesChange = debounce(() => {
|
||||
browser.storage.sync.set({ invidiousSubtitles: invidiousSubtitles.value });
|
||||
}, 500);
|
||||
invidiousSubtitles.addEventListener("input", invidiousSubtitlesChange);
|
||||
browser.storage.sync.set({ invidiousSubtitles: invidiousSubtitles.value })
|
||||
}, 500)
|
||||
invidiousSubtitles.addEventListener('input', invidiousSubtitlesChange)
|
||||
|
||||
invidiousAutoplay.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ invidiousAutoplay: event.target.checked });
|
||||
});
|
||||
invidiousAutoplay.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ invidiousAutoplay: event.target.checked })
|
||||
})
|
||||
|
||||
const nitterRandomPoolChange = debounce(() => {
|
||||
browser.storage.sync.set({ nitterRandomPool: nitterRandomPool.value });
|
||||
}, 500);
|
||||
nitterRandomPool.addEventListener("input", nitterRandomPoolChange);
|
||||
browser.storage.sync.set({ nitterRandomPool: nitterRandomPool.value })
|
||||
}, 500)
|
||||
nitterRandomPool.addEventListener('input', nitterRandomPoolChange)
|
||||
|
||||
const invidiousRandomPoolChange = debounce(() => {
|
||||
browser.storage.sync.set({ invidiousRandomPool: invidiousRandomPool.value });
|
||||
}, 500);
|
||||
invidiousRandomPool.addEventListener("input", invidiousRandomPoolChange);
|
||||
browser.storage.sync.set({ invidiousRandomPool: invidiousRandomPool.value })
|
||||
}, 500)
|
||||
invidiousRandomPool.addEventListener('input', invidiousRandomPoolChange)
|
||||
|
||||
const bibliogramRandomPoolChange = debounce(() => {
|
||||
browser.storage.sync.set({
|
||||
bibliogramRandomPool: bibliogramRandomPool.value,
|
||||
});
|
||||
}, 500);
|
||||
bibliogramRandomPool.addEventListener("input", bibliogramRandomPoolChange);
|
||||
bibliogramRandomPool: bibliogramRandomPool.value
|
||||
})
|
||||
}, 500)
|
||||
bibliogramRandomPool.addEventListener('input', bibliogramRandomPoolChange)
|
||||
|
||||
theme.addEventListener("change", (event) => {
|
||||
const value = event.target.options[theme.selectedIndex].value;
|
||||
theme.addEventListener('change', (event) => {
|
||||
const value = event.target.options[theme.selectedIndex].value
|
||||
switch (value) {
|
||||
case "dark-theme":
|
||||
document.body.classList.add("dark-theme");
|
||||
document.body.classList.remove("light-theme");
|
||||
break;
|
||||
case "light-theme":
|
||||
document.body.classList.add("light-theme");
|
||||
document.body.classList.remove("dark-theme");
|
||||
break;
|
||||
case 'dark-theme':
|
||||
document.body.classList.add('dark-theme')
|
||||
document.body.classList.remove('light-theme')
|
||||
break
|
||||
case 'light-theme':
|
||||
document.body.classList.add('light-theme')
|
||||
document.body.classList.remove('dark-theme')
|
||||
break
|
||||
default:
|
||||
document.body.classList.remove("light-theme");
|
||||
document.body.classList.remove("dark-theme");
|
||||
document.body.classList.remove('light-theme')
|
||||
document.body.classList.remove('dark-theme')
|
||||
}
|
||||
browser.storage.sync.set({
|
||||
theme: value,
|
||||
});
|
||||
});
|
||||
theme: value
|
||||
})
|
||||
})
|
||||
|
||||
function autocomplete(input, list) {
|
||||
let currentFocus;
|
||||
input.addEventListener("focus", (e) => {
|
||||
showOptions(e, true);
|
||||
});
|
||||
input.addEventListener("input", (e) => {
|
||||
const val = e.target.value;
|
||||
function autocomplete (input, list) {
|
||||
let currentFocus
|
||||
input.addEventListener('focus', (e) => {
|
||||
showOptions(e, true)
|
||||
})
|
||||
input.addEventListener('input', (e) => {
|
||||
const val = e.target.value
|
||||
if (!val) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
currentFocus = -1;
|
||||
showOptions(e);
|
||||
});
|
||||
input.addEventListener("keydown", function (e) {
|
||||
let x = document.getElementById(this.id + "autocomplete-list");
|
||||
if (x) x = x.getElementsByTagName("div");
|
||||
if (e.keyCode == 40) {
|
||||
currentFocus++;
|
||||
addActive(x);
|
||||
} else if (e.keyCode == 38) {
|
||||
currentFocus--;
|
||||
addActive(x);
|
||||
} else if (e.keyCode == 13) {
|
||||
e.preventDefault();
|
||||
currentFocus = -1
|
||||
showOptions(e)
|
||||
})
|
||||
input.addEventListener('keydown', function (e) {
|
||||
let x = document.getElementById(this.id + 'autocomplete-list')
|
||||
if (x) x = x.getElementsByTagName('div')
|
||||
if (e.keyCode === 40) {
|
||||
currentFocus++
|
||||
addActive(x)
|
||||
} else if (e.keyCode === 38) {
|
||||
currentFocus--
|
||||
addActive(x)
|
||||
} else if (e.keyCode === 13) {
|
||||
e.preventDefault()
|
||||
if (currentFocus > -1) {
|
||||
if (x) x[currentFocus].click();
|
||||
if (x) x[currentFocus].click()
|
||||
}
|
||||
}
|
||||
});
|
||||
function showOptions(event, showAll = false) {
|
||||
let div,
|
||||
i,
|
||||
val = event.target.value;
|
||||
closeAllLists();
|
||||
div = document.createElement("div");
|
||||
div.setAttribute("id", event.target.id + "autocomplete-list");
|
||||
div.setAttribute("class", "autocomplete-items");
|
||||
event.target.parentNode.appendChild(div);
|
||||
})
|
||||
function showOptions (event, showAll = false) {
|
||||
let i
|
||||
const val = event.target.value
|
||||
closeAllLists()
|
||||
const div = document.createElement('div')
|
||||
div.setAttribute('id', event.target.id + 'autocomplete-list')
|
||||
div.setAttribute('class', 'autocomplete-items')
|
||||
event.target.parentNode.appendChild(div)
|
||||
for (i = 0; i < list.length; i++) {
|
||||
if (list[i].toLowerCase().indexOf(val.toLowerCase()) > -1) {
|
||||
div.appendChild(getItem(list[i], val));
|
||||
div.appendChild(getItem(list[i], val))
|
||||
} else if (showAll) {
|
||||
div.appendChild(getItem(list[i], val));
|
||||
div.appendChild(getItem(list[i], val))
|
||||
}
|
||||
}
|
||||
}
|
||||
function getItem(item, val) {
|
||||
const div = document.createElement("div");
|
||||
const strong = document.createElement("strong");
|
||||
strong.textContent = item.substr(0, val.length);
|
||||
div.innerText = item.substr(val.length);
|
||||
const hiddenInput = document.createElement("input");
|
||||
hiddenInput.type = "hidden";
|
||||
hiddenInput.value = item;
|
||||
div.prepend(strong);
|
||||
div.appendChild(hiddenInput);
|
||||
div.addEventListener("click", function (e) {
|
||||
input.value = div.getElementsByTagName("input")[0].value;
|
||||
input.dispatchEvent(new Event("input"));
|
||||
closeAllLists();
|
||||
});
|
||||
return div;
|
||||
function getItem (item, val) {
|
||||
const div = document.createElement('div')
|
||||
const strong = document.createElement('strong')
|
||||
strong.textContent = item.substr(0, val.length)
|
||||
div.innerText = item.substr(val.length)
|
||||
const hiddenInput = document.createElement('input')
|
||||
hiddenInput.type = 'hidden'
|
||||
hiddenInput.value = item
|
||||
div.prepend(strong)
|
||||
div.appendChild(hiddenInput)
|
||||
div.addEventListener('click', function (e) {
|
||||
input.value = div.getElementsByTagName('input')[0].value
|
||||
input.dispatchEvent(new Event('input'))
|
||||
closeAllLists()
|
||||
})
|
||||
return div
|
||||
}
|
||||
function addActive(x) {
|
||||
if (!x) return false;
|
||||
removeActive(x);
|
||||
if (currentFocus >= x.length) currentFocus = 0;
|
||||
if (currentFocus < 0) currentFocus = x.length - 1;
|
||||
x[currentFocus].classList.add("autocomplete-active");
|
||||
function addActive (x) {
|
||||
if (!x) return false
|
||||
removeActive(x)
|
||||
if (currentFocus >= x.length) currentFocus = 0
|
||||
if (currentFocus < 0) currentFocus = x.length - 1
|
||||
x[currentFocus].classList.add('autocomplete-active')
|
||||
}
|
||||
function removeActive(x) {
|
||||
function removeActive (x) {
|
||||
for (let i = 0; i < x.length; i++) {
|
||||
x[i].classList.remove("autocomplete-active");
|
||||
x[i].classList.remove('autocomplete-active')
|
||||
}
|
||||
}
|
||||
function closeAllLists(elmnt) {
|
||||
let x = document.getElementsByClassName("autocomplete-items");
|
||||
function closeAllLists (elmnt) {
|
||||
const x = document.getElementsByClassName('autocomplete-items')
|
||||
for (let i = 0; i < x.length; i++) {
|
||||
if (elmnt != x[i] && elmnt != input) {
|
||||
x[i].parentNode.removeChild(x[i]);
|
||||
if (elmnt !== x[i] && elmnt !== input) {
|
||||
x[i].parentNode.removeChild(x[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
document.addEventListener("click", (e) => {
|
||||
document.addEventListener('click', (e) => {
|
||||
if (!autocompletes.find((element) => element.id === e.target.id)) {
|
||||
closeAllLists(e.target);
|
||||
closeAllLists(e.target)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
autocompletes.forEach((value) => {
|
||||
autocomplete(document.getElementById(value.id), value.instances);
|
||||
});
|
||||
autocomplete(document.getElementById(value.id), value.instances)
|
||||
})
|
||||
|
||||
var coll = document.getElementsByClassName("collapsible");
|
||||
var i;
|
||||
const coll = document.getElementsByClassName('collapsible')
|
||||
let i
|
||||
|
||||
for (i = 0; i < coll.length; i++) {
|
||||
coll[i].addEventListener("click", function () {
|
||||
this.classList.toggle("collapsible-active");
|
||||
var content = this.nextElementSibling;
|
||||
if (content.style.display === "block") {
|
||||
content.style.display = "none";
|
||||
coll[i].addEventListener('click', function () {
|
||||
this.classList.toggle('collapsible-active')
|
||||
const content = this.nextElementSibling
|
||||
if (content.style.display === 'block') {
|
||||
content.style.display = 'none'
|
||||
} else {
|
||||
content.style.display = "block";
|
||||
content.style.display = 'block'
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
+58
-58
@@ -1,76 +1,76 @@
|
||||
"use strict";
|
||||
'use strict'
|
||||
|
||||
let disableNitter = document.querySelector("#disable-nitter");
|
||||
let disableInvidious = document.querySelector("#disable-invidious");
|
||||
let disableBibliogram = document.querySelector("#disable-bibliogram");
|
||||
let disableOsm = document.querySelector("#disable-osm");
|
||||
let disableReddit = document.querySelector("#disable-reddit");
|
||||
let disableSearchEngine = document.querySelector("#disable-searchEngine");
|
||||
let disableSimplyTranslate = document.querySelector("#disable-simplyTranslate");
|
||||
let disableWikipedia = document.querySelector("#disable-wikipedia");
|
||||
let version = document.querySelector("#version");
|
||||
const disableNitter = document.querySelector('#disable-nitter')
|
||||
const disableInvidious = document.querySelector('#disable-invidious')
|
||||
const disableBibliogram = document.querySelector('#disable-bibliogram')
|
||||
const disableOsm = document.querySelector('#disable-osm')
|
||||
const disableReddit = document.querySelector('#disable-reddit')
|
||||
const disableSearchEngine = document.querySelector('#disable-searchEngine')
|
||||
const disableSimplyTranslate = document.querySelector('#disable-simplyTranslate')
|
||||
const disableWikipedia = document.querySelector('#disable-wikipedia')
|
||||
const version = document.querySelector('#version')
|
||||
|
||||
window.browser = window.browser || window.chrome;
|
||||
window.browser = window.browser || window.chrome
|
||||
|
||||
browser.storage.sync.get(
|
||||
[
|
||||
"disableNitter",
|
||||
"disableInvidious",
|
||||
"disableBibliogram",
|
||||
"disableOsm",
|
||||
"disableReddit",
|
||||
"disableSearchEngine",
|
||||
"disableSimplyTranslate",
|
||||
"disableWikipedia",
|
||||
"theme",
|
||||
'disableNitter',
|
||||
'disableInvidious',
|
||||
'disableBibliogram',
|
||||
'disableOsm',
|
||||
'disableReddit',
|
||||
'disableSearchEngine',
|
||||
'disableSimplyTranslate',
|
||||
'disableWikipedia',
|
||||
'theme'
|
||||
],
|
||||
(result) => {
|
||||
if (result.theme) document.body.classList.add(result.theme);
|
||||
disableNitter.checked = !result.disableNitter;
|
||||
disableInvidious.checked = !result.disableInvidious;
|
||||
disableBibliogram.checked = !result.disableBibliogram;
|
||||
disableOsm.checked = !result.disableOsm;
|
||||
disableReddit.checked = !result.disableReddit;
|
||||
disableSearchEngine.checked = !result.disableSearchEngine;
|
||||
disableSimplyTranslate.checked = !result.disableSimplyTranslate;
|
||||
disableWikipedia.checked = !result.disableWikipedia;
|
||||
if (result.theme) document.body.classList.add(result.theme)
|
||||
disableNitter.checked = !result.disableNitter
|
||||
disableInvidious.checked = !result.disableInvidious
|
||||
disableBibliogram.checked = !result.disableBibliogram
|
||||
disableOsm.checked = !result.disableOsm
|
||||
disableReddit.checked = !result.disableReddit
|
||||
disableSearchEngine.checked = !result.disableSearchEngine
|
||||
disableSimplyTranslate.checked = !result.disableSimplyTranslate
|
||||
disableWikipedia.checked = !result.disableWikipedia
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
version.textContent = browser.runtime.getManifest().version;
|
||||
version.textContent = browser.runtime.getManifest().version
|
||||
|
||||
disableNitter.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableNitter: !event.target.checked });
|
||||
});
|
||||
disableNitter.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableNitter: !event.target.checked })
|
||||
})
|
||||
|
||||
disableInvidious.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableInvidious: !event.target.checked });
|
||||
});
|
||||
disableInvidious.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableInvidious: !event.target.checked })
|
||||
})
|
||||
|
||||
disableBibliogram.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableBibliogram: !event.target.checked });
|
||||
});
|
||||
disableBibliogram.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableBibliogram: !event.target.checked })
|
||||
})
|
||||
|
||||
disableOsm.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableOsm: !event.target.checked });
|
||||
});
|
||||
disableOsm.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableOsm: !event.target.checked })
|
||||
})
|
||||
|
||||
disableReddit.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableReddit: !event.target.checked });
|
||||
});
|
||||
disableReddit.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableReddit: !event.target.checked })
|
||||
})
|
||||
|
||||
disableSearchEngine.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableSearchEngine: !event.target.checked });
|
||||
});
|
||||
disableSearchEngine.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableSearchEngine: !event.target.checked })
|
||||
})
|
||||
|
||||
disableSimplyTranslate.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableSimplyTranslate: !event.target.checked });
|
||||
});
|
||||
disableSimplyTranslate.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableSimplyTranslate: !event.target.checked })
|
||||
})
|
||||
|
||||
disableWikipedia.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableWikipedia: !event.target.checked });
|
||||
});
|
||||
disableWikipedia.addEventListener('change', (event) => {
|
||||
browser.storage.sync.set({ disableWikipedia: !event.target.checked })
|
||||
})
|
||||
|
||||
document.querySelector("#more-options").addEventListener("click", () => {
|
||||
browser.runtime.openOptionsPage();
|
||||
});
|
||||
document.querySelector('#more-options').addEventListener('click', () => {
|
||||
browser.runtime.openOptionsPage()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user