This commit is contained in:
Ilya Ig. Petrov 2017-02-05 15:17:59 +00:00
parent 5af9458eae
commit fda42ee307
9 changed files with 66 additions and 53 deletions

View File

@ -1,24 +1,33 @@
module.exports = {
"extends": ["airbnb"],
"env": {
"browser": true,
"webextensions": true,
"es6": true
extends: ['google'],
env: {
browser: true,
webextensions: true,
es6: true
},
"globals": {
"chrome": true
globals: {
chrome: true
},
"parserOptions": {
"sourceType": "script",
"ecmaVersion": 2017,
"ecmaFeatures": {
"impliedStrict": false
parserOptions: {
sourceType: 'script',
ecmaVersion: 2017,
ecmaFeatures: {
impliedStrict: false
}
},
"rules": {
"strict": ["error", "global"],
"no-console": "off",
"padded-blocks": "off",
"require-jsdoc": "off"
}
rules: {
strict: ['error', 'global'],
'no-console': 'off',
'padded-blocks': 'off',
'require-jsdoc': 'off',
// Taken from airbnb:
'max-len': ['error', 100, 2, {
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
}],
},
};

View File

@ -11,9 +11,6 @@
"license": "GPLv3",
"devDependencies": {
"eslint": "^3.15.0",
"eslint-config-airbnb": "^14.0.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^3.0.2",
"eslint-plugin-react": "^6.9.0"
"eslint-config-google": "^0.7.1"
}
}

View File

@ -102,7 +102,7 @@
}
localStorage.setItem(key, JSON.stringify(value));
}
};
},

View File

@ -59,7 +59,7 @@
return (privates._strToHostObj[hostStr] = {host: hostStr});
}
};
const _getHostObj = function _getHostObj(hostStr) {
@ -186,9 +186,9 @@
console.log('Canonized hosts/ips:', hostSet.size + '/' + ipSet.size);
return [ipSet, hostSet];
}
};
const self = window.apis.ipToHost = {
window.apis.ipToHost = {
persist() {
@ -247,7 +247,12 @@
console.log('Update all:', hostArr);
const promises = hostArr.map(
(hostStr) => new Promise( (resolve) => this._addAsync(hostStr, (...args) => resolve(args) ) )
(hostStr) => new Promise(
(resolve) => this._addAsync(
hostStr,
(...args) => resolve(args)
)
)
);
Promise.all( promises ).then( (cbsRes) => {

View File

@ -85,7 +85,7 @@
const pacMods = getCurrentConfigs();
return Object.keys(configs).reduce((arr, key) => {
const conf = configs[key]
const conf = configs[key];
if(typeof(conf.index) === 'number') {
arr[conf.index] = conf;
conf.value = pacMods[key];
@ -144,7 +144,7 @@
this.excluded = [];
for(const host of Object.keys(this.exceptions)) {
if (this.exceptions[host]) {
this.included.push(host)
this.included.push(host);
} else {
this.excluded.push(host);
}
@ -320,7 +320,7 @@
return cb(null, res, ...warns);
}
const hosts = par.map( (ps) => ps.split(/\s+/)[1] )
const hosts = par.map( (ps) => ps.split(/\s+/)[1] );
window.apis.ipToHost.replaceAllAsync(
hosts,
(...args) => cb(...args, ...warns)

View File

@ -26,7 +26,6 @@
const chromified = window.utils.chromified;
const checkChromeError = window.utils.checkChromeError;
const clarify = window.apis.errorsLib.clarify;
const clarifyThen = window.apis.errorsLib.clarifyThen;
const Warning = window.apis.errorsLib.Warning;
@ -332,7 +331,7 @@
}
const warns = pacWarns;
if (ipsErr) {
warns.push(ipsErr)
warns.push(ipsErr);
}
this.pushToStorageAsync(
(pushErr) => cb(pacErr || pushErr, null, ...warns)

View File

@ -144,11 +144,6 @@
)
);
};
const isInsideTabWithIp = function isInsideTabWithIp(requestDetails) {
};
const onRequest = function onRequest(requestDetails) {

View File

@ -75,7 +75,11 @@ chrome.runtime.getBackgroundPage( (backgroundPage) =>
return document.getElementById(id);
};
const checkChosenProvider = () => currentProviderRadio().checked = true;
const checkChosenProvider = () => {
currentProviderRadio().checked = true;
};
const showErrors = (err, ...warns) => {
@ -234,7 +238,7 @@ chrome.runtime.getBackgroundPage( (backgroundPage) =>
const ifInsideOptions = !currentTab || currentTab.url.startsWith('chrome://extensions/?options=');
if (ifInsideOptions) {
document.documentElement.classList.add('if-options-page')
document.documentElement.classList.add('if-options-page');
}
// EXCEPTIONS PANEL
@ -347,7 +351,7 @@ chrome.runtime.getBackgroundPage( (backgroundPage) =>
excEditor.dataset.moveCursorTo = nu;
window.setTimeout(moveCursorIfNeeded, 0);
}
};
const originalHost = excEditor.value.trim();
const ifInit = !event;
@ -558,11 +562,11 @@ HTTPS 11.22.33.44:8080;">${conf.value || localStorage.getItem(uiRaw) || ''}</tex
(str) =>
/^(?:DIRECT|(?:(?:HTTPS?|PROXY|SOCKS(?:4|5)?)\s+\S+))$/g
.test(str)
)
);
if (!ifValid) {
return showErrors(new TypeError(
'Неверный формат своих прокси. Свертесь с <a href="https://rebrand.ly/ac-own-proxy" data-in-bg="true">документацией</a>.'
))
));
}
oldMods[customProxyStringKey] = taVal;
} else {
@ -575,7 +579,11 @@ HTTPS 11.22.33.44:8080;">${conf.value || localStorage.getItem(uiRaw) || ''}</tex
'Применяем настройки...',
(cb) => pacKitchen.keepCookedNowAsync(oldMods, cb),
'Настройки применены.',
() => { document.getElementById('apply-mods').disabled = true; }
() => {
document.getElementById('apply-mods').disabled = true;
}
);
};