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
|
.DS_Store
|
||||||
nod
|
nod
|
||||||
node_modules
|
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
+6585
-83
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/",
|
"build": "web-ext build --overwrite-dest --source-dir ./src/",
|
||||||
"test": "web-ext lint --source-dir ./src/ || true"
|
"test": "web-ext lint --source-dir ./src/ || true"
|
||||||
},
|
},
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/SimonBrazell/privacy-redirect.git"
|
|
||||||
},
|
|
||||||
"author": "SimonBrazell",
|
"author": "SimonBrazell",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
@@ -20,6 +16,11 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/SimonBrazell/privacy-redirect#readme",
|
"homepage": "https://github.com/SimonBrazell/privacy-redirect#readme",
|
||||||
"devDependencies": {
|
"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"
|
"web-ext": "^6.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
function filterInstances(instances) {
|
function filterInstances (instances) {
|
||||||
return instances.filter((instance) => !instance.includes(".onion"));
|
return instances.filter((instance) => !instance.includes('.onion'))
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandomInstance(instances) {
|
function getRandomInstance (instances) {
|
||||||
return instances[~~(instances.length * Math.random())];
|
return instances[~~(instances.length * Math.random())]
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
filterInstances,
|
filterInstances,
|
||||||
getRandomInstance,
|
getRandomInstance
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,43 +1,43 @@
|
|||||||
const targets = /https?:\/\/(((www|maps)\.)?(google\.).*(\/maps)|maps\.(google\.).*)/;
|
const targets = /https?:\/\/(((www|maps)\.)?(google\.).*(\/maps)|maps\.(google\.).*)/
|
||||||
const redirects = ["https://openstreetmap.org"];
|
const redirects = ['https://openstreetmap.org']
|
||||||
const mapCentreRegex = /@(-?\d[0-9.]*),(-?\d[0-9.]*),(\d{1,2})[.z]/;
|
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 dataLatLngRegex = /(!3d|!4d)(-?[0-9]{1,10}.[0-9]{1,10})/g
|
||||||
const placeRegex = /\/place\/(.*)\//;
|
const placeRegex = /\/place\/(.*)\//
|
||||||
const travelModes = {
|
const travelModes = {
|
||||||
driving: "fossgis_osrm_car",
|
driving: 'fossgis_osrm_car',
|
||||||
walking: "fossgis_osrm_foot",
|
walking: 'fossgis_osrm_foot',
|
||||||
bicycling: "fossgis_osrm_bike",
|
bicycling: 'fossgis_osrm_bike',
|
||||||
transit: "fossgis_osrm_car", // not implemented on OSM, default to car.
|
transit: 'fossgis_osrm_car' // not implemented on OSM, default to car.
|
||||||
};
|
}
|
||||||
const layers = {
|
const layers = {
|
||||||
none: "S",
|
none: 'S',
|
||||||
transit: "T",
|
transit: 'T',
|
||||||
traffic: "S", // not implemented on OSM, default to standard.
|
traffic: 'S', // not implemented on OSM, default to standard.
|
||||||
bicycling: "C",
|
bicycling: 'C'
|
||||||
};
|
}
|
||||||
function addressToLatLng(address, callback) {
|
function addressToLatLng (address, callback) {
|
||||||
const xmlhttp = new XMLHttpRequest();
|
const xmlhttp = new XMLHttpRequest()
|
||||||
xmlhttp.onreadystatechange = () => {
|
xmlhttp.onreadystatechange = () => {
|
||||||
if (xmlhttp.readyState === XMLHttpRequest.DONE) {
|
if (xmlhttp.readyState === XMLHttpRequest.DONE) {
|
||||||
if (xmlhttp.status === 200) {
|
if (xmlhttp.status === 200) {
|
||||||
const json = JSON.parse(xmlhttp.responseText)[0];
|
const json = JSON.parse(xmlhttp.responseText)[0]
|
||||||
if (json) {
|
if (json) {
|
||||||
callback(
|
callback(
|
||||||
`${json.lat}%2C${json.lon}`,
|
`${json.lat}%2C${json.lon}`,
|
||||||
`${json.boundingbox[2]},${json.boundingbox[1]},${json.boundingbox[3]},${json.boundingbox[0]}`
|
`${json.boundingbox[2]},${json.boundingbox[1]},${json.boundingbox[3]},${json.boundingbox[0]}`
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.info("Error: Status is " + xmlhttp.status);
|
console.info('Error: Status is ' + xmlhttp.status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
xmlhttp.open(
|
xmlhttp.open(
|
||||||
"GET",
|
'GET',
|
||||||
`https://nominatim.openstreetmap.org/search/${address}?format=json&limit=1`,
|
`https://nominatim.openstreetmap.org/search/${address}?format=json&limit=1`,
|
||||||
false
|
false
|
||||||
);
|
)
|
||||||
xmlhttp.send();
|
xmlhttp.send()
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -48,5 +48,5 @@ export default {
|
|||||||
placeRegex,
|
placeRegex,
|
||||||
travelModes,
|
travelModes,
|
||||||
layers,
|
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 = [
|
const redirects = [
|
||||||
{ link: "https://duckduckgo.com", q: "/" },
|
{ link: 'https://duckduckgo.com', q: '/' },
|
||||||
{ link: "https://startpage.com", q: "/search/" },
|
{ link: 'https://startpage.com', q: '/search/' },
|
||||||
{ link: "https://www.ecosia.org", q: "/search" },
|
{ link: 'https://www.ecosia.org', q: '/search' },
|
||||||
{ link: "https://www.qwant.com", q: "/" },
|
{ link: 'https://www.qwant.com', q: '/' },
|
||||||
{ link: "https://www.mojeek.com", q: "/search" },
|
{ link: 'https://www.mojeek.com', q: '/search' },
|
||||||
{ link: "https://search.snopyta.org", q: "/" },
|
{ link: 'https://search.snopyta.org', q: '/' },
|
||||||
{ link: "https://searx.info", q: "/" },
|
{ link: 'https://searx.info', q: '/' },
|
||||||
{ link: "https://searx.be", q: "/" },
|
{ link: 'https://searx.be', q: '/' },
|
||||||
{ link: "https://search.disroot.org", q: "/" },
|
{ link: 'https://search.disroot.org', q: '/' },
|
||||||
{ link: "https://searx.tuxcloud.net", q: "/" },
|
{ link: 'https://searx.tuxcloud.net', q: '/' },
|
||||||
{ link: "https://searx.ninja", q: "/" },
|
{ link: 'https://searx.ninja', q: '/' },
|
||||||
{ link: "https://tromland.org/searx", q: "/search" },
|
{ link: 'https://tromland.org/searx', q: '/search' },
|
||||||
{ link: "https://engine.presearch.org", q: "/search" },
|
{ link: 'https://engine.presearch.org', q: '/search' },
|
||||||
{ link: "https://searx.silkky.cloud", q: "/" },
|
{ link: 'https://searx.silkky.cloud', q: '/' },
|
||||||
{ link: "https://search.trom.tf", q: "/" },
|
{ link: 'https://search.trom.tf', q: '/' },
|
||||||
{ link: "https://whooglesearch.net", q: "/search" },
|
{ link: 'https://whooglesearch.net', q: '/search' },
|
||||||
{ link: "https://whoogle.sdf.org", q: "/search" },
|
{ link: 'https://whoogle.sdf.org', q: '/search' },
|
||||||
{ link: "https://whoogle.himiko.cloud", q: "/search" },
|
{ link: 'https://whoogle.himiko.cloud', q: '/search' },
|
||||||
{ link: "https://whoogle-search.zeet.app", q: "/search" },
|
{ link: 'https://whoogle-search.zeet.app', q: '/search' }
|
||||||
];
|
]
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
targets,
|
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 {
|
export default {
|
||||||
targets,
|
targets,
|
||||||
redirects,
|
redirects
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,49 +1,49 @@
|
|||||||
const targets = [
|
const targets = [
|
||||||
"instagram.com",
|
'instagram.com',
|
||||||
"www.instagram.com",
|
'www.instagram.com',
|
||||||
"help.instagram.com",
|
'help.instagram.com',
|
||||||
"about.instagram.com",
|
'about.instagram.com'
|
||||||
];
|
]
|
||||||
const redirects = [
|
const redirects = [
|
||||||
"https://bibliogram.art",
|
'https://bibliogram.art',
|
||||||
"https://bibliogram.snopyta.org",
|
'https://bibliogram.snopyta.org',
|
||||||
"https://bibliogram.pussthecat.org",
|
'https://bibliogram.pussthecat.org',
|
||||||
"https://bibliogram.nixnet.services",
|
'https://bibliogram.nixnet.services',
|
||||||
"https://bibliogram.ethibox.fr",
|
'https://bibliogram.ethibox.fr',
|
||||||
"https://bibliogram.hamster.dance",
|
'https://bibliogram.hamster.dance',
|
||||||
"https://insta.trom.tf",
|
'https://insta.trom.tf',
|
||||||
"https://bib.actionsack.com"
|
'https://bib.actionsack.com'
|
||||||
];
|
]
|
||||||
const reservedPaths = [
|
const reservedPaths = [
|
||||||
"about",
|
'about',
|
||||||
"explore",
|
'explore',
|
||||||
"support",
|
'support',
|
||||||
"press",
|
'press',
|
||||||
"api",
|
'api',
|
||||||
"privacy",
|
'privacy',
|
||||||
"safety",
|
'safety',
|
||||||
"admin",
|
'admin',
|
||||||
"graphql",
|
'graphql',
|
||||||
"accounts",
|
'accounts',
|
||||||
"help",
|
'help',
|
||||||
"terms",
|
'terms',
|
||||||
"contact",
|
'contact',
|
||||||
"blog",
|
'blog',
|
||||||
"igtv",
|
'igtv',
|
||||||
"u",
|
'u',
|
||||||
"p",
|
'p',
|
||||||
"fragment",
|
'fragment',
|
||||||
"imageproxy",
|
'imageproxy',
|
||||||
"videoproxy",
|
'videoproxy',
|
||||||
".well-known",
|
'.well-known',
|
||||||
"tv",
|
'tv',
|
||||||
"reel",
|
'reel'
|
||||||
];
|
]
|
||||||
const bypassPaths = /\/(accounts\/|embeds?.js)/;
|
const bypassPaths = /\/(accounts\/|embeds?.js)/
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
targets,
|
targets,
|
||||||
redirects,
|
redirects,
|
||||||
reservedPaths,
|
reservedPaths,
|
||||||
bypassPaths,
|
bypassPaths
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,32 +1,32 @@
|
|||||||
const targets = [
|
const targets = [
|
||||||
"www.reddit.com",
|
'www.reddit.com',
|
||||||
"np.reddit.com",
|
'np.reddit.com',
|
||||||
"new.reddit.com",
|
'new.reddit.com',
|
||||||
"amp.reddit.com",
|
'amp.reddit.com',
|
||||||
"i.redd.it",
|
'i.redd.it',
|
||||||
"redd.it",
|
'redd.it',
|
||||||
"old.reddit.com",
|
'old.reddit.com'
|
||||||
];
|
]
|
||||||
const redirects = [
|
const redirects = [
|
||||||
// libreddit: privacy w/ modern UI
|
// libreddit: privacy w/ modern UI
|
||||||
"https://libredd.it",
|
'https://libredd.it',
|
||||||
"https://libreddit.spike.codes",
|
'https://libreddit.spike.codes',
|
||||||
"https://libreddit.kavin.rocks",
|
'https://libreddit.kavin.rocks',
|
||||||
"https://libreddit.insanity.wtf",
|
'https://libreddit.insanity.wtf',
|
||||||
"https://libreddit.dothq.co",
|
'https://libreddit.dothq.co',
|
||||||
"https://libreddit.silkky.cloud",
|
'https://libreddit.silkky.cloud',
|
||||||
"https://libreddit.himiko.cloud",
|
'https://libreddit.himiko.cloud',
|
||||||
"https://reddit.artemislena.eu",
|
'https://reddit.artemislena.eu',
|
||||||
// teddit: privacy w/ old UI
|
// teddit: privacy w/ old UI
|
||||||
"https://teddit.net",
|
'https://teddit.net',
|
||||||
"https://teddit.ggc-project.de",
|
'https://teddit.ggc-project.de',
|
||||||
"https://teddit.kavin.rocks",
|
'https://teddit.kavin.rocks',
|
||||||
"https://snew.notabug.io",
|
'https://snew.notabug.io'
|
||||||
];
|
]
|
||||||
const bypassPaths = /\/(gallery\/poll\/rpan\/settings\/topics)/;
|
const bypassPaths = /\/(gallery\/poll\/rpan\/settings\/topics)/
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
targets,
|
targets,
|
||||||
redirects,
|
redirects,
|
||||||
bypassPaths,
|
bypassPaths
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,44 +1,44 @@
|
|||||||
/*
|
/*
|
||||||
Please remember to also update the src/manifest.json file
|
Please remember to also update the src/manifest.json file
|
||||||
(content_scripts > matches, 'remove-twitter-sw.js')
|
(content_scripts > matches, 'remove-twitter-sw.js')
|
||||||
when updating this list:
|
when updating this list:
|
||||||
*/
|
*/
|
||||||
const targets = [
|
const targets = [
|
||||||
"twitter.com",
|
'twitter.com',
|
||||||
"www.twitter.com",
|
'www.twitter.com',
|
||||||
"mobile.twitter.com",
|
'mobile.twitter.com',
|
||||||
"pbs.twimg.com",
|
'pbs.twimg.com',
|
||||||
"video.twimg.com",
|
'video.twimg.com'
|
||||||
];
|
]
|
||||||
/*
|
/*
|
||||||
Please remember to also update the
|
Please remember to also update the
|
||||||
src/assets/javascripts/remove-twitter-sw.js file
|
src/assets/javascripts/remove-twitter-sw.js file
|
||||||
(const nitterInstances) when updating this list:
|
(const nitterInstances) when updating this list:
|
||||||
*/
|
*/
|
||||||
const redirects = [
|
const redirects = [
|
||||||
"https://nitter.net",
|
'https://nitter.net',
|
||||||
"https://nitter.snopyta.org",
|
'https://nitter.snopyta.org',
|
||||||
"https://nitter.42l.fr",
|
'https://nitter.42l.fr',
|
||||||
"https://nitter.nixnet.services",
|
'https://nitter.nixnet.services',
|
||||||
"https://nitter.pussthecat.org",
|
'https://nitter.pussthecat.org',
|
||||||
"https://nitter.dark.fail",
|
'https://nitter.dark.fail',
|
||||||
"https://nitter.tedomum.net",
|
'https://nitter.tedomum.net',
|
||||||
"https://nitter.cattube.org",
|
'https://nitter.cattube.org',
|
||||||
"https://nitter.fdn.fr",
|
'https://nitter.fdn.fr',
|
||||||
"https://nitter.1d4.us",
|
'https://nitter.1d4.us',
|
||||||
"https://nitter.kavin.rocks",
|
'https://nitter.kavin.rocks',
|
||||||
"https://tweet.lambda.dance",
|
'https://tweet.lambda.dance',
|
||||||
"https://nitter.cc",
|
'https://nitter.cc',
|
||||||
"https://nitter.vxempire.xyz",
|
'https://nitter.vxempire.xyz',
|
||||||
"https://nitter.unixfox.eu",
|
'https://nitter.unixfox.eu',
|
||||||
"https://bird.trom.tf",
|
'https://bird.trom.tf',
|
||||||
"http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion",
|
'http://3nzoldnxplag42gqjs23xvghtzf6t6yzssrtytnntc6ppc7xxuoneoad.onion',
|
||||||
"http://nitter.l4qlywnpwqsluw65ts7md3khrivpirse744un3x7mlskqauz5pyuzgqd.onion",
|
'http://nitter.l4qlywnpwqsluw65ts7md3khrivpirse744un3x7mlskqauz5pyuzgqd.onion',
|
||||||
"http://nitterlgj3n5fgwesu3vxc5h67ruku33nqaoeoocae2mvlzhsu6k7fqd.onion",
|
'http://nitterlgj3n5fgwesu3vxc5h67ruku33nqaoeoocae2mvlzhsu6k7fqd.onion',
|
||||||
"http://npf37k3mtzwxreiw52ccs5ay4e6qt2fkcs2ndieurdyn2cuzzsfyfvid.onion",
|
'http://npf37k3mtzwxreiw52ccs5ay4e6qt2fkcs2ndieurdyn2cuzzsfyfvid.onion'
|
||||||
];
|
]
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
targets,
|
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 {
|
export default {
|
||||||
targets,
|
targets,
|
||||||
redirects,
|
redirects
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,45 +1,25 @@
|
|||||||
const targets = [
|
const targets = [
|
||||||
"m.youtube.com",
|
'm.youtube.com',
|
||||||
"youtube.com",
|
'youtube.com',
|
||||||
"img.youtube.com",
|
'img.youtube.com',
|
||||||
"www.youtube.com",
|
'www.youtube.com',
|
||||||
"youtube-nocookie.com",
|
'youtube-nocookie.com',
|
||||||
"www.youtube-nocookie.com",
|
'www.youtube-nocookie.com',
|
||||||
"youtu.be",
|
'youtu.be',
|
||||||
"s.ytimg.com",
|
's.ytimg.com',
|
||||||
"music.youtube.com",
|
'music.youtube.com'
|
||||||
];
|
]
|
||||||
/*
|
/*
|
||||||
Please remember to also update the manifest.json file
|
Please remember to also update the manifest.json file
|
||||||
(content_scripts > matches, 'persist-invidious-prefs.js')
|
(content_scripts > matches, 'persist-invidious-prefs.js')
|
||||||
when updating this list:
|
when updating this list:
|
||||||
*/
|
*/
|
||||||
const redirects = [
|
const redirects = [
|
||||||
"https://invidious.snopyta.org",
|
'https://piped-material.১.net',
|
||||||
"https://invidious.xyz",
|
'https://piped-staging.ftp.sh'
|
||||||
"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",
|
|
||||||
];
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
targets,
|
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 tag.replace(/__MSG_(\w+)__/g, function (_match, v1) {
|
||||||
return v1 ? browser.i18n.getMessage(v1) : null;
|
return v1 ? browser.i18n.getMessage(v1) : null
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function localisePage() {
|
function localisePage () {
|
||||||
let elements = document.querySelectorAll("[data-localise]");
|
const elements = document.querySelectorAll('[data-localise]')
|
||||||
|
|
||||||
for (let i in elements)
|
for (const i in elements) {
|
||||||
if (elements.hasOwnProperty(i)) {
|
if (elements.hasOwnProperty(i)) {
|
||||||
let obj = elements[i];
|
const obj = elements[i]
|
||||||
let tag = obj.getAttribute("data-localise").toString();
|
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)) {
|
if (placeholders.hasOwnProperty(i)) {
|
||||||
let obj = placeholders[i];
|
const obj = placeholders[i]
|
||||||
let tag = obj.getAttribute("data-localise-placeholder").toString();
|
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() {
|
function getCookie () {
|
||||||
let ca = document.cookie.split(";");
|
const ca = document.cookie.split(';')
|
||||||
for (let i = 0; i < ca.length; i++) {
|
for (let i = 0; i < ca.length; i++) {
|
||||||
let c = ca[i];
|
let c = ca[i]
|
||||||
while (c.charAt(0) == " ") c = c.substring(1, c.length);
|
while (c.charAt(0) == ' ') c = c.substring(1, c.length)
|
||||||
if (c.indexOf("PREFS=") == 0) {
|
if (c.indexOf('PREFS=') == 0) {
|
||||||
return JSON.parse(
|
return JSON.parse(
|
||||||
decodeURIComponent(c.substring("PREFS=".length, c.length))
|
decodeURIComponent(c.substring('PREFS='.length, c.length))
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {};
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
browser.storage.sync.get(
|
browser.storage.sync.get(
|
||||||
["alwaysProxy", "videoQuality", "invidiousDarkMode", "persistInvidiousPrefs"],
|
['alwaysProxy', 'videoQuality', 'invidiousDarkMode', 'persistInvidiousPrefs'],
|
||||||
(result) => {
|
(result) => {
|
||||||
if (result.persistInvidiousPrefs) {
|
if (result.persistInvidiousPrefs) {
|
||||||
const prefs = getCookie();
|
const prefs = getCookie()
|
||||||
prefs.local = result.alwaysProxy;
|
prefs.local = result.alwaysProxy
|
||||||
prefs.quality = result.videoQuality;
|
prefs.quality = result.videoQuality
|
||||||
prefs.dark_mode = result.invidiousDarkMode;
|
prefs.dark_mode = result.invidiousDarkMode
|
||||||
document.cookie = `PREFS=${encodeURIComponent(JSON.stringify(prefs))}`;
|
document.cookie = `PREFS=${encodeURIComponent(JSON.stringify(prefs))}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
|
|||||||
@@ -1,113 +1,113 @@
|
|||||||
"use strict";
|
'use strict'
|
||||||
|
|
||||||
const nitterInstances = [
|
const nitterInstances = [
|
||||||
"https://nitter.net",
|
'https://nitter.net',
|
||||||
"https://nitter.snopyta.org",
|
'https://nitter.snopyta.org',
|
||||||
"https://nitter.42l.fr",
|
'https://nitter.42l.fr',
|
||||||
"https://nitter.nixnet.services",
|
'https://nitter.nixnet.services',
|
||||||
"https://nitter.pussthecat.org",
|
'https://nitter.pussthecat.org',
|
||||||
"https://nitter.dark.fail",
|
'https://nitter.dark.fail',
|
||||||
"https://nitter.tedomum.net",
|
'https://nitter.tedomum.net',
|
||||||
"https://nitter.cattube.org",
|
'https://nitter.cattube.org',
|
||||||
"https://nitter.fdn.fr",
|
'https://nitter.fdn.fr',
|
||||||
"https://nitter.1d4.us",
|
'https://nitter.1d4.us',
|
||||||
"https://nitter.kavin.rocks",
|
'https://nitter.kavin.rocks',
|
||||||
"https://tweet.lambda.dance",
|
'https://tweet.lambda.dance',
|
||||||
"https://nitter.cc",
|
'https://nitter.cc',
|
||||||
"https://nitter.vxempire.xyz",
|
'https://nitter.vxempire.xyz',
|
||||||
"https://nitter.unixfox.eu",
|
'https://nitter.unixfox.eu',
|
||||||
"https://bird.trom.tf"
|
'https://bird.trom.tf'
|
||||||
];
|
]
|
||||||
|
|
||||||
let disableNitter;
|
let disableNitter
|
||||||
let nitterInstance;
|
let nitterInstance
|
||||||
let redirectBypassFlag;
|
let redirectBypassFlag
|
||||||
let exceptions;
|
let exceptions
|
||||||
|
|
||||||
window.browser = window.browser || window.chrome;
|
window.browser = window.browser || window.chrome
|
||||||
|
|
||||||
function getRandomInstance() {
|
function getRandomInstance () {
|
||||||
return nitterInstances[~~(nitterInstances.length * Math.random())];
|
return nitterInstances[~~(nitterInstances.length * Math.random())]
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNotException(url) {
|
function isNotException (url) {
|
||||||
return !exceptions.some((regex) => regex.test(url.href));
|
return !exceptions.some((regex) => regex.test(url.href))
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldRedirect(url) {
|
function shouldRedirect (url) {
|
||||||
return (
|
return (
|
||||||
!redirectBypassFlag &&
|
!redirectBypassFlag &&
|
||||||
isNotException(url) &&
|
isNotException(url) &&
|
||||||
!disableNitter &&
|
!disableNitter &&
|
||||||
url.host !== nitterInstance &&
|
url.host !== nitterInstance &&
|
||||||
!url.pathname.includes("/home")
|
!url.pathname.includes('/home')
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function redirectTwitter(url) {
|
function redirectTwitter (url) {
|
||||||
if (url.host.split(".")[0] === "pbs") {
|
if (url.host.split('.')[0] === 'pbs') {
|
||||||
return `${nitterInstance}/pic/${encodeURIComponent(url.href)}`;
|
return `${nitterInstance}/pic/${encodeURIComponent(url.href)}`
|
||||||
} else if (url.host.split(".")[0] === "video") {
|
} else if (url.host.split('.')[0] === 'video') {
|
||||||
return `${nitterInstance}/gif/${encodeURIComponent(url.href)}`;
|
return `${nitterInstance}/gif/${encodeURIComponent(url.href)}`
|
||||||
} else {
|
} else {
|
||||||
return `${nitterInstance}${url.pathname}${url.search}`;
|
return `${nitterInstance}${url.pathname}${url.search}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
browser.storage.sync.get(
|
browser.storage.sync.get(
|
||||||
[
|
[
|
||||||
"nitterInstance",
|
'nitterInstance',
|
||||||
"disableNitter",
|
'disableNitter',
|
||||||
"removeTwitterSW",
|
'removeTwitterSW',
|
||||||
"redirectBypassFlag",
|
'redirectBypassFlag',
|
||||||
"exceptions",
|
'exceptions'
|
||||||
],
|
],
|
||||||
(result) => {
|
(result) => {
|
||||||
redirectBypassFlag = result.redirectBypassFlag;
|
redirectBypassFlag = result.redirectBypassFlag
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
redirectBypassFlag: false,
|
redirectBypassFlag: false
|
||||||
});
|
})
|
||||||
if (!result.removeTwitterSW) {
|
if (!result.removeTwitterSW) {
|
||||||
disableNitter = result.disableNitter;
|
disableNitter = result.disableNitter
|
||||||
nitterInstance = result.nitterInstance || getRandomInstance();
|
nitterInstance = result.nitterInstance || getRandomInstance()
|
||||||
exceptions = result.exceptions
|
exceptions = result.exceptions
|
||||||
? result.exceptions.map((e) => {
|
? result.exceptions.map((e) => {
|
||||||
return new RegExp(e);
|
return new RegExp(e)
|
||||||
})
|
})
|
||||||
: [];
|
: []
|
||||||
navigator.serviceWorker.getRegistrations().then((registrations) => {
|
navigator.serviceWorker.getRegistrations().then((registrations) => {
|
||||||
for (let registration of registrations) {
|
for (const registration of registrations) {
|
||||||
if (registration.scope === "https://twitter.com/") {
|
if (registration.scope === 'https://twitter.com/') {
|
||||||
registration.unregister();
|
registration.unregister()
|
||||||
console.log("Unregistered Twitter SW", registration);
|
console.log('Unregistered Twitter SW', registration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
const url = new URL(window.location);
|
const url = new URL(window.location)
|
||||||
if (shouldRedirect(url)) {
|
if (shouldRedirect(url)) {
|
||||||
const redirect = redirectTwitter(url);
|
const redirect = redirectTwitter(url)
|
||||||
console.info("Redirecting", `"${url.href}"`, "=>", `"${redirect}"`);
|
console.info('Redirecting', `"${url.href}"`, '=>', `"${redirect}"`)
|
||||||
window.location = redirect;
|
window.location = redirect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
|
|
||||||
// Keeping this here until https://bugzilla.mozilla.org/show_bug.cgi?id=1536094 is fixed...
|
// Keeping this here until https://bugzilla.mozilla.org/show_bug.cgi?id=1536094 is fixed...
|
||||||
//
|
//
|
||||||
//"use strict";
|
// "use strict";
|
||||||
//
|
//
|
||||||
//let disableNitter;
|
// let disableNitter;
|
||||||
//let nitterInstance;
|
// let nitterInstance;
|
||||||
//let redirectBypassFlag;
|
// let redirectBypassFlag;
|
||||||
//let exceptions;
|
// 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/common.js")),
|
||||||
// import(browser.extension.getURL("src/assets/javascripts/helpers/twitter.js")),
|
// import(browser.extension.getURL("src/assets/javascripts/helpers/twitter.js")),
|
||||||
//]).then(
|
// ]).then(
|
||||||
// (helpers) => {
|
// (helpers) => {
|
||||||
// let commonHelper;
|
// let commonHelper;
|
||||||
// let twitterHelper;
|
// let twitterHelper;
|
||||||
@@ -183,4 +183,4 @@ browser.storage.sync.get(
|
|||||||
// (error) => {
|
// (error) => {
|
||||||
// console.error(error);
|
// console.error(error);
|
||||||
// }
|
// }
|
||||||
//);
|
// );
|
||||||
|
|||||||
+388
-392
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 commonHelper from '../../assets/javascripts/helpers/common.js'
|
||||||
import twitterHelper from "../../assets/javascripts/helpers/twitter.js";
|
import twitterHelper from '../../assets/javascripts/helpers/twitter.js'
|
||||||
import youtubeHelper from "../../assets/javascripts/helpers/youtube.js";
|
import youtubeHelper from '../../assets/javascripts/helpers/youtube.js'
|
||||||
import instagramHelper from "../../assets/javascripts/helpers/instagram.js";
|
import instagramHelper from '../../assets/javascripts/helpers/instagram.js'
|
||||||
import mapsHelper from "../../assets/javascripts/helpers/google-maps.js";
|
import mapsHelper from '../../assets/javascripts/helpers/google-maps.js'
|
||||||
import redditHelper from "../../assets/javascripts/helpers/reddit.js";
|
import redditHelper from '../../assets/javascripts/helpers/reddit.js'
|
||||||
import searchHelper from "../../assets/javascripts/helpers/google-search.js";
|
import searchHelper from '../../assets/javascripts/helpers/google-search.js'
|
||||||
import googleTranslateHelper from "../../assets/javascripts/helpers/google-translate.js";
|
import googleTranslateHelper from '../../assets/javascripts/helpers/google-translate.js'
|
||||||
import wikipediaHelper from "../../assets/javascripts/helpers/wikipedia.js";
|
import wikipediaHelper from '../../assets/javascripts/helpers/wikipedia.js'
|
||||||
|
|
||||||
const nitterInstances = twitterHelper.redirects;
|
const nitterInstances = twitterHelper.redirects
|
||||||
const invidiousInstances = youtubeHelper.redirects;
|
const invidiousInstances = youtubeHelper.redirects
|
||||||
const bibliogramInstances = instagramHelper.redirects;
|
const bibliogramInstances = instagramHelper.redirects
|
||||||
const osmInstances = mapsHelper.redirects;
|
const osmInstances = mapsHelper.redirects
|
||||||
const redditInstances = redditHelper.redirects;
|
const redditInstances = redditHelper.redirects
|
||||||
const searchEngineInstances = searchHelper.redirects;
|
const searchEngineInstances = searchHelper.redirects
|
||||||
const simplyTranslateInstances = googleTranslateHelper.redirects;
|
const simplyTranslateInstances = googleTranslateHelper.redirects
|
||||||
const wikipediaInstances = wikipediaHelper.redirects;
|
const wikipediaInstances = wikipediaHelper.redirects
|
||||||
const autocompletes = [
|
const autocompletes = [
|
||||||
{ id: "nitter-instance", instances: nitterInstances },
|
{ id: 'nitter-instance', instances: nitterInstances },
|
||||||
{ id: "invidious-instance", instances: invidiousInstances },
|
{ id: 'invidious-instance', instances: invidiousInstances },
|
||||||
{ id: "bibliogram-instance", instances: bibliogramInstances },
|
{ id: 'bibliogram-instance', instances: bibliogramInstances },
|
||||||
{ id: "osm-instance", instances: osmInstances },
|
{ id: 'osm-instance', instances: osmInstances },
|
||||||
{ id: "reddit-instance", instances: redditInstances },
|
{ id: 'reddit-instance', instances: redditInstances },
|
||||||
{
|
{
|
||||||
id: "search-engine-instance",
|
id: 'search-engine-instance',
|
||||||
instances: searchEngineInstances.map((instance) => instance.link),
|
instances: searchEngineInstances.map((instance) => instance.link)
|
||||||
},
|
},
|
||||||
{ id: "simply-translate-instance", instances: simplyTranslateInstances },
|
{ id: 'simply-translate-instance', instances: simplyTranslateInstances },
|
||||||
{ id: "wikipedia-instance", instances: wikipediaInstances },
|
{ id: 'wikipedia-instance', instances: wikipediaInstances }
|
||||||
];
|
]
|
||||||
const domparser = new DOMParser();
|
const domparser = new DOMParser()
|
||||||
|
|
||||||
let nitterInstance = document.getElementById("nitter-instance");
|
const nitterInstance = document.getElementById('nitter-instance')
|
||||||
let invidiousInstance = document.getElementById("invidious-instance");
|
const invidiousInstance = document.getElementById('invidious-instance')
|
||||||
let bibliogramInstance = document.getElementById("bibliogram-instance");
|
const bibliogramInstance = document.getElementById('bibliogram-instance')
|
||||||
let osmInstance = document.getElementById("osm-instance");
|
const osmInstance = document.getElementById('osm-instance')
|
||||||
let redditInstance = document.getElementById("reddit-instance");
|
const redditInstance = document.getElementById('reddit-instance')
|
||||||
let searchEngineInstance = document.getElementById("search-engine-instance");
|
const searchEngineInstance = document.getElementById('search-engine-instance')
|
||||||
let simplyTranslateInstance = document.getElementById(
|
const simplyTranslateInstance = document.getElementById(
|
||||||
"simply-translate-instance"
|
'simply-translate-instance'
|
||||||
);
|
)
|
||||||
let wikipediaInstance = document.getElementById("wikipedia-instance");
|
const wikipediaInstance = document.getElementById('wikipedia-instance')
|
||||||
let disableNitter = document.getElementById("disable-nitter");
|
const disableNitter = document.getElementById('disable-nitter')
|
||||||
let disableInvidious = document.getElementById("disable-invidious");
|
const disableInvidious = document.getElementById('disable-invidious')
|
||||||
let disableBibliogram = document.getElementById("disable-bibliogram");
|
const disableBibliogram = document.getElementById('disable-bibliogram')
|
||||||
let disableOsm = document.getElementById("disable-osm");
|
const disableOsm = document.getElementById('disable-osm')
|
||||||
let disableReddit = document.getElementById("disable-reddit");
|
const disableReddit = document.getElementById('disable-reddit')
|
||||||
let disableSearchEngine = document.getElementById("disable-search-engine");
|
const disableSearchEngine = document.getElementById('disable-search-engine')
|
||||||
let disableSimplyTranslate = document.getElementById(
|
const disableSimplyTranslate = document.getElementById(
|
||||||
"disable-simply-translate"
|
'disable-simply-translate'
|
||||||
);
|
)
|
||||||
let disableWikipedia = document.getElementById("disable-wikipedia");
|
const disableWikipedia = document.getElementById('disable-wikipedia')
|
||||||
let alwaysProxy = document.getElementById("always-proxy");
|
const alwaysProxy = document.getElementById('always-proxy')
|
||||||
let onlyEmbeddedVideo = document.getElementById("only-embed");
|
const onlyEmbeddedVideo = document.getElementById('only-embed')
|
||||||
let videoQuality = document.getElementById("video-quality");
|
const videoQuality = document.getElementById('video-quality')
|
||||||
let removeTwitterSW = document.getElementById("remove-twitter-sw");
|
const removeTwitterSW = document.getElementById('remove-twitter-sw')
|
||||||
let invidiousDarkMode = document.getElementById("invidious-dark-mode");
|
const invidiousDarkMode = document.getElementById('invidious-dark-mode')
|
||||||
let persistInvidiousPrefs = document.getElementById("persist-invidious-prefs");
|
const persistInvidiousPrefs = document.getElementById('persist-invidious-prefs')
|
||||||
let invidiousVolume = document.getElementById("invidious-volume");
|
const invidiousVolume = document.getElementById('invidious-volume')
|
||||||
let invidiousPlayerStyle = document.getElementById("invidious-player-style");
|
const invidiousPlayerStyle = document.getElementById('invidious-player-style')
|
||||||
let invidiousSubtitles = document.getElementById("invidious-subtitles");
|
const invidiousSubtitles = document.getElementById('invidious-subtitles')
|
||||||
let invidiousAutoplay = document.getElementById("invidious-autoplay");
|
const invidiousAutoplay = document.getElementById('invidious-autoplay')
|
||||||
let theme = document.getElementById("theme");
|
const theme = document.getElementById('theme')
|
||||||
let useFreeTube = document.getElementById("use-freetube");
|
const useFreeTube = document.getElementById('use-freetube')
|
||||||
let nitterRandomPool = document.getElementById("nitter-random-pool");
|
const nitterRandomPool = document.getElementById('nitter-random-pool')
|
||||||
let invidiousRandomPool = document.getElementById("invidious-random-pool");
|
const invidiousRandomPool = document.getElementById('invidious-random-pool')
|
||||||
let bibliogramRandomPool = document.getElementById("bibliogram-random-pool");
|
const bibliogramRandomPool = document.getElementById('bibliogram-random-pool')
|
||||||
let exceptions;
|
let exceptions
|
||||||
|
|
||||||
window.browser = window.browser || window.chrome;
|
window.browser = window.browser || window.chrome
|
||||||
|
|
||||||
function prependExceptionsItem(item, index) {
|
function prependExceptionsItem (item, index) {
|
||||||
const li = document.createElement("li");
|
const li = document.createElement('li')
|
||||||
li.appendChild(document.createTextNode(item.toString()));
|
li.appendChild(document.createTextNode(item.toString()))
|
||||||
const button = document.createElement("button");
|
const button = document.createElement('button')
|
||||||
li.appendChild(button);
|
li.appendChild(button)
|
||||||
document.getElementById("exceptions-items").prepend(li);
|
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'>
|
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'
|
<line x1='368' y1='368' x2='144' y2='144'
|
||||||
style='fill:none;stroke:#FFF;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px' />
|
style='fill:none;stroke:#FFF;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px' />
|
||||||
<line x1='368' y1='144' x2='144' y2='368'
|
<line x1='368' y1='144' x2='144' y2='368'
|
||||||
style='fill:none;stroke:#FFF;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px' />
|
style='fill:none;stroke:#FFF;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px' />
|
||||||
</svg>`;
|
</svg>`
|
||||||
button.appendChild(
|
button.appendChild(
|
||||||
domparser.parseFromString(svg, "image/svg+xml").documentElement
|
domparser.parseFromString(svg, 'image/svg+xml').documentElement
|
||||||
);
|
)
|
||||||
button.addEventListener("click", () => {
|
button.addEventListener('click', () => {
|
||||||
exceptions.splice(index, 1);
|
exceptions.splice(index, 1)
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
exceptions: exceptions,
|
exceptions: exceptions
|
||||||
});
|
})
|
||||||
li.remove();
|
li.remove()
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
browser.storage.sync.get(
|
browser.storage.sync.get(
|
||||||
[
|
[
|
||||||
"nitterInstance",
|
'nitterInstance',
|
||||||
"invidiousInstance",
|
'invidiousInstance',
|
||||||
"bibliogramInstance",
|
'bibliogramInstance',
|
||||||
"osmInstance",
|
'osmInstance',
|
||||||
"redditInstance",
|
'redditInstance',
|
||||||
"searchEngineInstance",
|
'searchEngineInstance',
|
||||||
"simplyTranslateInstance",
|
'simplyTranslateInstance',
|
||||||
"wikipediaInstance",
|
'wikipediaInstance',
|
||||||
"disableNitter",
|
'disableNitter',
|
||||||
"disableInvidious",
|
'disableInvidious',
|
||||||
"disableBibliogram",
|
'disableBibliogram',
|
||||||
"disableOsm",
|
'disableOsm',
|
||||||
"disableReddit",
|
'disableReddit',
|
||||||
"disableSearchEngine",
|
'disableSearchEngine',
|
||||||
"disableSimplyTranslate",
|
'disableSimplyTranslate',
|
||||||
"disableWikipedia",
|
'disableWikipedia',
|
||||||
"alwaysProxy",
|
'alwaysProxy',
|
||||||
"onlyEmbeddedVideo",
|
'onlyEmbeddedVideo',
|
||||||
"videoQuality",
|
'videoQuality',
|
||||||
"removeTwitterSW",
|
'removeTwitterSW',
|
||||||
"invidiousDarkMode",
|
'invidiousDarkMode',
|
||||||
"persistInvidiousPrefs",
|
'persistInvidiousPrefs',
|
||||||
"invidiousVolume",
|
'invidiousVolume',
|
||||||
"invidiousPlayerStyle",
|
'invidiousPlayerStyle',
|
||||||
"invidiousSubtitles",
|
'invidiousSubtitles',
|
||||||
"invidiousAutoplay",
|
'invidiousAutoplay',
|
||||||
"exceptions",
|
'exceptions',
|
||||||
"theme",
|
'theme',
|
||||||
"useFreeTube",
|
'useFreeTube',
|
||||||
"nitterRandomPool",
|
'nitterRandomPool',
|
||||||
"invidiousRandomPool",
|
'invidiousRandomPool',
|
||||||
"bibliogramRandomPool",
|
'bibliogramRandomPool'
|
||||||
],
|
],
|
||||||
(result) => {
|
(result) => {
|
||||||
theme.value = result.theme || "";
|
theme.value = result.theme || ''
|
||||||
if (result.theme) document.body.classList.add(result.theme);
|
if (result.theme) document.body.classList.add(result.theme)
|
||||||
nitterInstance.value = result.nitterInstance || "";
|
nitterInstance.value = result.nitterInstance || ''
|
||||||
invidiousInstance.value = result.invidiousInstance || "";
|
invidiousInstance.value = result.invidiousInstance || ''
|
||||||
bibliogramInstance.value = result.bibliogramInstance || "";
|
bibliogramInstance.value = result.bibliogramInstance || ''
|
||||||
osmInstance.value = result.osmInstance || "";
|
osmInstance.value = result.osmInstance || ''
|
||||||
redditInstance.value = result.redditInstance || "";
|
redditInstance.value = result.redditInstance || ''
|
||||||
searchEngineInstance.value =
|
searchEngineInstance.value =
|
||||||
(result.searchEngineInstance && result.searchEngineInstance.link) || "";
|
(result.searchEngineInstance && result.searchEngineInstance.link) || ''
|
||||||
simplyTranslateInstance.value = result.simplyTranslateInstance || "";
|
simplyTranslateInstance.value = result.simplyTranslateInstance || ''
|
||||||
wikipediaInstance.value = result.wikipediaInstance || "";
|
wikipediaInstance.value = result.wikipediaInstance || ''
|
||||||
disableNitter.checked = !result.disableNitter;
|
disableNitter.checked = !result.disableNitter
|
||||||
disableInvidious.checked = !result.disableInvidious;
|
disableInvidious.checked = !result.disableInvidious
|
||||||
disableBibliogram.checked = !result.disableBibliogram;
|
disableBibliogram.checked = !result.disableBibliogram
|
||||||
disableOsm.checked = !result.disableOsm;
|
disableOsm.checked = !result.disableOsm
|
||||||
disableReddit.checked = !result.disableReddit;
|
disableReddit.checked = !result.disableReddit
|
||||||
disableSearchEngine.checked = !result.disableSearchEngine;
|
disableSearchEngine.checked = !result.disableSearchEngine
|
||||||
disableSimplyTranslate.checked = !result.disableSimplyTranslate;
|
disableSimplyTranslate.checked = !result.disableSimplyTranslate
|
||||||
disableWikipedia.checked = !result.disableWikipedia;
|
disableWikipedia.checked = !result.disableWikipedia
|
||||||
alwaysProxy.checked = result.alwaysProxy;
|
alwaysProxy.checked = result.alwaysProxy
|
||||||
onlyEmbeddedVideo.checked = result.onlyEmbeddedVideo;
|
onlyEmbeddedVideo.checked = result.onlyEmbeddedVideo
|
||||||
videoQuality.value = result.videoQuality || "";
|
videoQuality.value = result.videoQuality || ''
|
||||||
removeTwitterSW.checked = !result.removeTwitterSW;
|
removeTwitterSW.checked = !result.removeTwitterSW
|
||||||
invidiousDarkMode.checked = result.invidiousDarkMode;
|
invidiousDarkMode.checked = result.invidiousDarkMode
|
||||||
persistInvidiousPrefs.checked = result.persistInvidiousPrefs;
|
persistInvidiousPrefs.checked = result.persistInvidiousPrefs
|
||||||
exceptions = result.exceptions || [];
|
exceptions = result.exceptions || []
|
||||||
exceptions.forEach(prependExceptionsItem);
|
exceptions.forEach(prependExceptionsItem)
|
||||||
invidiousVolume.value = result.invidiousVolume;
|
invidiousVolume.value = result.invidiousVolume
|
||||||
document.querySelector("#volume-value").textContent = result.invidiousVolume
|
document.querySelector('#volume-value').textContent = result.invidiousVolume
|
||||||
? `${result.invidiousVolume}%`
|
? `${result.invidiousVolume}%`
|
||||||
: " - ";
|
: ' - '
|
||||||
invidiousPlayerStyle.value = result.invidiousPlayerStyle || "";
|
invidiousPlayerStyle.value = result.invidiousPlayerStyle || ''
|
||||||
invidiousSubtitles.value = result.invidiousSubtitles || "";
|
invidiousSubtitles.value = result.invidiousSubtitles || ''
|
||||||
invidiousAutoplay.checked = result.invidiousAutoplay;
|
invidiousAutoplay.checked = result.invidiousAutoplay
|
||||||
useFreeTube.checked = result.useFreeTube;
|
useFreeTube.checked = result.useFreeTube
|
||||||
nitterRandomPool.value =
|
nitterRandomPool.value =
|
||||||
result.nitterRandomPool || commonHelper.filterInstances(nitterInstances);
|
result.nitterRandomPool || commonHelper.filterInstances(nitterInstances)
|
||||||
invidiousRandomPool.value =
|
invidiousRandomPool.value =
|
||||||
result.invidiousRandomPool ||
|
result.invidiousRandomPool ||
|
||||||
commonHelper.filterInstances(invidiousInstances);
|
commonHelper.filterInstances(invidiousInstances)
|
||||||
bibliogramRandomPool.value =
|
bibliogramRandomPool.value =
|
||||||
result.bibliogramRandomPool ||
|
result.bibliogramRandomPool ||
|
||||||
commonHelper.filterInstances(bibliogramInstances);
|
commonHelper.filterInstances(bibliogramInstances)
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
|
|
||||||
function openTab(tab, event) {
|
function openTab (tab, event) {
|
||||||
let i, tabcontent, tablinks;
|
let i, tabcontent, tablinks
|
||||||
tabcontent = document.getElementsByClassName("tabcontent");
|
tabcontent = document.getElementsByClassName('tabcontent')
|
||||||
for (i = 0; i < tabcontent.length; i++) {
|
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++) {
|
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";
|
document.getElementById(tab).style.display = 'block'
|
||||||
event.currentTarget.className += " active";
|
event.currentTarget.className += ' active'
|
||||||
}
|
}
|
||||||
|
|
||||||
document
|
document
|
||||||
.getElementById("general-tab")
|
.getElementById('general-tab')
|
||||||
.addEventListener("click", openTab.bind(null, "general"));
|
.addEventListener('click', openTab.bind(null, 'general'))
|
||||||
document
|
document
|
||||||
.getElementById("advanced-tab")
|
.getElementById('advanced-tab')
|
||||||
.addEventListener("click", openTab.bind(null, "advanced"));
|
.addEventListener('click', openTab.bind(null, 'advanced'))
|
||||||
document
|
document
|
||||||
.getElementById("exceptions-tab")
|
.getElementById('exceptions-tab')
|
||||||
.addEventListener("click", openTab.bind(null, "exceptions"));
|
.addEventListener('click', openTab.bind(null, 'exceptions'))
|
||||||
|
|
||||||
document.getElementById("general-tab").click();
|
document.getElementById('general-tab').click()
|
||||||
|
|
||||||
function addToExceptions() {
|
function addToExceptions () {
|
||||||
const input = document.getElementById("new-exceptions-item");
|
const input = document.getElementById('new-exceptions-item')
|
||||||
const type = document.querySelector('input[name="type"]:checked').value;
|
const type = document.querySelector('input[name="type"]:checked').value
|
||||||
if (input.value) {
|
if (input.value) {
|
||||||
try {
|
try {
|
||||||
let value = input.value;
|
let value = input.value
|
||||||
new RegExp(input.value);
|
new RegExp(input.value)
|
||||||
if (type === "URL") {
|
if (type === 'URL') {
|
||||||
value = value.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
value = value.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||||
}
|
}
|
||||||
exceptions.push(value);
|
exceptions.push(value)
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
exceptions: exceptions,
|
exceptions: exceptions
|
||||||
});
|
})
|
||||||
prependExceptionsItem(value, exceptions.indexOf(value));
|
prependExceptionsItem(value, exceptions.indexOf(value))
|
||||||
input.value = "";
|
input.value = ''
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
input.setCustomValidity("Invalid RegExp");
|
input.setCustomValidity('Invalid RegExp')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
input.setCustomValidity("Invalid RegExp");
|
input.setCustomValidity('Invalid RegExp')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document
|
document
|
||||||
.getElementById("add-to-exceptions")
|
.getElementById('add-to-exceptions')
|
||||||
.addEventListener("click", addToExceptions);
|
.addEventListener('click', addToExceptions)
|
||||||
|
|
||||||
function debounce(func, wait, immediate) {
|
function debounce (func, wait, immediate) {
|
||||||
let timeout;
|
let timeout
|
||||||
return () => {
|
return () => {
|
||||||
let context = this,
|
const context = this
|
||||||
args = arguments;
|
const args = arguments
|
||||||
let later = () => {
|
const later = () => {
|
||||||
timeout = null;
|
timeout = null
|
||||||
if (!immediate) func.apply(context, args);
|
if (!immediate) func.apply(context, args)
|
||||||
};
|
}
|
||||||
let callNow = immediate && !timeout;
|
const callNow = immediate && !timeout
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout)
|
||||||
timeout = setTimeout(later, wait);
|
timeout = setTimeout(later, wait)
|
||||||
if (callNow) func.apply(context, args);
|
if (callNow) func.apply(context, args)
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseURL(urlString) {
|
function parseURL (urlString) {
|
||||||
if (urlString) {
|
if (urlString) {
|
||||||
try {
|
try {
|
||||||
const url = new URL(urlString);
|
const url = new URL(urlString)
|
||||||
if (url.username && url.password) {
|
if (url.username && url.password) {
|
||||||
return `${url.protocol}//${url.username}:${url.password}@${url.host}`;
|
return `${url.protocol}//${url.username}:${url.password}@${url.host}`
|
||||||
} else {
|
} else {
|
||||||
return url.origin;
|
return url.origin
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error)
|
||||||
return "";
|
return ''
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const nitterInstanceChange = debounce(() => {
|
const nitterInstanceChange = debounce(() => {
|
||||||
if (nitterInstance.checkValidity()) {
|
if (nitterInstance.checkValidity()) {
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
nitterInstance: parseURL(nitterInstance.value),
|
nitterInstance: parseURL(nitterInstance.value)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500)
|
||||||
nitterInstance.addEventListener("input", nitterInstanceChange);
|
nitterInstance.addEventListener('input', nitterInstanceChange)
|
||||||
|
|
||||||
const invidiousInstanceChange = debounce(() => {
|
const invidiousInstanceChange = debounce(() => {
|
||||||
if (invidiousInstance.checkValidity()) {
|
if (invidiousInstance.checkValidity()) {
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
invidiousInstance: parseURL(invidiousInstance.value),
|
invidiousInstance: parseURL(invidiousInstance.value)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500)
|
||||||
invidiousInstance.addEventListener("input", invidiousInstanceChange);
|
invidiousInstance.addEventListener('input', invidiousInstanceChange)
|
||||||
|
|
||||||
const bibliogramInstanceChange = debounce(() => {
|
const bibliogramInstanceChange = debounce(() => {
|
||||||
if (bibliogramInstance.checkValidity()) {
|
if (bibliogramInstance.checkValidity()) {
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
bibliogramInstance: parseURL(bibliogramInstance.value),
|
bibliogramInstance: parseURL(bibliogramInstance.value)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500)
|
||||||
bibliogramInstance.addEventListener("input", bibliogramInstanceChange);
|
bibliogramInstance.addEventListener('input', bibliogramInstanceChange)
|
||||||
|
|
||||||
const osmInstanceChange = debounce(() => {
|
const osmInstanceChange = debounce(() => {
|
||||||
if (osmInstance.checkValidity()) {
|
if (osmInstance.checkValidity()) {
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
osmInstance: parseURL(osmInstance.value),
|
osmInstance: parseURL(osmInstance.value)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500)
|
||||||
osmInstance.addEventListener("input", osmInstanceChange);
|
osmInstance.addEventListener('input', osmInstanceChange)
|
||||||
|
|
||||||
const redditInstanceChange = debounce(() => {
|
const redditInstanceChange = debounce(() => {
|
||||||
if (redditInstance.checkValidity()) {
|
if (redditInstance.checkValidity()) {
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
redditInstance: parseURL(redditInstance.value),
|
redditInstance: parseURL(redditInstance.value)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500)
|
||||||
redditInstance.addEventListener("input", redditInstanceChange);
|
redditInstance.addEventListener('input', redditInstanceChange)
|
||||||
|
|
||||||
const searchEngineInstanceChange = debounce(() => {
|
const searchEngineInstanceChange = debounce(() => {
|
||||||
const instance = searchEngineInstances.find(
|
const instance = searchEngineInstances.find(
|
||||||
(instance) => instance.link === searchEngineInstance.value
|
(instance) => instance.link === searchEngineInstance.value
|
||||||
);
|
)
|
||||||
if (instance || !searchEngineInstance.value) {
|
if (instance || !searchEngineInstance.value) {
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
searchEngineInstance: instance || searchEngineInstance.value,
|
searchEngineInstance: instance || searchEngineInstance.value
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
searchEngineInstance.setCustomValidity("Must be an instance from the list");
|
searchEngineInstance.setCustomValidity('Must be an instance from the list')
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500)
|
||||||
searchEngineInstance.addEventListener("input", searchEngineInstanceChange);
|
searchEngineInstance.addEventListener('input', searchEngineInstanceChange)
|
||||||
|
|
||||||
const simplyTranslateInstanceChange = debounce(() => {
|
const simplyTranslateInstanceChange = debounce(() => {
|
||||||
if (simplyTranslateInstance.checkValidity()) {
|
if (simplyTranslateInstance.checkValidity()) {
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
simplyTranslateInstance: parseURL(simplyTranslateInstance.value),
|
simplyTranslateInstance: parseURL(simplyTranslateInstance.value)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500)
|
||||||
simplyTranslateInstance.addEventListener(
|
simplyTranslateInstance.addEventListener(
|
||||||
"input",
|
'input',
|
||||||
simplyTranslateInstanceChange
|
simplyTranslateInstanceChange
|
||||||
);
|
)
|
||||||
|
|
||||||
const wikipediaInstanceChange = debounce(() => {
|
const wikipediaInstanceChange = debounce(() => {
|
||||||
if (wikipediaInstance.checkValidity()) {
|
if (wikipediaInstance.checkValidity()) {
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
wikipediaInstance: parseURL(wikipediaInstance.value),
|
wikipediaInstance: parseURL(wikipediaInstance.value)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500)
|
||||||
wikipediaInstance.addEventListener(
|
wikipediaInstance.addEventListener(
|
||||||
"input",
|
'input',
|
||||||
wikipediaInstanceChange
|
wikipediaInstanceChange
|
||||||
);
|
)
|
||||||
|
|
||||||
disableNitter.addEventListener("change", (event) => {
|
disableNitter.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableNitter: !event.target.checked });
|
browser.storage.sync.set({ disableNitter: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableInvidious.addEventListener("change", (event) => {
|
disableInvidious.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableInvidious: !event.target.checked });
|
browser.storage.sync.set({ disableInvidious: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableBibliogram.addEventListener("change", (event) => {
|
disableBibliogram.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableBibliogram: !event.target.checked });
|
browser.storage.sync.set({ disableBibliogram: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableOsm.addEventListener("change", (event) => {
|
disableOsm.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableOsm: !event.target.checked });
|
browser.storage.sync.set({ disableOsm: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableReddit.addEventListener("change", (event) => {
|
disableReddit.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableReddit: !event.target.checked });
|
browser.storage.sync.set({ disableReddit: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableSearchEngine.addEventListener("change", (event) => {
|
disableSearchEngine.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableSearchEngine: !event.target.checked });
|
browser.storage.sync.set({ disableSearchEngine: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableSimplyTranslate.addEventListener("change", (event) => {
|
disableSimplyTranslate.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableSimplyTranslate: !event.target.checked });
|
browser.storage.sync.set({ disableSimplyTranslate: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableWikipedia.addEventListener("change", (event) => {
|
disableWikipedia.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableWikipedia: !event.target.checked });
|
browser.storage.sync.set({ disableWikipedia: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
alwaysProxy.addEventListener("change", (event) => {
|
alwaysProxy.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ alwaysProxy: event.target.checked });
|
browser.storage.sync.set({ alwaysProxy: event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
onlyEmbeddedVideo.addEventListener("change", (event) => {
|
onlyEmbeddedVideo.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ onlyEmbeddedVideo: event.target.checked });
|
browser.storage.sync.set({ onlyEmbeddedVideo: event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
videoQuality.addEventListener("change", (event) => {
|
videoQuality.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
videoQuality: event.target.options[videoQuality.selectedIndex].value,
|
videoQuality: event.target.options[videoQuality.selectedIndex].value
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
removeTwitterSW.addEventListener("change", (event) => {
|
removeTwitterSW.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ removeTwitterSW: !event.target.checked });
|
browser.storage.sync.set({ removeTwitterSW: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
invidiousDarkMode.addEventListener("change", (event) => {
|
invidiousDarkMode.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ invidiousDarkMode: event.target.checked });
|
browser.storage.sync.set({ invidiousDarkMode: event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
persistInvidiousPrefs.addEventListener("change", (event) => {
|
persistInvidiousPrefs.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ persistInvidiousPrefs: event.target.checked });
|
browser.storage.sync.set({ persistInvidiousPrefs: event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
useFreeTube.addEventListener("change", (event) => {
|
useFreeTube.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ useFreeTube: event.target.checked });
|
browser.storage.sync.set({ useFreeTube: event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
const invidiousVolumeChange = debounce(() => {
|
const invidiousVolumeChange = debounce(() => {
|
||||||
document.querySelector(
|
document.querySelector(
|
||||||
"#volume-value"
|
'#volume-value'
|
||||||
).textContent = `${invidiousVolume.value}%`;
|
).textContent = `${invidiousVolume.value}%`
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
invidiousVolume: invidiousVolume.value,
|
invidiousVolume: invidiousVolume.value
|
||||||
});
|
})
|
||||||
}, 500);
|
}, 500)
|
||||||
invidiousVolume.addEventListener("input", invidiousVolumeChange);
|
invidiousVolume.addEventListener('input', invidiousVolumeChange)
|
||||||
|
|
||||||
invidiousPlayerStyle.addEventListener("change", (event) => {
|
invidiousPlayerStyle.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
invidiousPlayerStyle:
|
invidiousPlayerStyle:
|
||||||
event.target.options[invidiousPlayerStyle.selectedIndex].value,
|
event.target.options[invidiousPlayerStyle.selectedIndex].value
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
const invidiousSubtitlesChange = debounce(() => {
|
const invidiousSubtitlesChange = debounce(() => {
|
||||||
browser.storage.sync.set({ invidiousSubtitles: invidiousSubtitles.value });
|
browser.storage.sync.set({ invidiousSubtitles: invidiousSubtitles.value })
|
||||||
}, 500);
|
}, 500)
|
||||||
invidiousSubtitles.addEventListener("input", invidiousSubtitlesChange);
|
invidiousSubtitles.addEventListener('input', invidiousSubtitlesChange)
|
||||||
|
|
||||||
invidiousAutoplay.addEventListener("change", (event) => {
|
invidiousAutoplay.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ invidiousAutoplay: event.target.checked });
|
browser.storage.sync.set({ invidiousAutoplay: event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
const nitterRandomPoolChange = debounce(() => {
|
const nitterRandomPoolChange = debounce(() => {
|
||||||
browser.storage.sync.set({ nitterRandomPool: nitterRandomPool.value });
|
browser.storage.sync.set({ nitterRandomPool: nitterRandomPool.value })
|
||||||
}, 500);
|
}, 500)
|
||||||
nitterRandomPool.addEventListener("input", nitterRandomPoolChange);
|
nitterRandomPool.addEventListener('input', nitterRandomPoolChange)
|
||||||
|
|
||||||
const invidiousRandomPoolChange = debounce(() => {
|
const invidiousRandomPoolChange = debounce(() => {
|
||||||
browser.storage.sync.set({ invidiousRandomPool: invidiousRandomPool.value });
|
browser.storage.sync.set({ invidiousRandomPool: invidiousRandomPool.value })
|
||||||
}, 500);
|
}, 500)
|
||||||
invidiousRandomPool.addEventListener("input", invidiousRandomPoolChange);
|
invidiousRandomPool.addEventListener('input', invidiousRandomPoolChange)
|
||||||
|
|
||||||
const bibliogramRandomPoolChange = debounce(() => {
|
const bibliogramRandomPoolChange = debounce(() => {
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
bibliogramRandomPool: bibliogramRandomPool.value,
|
bibliogramRandomPool: bibliogramRandomPool.value
|
||||||
});
|
})
|
||||||
}, 500);
|
}, 500)
|
||||||
bibliogramRandomPool.addEventListener("input", bibliogramRandomPoolChange);
|
bibliogramRandomPool.addEventListener('input', bibliogramRandomPoolChange)
|
||||||
|
|
||||||
theme.addEventListener("change", (event) => {
|
theme.addEventListener('change', (event) => {
|
||||||
const value = event.target.options[theme.selectedIndex].value;
|
const value = event.target.options[theme.selectedIndex].value
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case "dark-theme":
|
case 'dark-theme':
|
||||||
document.body.classList.add("dark-theme");
|
document.body.classList.add('dark-theme')
|
||||||
document.body.classList.remove("light-theme");
|
document.body.classList.remove('light-theme')
|
||||||
break;
|
break
|
||||||
case "light-theme":
|
case 'light-theme':
|
||||||
document.body.classList.add("light-theme");
|
document.body.classList.add('light-theme')
|
||||||
document.body.classList.remove("dark-theme");
|
document.body.classList.remove('dark-theme')
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
document.body.classList.remove("light-theme");
|
document.body.classList.remove('light-theme')
|
||||||
document.body.classList.remove("dark-theme");
|
document.body.classList.remove('dark-theme')
|
||||||
}
|
}
|
||||||
browser.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
theme: value,
|
theme: value
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
function autocomplete(input, list) {
|
function autocomplete (input, list) {
|
||||||
let currentFocus;
|
let currentFocus
|
||||||
input.addEventListener("focus", (e) => {
|
input.addEventListener('focus', (e) => {
|
||||||
showOptions(e, true);
|
showOptions(e, true)
|
||||||
});
|
})
|
||||||
input.addEventListener("input", (e) => {
|
input.addEventListener('input', (e) => {
|
||||||
const val = e.target.value;
|
const val = e.target.value
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
currentFocus = -1;
|
currentFocus = -1
|
||||||
showOptions(e);
|
showOptions(e)
|
||||||
});
|
})
|
||||||
input.addEventListener("keydown", function (e) {
|
input.addEventListener('keydown', function (e) {
|
||||||
let x = document.getElementById(this.id + "autocomplete-list");
|
let x = document.getElementById(this.id + 'autocomplete-list')
|
||||||
if (x) x = x.getElementsByTagName("div");
|
if (x) x = x.getElementsByTagName('div')
|
||||||
if (e.keyCode == 40) {
|
if (e.keyCode === 40) {
|
||||||
currentFocus++;
|
currentFocus++
|
||||||
addActive(x);
|
addActive(x)
|
||||||
} else if (e.keyCode == 38) {
|
} else if (e.keyCode === 38) {
|
||||||
currentFocus--;
|
currentFocus--
|
||||||
addActive(x);
|
addActive(x)
|
||||||
} else if (e.keyCode == 13) {
|
} else if (e.keyCode === 13) {
|
||||||
e.preventDefault();
|
e.preventDefault()
|
||||||
if (currentFocus > -1) {
|
if (currentFocus > -1) {
|
||||||
if (x) x[currentFocus].click();
|
if (x) x[currentFocus].click()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
function showOptions(event, showAll = false) {
|
function showOptions (event, showAll = false) {
|
||||||
let div,
|
let i
|
||||||
i,
|
const val = event.target.value
|
||||||
val = event.target.value;
|
closeAllLists()
|
||||||
closeAllLists();
|
const div = document.createElement('div')
|
||||||
div = document.createElement("div");
|
div.setAttribute('id', event.target.id + 'autocomplete-list')
|
||||||
div.setAttribute("id", event.target.id + "autocomplete-list");
|
div.setAttribute('class', 'autocomplete-items')
|
||||||
div.setAttribute("class", "autocomplete-items");
|
event.target.parentNode.appendChild(div)
|
||||||
event.target.parentNode.appendChild(div);
|
|
||||||
for (i = 0; i < list.length; i++) {
|
for (i = 0; i < list.length; i++) {
|
||||||
if (list[i].toLowerCase().indexOf(val.toLowerCase()) > -1) {
|
if (list[i].toLowerCase().indexOf(val.toLowerCase()) > -1) {
|
||||||
div.appendChild(getItem(list[i], val));
|
div.appendChild(getItem(list[i], val))
|
||||||
} else if (showAll) {
|
} else if (showAll) {
|
||||||
div.appendChild(getItem(list[i], val));
|
div.appendChild(getItem(list[i], val))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function getItem(item, val) {
|
function getItem (item, val) {
|
||||||
const div = document.createElement("div");
|
const div = document.createElement('div')
|
||||||
const strong = document.createElement("strong");
|
const strong = document.createElement('strong')
|
||||||
strong.textContent = item.substr(0, val.length);
|
strong.textContent = item.substr(0, val.length)
|
||||||
div.innerText = item.substr(val.length);
|
div.innerText = item.substr(val.length)
|
||||||
const hiddenInput = document.createElement("input");
|
const hiddenInput = document.createElement('input')
|
||||||
hiddenInput.type = "hidden";
|
hiddenInput.type = 'hidden'
|
||||||
hiddenInput.value = item;
|
hiddenInput.value = item
|
||||||
div.prepend(strong);
|
div.prepend(strong)
|
||||||
div.appendChild(hiddenInput);
|
div.appendChild(hiddenInput)
|
||||||
div.addEventListener("click", function (e) {
|
div.addEventListener('click', function (e) {
|
||||||
input.value = div.getElementsByTagName("input")[0].value;
|
input.value = div.getElementsByTagName('input')[0].value
|
||||||
input.dispatchEvent(new Event("input"));
|
input.dispatchEvent(new Event('input'))
|
||||||
closeAllLists();
|
closeAllLists()
|
||||||
});
|
})
|
||||||
return div;
|
return div
|
||||||
}
|
}
|
||||||
function addActive(x) {
|
function addActive (x) {
|
||||||
if (!x) return false;
|
if (!x) return false
|
||||||
removeActive(x);
|
removeActive(x)
|
||||||
if (currentFocus >= x.length) currentFocus = 0;
|
if (currentFocus >= x.length) currentFocus = 0
|
||||||
if (currentFocus < 0) currentFocus = x.length - 1;
|
if (currentFocus < 0) currentFocus = x.length - 1
|
||||||
x[currentFocus].classList.add("autocomplete-active");
|
x[currentFocus].classList.add('autocomplete-active')
|
||||||
}
|
}
|
||||||
function removeActive(x) {
|
function removeActive (x) {
|
||||||
for (let i = 0; i < x.length; i++) {
|
for (let i = 0; i < x.length; i++) {
|
||||||
x[i].classList.remove("autocomplete-active");
|
x[i].classList.remove('autocomplete-active')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function closeAllLists(elmnt) {
|
function closeAllLists (elmnt) {
|
||||||
let x = document.getElementsByClassName("autocomplete-items");
|
const x = document.getElementsByClassName('autocomplete-items')
|
||||||
for (let i = 0; i < x.length; i++) {
|
for (let i = 0; i < x.length; i++) {
|
||||||
if (elmnt != x[i] && elmnt != input) {
|
if (elmnt !== x[i] && elmnt !== input) {
|
||||||
x[i].parentNode.removeChild(x[i]);
|
x[i].parentNode.removeChild(x[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.addEventListener("click", (e) => {
|
document.addEventListener('click', (e) => {
|
||||||
if (!autocompletes.find((element) => element.id === e.target.id)) {
|
if (!autocompletes.find((element) => element.id === e.target.id)) {
|
||||||
closeAllLists(e.target);
|
closeAllLists(e.target)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
autocompletes.forEach((value) => {
|
autocompletes.forEach((value) => {
|
||||||
autocomplete(document.getElementById(value.id), value.instances);
|
autocomplete(document.getElementById(value.id), value.instances)
|
||||||
});
|
})
|
||||||
|
|
||||||
var coll = document.getElementsByClassName("collapsible");
|
const coll = document.getElementsByClassName('collapsible')
|
||||||
var i;
|
let i
|
||||||
|
|
||||||
for (i = 0; i < coll.length; i++) {
|
for (i = 0; i < coll.length; i++) {
|
||||||
coll[i].addEventListener("click", function () {
|
coll[i].addEventListener('click', function () {
|
||||||
this.classList.toggle("collapsible-active");
|
this.classList.toggle('collapsible-active')
|
||||||
var content = this.nextElementSibling;
|
const content = this.nextElementSibling
|
||||||
if (content.style.display === "block") {
|
if (content.style.display === 'block') {
|
||||||
content.style.display = "none";
|
content.style.display = 'none'
|
||||||
} else {
|
} 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");
|
const disableNitter = document.querySelector('#disable-nitter')
|
||||||
let disableInvidious = document.querySelector("#disable-invidious");
|
const disableInvidious = document.querySelector('#disable-invidious')
|
||||||
let disableBibliogram = document.querySelector("#disable-bibliogram");
|
const disableBibliogram = document.querySelector('#disable-bibliogram')
|
||||||
let disableOsm = document.querySelector("#disable-osm");
|
const disableOsm = document.querySelector('#disable-osm')
|
||||||
let disableReddit = document.querySelector("#disable-reddit");
|
const disableReddit = document.querySelector('#disable-reddit')
|
||||||
let disableSearchEngine = document.querySelector("#disable-searchEngine");
|
const disableSearchEngine = document.querySelector('#disable-searchEngine')
|
||||||
let disableSimplyTranslate = document.querySelector("#disable-simplyTranslate");
|
const disableSimplyTranslate = document.querySelector('#disable-simplyTranslate')
|
||||||
let disableWikipedia = document.querySelector("#disable-wikipedia");
|
const disableWikipedia = document.querySelector('#disable-wikipedia')
|
||||||
let version = document.querySelector("#version");
|
const version = document.querySelector('#version')
|
||||||
|
|
||||||
window.browser = window.browser || window.chrome;
|
window.browser = window.browser || window.chrome
|
||||||
|
|
||||||
browser.storage.sync.get(
|
browser.storage.sync.get(
|
||||||
[
|
[
|
||||||
"disableNitter",
|
'disableNitter',
|
||||||
"disableInvidious",
|
'disableInvidious',
|
||||||
"disableBibliogram",
|
'disableBibliogram',
|
||||||
"disableOsm",
|
'disableOsm',
|
||||||
"disableReddit",
|
'disableReddit',
|
||||||
"disableSearchEngine",
|
'disableSearchEngine',
|
||||||
"disableSimplyTranslate",
|
'disableSimplyTranslate',
|
||||||
"disableWikipedia",
|
'disableWikipedia',
|
||||||
"theme",
|
'theme'
|
||||||
],
|
],
|
||||||
(result) => {
|
(result) => {
|
||||||
if (result.theme) document.body.classList.add(result.theme);
|
if (result.theme) document.body.classList.add(result.theme)
|
||||||
disableNitter.checked = !result.disableNitter;
|
disableNitter.checked = !result.disableNitter
|
||||||
disableInvidious.checked = !result.disableInvidious;
|
disableInvidious.checked = !result.disableInvidious
|
||||||
disableBibliogram.checked = !result.disableBibliogram;
|
disableBibliogram.checked = !result.disableBibliogram
|
||||||
disableOsm.checked = !result.disableOsm;
|
disableOsm.checked = !result.disableOsm
|
||||||
disableReddit.checked = !result.disableReddit;
|
disableReddit.checked = !result.disableReddit
|
||||||
disableSearchEngine.checked = !result.disableSearchEngine;
|
disableSearchEngine.checked = !result.disableSearchEngine
|
||||||
disableSimplyTranslate.checked = !result.disableSimplyTranslate;
|
disableSimplyTranslate.checked = !result.disableSimplyTranslate
|
||||||
disableWikipedia.checked = !result.disableWikipedia;
|
disableWikipedia.checked = !result.disableWikipedia
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
|
|
||||||
version.textContent = browser.runtime.getManifest().version;
|
version.textContent = browser.runtime.getManifest().version
|
||||||
|
|
||||||
disableNitter.addEventListener("change", (event) => {
|
disableNitter.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableNitter: !event.target.checked });
|
browser.storage.sync.set({ disableNitter: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableInvidious.addEventListener("change", (event) => {
|
disableInvidious.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableInvidious: !event.target.checked });
|
browser.storage.sync.set({ disableInvidious: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableBibliogram.addEventListener("change", (event) => {
|
disableBibliogram.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableBibliogram: !event.target.checked });
|
browser.storage.sync.set({ disableBibliogram: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableOsm.addEventListener("change", (event) => {
|
disableOsm.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableOsm: !event.target.checked });
|
browser.storage.sync.set({ disableOsm: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableReddit.addEventListener("change", (event) => {
|
disableReddit.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableReddit: !event.target.checked });
|
browser.storage.sync.set({ disableReddit: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableSearchEngine.addEventListener("change", (event) => {
|
disableSearchEngine.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableSearchEngine: !event.target.checked });
|
browser.storage.sync.set({ disableSearchEngine: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableSimplyTranslate.addEventListener("change", (event) => {
|
disableSimplyTranslate.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableSimplyTranslate: !event.target.checked });
|
browser.storage.sync.set({ disableSimplyTranslate: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
disableWikipedia.addEventListener("change", (event) => {
|
disableWikipedia.addEventListener('change', (event) => {
|
||||||
browser.storage.sync.set({ disableWikipedia: !event.target.checked });
|
browser.storage.sync.set({ disableWikipedia: !event.target.checked })
|
||||||
});
|
})
|
||||||
|
|
||||||
document.querySelector("#more-options").addEventListener("click", () => {
|
document.querySelector('#more-options').addEventListener('click', () => {
|
||||||
browser.runtime.openOptionsPage();
|
browser.runtime.openOptionsPage()
|
||||||
});
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user