diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/App.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/App.js
index 8c4463d..84ba3ae 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/App.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/App.js
@@ -8,6 +8,7 @@ import getTabPanel from './TabPanel';
import getPacChooser from './PacChooser';
import getNotifications from './Notifications';
import getExceptions from './Exceptions';
+import getMods from './Mods';
import getFooter from './Footer';
@@ -19,6 +20,7 @@ export default function getApp(theState) {
const PacChooser = getPacChooser(theState);
const Notifications = getNotifications(theState);
const Exceptions = getExceptions(theState);
+ const Mods = getMods(theState);
const Footer = getFooter(theState);
@@ -152,7 +154,7 @@ export default function getApp(theState) {
},
{
label: 'Модификаторы',
- content: "Modificators().render(this.props)",
+ content: createElement(Mods, props),
},
{
label: 'Уведомления',
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ApplyMods.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ApplyMods.js
new file mode 100644
index 0000000..27189f2
--- /dev/null
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ApplyMods.js
@@ -0,0 +1,36 @@
+import Inferno, { linkEvent } from 'inferno';
+
+export default function getApplyMods(theState) {
+
+ const resetMods = function resetMods(props) {
+
+ const ifSure = props.bgWindow.confirm('Сбросиь все модификаторы и ИСКЛЮЧЕНИЯ?');
+ if (!ifSure) {
+ return false;
+ }
+ props.funs.conduct(
+ 'Сбрасываем...',
+ (cb) => {
+
+ props.apis.pacKitchen.resetToDefaults();
+ props.bgWindow.utils.fireRequest('ip-to-host-reset-to-defaults', cb);
+
+ },
+ 'Откройте окно заново для отображения эффекта.',
+ () => window.close()
+ );
+
+ }
+
+ return function ApplyMods(props) {
+
+ return (
+
+ );
+
+ };
+
+};
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ExcEditor.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ExcEditor.js
index e73733e..47228c2 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ExcEditor.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/ExcEditor.js
@@ -243,7 +243,6 @@ export default function getExcEditor(theState) {
if (ifBackspacedOneChar) {
removeEditedHost();
}
- //
}
return true;
}
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/InfoLi.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/InfoLi.js
index d959876..ab59796 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/InfoLi.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/InfoLi.js
@@ -115,7 +115,7 @@ export default function getInfoRow() {
disabled={props.disabled}
/>
-
+
{props.children}
{props.conf.desc
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/Mods.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/Mods.js
new file mode 100644
index 0000000..cd8a15b
--- /dev/null
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/components/Mods.js
@@ -0,0 +1,79 @@
+import Inferno from 'inferno';
+import Component from 'inferno-component';
+import createElement from 'inferno-create-element';
+import css from 'csjs-inject';
+
+import getInfoLi from './InfoLi';
+import getApplyMods from './ApplyMods';
+
+export default function getMods(theState) {
+
+ const InfoLi = getInfoLi(theState);
+ const ApplyMods = getApplyMods(theState);
+
+ return class Mods extends Component {
+
+ getOrderedConfigs() {
+
+ return this.props.apis.pacKitchen.getOrderedConfigs('general');
+
+ }
+
+ constructor(props) {
+
+ super(props);
+ this.state = {
+ orderedConfigs: this.getOrderedConfigs(),
+ ifChangesStashed: false,
+ };
+
+ }
+
+ render(props) {
+
+ return (
+
+ { this.setState({ifChangesStashed: true}); }}>
+ {
+ this.state.orderedConfigs.map((conf, index) =>
+ {
+
+ const newConfigs = this.state.orderedConfigs.map((c) => Object.assign({}, c)); // Shallow.
+ newConfigs[index].value = !newConfigs[index].value;
+ this.setState({orderedConfigs: newConfigs});
+
+ }}/>
+ )
+ }
+
+ {createElement(ApplyMods, Object.assign({}, props,
+ {
+ disabled: !this.state.ifChangesStashed,
+ onClick: () => {
+
+ const oldMods = this.props.apis.pacKitchen.getPacMods();
+ const newMods = this.state.orderedConfigs.reduce((acc, conf) => {
+
+ acc[conf.key] = conf.value;
+ return acc;
+
+ }, oldMods);
+
+ this.props.funs.conduct(
+ 'Применяем настройки...',
+ (cb) => this.props.apis.pacKitchen.keepCookedNowAsync(newMods, cb),
+ 'Настройки применены.',
+ () => this.setState({ifChangesStashed: false})
+ );
+
+ }
+ }
+ ))}
+
+ );
+
+ }
+
+ };
+
+};
diff --git a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/index.js b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/index.js
index 444b9b4..3e439d0 100644
--- a/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/index.js
+++ b/extensions/chromium/runet-censorship-bypass/src/extension-common/pages/options/src/index.js
@@ -5,22 +5,23 @@ import createElement from 'inferno-create-element';
import appendGlobalCss from './globalCss';
import getApp from './components/App';
-chrome.runtime.getBackgroundPage( (backgroundPage) =>
- backgroundPage.apis.errorHandlers.installListenersOn(
+chrome.runtime.getBackgroundPage( (bgWindow) =>
+ bgWindow.apis.errorHandlers.installListenersOn(
window, 'PUP', async() => {
let theState;
{
- const apis = backgroundPage.apis;
+ const apis = bgWindow.apis;
theState = {
- utils: backgroundPage.utils,
- apis: backgroundPage.apis,
+ utils: bgWindow.utils,
+ apis: bgWindow.apis,
flags: {
/* Shortcuts to boolean values. */
ifNotControlled: !apis.errorHandlers.ifControllable,
ifMini: apis.version.ifMini,
},
+ bgWindow,
};
}