version 0.3.3

This commit is contained in:
Ray Lothian 2019-11-06 06:19:42 +00:00
parent b99fd158bb
commit b866177b86
9 changed files with 59 additions and 26 deletions

View file

@ -24,7 +24,7 @@
<table width=100%>
<tr>
<td>
<label><input type="radio" name="mode" value="blacklist" id="mode-blacklist"> <span class="h">Black-list mode</span>: Apply the custom user-agent string to all tabs except the tabs with the following top-level hostnames (comma-separated list of hostnames). Note that even if a window-based user-agent string is set from the toolbar popup, your browser's default user-agent string is used.</label>
<label><input type="radio" name="mode" value="blacklist" id="mode-blacklist"> <span class="h">Black-List Mode</span>: Apply the custom user-agent string to all tabs except the tabs with the following top-level hostnames (comma-separated list of hostnames). Note that even if a window-based user-agent string is set from the toolbar popup, your browser's default user-agent string is used.</label>
</td>
</tr>
<tr>
@ -32,7 +32,7 @@
</tr>
<tr>
<td>
<label><input type="radio" name="mode" value="whitelist" id="mode-whitelist"> <span class="h">White-list mode</span>: Only apply the custom user-agent string to the tabs with following top-level hostnames. Note that if a window-based user-agent string is set from the toolbar popup, this user-agent will overwrite the global one.</label>
<label><input type="radio" name="mode" value="whitelist" id="mode-whitelist"> <span class="h">White-List Mode</span>: Only apply the custom user-agent string to the tabs with following top-level hostnames. Note that if a window-based user-agent string is set from the toolbar popup, this user-agent will overwrite the global one.</label>
</td>
</tr>
<tr>
@ -40,20 +40,12 @@
</tr>
<tr>
<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 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.
<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>
</tr>
<tr>
<td class="spacer"><textarea id="custom" rows="5" wrap="off"></textarea></td>
</tr>
<tr>
<td>
<label><span class="h">Custom user-agent string parsing</span>: A JSON object to bypass the internal user-agent string parsing method. The keys are the actual user-agent strings and the value of each key is an object of the keys that need to be set for the "navigator" object. You can use the "[delete]" keyword if you want a key in the "navigator" object to get deleted.</label> Press <a href="#" id="sample-2">here</a> to insert a sample JSON object.
</td>
</tr>
<tr>
<td class="spacer"><textarea id="parser" rows="5" wrap="off"></textarea></td>
</tr>
<tr>
<td class="spacer"><label><input type="checkbox" id="cache"> Use caching to improve performance (recommended value is true). Uncheck this option only if you are using the custom mode and also you need the user-agent string to be altered from the provided list on every single request.</label></td>
</tr>
@ -64,11 +56,22 @@
<td class="spacer"><label><input type="checkbox" id="faqs"> Open FAQs page on updates</label></td>
</tr>
<tr>
<td>A comma-separated list of keywords that the extension should not spoof the user-agent header. Use this list to protect URLs that contain these protected keywords. Each keyword need to be at least 5 char long.</td>
<td class="spacer"><label><input type="checkbox" id="log"> Display debuging info in the browser console</label></td>
</tr>
<tr>
<td><span class="h">Disable Spoofing</span> A comma-separated list of keywords that the extension should not spoof the user-agent header. Use this list to protect URLs that contain these protected keywords. Each keyword need to be at least 5 char long.</td>
</tr>
<tr>
<td><textarea id="protected" rows="3" wrap="off"></textarea></td>
</tr>
<tr>
<td>
<span class="h">Custom User-Agent Parsing</span>: A JSON object to bypass the internal user-agent string parsing method. The keys are the actual user-agent strings and the value of each key is an object of the keys that need to be set for the "navigator" object. You can use the "[delete]" keyword if you want a key in the "navigator" object to get deleted. Press <a href="#" id="sample-2">here</a> to insert a sample JSON object.
</td>
</tr>
<tr>
<td class="spacer"><textarea id="parser" rows="5" wrap="off"></textarea></td>
</tr>
</table>
<p>

View file

@ -43,6 +43,7 @@ function save() {
chrome.storage.local.set({
exactMatch: document.getElementById('exactMatch').checked,
faqs: document.getElementById('faqs').checked,
log: document.getElementById('log').checked,
cache: document.getElementById('cache').checked,
blacklist: prepare(document.getElementById('blacklist').value),
whitelist: prepare(document.getElementById('whitelist').value),
@ -63,6 +64,7 @@ function restore() {
chrome.storage.local.get({
exactMatch: false,
faqs: true,
log: false,
cache: true,
mode: 'blacklist',
whitelist: [],
@ -73,6 +75,7 @@ function restore() {
}, prefs => {
document.getElementById('exactMatch').checked = prefs.exactMatch;
document.getElementById('faqs').checked = prefs.faqs;
document.getElementById('log').checked = prefs.log;
document.getElementById('cache').checked = prefs.cache;
document.querySelector(`[name="mode"][value="${prefs.mode}"`).checked = true;
document.getElementById('blacklist').value = prefs.blacklist.join(', ');

View file

@ -26,7 +26,7 @@ body {
background-color: #fff;
font-family: "Helvetica Neue", Helvetica, sans-serif;
font-size: 13px;
width: 650px;
min-width: 650px;
margin: 0;
}
table {
@ -89,10 +89,10 @@ select {
#list {
overflow: auto;
scroll-behavior: smooth;
height: 200px;
height: 268px;
margin-bottom: 16px;
color: #000;
background-position: top 88px center;
background-position: top 120px center;
background-repeat: no-repeat;
font-size: 11px;
}
@ -210,6 +210,7 @@ body[data-android="true"] [data-cmd="window"] {
}
#view {
background-color: #f5f5f5;
padding: 5px 0;
}
#view td {
text-align: right;

View file

@ -85,7 +85,6 @@ function update(ua) {
}
document.addEventListener('change', ({target}) => {
console.log(target);
if (target.closest('#filter')) {
localStorage.setItem(target.id, target.value);
chrome.storage.local.get({