mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-06-28 02:50:32 +02:00
2 new websites + indicator for redirect reliability
This commit is contained in:
@ -51,12 +51,53 @@ chrome.storage.local.get(['all', 'disabled'], function (result) {
|
||||
let name = document.createElement('td')
|
||||
let nameValue = document.createElement('p')
|
||||
nameValue.innerText = match[0]
|
||||
switch (match[3]) {
|
||||
case 1: // low
|
||||
nameValue.classList.add('low-reliability')
|
||||
// @ts-ignore
|
||||
tippy(nameValue, {
|
||||
content: 'Low reliability: Errors may occur often'
|
||||
})
|
||||
break
|
||||
case 2: // normal
|
||||
nameValue.classList.add('normal-reliability')
|
||||
// @ts-ignore
|
||||
tippy(nameValue, {
|
||||
content: 'Normal reliability: Save to use but errors may occur'
|
||||
})
|
||||
break
|
||||
case 3: //high
|
||||
nameValue.classList.add('high-reliability')
|
||||
// @ts-ignore
|
||||
tippy(nameValue, {
|
||||
content: 'High reliability: Errors are very unlikely to happen'
|
||||
})
|
||||
break
|
||||
}
|
||||
let buttons = document.createElement('td')
|
||||
buttons.classList.add('buttons')
|
||||
let on = document.createElement('a')
|
||||
on.innerText = 'On'
|
||||
// @ts-ignore
|
||||
let onTippy = tippy(on, {
|
||||
content: `Enable ${match[0]}`,
|
||||
onMount: () => {
|
||||
if (on.classList.contains('active') || off.classList.contains('disabled')) {
|
||||
onTippy.hide()
|
||||
}
|
||||
}
|
||||
})
|
||||
let off = document.createElement('a')
|
||||
off.innerText = 'Off'
|
||||
// @ts-ignore
|
||||
let offTippy = tippy(off, {
|
||||
content: `Disable ${match[0]}`,
|
||||
onMount: () => {
|
||||
if (off.classList.contains('active') || off.classList.contains('disabled')) {
|
||||
offTippy.hide()
|
||||
}
|
||||
}
|
||||
})
|
||||
disabled.has(match[0]) ? off.classList.add('active') : on.classList.add('active')
|
||||
if (allDisabled) {
|
||||
on.classList.add('disabled')
|
||||
@ -85,6 +126,7 @@ chrome.storage.local.get(['all', 'disabled'], function (result) {
|
||||
}
|
||||
|
||||
let allButtons = document.getElementById('all').getElementsByTagName('a')
|
||||
let allOn = allButtons[0]
|
||||
allButtons[0].onclick = function () {
|
||||
if (!allButtons[0].classList.contains('disabled')) {
|
||||
enableAll(true)
|
||||
@ -92,6 +134,15 @@ chrome.storage.local.get(['all', 'disabled'], function (result) {
|
||||
allButtons[1].classList.remove('active')
|
||||
}
|
||||
}
|
||||
// @ts-ignore
|
||||
let allOnTippy = tippy(allOn, {
|
||||
content: 'Enable all websites',
|
||||
onMount: () => {
|
||||
if (allButtons[0].classList.contains('active')) {
|
||||
allOnTippy.hide()
|
||||
}
|
||||
}
|
||||
})
|
||||
allButtons[1].onclick = function () {
|
||||
if (!allButtons[1].classList.contains('disabled')) {
|
||||
enableAll(false)
|
||||
@ -99,5 +150,14 @@ chrome.storage.local.get(['all', 'disabled'], function (result) {
|
||||
allButtons[1].classList.add('active')
|
||||
}
|
||||
}
|
||||
// @ts-ignore
|
||||
let allOffTippy = tippy(allButtons[1], {
|
||||
content: 'Disable all websites',
|
||||
onMount: () => {
|
||||
if (allButtons[1].classList.contains('active')) {
|
||||
allOffTippy.hide()
|
||||
}
|
||||
}
|
||||
})
|
||||
allDisabled ? allButtons[1].classList.add('active') : allButtons[0].classList.add('active')
|
||||
})
|
||||
|
Reference in New Issue
Block a user