Save and load custom values
This commit is contained in:
parent
c350da3cc3
commit
62bac340de
4 changed files with 8 additions and 7 deletions
|
|
@ -6,24 +6,27 @@ const DebugSettings = ({ type, title, ip, profile, setProfile }) => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (profile === 'match') {
|
if (profile === 'match') {
|
||||||
console.log(ip)
|
console.log(1)
|
||||||
|
|
||||||
if (ip) {
|
if (ip) {
|
||||||
setValue(ip[type])
|
setValue(ip[type])
|
||||||
chrome.storage.sync.set({ [type]: ip[type] })
|
chrome.storage.sync.set({ [type]: ip[type] })
|
||||||
}
|
}
|
||||||
} else if (profile === 'custom') {
|
} else if (profile === 'custom') {
|
||||||
console.log(111)
|
console.log(2)
|
||||||
chrome.storage.sync.get([type], (result) => {
|
chrome.storage.sync.get([type], (result) => {
|
||||||
|
console.log(type)
|
||||||
|
console.log(result)
|
||||||
result[type] && setValue(result[type])
|
result[type] && setValue(result[type])
|
||||||
})
|
})
|
||||||
} else {
|
} else if (profile !== 'default') {
|
||||||
setValue(profiles[profile][type])
|
setValue(profiles[profile][type])
|
||||||
chrome.storage.sync.set({ [type]: profiles[profile][type] })
|
chrome.storage.sync.set({ [type]: profiles[profile][type] })
|
||||||
}
|
}
|
||||||
}, [ip, profile, type])
|
}, [ip, profile, type])
|
||||||
|
|
||||||
const changeTextValue = (e) => {
|
const changeTextValue = (e) => {
|
||||||
chrome.storage.sync.set({ [type]: e.target.value })
|
chrome.storage.sync.set({ timezone: e.target.value })
|
||||||
setValue(e.target.value)
|
setValue(e.target.value)
|
||||||
chrome.storage.sync.set({ profile: 'custom' })
|
chrome.storage.sync.set({ profile: 'custom' })
|
||||||
setProfile('custom')
|
setProfile('custom')
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ const getIP = () =>
|
||||||
|
|
||||||
const Popup = () => {
|
const Popup = () => {
|
||||||
const [ip, setIP] = useState(null)
|
const [ip, setIP] = useState(null)
|
||||||
const [profile, setProfile] = useState('none')
|
const [profile, setProfile] = useState('default')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
chrome.storage.sync.get(['profile', 'ipData'], (result) => {
|
chrome.storage.sync.get(['profile', 'ipData'], (result) => {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ const UserAgentSettings = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeInterval = (e) => {
|
const changeInterval = (e) => {
|
||||||
console.log(e.target.value)
|
|
||||||
chrome.storage.sync.set({ interval: e.target.value })
|
chrome.storage.sync.set({ interval: e.target.value })
|
||||||
setInterval(e.target.value)
|
setInterval(e.target.value)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
const detachDebugger = () => {
|
const detachDebugger = () => {
|
||||||
chrome.debugger.getTargets((tabs) => {
|
chrome.debugger.getTargets((tabs) => {
|
||||||
console.log(tabs)
|
|
||||||
for (const tab in tabs) {
|
for (const tab in tabs) {
|
||||||
if (tabs[tab].attached && tabs[tab].tabId) {
|
if (tabs[tab].attached && tabs[tab].tabId) {
|
||||||
chrome.debugger.detach({ tabId: tabs[tab].tabId })
|
chrome.debugger.detach({ tabId: tabs[tab].tabId })
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue