Merge branch 'refactor-popup' into development

This commit is contained in:
Ilya Ig. Petrov 2017-05-27 04:59:40 -07:00
commit de4619a4ba
31 changed files with 5133 additions and 889 deletions

View File

@ -2,5 +2,5 @@ node_modules
node_modules_linux
node_modules_win
npm-debug.log
.swp
*.swp
build/

View File

@ -4,6 +4,7 @@ const gulp = require('gulp');
const del = require('del');
const through = require('through2');
const PluginError = require('gulp-util').PluginError;
const changed = require('gulp-changed');
const PluginName = 'Template literals';
@ -44,9 +45,10 @@ const templatePlugin = (context) => through.obj(function(file, encoding, cb) {
gulp.task('default', ['build']);
gulp.task('clean', function() {
gulp.task('clean', function(cb) {
return del.sync('./build');
//return del.sync('./build');
return cb();
});
@ -56,31 +58,48 @@ const excFolder = (name) => [`!./src/**/${name}`, `!./src/**/${name}/**/*`];
const excluded = [ ...excFolder('test') , ...excFolder('node_modules'), ...excFolder('src') ];
const commonWoTests = ['./src/extension-common/**/*', ...excluded];
gulp.task('_cp-common', ['clean'], function() {
const miniDst = './build/extension-mini';
const fullDst = './build/extension-full';
gulp.task('_cp-common', ['clean'], function(cb) {
let fins = 0;
const intheend = () => {
if (++fins === 2) {
cb();
}
};
gulp.src(commonWoTests)
.pipe(changed(miniDst))
.pipe(templatePlugin(contexts.mini))
.pipe(gulp.dest('./build/extension-mini'))
.pipe(gulp.dest(miniDst))
.on('end', intheend);
gulp.src(commonWoTests)
.pipe(changed(fullDst))
.pipe(templatePlugin(contexts.full))
.pipe(gulp.dest('./build/extension-full'));
.pipe(gulp.dest(fullDst))
.on('end', intheend);
});
gulp.task('_cp-mini', ['_cp-common'], function() {
gulp.task('_cp-mini', ['_cp-common'], function(cb) {
gulp.src(['./src/extension-mini/**/*', ...excluded])
.pipe(changed(miniDst))
.pipe(templatePlugin(contexts.mini))
.pipe(gulp.dest('./build/extension-mini'));
.pipe(gulp.dest(miniDst))
.on('end', cb);
});
gulp.task('_cp-full', ['_cp-common'], function() {
gulp.task('_cp-full', ['_cp-common'], function(cb) {
gulp.src(['./src/extension-full/**/*', ...excluded])
.pipe(changed(fullDst))
.pipe(templatePlugin(contexts.full))
.pipe(gulp.dest('./build/extension-full'));
.pipe(gulp.dest(fullDst))
.on('end', cb);
});

View File

@ -14,6 +14,7 @@
"chai": "^3.5.0",
"eslint": "^3.15.0",
"eslint-config-google": "^0.7.1",
"gulp-changed": "^3.1.0",
"mocha": "^3.3.0",
"sinon-chrome": "^2.2.1"
},

View File

@ -12,8 +12,7 @@
const ifIncontinence = 'if-incontinence';
const modsKey = 'mods';
// Don't keep objects in defaults or at least freeze them!
const configs = {
const getDefaultConfigs = () => ({// Configs user may mutate them and we don't care!
ifProxyHttpsUrlsOnly: {
dflt: false,
@ -75,9 +74,9 @@
ifProxyMoreDomains: {
ifDisabled: true,
dflt: false,
category: 'ownProxies',
category: 'exceptions',
label: 'проксировать .onion, .i2p и OpenNIC',
desc: 'Проксировать особые домены. Необходима поддержка со стороны прокси.',
desc: 'Проксировать особые домены. Необходима поддержка со стороны СВОИХ прокси.',
order: 8,
},
ifProxyErrors: {
@ -89,10 +88,11 @@
order: 9,
},
};
});
const getDefaults = function getDefaults() {
const configs = getDefaultConfigs();
return Object.keys(configs).reduce((acc, key) => {
acc[key] = configs[key].dflt;
@ -105,13 +105,14 @@
const getCurrentConfigs = function getCurrentConfigs() {
const oldMods = kitchenState(modsKey);
if (oldMods) {
/*if (oldMods) {
// No migration!
return oldMods;
}
}*/
// In case of first install.
const [err, mods, ...warns] = createPacModifiers();
// Client may expect mods.included and mods.excluded!
// On first install they are not defined.
const [err, mods, ...warns] = createPacModifiers(oldMods);
if (err) {
throw err;
}
@ -122,6 +123,7 @@
const getOrderedConfigsForUser = function getOrderedConfigs(category) {
const pacMods = getCurrentConfigs();
const configs = getDefaultConfigs();
return Object.keys(configs)
.sort((keyA, keyB) => configs[keyA].order - configs[keyB].order)
.reduce((arr, key) => {
@ -143,6 +145,7 @@
const createPacModifiers = function createPacModifiers(mods = {}) {
mods = mods || {}; // null?
const configs = getDefaultConfigs();
const ifNoMods = Object.keys(configs)
.every((dProp) => {
@ -171,7 +174,8 @@
}
}
if (self.ifUseLocalTor) {
customProxyArray.push('SOCKS5 localhost:9050', 'SOCKS5 localhost:9150');
self.torPoints = ['SOCKS5 localhost:9150', 'SOCKS5 localhost:9050'];
customProxyArray.push(...self.torPoints);
}
self.filteredCustomsString = '';
@ -185,7 +189,18 @@
self.customProxyArray = false;
}
self.included = self.excluded = undefined;
[self.included, self.excluded] = [[], []];
if (self.ifProxyMoreDomains) {
self.moreDomains = [
/* Networks */
'onion', 'i2p',
/* OpenNIC */
'bbs', 'chan', 'dyn', 'free', 'geek', 'gopher', 'indy',
'libre', 'neo', 'null', 'o', 'oss', 'oz', 'parody', 'pirate',
/* OpenNIC Alternatives */
'bazar', 'bit', 'coin', 'emc', 'fur', 'ku', 'lib', 'te', 'ti', 'uu'
];
}
if (self.ifMindExceptions && self.exceptions) {
self.included = [];
self.excluded = [];
@ -222,72 +237,106 @@
cook(pacData, pacMods = mandatory()) {
return pacMods.ifNoMods ? pacData : pacData + `${ kitchenStartsMark }
;+function(global) {
"use strict";
const originalFindProxyForURL = FindProxyForURL;
global.FindProxyForURL = function(url, host) {
${function() {
/******/
/******/;+function(global) {
/******/ "use strict";
/******/
/******/ const originalFindProxyForURL = FindProxyForURL;
/******/ global.FindProxyForURL = function(url, host) {
/******/
${
function() {
let res = pacMods.ifProhibitDns ? `
global.dnsResolve = function(host) { return null; };
` : '';
/******/
/******/ global.dnsResolve = function(host) { return null; };
/******/
/******/` : '';
if (pacMods.ifProxyHttpsUrlsOnly) {
res += `
if (!url.startsWith("https")) {
return "DIRECT";
/******/
/******/ if (!url.startsWith("https")) {
/******/ return "DIRECT";
/******/ }
/******/
/******/ `;
}
`;
if (pacMods.ifUseLocalTor) {
res += `
/******/
/******/ if (host.endsWith(".onion")) {
/******/ return "${pacMods.torPoints.join('; ')}";
/******/ }
/******/
/******/ `;
}
res += `
const directIfAllowed = ${pacMods.ifProxyOrDie ? '""/* Not allowed. */' : '"; DIRECT"'};`;
/******/
/******/ const directIfAllowed = ${pacMods.ifProxyOrDie ? '""/* Not allowed. */' : '"; DIRECT"'};
/******/`;
if (pacMods.filteredCustomsString) {
res += `
const filteredCustomProxies = "; ${pacMods.filteredCustomsString}";`;
/******/
/******/ const filteredCustomProxies = "; ${pacMods.filteredCustomsString}";
/******/`;
}
const ifIncluded = pacMods.included && pacMods.included.length;
const ifExcluded = pacMods.excluded && pacMods.excluded.length;
const ifExceptions = ifIncluded || ifExcluded;
const ifManualExceptions = ifIncluded || ifExcluded;
const finalExceptions = {};
if (pacMods.ifProxyMoreDomains) {
pacMods.moreDomains.reduce((acc, tld) => {
acc[tld] = true;
return acc;
}, finalExceptions);
}
if (pacMods.ifMindExceptions || ifManualExceptions) {
Object.assign(finalExceptions, (pacMods.exceptions || {}));
}
const ifExceptions = Object.keys(finalExceptions).length;
if (ifExceptions) {
res += `
/* EXCEPTIONS START */
const dotHost = '.' + host;
const isHostInDomain = (domain) => dotHost.endsWith('.' + domain);
const domainReducer = (maxWeight, [domain, ifIncluded]) => {
if (!isHostInDomain(domain)) {
return maxWeight;
}
const newWeightAbs = domain.length;
if (newWeightAbs < Math.abs(maxWeight)) {
return maxWeight;
}
return newWeightAbs*(ifIncluded ? 1 : -1);
};
const excWeight = ${JSON.stringify(Object.entries(pacMods.exceptions))}.reduce( domainReducer, 0 );
if (excWeight !== 0) {
if (excWeight < 0) {
// Never proxy it!
return "DIRECT";
}
// Always proxy it!
/******/
/******/ /* EXCEPTIONS START */
/******/ const dotHost = '.' + host;
/******/ const isHostInDomain = (domain) => dotHost.endsWith('.' + domain);
/******/ const domainReducer = (maxWeight, [domain, ifIncluded]) => {
/******/
/******/ if (!isHostInDomain(domain)) {
/******/ return maxWeight;
/******/ }
/******/ const newWeightAbs = domain.length;
/******/ if (newWeightAbs < Math.abs(maxWeight)) {
/******/ return maxWeight;
/******/ }
/******/ return newWeightAbs*(ifIncluded ? 1 : -1);
/******/
/******/ };
/******/
/******/ const excWeight = ${ JSON.stringify(Object.entries(finalExceptions)) }.reduce( domainReducer, 0 );
/******/ if (excWeight !== 0) {
/******/ if (excWeight < 0) {
/******/ // Never proxy it!
/******/ return "DIRECT";
/******/ }
/******/ // Always proxy it!
${ pacMods.filteredCustomsString
? `return filteredCustomProxies + directIfAllowed;`
: '/* No custom proxies -- continue. */'
? `/******/ return filteredCustomProxies + directIfAllowed;`
: '/******/ /* No custom proxies -- continue. */'
}
}
/* EXCEPTIONS END */
/******/ }
/******/ /* EXCEPTIONS END */
`;
}
res += `
const pacScriptProxies = originalFindProxyForURL(url, host)${
pacMods.ifProxyOrDie ? '.replace(/DIRECT/g, "")' : ' + directIfAllowed'
/******/ const pacScriptProxies = originalFindProxyForURL(url, host)${
/******/ pacMods.ifProxyOrDie ? '.replace(/DIRECT/g, "")' : ' + directIfAllowed'
};`;
if(
!pacMods.ifUseSecureProxiesOnly &&
@ -295,17 +344,17 @@
pacMods.ifUsePacScriptProxies
) {
return res + `
return pacScriptProxies + directIfAllowed;`;
/******/ return pacScriptProxies + directIfAllowed;`;
}
return res + `
let pacProxyArray = pacScriptProxies.split(/(?:\\s*;\\s*)+/g).filter( (p) => p );
const ifNoProxies = pacProxyArray${pacMods.ifProxyOrDie ? '.length === 0' : '.every( (p) => /^DIRECT$/i.test(p) )'};
if (ifNoProxies) {
// Directs only or null, no proxies.
return "DIRECT";
}
return ` +
/******/ let pacProxyArray = pacScriptProxies.split(/(?:\\s*;\\s*)+/g).filter( (p) => p );
/******/ const ifNoProxies = pacProxyArray${pacMods.ifProxyOrDie ? '.length === 0' : '.every( (p) => /^DIRECT$/i.test(p) )'};
/******/ if (ifNoProxies) {
/******/ // Directs only or null, no proxies.
/******/ return "DIRECT";
/******/ }
/******/ return ` +
function() {
if (!pacMods.ifUsePacScriptProxies) {
@ -320,7 +369,8 @@
}() + `${pacMods.filteredCustomsString ? 'filteredCustomProxies + ' : ''}directIfAllowed;`; // Without DIRECT you will get 'PROXY CONN FAILED' pac-error.
}()}
}()
}
};

View File

@ -177,7 +177,7 @@
pacUrls: ['https://antizapret.prostovpn.org/proxy.pac'],
},
Антицензорити: {
label: 'Антицензорити (<a href="https://github.com/anticensorship-russia/chromium-extension/issues/6" style="color: red">тормозит</a>)',
label: 'Антицензорити',
desc: 'Основной PAC-скрипт от автора расширения.' +
' Блокировка определятся по доменному имени или IP адресу.' +
' Работает на switch-ах. <br/>' +

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -1,4 +1,4 @@
node_modules
npm-debug.log
.swp
*.swp
dist

View File

@ -3,594 +3,22 @@
<head>
<meta charset="utf-8">
<title>Настройки</title>
<style>
:root {
--ribbon-color: #4169e1;
--blue-bg: dodgerblue;
--default-grey: #bfbfbf;
--cr-options-headline: #d3d3d3;
--cr-icon-selected: #d7d7d7;
--cr-popup-border: #bababa;
--cr-grey-panel: #f2f2f2;
max-width: 28em;
}
body {
margin: 0;
}
a, a:visited {
color: var(--ribbon-color);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
label {
user-select: none;
}
div, section, header, ul, ol {
margin: 0;
padding: 0;
}
header {
margin-bottom: 0.3em
}
ul, ol {
list-style-type: none;
}
:root:not(.if-options-page) ul,
:root:not(.if-options-page) ol {
/*Here is a flex bug:
() antizapret [update] (i)
() anticensority very_long_foobar [update] (i) <- Sic!
Also: options page is wider, check it too.
But: fixed 100% width conflicts with margins/paddings.
So: use only when needed and avoid margins.
FYI: setting left-margin fixes problem too, but margins are not wanted.
Fix this problem below:
*/
display: inline-block;
min-width: 100%;
}
:root.if-options-page ul,
:root.if-options-page ol,
#list-of-notifiers {
margin-left: 0.4em;
}
li, .nowrap {
display: block;
white-space: nowrap;
word-break: keep-all;
}
li, li > * {
vertical-align: middle;
}
input[type="radio"], input[type="checkbox"] {
flex-shrink: 0;
}
input[type="radio"], label {
cursor: pointer;
}
hr {
border: none;
border-top: 1px solid var(--cr-popup-border);
margin: 0 0 0.6em 0;
padding: 0;
}
em {
font-style: normal;
text-decoration: underline;
}
/* COMMON 1 */
.hor-padded {
padding-left: 1.4em;
padding-right: 1.4em;
}
.horizontal-list,
.horizontal-list li {
line-height: 100%;
}
.horizontal-list li {
display: inline-block;
}
/* NOT CONTROLLED */
.if-not-controlled {
display: none;
background-color: red;
color: white;
font-weight: bold;
text-align: center;
padding-top: 1em;
padding-bottom: 1em;
border-bottom: 1px solid var(--default-grey);
}
:root.if-options-page .if-not-controlled {
padding-top: 0;
padding-bottom: 0;
}
.if-not-controlled a {
color: white;
}
/* MINI VS FULL */
:root:not(.if-version-mini) .only-for-mini-version {
display: none;
}
:root.if-version-mini .only-for-full-version {
display: none;
}
/* OPTIONS PAGE */
:root:not(.if-options-page) .only-for-options-page {
display: none;
}
:root.if-options-page .hidden-for-options-page {
display: none;
}
/* ACCORDION (OR TABBED STATEFUL UI) */
.off {
display: none;
}
section[data-for] {
padding: 0.6em 0 1em;
}
section[data-for] li label {
display: inline-block; /* Needed for ::first-letter below. */
}
section[data-for] li label::first-letter {
text-transform: uppercase;
}
:root.if-options-page section[data-for] {
padding-bottom: 0.6em;
}
:root.if-options-page section[data-for]:not(:last-child),
.underlined {
border-bottom: 1px solid var(--cr-options-headline);
}
/* HIDE starts. */
:root:not(.if-options-page) #acc-pac:not(:checked) ~ .main-nav section[data-for="acc-pac"],
:root:not(.if-options-page) #acc-exc:not(:checked) ~ .main-nav section[data-for="acc-exc"],
:root:not(.if-options-page) #acc-own-mods:not(:checked) ~ .main-nav section[data-for="acc-own-mods"],
:root:not(.if-options-page) #acc-mods:not(:checked) ~ .main-nav section[data-for="acc-mods"],
:root:not(.if-options-page) #acc-ntf:not(:checked) ~ .main-nav section[data-for="acc-ntf"],
/* One button shared between two sections: */
:root:not(.if-options-page) #acc-own-mods:not(:checked) + #acc-mods:not(:checked) ~ .main-nav #apply-mods-section
{
/* Hide, but preclude width resizes. */
height: 0px !important;
line-height: 0px !important;
padding-top: 0 !important;
padding-bottom: 0 !important;
margin-top: 0 !important;
margin-bottom: 0 !important;
border: none !important;
display: block;
visibility: hidden;
transform: scaleY(0) !important;
}
:root:not(.if-options-page) #acc-pac:not(:checked) ~ .main-nav section[data-for="acc-pac"] *,
:root:not(.if-options-page) #acc-exc:not(:checked) ~ .main-nav section[data-for="acc-exc"] *,
:root:not(.if-options-page) #acc-own-mods:not(:checked) ~ .main-nav section[data-for="acc-own-mods"] *,
:root:not(.if-options-page) #acc-mods:not(:checked) ~ .main-nav section[data-for="acc-mods"] *,
:root:not(.if-options-page) #acc-ntf:not(:checked) ~ .main-nav section[data-for="acc-ntf"] *,
/* One button shared between two sections: */
:root:not(.if-options-page) #acc-own-mods:not(:checked) + #acc-mods:not(:checked) ~ .main-nav #apply-mods-section *
{
margin-top: 0 !important;
margin-bottom: 0 !important;
}
/* HIDE ends. */
.nav-labels {
background-color: var(--cr-grey-panel);
text-align: center;
}
.nav-labels li label {
display: inline-block;
border: 1px solid var(--ribbon-color);
border-radius: 0.2em;
background-color: white;
color: var(--ribbon-color);
padding: 0.2em 0.3em 0.3em 0.2em;
line-height: 0.8em;
margin: 0.1em 0;
}
.nav-labels li label:hover {
background-color: var(--blue-bg);
color: white;
/*
border-color: white;
border-style: dotted;*/
}
/* LABELS starts. */
#acc-pac:checked ~ .nav-labels label[for="acc-pac"]:not(:hover),
#acc-exc:checked ~ .nav-labels label[for="acc-exc"]:not(:hover),
#acc-own-mods:checked ~ .nav-labels label[for="acc-own-mods"]:not(:hover),
#acc-mods:checked ~ .nav-labels label[for="acc-mods"]:not(:hover),
#acc-ntf:checked ~ .nav-labels label[for="acc-ntf"]:not(:hover)
{
background-color: var(--blue-bg);
color: white;
}
/* ★★★★★ */
.nav-labels label:before {
content: '★';
padding-right: 0.1em;
visibility: hidden;
}
.nav-labels li label:hover:before,
#acc-pac:checked ~ .nav-labels label[for="acc-pac"]:before,
#acc-exc:checked ~ .nav-labels label[for="acc-exc"]:before,
#acc-own-mods:checked ~ .nav-labels label[for="acc-own-mods"]:before,
#acc-mods:checked ~ .nav-labels label[for="acc-mods"]:before,
#acc-ntf:checked ~ .nav-labels label[for="acc-ntf"]:before
{
visibility: initial;
}
/* LABELS ends. */
/* COMMON 2 */
/* INFO SIGNS */
input:disabled + .label-container label {
color: var(--default-grey);
pointer-events: none;
}
.info-row {
position: relative;
}
.right-bottom-icon {
margin-left: 0.1em;
vertical-align: bottom;
}
.info-url, .info-url:hover {
text-decoration: none;
}
/* Source: https://jsfiddle.net/greypants/zgCb7/ */
.desc {
text-align: right;
color: var(--ribbon-color);
cursor: help;
padding-left: 0.3em;
}
.tooltip {
display: none;
position: absolute;
white-space: initial;
word-break: initial;
top: 100%;
left: 0;
right: 1em;
z-index: 1;
background-color: var(--ribbon-color);
padding: 1em;
color: white;
text-align: initial;
}
.desc:hover .tooltip {
display: block;
}
.tooltip a,
.tooltip em {
color: white;
}
.desc .tooltip:after {
border-left: solid transparent 0.5em;
border-bottom: solid var(--ribbon-color) 0.5em;
position: absolute;
top: -0.5em;
content: "";
width: 0;
right: 0;
height: 0;
}
/* This bridges the gap so you can mouse into the tooltip without it disappearing. */
.desc .tooltip:before {
position: absolute;
top: -1em;
content: "";
display: block;
height: 1.2em;
left: 75%;
width: calc(25% + 0.6em);
}
/* TAB_1: PAC PROVIDER */
.update-button {
visibility: hidden;
}
input:checked ~ .label-container .update-button {
visibility: inherit;
}
label[for="onlyOwnSites"] + .update-button {
display: none;
}
#none:checked ~ .label-container label {
color: red;
}
#update-message {
white-space: nowrap;
margin-top: 0.5em;
}
/* TAB_2: PAC MODS */
#mods-custom-proxy-string-raw ~ textarea {
width: 100%;
max-width: 38.5em; /* ~418px, layout breaks if more */
height: 7em;
margin-top: 0.3em;
font-size: 0.9em;
}
#mods-custom-proxy-string-raw:not(:checked) ~ textarea {
display: none;
}
/* TAB_3: EXCEPTIONS */
/* EXC-EDITOR starts. */
#exc-address-container {
display: flex;
align-items: center;
width: 100%;
}
#exc-address-container > a {
border-bottom: 1px solid transparent;
margin-left: 0.2em;
}
#exc-address {
width: 100%;
display: flex;
align-items: baseline;
--exc-hieght: 1.6em;
font-size: 1em;
border-bottom: 1px solid var(--ribbon-color) !important;
}
input#exc-editor {
border: none;
width: 100%;
background: inherit;
/* The two below align '.' (dot) vertically. */
max-height: var(--exc-hieght) !important;
min-height: var(--exc-hieght) !important;
}
#exc-radio {
display: flex;
justify-content: space-around;
margin-top: 0.5em;
}
[name="if-proxy-this-site"]:checked + label {
font-weight: bold;
}
#exc-address.if-yes {
background-color: lightgreen;
}
#exc-address.if-no {
background-color: pink;
}
option.if-proxied {
color: var(--ribbon-color);
}
option:not(.if-proxied) {
color: red;
}
/* EXC-EDITOR ends. */
#exc-mods {
padding-top: 1em;
}
#exc-mods input#mods-if-mind-exceptions:not(:checked) + .label-container label {
color: red;
}
/* CONTROL RAW = BUTTON + LINK */
.hor-flex {
display: flex;
align-items: baseline;
justify-content: space-between;
width: 100%;
}
.control-row {
margin: 1em 0 1em 0;
}
.hor-flex input:not([type="button"]) {
align-self: flex-end;
}
.label-container {
flex-grow: 9;
padding-left: 0.3em;
}
/* STATUS */
#status-row {
padding: 0 0.3em 1em;
}
#status {
display: inline-block;
}
.other-version {
font-size: 1.7em;
color: var(--ribbon-color);
margin-left: 0.1em;
}
.other-version:hover {
text-decoration: none;
}
.full-line-height,
.full-line-height * {
line-height: 100%;
}
@font-face {
font-family: "emoji";
src:url("../lib/fonts/emoji.woff") format("woff");
font-weight: normal;
font-style: normal;
}
.emoji {
font-family: "emoji";
}
svg.icon {
display: inline-block;
width: 1em;
height: 1em;
stroke-width: 0;
stroke: currentColor;
fill: currentColor;
}
</style>
<style><!-- Don't delete this mount point! --></style>
</head>
<body>
<section class="if-not-controlled hor-padded" id="which-extension"></section>
<input type="radio" name="accordion" class="off" id="acc-pac" checked/>
<input type="radio" name="accordion" class="off" id="acc-exc"/>
<input type="radio" name="accordion" class="off" id="acc-own-mods"/>
<input type="radio" name="accordion" class="off" id="acc-mods"/>
<input type="radio" name="accordion" class="off" id="acc-ntf"/>
<nav class="nav-labels hidden-for-options-page">
<ul class='horizontal-list'>
<li><label for="acc-pac" class="nav-label">PAC-скрипт</label></li>
<li><label for="acc-exc" class="nav-label">Исключения</label></li>
<li><label for="acc-own-mods" class="nav-label">Свои прокси</label></li>
<li><label for="acc-mods" class="nav-label">Модификаторы</label></li>
<li><label for="acc-ntf" class="nav-label">Уведомления</label></li>
</ul>
<hr/>
</nav>
<nav class="hor-padded main-nav">
<section data-for="acc-pac">
<header class="only-for-options-page">PAC-скрипт:</header>
<ul id="list-of-providers">
<li class="info-row hor-flex"><input type="radio" name="pacProvider" id="none" checked> <div class="label-container"><label for="none">Отключить</label></div></li>
</ul>
<div id="update-message" class="hor-flex" style="align-items: center">
<div>Обновлялись: <span class="update-date">...</span></div>
<div class="full-line-height">
<a class="only-for-mini-version other-version emoji" href="https://rebrand.ly/ac-versions"
title="Полная версия">🏋</a>
<a class="only-for-full-version other-version emoji" href="https://rebrand.ly/ac-versions"
title="Версия для слабых машин">🐌</a>
</div>
</div>
</section>
<section class="only-for-options-page nowrap underlined">
Редактор исключений доступен толко для <a href="chrome://newtab">вкладок</a>.
</section>
<section data-for="acc-exc" class="hidden-for-options-page">
<section class="exc-editor-section" style="padding-bottom: 1em;">
<div>Проксировать указанный сайт?</div>
<div id="exc-address-container">
<div id="exc-address">
<span>*.</span><input placeholder="navalny.com" list="exc-list" name="browser" id="exc-editor" style=""/>
</div>
<!--a href class="emoji">⇄</a-->
<a href="../exceptions/index.html" title="импорт/экспорт"><svg
class="icon"
><use xlink:href="#icon-import-export"></use></svg>
</a>
</div>
<datalist id="exc-list"></datalist>
<ol class="horizontal-list" id="exc-radio">
<li><input id="this-auto" type="radio" checked name="if-proxy-this-site"/>
<label for="this-auto"><!--span class="emoji">🔄(looks fat)</span--><svg
class="icon"
style="position: relative; top: 0.15em;"><use xlink:href="#icon-loop-round"></use></svg>&nbsp;авто</label>
</li>
<li><input id="this-yes" type="radio" name="if-proxy-this-site"/> <label for="this-yes">&nbsp;да</label></li>
<li><input id="this-no" type="radio" name="if-proxy-this-site"/> <label for="this-no">&nbsp;нет</label></li>
</ol>
</section>
<ul id="exc-mods"></ul>
</section>
<section data-for="acc-own-mods">
<ul id="own-mods"></ul>
</section>
<section data-for="acc-mods">
<ul id="pac-mods"></ul>
</section>
<section id="apply-mods-section" class="control-row hor-flex" style="margin-top: 0.2em">
<input type="button" value="Применить" id="apply-mods" disabled/>
<a href id="reset-mods">К изначальным!</a>
</section>
<section data-for="acc-ntf">
<header>Я <span style="color: #f93a17"></span>едомления:</header>
<ul id="list-of-notifiers"></ul>
</section>
</nav>
<hr/>
<div class="hor-padded">
<section id="status-row">
<div id="status" style="will-change: contents">Загрузка...</div>
</section>
<footer class="control-row hor-flex nowrap">
<input type="button" value="Готово" class="close-button">
<a href="../troubleshoot/index.html">
Проблемы?
</a>
</footer>
</div>
<script src="./index.js"></script>
<script src="../lib/keep-links-clickable.js"></script>
<!-- ICONS -->
<div id="app-root"></div>
<svg style="display: none" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<symbol id="icon-info" viewBox="0 0 100 100">
<symbol id="iconInfo" viewBox="0 0 100 100">
<title>info</title>
<circle shape-rendering="geometricPrecision" fill="none" stroke="currentColor" stroke-width="7" cx="50" cy="50" r="45"/>
<path shape-rendering="crispEdges" d="M 55,40 V 80 H 45 V 40 z m 0,-20 V 35 H 45 V 20 Z"/>
</symbol>
<symbol id="icon-loop-round" viewBox="0 0 32 32">
<symbol id="iconLoopRound" viewBox="0 0 32 32">
<title>loop-round</title>
<path d="M27.802 5.197c-2.925-3.194-7.13-5.197-11.803-5.197-8.837 0-16 7.163-16 16h3c0-7.18 5.82-13 13-13 3.844 0 7.298 1.669 9.678 4.322l-4.678 4.678h11v-11l-4.198 4.197z"/>
<path d="M29 16c0 7.18-5.82 13-13 13-3.844 0-7.298-1.669-9.678-4.322l4.678-4.678h-11v11l4.197-4.197c2.925 3.194 7.13 5.197 11.803 5.197 8.837 0 16-7.163 16-16h-3z"/>
</symbol>
<symbol id="icon-import-export" viewBox="0 0 32 32">
<symbol id="iconImportExport" viewBox="0 0 32 32">
<title>import-export</title>
<g transform="rotate(0 16 16)">
<path d="M7 22 h 25 v 4 h -25 v 5 l -7-7 7-7 v5 z"/>
@ -604,5 +32,7 @@
<path d="M22 10 h-22 v-4 h 22 v -5 l 7 7 -7 7 z"></path-->
</symbol>
</svg>
<script src="./dist/bundle.min.js"></script>
<script src="../lib/keep-links-clickable.js"></script>
</body>
</html>

View File

@ -0,0 +1,24 @@
'use strict';
const loaderUtils = require('loader-utils');
const concat = require('concat-stream');
module.exports = function(content) {
const cb = this.async();
const Readable = require('stream').Readable;
const src = new Readable();
src._read = function noop() {};
src.push(content);
src.push(null);
const opts = loaderUtils.getOptions(this) || {};
const readme = Object.keys(opts).reduce((readable, moduleName) => {
const newStream = require(moduleName)(/* No filename. */);
return readable.pipe(newStream);
}, src);
readme.pipe(concat ((buf) => cb(null, buf.toString()) ));
};

View File

@ -0,0 +1,608 @@
<!DOCTYPE html>
<html style="display: none; will-change: contents, display">
<head>
<meta charset="utf-8">
<title>Настройки</title>
<style>
:root {
--ribbon-color: #4169e1;
--blue-bg: dodgerblue;
--default-grey: #bfbfbf;
--cr-options-headline: #d3d3d3;
--cr-icon-selected: #d7d7d7;
--cr-popup-border: #bababa;
--cr-grey-panel: #f2f2f2;
max-width: 28em;
}
body {
margin: 0;
}
a, a:visited {
color: var(--ribbon-color);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
label {
user-select: none;
}
div, section, header, ul, ol {
margin: 0;
padding: 0;
}
header {
margin-bottom: 0.3em
}
ul, ol {
list-style-type: none;
}
:root:not(.if-options-page) ul,
:root:not(.if-options-page) ol {
/*Here is a flex bug:
() antizapret [update] (i)
() anticensority very_long_foobar [update] (i) <- Sic!
Also: options page is wider, check it too.
But: fixed 100% width conflicts with margins/paddings.
So: use only when needed and avoid margins.
FYI: setting left-margin fixes problem too, but margins are not wanted.
Fix this problem below:
*/
display: inline-block;
min-width: 100%;
}
:root.if-options-page ul,
:root.if-options-page ol,
#list-of-notifiers {
margin-left: 0.4em;
}
li, .nowrap {
display: block;
white-space: nowrap;
word-break: keep-all;
}
li, li > * {
vertical-align: middle;
}
input[type="radio"], input[type="checkbox"] {
flex-shrink: 0;
}
input[type="radio"], label {
cursor: pointer;
}
hr {
border: none;
border-top: 1px solid var(--cr-popup-border);
margin: 0 0 0.6em 0;
padding: 0;
}
em {
font-style: normal;
text-decoration: underline;
}
/* COMMON 1 */
.hor-padded {
padding-left: 1.4em;
padding-right: 1.4em;
}
.horizontal-list,
.horizontal-list li {
line-height: 100%;
}
.horizontal-list li {
display: inline-block;
}
/* NOT CONTROLLED */
.if-not-controlled {
display: none;
background-color: red;
color: white;
font-weight: bold;
text-align: center;
padding-top: 1em;
padding-bottom: 1em;
border-bottom: 1px solid var(--default-grey);
}
:root.if-options-page .if-not-controlled {
padding-top: 0;
padding-bottom: 0;
}
.if-not-controlled a {
color: white;
}
/* MINI VS FULL */
:root:not(.if-version-mini) .only-for-mini-version {
display: none;
}
:root.if-version-mini .only-for-full-version {
display: none;
}
/* OPTIONS PAGE */
:root:not(.if-options-page) .only-for-options-page {
display: none;
}
:root.if-options-page .hidden-for-options-page {
display: none;
}
/* ACCORDION (OR TABBED STATEFUL UI) */
.off {
display: none;
}
section[data-for] {
padding: 0.6em 0 1em;
}
section[data-for] li label {
display: inline-block; /* Needed for ::first-letter below. */
}
section[data-for] li label::first-letter {
text-transform: uppercase;
}
:root.if-options-page section[data-for] {
padding-bottom: 0.6em;
}
:root.if-options-page section[data-for]:not(:last-child),
.underlined {
border-bottom: 1px solid var(--cr-options-headline);
}
/* HIDE starts. */
:root:not(.if-options-page) #acc-pac:not(:checked) ~ .main-nav section[data-for="acc-pac"],
:root:not(.if-options-page) #acc-exc:not(:checked) ~ .main-nav section[data-for="acc-exc"],
:root:not(.if-options-page) #acc-own-mods:not(:checked) ~ .main-nav section[data-for="acc-own-mods"],
:root:not(.if-options-page) #acc-mods:not(:checked) ~ .main-nav section[data-for="acc-mods"],
:root:not(.if-options-page) #acc-ntf:not(:checked) ~ .main-nav section[data-for="acc-ntf"],
/* One button shared between two sections: */
:root:not(.if-options-page) #acc-own-mods:not(:checked) + #acc-mods:not(:checked) ~ .main-nav #apply-mods-section
{
/* Hide, but preclude width resizes. */
height: 0px !important;
line-height: 0px !important;
padding-top: 0 !important;
padding-bottom: 0 !important;
margin-top: 0 !important;
margin-bottom: 0 !important;
border: none !important;
display: block;
visibility: hidden;
transform: scaleY(0) !important;
}
:root:not(.if-options-page) #acc-pac:not(:checked) ~ .main-nav section[data-for="acc-pac"] *,
:root:not(.if-options-page) #acc-exc:not(:checked) ~ .main-nav section[data-for="acc-exc"] *,
:root:not(.if-options-page) #acc-own-mods:not(:checked) ~ .main-nav section[data-for="acc-own-mods"] *,
:root:not(.if-options-page) #acc-mods:not(:checked) ~ .main-nav section[data-for="acc-mods"] *,
:root:not(.if-options-page) #acc-ntf:not(:checked) ~ .main-nav section[data-for="acc-ntf"] *,
/* One button shared between two sections: */
:root:not(.if-options-page) #acc-own-mods:not(:checked) + #acc-mods:not(:checked) ~ .main-nav #apply-mods-section *
{
margin-top: 0 !important;
margin-bottom: 0 !important;
}
/* HIDE ends. */
.nav-labels {
background-color: var(--cr-grey-panel);
text-align: center;
}
.nav-labels li label {
display: inline-block;
border: 1px solid var(--ribbon-color);
border-radius: 0.2em;
background-color: white;
color: var(--ribbon-color);
padding: 0.2em 0.3em 0.3em 0.2em;
line-height: 0.8em;
margin: 0.1em 0;
}
.nav-labels li label:hover {
background-color: var(--blue-bg);
color: white;
/*
border-color: white;
border-style: dotted;*/
}
/* LABELS starts. */
#acc-pac:checked ~ .nav-labels label[for="acc-pac"]:not(:hover),
#acc-exc:checked ~ .nav-labels label[for="acc-exc"]:not(:hover),
#acc-own-mods:checked ~ .nav-labels label[for="acc-own-mods"]:not(:hover),
#acc-mods:checked ~ .nav-labels label[for="acc-mods"]:not(:hover),
#acc-ntf:checked ~ .nav-labels label[for="acc-ntf"]:not(:hover)
{
background-color: var(--blue-bg);
color: white;
}
/* ★★★★★ */
.nav-labels label:before {
content: '★';
padding-right: 0.1em;
visibility: hidden;
}
.nav-labels li label:hover:before,
#acc-pac:checked ~ .nav-labels label[for="acc-pac"]:before,
#acc-exc:checked ~ .nav-labels label[for="acc-exc"]:before,
#acc-own-mods:checked ~ .nav-labels label[for="acc-own-mods"]:before,
#acc-mods:checked ~ .nav-labels label[for="acc-mods"]:before,
#acc-ntf:checked ~ .nav-labels label[for="acc-ntf"]:before
{
visibility: initial;
}
/* LABELS ends. */
/* COMMON 2 */
/* INFO SIGNS */
input:disabled + .label-container label {
color: var(--default-grey);
pointer-events: none;
}
.info-row {
position: relative;
}
.right-bottom-icon {
margin-left: 0.1em;
vertical-align: bottom;
}
.info-url, .info-url:hover {
text-decoration: none;
}
/* Source: https://jsfiddle.net/greypants/zgCb7/ */
.desc {
text-align: right;
color: var(--ribbon-color);
cursor: help;
padding-left: 0.3em;
}
.tooltip {
display: none;
position: absolute;
white-space: initial;
word-break: initial;
top: 100%;
left: 0;
right: 1em;
z-index: 1;
background-color: var(--ribbon-color);
padding: 1em;
color: white;
text-align: initial;
}
.desc:hover .tooltip {
display: block;
}
.tooltip a,
.tooltip em {
color: white;
}
.desc .tooltip:after {
border-left: solid transparent 0.5em;
border-bottom: solid var(--ribbon-color) 0.5em;
position: absolute;
top: -0.5em;
content: "";
width: 0;
right: 0;
height: 0;
}
/* This bridges the gap so you can mouse into the tooltip without it disappearing. */
.desc .tooltip:before {
position: absolute;
top: -1em;
content: "";
display: block;
height: 1.2em;
left: 75%;
width: calc(25% + 0.6em);
}
/* TAB_1: PAC PROVIDER */
.update-button {
visibility: hidden;
}
input:checked ~ .label-container .update-button {
visibility: inherit;
}
label[for="onlyOwnSites"] + .update-button {
display: none;
}
#none:checked ~ .label-container label {
color: red;
}
#update-message {
white-space: nowrap;
margin-top: 0.5em;
}
/* TAB_2: PAC MODS */
#mods-custom-proxy-string-raw ~ textarea {
width: 100%;
max-width: 38.5em; /* ~418px, layout breaks if more */
height: 7em;
margin-top: 0.3em;
font-size: 0.9em;
}
#mods-custom-proxy-string-raw:not(:checked) ~ textarea {
display: none;
}
/* TAB_3: EXCEPTIONS */
/* EXC-EDITOR starts. */
#exc-address-container {
display: flex;
align-items: center;
width: 100%;
}
#exc-address-container > a {
border-bottom: 1px solid transparent;
margin-left: 0.2em;
}
#exc-address {
width: 100%;
display: flex;
align-items: baseline;
--exc-hieght: 1.6em;
font-size: 1em;
border-bottom: 1px solid var(--ribbon-color) !important;
}
input#exc-editor {
border: none;
width: 100%;
background: inherit;
/* The two below align '.' (dot) vertically. */
max-height: var(--exc-hieght) !important;
min-height: var(--exc-hieght) !important;
}
#exc-radio {
display: flex;
justify-content: space-around;
margin-top: 0.5em;
}
[name="if-proxy-this-site"]:checked + label {
font-weight: bold;
}
#exc-address.if-yes {
background-color: lightgreen;
}
#exc-address.if-no {
background-color: pink;
}
option.if-proxied {
color: var(--ribbon-color);
}
option:not(.if-proxied) {
color: red;
}
/* EXC-EDITOR ends. */
#exc-mods {
padding-top: 1em;
}
#exc-mods input#mods-if-mind-exceptions:not(:checked) + .label-container label {
color: red;
}
/* CONTROL RAW = BUTTON + LINK */
.hor-flex {
display: flex;
align-items: baseline;
justify-content: space-between;
width: 100%;
}
.control-row {
margin: 1em 0 1em 0;
}
.hor-flex input:not([type="button"]) {
align-self: flex-end;
}
.label-container {
flex-grow: 9;
padding-left: 0.3em;
}
/* STATUS */
#status-row {
padding: 0 0.3em 1em;
}
#status {
display: inline-block;
}
.other-version {
font-size: 1.7em;
color: var(--ribbon-color);
margin-left: 0.1em;
}
.other-version:hover {
text-decoration: none;
}
.full-line-height,
.full-line-height * {
line-height: 100%;
}
@font-face {
font-family: "emoji";
src:url("../lib/fonts/emoji.woff") format("woff");
font-weight: normal;
font-style: normal;
}
.emoji {
font-family: "emoji";
}
svg.icon {
display: inline-block;
width: 1em;
height: 1em;
stroke-width: 0;
stroke: currentColor;
fill: currentColor;
}
</style>
</head>
<body>
<section class="if-not-controlled hor-padded" id="which-extension"></section>
<input type="radio" name="accordion" class="off" id="acc-pac" checked/>
<input type="radio" name="accordion" class="off" id="acc-exc"/>
<input type="radio" name="accordion" class="off" id="acc-own-mods"/>
<input type="radio" name="accordion" class="off" id="acc-mods"/>
<input type="radio" name="accordion" class="off" id="acc-ntf"/>
<nav class="nav-labels hidden-for-options-page">
<ul class='horizontal-list'>
<li><label for="acc-pac" class="nav-label">PAC-скрипт</label></li>
<li><label for="acc-exc" class="nav-label">Исключения</label></li>
<li><label for="acc-own-mods" class="nav-label">Свои прокси</label></li>
<li><label for="acc-mods" class="nav-label">Модификаторы</label></li>
<li><label for="acc-ntf" class="nav-label">Уведомления</label></li>
</ul>
<hr/>
</nav>
<nav class="hor-padded main-nav">
<section data-for="acc-pac">
<header class="only-for-options-page">PAC-скрипт:</header>
<ul id="list-of-providers">
<li class="info-row hor-flex"><input type="radio" name="pacProvider" id="none" checked> <div class="label-container"><label for="none">Отключить</label></div></li>
</ul>
<div id="update-message" class="hor-flex" style="align-items: center">
<div>Обновлялись: <span class="update-date">...</span></div>
<div class="full-line-height">
<a class="only-for-mini-version other-version emoji" href="https://rebrand.ly/ac-versions"
title="Полная версия">🏋</a>
<a class="only-for-full-version other-version emoji" href="https://rebrand.ly/ac-versions"
title="Версия для слабых машин">🐌</a>
</div>
</div>
</section>
<section class="only-for-options-page nowrap underlined">
Редактор исключений доступен толко для <a href="chrome://newtab">вкладок</a>.
</section>
<section data-for="acc-exc" class="hidden-for-options-page">
<section class="exc-editor-section" style="padding-bottom: 1em;">
<div>Проксировать указанный сайт?</div>
<div id="exc-address-container">
<div id="exc-address">
<span>*.</span><input placeholder="navalny.com" list="exc-list" name="browser" id="exc-editor" style=""/>
</div>
<!--a href class="emoji">⇄</a-->
<a href="../exceptions/index.html" title="импорт/экспорт"><svg
class="icon"
><use xlink:href="#icon-import-export"></use></svg>
</a>
</div>
<datalist id="exc-list"></datalist>
<ol class="horizontal-list" id="exc-radio">
<li><input id="this-auto" type="radio" checked name="if-proxy-this-site"/>
<label for="this-auto"><!--span class="emoji">🔄(looks fat)</span--><svg
class="icon"
style="position: relative; top: 0.15em;"><use xlink:href="#icon-loop-round"></use></svg>&nbsp;авто</label>
</li>
<li><input id="this-yes" type="radio" name="if-proxy-this-site"/> <label for="this-yes">&nbsp;да</label></li>
<li><input id="this-no" type="radio" name="if-proxy-this-site"/> <label for="this-no">&nbsp;нет</label></li>
</ol>
</section>
<ul id="exc-mods"></ul>
</section>
<section data-for="acc-own-mods">
<ul id="own-mods"></ul>
</section>
<section data-for="acc-mods">
<ul id="pac-mods"></ul>
</section>
<section id="apply-mods-section" class="control-row hor-flex" style="margin-top: 0.2em">
<input type="button" value="Применить" id="apply-mods" disabled/>
<a href id="reset-mods">К изначальным!</a>
</section>
<section data-for="acc-ntf">
<header>Я <span style="color: #f93a17"></span>едомления:</header>
<ul id="list-of-notifiers"></ul>
</section>
</nav>
<hr/>
<div class="hor-padded">
<section id="status-row">
<div id="status" style="will-change: contents">Загрузка...</div>
</section>
<footer class="control-row hor-flex nowrap">
<input type="button" value="Готово" class="close-button">
<a href="../troubleshoot/index.html">
Проблемы?
</a>
</footer>
</div>
<script src="./index.js"></script>
<script src="../lib/keep-links-clickable.js"></script>
<!-- ICONS -->
<svg style="display: none" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<symbol id="icon-info" viewBox="0 0 100 100">
<title>info</title>
<circle shape-rendering="geometricPrecision" fill="none" stroke="currentColor" stroke-width="7" cx="50" cy="50" r="45"/>
<path shape-rendering="crispEdges" d="M 55,40 V 80 H 45 V 40 z m 0,-20 V 35 H 45 V 20 Z"/>
</symbol>
<symbol id="icon-loop-round" viewBox="0 0 32 32">
<title>loop-round</title>
<path d="M27.802 5.197c-2.925-3.194-7.13-5.197-11.803-5.197-8.837 0-16 7.163-16 16h3c0-7.18 5.82-13 13-13 3.844 0 7.298 1.669 9.678 4.322l-4.678 4.678h11v-11l-4.198 4.197z"/>
<path d="M29 16c0 7.18-5.82 13-13 13-3.844 0-7.298-1.669-9.678-4.322l4.678-4.678h-11v11l4.197-4.197c2.925 3.194 7.13 5.197 11.803 5.197 8.837 0 16-7.163 16-16h-3z"/>
</symbol>
<symbol id="icon-import-export" viewBox="0 0 32 32">
<title>import-export</title>
<g transform="rotate(0 16 16)">
<path d="M7 22 h 25 v 4 h -25 v 5 l -7-7 7-7 v5 z"/>
<path d="M25 10 h-25 v-4 h 25 v -5 l 7 7 -7 7 z"/>
</g>
<!-- With bars on peaks.
<path d="M30 0h2v16h-2v-16z"></path>
<path d="M0 16h2v16h-2v-16z"></path>
<path d="M10 22 h 22 v 4 h -22 v 5 l -7-7 7-7 v5 z"></path>
<path d="M22 10 h-22 v-4 h 22 v -5 l 7 7 -7 7 z"></path-->
</symbol>
</svg>
</body>
</html>

View File

@ -6,19 +6,27 @@
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-plugin-dynamic-import-webpack": "^1.0.1",
"babel-preset-flow": "^6.23.0",
"babel-preset-react": "^6.24.1",
"babili-webpack-plugin": "^0.0.11",
"concat-stream": "^1.6.0",
"csjs-inject": "^1.0.1",
"flow-bin": "^0.45.0",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"inferno": "^3.2.0",
"inferno-component": "^3.1.2",
"inferno-create-element": "^3.1.2",
"webpack": "^2.5.1"
},
"scripts": {
"check": "flow status",
"build:prod": "webpack --define process.env.NODE_ENV=\"'production'\" --env=prod",
"build:dev:nocomp": "webpack --define process.env.NODE_ENV=\"'production'\" --env=dev",
"build:dev": "webpack --debug --devtool source-map --output-pathinfo --env=dev",
"build": "npm run build:dev"
"build:dev:nocomp": "NODE_ENV=development webpack --define process.env.NODE_ENV=\"'development'\" --env=dev",
"build:dev": "NODE_ENV=development webpack --debug --define process.env.NODE_ENV=\"'development'\" --output-pathinfo --env=dev",
"gulp": "cd .. && npm run gulp",
"start": "npm run build:dev && npm run gulp"
},
"dependencies": {
"babel-plugin-inferno": "^3.2.0"
}
}

View File

@ -0,0 +1,146 @@
import Inferno from 'inferno';
import Component from 'inferno-component';
import createElement from 'inferno-create-element';
import getNotControlledWarning from './NotControlledWarning';
import getMain from './Main';
import getFooter from './Footer';
export default function getApp(theState) {
const NotControlledWarning = getNotControlledWarning(theState);
const Main = getMain(theState);
const Footer = getFooter(theState);
return class App extends Component {
constructor(props) {
super(props);
this.state = {
status: 'Загрузка...',
ifInputsDisabled: false,
};
}
setStatusTo(msg, cb) {
this.setState(
{
status: msg,
},
cb
);
}
showErrors(err, ...args/* ...warns, cb */) {
const lastArg = args[args.length - 1];
const cb = (lastArg && typeof lastArg === 'function')
? args.pop()
: () => {};
const warns = args;
const warningHtml = warns
.map(
(w) => w && w.message || ''
)
.filter( (m) => m )
.map( (m) => '✘ ' + m )
.join('<br/>');
let messageHtml = '';
if (err) {
let wrapped = err.wrapped;
messageHtml = err.message || '';
while( wrapped ) {
const deeperMsg = wrapped && wrapped.message;
if (deeperMsg) {
messageHtml = messageHtml + ' &gt; ' + deeperMsg;
}
wrapped = wrapped.wrapped;
}
}
messageHtml = messageHtml.trim();
if (warningHtml) {
messageHtml = messageHtml ? messageHtml + '<br/>' + warningHtml : warningHtml;
}
this.setStatusTo(
(<span>
<span style="color:red">
{err ? <span><span class="emoji">🔥</span> Ошибка!</span> : 'Некритичная oшибка.'}
</span>
<br/>
<span style="font-size: 0.9em; color: darkred" dangerouslySetInnerHTML={{__html: messageHtml}}></span>
{' '}
{err && <a href="" onClick={(evt) => {
this.props.apis.errorHandlers.viewError('pup-ext-err', err);
evt.preventDefault();
}}>[Техн.детали]</a>}
</span>),
cb
);
}
switchInputs(val) {
this.setState({
ifInputsDisabled: val === 'off' ? true : false,
});
}
conduct(
beforeStatus, operation, afterStatus,
onSuccess = () => {}, onError = () => {}
) {
this.setStatusTo(beforeStatus);
this.switchInputs('off');
operation((err, res, ...warns) => {
warns = warns.filter( (w) => w );
if (err || warns.length) {
this.showErrors(err, ...warns);
} else {
this.setStatusTo(afterStatus);
}
this.switchInputs('on');
if (!err) {
onSuccess(res);
} else {
onError(err);
}
});
}
render(originalProps) {
const props = Object.assign({}, originalProps, {
funs: {
setStatusTo: this.setStatusTo.bind(this),
conduct: this.conduct.bind(this),
showErrors: this.showErrors.bind(this),
},
ifInputsDisabled: this.state.ifInputsDisabled,
});
return createElement('div', null, [
...( props.flags.ifNotControlled ? [createElement(NotControlledWarning, props)] : [] ),
createElement(Main, props),
createElement(Footer, Object.assign({ status: this.state.status }, props)),
]);
}
}
};

View File

@ -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 (
<section class="controlRow horFlex" style="margin-top: 1em">
<input type="button" value="Применить" disabled={props.ifInputsDisabled} onClick={props.onClick}/>
<a href="" onClick={linkEvent(props, resetMods)}>К изначальным!</a>
</section>
);
};
};

View File

@ -0,0 +1,348 @@
import Inferno from 'inferno';
import Component from 'inferno-component';
import css from 'csjs-inject';
export default function getExcEditor(theState) {
const scopedCss = css`
#exc-address-container {
display: flex;
align-items: center;
width: 100%;
}
#exc-address-container > a {
border-bottom: 1px solid transparent;
margin-left: 0.2em;
align-self: flex-end;
}
#exc-address {
width: 100%;
display: flex;
align-items: baseline;
--exc-hieght: 1.6em;
font-size: 1em;
border-bottom: 1px solid var(--ribbon-color) !important;
}
input#exc-editor {
border: none;
width: 100%;
background: inherit;
/* The two below align '.' (dot) vertically. */
max-height: var(--exc-hieght) !important;
min-height: var(--exc-hieght) !important;
}
#exc-radio {
display: flex;
justify-content: space-around;
margin-top: 0.5em;
}
[name="if-proxy-this-site"]:checked + label {
font-weight: bold;
}
#exc-address.ifYes {
background-color: lightgreen;
}
#exc-address.ifNo {
background-color: pink;
}
`;
const labelIfProxied = '✔';
const labelIfNotProxied = '✘';
const labelIfAuto = '↻';
/* Not used.
const sortOptions = (options) => {
const aWins = 1;
return options.sort(([aHost, aState], [bHost, bState]) => aState === undefined ? aWins : aHost.localeCompare(bHost))
};
*/
return class ExcEditor extends Component {
modsToOpts(pacMods) {
return Object.keys(pacMods.exceptions || {}).sort().map(
(excHost) => [excHost, pacMods.exceptions[excHost]]
);
}
constructor(props) {
super(props);
const pacMods = props.apis.pacKitchen.getPacMods();
this.state = {
trimmedInputValueOrSpace:
props.currentTab && !props.currentTab.url.startsWith('chrome') ? new URL(props.currentTab.url).hostname : '',
sortedListOfOptions: this.modsToOpts(pacMods),
isHostHidden: {}
};
}
hideAllOptions() {
this.setState({
isHostHidden: this.state.sortedListOfOptions.reduce(
(isHostHidden, [excHost]) => {
isHostHidden[excHost] = true;
return isHostHidden;
},
{}),
});
}
isHostValid(host) {
const ValidHostnameRegex = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/;
if(!ValidHostnameRegex.test(host)) {
this.props.funs.showErrors(new TypeError('Должно быть только доменное имя, без протокола, порта и пути. Попробуйте ещё раз.'));
return false;
}
return true;
}
handleRadioClick(event) {
const host = this.state.trimmedInputValueOrSpace;
(() => { // `return` === `preventDefault`.
if(!this.isHostValid(host)) {
return false;
}
const pacMods = this.props.apis.pacKitchen.getPacMods();
pacMods.exceptions = pacMods.exceptions || {};
let ifYesClicked = false;
switch(event.target.id) {
case 'this-auto':
delete pacMods.exceptions[host];
break;
case 'this-yes':
ifYesClicked = true;
case 'this-no':
if (ifYesClicked && !pacMods.filteredCustomsString) {
this.props.funs.showErrors( new TypeError(
'Проксировать СВОИ сайты можно только при наличии СВОИХ прокси (см. «Модификаторы» ). Нет своих прокси, удовлетворяющих вашим требованиям.'
));
return false;
}
pacMods.exceptions[host] = ifYesClicked;
break;
default:
throw new Error('Only yes/no/auto!');
}
this.props.funs.conduct(
'Применяем исключения...',
(cb) => this.props.apis.pacKitchen.keepCookedNowAsync(pacMods, cb),
'Исключения применены. Не забывайте о кэше!',
() => this.setState({sortedListOfOptions: this.modsToOpts(pacMods)})
);
})();
// Don't check before operation is finished.
event.preventDefault();
}
handleKeyDown(event) {
if(event.key === 'Enter') {
this.hideAllOptions();
}
return true;
}
handleInputOrClick(event) {
// Episode 1.
const ifClick = event && event.type === 'click';
// If triangle button on right of datalist input clicked.
let ifTriangleClicked = false;
{
const maxIndentFromRightInPx = 15;
ifTriangleClicked = ifClick
&& !this.rawInput.selectionStart && !this.rawInput.selectionEnd
&& event.x > this.rawInput.getBoundingClientRect().right - maxIndentFromRightInPx;
}
const setInputValue = (newValue) => {
if (ifClick && !ifTriangleClicked) {
// Don't jerk cursor on simple clicks.
return;
}
// See bug in my comment to http://stackoverflow.com/a/32394157/521957
// First click on empty input may be still ignored.
const newPos = this.rawInput.selectionStart + newValue.length - this.rawInput.value.length;
this.rawInput.value = newValue;
window.setTimeout(() => this.rawInput.setSelectionRange(newPos, newPos), 0);
};
const trimmedInput = event.target.value.trim();
const ifInputEmpty = !trimmedInput;
const ifInit = !event;
const currentHost = ifTriangleClicked ? '' : (trimmedInput || (ifInit ? '' : ' '));
setInputValue(currentHost);
this.setState({trimmedInputValueOrSpace: currentHost});
// Episode 2.
let exactHost, exactState; // Undefined.
let editedHost = false;
const hidden = this.state.sortedListOfOptions.reduce(
(hiddenAcc, [excHost, excState]) => {
if (excState === undefined) {
editedHost = excHost;
} else if (excHost === trimmedInput) {
// Exact match found for input.
[exactHost, exactState] = [excHost, excState];
}
hiddenAcc[excHost] = false;
return hiddenAcc;
},
{}
);
let options = this.state.sortedListOfOptions;
const removeEditedHost = () => {
options = options.filter(([excHost, excState]) => editedHost !== excHost);
delete hidden[editedHost];
};
(() => {// `return` === setState
if (ifTriangleClicked || ifInputEmpty) {
// Show all opts.
if (editedHost) {
// Example of editedOpt.value: 'abcde ' <- Mind the space (see unhideOptAndAddSpace)!
const ifBackspacedOneChar = ifInputEmpty && editedHost.length < 3;
if (ifBackspacedOneChar) {
removeEditedHost();
}
}
return true;
}
if (editedHost) {
const ifUpdateNeeded = editedHost !== trimmedInput;
if(!ifUpdateNeeded) {
hidden[editedHost] = true;
return true;
}
// Not exact! Update!
removeEditedHost();
}
if (!exactHost) {
editedHost = trimmedInput;
options.unshift([editedHost, undefined]);
if (!ifClick) {
// New value was typed -- don't show tooltip.
hidden[editedHost] = true;
}
}
// Exact found!
// Do nothing.
})();
this.setState({
isHostHidden: hidden,
sortedListOfOptions: options,
});
}
render(props) {
const inputProxyingState = this.state.sortedListOfOptions.reduce((acc, [excHost, excState]) => {
if ( acc !== undefined ) {
return acc;
}
return this.state.trimmedInputValueOrSpace === excHost ? excState : undefined;
}, undefined);
const onradio = this.handleRadioClick.bind(this);
const oninput = this.handleInputOrClick.bind(this);
return (
<section style="padding-bottom: 1em;">
<div>Проксировать указанный сайт?</div>
<div id="exc-address-container">
<div id="exc-address" class={inputProxyingState !== undefined ? ( inputProxyingState === true ? scopedCss.ifYes : scopedCss.ifNo ) : ''}>
<span>*.</span><input placeholder="navalny.com" list="exc-list" id="exc-editor"
value={this.state.trimmedInputValueOrSpace}
ref={(inputNode) => { this.rawInput = inputNode; }}
onKeyDown={this.handleKeyDown.bind(this)}
onInput={oninput}
onClick={oninput}
/>
</div>
{/*<a href class="emoji">⇄</a>*/}
<a href="../exceptions/index.html" title="импорт/экспорт"><svg
class="icon"
><use xlink:href="#iconImportExport"></use></svg>
</a>
</div>
<datalist id="exc-list">
{
this.state.sortedListOfOptions.map(([excHost, excState]) => {
// 1. Option's value may be changed to hide it from the tooltip.
// 2. Space is used in matching so even an empty input (replaced with space) has tooltip with prompts.
return <option
value={ this.state.isHostHidden[excHost] ? '\n' : excHost + ' ' }
label={ excState === true ? labelIfProxied : (excState === false ? labelIfNotProxied : labelIfAuto) }/>
})
}
</datalist>
<ol class="horizontalList" id="exc-radio">
<li><input id="this-auto" type="radio" checked name="if-proxy-this-site" onClick={onradio}/>{' '}
<label for="this-auto">{/*<span class="emoji">🔄(looks fat)</span>*/}<svg
class="icon"
style="position: relative; top: 0.15em;"><use xlink:href="#iconLoopRound"></use></svg>&nbsp;авто</label>
</li>
<li>
<input id="this-yes" type="radio" name="if-proxy-this-site" checked={inputProxyingState === true} onClick={onradio}/>
{' '}<label for="this-yes"><span class="emoji"></span>&nbsp;да</label>
</li>
<li>
<input id="this-no" type="radio" name="if-proxy-this-site" checked={inputProxyingState === false} onClick={onradio}/>
{' '}<label for="this-no"><span class="emoji"></span>&nbsp;нет</label></li>
</ol>
</section>
);
}
};
};

View File

@ -0,0 +1,71 @@
import Inferno from 'inferno';
import createElement from 'inferno-create-element';
import css from 'csjs-inject';
import getInfoLi from './InfoLi';
import getExcEditor from './ExcEditor';
export default function getExceptions(theState) {
const scopedCss = css`
.excMods {
padding-top: 1em;
}
.excMods input#mods-ifMindExceptions:not(:checked) + * > label {
color: red;
}
`;
const InfoLi = getInfoLi(theState);
const ExcEditor = getExcEditor(theState);
return function Exceptions(props) {
const applyMods = (newMods) => {
props.apis.pacKitchen.keepCookedNowAsync(newMods, (err, ...warns) =>
err
? props.funs.showErrors(err, ...warns)
: props.funs.setStatusTo('Применено.')
);
};
return props.flags.ifInsideOptionsPage
? (
<div class="nowrap">
Редактор исключений доступен только для <a href="chrome://newtab">вкладок</a>.
</div>)
:
(<div>
{createElement(ExcEditor, props)}
<ul class={scopedCss.excMods}>
{
props.apis.pacKitchen.getOrderedConfigs('exceptions').map((conf) => {
return <InfoLi
type="checkbox"
conf={conf}
idPrefix="mods-"
checked={conf.value}
disabled={props.ifInputsDisabled}
onClick={(evt) => {
const oldMods = props.apis.pacKitchen.getPacMods();
oldMods[conf.key] = !conf.value;
applyMods(oldMods);
}}
/>;
})
}
</ul>
</div>
);
};
};

View File

@ -0,0 +1,39 @@
import Inferno from 'inferno';
import css from 'csjs-inject';
export default function getFooter() {
const scopedCss = css`
.statusRow {
padding: 0 0.3em 1em;
}
.status {
display: inline-block;
}
.controlRow {
margin: 1em 0 1em 0;
}
`;
return function (props) {
return (
<div class="horPadded">
<section class={scopedCss.statusRow}>
<div clss={scopedCss.status} style="will-change: contents">{props.status}</div>
</section>
<footer class={scopedCss.controlRow + ' horFlex nowrap'}>
<input type="button" value="Готово" disabled={props.ifInputsDisabled} onClick={() => window.close()} />
<a href="../troubleshoot/index.html">
Проблемы?
</a>
</footer>
</div>
);
};
};

View File

@ -0,0 +1,153 @@
import Inferno from 'inferno';
import css from 'csjs-inject';
export default function getInfoLi() {
const scopedCss = css`
/* CONTROL RAW = BUTTON + LINK */
.labelContainer {
flex-grow: 9;
padding-left: 0.3em;
/* Vertical align to middle. */
/*align-self: flex-end;*/
line-height: 100%;
}
/* INFO SIGNS */
input:disabled + .labelContainer label {
color: var(--default-grey);
pointer-events: none;
}
.infoRow {
position: relative;
flex-wrap: wrap;
}
.infoRow > input[type="checkbox"] {
position: relative;
top: -0.08em;
}
.rightBottomIcon {
margin-left: 0.1em;
vertical-align: bottom;
}
.infoUrl, .infoUrl:hover {
text-decoration: none;
}
/* Source: https://jsfiddle.net/greypants/zgCb7/ */
.desc {
text-align: right;
color: var(--ribbon-color);
cursor: help;
padding-left: 0.3em;
}
.tooltip {
display: none;
position: absolute;
white-space: initial;
word-break: initial;
top: 100%;
left: 0;
right: 1em;
z-index: 1;
background-color: var(--ribbon-color);
padding: 1em;
color: white;
text-align: initial;
}
.desc:hover .tooltip {
display: block;
}
.tooltip a,
.tooltip em {
color: white;
}
.desc .tooltip:after {
border-left: solid transparent 0.5em;
border-bottom: solid var(--ribbon-color) 0.5em;
position: absolute;
top: -0.5em;
content: "";
width: 0;
right: 0;
height: 0;
}
/* This bridges the gap so you can mouse into the tooltip without it disappearing. */
.desc .tooltip:before {
position: absolute;
top: -1em;
content: "";
display: block;
height: 1.2em;
left: 75%;
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 dashToCamel = (name) => name.replace(/-(.)/g, (_, p1) => p1.toUpperCase());
const InfoIcon = function InfoIcon(props) {
return (
<svg class="icon" style="position: relative; top: 0.08em">$
<use xlink:href="#iconInfo"></use>$
</svg>
);
};
return function InfoLi(props) {
props = Object.assign({}, {
idPrefix: '',
ifDashify: false,
}, props);
const iddy = props.idPrefix + ( props.ifDashify ? camelToDash(props.conf.key) : props.conf.key );
return (
<li class={scopedCss.infoRow + ' horFlex'}>
<input
type={props.type}
name={props.name}
checked={props.checked}
id={iddy}
onClick={props.onClick}
onChange={props.onChange}
disabled={props.disabled}
/>
<div class={scopedCss.labelContainer}>
<label for={iddy} dangerouslySetInnerHTML={{__html: props.conf.label}}></label>
&nbsp;{props.nodeAfterLabel}
</div>
{props.conf.desc
? (
<div class={scopedCss.desc}>
<InfoIcon />
<div class={scopedCss.tooltip} dangerouslySetInnerHTML={{__html: props.conf.desc}}/>
</div>)
: (props.conf.url
? (<a href={props.conf.url} class={[scopedCss.rightBottomIcon, scopedCss.infoUrl].join(' ')} title="Открыть документацию"><InfoIcon /></a>)
: (<span>&nbsp;</span>) // Affects vertical align of flexbox items.
)
}
{props.children && (<div class={scopedCss.children}>{props.children}</div>)}
</li>
);
};
};

View File

@ -0,0 +1,62 @@
import Inferno from 'inferno';
import Component from 'inferno-component';
export default function getLastUpdateDate(theState) {
return class LastUpdateDate extends Component {
componentWillMount() {
this.onStorageChangedHandler = (changes) =>
changes.lastPacUpdateStamp.newValue && this.forceUpdate();
chrome.storage.onChanged.addListener( this.onStorageChangedHandler );
}
componentWillUnmount() {
chrome.storage.onChanged.removeListener( this.onStorageChangedHandler );
}
getDate(antiCensorRu) {
let dateForUser = 'никогда';
if( antiCensorRu.lastPacUpdateStamp ) {
let diff = Date.now() - antiCensorRu.lastPacUpdateStamp;
let units = 'мс';
const gauges = [
[1000, 'с'],
[60, 'мин'],
[60, 'ч'],
[24, 'дн'],
[7, ' недель'],
[4, ' месяцев'],
];
for(const g of gauges) {
const diffy = Math.floor(diff / g[0]);
if (!diffy)
break;
diff = diffy;
units = g[1];
}
dateForUser = diff + units + ' назад';
}
return {
text: `${dateForUser} / ${antiCensorRu.pacUpdatePeriodInMinutes/60}ч`,
title: new Date(antiCensorRu.lastPacUpdateStamp).toLocaleString('ru-RU'),
};
}
render(props) {
const date = this.getDate(props.apis.antiCensorRu);
return (<div>Обновлялись: <span class="updateDate" title={date.title}>{ date.text }</span></div>);
}
};
};

View File

@ -0,0 +1,169 @@
import Inferno, {linkEvent} from 'inferno';
import Component from 'inferno-component';
import createElement from 'inferno-create-element';
import getTabPanel from './TabPanel';
import getPacChooser from './PacChooser';
import getExceptions from './Exceptions';
import getModList from './ModList';
import getProxyEditor from './ProxyEditor';
import getApplyMods from './ApplyMods';
import getNotifications from './Notifications';
export default function getMain(theState) {
const TabPanel = getTabPanel(theState);
const PacChooser = getPacChooser(theState);
const Exceptions = getExceptions(theState);
const ModList = getModList(theState);
const ProxyEditor = getProxyEditor(theState);
const ApplyMods = getApplyMods(theState);
const Notifications = getNotifications(theState);
//const addChecks = (arr) => arr.map( (conf) => Object.assign(conf, {ifChecked: Boolean(conf.value)}) );
const checksName = 'pacMods';
return class Main extends Component {
constructor(props) {
super(props);
this.state = {
ifModsChangesStashed: false,
catToOrderedMods: {
'general': props.apis.pacKitchen.getOrderedConfigs('general'),
'ownProxies': props.apis.pacKitchen.getOrderedConfigs('ownProxies'),
},
};
this.handleModChange = this.handleModChange.bind(this);
}
getAllMods() {
return [].concat(...Object.keys(this.state.catToOrderedMods).map((cat) =>
this.state.catToOrderedMods[cat]
))
}
handleModApply(that) {
const modsMutated = that.props.apis.pacKitchen.getPacMods();
const newMods = that.getAllMods().reduce((_, conf) => {
modsMutated[conf.key] = conf.value;
return modsMutated;
});
that.props.funs.conduct(
'Применяем настройки...',
(cb) => that.props.apis.pacKitchen.keepCookedNowAsync(newMods, cb),
'Настройки применены.',
() => that.setState({ifModsChangesStashed: false})
);
}
handleModChange({targetConf, targetIndex, newValue}) {
const oldCats = this.state.catToOrderedMods;
const newCats = Object.keys(this.state.catToOrderedMods).reduce((acc, cat) => {
if (cat !== targetConf.category) {
acc[cat] = oldCats[cat];
} else {
acc[cat] = oldCats[cat].map((conf, index) => {
if (targetIndex !== index) {
return conf;
}
return Object.assign({}, conf, {
value: newValue
});
});
}
return acc;
}, {});
this.setState({
catToOrderedMods: newCats,
ifModsChangesStashed: true,
});
}
render(props) {
const applyModsEl = createElement(ApplyMods, Object.assign({}, props,
{
ifInputsDisabled: !this.state.ifModsChangesStashed || props.ifInputsDisabled,
onClick: linkEvent(this, this.handleModApply),
}
));
const modsHandlers = {
onConfChanged: this.handleModChange,
};
return createElement(TabPanel, {
tabs: [
{
label: 'PAC-скрипт',
content: createElement(PacChooser, props),
key: 'pacScript',
},
{
label: 'Исключения',
content: createElement(Exceptions, props),
key: 'exceptions',
},
{
label: 'Свои прокси',
content: createElement(
ModList,
Object.assign({}, props, {
orderedConfigs: this.state.catToOrderedMods['ownProxies'],
childrenOfMod: {
customProxyStringRaw: ProxyEditor,
},
name: checksName,
}, modsHandlers)
),
key: 'ownProxies',
},
{
label: 'Модификаторы',
content: createElement(
ModList,
Object.assign({}, props, {
orderedConfigs: this.state.catToOrderedMods['general'],
name: checksName,
}, modsHandlers)
),
key: 'mods',
},
{
content: applyModsEl,
key: 'applyMods',
},
{
label: 'Уведомления',
content: createElement(Notifications, props),
key: 'notifications',
},
],
alwaysShownWith: {
'applyMods': ['ownProxies', 'mods'],
},
});
}
}
};

View File

@ -0,0 +1,82 @@
import Inferno, {linkEvent} from 'inferno';
import Component from 'inferno-component';
import createElement from 'inferno-create-element';
import getInfoLi from './InfoLi';
export default function getModList(theState) {
const InfoLi = getInfoLi(theState);
return class ModList extends Component {
constructor(props) {
super(props);
this.state= {
checks: props.orderedConfigs.map((mod) => Boolean(mod.value)),
};
}
handleCheck(confMeta, ifChecked) {
this.state.checks[confMeta.index] = ifChecked;
if (ifChecked === false || !confMeta.ifChild) {
this.handleNewValue(confMeta, ifChecked);
} else {
this.setState({
checks: this.state.checks.map(
(ch, i) => i === confMeta.index ? ifChecked : ch
)
});
}
}
handleNewValue({ conf, index }, newValue) {
this.props.onConfChanged({
targetConf: conf,
targetIndex: index,
newValue: newValue,
});
}
render(props) {
return (
<ol>
{
props.orderedConfigs.map((conf, index) => {
const ifMayHaveChild = props.childrenOfMod && props.childrenOfMod[conf.key];
const confMeta = { conf, index, ifChild: ifMayHaveChild };
const child = ifMayHaveChild && this.state.checks[index]
&& createElement(
props.childrenOfMod[conf.key],
Object.assign({}, props, {conf, onNewValue: (newValue) => this.handleNewValue(confMeta, newValue)})
);
return (<InfoLi
conf={conf}
type='checkbox'
name={props.name}
checked={conf.value}
key={index}
onChange={(event) => this.handleCheck(confMeta, event.target.checked)}
>
{child}
</InfoLi>);
})
}
</ol>
);
}
}
};

View File

@ -0,0 +1,41 @@
// @flow
import css from 'csjs-inject';
import Inferno from 'inferno';
export default function getNotControlledWarning({ flags }) {
const cssClasses = css`
.warningContainer {
background-color: red;
color: white;
font-weight: bold;
text-align: center;
${ flags.ifInsideOptionsPage
? `
padding-top: 0;
padding-bottom: 0;
` : `
padding-top: 1em;
padding-bottom: 1em;
`
}
border-bottom: 1px solid var(--default-grey);
}
.warningContainer a {
color: white;
}
`;
return function NotControlledWarning(props) {
return (
<section class={cssClasses.warningContainer + " horPadded"} dangerouslySetInnerHTML={{ __html: props.utils.messages.whichExtensionHtml() }} />
);
}
}

View File

@ -0,0 +1,54 @@
import Inferno from 'inferno';
import css from 'csjs-inject';
export default function getPacChooser(theState) {
const scopedCss = css`
.listOfNotifiers {
margin-left: 0.4em;
}
`;
return function Notifications(props) {
return (
<section>
<header>Я <span class="emoji" style="color: #f93a17"></span> yведомления:</header>
<ul class={scopedCss.listOfNotifiers}>
{
Array.from(props.apis.errorHandlers.getEventsMap()).map(([ntfId, ntfName]) => {
const iddy = `if-on-${ntfId}`;
const ifChecked = props.apis.errorHandlers.isOn(ntfId);
return (
<li>
<input
type="checkbox"
id={iddy}
checked={ifChecked}
disabled={props.ifInputsDisabled}
onClick={() => {
props.apis.errorHandlers.switch(
ifChecked ? 'off' : 'on', // Reverse.
ntfId
);
}}
/>
{' '}
<label for={iddy}>{ntfName}</label>
</li>
);
})
}
</ul>
</section>
);
};
};

View File

@ -0,0 +1,151 @@
import Inferno from 'inferno';
import Component from 'inferno-component';
import createElement from 'inferno-create-element';
import css from 'csjs-inject';
import getLastUpdateDate from './LastUpdateDate';
import getInfoLi from './InfoLi';
export default function getPacChooser(theState) {
const scopedCss = css`
/* OTHER VERSION */
.otherVersion {
font-size: 1.7em;
color: var(--ribbon-color);
margin-left: 0.1em;
}
.otherVersion:hover {
text-decoration: none;
}
.fullLineHeight,
.fullLineHeight * {
line-height: 100%;
}
/* TAB_1: PAC PROVIDER */
.updateButton {
visibility: hidden;
}
input:checked + div .updateButton {
visibility: inherit;
}
label[for="onlyOwnSites"] + .updateButton,
label[for="none"] + .updateButton {
display: none;
}
#none:checked + div label[for="none"] {
color: red;
}
#updateMessage {
white-space: nowrap;
margin-top: 0.5em;
}
`;
const LastUpdateDate = getLastUpdateDate(theState);
const InfoLi = getInfoLi(theState);
return class PacChooser extends Component {
constructor(props) {
super();
this.state = {
chosenPacName: 'none',
};
}
getCurrentProviderId() {
return this.props.apis.antiCensorRu.getCurrentPacProviderKey() || 'none';
}
radioClickHandler(event) {
const checkChosenProvider = () =>
this.setState({ chosenPacName: this.getCurrentProviderId() });
const pacKey = event.target.id;
if (
pacKey === (
this.props.apis.antiCensorRu.getCurrentPacProviderKey() || 'none'
)
) {
return false;
}
if (pacKey === 'none') {
this.props.funs.conduct(
'Отключение...',
(cb) => this.props.apis.antiCensorRu.clearPacAsync(cb),
'Отключено.',
() => this.setState({ chosenPacName: 'none' }),
checkChosenProvider
);
} else {
this.props.funs.conduct(
'Установка...',
(cb) => this.props.apis.antiCensorRu.installPacAsync(pacKey, cb),
'PAC-скрипт установлен.',
checkChosenProvider
);
}
return false;
}
render(props) {
const updatePac = function updatePac() {
props.funs.conduct(
'Обновляем...',
(cb) => props.apis.antiCensorRu.syncWithPacProviderAsync(cb),
'Обновлено.'
);
};
const iddyToCheck = this.getCurrentProviderId();
return (
<div>
{props.flags.ifInsideOptionsPage && (<header>PAC-скрипт:</header>)}
<ul>
{
[...props.apis.antiCensorRu.getSortedEntriesForProviders(), {key: 'none', label: 'Отключить'}].map((provConf) =>
(<InfoLi
onClick={this.radioClickHandler.bind(this)}
conf={provConf}
type="radio"
name="pacProvider"
checked={iddyToCheck === provConf.key}
disabled={props.ifInputsDisabled}
nodeAfterLabel={<a href="" class={scopedCss.updateButton} onClick={(evt) => { evt.preventDefault(); updatePac(); }}>[обновить]</a>}
/>)
)
}
</ul>
<div id="updateMessage" class="horFlex" style="align-items: center">
{ createElement(LastUpdateDate, props) }
<div class={scopedCss.fullLineHeight}>
{
props.flags.ifMini
? (<a class={scopedCss.otherVersion + ' emoji'} href="https://rebrand.ly/ac-versions"
title="Полная версия">🏋</a>)
: (<a class={scopedCss.otherVersion + ' emoji'} href="https://rebrand.ly/ac-versions"
title="Версия для слабых машин">🐌</a>)
}
</div>
</div>
</div>
);
}
};
};

View File

@ -0,0 +1,540 @@
import Inferno, {linkEvent} from 'inferno';
import Component from 'inferno-component';
import createElement from 'inferno-create-element';
import css from 'csjs-inject';
export default function getProxyEditor(theState) {
const scopedCss = css`
table.editor {
border-collapse: collapse;
/*border-style: hidden;*/
width: 100%;
margin: 0.5em 0;
background-color: #f3f5f6;
}
table.editor ::-webkit-input-placeholder {
color: #c9c9c9;
}
table.editor td, table.editor th {
border: 1px solid #ccc;
text-align: left;
height: 100%;
}
/* ADD PANEL */
table.editor tr.addPanel td {
padding: 0;
}
/* PROXY ROW */
table.editor tr.proxyRow td:nth-child(2) {
text-align: center;
}
table.editor th:not(:last-child) {
padding: 0 0.6em;
}
table.editor input:not([type="submit"]),
table.editor select,
table.editor select:hover {
border: none;
background: inherit !important;
}
table.editor select,
table.editor select:hover {
-webkit-appearance: menulist !important;
box-shadow: none !important;
}
table.editor input {
width: 100%;
}
/* BUTTONS */
table.editor input[type="submit"],
table.editor button {
min-width: 0;
min-height: 0;
width: 100%;
padding: 0;
border: none;
}
.only {
/*height: 100%;*/
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
table.editor .add {
font-weight: 900;
}
table.editor .export {
padding-right: 2px;
}
/* LAST COLUMN: BUTTONS */
table.editor tr > *:nth-last-child(1),
table.editor tr.proxyRow > td:first-child {
text-align: center;
padding: 0;
position: relative;
min-width: 1em;
}
/* LAST-2 COLUMN: HOSTNAME
table.editor td:nth-last-child(3) {
padding-left: 2px;
}*/
.noPad {
padding: 0;
}
.padLeft {
padding-left: 2px;
}
textarea.textarea {
width: 100% !important;
min-height: 100%;
height: 6em;
border-width: 1px 0 0 0;
/*border: none;*/
}
table.editor input:invalid {
color: red !important;
border-radius: 0;
border-bottom: 1px dotted red !important;
}
`;
const UI_RAW = 'ui-proxy-string-raw';
const MAX_PORT = 65535;
const onlyPort = function onlyPort(event) {
if (!event.ctrlKey && (/^\D$/.test(event.key) || /^\d$/.test(event.key) && parseInt(`${this.value}${event.key}`) > MAX_PORT)) {
event.preventDefault();
return false;
}
// Digits, Alt, Tab, Enter, etc.
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']];
const SwitchButton = (props) =>
(
<button
type="button" disabled={props.ifInputsDisabled}
class={'emoji' + ' ' + scopedCss.export + ' ' + scopedCss.only}
title={props.title}
onClick={props.onClick}
></button>
);
class TabledEditor extends Component {
constructor(props) {
super(props);
this.state = {
selectedNewType: 'HTTPS',
};
}
handleTypeSelect(that, event) {
that.setState({
selectedNewType: event.target.value,
});
}
showInvalidMessage(that, event) {
that.props.funs.showErrors({message: event.target.validationMessage});
}
handleModeSwitch(that) {
that.props.onSwitch();
}
handleAdd(that, event) {
const form = event.target;
const elements = Array.from(form.elements).reduce((acc, el, index) => {
acc[el.name || index] = el.value;
el.value = '';
return acc;
}, {});
const type = that.state.selectedNewType;
const hostname = elements.hostname;
const port = elements.port;
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();
that.handleAdd(that, event);
}
render(props) {
return (
<form onSubmit={linkEvent(this, this.handleSubmit)}>
<table class={scopedCss.editor}>
<thead>
<tr>
<th colspan="2">протокол</th> <th>домен / IP</th> <th>порт</th> <th>
<SwitchButton title="импорт/экспорт" onClick={linkEvent(this, this.handleModeSwitch)}/>
</th>
</tr>
</thead>
<tbody>
{/* ADD NEW PROXY STARTS. */}
<tr class={scopedCss.addPanel}>
<td colspan="2">
<select reqiured
class={scopedCss.noPad}
name="proxyType"
onChange={linkEvent(this, this.handleTypeSelect)}
>
{
PROXY_TYPE_LABEL_PAIRS.map(
([type, label]) =>
(<option value={type} selected={type === this.state.selectedNewType}>
{label || type}
</option>)
)
}
</select>
</td>
<td>
{/* LAST-2: HOSTNAME */}
<input required disabled={props.ifInputsDisabled}
class={scopedCss.noPad}
placeholder="89.140.125.17"
name="hostname"
onInvalid={linkEvent(this, this.showInvalidMessage)}
tabindex="1"
/>
</td>
<td>
{/* LAST-1: PORT */}
<input required type="number" disabled={props.ifInputsDisabled}
class={scopedCss.noPad + ' ' + scopedCss.padLeft} style="min-width: 4em"
placeholder="9150"
min="0" step="1" max={MAX_PORT} pattern="[0-9]{1,5}"
name="port"
onInvalid={linkEvent(this, this.showInvalidMessage)}
onkeydown={onlyPort}
tabindex="2"
/>
</td>
<td>
{/* LAST: ADD BUTTON */}
<input type="submit" disabled={props.ifInputsDisabled}
class={scopedCss.add + ' ' + scopedCss.only}
title="Добавить прокси" value="+"
/>
</td>
</tr>
{/* ADD NEW PROXY ENDS. */}
{
splitBySemi(this.props.proxyStringRaw).map((proxyAsString, index) => {
const [type, addr] = proxyAsString.trim().split(/\s+/);
const [hostname, port] = addr.split(':');
return (
<tr class={scopedCss.proxyRow}>
<td>
<button type="button" disabled={props.ifInputsDisabled}
class={scopedCss.only} title="Удалить"
onClick={() => this.handleDelete(this, {proxyAsString, index})}
>X</button>
</td><td>{type}</td><td>{hostname}</td><td>{port}</td>
<td>
<button type="button" disabled={props.ifInputsDisabled}
class={scopedCss.only} title="Повысить приоритет"
onClick={() => this.raisePriority(this, {proxyAsString, index})}
></button>
</td>
</tr>
);
})
}
</tbody>
</table>
</form>
);
}
}
const getInitState = () => ({
ifHasErrors: false,
stashedExports: false,
});
class ExportsEditor extends Component {
constructor(props) {
super(props);
this.state = getInitState();
}
resetState(that, event) {
that.setState(getInitState());
event.preventDefault();
}
getErrorsInStashedExports() {
if(this.state.stashedExports === false) {
return;
}
const errors = splitBySemi(this.state.stashedExports)
.map((proxyAsString) => {
const [rawType, addr, ...rest] = proxyAsString.split(/\s+/);
if (rest && rest.length) {
return new Error(
`"${rest.join(', ')}" кажется мне лишним. Вы забыли ";"?`
);
}
const knownTypes = PROXY_TYPE_LABEL_PAIRS.map(([type, label]) => type);
if( !knownTypes.includes(rawType.toUpperCase()) ) {
return new Error(
`Неверный тип ${rawType}. Известные типы: ${knownTypes.join(', ')}.`
);
}
if (!(addr && /^[^:]+:\d+$/.test(addr))) {
return new Error(
`Адрес прокси "${addr || ''}" не соответствует формату "<домен_или_IP>:<порт_из_цифр>".`
);
}
const [hostname, rawPort] = addr.split(':');
const port = parseInt(rawPort);
if (port < 0 || port > 65535) {
return new Error(
`Порт "${rawPort}" должен быть целым числом от 0 до 65535.`
);
}
return false;
}).filter((e) => e);
return errors && errors.length && errors;
}
handleModeSwitch(that, event) {
if (that.state.stashedExports !== false) {
const errors = that.getErrorsInStashedExports();
if (errors) {
that.setState({ifHasErrors: true});
that.props.funs.showErrors(...errors);
return;
}
that.props.setProxyStringRaw(that.state.stashedExports);
}
that.setState({
stashedExports: false,
ifHasErrors: false,
});
that.props.onSwitch();
}
handleTextareaChange(that, event) {
that.setState({
stashedExports: normilizeProxyString(event.target.value),
});
}
handleSubmit(that, event) {
event.preventDefault();
this.handleModeSwitch(this, event);
}
render(props) {
const reset = linkEvent(this, this.resetState);
return (
<form onSubmit={linkEvent(this, this.handleSubmit)}>
<table class={scopedCss.editor}>
<thead>
<tr>
<th style="width: 100%">
{
this.state.stashedExports === false
? 'Комментарии не поддерживаются!'
: (this.state.ifHasErrors
? (<span><a href="" onClick={reset}>Сбросьте изменения</a> или поправьте</span>)
: (<a href="" onClick={reset}>Сбросить изменения</a>)
)
}
</th>
<th style="width: 1%">
<SwitchButton title="Переключиться в табличный режим" onClick={linkEvent(this, this.handleModeSwitch)}/>
</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2"><textarea
class={scopedCss.textarea}
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()}
onChange={linkEvent(this, this.handleTextareaChange)}
value={
this.state.stashedExports !== false
? this.state.stashedExports
: (this.props.proxyStringRaw || '').replace(/\s*;\s*/g, ';\n')
}
/></td>
</tr>
</tbody>
</table>
</form>
);
}
}
const migrate = (proxyStringRaw) => {
/* In the old format \n\r? could be used as a separator. */
return proxyStringRaw
.replace(/#.*$/mg, '') // Strip comments.
.split( /(?:[^\S\r\n]*(?:;|\r?\n)+[^\S\r\n]*)+/g )
.map( (p) => p.trim() )
.filter((p) => p)
.join(';\n');
};
let waitingTillMount = [];
return class ProxyEditor extends Component {
constructor(props/*{ conf, onNewValue, ifInputsDisabled }*/) {
super(props);
const oldValue = typeof props.conf.value === 'string' && props.conf.value;
const newValue = migrate(oldValue || localStorage.getItem(UI_RAW) || '');
this.state = {
proxyStringRaw: newValue,
ifExportsMode: false,
};
this.handleSwitch = () => this.setState({ifExportsMode: !this.state.ifExportsMode});
waitingTillMount.push(newValue); // Wait till mount or eat bugs.
}
componentDidMount() {
if (waitingTillMount.length) {
this.mayEmitNewValue(this.props.value, waitingTillMount.pop());
waitingTillMount = [];
}
}
componentDidUnmount() {
waitingTillMount = [];
}
mayEmitNewValue(oldValue, newValue) {
if ( // Reject: 1) both `false` OR 2) both `===`.
( Boolean(oldValue) || Boolean(newValue) ) && oldValue !== newValue
) {
this.props.onNewValue(newValue);
}
}
render(originalProps) {
const props = Object.assign({
proxyStringRaw: this.state.proxyStringRaw,
onSwitch: this.handleSwitch,
setProxyStringRaw: (newValue) => {
const oldValue = this.state.proxyStringRaw;
localStorage.setItem(UI_RAW, newValue);
this.setState({proxyStringRaw: newValue});
this.mayEmitNewValue(oldValue, newValue);
},
}, originalProps);
return this.state.ifExportsMode
? createElement(ExportsEditor, props)
: createElement(TabledEditor, props);
};
}
};

View File

@ -0,0 +1,163 @@
import Inferno, { linkEvent } from 'inferno';
import Component from 'inferno-component';
import css from 'csjs-inject';
export default function getTabPannel({ flags, baseCss }) {
const scopedCss = css`
/*.tabContainer {
padding: 0;
}*/
.tabContainer li label {
display: inline-block; /* Needed for ::first-letter below. */
}
.tabContainer li label::first-letter {
text-transform: uppercase;
}
:root.ifInsideOptionsPage .tabContainer {
padding: 0.3em 0 0.4em 0;
}
:root.ifInsideOptionsPage nav.mainNav > section:not(:last-child):not([data-key=ownProxies]):not([data-key=mods]) {
border-bottom: 1px solid var(--cr-options-headline);
}
:root.ifInsideOptionsPage .navLabels {
display: none;
}
/* HIDE starts. */
:root:not(.ifInsideOptionsPage) .mainNav input:not(:checked) + section
{
/* Hide, but preclude width resizes. */
height: 0px !important;
line-height: 0px !important;
padding-top: 0 !important;
padding-bottom: 0 !important;
margin-top: 0 !important;
margin-bottom: 0 !important;
border: none !important;
display: block;
visibility: hidden;
transform: scaleY(0) !important;
}
:root:not(.ifInsideOptionsPage) .mainNav input:not(:checked) + section *
{
margin-top: 0 !important;
margin-bottom: 0 !important;
}
/* HIDE ends. */
.navLabels {
background-color: var(--cr-grey-panel);
text-align: center;
min-width: 24em;
}
.navLabels li label {
display: inline-block;
border: 1px solid var(--ribbon-color);
border-radius: 0.2em;
background-color: white;
color: var(--ribbon-color);
padding: 0.2em 0.3em 0.3em 0.2em;
line-height: 0.8em;
margin: 0.1em 0;
}
.navLabels li label:hover {
background-color: var(--blue-bg);
color: white;
}
/* LABELS starts. */
input[name="selectedTabLabel"]:checked + label:not(:hover)
{
background-color: var(--blue-bg);
color: white;
}
/* ★★★★★ */
.navLabels label:before {
content: '★';
padding-right: 0.1em;
visibility: hidden;
}
.navLabels li label:hover:before,
input[name="selectedTabLabel"]:checked + label:before
{
visibility: initial;
}
.navLabels li {
margin: 0 0.125em; /* 1.5px */
}
/* LABELS ends. */
.mainNav {
padding-top: 0.6em;
padding-bottom: 1em;
}
`;
if (flags.ifInsideOptionsPage) {
document.documentElement.classList.add(scopedCss.ifInsideOptionsPage);
}
return class TabPannel extends Component {
constructor(props) {
super(props);
this.state = {
chosenTabIndex: 0,
};
}
render(props) {
const indexedTabs = props.tabs.filter((tab) => tab.label);
const chosenTabKey = indexedTabs[this.state.chosenTabIndex].key;
return (
<div>
<nav class={scopedCss.navLabels}>
<ul class='horizontalList'>
{
indexedTabs.map((tab, index) =>
(<li>
<input type="radio" name="selectedTabLabel" id={'radioLabel' + index} checked={this.state.chosenTabIndex === index} class="off"/>
<label onClick={() => this.setState({chosenTabIndex: index})} for={'radioLabel' + index} class={scopedCss.navLabel}>{tab.label}</label>
</li>)
)
}
</ul>
<hr/>
</nav>
<nav class={'horPadded ' + scopedCss.mainNav}>
{
[].concat(...props.tabs.map((tab, index) => [
(<input type="checkbox" name="selectedTab" id={'radioTab' + index} checked={
chosenTabKey === tab.key || (props.alwaysShownWith[tab.key] || []).includes(chosenTabKey)
} class="off"/>),
(<section id={'tab' + index} class={scopedCss.tabContainer} data-key={tab.key}>{tab.content}</section>),
]))
}
</nav>
<hr/>
</div>);
}
};
};

View File

@ -0,0 +1,149 @@
export default function append(document, { flags }) {
// innerText converts \n to <br>, so:
document.querySelector('style').innerHTML = `
/* GLOBAL VARIABLES */
:root {
--ribbon-color: #4169e1;
--blue-bg: dodgerblue;
--default-grey: #bfbfbf;
--cr-options-headline: #d3d3d3;
--cr-icon-selected: #d7d7d7;
--cr-popup-border: #bababa;
--cr-grey-panel: #f2f2f2;
${ flags.ifInsideOptionsPage ? '' : 'max-width: 24em;' }
}
/* BASE ELEMENTS */
body {
margin: 0;
}
a, a:visited {
color: var(--ribbon-color);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
label {
user-select: none;
}
div, section, header, ul, ol {
margin: 0;
padding: 0;
}
header {
margin-bottom: 0.3em
}
ul, ol {
list-style-type: none;
}
li, .nowrap {
display: block;
white-space: nowrap;
word-break: keep-all;
}
li, li > * {
vertical-align: middle;
}
input[type="radio"], input[type="checkbox"] {
flex-shrink: 0;
}
input[type="radio"], label {
cursor: pointer;
}
hr {
border: none;
border-top: 1px solid var(--cr-popup-border);
margin: 0 0 0.6em 0;
padding: 0;
}
em {
font-style: normal;
text-decoration: underline;
}
/* IF INSIDE OPTIONS */
${
flags.ifInsideOptionsPage
? `
ul, ol {
margin-left: 0.4em;
}
` : `
ul, ol {
/*Here is a flex bug:
() antizapret [update] (i)
() anticensority very_long_foobar [update] (i) <- Sic!
Also: options page is wider, check it too.
But: fixed 100% width conflicts with margins/paddings.
So: use only when needed and avoid margins.
FYI: setting left-margin fixes problem too, but margins are not wanted.
Fix this problem below:
*/
display: inline-block;
min-width: 100%;
}
`
}
/* COMMON CLASSES */
.off {
display: none;
}
.horPadded {
padding-left: 1.4em;
padding-right: 1.4em;
}
.horizontalList,
.horizontalList li {
line-height: 100%;
}
.horizontalList li {
display: inline-block;
}
/* Flexes */
.horFlex {
display: flex;
align-items: baseline;
justify-content: space-between;
width: 100%;
}
.horFlex > input:not([type="button"]) {
align-self: flex-end;
}
/* Fonts/Icons */
@font-face {
font-family: "emoji";
src:url("../lib/fonts/emoji.woff") format("woff");
font-weight: normal;
font-style: normal;
}
.emoji {
font-family: "emoji";
}
svg.icon {
display: inline-block;
width: 1em;
height: 1em;
stroke-width: 0;
stroke: currentColor;
fill: currentColor;
}
`;
};

View File

@ -1,15 +1,57 @@
// @flow
import React from 'react';
import ReactDOM from 'react-dom';
let x:string; // webpack/babel must remove type here!
x = 'Search me in the compiled bundle!';
import Inferno from 'inferno';
import createElement from 'inferno-create-element';
import appendGlobalCss from './globalCss';
import css from 'csjs-inject';
import getApp from './components/App';
let t:string;
t = 12345; // Flow must detect error here!
chrome.runtime.getBackgroundPage( (bgWindow) =>
bgWindow.apis.errorHandlers.installListenersOn(
window, 'PUP', async() => {
// webpack/babel must transpile JSX to JS below:
ReactDOM.render(
<h1>Hello from React WITH BABEL</h1>,
document.getElementById('root')
let theState;
{
const apis = bgWindow.apis;
theState = {
utils: bgWindow.utils,
apis: apis,
flags: {
/* Shortcuts to boolean values. */
ifNotControlled: !apis.errorHandlers.ifControllable,
ifMini: apis.version.ifMini,
},
bgWindow,
};
}
// IF INSIDE OPTIONS TAB
const currentTab = await new Promise(
(resolve) => chrome.tabs.query(
{active: true, currentWindow: true},
([tab]) => resolve(tab)
)
);
theState.flags.ifInsideOptionsPage = !currentTab || currentTab.url.startsWith('chrome://extensions/?options=');
theState.currentTab = currentTab;
// STATE DEFINED, COMPOSE.
appendGlobalCss(document, theState);
// Extendable css classes.
Inferno.render(
createElement(getApp(theState), theState),
document.getElementById('app-root'),
);
// READY TO RENDER
document.documentElement.style.display = 'initial';
}
)
);

View File

@ -7,24 +7,39 @@ module.exports = (env, ...flags) => ({
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: `bundle${env === 'prod' ? '.min' : ''}.js`,
filename: `bundle.min.js`,
publicPath: './dist/',
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.jsx?$/,
include: path.join(__dirname, 'src'),
use: [{
use: [
{
loader: 'babel-loader',
options: { presets: ['react', 'flow'] },
}],
options: {
presets: ['flow'],
plugins: ['dynamic-import-webpack', 'inferno'],
},
},
/*{
loader: './lib/transform-loader?csjs-injectify',
},*/
],
}
],
},
resolve: {
aliasFields: [],
},
plugins: env === 'prod' ?
[
/* Production */
new BabiliPlugin(),
//new BabiliPlugin(),
] : [
/* Development */
],

View File

@ -13,8 +13,8 @@ acorn-dynamic-import@^2.0.0:
acorn "^4.0.3"
acorn@^4.0.3:
version "4.0.11"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.11.tgz#edcda3bd937e7556410d42ed5860f67399c794c0"
version "4.0.13"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"
acorn@^5.0.0:
version "5.0.3"
@ -83,10 +83,6 @@ arrify@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
asap@~2.0.3:
version "2.0.5"
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f"
asn1.js@^4.0.0:
version "4.9.1"
resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.9.1.tgz#48ba240b45a9280e94748990ba597d216617fd40"
@ -118,8 +114,8 @@ async-each@^1.0.0:
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"
async@^2.1.2:
version "2.4.0"
resolved "https://registry.yarnpkg.com/async/-/async-2.4.0.tgz#4990200f18ea5b837c2cc4f8c031a6985c385611"
version "2.4.1"
resolved "https://registry.yarnpkg.com/async/-/async-2.4.1.tgz#62a56b279c98a11d0987096a01cc3eeb8eb7bbd7"
dependencies:
lodash "^4.14.0"
@ -229,9 +225,13 @@ babel-helper-mark-eval-scopes@^0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/babel-helper-mark-eval-scopes/-/babel-helper-mark-eval-scopes-0.0.3.tgz#902f75aeb537336edc35eb9f52b6f09db7785328"
babel-helper-remove-or-void@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/babel-helper-remove-or-void/-/babel-helper-remove-or-void-0.0.1.tgz#f602790e465acf2dfbe84fb3dd210c43a2dd7262"
babel-helper-mark-eval-scopes@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/babel-helper-mark-eval-scopes/-/babel-helper-mark-eval-scopes-0.1.1.tgz#4554345edf9f2549427bd2098e530253f8af2992"
babel-helper-remove-or-void@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/babel-helper-remove-or-void/-/babel-helper-remove-or-void-0.1.1.tgz#9d7e1856dc6fafcb41b283a416730dc1844f66d7"
babel-helper-to-multiple-sequence-expressions@^0.0.4:
version "0.0.4"
@ -258,6 +258,20 @@ babel-messages@^6.23.0:
dependencies:
babel-runtime "^6.22.0"
babel-plugin-dynamic-import-webpack@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-webpack/-/babel-plugin-dynamic-import-webpack-1.0.1.tgz#26c24a1c1c9bf49184b30d5867562a4cbfa530d1"
dependencies:
babel-plugin-syntax-dynamic-import "^6.18.0"
babel-template "^6.16.0"
babel-plugin-inferno@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-inferno/-/babel-plugin-inferno-3.2.0.tgz#62ae1ac223e74e0d54f29fb196e06e358250d82a"
dependencies:
babel-plugin-syntax-jsx "^6.18.0"
inferno-vnode-flags "3.0.0"
babel-plugin-minify-builtins@^0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.0.2.tgz#f3be6121763c0c518d5ef82067cef4b615c9498c"
@ -272,11 +286,11 @@ babel-plugin-minify-constant-folding@^0.0.4:
jsesc "^2.4.0"
babel-plugin-minify-dead-code-elimination@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.1.4.tgz#18b6ecfab77c29caca061d8210fa3495001e4fa1"
version "0.1.6"
resolved "https://registry.yarnpkg.com/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.1.6.tgz#c5471346fb0a1046863fd765c784cba97d7b22e3"
dependencies:
babel-helper-mark-eval-scopes "^0.0.3"
babel-helper-remove-or-void "^0.0.1"
babel-helper-mark-eval-scopes "^0.1.1"
babel-helper-remove-or-void "^0.1.1"
lodash.some "^4.6.0"
babel-plugin-minify-flip-comparisons@^0.0.2:
@ -323,11 +337,15 @@ babel-plugin-minify-type-constructors@^0.0.4:
dependencies:
babel-helper-is-void-0 "^0.0.1"
babel-plugin-syntax-dynamic-import@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz#8d6a26229c83745a9982a441051572caa179b1da"
babel-plugin-syntax-flow@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz#4c3ab20a2af26aa20cd25995c398c4eb70310c8d"
babel-plugin-syntax-jsx@^6.3.13, babel-plugin-syntax-jsx@^6.8.0:
babel-plugin-syntax-jsx@^6.18.0, babel-plugin-syntax-jsx@^6.3.13, babel-plugin-syntax-jsx@^6.8.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
@ -343,22 +361,20 @@ babel-plugin-transform-inline-consecutive-adds@^0.0.2:
resolved "https://registry.yarnpkg.com/babel-plugin-transform-inline-consecutive-adds/-/babel-plugin-transform-inline-consecutive-adds-0.0.2.tgz#a58fcecfc09c08fbf9373a5a3e70746c03d01fc1"
babel-plugin-transform-member-expression-literals@^6.8.1:
version "6.8.1"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-member-expression-literals/-/babel-plugin-transform-member-expression-literals-6.8.1.tgz#60b78cb2b814ac71dd6104ef51c496c62e877337"
version "6.8.3"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-member-expression-literals/-/babel-plugin-transform-member-expression-literals-6.8.3.tgz#4eefa7fa1d3a86d05ac220bc3fdf96d5ed1835d6"
babel-plugin-transform-merge-sibling-variables@^6.8.2:
version "6.8.2"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-merge-sibling-variables/-/babel-plugin-transform-merge-sibling-variables-6.8.2.tgz#498acd07481ab340c1bad8b726c2fad1b8f644e5"
version "6.8.4"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-merge-sibling-variables/-/babel-plugin-transform-merge-sibling-variables-6.8.4.tgz#813a433f2d8c6989ee3a9c5e0cb46d3752d367a9"
babel-plugin-transform-minify-booleans@^6.8.0:
version "6.8.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.8.0.tgz#b1a48864a727847696b84eae36fa4d085a54b42b"
dependencies:
babel-runtime "^6.0.0"
version "6.8.2"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.8.2.tgz#8451579f706e702c1e1ab2756de5c8ea369cf07c"
babel-plugin-transform-property-literals@^6.8.1:
version "6.8.1"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-property-literals/-/babel-plugin-transform-property-literals-6.8.1.tgz#05ed01f6024820b18f1d0495c80fe287176bccd9"
version "6.8.3"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-property-literals/-/babel-plugin-transform-property-literals-6.8.3.tgz#0dcd2ecf0486c54c23f84817f911c4ab0e8d4b99"
babel-plugin-transform-react-display-name@^6.23.0:
version "6.23.0"
@ -393,26 +409,24 @@ babel-plugin-transform-regexp-constructors@^0.0.6:
resolved "https://registry.yarnpkg.com/babel-plugin-transform-regexp-constructors/-/babel-plugin-transform-regexp-constructors-0.0.6.tgz#0d92607f0d26268296980cb7c1dea5f2dd3e1e20"
babel-plugin-transform-remove-console@^6.8.1:
version "6.8.1"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.8.1.tgz#38f6a6ca1581e76b75fc2c6fdcf909deadee7d6a"
version "6.8.3"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.8.3.tgz#313441720324ad20af0fb009fa59e8102364626b"
babel-plugin-transform-remove-debugger@^6.8.1:
version "6.8.1"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-remove-debugger/-/babel-plugin-transform-remove-debugger-6.8.1.tgz#aabd0be107f8299094defe8e1ba8ccf4b114d07f"
version "6.8.3"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-remove-debugger/-/babel-plugin-transform-remove-debugger-6.8.3.tgz#5064f2d843b77ce660ebaa7760be30eb925bb93f"
babel-plugin-transform-remove-undefined@^0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-remove-undefined/-/babel-plugin-transform-remove-undefined-0.0.5.tgz#12ef11805e06e861dd2eb0c7cc041d2184b8f410"
babel-plugin-transform-simplify-comparison-operators@^6.8.1:
version "6.8.1"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-simplify-comparison-operators/-/babel-plugin-transform-simplify-comparison-operators-6.8.1.tgz#a307088e0d1c728081777fba568f4107396ab25c"
version "6.8.3"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-simplify-comparison-operators/-/babel-plugin-transform-simplify-comparison-operators-6.8.3.tgz#2e47e11e5f8dc33e97476e0263151d5fd57e1c4c"
babel-plugin-transform-undefined-to-void@^6.8.0:
version "6.8.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.8.0.tgz#bc5b6b4908d3b1262170e67cb3963903ddce167e"
dependencies:
babel-runtime "^6.0.0"
version "6.8.2"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.8.2.tgz#fe2b1d294eb05e87524eb93724dea6e2c3d66fa1"
babel-polyfill@^6.23.0:
version "6.23.0"
@ -479,14 +493,14 @@ babel-register@^6.24.1:
mkdirp "^0.5.1"
source-map-support "^0.4.2"
babel-runtime@^6.0.0, babel-runtime@^6.22.0:
babel-runtime@^6.22.0:
version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b"
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.10.0"
babel-template@^6.24.1:
babel-template@^6.16.0, babel-template@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.24.1.tgz#04ae514f1f93b3a2537f2a0f60a5a45fb8308333"
dependencies:
@ -528,8 +542,8 @@ babili-webpack-plugin@^0.0.11:
webpack-sources "^0.1.4"
babylon@^6.11.0, babylon@^6.15.0:
version "6.17.0"
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932"
version "6.17.1"
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.1.tgz#17f14fddf361b695981fe679385e4f1c01ebd86f"
balanced-match@^0.4.1:
version "0.4.2"
@ -693,8 +707,8 @@ chalk@^1.1.0:
supports-color "^2.0.0"
chokidar@^1.4.3, chokidar@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2"
version "1.7.0"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468"
dependencies:
anymatch "^1.3.0"
async-each "^1.0.0"
@ -707,7 +721,7 @@ chokidar@^1.4.3, chokidar@^1.6.1:
optionalDependencies:
fsevents "^1.0.0"
cipher-base@^1.0.0, cipher-base@^1.0.1:
cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.3.tgz#eeabf194419ce900da3018c207d212f2a6df0a07"
dependencies:
@ -757,6 +771,14 @@ concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
concat-stream@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7"
dependencies:
inherits "^2.0.3"
readable-stream "^2.2.2"
typedarray "^0.0.6"
console-browserify@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10"
@ -775,10 +797,6 @@ convert-source-map@^1.1.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5"
core-js@^1.0.0:
version "1.2.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
core-js@^2.4.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e"
@ -794,21 +812,25 @@ create-ecdh@^4.0.0:
bn.js "^4.1.0"
elliptic "^6.0.0"
create-hash@^1.1.0, create-hash@^1.1.1:
version "1.1.2"
resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.2.tgz#51210062d7bb7479f6c65bb41a92208b1d61abad"
create-hash@^1.1.0, create-hash@^1.1.1, create-hash@^1.1.2:
version "1.1.3"
resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.3.tgz#606042ac8b9262750f483caddab0f5819172d8fd"
dependencies:
cipher-base "^1.0.1"
inherits "^2.0.1"
ripemd160 "^1.0.0"
sha.js "^2.3.6"
ripemd160 "^2.0.0"
sha.js "^2.4.0"
create-hmac@^1.1.0, create-hmac@^1.1.2:
version "1.1.4"
resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.4.tgz#d3fb4ba253eb8b3f56e39ea2fbcb8af747bd3170"
create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
version "1.1.6"
resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.6.tgz#acb9e221a4e17bdb076e90657c42b93e3726cf06"
dependencies:
cipher-base "^1.0.3"
create-hash "^1.1.0"
inherits "^2.0.1"
ripemd160 "^2.0.0"
safe-buffer "^5.0.1"
sha.js "^2.4.8"
cryptiles@2.x.x:
version "2.0.5"
@ -831,6 +853,17 @@ crypto-browserify@^3.11.0:
public-encrypt "^4.0.0"
randombytes "^2.0.0"
csjs-inject@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/csjs-inject/-/csjs-inject-1.0.1.tgz#de22113c40b46cfe17d3d62a00c77c9d7da7527c"
dependencies:
csjs "^1.0.0"
insert-css "^0.2.0"
csjs@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/csjs/-/csjs-1.1.0.tgz#1b5753c6bd902da269deb369215585a5d8f1f380"
dashdash@^1.12.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
@ -842,18 +875,18 @@ date-now@^0.1.4:
resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"
debug@^2.1.1, debug@^2.2.0:
version "2.6.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.6.tgz#a9fa6fbe9ca43cf1e79f73b75c0189cbb7d6db5a"
version "2.6.8"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc"
dependencies:
ms "0.7.3"
ms "2.0.0"
decamelize@^1.0.0, decamelize@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
deep-extend@~0.4.0:
version "0.4.1"
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.1.tgz#efe4113d08085f4e6f9687759810f807469e2253"
version "0.4.2"
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f"
delayed-stream@~1.0.0:
version "1.0.0"
@ -910,12 +943,6 @@ emojis-list@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389"
encoding@^0.1.11:
version "0.1.12"
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
dependencies:
iconv-lite "~0.4.13"
enhanced-resolve@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.1.0.tgz#9f4b626f577245edcf4b2ad83d86e17f4f421dec"
@ -981,18 +1008,6 @@ extsprintf@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550"
fbjs@^0.8.9:
version "0.8.12"
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04"
dependencies:
core-js "^1.0.0"
isomorphic-fetch "^2.1.1"
loose-envify "^1.0.0"
object-assign "^4.1.0"
promise "^7.1.1"
setimmediate "^1.0.5"
ua-parser-js "^0.7.9"
filename-regex@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26"
@ -1117,13 +1132,13 @@ glob-parent@^2.0.0:
is-glob "^2.0.0"
glob@^7.0.0, glob@^7.0.5:
version "7.1.1"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
@ -1164,6 +1179,12 @@ has-unicode@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9"
hash-base@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-2.0.2.tgz#66ea1d856db4e8a5470cadf6fce23ae5244ef2e1"
dependencies:
inherits "^2.0.1"
hash.js@^1.0.0, hash.js@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.0.3.tgz#1332ff00156c0a0ffdd8236013d07b77a0451573"
@ -1214,10 +1235,6 @@ https-browserify@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82"
iconv-lite@~0.4.13:
version "0.4.17"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.17.tgz#4fdaa3b38acbc2c031b045d0edcdfe1ecab18c8d"
ieee754@^1.1.4:
version "1.1.8"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4"
@ -1226,6 +1243,38 @@ indexof@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d"
inferno-component@3.3.1, inferno-component@^3.1.2:
version "3.3.1"
resolved "https://registry.yarnpkg.com/inferno-component/-/inferno-component-3.3.1.tgz#ddf28ff0bf195b641d77e8e8097ba488730adca5"
dependencies:
inferno "3.3.1"
inferno-shared "3.1.1"
inferno-vnode-flags "^3.0.0"
inferno-create-element@^3.1.2:
version "3.3.1"
resolved "https://registry.yarnpkg.com/inferno-create-element/-/inferno-create-element-3.3.1.tgz#0babdb85e4c11f259a6fd10886ffc58820330c48"
dependencies:
inferno "3.3.1"
inferno-component "3.3.1"
inferno-shared "3.1.1"
inferno-vnode-flags "^3.0.0"
inferno-shared@3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/inferno-shared/-/inferno-shared-3.1.1.tgz#70376e29a56c53f6ba1e942191fe5cb710654f73"
inferno-vnode-flags@3.0.0, inferno-vnode-flags@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/inferno-vnode-flags/-/inferno-vnode-flags-3.0.0.tgz#f396390f3dafae3b76eea04d04eed6cf2004473b"
inferno@3.3.1, inferno@^3.2.0:
version "3.3.1"
resolved "https://registry.yarnpkg.com/inferno/-/inferno-3.3.1.tgz#376b7bcd065a1623c41904e42e0beb981e4552cd"
dependencies:
inferno-shared "3.1.1"
inferno-vnode-flags "^3.0.0"
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
@ -1233,7 +1282,7 @@ inflight@^1.0.4:
once "^1.3.0"
wrappy "1"
inherits@2, inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1:
inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
@ -1245,6 +1294,10 @@ ini@~1.3.0:
version "1.3.4"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e"
insert-css@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/insert-css/-/insert-css-0.2.0.tgz#d15789971662d9899c28977fb6220d5381d2451a"
interpret@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90"
@ -1329,10 +1382,6 @@ is-primitive@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575"
is-stream@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
is-typedarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
@ -1351,13 +1400,6 @@ isobject@^2.0.0:
dependencies:
isarray "1.0.0"
isomorphic-fetch@^2.1.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
dependencies:
node-fetch "^1.0.1"
whatwg-fetch ">=0.10.0"
isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
@ -1420,8 +1462,8 @@ jsprim@^1.2.2:
verror "1.3.6"
kind-of@^3.0.2:
version "3.2.0"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.0.tgz#b58abe4d5c044ad33726a8c1525b48cf891bff07"
version "3.2.2"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
dependencies:
is-buffer "^1.1.5"
@ -1482,7 +1524,7 @@ longest@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
loose-envify@^1.0.0, loose-envify@^1.1.0:
loose-envify@^1.0.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
dependencies:
@ -1538,7 +1580,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
minimatch@^3.0.0, minimatch@^3.0.2:
minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
dependencies:
@ -1558,21 +1600,14 @@ minimist@^1.2.0:
dependencies:
minimist "0.0.8"
ms@0.7.3:
version "0.7.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.3.tgz#708155a5e44e33f5fd0fc53e81d0d40a91be1fff"
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
nan@^2.3.0:
version "2.6.2"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45"
node-fetch@^1.0.1:
version "1.6.3"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.6.3.tgz#dc234edd6489982d58e8f0db4f695029abcd8c04"
dependencies:
encoding "^0.1.11"
is-stream "^1.0.1"
node-libs-browser@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.0.0.tgz#a3a59ec97024985b46e958379646f96c4b616646"
@ -1756,10 +1791,14 @@ path-type@^1.0.0:
pinkie-promise "^2.0.0"
pbkdf2@^3.0.3:
version "3.0.9"
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.9.tgz#f2c4b25a600058b3c3773c086c37dbbee1ffe693"
version "3.0.12"
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.12.tgz#be36785c5067ea48d806ff923288c5f750b6b8a2"
dependencies:
create-hmac "^1.1.2"
create-hash "^1.1.2"
create-hmac "^1.1.4"
ripemd160 "^2.0.1"
safe-buffer "^5.0.1"
sha.js "^2.4.8"
performance-now@^0.2.0:
version "0.2.0"
@ -1801,18 +1840,6 @@ process@^0.11.0:
version "0.11.10"
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
promise@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf"
dependencies:
asap "~2.0.3"
prop-types@^15.5.7, prop-types@~15.5.7:
version "15.5.8"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.8.tgz#6b7b2e141083be38c8595aa51fc55775c7199394"
dependencies:
fbjs "^0.8.9"
prr@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a"
@ -1867,24 +1894,6 @@ rc@^1.1.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"
react-dom@^15.5.4:
version "15.5.4"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.5.4.tgz#ba0c28786fd52ed7e4f2135fe0288d462aef93da"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.1.0"
object-assign "^4.1.0"
prop-types "~15.5.7"
react@^15.5.4:
version "15.5.4"
resolved "https://registry.yarnpkg.com/react/-/react-15.5.4.tgz#fa83eb01506ab237cdc1c8c3b1cea8de012bf047"
dependencies:
fbjs "^0.8.9"
loose-envify "^1.1.0"
object-assign "^4.1.0"
prop-types "^15.5.7"
read-pkg-up@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02"
@ -1900,7 +1909,7 @@ read-pkg@^1.0.0:
normalize-package-data "^2.3.2"
path-type "^1.0.0"
readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.2.6:
readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.2.2, readable-stream@^2.2.6:
version "2.2.9"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.9.tgz#cf78ec6f4a6d1eb43d26488cac97f042e74b7fc8"
dependencies:
@ -1997,9 +2006,12 @@ rimraf@2, rimraf@^2.5.1, rimraf@^2.6.1:
dependencies:
glob "^7.0.5"
ripemd160@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-1.0.1.tgz#93a4bbd4942bc574b69a8fa57c71de10ecca7d6e"
ripemd160@^2.0.0, ripemd160@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.1.tgz#0f4584295c53a3628af7e6d79aca21ce57d1c6e7"
dependencies:
hash-base "^2.0.0"
inherits "^2.0.1"
safe-buffer@^5.0.1:
version "5.0.1"
@ -2017,11 +2029,11 @@ set-immediate-shim@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61"
setimmediate@^1.0.4, setimmediate@^1.0.5:
setimmediate@^1.0.4:
version "1.0.5"
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
sha.js@^2.3.6:
sha.js@^2.4.0, sha.js@^2.4.8:
version "2.4.8"
resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.8.tgz#37068c2c476b6baf402d14a49c67f597921f634f"
dependencies:
@ -2096,8 +2108,8 @@ stream-browserify@^2.0.1:
readable-stream "^2.0.2"
stream-http@^2.3.1:
version "2.7.0"
resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.7.0.tgz#cec1f4e3b494bc4a81b451808970f8b20b4ed5f6"
version "2.7.1"
resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.7.1.tgz#546a51741ad5a6b07e9e31b0b10441a917df528a"
dependencies:
builtin-status-codes "^3.0.0"
inherits "^2.0.1"
@ -2118,10 +2130,10 @@ string_decoder@^0.10.25:
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
string_decoder@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.0.tgz#f06f41157b664d86069f84bdbdc9b0d8ab281667"
version "1.0.1"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.1.tgz#62e200f039955a6810d8df0a33ffc0f013662d98"
dependencies:
buffer-shims "~1.0.0"
safe-buffer "^5.0.1"
stringstream@~0.0.4:
version "0.0.5"
@ -2216,13 +2228,13 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
ua-parser-js@^0.7.9:
version "0.7.12"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb"
typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
uglify-js@^2.8.5:
version "2.8.23"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.23.tgz#8230dd9783371232d62a7821e2cf9a817270a8a0"
uglify-js@^2.8.27:
version "2.8.27"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.27.tgz#47787f912b0f242e5b984343be8e35e95f694c9c"
dependencies:
source-map "~0.5.1"
yargs "~3.10.0"
@ -2310,8 +2322,8 @@ webpack-sources@^0.2.3:
source-map "~0.5.3"
webpack@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.5.1.tgz#61742f0cf8af555b87460a9cd8bba2f1e3ee2fce"
version "2.6.1"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.6.1.tgz#2e0457f0abb1ac5df3ab106c69c672f236785f07"
dependencies:
acorn "^5.0.0"
acorn-dynamic-import "^2.0.0"
@ -2330,24 +2342,20 @@ webpack@^2.5.1:
source-map "^0.5.3"
supports-color "^3.1.0"
tapable "~0.2.5"
uglify-js "^2.8.5"
uglify-js "^2.8.27"
watchpack "^1.3.1"
webpack-sources "^0.2.3"
yargs "^6.0.0"
whatwg-fetch@>=0.10.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"
which-module@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f"
wide-align@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.0.tgz#40edde802a71fea1f070da3e62dcda2e7add96ad"
version "1.1.2"
resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710"
dependencies:
string-width "^1.0.1"
string-width "^1.0.2"
window-size@0.1.0:
version "0.1.0"

File diff suppressed because it is too large Load Diff