fixes #36, fixes #37

This commit is contained in:
Ray Lothian 2019-05-16 07:18:58 +02:00
parent e1cdd7cb44
commit 6a5c4c4783
12 changed files with 35 additions and 15 deletions

View file

@ -234,7 +234,7 @@ function match({url, tabId}) {
if (prefs.custom[key]) {
prefs.custom[key] = s;
}
else {
else if (prefs.custom['*']) {
prefs.custom['*'] = s;
}
}

View file

@ -55,10 +55,12 @@ input {
input[type=button] {
cursor: pointer;
min-width: 100px;
transition-delay: 0;
}
input[type=button]:active {
input[type=button].active {
opacity: 0.5;
}
input[type=button]:disabled {
opacity: 0.2;
cursor: default;
@ -158,17 +160,19 @@ select {
display: none;
}
[data-cmd="refresh"] {
margin-left: 2px;
[data-cmd] {
margin-right: 2px;
}
[data-cmd="test"] {
background-color: #4d72b7;
border: solid 1px #4a6dad;
color: #fff;
}
[data-cmd="window"],
[data-cmd="apply"] {
color: #fff;
background-color: #3c923c;
border: solid 1px #327932;
margin-right: 2px;
margin-left: 2px;
}
[data-cmd="reset"] {

View file

@ -25,6 +25,7 @@
<option value="Firefox">Firefox</option>
<option value="Opera">Opera</option>
<option value="Edge">Edge</option>
<option value="Vivaldi">Vivaldi</option>
</optgroup>
<optgroup label="Others"></optgroup>
</select>&nbsp;
@ -73,7 +74,8 @@
<span flex="1"></span>
<input type="button" value="Apply" title="Set this string as the browser's User-Agent string" data-cmd="apply">
<input type="button" value="Window" title="Set this string as this window's User-Agent string" data-cmd="window">
<input type="button" value="Reset" title="Reset User-Agent string to the default one. This will not reset window-based UA strings. To reset them, use the 'Restart' button" style="margin-left: 2px;" data-cmd="reset">
<input type="button" value="Reset" title="Reset User-Agent string to the default one. This will not reset window-based UA strings. To reset them, use the 'Restart' button" data-cmd="reset">
<input type="button" value="Test" title="Test your user-agent string" data-cmd="test">
</div>
<input id="ua" type="text" placeholder="Your preferred user-agent string" title="To set blank user-agent string, use 'empty' keyword">
<div id="explore"></div>

View file

@ -189,6 +189,18 @@ document.addEventListener('click', ({target}) => {
else if (cmd === 'reload') {
chrome.runtime.reload();
}
else if (cmd === 'test') {
chrome.storage.local.get({
'test': 'https://webbrowsertools.com/useragent/?method=normal&verbose=false'
}, prefs => chrome.tabs.create({
url: prefs.test
}));
}
if (cmd) {
target.classList.add('active');
window.setTimeout(() => target.classList.remove('active'), 500);
}
}
});

View file

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "User-Agent Switcher and Manager",
"short_name": "useragent-switcher",
"version": "0.2.8",
"version": "0.2.9",
"description": "Spoofs User-Agent strings of your browser with a new one globally, randomly or per hostname",
@ -43,7 +43,7 @@
},
"default_popup": "data/popup/index.html"
},
"homepage_url": "http://add0n.com/useragent-switcher.html",
"homepage_url": "https://add0n.com/useragent-switcher.html",
"options_ui": {
"page": "data/options/index.html",
"chrome_style": true