Skip to content

Commit

Permalink
* Show patterns buttons when adding Direct (no proxy) setting.
Browse files Browse the repository at this point in the history
* Fixed some minor UI bugs when using Direct (no proxy).
  • Loading branch information
ericjung committed Oct 18, 2019
1 parent 16066b1 commit d349179
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 39 deletions.
1 change: 1 addition & 0 deletions src/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ <h4>Version 7.4</h4>
on pattern-related pages</div>
</li>
<li>Bug fixes when importing legacy foxyproxy.xml settings (FoxyProxy 4.x and earlier)</li>
<li>Show patterns buttons when adding Direct (no proxy) setting. Fixed some minor UI bugs when using Direct (no proxy).</li>
</ul>
<h4>Version 7.3</h4>
<ul>
Expand Down
84 changes: 48 additions & 36 deletions src/proxy.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,23 @@
display: none;
}

#direct:checked ~ div button[data-i18n="saveEditPattern"] {
#http:checked ~ div .patternShortcuts,
#https:checked ~ div .patternShortcuts,
#socks4:checked ~ div .patternShortcuts,
#socks5:checked ~ div .patternShortcuts,
#direct:checked ~ div .patternShortcuts {
display: flex;
}

#pac:checked ~ div .patternShortcutsContainer,
#wpad:checked ~ div .patternShortcutsContainer,
#system:checked ~ div .patternShortcutsContainer {
display: none;
}


#direct:checked ~ div .patternShortcutsContainer {
display: block;
}
</style>
</head>
<body>
Expand All @@ -72,39 +85,13 @@

<!-- left column -->
<div>
<label data-i18n="title"></label>
<input id="proxyTitle" type="text" spellcheck="false" placeholder="title">

<label data-i18n="color"></label>
<input id="colorChooser" type="text" style="text-align: center;">

<label data-i18n="patternShortcuts" class="notForBasic notForEdit"></label>
<div class="prime warning notForBasic notForEdit">
<div class="flex onOff">
<label data-i18n="active"></label>
<div>
<input type="checkbox" class="switch" id="proxyActive" checked><label for="proxyActive"></label>
</div>
</div>

<div class="flex onOff">
<label><span data-i18n="addWhitelist"></span>
<div class="tooltip"><i class="fa fa-info-circle" style="font-size: 1.2em;"></i><span class="tooltiptext" data-i18n="addWhitelistTip"></span></div></label>
<div>
<input type="checkbox" class="switch" id="whiteAll"><label for="whiteAll"></label>
</div>
</div>

<div class="flex onOff">
<label><span data-i18n="noLocal"></span>
<div class="tooltip"><i class="fa fa-info-circle" style="font-size: 1.2em;"></i><span class="tooltiptext" data-i18n="addBlacklistTip"></span></div></label>
<div>
<label data-i18n="title"></label>
<input id="proxyTitle" type="text" spellcheck="false" placeholder="title">

<div>
<input type="checkbox" class="switch" id="blackAll"><label for="blackAll"></label>
</div>
</div>
<label data-i18n="color"></label>
<input id="colorChooser" type="text" style="text-align: center;">
</div>


<!-- SOCKS5 -->
<div class="flex onOff dns">
Expand All @@ -113,10 +100,35 @@
<input type="checkbox" class="switch" id="proxyDNS" checked><label for="proxyDNS"></label>
</div>
</div>




<div class="patternShortcutsContainer notForBasic notForEdit">
<label data-i18n="patternShortcuts" class="notForBasic notForEdit"></label>
<div class="prime warning">
<div class="patternShortcuts flex onOff">
<label data-i18n="active"></label>
<div>
<input type="checkbox" class="switch" id="proxyActive" checked><label for="proxyActive"></label>
</div>
</div>

<div class="patternShortcuts onOff">
<label><span data-i18n="addWhitelist"></span>
<div class="tooltip"><i class="fa fa-info-circle"></i><span class="tooltiptext" data-i18n="addWhitelistTip"></span></div></label>
<div>
<input type="checkbox" class="switch" id="whiteAll"><label for="whiteAll"></label>
</div>
</div>

<div class="patternShortcuts onOff">
<label><span data-i18n="noLocal"></span>
<div class="tooltip"><i class="fa fa-info-circle"></i><span class="tooltiptext" data-i18n="addBlacklistTip"></span></div></label>

<div>
<input type="checkbox" class="switch" id="blackAll"><label for="blackAll"></label>
</div>
</div>
</div>
</div>
</div>

<!-- right column -->
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function processOptions(pref) {

div.id = id;
node[0].style.backgroundColor = item.color;
node[1].textContent = item.title || `${item.address}:${item.port}`; // ellipsis is handled by CSS
node[1].textContent = Utils.getProxyTitle(item);
node[2].textContent = item.address; // ellipsis is handled by CSS
if (item.cc) {
node[3].classList.remove('hide');
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function processOptions(pref) {
li.classList.remove('template');
li.id = id;
li.style.color = item.color;
li.children[0].textContent = item.title || `${item.address}:${item.port}`;
li.children[0].textContent = Utils.getProxyTitle(item);
li.children[1].textContent = '(' + chrome.i18n.getMessage('forAll') + ')';

docfrag.appendChild(li);
Expand Down
10 changes: 9 additions & 1 deletion src/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,15 @@ class Utils {
}

static getProxyTitle(proxySetting) {
return proxySetting.title || `${proxySetting.address}:${proxySetting.port}`;
if (proxySetting.title) {
return proxySetting.title;
}
else if (proxySetting.type === PROXY_TYPE_NONE) {
return 'Direct (no proxy)';
}
else {
return `${proxySetting.address}:${proxySetting.port}`;
}
}

/*
Expand Down

0 comments on commit d349179

Please sign in to comment.