diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ProxyEditor.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ProxyEditor.js index 1148c56..c9ee179 100644 --- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ProxyEditor.js +++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ProxyEditor.js @@ -30,7 +30,7 @@ export default function getProxyEditor(theState) { padding: 0; } /* PROXY ROW */ - table.editor tr.proxyRow td:first-child { + table.editor tr.proxyRow td:nth-child(2) { text-align: center; } @@ -78,7 +78,8 @@ export default function getProxyEditor(theState) { } /* LAST COLUMN: BUTTONS */ - table.editor tr > *:nth-last-child(1) { + table.editor tr > *:nth-last-child(1), + table.editor tr.proxyRow > td:first-child { text-align: center; padding: 0; position: relative; @@ -123,6 +124,10 @@ export default function getProxyEditor(theState) { return true; }; + const splitBySemi = (proxyString) => proxyString.replace(/#.*$/mg, '').trim().split(/\s*;\s*/g).filter((s) => s); + const joinBySemi = (strs) => strs.join(';\n') + ';'; + const normilizeProxyString = (str) => joinBySemi(splitBySemi(str)); + const PROXY_TYPE_LABEL_PAIRS = [['PROXY', 'PROXY/HTTP'],['HTTPS'],['SOCKS4'],['SOCKS5'],['SOCKS']]; @@ -181,12 +186,35 @@ export default function getProxyEditor(theState) { const hostname = elements.hostname; const port = elements.port; - that.props.updateProxyStringRaw( + that.props.setProxyStringRaw( `${that.props.proxyStringRaw} ${type} ${hostname}:${port};`.trim() ); } + handleDelete(that, {proxyAsString, index}) { + + event.preventDefault(); + const proxyStrings = splitBySemi(that.props.proxyStringRaw); + proxyStrings.splice(index, 1); + + that.props.setProxyStringRaw( joinBySemi(proxyStrings) ); + + } + + raisePriority(that, {proxyAsString, index}) { + + event.preventDefault(); + if (index < 1) { + return; + } + const proxyStrings = splitBySemi(that.props.proxyStringRaw); + proxyStrings.splice(index - 1, 2, proxyStrings[index], proxyStrings[index-1]); + + that.props.setProxyStringRaw( joinBySemi(proxyStrings) ); + + } + handleSubmit(that, event) { event.preventDefault(); @@ -201,7 +229,7 @@ export default function getProxyEditor(theState) {
протокол | домен / IP | порт | + | протокол | домен / IP | порт |
|
|
---|---|---|---|---|---|---|---|---|
+ | @@ -243,6 +272,7 @@ export default function getProxyEditor(theState) { name="port" onInvalid={linkEvent(this, this.showInvalidMessage)} onkeydown={onlyPort} + tabindex="2" /> | @@ -255,17 +285,23 @@ export default function getProxyEditor(theState) { | ||||||
{type} | {hostname} | {port} |
-
- - {/**/} + + | {type} | {hostname} | {port} | ++ |