fixes #35
This commit is contained in:
parent
2eb019d60f
commit
1e16c33019
3 changed files with 18 additions and 3 deletions
|
@ -225,6 +225,15 @@ function match({url, tabId}) {
|
||||||
// if s is an array select a random string
|
// if s is an array select a random string
|
||||||
if (Array.isArray(s)) {
|
if (Array.isArray(s)) {
|
||||||
s = s[Math.floor(Math.random() * s.length)];
|
s = s[Math.floor(Math.random() * s.length)];
|
||||||
|
// set session mode if key is either on _[key] or _['*'] lists
|
||||||
|
if (prefs.custom._ && Array.isArray(prefs.custom._)) {
|
||||||
|
if (prefs.custom._.indexOf(key) !== -1) {
|
||||||
|
prefs.custom[key] = s;
|
||||||
|
}
|
||||||
|
else if (prefs.custom._.indexOf('*') !== -1) {
|
||||||
|
prefs.custom['*'] = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (s) {
|
if (s) {
|
||||||
return ua.parse(s);
|
return ua.parse(s);
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label><input type="radio" name="mode" value="custom" id="mode-custom"> <span class="h">Custom mode</span>: Try to resolve the user-agent string from a JSON object; otherwise either use the default user-agent string or use the one that user is set from the popup. Use "*" as the hostname to match all domains. You can randomly select from multiple user-agent strings by providing an array instead of a string.</label> <a href="#" id="sample">Insert</a> a sample JSON object.
|
<label><input type="radio" name="mode" value="custom" id="mode-custom"> <span class="h">Custom mode</span>: Try to resolve the user-agent string from a JSON object; otherwise either use the default user-agent string or use the one that the user is set from the popup interface. Use "*" as the hostname to match all domains. You can randomly select from multiple user-agent strings by providing an array instead of a fixed string. If there is a "_" key in your JSON object which refers to an array of hostnames, then the extension only randomly selects the user-agent string once for each hostname inside this list. This is useful if you don't want the random user-agent to change until this browser session is over.</label> Press <a href="#" id="sample">here</a> to insert a sample JSON object.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -53,9 +53,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p>
|
<p>
|
||||||
|
<button id="help">FAQs Page (Help)</button>
|
||||||
<button id="donate">Support Development</button>
|
<button id="donate">Support Development</button>
|
||||||
<button id="reset">Reset</button>
|
<button id="reset">Reset</button> - <button id="save">Save</button>
|
||||||
<button id="save">Save</button>
|
|
||||||
<span id="status"></span>
|
<span id="status"></span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -93,3 +93,9 @@ document.getElementById('reset').addEventListener('click', e => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.getElementById('help').addEventListener('click', () => {
|
||||||
|
chrome.tabs.create({
|
||||||
|
url: chrome.runtime.getManifest().homepage_url
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue