mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-27 20:03:45 +03:00
Finish the view part of popup (almost)
This commit is contained in:
parent
84ddcb2348
commit
7512bb697f
|
@ -8,7 +8,8 @@ import getTabPanel from './TabPanel';
|
||||||
import getPacChooser from './PacChooser';
|
import getPacChooser from './PacChooser';
|
||||||
import getNotifications from './Notifications';
|
import getNotifications from './Notifications';
|
||||||
import getExceptions from './Exceptions';
|
import getExceptions from './Exceptions';
|
||||||
import getMods from './Mods';
|
import getModList from './ModList';
|
||||||
|
import getProxyEditor from './ProxyEditor';
|
||||||
|
|
||||||
import getFooter from './Footer';
|
import getFooter from './Footer';
|
||||||
|
|
||||||
|
@ -20,7 +21,8 @@ export default function getApp(theState) {
|
||||||
const PacChooser = getPacChooser(theState);
|
const PacChooser = getPacChooser(theState);
|
||||||
const Notifications = getNotifications(theState);
|
const Notifications = getNotifications(theState);
|
||||||
const Exceptions = getExceptions(theState);
|
const Exceptions = getExceptions(theState);
|
||||||
const Mods = getMods(theState);
|
const ModList = getModList(theState);
|
||||||
|
const ProxyEditor = getProxyEditor(theState);
|
||||||
|
|
||||||
const Footer = getFooter(theState);
|
const Footer = getFooter(theState);
|
||||||
|
|
||||||
|
@ -138,8 +140,9 @@ export default function getApp(theState) {
|
||||||
|
|
||||||
return createElement('div', null, [
|
return createElement('div', null, [
|
||||||
...( props.flags.ifNotControlled ? [createElement(NotControlledWarning, props)] : [] ),
|
...( props.flags.ifNotControlled ? [createElement(NotControlledWarning, props)] : [] ),
|
||||||
|
// WARNIGN ENDS.
|
||||||
createElement(TabPanel, {
|
createElement(TabPanel, {
|
||||||
tabs:[
|
tabs: [
|
||||||
{
|
{
|
||||||
label: 'PAC-скрипт',
|
label: 'PAC-скрипт',
|
||||||
content: createElement(PacChooser, props),
|
content: createElement(PacChooser, props),
|
||||||
|
@ -150,18 +153,30 @@ export default function getApp(theState) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Свои прокси',
|
label: 'Свои прокси',
|
||||||
content: "OwnProxies().render(this.props)",
|
content: createElement(
|
||||||
|
ModList,
|
||||||
|
Object.assign({}, props, {
|
||||||
|
category: 'ownProxies',
|
||||||
|
modToChildren: {
|
||||||
|
customProxyStringRaw: createElement(ProxyEditor),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Модификаторы',
|
label: 'Модификаторы',
|
||||||
content: createElement(Mods, props),
|
content: createElement(
|
||||||
|
ModList,
|
||||||
|
Object.assign({}, props, {category: 'general'})
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Уведомления',
|
label: 'Уведомления',
|
||||||
content: createElement(Notifications, props),
|
content: createElement(Notifications, props),
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}),
|
}),
|
||||||
|
// FOOTER.
|
||||||
createElement(Footer, Object.assign({ status: this.state.status }, props)),
|
createElement(Footer, Object.assign({ status: this.state.status }, props)),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -169,4 +184,4 @@ export default function getApp(theState) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};;
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Inferno from 'inferno';
|
import Inferno from 'inferno';
|
||||||
import css from 'csjs-inject';
|
import css from 'csjs-inject';
|
||||||
|
|
||||||
export default function getInfoRow() {
|
export default function getInfoLi() {
|
||||||
|
|
||||||
const scopedCss = css`
|
const scopedCss = css`
|
||||||
/* CONTROL RAW = BUTTON + LINK */
|
/* CONTROL RAW = BUTTON + LINK */
|
||||||
|
@ -23,6 +23,7 @@ export default function getInfoRow() {
|
||||||
|
|
||||||
.infoRow {
|
.infoRow {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
.rightBottomIcon {
|
.rightBottomIcon {
|
||||||
margin-left: 0.1em;
|
margin-left: 0.1em;
|
||||||
|
@ -80,6 +81,16 @@ export default function getInfoRow() {
|
||||||
left: 75%;
|
left: 75%;
|
||||||
width: calc(25% + 0.6em);
|
width: calc(25% + 0.6em);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* CHILDREN */
|
||||||
|
|
||||||
|
input:not(:checked) ~ .children {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.children {
|
||||||
|
flex-grow: 9999;
|
||||||
|
}
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const camelToDash = (name) => name.replace(/([A-Z])/g, (_, p1) => '-' + p1.toLowerCase());
|
const camelToDash = (name) => name.replace(/([A-Z])/g, (_, p1) => '-' + p1.toLowerCase());
|
||||||
|
@ -95,12 +106,11 @@ export default function getInfoRow() {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return function InfoRow(props) {
|
return function InfoLi(props) {
|
||||||
|
|
||||||
props = Object.assign({}, {
|
props = Object.assign({}, {
|
||||||
idPrefix: '',
|
idPrefix: '',
|
||||||
ifDashify: false,
|
ifDashify: false,
|
||||||
htmlAfterLabel: '',
|
|
||||||
}, props);
|
}, props);
|
||||||
|
|
||||||
const iddy = props.idPrefix + ( props.ifDashify ? camelToDash(props.conf.key) : props.conf.key );
|
const iddy = props.idPrefix + ( props.ifDashify ? camelToDash(props.conf.key) : props.conf.key );
|
||||||
|
@ -116,7 +126,7 @@ export default function getInfoRow() {
|
||||||
/>
|
/>
|
||||||
<div class={scopedCss.labelContainer}>
|
<div class={scopedCss.labelContainer}>
|
||||||
<label for={iddy} dangerouslySetInnerHTML={{__html: props.conf.label}}></label>
|
<label for={iddy} dangerouslySetInnerHTML={{__html: props.conf.label}}></label>
|
||||||
{props.children}
|
{props.nodeAfterLabel}
|
||||||
</div>
|
</div>
|
||||||
{props.conf.desc
|
{props.conf.desc
|
||||||
? (
|
? (
|
||||||
|
@ -129,6 +139,7 @@ export default function getInfoRow() {
|
||||||
: (<span> </span>) // Affects vertical align of flexbox items.
|
: (<span> </span>) // Affects vertical align of flexbox items.
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
{props.children && (<div class={scopedCss.children}>{props.children}</div>)}
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,22 @@
|
||||||
import Inferno from 'inferno';
|
import Inferno from 'inferno';
|
||||||
import Component from 'inferno-component';
|
import Component from 'inferno-component';
|
||||||
import createElement from 'inferno-create-element';
|
import createElement from 'inferno-create-element';
|
||||||
import css from 'csjs-inject';
|
|
||||||
|
|
||||||
import getInfoLi from './InfoLi';
|
import getInfoLi from './InfoLi';
|
||||||
import getApplyMods from './ApplyMods';
|
import getApplyMods from './ApplyMods';
|
||||||
|
|
||||||
export default function getMods(theState) {
|
export default function getModList(theState) {
|
||||||
|
|
||||||
const InfoLi = getInfoLi(theState);
|
const InfoLi = getInfoLi(theState);
|
||||||
const ApplyMods = getApplyMods(theState);
|
const ApplyMods = getApplyMods(theState);
|
||||||
|
|
||||||
return class Mods extends Component {
|
return class ModList extends Component {
|
||||||
|
|
||||||
getOrderedConfigs() {
|
|
||||||
|
|
||||||
return this.props.apis.pacKitchen.getOrderedConfigs('general');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
orderedConfigs: this.getOrderedConfigs(),
|
orderedConfigs: props.apis.pacKitchen.getOrderedConfigs(props.category),
|
||||||
ifChangesStashed: false,
|
ifChangesStashed: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,7 +35,7 @@ export default function getMods(theState) {
|
||||||
newConfigs[index].value = !newConfigs[index].value;
|
newConfigs[index].value = !newConfigs[index].value;
|
||||||
this.setState({orderedConfigs: newConfigs});
|
this.setState({orderedConfigs: newConfigs});
|
||||||
|
|
||||||
}}/>
|
}}>{props.modToChildren && props.modToChildren[conf.key]}</InfoLi>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
|
@ -124,18 +124,9 @@ export default function getPacChooser(theState) {
|
||||||
name="pacProvider"
|
name="pacProvider"
|
||||||
checked={iddyToCheck === provConf.key}
|
checked={iddyToCheck === provConf.key}
|
||||||
disabled={props.ifInputsDisabled}
|
disabled={props.ifInputsDisabled}
|
||||||
>
|
nodeAfterLabel={<a href="" class={scopedCss.updateButton} onClick={(evt) => { evt.preventDefault(); updatePac(); }}>[обновить]</a>}
|
||||||
<a href="" class={scopedCss.updateButton} onClick={(evt) => { evt.preventDefault(); updatePac(); }}>[обновить]</a>
|
/>)
|
||||||
</InfoLi>)
|
|
||||||
)
|
)
|
||||||
/*<InfoLi
|
|
||||||
onClick={this.radioClickHandler.bind(this)}
|
|
||||||
type="radio"
|
|
||||||
name="pacProvider"
|
|
||||||
conf={{key: 'none', label: 'Отключить'}}
|
|
||||||
checked={iddyToCheck === 'none'}
|
|
||||||
disabled={props.ifInputsDisabled}
|
|
||||||
/>*/
|
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
<div id="updateMessage" class="horFlex" style="align-items: center">
|
<div id="updateMessage" class="horFlex" style="align-items: center">
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
import Inferno from 'inferno';
|
||||||
|
import css from 'csjs-inject';
|
||||||
|
|
||||||
|
export default function getProxyEditor(theState) {
|
||||||
|
|
||||||
|
const scopedCss = css`
|
||||||
|
|
||||||
|
.texty {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 38.5em; /* ~418px, layout breaks if more */
|
||||||
|
height: 7em;
|
||||||
|
margin-top: 0.3em;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
||||||
|
const uiRaw = 'ui-proxy-string-raw';
|
||||||
|
|
||||||
|
return function ProxyEditor(props) {
|
||||||
|
|
||||||
|
return (<textarea class={scopedCss.texty}
|
||||||
|
spellcheck={false}
|
||||||
|
placeholder={
|
||||||
|
`SOCKS5 localhost:9050; # Tor Expert
|
||||||
|
SOCKS5 localhost:9150; # Tor Browser
|
||||||
|
HTTPS 11.22.33.44:3143;
|
||||||
|
PROXY foobar.com:8080; # Not HTTP!`.trim()}
|
||||||
|
value={props.value || localStorage.getItem(uiRaw) || ''}
|
||||||
|
/>);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
|
@ -2,7 +2,7 @@ import Inferno, { linkEvent } from 'inferno';
|
||||||
import Component from 'inferno-component';
|
import Component from 'inferno-component';
|
||||||
import css from 'csjs-inject';
|
import css from 'csjs-inject';
|
||||||
|
|
||||||
export default function getTabsPannel({ flags }) {
|
export default function getTabPannel({ flags }) {
|
||||||
|
|
||||||
const scopedCss = css`
|
const scopedCss = css`
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ export default function getTabsPannel({ flags }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<nav class={scopedCss.navLabels + ' hiddenForOptionsPage'}>
|
<nav class={scopedCss.navLabels}>
|
||||||
<ul class='horizontalList'>
|
<ul class='horizontalList'>
|
||||||
{
|
{
|
||||||
props.tabs.map((tab, index) =>
|
props.tabs.map((tab, index) =>
|
||||||
|
|
|
@ -15,7 +15,7 @@ chrome.runtime.getBackgroundPage( (bgWindow) =>
|
||||||
|
|
||||||
theState = {
|
theState = {
|
||||||
utils: bgWindow.utils,
|
utils: bgWindow.utils,
|
||||||
apis: bgWindow.apis,
|
apis: apis,
|
||||||
flags: {
|
flags: {
|
||||||
/* Shortcuts to boolean values. */
|
/* Shortcuts to boolean values. */
|
||||||
ifNotControlled: !apis.errorHandlers.ifControllable,
|
ifNotControlled: !apis.errorHandlers.ifControllable,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user