allow the admin to alter the default user-agent string
This commit is contained in:
parent
4e4ccd589c
commit
d0340982fc
4 changed files with 32 additions and 9 deletions
|
@ -156,7 +156,6 @@ document.addEventListener('DOMContentLoaded', () => fetch('./map.json').then(r =
|
|||
document.querySelector('#os optgroup:last-of-type').appendChild(f2);
|
||||
|
||||
chrome.storage.local.get({
|
||||
'ua': '',
|
||||
'popup-browser': 'Chrome',
|
||||
'popup-os': 'Windows',
|
||||
'popup-sort': 'descending'
|
||||
|
@ -165,10 +164,12 @@ document.addEventListener('DOMContentLoaded', () => fetch('./map.json').then(r =
|
|||
document.getElementById('os').value = prefs['popup-os'];
|
||||
document.getElementById('sort').value = prefs['popup-sort'];
|
||||
|
||||
const ua = prefs.ua || navigator.userAgent;
|
||||
update(ua);
|
||||
document.getElementById('ua').value = ua;
|
||||
document.getElementById('ua').dispatchEvent(new Event('input'));
|
||||
chrome.runtime.getBackgroundPage(bg => {
|
||||
const ua = bg.prefs.ua || navigator.userAgent;
|
||||
update(ua);
|
||||
document.getElementById('ua').value = ua;
|
||||
document.getElementById('ua').dispatchEvent(new Event('input'));
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue