multiple extensions spawned

This commit is contained in:
Ilya Ig. Petrov 2015-12-07 15:53:47 +05:00
parent 92dedaf7b5
commit 917b88843b
469 changed files with 95182 additions and 0 deletions

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

8
extensions/chromium/index.html Executable file
View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script src="./pages/alert.js"></script>
</body>
</html>

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script src="alert.js"></script>
</body>
</html>

View File

@ -0,0 +1 @@
alert('YES!');

View File

@ -0,0 +1,3 @@
# antizapret-chrome-extension
РосКомНадзор заблокировал очередной сайт?

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -0,0 +1,806 @@
'use strict';
function installRkn(cb) {
var RKN = {
csvMirrors: [
'https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv',
'http://sourceforge.net/p/z-i/code-0/HEAD/tree/dump.csv?format=raw',
'https://www.assembla.com/spaces/z-i/git/source/master/dump.csv?_format=raw'
],
lastUpdate: (new Date(0)).toString(),
updatePeriodInMinutes: 7*60,
ifEnabled: false,
/*
ifBlockedFunAsStr: "function(host) {}"
*/
updateIcon: function(cb) {
var cb = cb || () => {};
return chrome.browserAction.setIcon(
{ path: this.ifEnabled ? './assets/icons/rkn.png' : './assets/icons/rkn-disabled.png' },
cb
);
},
disable: function(cb) {
var cb = cb || () => {};
this.checkForUpdates( (err, res) => {
if (err) return cb(err);
this.ifEnabled = false;
return this.persistToStorage( () => this.updateIcon(cb) );
});
},
enable: function(cb) {
var cb = cb || () => {};
return chrome.proxy.settings.clear({/*All*/}, () => {
this.ifEnabled = true;
return this.persistToStorage( () => this.updateIcon(cb) );
});
},
switch: function(cb) {
var cb = cb || () => {};
return this.ifEnabled ? this.disable(cb) : this.enable(cb);
},
persistToStorage: function(cb) {
var cb = cb || () => {};
var storage = {};
for(var key of Object.keys(this))
storage[key] = JSON.stringify(this[key]);
chrome.storage.local.set(storage, cb);
},
syncWithStorage: function(cb) {
var cb = cb || () => {};
chrome.storage.local.get(
null,
storage => {
if (!Object.keys(storage).length)
return this.persistToStorage(cb);
for(var key of Object.keys(storage))
this[key] = JSON.parse( storage[key] );
return cb(this);
}
);
},
install: function(cb) {
chrome.storage.local.clear( () => this.disable(cb) );
},
rescheduleUpdate: function(period) {
var checkNewBlocked = 'Check for new blocked sites';
var period = period || this.updatePeriodInMinutes;
chrome.alarms.clearAll( ifWasCleared => {
chrome.alarms.create(checkNewBlocked, {
delayInMinutes: period
});
chrome.alarms.onAlarm.addListener( alarm => {
if (alarm.name === checkNewBlocked) {
this.checkForUpdate();
}
});
});
},
checkForUpdates: function(url, cb) {
if (!url || !cb)
return this._useTheMirrorsLuke(this.checkForUpdates, url, cb);
var req = new XMLHttpRequest();
var ifAsync = true;
req.open('HEAD', url, ifAsync);
req.onload = event => {
if (req.status === 404)
return cb(req.status);
var date = Date.parse(req.getResponseHeader('Date'));
if (date > Date.parse(this.lastUpdate))
return this.update(url, cb);
return cb(null);
};
req.send(null);
},
update: function(url, cb) {
if (!url || !cb)
return this._useTheMirrorsLuke(this.update, url, cb);
var req = new XMLHttpRequest();
req.open('GET', url, true);
req.onload = event => {
this.lastUpdate = (new Date()).toString();
this.applyCsv(req.responseText);
this.persistToStorage();
this.rescheduleUpdate();
return cb(null, req.responseText);
};
req.send(null);
},
applyCsv: function(csv) {
var columnsSep = ';';
var valuesSep = /\s*\|\s*/g;
var ips = [], hosts = [], urls = [], orgs = [], date, reason;
var lines = csv.trim().split(/\r?\n/g).slice(1);
lines.forEach( function(line) {
var values = line.split( columnsSep );
var newIps = values.shift().split( valuesSep );
var newHosts = values.shift().split( valuesSep ).map( punycode.toASCII ).map( function(h) { return h.replace(/\.+$/g); } );
var newUrls = values.shift().split( valuesSep );
var newOrgs = values.shift().split( valuesSep );
var newDate = values.pop();
var newReason = values.join(';');
ips.push.apply(ips, newIps);
hosts.push.apply(hosts, newHosts);
});
function toHash(arr) {
var res = {};
arr.forEach( el => res[el] = true );
return res;
}
var ipsHash = toHash(ips);
var hostsHash = toHash(hosts);
// Remove duplicates and sort.
var ips = Object.keys(ipsHash).sort();
var hosts = Object.keys(hostsHash).sort();
// REVERSED HOSTS SWITCH
function populateTrie(trie, doms) {
var dom = doms.pop();
if (!doms.length || doms.length === 1 && doms[0] === 'www') {
trie[''] = trie[''] || [];
trie[''].push( dom )
return trie;
}
if (trie[''] && trie[''].indexOf(dom) !== -1) // Subdomain of a blocked domain.
return trie;
trie[dom] = trie[dom] || {};
populateTrie( trie[dom], doms );
return trie;
}
var trie = {};
hosts.forEach( function(host) {
var doms = host.replace(/\.+$/).split('.');
populateTrie(trie, doms);
});
function trieToSwitch(trie, indent) {
var _indent = indent || '';
var indent = _indent + ' ';
var keys = Object.keys(trie).sort();
if (!trie[''] && keys.length === 1) {
var key = keys[0];
return _indent + 'if (doms.pop() === "'+key+'")\n'+ trieToSwitch(trie[key], indent);
}
var cases = '';
if (trie['']) {
var values = trie[''].sort();
if (values.length === 1 && keys.length === 1)
return _indent + 'return doms.pop() === "'+values[0]+'";\n';
cases =
values.filter( function(v) { return v; } ).map( function(val) { return indent +'case "'+val+'":\n'; } ).join('') + indent +' return true;\n';
delete trie[''];
keys = Object.keys(trie).sort();
}
cases += keys.filter( function(k) { return k; } ).map(
function(key) {
var tmp = trieToSwitch( trie[key], indent+' ');
if (!/^\s*return/.test(tmp))
tmp += indent+' break;\n';
return indent +'case "'+key+'":\n' +tmp;
}).join('');
return ''
+ _indent +'switch( doms.pop() ) {\n'
+ cases
+ _indent +'}\n';
}
var ifBlocked = host => {
var doms = host.replace(/\.+$/).split('.');
"{SWITCH}"
return false;
}
this.ifBlockedFunAsStr = ifBlocked.toString().replace('"{SWITCH}"', trieToSwitch(trie, ' '));
return this.ifBlockedFunAsStr;
},
_useTheMirrorsLuke: function(method, url, cb) {
if (!cb)
if (typeof url === 'function') {
cb = url;
url = undefined;
} else cb = () => {};
var it;
if (typeof url === 'string')
it = [url][Symbol.iterator]();
else
it = url || this.csvMirrors[Symbol.iterator]();
var self = this;
function cbb(err, res) {
var cur = it.next();
if (cur.done || !err)
return cb(err, res);
method.call(self, cur.value, cbb);
}
var url = it.next().value;
return method.call(this, url, cbb);
}
};
RKN.install(cb);
//==============PUNYCODE====================================
/*! https://mths.be/punycode v1.3.2 by @mathias */
;(function(root) {
/** Detect free variables */
var freeExports = typeof exports == 'object' && exports &&
!exports.nodeType && exports;
var freeModule = typeof module == 'object' && module &&
!module.nodeType && module;
var freeGlobal = typeof global == 'object' && global;
if (
freeGlobal.global === freeGlobal ||
freeGlobal.window === freeGlobal ||
freeGlobal.self === freeGlobal
) {
root = freeGlobal;
}
/**
* The `punycode` object.
* @name punycode
* @type Object
*/
var punycode,
/** Highest positive signed 32-bit float value */
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
/** Bootstring parameters */
base = 36,
tMin = 1,
tMax = 26,
skew = 38,
damp = 700,
initialBias = 72,
initialN = 128, // 0x80
delimiter = '-', // '\x2D'
/** Regular expressions */
regexPunycode = /^xn--/,
regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
/** Error messages */
errors = {
'overflow': 'Overflow: input needs wider integers to process',
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
'invalid-input': 'Invalid input'
},
/** Convenience shortcuts */
baseMinusTMin = base - tMin,
floor = Math.floor,
stringFromCharCode = String.fromCharCode,
/** Temporary variable */
key;
/*--------------------------------------------------------------------------*/
/**
* A generic error utility function.
* @private
* @param {String} type The error type.
* @returns {Error} Throws a `RangeError` with the applicable error message.
*/
function error(type) {
throw new RangeError(errors[type]);
}
/**
* A generic `Array#map` utility function.
* @private
* @param {Array} array The array to iterate over.
* @param {Function} callback The function that gets called for every array
* item.
* @returns {Array} A new array of values returned by the callback function.
*/
function map(array, fn) {
var length = array.length;
var result = [];
while (length--) {
result[length] = fn(array[length]);
}
return result;
}
/**
* A simple `Array#map`-like wrapper to work with domain name strings or email
* addresses.
* @private
* @param {String} domain The domain name or email address.
* @param {Function} callback The function that gets called for every
* character.
* @returns {Array} A new string of characters returned by the callback
* function.
*/
function mapDomain(string, fn) {
var parts = string.split('@');
var result = '';
if (parts.length > 1) {
// In email addresses, only the domain name should be punycoded. Leave
// the local part (i.e. everything up to `@`) intact.
result = parts[0] + '@';
string = parts[1];
}
// Avoid `split(regex)` for IE8 compatibility. See #17.
string = string.replace(regexSeparators, '\x2E');
var labels = string.split('.');
var encoded = map(labels, fn).join('.');
return result + encoded;
}
/**
* Creates an array containing the numeric code points of each Unicode
* character in the string. While JavaScript uses UCS-2 internally,
* this function will convert a pair of surrogate halves (each of which
* UCS-2 exposes as separate characters) into a single code point,
* matching UTF-16.
* @see `punycode.ucs2.encode`
* @see <https://mathiasbynens.be/notes/javascript-encoding>
* @memberOf punycode.ucs2
* @name decode
* @param {String} string The Unicode input string (UCS-2).
* @returns {Array} The new array of code points.
*/
function ucs2decode(string) {
var output = [],
counter = 0,
length = string.length,
value,
extra;
while (counter < length) {
value = string.charCodeAt(counter++);
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
// high surrogate, and there is a next character
extra = string.charCodeAt(counter++);
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
} else {
// unmatched surrogate; only append this code unit, in case the next
// code unit is the high surrogate of a surrogate pair
output.push(value);
counter--;
}
} else {
output.push(value);
}
}
return output;
}
/**
* Creates a string based on an array of numeric code points.
* @see `punycode.ucs2.decode`
* @memberOf punycode.ucs2
* @name encode
* @param {Array} codePoints The array of numeric code points.
* @returns {String} The new Unicode string (UCS-2).
*/
function ucs2encode(array) {
return map(array, function(value) {
var output = '';
if (value > 0xFFFF) {
value -= 0x10000;
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
value = 0xDC00 | value & 0x3FF;
}
output += stringFromCharCode(value);
return output;
}).join('');
}
/**
* Converts a basic code point into a digit/integer.
* @see `digitToBasic()`
* @private
* @param {Number} codePoint The basic numeric code point value.
* @returns {Number} The numeric value of a basic code point (for use in
* representing integers) in the range `0` to `base - 1`, or `base` if
* the code point does not represent a value.
*/
function basicToDigit(codePoint) {
if (codePoint - 48 < 10) {
return codePoint - 22;
}
if (codePoint - 65 < 26) {
return codePoint - 65;
}
if (codePoint - 97 < 26) {
return codePoint - 97;
}
return base;
}
/**
* Converts a digit/integer into a basic code point.
* @see `basicToDigit()`
* @private
* @param {Number} digit The numeric value of a basic code point.
* @returns {Number} The basic code point whose value (when used for
* representing integers) is `digit`, which needs to be in the range
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
* used; else, the lowercase form is used. The behavior is undefined
* if `flag` is non-zero and `digit` has no uppercase form.
*/
function digitToBasic(digit, flag) {
// 0..25 map to ASCII a..z or A..Z
// 26..35 map to ASCII 0..9
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
}
/**
* Bias adaptation function as per section 3.4 of RFC 3492.
* https://tools.ietf.org/html/rfc3492#section-3.4
* @private
*/
function adapt(delta, numPoints, firstTime) {
var k = 0;
delta = firstTime ? floor(delta / damp) : delta >> 1;
delta += floor(delta / numPoints);
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
delta = floor(delta / baseMinusTMin);
}
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
}
/**
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
* symbols.
* @memberOf punycode
* @param {String} input The Punycode string of ASCII-only symbols.
* @returns {String} The resulting string of Unicode symbols.
*/
function decode(input) {
// Don't use UCS-2
var output = [],
inputLength = input.length,
out,
i = 0,
n = initialN,
bias = initialBias,
basic,
j,
index,
oldi,
w,
k,
digit,
t,
/** Cached calculation results */
baseMinusT;
// Handle the basic code points: let `basic` be the number of input code
// points before the last delimiter, or `0` if there is none, then copy
// the first basic code points to the output.
basic = input.lastIndexOf(delimiter);
if (basic < 0) {
basic = 0;
}
for (j = 0; j < basic; ++j) {
// if it's not a basic code point
if (input.charCodeAt(j) >= 0x80) {
error('not-basic');
}
output.push(input.charCodeAt(j));
}
// Main decoding loop: start just after the last delimiter if any basic code
// points were copied; start at the beginning otherwise.
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
// `index` is the index of the next character to be consumed.
// Decode a generalized variable-length integer into `delta`,
// which gets added to `i`. The overflow checking is easier
// if we increase `i` as we go, then subtract off its starting
// value at the end to obtain `delta`.
for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
if (index >= inputLength) {
error('invalid-input');
}
digit = basicToDigit(input.charCodeAt(index++));
if (digit >= base || digit > floor((maxInt - i) / w)) {
error('overflow');
}
i += digit * w;
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
if (digit < t) {
break;
}
baseMinusT = base - t;
if (w > floor(maxInt / baseMinusT)) {
error('overflow');
}
w *= baseMinusT;
}
out = output.length + 1;
bias = adapt(i - oldi, out, oldi == 0);
// `i` was supposed to wrap around from `out` to `0`,
// incrementing `n` each time, so we'll fix that now:
if (floor(i / out) > maxInt - n) {
error('overflow');
}
n += floor(i / out);
i %= out;
// Insert `n` at position `i` of the output
output.splice(i++, 0, n);
}
return ucs2encode(output);
}
/**
* Converts a string of Unicode symbols (e.g. a domain name label) to a
* Punycode string of ASCII-only symbols.
* @memberOf punycode
* @param {String} input The string of Unicode symbols.
* @returns {String} The resulting Punycode string of ASCII-only symbols.
*/
function encode(input) {
var n,
delta,
handledCPCount,
basicLength,
bias,
j,
m,
q,
k,
t,
currentValue,
output = [],
/** `inputLength` will hold the number of code points in `input`. */
inputLength,
/** Cached calculation results */
handledCPCountPlusOne,
baseMinusT,
qMinusT;
// Convert the input in UCS-2 to Unicode
input = ucs2decode(input);
// Cache the length
inputLength = input.length;
// Initialize the state
n = initialN;
delta = 0;
bias = initialBias;
// Handle the basic code points
for (j = 0; j < inputLength; ++j) {
currentValue = input[j];
if (currentValue < 0x80) {
output.push(stringFromCharCode(currentValue));
}
}
handledCPCount = basicLength = output.length;
// `handledCPCount` is the number of code points that have been handled;
// `basicLength` is the number of basic code points.
// Finish the basic string - if it is not empty - with a delimiter
if (basicLength) {
output.push(delimiter);
}
// Main encoding loop:
while (handledCPCount < inputLength) {
// All non-basic code points < n have been handled already. Find the next
// larger one:
for (m = maxInt, j = 0; j < inputLength; ++j) {
currentValue = input[j];
if (currentValue >= n && currentValue < m) {
m = currentValue;
}
}
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
// but guard against overflow
handledCPCountPlusOne = handledCPCount + 1;
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
error('overflow');
}
delta += (m - n) * handledCPCountPlusOne;
n = m;
for (j = 0; j < inputLength; ++j) {
currentValue = input[j];
if (currentValue < n && ++delta > maxInt) {
error('overflow');
}
if (currentValue == n) {
// Represent delta as a generalized variable-length integer
for (q = delta, k = base; /* no condition */; k += base) {
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
if (q < t) {
break;
}
qMinusT = q - t;
baseMinusT = base - t;
output.push(
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
);
q = floor(qMinusT / baseMinusT);
}
output.push(stringFromCharCode(digitToBasic(q, 0)));
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
delta = 0;
++handledCPCount;
}
}
++delta;
++n;
}
return output.join('');
}
/**
* Converts a Punycode string representing a domain name or an email address
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
* it doesn't matter if you call it on a string that has already been
* converted to Unicode.
* @memberOf punycode
* @param {String} input The Punycoded domain name or email address to
* convert to Unicode.
* @returns {String} The Unicode representation of the given Punycode
* string.
*/
function toUnicode(input) {
return mapDomain(input, function(string) {
return regexPunycode.test(string)
? decode(string.slice(4).toLowerCase())
: string;
});
}
/**
* Converts a Unicode string representing a domain name or an email address to
* Punycode. Only the non-ASCII parts of the domain name will be converted,
* i.e. it doesn't matter if you call it with a domain that's already in
* ASCII.
* @memberOf punycode
* @param {String} input The domain name or email address to convert, as a
* Unicode string.
* @returns {String} The Punycode representation of the given domain name or
* email address.
*/
function toASCII(input) {
return mapDomain(input, function(string) {
return regexNonASCII.test(string)
? 'xn--' + encode(string)
: string;
});
}
/*--------------------------------------------------------------------------*/
/** Define the public API */
punycode = {
/**
* A string representing the current Punycode.js version number.
* @memberOf punycode
* @type String
*/
'version': '1.3.2',
/**
* An object of methods to convert from JavaScript's internal character
* representation (UCS-2) to Unicode code points, and back.
* @see <https://mathiasbynens.be/notes/javascript-encoding>
* @memberOf punycode
* @type Object
*/
'ucs2': {
'decode': ucs2decode,
'encode': ucs2encode
},
'decode': decode,
'encode': encode,
'toASCII': toASCII,
'toUnicode': toUnicode
};
/** Expose `punycode` */
// Some AMD build optimizers, like r.js, check for specific condition patterns
// like the following:
if (
typeof define == 'function' &&
typeof define.amd == 'object' &&
define.amd
) {
define('punycode', function() {
return punycode;
});
} else if (freeExports && freeModule) {
if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+
freeModule.exports = punycode;
} else { // in Narwhal or RingoJS v0.7.0-
for (key in punycode) {
punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
}
}
} else { // in Rhino or a web browser
root.punycode = punycode;
}
}(window));
}

View File

@ -0,0 +1,31 @@
{
"manifest_version": 2,
"name": "РосКомНадзор3",
"description": "Безопасный Интернет от РосКомНадзор с возможностью отказаться.",
"version": "0.1",
"permissions": [
"proxy",
"storage",
"alarms",
"declarativeWebRequest",
"*://*/*"
],
"icons": {
"128": "./assets/icons/rkn.png"
},
"background": {
"scripts": ["install.js"]
},
"browser_action": {
"default_popup": "./pages/popup.html"
},
"options_page": "./pages/options.html",
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"author": "ilyaigpetrov@gmail.com",
"homepage_url": "https://github.com/ilyaigpetrov/consorship-free",
"short_name": "Антизапрет"
}

View File

@ -0,0 +1,45 @@
nl.drew.cp.lang.s['en'] = {
"msgOn":"on",
"msgOff":"off",
"allSites":"All Sites",
"thisSite":"This Site",
"listsTab":"Lists Sites",
"userProTab":"User proxys",
"proxyEnabled": "Proxy enabled for all sites",
"anonymityEnabled": "Enable anonymity for all sites",
"locationForAll": "Use proxy location for all sites:",
"torForAll": "TOR for all sites",
"notUseProxy":"Not use proxy for this site",
"alwUseProxy":"Always use proxy for this site",
"anonForSite":"Enable anonymity for this site",
"locSite":"Use proxy location for this site:",
"torForSite": "TOR for this site",
"setHttp":"Use proxy for https traffic",
"setHelp":"Tips enable",
"proxyOff": "proxy <b>off</b> for this site",
"proxyEnabledHelp": "if you disable this option, you will have access to all proxies, not just public and increases speed",
"anonymityEnabledHelp": "Anonymity allows you to hide your IP, but it also imposes some restrictions. Some sites may block the access because of anonymity.",
"locationForAllHelp": "If possible, the proxy will be chosen this country",
"notUseProxyHelp":"even if proxy is enabled for all sites",
"alwUseProxyHelp":"even if proxy is disabled for all sites",
"anonForSiteHelp":"only for this site",
"locSiteHelp":"",
"torAllHelp":"send all traffic through TOR",
"torSiteHelp":"send site traffic through TOR",
"EmptyURL":"Empty URL",
"WrongURLformat":"Wrong URL format",
"WrongURLprotocol":"Wrong URL protocol",
"ThisURLalreadyadded":"This URL already added",
"Nooptionschanged":"No options changed",
"interfaceLanguage":"Interface language",
"uProxyNameFormat": "Wrong format of the list name. Must consist of letters, digits and _-",
"uProxyNameAlreadyHave": "Already there is the proxy named ",
"errUproxyIpFormat": "Proxy is defined as IP:PORT, for example: <b>127.0.0.1:443</b> or <b>proxyname.example:1080</b>"
}

View File

@ -0,0 +1,11 @@
{
"chrome_extension_name": {
"message": "Proxy for Chrome"
},
"chrome_extension_description": {
"message": "Free proxy servers for you"
},
"browser_action_title": {
"message": "on/off"
}
}

View File

@ -0,0 +1,45 @@
nl.drew.cp.lang.s['ru'] = {
"msgOn":"вкл",
"msgOff":"выкл",
"allSites":"Все сайты",
"thisSite":"Текущий сайт",
"listsTab":"Списки сайтов",
"userProTab":"Мои прокси",
"proxyOff": "прокси <b>выкл.</b> для этого сайта",
"proxyEnabled": "Вкл. прокси для всех сайтов",
"anonymityEnabled": "Вкл. анонимность для всех сайтов",
"locationForAll": "Для всех сайтов использовать локацию:",
"torForAll": "Все сайты через TOR",
"notUseProxy":"Для этого сайта не использовать прокси",
"alwUseProxy":"Всегда использовать прокси для этого сайта",
"anonForSite":"Вкл. анонимность для этого сайта",
"locSite":"Для этого сайта использовать локацию:",
"torForSite": "Этот сайт через TOR",
"setHttp":"Использовать прокси для https протокола",
"setHelp":"Включить подсказки",
"locationForAllHelp": "По возможности будет выбран прокси этой страны",
"proxyEnabledHelp": "если отключить эту опцию, то будут доступны все прокси, а не только общественные, что может значительно увеличить скорость",
"anonymityEnabledHelp": "Анонимность позволяет скрыть свой IP, но одновременно накладывает некоторые ограничения. Некоторые сайты могут прекратить ваш доступ из-за анонимности.",
"notUseProxyHelp":"даже если прокси включен для всех сайтов",
"alwUseProxyHelp":"даже если прокси отключен для всех сайтов",
"anonForSiteHelp":"только для этого сайта",
"locSiteHelp":"",
"torAllHelp":"направить весь трафик через шлюз tor",
"torSiteHelp":"использовать tor для доступа к этому сайту",
"EmptyURL":"Поле URL пустое",
"WrongURLformat":"Неправильный формать URL",
"WrongURLprotocol":"Неправильный протокол URL",
"ThisURLalreadyadded":"Этот адрес уже добавлен",
"Nooptionschanged":"Нет измененных опций",
"interfaceLanguage":"Язык интерфейса",
"errUProxyNameFormat": "Имя прокси должно состоять из букв, цифр, тире и знака подчеркивания. От 3 до 9 символов",
"errUProxyNameAlreadyHave": "Уже есть прокси с именем ",
"errUproxyIpFormat": "Прокси задается в виде IP:PORT, например 127.0.0.1:443 или proxyname.example:1080"
}

View File

@ -0,0 +1,11 @@
{
"chrome_extension_name": {
"message": "Proxy for Chrome"
},
"chrome_extension_description": {
"message": "Бесплатные прокси сервера для вашего браузера"
},
"browser_action_title": {
"message": "babyList - вкл/выкл"
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="js/core/vars.js"></script>
<script type="text/javascript" charset="utf-8" src="js/lib/ls.js"></script>
<script type="text/javascript" charset="utf-8" src="js/lib/lib.js"></script>
<script type="text/javascript" charset="utf-8" src="js/lib/icoanimation.js"></script>
<script type="text/javascript" charset="utf-8" src="js/core/conf.js"></script>
<script type="text/javascript" charset="utf-8" src="js/core/proxy.js"></script>
<script type="text/javascript" charset="utf-8" src="js/core/api.js"></script>
<script type="text/javascript" charset="utf-8" src="js/core/lib.js"></script>
<script type="text/javascript" charset="utf-8" src="js/core/interf.js"></script>
<script type="text/javascript" charset="utf-8" src="js/core/header.js"></script>
<script type="text/javascript" charset="utf-8" src="js/core/cache.js"></script>
<script type="text/javascript" charset="utf-8" src="js/core/core.js"></script>
</head>
<body>
<img src="im/ico19-2.png"/>
<img src="im/ico19g-2.png"/>
<img src="im/co/ru.png"/>
<img src="im/co/de.png"/>
<img src="im/co/uk.png"/>
<img src="im/co/fr.png"/>
<img src="im/co/nl.png"/>
</body>
</html>

View File

@ -0,0 +1,245 @@
div#foot {
position: absolute;
bottom: 0;
display: block;
width: 100%;
margin-bottom: 5px;
padding-top: 5px;
}
.cp-os-light {
font-family: 'Open Sans', sans-serif;
font-weight: 300;
}
.cp-os {
font-family: 'Open Sans', sans-serif;
font-weight: 400;
}
.cp-os-bold {
font-family: 'Open Sans', sans-serif;
font-weight: 700;
}
.cp-os-condensed {
font-family: 'Open Sans Condensed', sans-serif;
font-weight: 300;
}
.cp-os-condensed-bold {
font-family: 'Open Sans Condensed', sans-serif;
font-weight: 700;
}
.cp-pointer {
cursor: pointer;
}
.cp-pointer:hover {
color: #777777;
}
#mainproxy {
font-size: 14px;
}
td#mainproxyco {
width: 44px;
}
#mainproxyco img {
height: 28px;
width: 42px;
box-shadow: 0 0 1px 1px #dfdfdf;
}
#listtable img {
width: 20px;
}
#hideip img {
height: 30px;
}
.uk-text-success {
color: #5B7900;
}
.uk-tab li {
font-family: 'Open Sans', sans-serif;
font-weight: 700;
font-size: 12px;
}
#configproxy > li {
padding: 20px 20px 20px 15px;
}
#configproxy > li.uk-active {
background-color: #fff;
}
a, .uk-tab > li > a {
color: #006D9A;
}
#flags-all, #flags-site {
position: relative;
}
.cp-flags {
display: none;
position: relative;
}
.cp-uproxy {
padding-left: 7px;
display: inline-block;
*display: inline;
*zoom: 1;
}
.cp-uproxy > div {
}
.cp-flag {
cursor: pointer;
display: inline-block;
*display: inline;
*zoom: 1;
background-color: #fff;
border: 1px solid #fff;
border-radius: 3px;
padding: 5px 5px 5px 5px;
-webkit-transition: background-color 0.3s;
transition: background-color 0.3s;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.cp-flag img {
margin: 0;
padding: 0;
width: 32px;
box-shadow: 0 0 2px 1px #efefef;
}
label img {
margin: 0;
padding: 0;
width: 22px;
box-shadow: 0 0 2px 1px #d0d0d0;
}
.cp-flag:hover {
border: 1px solid #ccc;
box-shadow: 0 0 2px 1px #dfdfdf;
}
.cp-flag.is-active {
border: 1px solid #fff;
background: #B8BDC6;
/*
background: -webkit-radial-gradient(center, ellipse cover, #ffffff 0%, #646473 200%);
*/
}
.cp-uproxy.is-active {
}
.cp-flag.is-active:after, .cp-uproxy.is-active:after {
font-family: FontAwesome;
content: "\f058";
position: absolute;
margin-left: -22px;
top: 26px;
color: #80A000;
}
tr, td, table {
border: 0px solid #da314b;
}
.cp-uppercase {
text-transform: uppercase;
}
::selection {
background: #006D9A;
}
.uk-form {
font-size: 11px;
}
.cp-newhost input {
margin-left: -3px;
}
.uk-form input[type="text"] {
height: 23px;
}
td.cp-act {
width: 54px;
}
.cp-pname, .cp-pproto {
font-size: 14px;
}
.cp-pip {
font-weight: bold;
font-size: 12px;
}
.cp-pproto select {
height: 23px;
}
#addproxy {
font-size: 24px;
margin-right: 18px;
}
.uk-badge {
background: #006D9A;
}
.uk-badge a {
color: #fff;
}
.uk-dropdown {
width: 200px;
}
.uk-dropdown-scrollable {
max-height: 140px;
}
.cp-vspace {
height: 7px;
padding: 0;
margin: 0;
}
.cp-unvis {
visibility: hidden;
}
.uk-scrollable-text {
max-height: 300px;
min-height: 100px;
height: auto;
}

View File

@ -0,0 +1,99 @@
/*! UIkit 2.12.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
/* ========================================================================
Component: Notify
========================================================================== */
/*
* Message container for positioning
*/
.uk-notify {
position: fixed;
top: 10px;
left: 10px;
z-index: 1040;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 350px;
}
/* Position modifiers
========================================================================== */
.uk-notify-top-right,
.uk-notify-bottom-right {
left: auto;
right: 10px;
}
.uk-notify-top-center,
.uk-notify-bottom-center {
left: 50%;
margin-left: -175px;
}
.uk-notify-bottom-left,
.uk-notify-bottom-right,
.uk-notify-bottom-center {
top: auto;
bottom: 10px;
}
/* Responsiveness
========================================================================== */
/* Phones portrait and smaller */
@media (max-width: 479px) {
/*
* Fit in small screen
*/
.uk-notify {
left: 10px;
right: 10px;
width: auto;
margin: 0;
}
}
/* Sub-object: `uk-notify-message`
========================================================================== */
.uk-notify-message {
position: relative;
margin-bottom: 10px;
padding: 15px;
background: #444444;
color: #ffffff;
font-size: 16px;
line-height: 22px;
cursor: pointer;
border: 1px solid #444444;
border-radius: 4px;
}
/* Close in notify
========================================================================== */
.uk-notify-message > .uk-close {
visibility: hidden;
float: right;
}
.uk-notify-message:hover > .uk-close {
visibility: visible;
}
/* Modifier: `uk-alert-info`
========================================================================== */
.uk-notify-message-primary {
background: #ebf7fd;
color: #2d7091;
border-color: rgba(45, 112, 145, 0.3);
}
/* Modifier: `uk-alert-success`
========================================================================== */
.uk-notify-message-success {
background: #f2fae3;
color: #659f13;
border-color: rgba(101, 159, 19, 0.3);
}
/* Modifier: `uk-notify-message-warning`
========================================================================== */
.uk-notify-message-warning {
background: #fffceb;
color: #e28327;
border-color: rgba(226, 131, 39, 0.3);
}
/* Modifier: `uk-notify-message-danger`
========================================================================== */
.uk-notify-message-danger {
background: #fff1f0;
color: #d85030;
border-color: rgba(216, 80, 48, 0.3);
}

View File

@ -0,0 +1,123 @@
/* jquery.switcher - 1.2.4
* https://github.com/djanix/jquery-switcher
* Copyright (c) 2014-11-04 - */
.switcher {
cursor: pointer;
/*
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
*/
font-size: 12px;
text-transform: uppercase;
display: inline-block;
*display: inline;
*zoom: 1;
}
.switcher .content {
position: relative;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.switcher .text {
display: none;
overflow: hidden;
text-align: center;
white-space: nowrap;
}
.switcher.is-disabled {
opacity: 0.4;
}
.switcher.default {
background-color: #efeff0;
border: 1px solid #eee;
border-radius: 4px;
line-height: 26px;
min-width: 80px;
padding: 2px;
-webkit-transition: background-color 0.3s;
transition: background-color 0.3s;
margin: 4px 6px 0px 0px;
}
.switcher.default input {
display: none;
}
.switcher.default .slider {
background-color: white;
border-radius: 4px;
-webkit-box-shadow: 0 0 2px 1px #dfdfdf;
box-shadow: 0 0 2px 1px #dfdfdf;
height: 26px;
left: 0;
position: absolute;
top: 0;
-webkit-transform: translateX(0%);
-ms-transform: translateX(0%);
transform: translateX(0%);
-webkit-transition: -webkit-transform 0.3s;
transition: transform 0.3s;
width: 50%;
z-index: 2;
}
.switcher.default .text {
width: 50%;
display: inline-block;
*display: inline;
*zoom: 1;
}
.switcher.default .textYes {
color: white;
float: left;
}
.switcher.default .textNo {
color: #9f9f9f;
float: right;
}
.switcher.default.is-active {
background-color: #80A000;
}
.switcher.default.is-active .slider {
-webkit-transform: translateX(100%);
-ms-transform: translateX(100%);
transform: translateX(100%);
}
.switcher.short {
cursor: pointer;
display: inline-block;
margin-right: 5px;
vertical-align: middle;
margin-bottom: 3px;
}
.switcher.short input {
display: none;
}
.switcher.short .content {
border: 1px solid #aaaaaa;
border-radius: 50%;
height: 18px;
padding: 0;
width: 18px;
}
.switcher.short .slider {
background-color: #519b20;
border-radius: 50%;
height: 12px;
margin: 3px;
opacity: 0;
-webkit-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-transition: all 0.2s;
transition: all 0.2s;
width: 12px;
}
.switcher.short.is-active .slider {
opacity: 1;
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 921 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,509 @@
nl.drew.cp.core.api = function() {
var api = {port:null};
api.handling = function(port, msg) {
var lid;
nl.drew.cp.core.api.port = port;
if (msg.msg == "log") {
nl.drew.cp.lib.debug(msg.param);
} else {
if (msg.msg == "on") {
nl.drew.cp.core.main.start(true);
nl.drew.cp.core.cache.nowProxyAllClean();
} else {
if (msg.msg == "off") {
nl.drew.cp.core.main.stop();
nl.drew.cp.core.cache.nowProxyAllClean();
} else {
if (msg.msg == "icoupd") {
nl.drew.cp.core.interf.icoupdate2();
} else {
if (msg.msg == "set") {
if (msg.param == "https") {
if (typeof msg.val != "undefined") {
nl.drew.cp.state.https = msg.val;
nl.drew.cp.ls.set("https", nl.drew.cp.state.https, false);
}
} else {
if (msg.param == "uproxyremove") {
if (typeof msg.val != "undefined" && typeof msg.val.co != "undefined" && msg.val.co) {
var delUproxyList = nl.drew.cp.core.lib.inUproxyList(msg.val.co);
if (delUproxyList > -1) {
nl.drew.cp.state.uproxys.splice(delUproxyList, 1);
nl.drew.cp.ls.set("uproxys", nl.drew.cp.state.uproxys, false);
nl.drew.cp.core.cache.nowProxyAllClean();
nl.drew.cp.core.filter.inst();
}
}
} else {
if (msg.param == "uproxy") {
if (typeof msg.val != "undefined" && typeof msg.val.oldname != "undefined" && msg.val.oldname) {
var i = nl.drew.cp.core.lib.inUproxyList(msg.val.oldname);
var newname = msg.val.proto.toUpperCase() + " " + msg.val.ip + ":" + msg.val.port;
if (i > -1) {
nl.drew.cp.state.uproxys[i].co = msg.val.co;
nl.drew.cp.state.uproxys[i].proto = msg.val.proto;
nl.drew.cp.state.uproxys[i].ip = msg.val.ip;
nl.drew.cp.state.uproxys[i].port = msg.val.port;
nl.drew.cp.state.uproxys[i].name = newname;
nl.drew.cp.state.uproxys[i].off = msg.val.hasOwnProperty("off") ? msg.val.off : nl.drew.cp.state.uproxys[i].off;
if (nl.drew.cp.state.listContrySite.hasOwnProperty(msg.val.oldname)) {
nl.drew.cp.state.listContrySite[msg.val.co] = nl.drew.cp.lib.clone(nl.drew.cp.state.listContrySite[msg.val.oldname]);
delete nl.drew.cp.state.listContrySite[msg.val.oldname];
}
} else {
nl.drew.cp.state.uproxys.push({ip:msg.val.ip, port:msg.val.port, sport:"", proto:msg.val.proto, co:msg.val.co, name:newname, off:msg.val.hasOwnProperty("off") ? msg.val.off : false});
}
nl.drew.cp.core.cache.nowProxyAllClean();
nl.drew.cp.ls.set("uproxys", nl.drew.cp.state.uproxys, false);
nl.drew.cp.core.filter.inst();
}
} else {
if (msg.param == "liston") {
if (typeof msg.val != "undefined") {
nl.drew.cp.core.lib.liston(msg.val);
nl.drew.cp.core.api.postMessage({param:"lists", val:nl.drew.cp.core.lib.globalListGen()});
}
} else {
if (msg.param == "listoff") {
if (typeof msg.val != "undefined") {
nl.drew.cp.core.lib.listoff(msg.val);
}
} else {
if (msg.param == "listonrest") {
if (typeof msg.val != "undefined") {
nl.drew.cp.core.lib.liston(msg.val, true);
}
} else {
if (msg.param == "listonremove") {
if (typeof msg.val != "undefined") {
var nosend = false;
if (typeof msg.val.nosend != "undefined") {
nosend = msg.val.nosend;
}
nl.drew.cp.core.lib.listoff(msg.val.host, true, nosend);
}
} else {
if (msg.param == "listoffrest") {
if (typeof msg.val != "undefined") {
if (nl.drew.cp.core.lib.inOffSiteListAllParam(msg.val) == -1) {
nl.drew.cp.state.offlist.push(msg.val);
}
}
nl.drew.cp.core.cache.nowProxyClean({host:msg.val});
} else {
if (msg.param == "listoffremove") {
if (typeof msg.val != "undefined") {
lid = nl.drew.cp.core.lib.inOffSiteListAllParam(msg.val);
if (lid == -1) {
return;
}
nl.drew.cp.state.offlist.splice(lid, 1);
nl.drew.cp.ls.set("offlist", nl.drew.cp.state.offlist, false);
nl.drew.cp.core.cache.nowProxyClean({host:msg.val});
}
} else {
if (msg.param == "globalalwproxy") {
if (typeof msg.val != "undefined") {
nl.drew.cp.state.alwProxy = msg.val;
nl.drew.cp.ls.set("globalalwproxy", nl.drew.cp.state.alwProxy, false);
nl.drew.cp.core.cache.nowProxyAllClean();
nl.drew.cp.core.filter.inst();
}
} else {
if (msg.param == "contrymain") {
if (typeof msg.val != "undefined" && msg.val) {
nl.drew.cp.state.contryMain = msg.val;
nl.drew.cp.ls.set("contrymain", nl.drew.cp.state.contryMain, false);
nl.drew.cp.core.cache.nowProxyAllClean();
nl.drew.cp.core.filter.inst();
}
} else {
if (msg.param == "tor") {
if (typeof msg.val != "undefined") {
if (typeof msg.val.all != "undefined") {
nl.drew.cp.state.torAll = msg.val.all;
nl.drew.cp.ls.set("torall", nl.drew.cp.state.torAll, false);
}
nl.drew.cp.core.api.sendtoPortAnonymitynow();
}
} else {
if (msg.param == "torsite") {
if (typeof msg.val != "undefined" && typeof msg.val.host != "undefined" && msg.val.host) {
chrome.tabs.getSelected(null, function(tab) {
var purl = nl.drew.cp.lib.parseUrl(tab.url);
if ((typeof msg.val.list == "undefined" || !msg.val.list) && (!purl.allow || msg.val.host != purl.host)) {
return;
}
if (msg.val.val) {
if (nl.drew.cp.core.lib.inTorSiteList(msg.val.host) > -1) {
return;
}
nl.drew.cp.state.listTorSite.push(msg.val.host);
} else {
var ind = nl.drew.cp.core.lib.inTorSiteList(msg.val.host);
if (ind == -1) {
return;
}
nl.drew.cp.state.listTorSite.splice(ind, 1);
}
nl.drew.cp.ls.set("torSite", nl.drew.cp.state.listTorSite, false);
nl.drew.cp.core.interf.icoupdate7(tab.url);
nl.drew.cp.core.api.sendtoPortAnonymitynow(msg.val);
});
}
} else {
if (msg.param == "anonymity") {
if (typeof msg.val != "undefined") {
if (typeof msg.val.all != "undefined") {
nl.drew.cp.state.anonymityAll = msg.val.all;
nl.drew.cp.ls.set("anonymityall", nl.drew.cp.state.anonymityAll, false);
}
nl.drew.cp.core.api.sendtoPortAnonymitynow();
}
} else {
if (msg.param == "anonymitysite") {
if (typeof msg.val != "undefined" && typeof msg.val.host != "undefined" && msg.val.host) {
chrome.tabs.getSelected(null, function(tab) {
var purl = nl.drew.cp.lib.parseUrl(tab.url);
if ((typeof msg.val.list == "undefined" || !msg.val.list) && (!purl.allow || msg.val.host != purl.host)) {
return;
}
if (msg.val.val) {
if (nl.drew.cp.core.lib.inAnSiteList(msg.val.host) > -1) {
return;
}
nl.drew.cp.state.listAnSite.push(msg.val.host);
} else {
var ind = nl.drew.cp.core.lib.inAnSiteList(msg.val.host);
if (ind == -1) {
return;
}
nl.drew.cp.state.listAnSite.splice(ind, 1);
}
lid = nl.drew.cp.core.lib.checkListOnOff(msg.val.host);
if (lid > -1) {
nl.drew.cp.state.offlist.splice(lid, 1);
}
nl.drew.cp.ls.set("anSite", nl.drew.cp.state.listAnSite, false);
var nosend = false;
if (typeof msg.val.nosend != "undefined") {
nosend = msg.val.nosend;
}
if (!nosend) {
nl.drew.cp.core.api.sendtoPortAnonymitynow(msg.val);
}
nl.drew.cp.core.api.sendList(msg.val.listRequest, msg.val.host);
});
}
} else {
if (msg.param == "nonproxy") {
if (typeof msg.val != "undefined" && typeof msg.val.host != "undefined" && msg.val.host) {
chrome.tabs.getSelected(null, function(tab) {
var purl = nl.drew.cp.lib.parseUrl(tab.url);
nl.drew.cp.core.cache.nowProxyClean(purl);
if ((typeof msg.val.list == "undefined" || !msg.val.list) && (!purl.allow || msg.val.host != purl.host)) {
return;
}
if (msg.val.val) {
if (nl.drew.cp.core.lib.inNonProxySiteList(msg.val.host) > -1) {
return;
}
nl.drew.cp.state.listNonProxySite.push(msg.val.host);
var ind = nl.drew.cp.core.lib.inAlwProxySiteList(msg.val.host);
if (ind > -1) {
nl.drew.cp.state.listAlwProxySite.splice(ind, 1);
}
} else {
var ind = nl.drew.cp.core.lib.inNonProxySiteList(msg.val.host);
if (ind == -1) {
return;
}
nl.drew.cp.state.listNonProxySite.splice(ind, 1);
}
lid = nl.drew.cp.core.lib.checkListOnOff(msg.val.host);
if (lid > -1) {
nl.drew.cp.state.offlist.splice(lid, 1);
}
nl.drew.cp.ls.set("alwProxySite", nl.drew.cp.state.listAlwProxySite, false);
nl.drew.cp.ls.set("nonProxySite", nl.drew.cp.state.listNonProxySite, false);
nl.drew.cp.core.filter.inst();
var nosend = false;
if (typeof msg.val.nosend != "undefined") {
nosend = msg.val.nosend;
}
if (!nosend) {
nl.drew.cp.core.api.sendtoPortInProxyList(msg.val);
}
nl.drew.cp.core.api.sendList(msg.val.listRequest, msg.val.host);
});
}
} else {
if (msg.param == "alwproxy") {
if (typeof msg.val != "undefined" && typeof msg.val.host != "undefined" && msg.val.host) {
chrome.tabs.getSelected(null, function(tab) {
var purl = nl.drew.cp.lib.parseUrl(tab.url);
nl.drew.cp.core.cache.nowProxyClean(purl);
if ((typeof msg.val.list == "undefined" || !msg.val.list) && (!purl.allow || msg.val.host != purl.host)) {
return;
}
if (msg.val.val) {
if (nl.drew.cp.core.lib.inAlwProxySiteListEqually(msg.val.host) > -1) {
return;
}
nl.drew.cp.state.listAlwProxySite.push(msg.val.host);
var ind = nl.drew.cp.core.lib.inNonProxySiteList(msg.val.host);
if (ind > -1) {
nl.drew.cp.state.listNonProxySite.splice(ind, 1);
}
} else {
var ind = nl.drew.cp.core.lib.inAlwProxySiteListEqually(msg.val.host);
if (ind == -1) {
return;
}
nl.drew.cp.state.listAlwProxySite.splice(ind, 1);
}
lid = nl.drew.cp.core.lib.checkListOnOff(msg.val.host);
if (lid > -1) {
nl.drew.cp.state.offlist.splice(lid, 1);
}
nl.drew.cp.ls.set("alwProxySite", nl.drew.cp.state.listAlwProxySite, false);
nl.drew.cp.ls.set("nonProxySite", nl.drew.cp.state.listNonProxySite, false);
nl.drew.cp.core.filter.inst();
var nosend = false;
if (typeof msg.val.nosend != "undefined") {
nosend = msg.val.nosend;
}
if (!nosend) {
nl.drew.cp.core.api.sendtoPortInProxyList(msg.val);
}
nl.drew.cp.core.api.sendList(msg.val.listRequest, msg.val.host);
});
}
} else {
if (msg.param == "contrysite") {
if (typeof msg.val != "undefined" && typeof msg.val.host != "undefined" && msg.val.host) {
chrome.tabs.getSelected(null, function(tab) {
var purl = nl.drew.cp.lib.parseUrl(tab.url);
nl.drew.cp.core.cache.nowProxyClean(purl);
if ((typeof msg.val.list == "undefined" || !msg.val.list) && (!purl.allow || msg.val.host != purl.host)) {
return;
}
var key = msg.val.val;
if (key != "main") {
nl.drew.cp.core.lib.delContrySiteList(msg.val.host);
if (typeof nl.drew.cp.state.listContrySite[key] == "undefined") {
nl.drew.cp.state.listContrySite[key] = [];
}
nl.drew.cp.state.listContrySite[key].push(msg.val.host);
} else {
nl.drew.cp.core.lib.delContrySiteList(msg.val.host);
}
lid = nl.drew.cp.core.lib.checkListOnOff(msg.val.host);
if (lid > -1) {
nl.drew.cp.state.offlist.splice(lid, 1);
}
nl.drew.cp.ls.set("contrySiteList", nl.drew.cp.state.listContrySite, false);
nl.drew.cp.core.proxy.getNowProxy(null, purl, true, true);
nl.drew.cp.core.filter.inst();
var nosend = false;
if (typeof msg.val.nosend != "undefined") {
nosend = msg.val.nosend;
}
if (!nosend) {
nl.drew.cp.core.api.sendtoPortInProxyList(msg.val);
if (typeof msg.val.list != "undefined" && msg.val.list) {
nl.drew.cp.core.api.sendtoPortContrys(msg.val);
}
nl.drew.cp.core.api.sendtoPortAnonymitynow(msg.val);
}
nl.drew.cp.core.api.sendList(msg.val.listRequest, msg.val.host);
});
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
} else {
if (msg.msg == "get") {
if (msg.param == "https") {
port.postMessage({param:"https", val:nl.drew.cp.state.https});
} else {
if (msg.param == "globalalwproxy") {
port.postMessage({param:"globalalwproxy", val:nl.drew.cp.state.alwProxy});
} else {
if (msg.param == "isenabled") {
port.postMessage({param:"isenabled", val:nl.drew.cp.state.isenabled});
} else {
if (msg.param == "state") {
port.postMessage({param:"state", val:nl.drew.cp.state.state});
} else {
if (msg.param == "uproxy") {
port.postMessage({param:"uproxy", val:{uproxy:nl.drew.cp.state.uproxys, template:nl.drew.cp.config.proxyTemplate}});
} else {
if (msg.param == "mainproxy") {
nl.drew.cp.core.api.sendtoPortMainproxy();
} else {
if (msg.param == "contrys") {
nl.drew.cp.core.api.sendtoPortContrys(msg.val);
} else {
if (msg.param == "anonymity") {
nl.drew.cp.core.api.sendtoPortAnonymity(msg.val);
} else {
if (msg.param == "anonymitynow") {
nl.drew.cp.core.api.sendtoPortAnonymitynow(msg.val);
} else {
if (msg.param == "tor") {
nl.drew.cp.core.api.sendtoPortTor(msg.val);
} else {
if (msg.param == "nonproxyalwproxy") {
nl.drew.cp.core.api.sendtoPortInProxyList(msg.val);
} else {
if (msg.param == "lists") {
nl.drew.cp.core.api.sendList(true);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
};
api.sendList = function(isSend, host) {
if (!isSend) {
return;
}
nl.drew.cp.core.api.postMessage({param:"lists", val:nl.drew.cp.core.lib.globalListGen(), host:host});
};
api.sendtoPortInProxyList = function(val) {
if (nl.drew.cp.core.api.port) {
chrome.tabs.getSelected(null, function(tab) {
var purl = nl.drew.cp.lib.parseUrl(tab.url);
purl.host = nl.drew.cp.core.api.preSendtoPort(val, purl);
nl.drew.cp.core.api.postMessage({param:"nonproxyalwproxy", val:{host:purl.host, nonproxy:nl.drew.cp.core.lib.inNonProxySiteList(purl.host), alwproxy:nl.drew.cp.core.lib.inAlwProxySiteList(purl.host)}});
});
}
};
api.sendtoPortAnonymitynow = function(val) {
if (nl.drew.cp.core.api.port) {
chrome.tabs.getSelected(null, function(tab) {
var purl = nl.drew.cp.lib.parseUrl(tab.url);
purl.host = nl.drew.cp.core.api.preSendtoPort(val, purl);
var nowProxy = nl.drew.cp.core.proxy.getNowProxy(null, purl, true, true);
if (nowProxy && nowProxy.co.length > 2) {
nl.drew.cp.core.api.postMessage({param:"anonymitynow", val:[false, false]});
} else {
nl.drew.cp.core.api.postMessage({param:"anonymitynow", val:[nl.drew.cp.core.header.getAnonymityNow(purl.host), nl.drew.cp.core.header.getTorNow(purl.host)]});
}
nl.drew.cp.core.interf.icoupdate7(tab.url);
});
}
};
api.sendtoPortAnonymity = function(val) {
if (nl.drew.cp.core.api.port) {
chrome.tabs.getSelected(null, function(tab) {
var purl = nl.drew.cp.lib.parseUrl(tab.url);
purl.host = nl.drew.cp.core.api.preSendtoPort(val, purl);
nl.drew.cp.core.api.postMessage({param:"anonymity", val:nl.drew.cp.core.header.getAnonymity(purl.host)});
});
}
};
api.sendtoPortTor = function(val) {
if (nl.drew.cp.core.api.port) {
chrome.tabs.getSelected(null, function(tab) {
var purl = nl.drew.cp.lib.parseUrl(tab.url);
purl.host = nl.drew.cp.core.api.preSendtoPort(val, purl);
nl.drew.cp.core.api.postMessage({param:"tor", val:nl.drew.cp.core.header.getTor(purl.host)});
});
}
};
api.sendtoPortState = function() {
nl.drew.cp.core.api.postMessage({param:"state", val:nl.drew.cp.state.state});
};
api.sendtoPortMainproxy = function(nowProxys) {
if (nl.drew.cp.core.api.port) {
chrome.tabs.getSelected(null, function(tab) {
if (nl.drew.cp.state.started) {
var purl = nl.drew.cp.lib.parseUrl(tab.url);
var nowProxy = {};
if (nl.drew.cp.state.alwProxy) {
nowProxy = {name:"&nbsp; proxy server", co:"public", allow:true};
} else {
nowProxy = nl.drew.cp.core.proxy.getNowProxy(nowProxys, purl, true, true);
}
if (purl.allow && nowProxy == null) {
nowProxy = {host:purl.host};
}
nl.drew.cp.core.interf.icoupdate7(tab.url);
nl.drew.cp.core.api.sendtoPort({param:"mainproxy", val:nowProxy});
} else {
nl.drew.cp.core.api.postMessage({param:"mainproxy", val:false});
}
});
}
};
api.sendtoPortContrys = function(val) {
if (nl.drew.cp.core.api.port) {
chrome.tabs.getSelected(null, function(tab) {
var purl = nl.drew.cp.lib.parseUrl(tab.url);
purl.host = nl.drew.cp.core.api.preSendtoPort(val, purl);
nl.drew.cp.core.api.postMessage({param:"contrys", val:{contrys:nl.drew.cp.state.contrys, uproxys:nl.drew.cp.state.uproxys, contrymain:nl.drew.cp.state.contryMain, contrysite:nl.drew.cp.core.lib.inContrySiteList(purl.host), host:purl.host}});
});
}
};
api.preSendtoPort = function(val, purl) {
if ((!val || typeof val.list == "undefined" || !val.list) && !purl.allow) {
return "";
} else {
if (val && typeof val.list != "undefined" && val.list) {
return val.host;
} else {
if (!val || typeof val.host == "undefined" || !val.host) {
return purl.host;
} else {
if (val.host != purl.host) {
return "";
}
}
}
}
return purl.host;
};
api.sendtoPort = function(msg) {
nl.drew.cp.core.api.postMessage(msg);
};
api.postMessage = function(msg) {
if (nl.drew.cp.core.api.port) {
try {
nl.drew.cp.core.api.port.postMessage(msg);
} catch (err) {
}
}
};
return api;
}();

View File

@ -0,0 +1,13 @@
nl.drew.cp.core.cache = function() {
var cache = {};
cache.nowProxyAllClean = function() {
nl.drew.cp.state.nowProxyCache = {};
};
cache.nowProxyClean = function(purl) {
if (typeof purl.host != "undefined" && purl.host) {
delete nl.drew.cp.state.nowProxyCache[purl.host];
}
};
return cache;
}();

View File

@ -0,0 +1,185 @@
nl.drew.cp.core.conf = function() {
var conf = {};
conf.getApiUrl = function() {
if (nl.drew.cp.ls.isset("conf")) {
var conf = nl.drew.cp.ls.get("conf");
if (conf) {
if (typeof conf.Apiurl != "undefined" && conf.Apiurl.length > 0) {
nl.drew.cp.config.apiurl = conf.Apiurl;
}
if (typeof conf.Apiext != "undefined" && conf.Apiext.length > 0) {
nl.drew.cp.config.apiext = conf.Apiext;
}
if (typeof conf.Apiind != "undefined" && conf.Apiind.length > 0) {
nl.drew.cp.config.apiind = conf.Apiind;
}
if (typeof conf.Apidop != "undefined" && conf.Apidop.length > 0) {
nl.drew.cp.config.apidop = conf.Apidop;
}
}
}
var ret = new Array;
var uriapi;
for (var i in nl.drew.cp.config.apiurl) {
for (var j in nl.drew.cp.config.apiext) {
for (var k in nl.drew.cp.config.apiind) {
uriapi = nl.drew.cp.config.apiurl[i] + nl.drew.cp.config.apiind[k] + "." + nl.drew.cp.config.apiext[j];
ret.push("https://" + uriapi + "/");
}
}
}
nl.drew.cp.state.allApiUrls = ret;
nl.drew.cp.state.allApiUrls = nl.drew.cp.state.allApiUrls.concat(nl.drew.cp.config.apidop);
};
conf.preLoadConfigFromServer = function(callback) {
if (!nl.drew.cp.state.isenabled) {
if (callback != null) {
callback();
}
return;
}
nl.drew.cp.state.loadConfigFailCount = 0;
var allapiurlsLen = nl.drew.cp.state.allApiUrls.length;
if (allapiurlsLen < 1) {
nl.drew.cp.lib.debug("+++++++ crome-proxy +++++++ no api urls");
return null;
}
var ind = Math.random() * allapiurlsLen;
ind = ind ^ 0;
nl.drew.cp.state.apiUrl = nl.drew.cp.state.allApiUrls[ind];
conf.loadConfigFromServer(callback, ind);
};
conf.loadLocalConfig = function() {
if (nl.drew.cp.ls.isset("isenabled")) {
nl.drew.cp.state.isenabled = nl.drew.cp.ls.get("isenabled", false);
} else {
nl.drew.cp.state.isenabled = nl.drew.cp.config.isenabled;
}
if (nl.drew.cp.state.isenabled) {
if (nl.drew.cp.ls.isset("authHeader") && nl.drew.cp.ls.isset("authHeaderEnd")) {
nl.drew.cp.state.authHeader = nl.drew.cp.ls.get("authHeader", "96W3tAJeY40DufpX");
nl.drew.cp.state.authHeaderEnd = nl.drew.cp.ls.get("authHeaderEnd", false);
}
if (nl.drew.cp.ls.isset("contrymain")) {
var contrymain = nl.drew.cp.ls.get("contrymain", false);
if (contrymain) {
nl.drew.cp.state.contryMain = contrymain;
}
}
if (nl.drew.cp.ls.isset("globalalwproxy")) {
nl.drew.cp.state.alwProxy = nl.drew.cp.ls.get("globalalwproxy", false);
}
if (nl.drew.cp.ls.isset("anonymityall")) {
nl.drew.cp.state.anonymityAll = nl.drew.cp.ls.get("anonymityall", false);
}
if (nl.drew.cp.ls.isset("contrySiteList")) {
nl.drew.cp.state.listContrySite = nl.drew.cp.ls.get("contrySiteList", false);
}
if (nl.drew.cp.ls.isset("alwProxySite")) {
nl.drew.cp.state.listAlwProxySite = nl.drew.cp.ls.get("alwProxySite", false);
}
if (nl.drew.cp.ls.isset("nonProxySite")) {
nl.drew.cp.state.listNonProxySite = nl.drew.cp.ls.get("nonProxySite", false);
}
if (nl.drew.cp.ls.isset("anSite")) {
nl.drew.cp.state.listAnSite = nl.drew.cp.ls.get("anSite", false);
}
if (nl.drew.cp.ls.isset("torSite")) {
nl.drew.cp.state.listTorSite = nl.drew.cp.ls.get("torSite", false);
}
if (nl.drew.cp.ls.isset("offlist")) {
nl.drew.cp.state.offlist = nl.drew.cp.ls.get("offlist", false);
}
if (nl.drew.cp.ls.isset("uproxys")) {
nl.drew.cp.state.uproxys = nl.drew.cp.ls.get("uproxys", false);
}
nl.drew.cp.core.proxy.loadLocalProxy();
}
};
conf.clearConfigTimer = function() {
if (nl.drew.cp.state.loadConfigUpdTimer) {
clearTimeout(nl.drew.cp.state.loadConfigUpdTimer);
nl.drew.cp.state.loadConfigUpdTimer = null;
}
};
conf.startConfigTimer = function(callback) {
nl.drew.cp.state.loadConfigUpdTimer = setTimeout(function startLoadConfig() {
nl.drew.cp.core.conf.preLoadConfigFromServer(callback);
}, nl.drew.cp.config.loadConfigUpdT);
};
conf.startConfigTimer3 = function() {
nl.drew.cp.state.loadConfigUpdTimer = setTimeout(function startLoadConfig() {
nl.drew.cp.core.conf.loadConfigFromServer();
}, nl.drew.cp.config.loadConfigUpdT3);
};
conf.loadConfigFromServer = function(callback, ind) {
var apiUrl = nl.drew.cp.state.apiUrl;
if (!apiUrl) {
nl.drew.cp.lib.debug("+++++++ crome-proxy +++++++ no api url");
return null;
}
var onFail = function() {
var allapiurlsLen = nl.drew.cp.state.allApiUrls.length;
nl.drew.cp.state.loadConfigFailCount++;
if (ind !== null) {
ind++;
if (ind >= allapiurlsLen) {
ind = 0;
}
nl.drew.cp.state.apiUrl = nl.drew.cp.state.allApiUrls[ind];
if (nl.drew.cp.state.loadConfigFailCount >= allapiurlsLen) {
nl.drew.cp.state.loadConfigFailCountt = 0;
conf.loadConfigFromServer(callback, null);
nl.drew.cp.core.interf.icoupdate();
} else {
conf.loadConfigFromServer(callback, ind);
}
return null;
} else {
nl.drew.cp.core.conf.clearConfigTimer();
nl.drew.cp.core.conf.startConfigTimer(callback);
}
};
nl.drew.cp.lib.ReqJson(apiUrl + nl.drew.cp.config.api + "?crome-proxy-ywPHzueGrJX4vLYmC6Zj8TpotBacbgEf", 1E4, function(response) {
nl.drew.cp.core.conf.serverRespParse(response);
if (callback != null) {
callback();
}
nl.drew.cp.core.conf.clearConfigTimer();
nl.drew.cp.core.conf.startConfigTimer3();
}, onFail, onFail, "POST", "ip=" + encodeURIComponent(nl.drew.cp.state.ip) + "&s=" + encodeURIComponent(nl.drew.cp.state.lastUpdate) + "&sk=" + encodeURIComponent(nl.drew.cp.state.lastUpdateKey));
};
conf.serverRespParse = function(response) {
var responseJSON = {};
try {
responseJSON = JSON.parse(response);
} catch (e) {
nl.drew.cp.lib.debug("+++++++ crome-proxy +++++++ can't parse");
return null;
}
if (typeof responseJSON.Key != "undefined" && responseJSON.Key && typeof responseJSON.KeyD != "undefined" && typeof responseJSON.Now != "undefined") {
nl.drew.cp.state.authHeader = responseJSON.Key;
nl.drew.cp.state.authHeaderEnd = responseJSON.KeyD + (nl.drew.cp.lib.time() - responseJSON.Now);
nl.drew.cp.ls.set("authHeader", nl.drew.cp.state.authHeader, "96W3tAJeY40DufpX");
nl.drew.cp.ls.set("authHeaderEnd", nl.drew.cp.state.authHeaderEnd, false);
}
if (typeof responseJSON.Proxy != "undefined" && Object.prototype.toString.call(responseJSON.Proxy) === "[object Array]") {
nl.drew.cp.core.proxy.fromServerParser(responseJSON.Proxy);
} else {
if (typeof responseJSON.ProxyStat != "undefined") {
nl.drew.cp.core.proxy.setProxysCh(responseJSON.ProxyStat);
nl.drew.cp.core.proxy.setMainProxys();
}
}
if (typeof responseJSON.Conf != "undefined" && responseJSON.Conf) {
}
if (typeof responseJSON.S != "undefined" && responseJSON.S) {
nl.drew.cp.state.lastUpdate = responseJSON.S;
}
if (typeof responseJSON.KeyD != "undefined" && responseJSON.KeyD) {
nl.drew.cp.state.lastUpdateKey = responseJSON.KeyD;
}
};
return conf;
}();

View File

@ -0,0 +1,118 @@
nl.drew.cp.core.main = function() {
var main = {};
main.firstStart = function() {
chrome.runtime.onConnect.addListener(function(port) {
port.onMessage.addListener(function(msg) {
nl.drew.cp.core.api.handling(port, msg);
});
});
nl.drew.cp.state.icon = new iconAnimator("im/ico38-2.png");
nl.drew.cp.state.iconoff = new iconAnimator("im/ico19g-2.png");
chrome.tabs.onActivated.addListener(function onActTabs(info) {
nl.drew.cp.core.interf.icoupdate71(info.tabId);
});
chrome.webRequest.onCompleted.addListener(function onCompleted(details) {
if (details.url) {
nl.drew.cp.core.interf.icoupdate7(details.url);
}
}, {urls:["http://*/*", "https://*/*", "ftp://*/*", "file://*/*"], types:["main_frame"]});
nl.drew.cp.core.main.start();
};
main.onProxyError = function(details) {
if (details && typeof details.levelOfControl != "undefined" && details.levelOfControl != "controllable_by_this_extension" && details.levelOfControl != "controlled_by_this_extension") {
nl.drew.cp.state.started = null;
nl.drew.cp.core.main.started(false);
return false;
} else {
chrome.proxy.settings.get({"incognito":false}, function(details) {
if (details && typeof details.levelOfControl != "undefined" && details.levelOfControl != "controllable_by_this_extension" && details.levelOfControl != "controlled_by_this_extension") {
nl.drew.cp.state.started = null;
nl.drew.cp.core.main.started(false);
return false;
}
});
}
if (!nl.drew.cp.state.timerCheckProxy) {
nl.drew.cp.state.timerCheckProxy = setInterval(nl.drew.cp.core.main.onProxyError, 7E3);
}
};
main.start = function(needEnabled) {
chrome.proxy.settings.get({"incognito":false}, function(details) {
nl.drew.cp.core.main.onProxyError(details);
if (needEnabled) {
nl.drew.cp.state.isenabled = true;
nl.drew.cp.ls.set("isenabled", true, false);
}
if (nl.drew.cp.state.started !== null && !nl.drew.cp.state.started) {
nl.drew.cp.state.started = null;
nl.drew.cp.state.state = {text:"Starting...", cl:"uk-text-success", blink:true};
nl.drew.cp.core.api.sendtoPortState();
nl.drew.cp.core.conf.loadLocalConfig();
if (nl.drew.cp.state.isenabled) {
nl.drew.cp.core.header.inst();
var proxyObjKeys = Object.keys(nl.drew.cp.state.proxys);
if (proxyObjKeys.length > 1 && nl.drew.cp.state.authHeader.length > 0 && nl.drew.cp.state.authHeaderEnd > nl.drew.cp.lib.time()) {
nl.drew.cp.core.proxy.setMainProxys();
nl.drew.cp.core.filter.inst(function() {
nl.drew.cp.core.main.started(true);
nl.drew.cp.core.conf.getApiUrl();
nl.drew.cp.core.conf.preLoadConfigFromServer(function() {
nl.drew.cp.core.filter.inst(nl.drew.cp.core.interf.icoupdate71);
});
});
} else {
nl.drew.cp.core.conf.getApiUrl();
nl.drew.cp.core.conf.preLoadConfigFromServer(function() {
nl.drew.cp.core.proxy.setMainProxys();
nl.drew.cp.core.filter.inst(function() {
nl.drew.cp.core.main.started(true);
});
});
}
} else {
nl.drew.cp.core.main.started(false);
}
} else {
nl.drew.cp.core.interf.icoupdate();
}
});
};
main.stop = function() {
nl.drew.cp.state.isenabled = false;
nl.drew.cp.ls.set("isenabled", false, false);
if (nl.drew.cp.state.started !== null && nl.drew.cp.state.started) {
nl.drew.cp.state.started = null;
nl.drew.cp.core.filter.uninst(function() {
});
nl.drew.cp.core.header.uninst();
nl.drew.cp.core.main.started(false);
}
if (nl.drew.cp.state.timerCheckProxy) {
clearInterval(nl.drew.cp.state.timerCheckProxy);
}
nl.drew.cp.state.timerCheckProxy = null;
};
main.started = function(flag) {
if (flag) {
nl.drew.cp.state.state = {text:"Ok", cl:"uk-text-success", blink:false};
nl.drew.cp.core.api.sendtoPortState();
nl.drew.cp.state.started = true;
nl.drew.cp.core.interf.icoupdate71();
} else {
nl.drew.cp.state.state = {text:"Off", cl:"uk-text-muted", blink:false};
nl.drew.cp.core.api.sendtoPortState();
nl.drew.cp.core.api.sendtoPortContrys();
nl.drew.cp.core.interf.icoupdate();
nl.drew.cp.state.started = false;
nl.drew.cp.core.api.sendtoPortMainproxy();
}
};
return main;
}();
window.addEventListener("load", function load(event) {
window.removeEventListener("load", load, false);
setTimeout(nl.drew.cp.core.main.firstStart, 1);
}, false);
window.addEventListener("close", function load(event) {
}, false);

View File

@ -0,0 +1,96 @@
nl.drew.cp.core.header = function() {
var header = {};
header.inst = function() {
nl.drew.cp.core.header.uninst();
chrome.webRequest.onHeadersReceived.addListener(nl.drew.cp.core.header.onResponse, {urls:["http://*/*"]});
chrome.webRequest.onBeforeSendHeaders.addListener(nl.drew.cp.core.header.listener, {urls:["http://*/*"]}, ["requestHeaders", "blocking"]);
};
header.uninst = function() {
if (chrome.webRequest.onBeforeSendHeaders.hasListener(nl.drew.cp.core.header.listener)) {
chrome.webRequest.onBeforeSendHeaders.removeListener(nl.drew.cp.core.header.listener);
}
if (chrome.webRequest.onHeadersReceived.hasListener(nl.drew.cp.core.header.onResponse)) {
chrome.webRequest.onHeadersReceived.removeListener(nl.drew.cp.core.header.onResponse);
}
};
header.listener = function(details) {
var auth = "";
var name = "";
var purl = nl.drew.cp.lib.parseUrl(details.url);
if (!purl.allow) {
return{requestHeaders:details.requestHeaders};
}
var nowProxy = nl.drew.cp.core.proxy.getNowProxy(null, purl, true, false);
if (!nowProxy) {
return{requestHeaders:details.requestHeaders};
}
if (nowProxy.co.length == 2) {
name = "Proxy-Authorization";
if (nl.drew.cp.core.header.getTorNow(purl.host) || nl.drew.cp.state.alwProxy) {
auth = nl.drew.cp.state.authHeader[2];
} else {
if (nl.drew.cp.core.header.getAnonymityNow(purl.host)) {
auth = nl.drew.cp.state.authHeader[1];
} else {
auth = nl.drew.cp.state.authHeader[0];
}
}
} else {
if (nowProxy.ip == "proxy.googlezip.net" || nowProxy.ip == "compress.googlezip.net" || nowProxy.ip == "74.125.205.211") {
name = "Chrome-Proxy";
auth = nl.drew.cp.core.header.authGoogleHeader();
}
}
if (name) {
details.requestHeaders.push({name:name, value:auth});
}
return{requestHeaders:details.requestHeaders};
};
header.getAnonymityNow = function(host) {
var ret = false;
if (nl.drew.cp.state.anonymityAll) {
return true;
}
if (nl.drew.cp.core.lib.inAnSiteList(host) > -1) {
return true;
}
return ret;
};
header.getTorNow = function(host) {
var ret = false;
if (nl.drew.cp.state.torAll) {
return true;
}
if (nl.drew.cp.core.lib.inTorSiteList(host) > -1) {
return true;
}
return ret;
};
header.getTor = function(host) {
var ret = {all:null, site:null, url:null};
ret.all = nl.drew.cp.state.torAll;
if (host) {
ret.site = nl.drew.cp.core.lib.inTorSiteList(host) > -1;
}
return ret;
};
header.getAnonymity = function(host) {
var ret = {all:null, site:null, url:null};
ret.all = nl.drew.cp.state.anonymityAll;
if (host) {
ret.site = nl.drew.cp.core.lib.inAnSiteList(host) > -1;
ret.host = host;
}
return ret;
};
header.authGoogleHeader = function() {
var authValue = "ac4500dd3b7579186c1b0620614fdb1f7d61f944";
var timestamp = Date.now().toString().substring(0, 10);
var chromeVersion = navigator.appVersion.match(/Chrome\/(\d+)\.(\d+)\.(\d+)\.(\d+)/);
return "ps=" + timestamp + "-" + Math.floor(Math.random() * 1E9) + "-" + Math.floor(Math.random() * 1E9) + "-" + Math.floor(Math.random() * 1E9) + ", sid=" + nl.drew.cp.core.lib.MD5(timestamp + authValue + timestamp) + ", b=" + chromeVersion[3] + ", p=" + chromeVersion[4];
};
header.onResponse = function(response) {
};
return header;
}();

View File

@ -0,0 +1,84 @@
nl.drew.cp.core.interf = function() {
var interf = {};
interf.icoupdate71 = function(tabid) {
var icoupd = function(tab) {
var url;
if (typeof tab.url != "undefined") {
url = tab.url;
nl.drew.cp.core.interf.icoupdate7(url);
}
};
if (tabid) {
chrome.tabs.get(tabid, function(tab) {
icoupd(tab);
});
} else {
chrome.tabs.getSelected(null, function(tab) {
icoupd(tab);
});
}
};
interf.icoupdate7 = function(url) {
var purl = nl.drew.cp.lib.parseUrl(url);
var nowproxy = nl.drew.cp.core.proxy.getNowProxy(null, purl, true, false);
if (nowproxy) {
var co = nowproxy.co;
if (purl.allow && co.length < 3 && nl.drew.cp.core.header.getTorNow(purl.host)) {
co = "tor";
}
nl.drew.cp.core.interf.icoupdate3(co, purl.pathname);
} else {
nl.drew.cp.core.interf.icoupdate3();
}
};
interf.icoupdate3 = function(co, url) {
if (url) {
if (url.indexOf("_/chrome/newtab") != -1) {
co = false;
}
}
if (nl.drew.cp.lib.isNumeric(co)) {
co = false;
}
if (nl.drew.cp.state.isenabled && nl.drew.cp.state.started) {
if (co) {
if (nl.drew.cp.state.alwProxy) {
co = "public";
}
nl.drew.cp.state.icon.setCo(co);
} else {
nl.drew.cp.state.icon.set();
}
} else {
if (nl.drew.cp.state.started == null) {
nl.drew.cp.state.iconoff.setErr();
} else {
nl.drew.cp.state.iconoff.set();
}
}
};
interf.icoupdate = function() {
if (nl.drew.cp.state.isenabled && nl.drew.cp.state.started) {
nl.drew.cp.state.icon.set();
nl.drew.cp.state.icon.rotate();
} else {
if (nl.drew.cp.state.started == null) {
nl.drew.cp.state.iconoff.setErr();
} else {
nl.drew.cp.state.iconoff.set();
nl.drew.cp.state.iconoff.rotate();
}
}
};
interf.icoupdate2 = function() {
if (nl.drew.cp.state.isenabled && nl.drew.cp.state.started) {
nl.drew.cp.state.icon.set();
nl.drew.cp.state.icon.pulse2();
} else {
nl.drew.cp.state.iconoff.set();
nl.drew.cp.state.iconoff.pulse2();
}
};
return interf;
}();

View File

@ -0,0 +1,463 @@
nl.drew.cp.core.lib = function() {
var lib = {};
lib.inTorSiteList = function(host) {
return this.isUriInAnyList(host, nl.drew.cp.state.listTorSite);
};
lib.inAnSiteList = function(host) {
return this.isUriInAnyList(host, nl.drew.cp.state.listAnSite);
};
lib.inAnSiteListEqually = function(host) {
return this.quickInArray2(host, nl.drew.cp.state.listAnSite);
};
lib.inAlwProxySiteList = function(host) {
return this.isUriInAnyList(host, nl.drew.cp.state.listAlwProxySite);
};
lib.inAlwProxySiteListEqually = function(host) {
return this.quickInArray2(host, nl.drew.cp.state.listAlwProxySite);
};
lib.inNonProxySiteList = function(host) {
return this.isUriInAnyList(host, nl.drew.cp.state.listNonProxySite);
};
lib.inNonProxySiteListEqually = function(host) {
return this.quickInArray2(host, nl.drew.cp.state.listNonProxySite);
};
lib.inOffSiteList = function(host) {
return this.quickInArray(host, nl.drew.cp.state.offlist);
};
lib.inUproxyList = function(co) {
var i = nl.drew.cp.state.uproxys.length;
while (i--) {
if (typeof nl.drew.cp.state.uproxys[i] == "undefined") {
continue;
}
if (nl.drew.cp.state.uproxys[i].co == co) {
return i;
}
}
return-1;
};
lib.inOffSiteListAllParam = function(obj) {
var i = nl.drew.cp.state.offlist.length;
while (i--) {
if (typeof nl.drew.cp.state.offlist[i] == "undefined") {
continue;
}
if (nl.drew.cp.state.offlist[i].host == obj.host && nl.drew.cp.state.offlist[i].an == obj.an && nl.drew.cp.state.offlist[i].nonproxy == obj.nonproxy && nl.drew.cp.state.offlist[i].alwproxy == obj.alwproxy && nl.drew.cp.state.offlist[i].loc == obj.loc) {
return i;
}
}
return-1;
};
lib.isUriInAnyList = function(host, list) {
var i, lenHost;
if (!host) {
return-1;
}
i = list.length;
while (i--) {
if (typeof list[i] == "undefined") {
continue;
}
if (list[i] == host) {
return i;
} else {
if (list[i][0] == "*") {
lenHost = -1 * (list[i].length - 2);
if (list[i].substr(lenHost) == host.substr(lenHost)) {
return i;
}
}
}
}
return-1;
};
lib.delContrySiteList = function(host) {
if (host) {
var key;
var ind;
for (key in nl.drew.cp.state.listContrySite) {
if (!nl.drew.cp.state.listContrySite.hasOwnProperty(key)) {
continue;
}
if (nl.drew.cp.state.listContrySite[key].length < 1) {
continue;
}
ind = this.isUriInAnyList(host, nl.drew.cp.state.listContrySite[key]);
if (ind > -1) {
nl.drew.cp.state.listContrySite[key].splice(ind, 1);
}
}
}
};
lib.inContrySiteList = function(host) {
if (host) {
var key;
var nowProxys = nl.drew.cp.core.proxy.getNowProxys();
for (key in nl.drew.cp.state.listContrySite) {
if (!nl.drew.cp.state.listContrySite.hasOwnProperty(key)) {
continue;
}
if (nl.drew.cp.state.listContrySite[key].length < 1) {
continue;
}
if (this.isUriInAnyList(host, nl.drew.cp.state.listContrySite[key]) > -1) {
if (nowProxys.hasOwnProperty(key)) {
return key;
}
}
}
}
return "main";
};
lib.inContrySiteListEqually = function(host) {
if (host) {
var key;
for (key in nl.drew.cp.state.listContrySite) {
if (!nl.drew.cp.state.listContrySite.hasOwnProperty(key)) {
continue;
}
if (nl.drew.cp.state.listContrySite[key].length < 1) {
continue;
}
if (this.quickInArray2(host, nl.drew.cp.state.listContrySite[key]) > -1) {
return key;
}
}
}
return "main";
};
lib.quickInArray = function(it, arr) {
var i = arr.length;
while (i--) {
if (arr[i].host == it) {
return i;
}
}
return-1;
};
lib.quickInArray2 = function(it, arr) {
var i = arr.length;
while (i--) {
if (typeof arr[i] == "undefined") {
continue;
}
if (arr[i] == it) {
return i;
}
}
return-1;
};
lib.globalListGen = function() {
var retGlobal = [];
var i, findkey;
var listNonProxySite = nl.drew.cp.state.listNonProxySite.slice();
var listAlwProxySite = nl.drew.cp.state.listAlwProxySite.slice();
var offlist = nl.drew.cp.state.offlist.slice();
while (i = offlist.shift()) {
retGlobal.push(i);
}
while (i = listNonProxySite.shift()) {
retGlobal.push({host:i, nonproxy:true, alwproxy:false, an:false, loc:"", del:false, off:false});
}
while (i = listAlwProxySite.shift()) {
retGlobal.push({host:i, alwproxy:true, nonproxy:false, an:false, loc:"", del:false, off:false});
}
var j = nl.drew.cp.state.listAnSite.length;
while (j--) {
if (typeof nl.drew.cp.state.listAnSite[j] == "undefined") {
continue;
}
if ((findkey = this.quickInArray(nl.drew.cp.state.listAnSite[j], retGlobal)) != -1) {
retGlobal[findkey].an = true;
} else {
retGlobal.push({host:nl.drew.cp.state.listAnSite[j], an:true, nonproxy:false, alwproxy:false, loc:"", del:false, off:false});
}
}
var key;
for (key in nl.drew.cp.state.listContrySite) {
if (!nl.drew.cp.state.listContrySite.hasOwnProperty(key)) {
continue;
}
j = nl.drew.cp.state.listContrySite[key].length;
if (j < 1) {
continue;
}
while (j--) {
if (typeof nl.drew.cp.state.listContrySite[key][j] == "undefined") {
continue;
}
if ((findkey = this.quickInArray(nl.drew.cp.state.listContrySite[key][j], retGlobal)) != -1) {
retGlobal[findkey].loc = key;
} else {
retGlobal.push({host:nl.drew.cp.state.listContrySite[key][j], loc:key, nonproxy:false, alwproxy:false, an:false, del:false, off:false});
}
}
}
var i = retGlobal.length;
while (i--) {
if (typeof retGlobal[i].par == "undefined") {
retGlobal[i].par = -1;
}
if (retGlobal[i].host[0] == "*") {
var lenHost = -1 * (retGlobal[i].host.length - 2);
var j = retGlobal.length;
while (j--) {
if (i != j) {
if (retGlobal[i].host.substr(lenHost) == retGlobal[j].host.substr(lenHost)) {
if (typeof retGlobal[j].par != "undefined" && retGlobal[j].par > -1) {
if (retGlobal[i].host.length > retGlobal[retGlobal[j].par].host.length) {
retGlobal[j].par = i;
}
} else {
retGlobal[j].par = i;
}
}
}
}
}
}
return retGlobal;
};
lib.returnGen = function(nowProxy) {
var ret = "return 'DIRECT'";
if (nowProxy) {
if (nowProxy.co.length == 2) {
ret = "if ( schema=='https' ) " + "return 'SOCKS5 " + nowProxy.ip + ":" + nowProxy.sport + "'; " + "else " + "return 'HTTPS " + nowProxy.ip + ":" + nowProxy.port + "'; ";
} else {
nowProxy.proto = nowProxy.proto.toUpperCase();
ret = "return '" + nowProxy.proto + " " + nowProxy.ip + ":" + nowProxy.port + "'; ";
if (nowProxy.proto != "SOCKS5" && nowProxy.proto != "SOCKS") {
ret = "if ( schema=='http:' ) " + ret;
}
}
}
return ret;
};
lib.searchInListCodeGen = function(listName, list, action) {
var ret;
if (list.length < 1) {
return " ";
}
var listJson = JSON.stringify(list);
ret = " var " + listName + " = " + listJson + "; " + "for (var i = 0, length = " + listName + ".length; i < length; i++) if (" + listName + ".hasOwnProperty(i)) {" + "if (" + listName + "[i]==host) {" + action + "break; } else {" + "if (" + listName + "[i][0] == '*') { " + "var lenHost = -1 * (" + listName + "[i].length - 2);" + "if (" + listName + "[i].substr(lenHost) == host.substr(lenHost)) {" + action + "break; }}}}";
return ret;
};
lib.checkListOnOff = function(host) {
var offiteam = {host:"", nonproxy:false, alwproxy:false, an:false, loc:"", del:false, off:true};
var ch = false;
if (nl.drew.cp.core.lib.inAnSiteListEqually(host) > -1) {
ch = true;
offiteam.an = true;
}
var co = nl.drew.cp.core.lib.inContrySiteListEqually(host);
if (co != "main") {
offiteam.loc = co;
ch = true;
}
if (nl.drew.cp.core.lib.inAlwProxySiteListEqually(host) > -1) {
ch = true;
offiteam.alwproxy = true;
}
if (nl.drew.cp.core.lib.inNonProxySiteListEqually(host) > -1) {
ch = true;
offiteam.nonproxy = true;
}
if (ch) {
offiteam.host = host;
return nl.drew.cp.core.lib.inOffSiteListAllParam(offiteam);
}
return-1;
};
lib.liston = function(val, onlsave) {
nl.drew.cp.core.cache.nowProxyClean(val);
if (!onlsave) {
var lid = nl.drew.cp.core.lib.inOffSiteListAllParam(val);
if (lid == -1) {
return;
}
}
var host = val.host;
this.listoff(host);
var ind;
if (val.an) {
if (nl.drew.cp.core.lib.inAnSiteListEqually(host) == -1) {
nl.drew.cp.state.listAnSite.push(host);
nl.drew.cp.ls.set("anSite", nl.drew.cp.state.listAnSite, false);
nl.drew.cp.core.api.sendtoPortAnonymitynow({host:host, list:true});
nl.drew.cp.core.api.sendtoPortAnonymity({host:host, list:true});
}
}
if (val.nonproxy) {
if (nl.drew.cp.core.lib.inNonProxySiteListEqually(host) == -1) {
nl.drew.cp.state.listNonProxySite.push(host);
}
ind = nl.drew.cp.core.lib.inAlwProxySiteListEqually(host);
if (ind > -1) {
nl.drew.cp.state.listAlwProxySite.splice(ind, 1);
}
nl.drew.cp.ls.set("alwProxySite", nl.drew.cp.state.listAlwProxySite, false);
nl.drew.cp.ls.set("nonProxySite", nl.drew.cp.state.listNonProxySite, false);
} else {
if (val.alwproxy) {
if (nl.drew.cp.core.lib.inAlwProxySiteListEqually(host) == -1) {
nl.drew.cp.state.listAlwProxySite.push(host);
}
ind = nl.drew.cp.core.lib.inNonProxySiteListEqually(host);
if (ind > -1) {
nl.drew.cp.state.listNonProxySite.splice(ind, 1);
}
nl.drew.cp.ls.set("alwProxySite", nl.drew.cp.state.listAlwProxySite, false);
nl.drew.cp.ls.set("nonProxySite", nl.drew.cp.state.listNonProxySite, false);
}
}
if (val.loc) {
if (val.loc != "main") {
nl.drew.cp.core.lib.delContrySiteList(host);
if (typeof nl.drew.cp.state.listContrySite[val.loc] == "undefined") {
nl.drew.cp.state.listContrySite[val.loc] = [];
}
nl.drew.cp.state.listContrySite[val.loc].push(host);
nl.drew.cp.ls.set("contrySiteList", nl.drew.cp.state.listContrySite, false);
nl.drew.cp.core.api.sendtoPortContrys({host:host, list:true});
}
}
nl.drew.cp.core.filter.inst();
nl.drew.cp.core.api.sendtoPortInProxyList({host:host, list:true});
if (!onlsave) {
nl.drew.cp.state.offlist.splice(lid, 1);
nl.drew.cp.ls.set("offlist", nl.drew.cp.state.offlist, false);
}
};
lib.listoff = function(host, onlremove, nosendtoport) {
nl.drew.cp.lib.debug(host);
nl.drew.cp.core.cache.nowProxyClean({host:host});
var offiteam = {host:"", nonproxy:false, alwproxy:false, an:false, loc:"", del:false, off:true};
var an, nonproxy, alwproxy;
var ch = false;
if ((an = nl.drew.cp.core.lib.inAnSiteListEqually(host)) > -1) {
ch = true;
offiteam.an = true;
}
var co = nl.drew.cp.core.lib.inContrySiteListEqually(host);
if (co != "main") {
offiteam.loc = co;
ch = true;
}
if ((alwproxy = nl.drew.cp.core.lib.inAlwProxySiteListEqually(host)) > -1) {
ch = true;
offiteam.alwproxy = true;
}
if ((nonproxy = nl.drew.cp.core.lib.inNonProxySiteListEqually(host)) > -1) {
ch = true;
offiteam.nonproxy = true;
}
if (ch) {
nl.drew.cp.lib.debug(offiteam);
offiteam.host = host;
if (offiteam.an) {
nl.drew.cp.state.listAnSite.splice(an, 1);
nl.drew.cp.ls.set("anSite", nl.drew.cp.state.listAnSite, false);
if (!nosendtoport) {
nl.drew.cp.core.api.sendtoPortAnonymitynow({host:host, list:true});
nl.drew.cp.core.api.sendtoPortAnonymity({host:host, list:true});
}
}
if (offiteam.alwproxy) {
nl.drew.cp.state.listAlwProxySite.splice(alwproxy, 1);
nl.drew.cp.ls.set("alwProxySite", nl.drew.cp.state.listAlwProxySite, false);
} else {
if (offiteam.nonproxy) {
nl.drew.cp.state.listNonProxySite.splice(nonproxy, 1);
nl.drew.cp.ls.set("nonProxySite", nl.drew.cp.state.listNonProxySite, false);
}
}
if (co) {
nl.drew.cp.core.lib.delContrySiteList(host);
nl.drew.cp.ls.set("contrySiteList", nl.drew.cp.state.listContrySite, false);
if (!nosendtoport) {
nl.drew.cp.core.api.sendtoPortContrys({host:host, list:true});
}
}
nl.drew.cp.core.filter.inst();
if (!nosendtoport) {
nl.drew.cp.core.api.sendtoPortInProxyList({host:host, list:true});
}
if (!onlremove) {
if (this.inOffSiteListAllParam(offiteam) == -1) {
nl.drew.cp.state.offlist.push(offiteam);
}
nl.drew.cp.ls.set("offlist", nl.drew.cp.state.offlist, false);
}
}
};
lib.MD5 = function(e) {
function h(a, b) {
var c, d, e, f, g;
e = a & 2147483648;
f = b & 2147483648;
c = a & 1073741824;
d = b & 1073741824;
g = (a & 1073741823) + (b & 1073741823);
return c & d ? g ^ 2147483648 ^ e ^ f : c | d ? g & 1073741824 ? g ^ 3221225472 ^ e ^ f : g ^ 1073741824 ^ e ^ f : g ^ e ^ f;
}
function k(a, b, c, d, e, f, g) {
a = h(a, h(h(b & c | ~b & d, e), g));
return h(a << f | a >>> 32 - f, b);
}
function l(a, b, c, d, e, f, g) {
a = h(a, h(h(b & d | c & ~d, e), g));
return h(a << f | a >>> 32 - f, b);
}
function m(a, b, d, c, e, f, g) {
a = h(a, h(h(b ^ d ^ c, e), g));
return h(a << f | a >>> 32 - f, b);
}
function n(a, b, d, c, e, f, g) {
a = h(a, h(h(d ^ (b | ~c), e), g));
return h(a << f | a >>> 32 - f, b);
}
function p(a) {
var b = "", d = "", c;
for (c = 0;3 >= c;c++) {
d = a >>> 8 * c & 255, d = "0" + d.toString(16), b += d.substr(d.length - 2, 2);
}
return b;
}
var f = [], q, r, s, t, a, b, c, d;
e = function(a) {
a = a.replace(/\r\n/g, "\n");
for (var b = "", d = 0;d < a.length;d++) {
var c = a.charCodeAt(d);
128 > c ? b += String.fromCharCode(c) : (127 < c && 2048 > c ? b += String.fromCharCode(c >> 6 | 192) : (b += String.fromCharCode(c >> 12 | 224), b += String.fromCharCode(c >> 6 & 63 | 128)), b += String.fromCharCode(c & 63 | 128));
}
return b;
}(e);
f = function(b) {
var a, c = b.length;
a = c + 8;
for (var d = 16 * ((a - a % 64) / 64 + 1), e = Array(d - 1), f = 0, g = 0;g < c;) {
a = (g - g % 4) / 4, f = g % 4 * 8, e[a] |= b.charCodeAt(g) << f, g++;
}
a = (g - g % 4) / 4;
e[a] |= 128 << g % 4 * 8;
e[d - 2] = c << 3;
e[d - 1] = c >>> 29;
return e;
}(e);
a = 1732584193;
b = 4023233417;
c = 2562383102;
d = 271733878;
for (e = 0;e < f.length;e += 16) {
q = a, r = b, s = c, t = d, a = k(a, b, c, d, f[e + 0], 7, 3614090360), d = k(d, a, b, c, f[e + 1], 12, 3905402710), c = k(c, d, a, b, f[e + 2], 17, 606105819), b = k(b, c, d, a, f[e + 3], 22, 3250441966), a = k(a, b, c, d, f[e + 4], 7, 4118548399), d = k(d, a, b, c, f[e + 5], 12, 1200080426), c = k(c, d, a, b, f[e + 6], 17, 2821735955), b = k(b, c, d, a, f[e + 7], 22, 4249261313), a = k(a, b, c, d, f[e + 8], 7, 1770035416), d = k(d, a, b, c, f[e + 9], 12, 2336552879), c = k(c, d, a, b, f[e +
10], 17, 4294925233), b = k(b, c, d, a, f[e + 11], 22, 2304563134), a = k(a, b, c, d, f[e + 12], 7, 1804603682), d = k(d, a, b, c, f[e + 13], 12, 4254626195), c = k(c, d, a, b, f[e + 14], 17, 2792965006), b = k(b, c, d, a, f[e + 15], 22, 1236535329), a = l(a, b, c, d, f[e + 1], 5, 4129170786), d = l(d, a, b, c, f[e + 6], 9, 3225465664), c = l(c, d, a, b, f[e + 11], 14, 643717713), b = l(b, c, d, a, f[e + 0], 20, 3921069994), a = l(a, b, c, d, f[e + 5], 5, 3593408605), d = l(d, a, b, c, f[e +
10], 9, 38016083), c = l(c, d, a, b, f[e + 15], 14, 3634488961), b = l(b, c, d, a, f[e + 4], 20, 3889429448), a = l(a, b, c, d, f[e + 9], 5, 568446438), d = l(d, a, b, c, f[e + 14], 9, 3275163606), c = l(c, d, a, b, f[e + 3], 14, 4107603335), b = l(b, c, d, a, f[e + 8], 20, 1163531501), a = l(a, b, c, d, f[e + 13], 5, 2850285829), d = l(d, a, b, c, f[e + 2], 9, 4243563512), c = l(c, d, a, b, f[e + 7], 14, 1735328473), b = l(b, c, d, a, f[e + 12], 20, 2368359562), a = m(a, b, c, d, f[e + 5],
4, 4294588738), d = m(d, a, b, c, f[e + 8], 11, 2272392833), c = m(c, d, a, b, f[e + 11], 16, 1839030562), b = m(b, c, d, a, f[e + 14], 23, 4259657740), a = m(a, b, c, d, f[e + 1], 4, 2763975236), d = m(d, a, b, c, f[e + 4], 11, 1272893353), c = m(c, d, a, b, f[e + 7], 16, 4139469664), b = m(b, c, d, a, f[e + 10], 23, 3200236656), a = m(a, b, c, d, f[e + 13], 4, 681279174), d = m(d, a, b, c, f[e + 0], 11, 3936430074), c = m(c, d, a, b, f[e + 3], 16, 3572445317), b = m(b, c, d, a, f[e + 6],
23, 76029189), a = m(a, b, c, d, f[e + 9], 4, 3654602809), d = m(d, a, b, c, f[e + 12], 11, 3873151461), c = m(c, d, a, b, f[e + 15], 16, 530742520), b = m(b, c, d, a, f[e + 2], 23, 3299628645), a = n(a, b, c, d, f[e + 0], 6, 4096336452), d = n(d, a, b, c, f[e + 7], 10, 1126891415), c = n(c, d, a, b, f[e + 14], 15, 2878612391), b = n(b, c, d, a, f[e + 5], 21, 4237533241), a = n(a, b, c, d, f[e + 12], 6, 1700485571), d = n(d, a, b, c, f[e + 3], 10, 2399980690), c = n(c, d, a, b, f[e + 10], 15,
4293915773), b = n(b, c, d, a, f[e + 1], 21, 2240044497), a = n(a, b, c, d, f[e + 8], 6, 1873313359), d = n(d, a, b, c, f[e + 15], 10, 4264355552), c = n(c, d, a, b, f[e + 6], 15, 2734768916), b = n(b, c, d, a, f[e + 13], 21, 1309151649), a = n(a, b, c, d, f[e + 4], 6, 4149444226), d = n(d, a, b, c, f[e + 11], 10, 3174756917), c = n(c, d, a, b, f[e + 2], 15, 718787259), b = n(b, c, d, a, f[e + 9], 21, 3951481745), a = h(a, q), b = h(b, r), c = h(c, s), d = h(d, t);
}
return(p(a) + p(b) + p(c) + p(d)).toLowerCase();
};
return lib;
}();

View File

@ -0,0 +1,18 @@
nl.drew.cp.core.onoff = function() {
var onoff = {};
onoff.on = function() {
nl.drew.cp.state.isenabled = true;
nl.drew.cp.ls.set("isenabled", true, false);
console.log("onoff.on");
nl.drew.cp.core.interf.icoupdate();
nl.drew.cp.core.proxy.loadLocalProxy();
};
onoff.off = function() {
nl.drew.cp.state.isenabled = false;
nl.drew.cp.ls.set("isenabled", false, false);
console.log("onoff.off");
nl.drew.cp.core.interf.icoupdate();
};
return onoff;
}();

View File

@ -0,0 +1,298 @@
nl.drew.cp.core.proxy = function() {
var proxy = {};
proxy.setProxysCh = function(proxys) {
for (var i in proxys) {
if (!proxys.hasOwnProperty(i)) {
continue;
}
if (typeof nl.drew.cp.state.proxys[i] != "undefined") {
nl.drew.cp.state.proxys[i].chanel = proxys[i];
}
}
};
proxy.loadLocalProxy = function() {
if (nl.drew.cp.ls.isset("proxys")) {
nl.drew.cp.state.proxys = nl.drew.cp.ls.get("proxys", "vw5yHc8t6dU10fRe");
if (!nl.drew.cp.state.proxys) {
nl.drew.cp.state.proxys = {};
nl.drew.cp.ls.del("proxys");
}
}
var proxyObjKeys = Object.keys(nl.drew.cp.state.proxys);
if (proxyObjKeys.length < 1) {
nl.drew.cp.state.proxys[nl.drew.cp.config.startProxy.id] = nl.drew.cp.lib.clone(nl.drew.cp.config.startProxy);
}
};
proxy.getNowProxy = function(nowProxys, purl, noupdico, nocache) {
if (!purl) {
return null;
}
var now = nl.drew.cp.lib.time();
if (!nocache && nl.drew.cp.state.nowProxyCache.hasOwnProperty(purl.host) && now < nl.drew.cp.state.nowProxyCache[purl.host].t) {
return nl.drew.cp.state.nowProxyCache[purl.host].d;
}
now = now + 25;
var proxyInd = "main";
if (!nowProxys || nowProxys.length < 1) {
nowProxys = this.getNowProxys();
}
if (purl.allow) {
var host = purl.host;
var alwProxy = nl.drew.cp.state.alwProxy;
var needproxy = false;
if (nl.drew.cp.core.lib.inNonProxySiteList(host) > -1) {
nl.drew.cp.state.nowProxyCache[purl.host] = {t:now, d:null};
if (!noupdico) {
nl.drew.cp.core.interf.icoupdate3();
}
return null;
}
if (nl.drew.cp.core.lib.inAlwProxySiteList(host) > -1) {
needproxy = true;
}
if (!needproxy && !alwProxy) {
nl.drew.cp.state.nowProxyCache[purl.host] = {t:now, d:null};
if (!noupdico) {
nl.drew.cp.core.interf.icoupdate3();
}
return null;
}
proxyInd = nl.drew.cp.core.lib.inContrySiteList(host);
} else {
if (!noupdico) {
nl.drew.cp.core.interf.icoupdate3();
}
}
if (proxyInd == "main") {
if (typeof nowProxys[nl.drew.cp.state.contryMain] != "undefined") {
proxyInd = nl.drew.cp.state.contryMain;
}
}
if (nowProxys.hasOwnProperty(proxyInd)) {
var retproxy = nl.drew.cp.lib.clone(nowProxys[proxyInd]);
retproxy.allow = purl.allow;
nl.drew.cp.state.nowProxyCache[purl.host] = {t:now, d:retproxy};
if (!noupdico) {
if (proxyInd == "main") {
proxyInd = nowProxys["main"].co;
}
nl.drew.cp.core.interf.icoupdate3(proxyInd, purl.pathname);
}
return retproxy;
}
nl.drew.cp.state.nowProxyCache[purl.host] = {t:now, d:null};
if (!noupdico) {
nl.drew.cp.core.interf.icoupdate3();
}
return null;
};
proxy.getNowProxys = function() {
var key, i;
var ret = {};
var now = Date.now();
var contrys = nl.drew.cp.state.contrys.slice();
contrys.push("main");
for (i in contrys) {
if (!contrys.hasOwnProperty(i)) {
continue;
}
key = contrys[i];
if (typeof nl.drew.cp.state.proxys != "undefined" && typeof nl.drew.cp.state.proxyMain[key] != "undefined" && nl.drew.cp.state.proxyMain[key] != null && typeof nl.drew.cp.state.proxyMainInd[key] != "undefined" && typeof nl.drew.cp.state.proxys[nl.drew.cp.state.proxyMain[key][nl.drew.cp.state.proxyMainInd[key]]] != "undefined") {
ret[key] = nl.drew.cp.state.proxys[nl.drew.cp.state.proxyMain[key][nl.drew.cp.state.proxyMainInd[key]]];
}
}
for (i in nl.drew.cp.state.uproxys) {
if (!nl.drew.cp.state.uproxys.hasOwnProperty(i)) {
continue;
}
key = nl.drew.cp.state.uproxys[i].co;
ret[key] = nl.drew.cp.state.uproxys[i];
}
return ret;
};
proxy.setMainProxys = function() {
var key, i;
var now = Date.now();
nl.drew.cp.state.contrys = nl.drew.cp.core.proxy.contrys();
var contrys = nl.drew.cp.state.contrys.slice();
contrys.push("main");
for (i in contrys) {
if (!contrys.hasOwnProperty(i)) {
continue;
}
key = contrys[i];
if (typeof nl.drew.cp.state.proxyMain == "undefined") {
nl.drew.cp.state.proxyMain = [];
}
if (typeof nl.drew.cp.state.proxyMain[key] == "undefined" || nl.drew.cp.state.proxyMain[key] == null || nl.drew.cp.state.proxyMainT[key] < now || typeof nl.drew.cp.state.proxyMainInd[key] == "undefined" || typeof nl.drew.cp.state.proxys[nl.drew.cp.state.proxyMain[key][nl.drew.cp.state.proxyMainInd[key]]] == "undefined") {
nl.drew.cp.state.proxyMain[key] = nl.drew.cp.core.proxy.choice(key);
nl.drew.cp.state.proxyMainT[key] = now + nl.drew.cp.config.proxyUpdT;
nl.drew.cp.state.proxyMainInd[key] = 0;
}
}
nl.drew.cp.core.cache.nowProxyAllClean();
nl.drew.cp.core.api.sendtoPortContrys();
};
proxy.choice = function(co) {
var tmpArr = [];
var ret = [];
var tmpArrLen;
var key;
for (key in nl.drew.cp.state.proxys) {
if (!nl.drew.cp.state.proxys.hasOwnProperty(key)) {
continue;
}
if (co == null || co == "main" || co == nl.drew.cp.state.proxys[key].co) {
tmpArr.push(nl.drew.cp.state.proxys[key]);
}
}
tmpArr.sort(function(proxy1, proxy2) {
return proxy1.chanel - proxy2.chanel;
});
tmpArrLen = tmpArr.length;
if (tmpArrLen > 0) {
for (var j = 0;j < tmpArrLen;j++) {
ret.push(tmpArr[j].id);
}
}
return ret;
};
proxy.contrys = function() {
var key;
var ret = [];
for (key in nl.drew.cp.state.proxys) {
if (!nl.drew.cp.state.proxys.hasOwnProperty(key)) {
continue;
}
if (ret.indexOf(nl.drew.cp.state.proxys[key].co) == -1) {
ret.push(nl.drew.cp.state.proxys[key].co);
}
}
return ret;
};
proxy.fromServerParser = function(proxys) {
var key, i;
var is;
var ischange = false;
for (i in proxys) {
if (!proxys.hasOwnProperty(i)) {
continue;
}
key = proxys[i].Id;
if (typeof nl.drew.cp.state.proxys[key] == "undefined") {
nl.drew.cp.state.proxys[key] = {};
nl.drew.cp.state.proxys[key].id = proxys[i].Id;
nl.drew.cp.state.proxys[key].ip = proxys[i].Ip;
nl.drew.cp.state.proxys[key].port = proxys[i].Port;
nl.drew.cp.state.proxys[key].sport = proxys[i].Sport;
nl.drew.cp.state.proxys[key].chanel = proxys[i].Ch;
nl.drew.cp.state.proxys[key].co = proxys[i].Co;
nl.drew.cp.state.proxys[key].name = proxys[i].Na + ".chrome-proxy.com";
nl.drew.cp.state.proxys[key].ssl = proxys[i].Ssl;
ischange = true;
} else {
if (proxys[i].Ch != nl.drew.cp.state.proxys[key].chanel) {
nl.drew.cp.state.proxys[key].chanel = proxys[i].Ch;
}
if (proxys[i].Port != nl.drew.cp.state.proxys[key].port || proxys[i].Sport != nl.drew.cp.state.proxys[key].sport || proxys[i].Ssl != nl.drew.cp.state.proxys[key].ssl) {
ischange = true;
nl.drew.cp.state.proxys[key].port = proxys[i].Port;
nl.drew.cp.state.proxys[key].sport = proxys[i].Sport;
nl.drew.cp.state.proxys[key].ssl = proxys[i].Ssl;
}
}
nl.drew.cp.state.proxys[key].d = proxys[i].D + nl.drew.cp.lib.time();
}
for (key in nl.drew.cp.state.proxys) {
if (!nl.drew.cp.state.proxys.hasOwnProperty(key)) {
continue;
}
is = false;
for (i in proxys) {
if (!proxys.hasOwnProperty(i)) {
continue;
}
if (key == proxys[i].Id) {
is = true;
}
}
if (!is) {
ischange = true;
delete nl.drew.cp.state.proxys[key];
}
}
if (ischange) {
nl.drew.cp.core.proxy.setMainProxys();
}
var saveProxyArr = {};
for (key in nl.drew.cp.state.proxys) {
if (!nl.drew.cp.state.proxys.hasOwnProperty(key)) {
continue;
}
saveProxyArr[key] = {id:nl.drew.cp.state.proxys[key].id, ip:nl.drew.cp.state.proxys[key].ip, port:nl.drew.cp.state.proxys[key].port, sport:nl.drew.cp.state.proxys[key].sport, chanel:nl.drew.cp.state.proxys[key].chanel, co:nl.drew.cp.state.proxys[key].co, name:nl.drew.cp.state.proxys[key].name, ssl:nl.drew.cp.state.proxys[key].ssl, d:nl.drew.cp.state.proxys[key].d};
}
nl.drew.cp.ls.set("proxys", saveProxyArr, "vw5yHc8t6dU10fRe");
};
return proxy;
}();
nl.drew.cp.core.filter = function() {
var filter = {};
filter.uninst = function(callback) {
try {
chrome.proxy.settings.clear({scope:"regular"}, callback);
} catch (e) {
callback();
}
};
filter.inst = function(callback) {
if (typeof callback != "function") {
callback = function() {
};
}
if (nl.drew.cp.state.isenabled) {
var nowProxys = nl.drew.cp.core.proxy.getNowProxys();
var nowProxy;
var key;
if (typeof nowProxys[nl.drew.cp.state.contryMain] != "undefined") {
nowProxy = nowProxys[nl.drew.cp.state.contryMain];
} else {
nowProxy = nowProxys["main"];
}
nl.drew.cp.core.api.sendtoPortMainproxy(nowProxys);
var contryCodeStrig = "";
for (key in nl.drew.cp.state.listContrySite) {
if (!nl.drew.cp.state.listContrySite.hasOwnProperty(key)) {
continue;
}
if (!nowProxys.hasOwnProperty(key)) {
continue;
}
if (nl.drew.cp.state.listContrySite[key].length < 1) {
continue;
}
contryCodeStrig = contryCodeStrig + nl.drew.cp.core.lib.searchInListCodeGen(key, nl.drew.cp.state.listContrySite[key], nl.drew.cp.core.lib.returnGen(nowProxys[key])) + " ";
}
postclearproxy = function() {
var scr = "function FindProxyForURL(url, host) { " + "var schema=url.substring(0,5); " + "if ( schema!='https' && schema!='http:' ) " + "return 'DIRECT'; " + "if ( isPlainHostName(host) || " + "host=='127.0.0.1' || " + "shExpMatch(url,'*crome-proxy-ywPHzueGrJX4vLYmC6Zj8TpotBacbgEf*') || " + "shExpMatch(host, '*.local') || " + "isInNet(dnsResolve(host), '10.0.0.0', '255.0.0.0') || " + "isInNet(dnsResolve(host), '172.16.0.0', '255.240.0.0') || " + "isInNet(dnsResolve(host), '192.168.0.0', '255.255.0.0') || " +
"isInNet(dnsResolve(host), '127.0.0.0', '255.255.255.0') ) " + "return 'DIRECT'; " + "var alwProxy = " + JSON.stringify(nl.drew.cp.state.alwProxy) + ";" + "var needproxy = false;" + nl.drew.cp.core.lib.searchInListCodeGen("nonproxy", nl.drew.cp.state.listNonProxySite, "return 'DIRECT';") + nl.drew.cp.core.lib.searchInListCodeGen("alwproxy", nl.drew.cp.state.listAlwProxySite, "needproxy = true;") + "if ( !needproxy && !alwProxy) " + "return 'DIRECT'; " + contryCodeStrig + nl.drew.cp.core.lib.returnGen(nowProxy) +
"}";
var config = {mode:"pac_script", pacScript:{data:scr}};
try {
chrome.proxy.settings.set({value:config, scope:"regular"}, callback);
} catch (e) {
callback();
}
};
} else {
postclearproxy = callback;
}
try {
chrome.proxy.settings.clear({scope:"regular"}, postclearproxy);
} catch (e) {
postclearproxy();
}
return null;
};
return filter;
}();

View File

@ -0,0 +1,13 @@
if (!nl) {
var nl = {}
}
if (!nl.drew) {
nl.drew = {};
}
if (!nl.drew.cp) {
nl.drew.cp = {};
}
nl.drew.cp = {core:{}, api:{}, config:{loadConfigUpdT:1E3 * 60 * 1, loadConfigUpdT3:1E3 * 60 * 15, isDebug:false, isenabled:true, startProxy:{id:0, ip:"nl0.myproxy.org", port:"433", sport:"1010", chanel:0, co:"nl", name:"nl0", ssl:true, d:false}, api:"api", port:8088, proxyUpdT:1E3 * 60 * 60, apiurl:["cpapi.friproxy"], apiext:["eu", "biz"], apiind:[""], apidop:[], minute:1E3 * 60 * 1, proxyTemplate:[{co:"Google_3", ip:"74.125.205.211", port:"80", proto:"http"}, {co:"TOR", ip:"127.0.0.1", port:"9050",
proto:"socks5"}, {co:"TOR-Browser", ip:"127.0.0.1", port:"9150", proto:"socks5"}]}, state:{state:{text:"Off", cl:"uk-text-muted", blink:false}, isenabled:true, started:false, authHeader:null, isOnlyStartProxy:true, nowProxyCache:{}, uproxys:[], proxys:{}, anonymityAll:false, torAll:false, alwProxy:true, https:true, icon:null, iconoff:null, authHeader:[], authHeaderEnd:null, contrys:[], contryCh:"", proxyMain:{}, proxyMainT:{}, proxyMainInd:{}, ip:0, lastUpdate:0, lastUpdateKey:0, apiUrl:"", allApiUrls:[],
loadConfigUpdTimer:null, loadConfigFailCount:0, proxyhttps:false, contryMain:"main", listTorSite:[], listAnSite:[], listNonProxySite:[], listAlwProxySite:[], listContrySite:{}, offlist:[], timerCheckProxy:null}};

View File

@ -0,0 +1,328 @@
function iconAnimator(strPath) {
var icon = document.createElement("img");
icon.setAttribute("src", strPath);
var canvas = document.createElement("canvas");
canvas.setAttribute("width", "19");
canvas.setAttribute("height", "19");
var canvasContext = canvas.getContext("2d");
var time = 0;
var ru = new Image;
ru.src = "im/co/ru.png";
var de = new Image;
de.src = "im/co/de.png";
var uk = new Image;
uk.src = "im/co/uk.png";
var fr = new Image;
fr.src = "im/co/fr.png";
var nl = new Image;
nl.src = "im/co/nl.png";
var es = new Image;
es.src = "im/co/es.png";
var google = new Image;
google.src = "im/co/google.png";
var err = new Image;
err.src = "im/co/err.png";
var proxy = new Image;
proxy.src = "im/co/p.png";
var tor = new Image;
tor.src = "im/co/tor.png";
this.setErr = function() {
var coimg = err;
canvasContext.save();
canvasContext.clearRect(0, 0, canvas.width, canvas.height);
canvasContext.translate(Math.ceil(canvas.width / 2), Math.ceil(canvas.height / 2));
canvasContext.drawImage(icon, -Math.ceil(canvas.width / 2), -Math.ceil(canvas.height / 2), canvas.width, canvas.height);
canvasContext.drawImage(coimg, -8, -10, 16, 16);
canvasContext.restore();
chrome.browserAction.setIcon({imageData:canvasContext.getImageData(0, 0, 19, 19)});
};
this.setCo = function(co) {
var coimg = false;
co = co.toLowerCase();
if (co) {
if (co == "ru") {
coimg = ru;
} else {
if (co == "de") {
coimg = de;
} else {
if (co == "uk") {
coimg = uk;
} else {
if (co == "fr") {
coimg = fr;
} else {
if (co == "nl") {
coimg = nl;
} else {
if (co == "es") {
coimg = es;
} else {
if (co == "err") {
coimg = err;
} else {
if (co == "public") {
coimg = proxy;
} else {
if (co == "tor") {
coimg = tor;
} else {
if (co.indexOf("google") != -1) {
coimg = google;
} else {
coimg = proxy;
}
}
}
}
}
}
}
}
}
}
}
canvasContext.save();
canvasContext.clearRect(0, 0, canvas.width, canvas.height);
canvasContext.translate(Math.ceil(canvas.width / 2), Math.ceil(canvas.height / 2));
canvasContext.drawImage(icon, -Math.ceil(canvas.width / 2), -Math.ceil(canvas.height / 2), canvas.width, canvas.height);
canvasContext.fillStyle = "rgba(190,190,190,1)";
canvasContext.fillRect(-2, 1, 11, 8);
if (coimg) {
canvasContext.drawImage(coimg, -1, 1, 10, 8);
}
canvasContext.restore();
chrome.browserAction.setIcon({imageData:canvasContext.getImageData(0, 0, 19, 19)});
};
this.set = function() {
chrome.browserAction.setIcon({path:{19:strPath}});
};
function ease(x) {
return(1 - Math.sin(Math.PI / 2 + x * Math.PI)) / 2;
}
this.rotate = function() {
var rotation = 0;
var animationFrames = 30;
var animationSpeed = 1;
var cicles = 0;
function drawIconAtRotation() {
var width = canvas.width - 1;
var height = canvas.height - 1;
canvasContext.save();
canvasContext.clearRect(0, 0, canvas.width, canvas.height);
canvasContext.translate(Math.ceil(canvas.width / 2), Math.ceil(canvas.height / 2));
canvasContext.rotate(2 * Math.PI * ease(rotation));
canvasContext.drawImage(icon, -Math.ceil(width / 2), -Math.ceil(height / 2), width, height);
canvasContext.restore();
chrome.browserAction.setIcon({imageData:canvasContext.getImageData(0, 0, canvas.width, canvas.height)});
}
function Do() {
rotation += 1 / animationFrames;
drawIconAtRotation();
if (cicles <= 2) {
if (rotation >= 1) {
rotation = 0;
cicles += 1;
}
setTimeout(Do, animationSpeed);
} else {
rotation = 0;
chrome.browserAction.setIcon({path:{19:icon.src}});
}
}
Do();
};
this.flipHorizontal = function() {
var rotation = -2;
var animationFrames = 60;
var animationSpeed = 1;
function drawIconAtRotation() {
canvasContext.save();
canvasContext.clearRect(0, 0, canvas.width, canvas.height);
canvasContext.translate(Math.ceil(canvas.width / 2), Math.ceil(canvas.height / 2));
canvasContext.scale(ease(rotation), 1);
canvasContext.drawImage(icon, -Math.ceil(canvas.width / 2), -Math.ceil(canvas.height / 2), canvas.width, canvas.height);
canvasContext.restore();
chrome.browserAction.setIcon({imageData:canvasContext.getImageData(0, 0, canvas.width, canvas.height)});
}
function Do() {
rotation += 1 / animationFrames;
drawIconAtRotation();
if (rotation <= 1) {
setTimeout(Do, animationSpeed);
} else {
rotation = -2;
chrome.browserAction.setIcon({path:{19:icon.src}});
}
}
Do();
};
this.flipVertical = function() {
var rotation = -2;
var animationFrames = 60;
var animationSpeed = 1;
function drawIconAtRotation() {
canvasContext.save();
canvasContext.clearRect(0, 0, canvas.width, canvas.height);
canvasContext.translate(Math.ceil(canvas.width / 2), Math.ceil(canvas.height / 2));
canvasContext.scale(1, ease(rotation));
canvasContext.drawImage(icon, -Math.ceil(canvas.width / 2), -Math.ceil(canvas.height / 2), canvas.width, canvas.height);
canvasContext.restore();
chrome.browserAction.setIcon({imageData:canvasContext.getImageData(0, 0, canvas.width, canvas.height)});
}
function Do() {
rotation += 1 / animationFrames;
drawIconAtRotation();
if (rotation <= 1) {
setTimeout(Do, animationSpeed);
} else {
rotation = -2;
chrome.browserAction.setIcon({path:{19:icon.src}});
}
}
Do();
};
this.pulse = function() {
var rotation = -3;
var animationFrames = 60;
var animationSpeed = 2;
function drawIconAtRotation() {
canvasContext.save();
canvasContext.clearRect(0, 0, canvas.width, canvas.height);
canvasContext.translate(Math.ceil(canvas.width / 2), Math.ceil(canvas.height / 2));
canvasContext.scale(ease(rotation), ease(rotation));
canvasContext.drawImage(icon, -Math.ceil(canvas.width / 2), -Math.ceil(canvas.height / 2), canvas.width, canvas.height);
canvasContext.restore();
chrome.browserAction.setIcon({imageData:canvasContext.getImageData(0, 0, canvas.width, canvas.height)});
}
function Do() {
rotation += 1 / animationFrames;
drawIconAtRotation();
if (rotation <= 1) {
setTimeout(Do, animationSpeed);
} else {
rotation = -3;
chrome.browserAction.setIcon({path:{19:icon.src}});
}
}
Do();
};
this.pulse2 = function() {
var rotation = -3;
var animationFrames = 15;
var animationSpeed = 1;
function drawIconAtRotation() {
canvasContext.save();
canvasContext.clearRect(0, 0, canvas.width, canvas.height);
canvasContext.translate(Math.ceil(canvas.width / 2), Math.ceil(canvas.height / 2));
canvasContext.scale(ease(rotation), ease(rotation));
canvasContext.drawImage(icon, -Math.ceil(canvas.width / 2), -Math.ceil(canvas.height / 2), canvas.width, canvas.height);
canvasContext.restore();
chrome.browserAction.setIcon({imageData:canvasContext.getImageData(0, 0, canvas.width, canvas.height)});
}
function Do() {
rotation += 1 / animationFrames;
drawIconAtRotation();
if (rotation <= 1) {
setTimeout(Do, animationSpeed);
} else {
rotation = -3;
chrome.browserAction.setIcon({path:{19:icon.src}});
}
}
Do();
};
this.flipHorizontalChange = function(Icon) {
var rotation = -1;
var animationFrames = 35;
var animationSpeed = 7;
var i = 0;
var newIcon = document.createElement("img");
newIcon.setAttribute("src", Icon);
function drawIconAtRotation() {
canvasContext.save();
canvasContext.clearRect(0, 0, canvas.width, canvas.height);
canvasContext.translate(Math.ceil(canvas.width / 2), Math.ceil(canvas.height / 2));
canvasContext.scale(rotation, 1);
if (rotation > 0) {
canvasContext.drawImage(newIcon, -Math.ceil(canvas.width / 2), -Math.ceil(canvas.height / 2), canvas.width, canvas.height);
} else {
canvasContext.drawImage(icon, -Math.ceil(canvas.width / 2), -Math.ceil(canvas.height / 2), canvas.width, canvas.height);
}
canvasContext.restore();
chrome.browserAction.setIcon({imageData:canvasContext.getImageData(0, 0, canvas.width, canvas.height)});
}
function Do() {
rotation += 1 / animationFrames;
drawIconAtRotation();
i++;
if (rotation <= 1) {
setTimeout(Do, animationSpeed);
} else {
rotation = -1;
chrome.browserAction.setIcon({path:{19:newIcon.src}});
icon = newIcon;
}
}
Do();
};
this.slideRightChange = function(Icon) {
var rotation = 0;
var animationFrames = 60;
var animationSpeed = 10;
var newIcon = document.createElement("img");
newIcon.setAttribute("src", Icon);
function drawIconAtRotation() {
canvasContext.save();
canvasContext.clearRect(0, 0, canvas.width + canvas.width, canvas.height);
var position = canvas.width * rotation;
canvasContext.translate(position, 0);
canvasContext.drawImage(icon, 0, 0, canvas.width, canvas.height);
canvasContext.drawImage(newIcon, -canvas.width, 0, canvas.width, canvas.height);
canvasContext.restore();
chrome.browserAction.setIcon({imageData:canvasContext.getImageData(0, 0, canvas.width, canvas.height)});
}
function Do() {
drawIconAtRotation();
rotation += 1 / animationFrames;
if (rotation <= 1) {
setTimeout(Do, animationSpeed);
} else {
rotation = 0;
chrome.browserAction.setIcon({path:{19:newIcon.src}});
icon = newIcon;
}
}
Do();
};
this.slideLeftChange = function(Icon) {
var rotation = 0;
var animationFrames = 60;
var animationSpeed = 10;
var newIcon = document.createElement("img");
newIcon.setAttribute("src", Icon);
function drawIconAtRotation() {
canvasContext.save();
canvasContext.clearRect(0, 0, canvas.width + canvas.width, canvas.height);
var position = canvas.width * rotation;
canvasContext.translate(position, 0);
canvasContext.drawImage(icon, 0, 0, canvas.width, canvas.height);
canvasContext.drawImage(newIcon, canvas.width, 0, canvas.width, canvas.height);
canvasContext.restore();
chrome.browserAction.setIcon({imageData:canvasContext.getImageData(0, 0, canvas.width, canvas.height)});
}
function Do() {
drawIconAtRotation();
rotation -= 1 / animationFrames;
if (rotation >= -1) {
setTimeout(Do, animationSpeed);
} else {
rotation = 0;
chrome.browserAction.setIcon({path:{19:newIcon.src}});
icon = newIcon;
}
}
Do();
};
}
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,170 @@
(function($) {
$.fn.ddslick = function(method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else {
if (typeof method === "object" || !method) {
return methods.init.apply(this, arguments);
} else {
$.error("Method " + method + " does not exists.");
}
}
};
var methods = {}, defaults = {data:[], keepJSONItemsOnTop:false, width:260, height:null, background:"#eee", selectText:"", defaultSelectedIndex:null, truncateDescription:true, imagePosition:"left", showSelectedHTML:true, clickOffToClose:true, onSelected:function() {
}}, ddSelectHtml = '<div class="dd-select"><input class="dd-selected-value" type="hidden" /><a class="dd-selected"></a><span class="dd-pointer dd-pointer-down"></span></div>', ddOptionsHtml = '<ul class="dd-options" style=""></ul>', ddslickCSS = '<style id="css-ddslick" type="text/css">' + ".dd-select{ border-radius:3px; border:solid 1px #ccc; position:relative; cursor:pointer;}" + ".dd-desc { color:#aaa; display:block; overflow: hidden; font-weight:normal; line-height: 1.4em; }" + ".dd-selected{line-height: 14px; font-size:14px; overflow:hidden; display:block; padding:3px 5px 3px 5px; font-weight:bold;}" +
".dd-pointer{ width:0; height:0; position:absolute; right:5px; top:50%; margin-top:-3px;}" + ".dd-pointer-down{ border:solid 5px transparent; border-top:solid 5px #000; }" + ".dd-pointer-up{border:solid 5px transparent !important; border-bottom:solid 5px #000 !important; margin-top:-8px;}" + ".dd-options{ border:solid 1px #ccc; border-top:none; list-style:none; box-shadow:0px 1px 5px #ddd; display:none; position:absolute; z-index:2000; margin:0; padding:0;background:#fff; overflow:auto;}" + ".dd-option{ line-height: 16px; font-size:12px; padding:10px; display:block; border-bottom:solid 1px #ddd; overflow:hidden; text-decoration:none; color:#333; cursor:pointer;-webkit-transition: all 0.25s ease-in-out; -moz-transition: all 0.25s ease-in-out;-o-transition: all 0.25s ease-in-out;-ms-transition: all 0.25s ease-in-out; }" +
".dd-options > li:last-child > .dd-option{ border-bottom:none;}" + ".dd-option:hover{ background:#ddd; color:#000;}" + ".dd-selected-description-truncated { text-overflow: ellipsis; white-space:nowrap; }" + ".dd-option-selected { background:#f6f6f6; }" + ".dd-option-image, .dd-selected-image { vertical-align:middle; float:left; margin-right:5px; max-width:64px;}" + ".dd-image-right { float:right; margin-right:15px; margin-left:5px;}" + "a.dd-option {text-decoration: none;}" + ".dd-container{ position:relative;}\u200b .dd-selected-text { font-weight:bold}\u200b</style>";
if ($("#css-ddslick").length <= 0) {
$(ddslickCSS).appendTo("head");
}
methods.init = function(options) {
var options = $.extend({}, defaults, options);
return this.each(function() {
var obj = $(this), data = obj.data("ddslick");
if (!data) {
var ddSelect = [], ddJson = options.data;
obj.find("option").each(function() {
var $this = $(this), thisData = $this.data();
ddSelect.push({text:$.trim($this.text()), value:$this.val(), selected:$this.is(":selected"), description:thisData.description, ico:thisData.ico, imageSrc:thisData.imagesrc});
});
if (options.keepJSONItemsOnTop) {
$.merge(options.data, ddSelect);
} else {
options.data = $.merge(ddSelect, options.data);
}
var original = obj, placeholder = $('<div id="' + obj.attr("id") + '"></div>');
obj.replaceWith(placeholder);
obj = placeholder;
obj.addClass("dd-container").append(ddSelectHtml).append(ddOptionsHtml);
var ddSelect = obj.find(".dd-select"), ddOptions = obj.find(".dd-options");
ddOptions.css({width:options.width});
ddSelect.css({width:options.width, background:options.background});
obj.css({width:options.width});
if (options.height != null) {
ddOptions.css({height:options.height, overflow:"auto"});
}
$.each(options.data, function(index, item) {
if (item.selected) {
options.defaultSelectedIndex = index;
}
ddOptions.append("<li>" + '<a class="dd-option">' + (item.value ? ' <input class="dd-option-value" type="hidden" value="' + item.value + '" />' : "") + (item.imageSrc ? ' <img class="dd-option-image' + (options.imagePosition == "right" ? " dd-image-right" : "") + '" src="' + item.imageSrc + '" />' : "") + (item.ico ? '<i class="uk-text-bold uk-icon-' + item.ico + '"></i>' : "") + (item.text ? ' <label class="dd-option-text">' + item.text + "</label>" : "") + (item.description ? ' <small class="dd-option-description dd-desc">' +
item.description + "</small>" : "") + "</a>" + "</li>");
});
var pluginData = {settings:options, original:original, selectedIndex:-1, selectedItem:null, selectedData:null};
obj.data("ddslick", pluginData);
if (options.selectText.length > 0 && options.defaultSelectedIndex == null) {
obj.find(".dd-selected").html(options.selectText);
} else {
var index = options.defaultSelectedIndex != null && options.defaultSelectedIndex >= 0 && options.defaultSelectedIndex < options.data.length ? options.defaultSelectedIndex : 0;
selectIndex(obj, index);
}
obj.find(".dd-select").on("click.ddslick", function() {
open(obj);
});
obj.find(".dd-option").on("click.ddslick", function() {
selectIndex(obj, $(this).closest("li").index());
});
if (options.clickOffToClose) {
ddOptions.addClass("dd-click-off-close");
obj.on("click.ddslick", function(e) {
e.stopPropagation();
});
$("body").on("click", function() {
$(".dd-click-off-close").slideUp(50).siblings(".dd-select").find(".dd-pointer").removeClass("dd-pointer-up");
});
}
}
});
};
methods.select = function(options) {
return this.each(function() {
if (options.index) {
selectIndex($(this), options.index);
}
});
};
methods.open = function() {
return this.each(function() {
var $this = $(this), pluginData = $this.data("ddslick");
if (pluginData) {
open($this);
}
});
};
methods.close = function() {
return this.each(function() {
var $this = $(this), pluginData = $this.data("ddslick");
if (pluginData) {
close($this);
}
});
};
methods.destroy = function() {
return this.each(function() {
var $this = $(this), pluginData = $this.data("ddslick");
if (pluginData) {
var originalElement = pluginData.original;
$this.removeData("ddslick").unbind(".ddslick").replaceWith(originalElement);
}
});
};
function selectIndex(obj, index) {
var pluginData = obj.data("ddslick");
var ddSelected = obj.find(".dd-selected"), ddSelectedValue = ddSelected.siblings(".dd-selected-value"), ddOptions = obj.find(".dd-options"), ddPointer = ddSelected.siblings(".dd-pointer"), selectedOption = obj.find(".dd-option").eq(index), selectedLiItem = selectedOption.closest("li"), settings = pluginData.settings, selectedData = pluginData.settings.data[index];
obj.find(".dd-option").removeClass("dd-option-selected");
selectedOption.addClass("dd-option-selected");
pluginData.selectedIndex = index;
pluginData.selectedItem = selectedLiItem;
pluginData.selectedData = selectedData;
if (settings.showSelectedHTML) {
ddSelected.html((selectedData.ico ? '<i class="uk-text-bold uk-icon-' + selectedData.ico + '"></i>' : "") + (selectedData.imageSrc ? '<img class="dd-selected-image' + (settings.imagePosition == "right" ? " dd-image-right" : "") + '" src="' + selectedData.imageSrc + '" />' : "") + (selectedData.text ? '<label class="dd-selected-text">' + selectedData.text + "</label>" : "") + (selectedData.description ? '<small class="dd-selected-description dd-desc' + (settings.truncateDescription ? " dd-selected-description-truncated" :
"") + '" >' + selectedData.description + "</small>" : ""));
} else {
ddSelected.html(selectedData.text);
}
ddSelectedValue.val(selectedData.value);
pluginData.original.val(selectedData.value);
obj.data("ddslick", pluginData);
close(obj);
adjustSelectedHeight(obj);
if (typeof settings.onSelected == "function") {
settings.onSelected.call(this, pluginData);
}
}
function open(obj) {
var $this = obj.find(".dd-select"), ddOptions = $this.siblings(".dd-options"), ddPointer = $this.find(".dd-pointer"), wasOpen = ddOptions.is(":visible");
$(".dd-click-off-close").not(ddOptions).slideUp(50);
$(".dd-pointer").removeClass("dd-pointer-up");
if (wasOpen) {
ddOptions.slideUp("fast");
ddPointer.removeClass("dd-pointer-up");
} else {
ddOptions.slideDown("fast");
ddPointer.addClass("dd-pointer-up");
}
adjustOptionsHeight(obj);
}
function close(obj) {
obj.find(".dd-options").slideUp(50);
obj.find(".dd-pointer").removeClass("dd-pointer-up").removeClass("dd-pointer-up");
}
function adjustSelectedHeight(obj) {
var lSHeight = obj.find(".dd-select").css("height");
var descriptionSelected = obj.find(".dd-selected-description");
var imgSelected = obj.find(".dd-selected-image");
if (descriptionSelected.length <= 0 && imgSelected.length > 0) {
}
}
function adjustOptionsHeight(obj) {
obj.find(".dd-option").each(function() {
var $this = $(this);
var lOHeight = $this.css("height");
var descriptionOption = $this.find(".dd-option-description");
var imgOption = obj.find(".dd-option-image");
if (descriptionOption.length <= 0 && imgOption.length > 0) {
$this.find(".dd-option-text").css("lineHeight", lOHeight);
}
});
}
})(jQuery);

View File

@ -0,0 +1,18 @@
$.fn.scrollTo = function(target, options, callback) {
if (typeof options == "function" && arguments.length == 2) {
callback = options;
options = target;
}
var settings = $.extend({scrollTarget:target, offsetTop:130, duration:500, easing:"swing"}, options);
return this.each(function() {
var scrollPane = $(this);
var scrollTarget = typeof settings.scrollTarget == "number" ? settings.scrollTarget : $(settings.scrollTarget);
var scrollY = typeof scrollTarget == "number" ? scrollTarget : scrollTarget.offset().top + scrollPane.scrollTop() - parseInt(settings.offsetTop);
scrollPane.animate({scrollTop:scrollY}, parseInt(settings.duration), settings.easing, function() {
if (typeof callback == "function") {
callback.call(this);
}
});
});
};

View File

@ -0,0 +1,46 @@
nl.drew.cp.lang = function() {
var lang = {};
lang.s = {"en":{}, "ru":{}};
lang.user = "";
lang.chrome = "";
lang.init = function() {
if (nl.drew.cp.ls.isset("lang")) {
nl.drew.cp.lang.user = nl.drew.cp.ls.get("lang", false);
}
};
lang.l = function(m) {
var nowLang = this.getLang();
if (typeof nl.drew.cp.lang.s[nowLang] == "undefined") {
nowLang = "en";
if (typeof nl.drew.cp.lang.s[nowLang] == "undefined") {
return "not found iteam";
}
}
if (typeof nl.drew.cp.lang.s[nowLang][m] == "undefined") {
nowLang = "en";
if (typeof nl.drew.cp.lang.s[nowLang][m] == "undefined") {
return "not found iteam";
}
}
return nl.drew.cp.lang.s[nowLang][m];
};
lang.getLang = function() {
if (nl.drew.cp.lang.user) {
return nl.drew.cp.lang.user;
}
var chromeLang = chrome.i18n.getUILanguage();
if (chromeLang.substr(2).toLowerCase() == "en") {
return "en";
} else {
if (chromeLang.substr(2).toLowerCase() == "ru") {
return "ru";
}
}
};
lang.setLang = function(l) {
nl.drew.cp.lang.user = l;
nl.drew.cp.ls.set("lang", l, false);
};
return lang;
}();

Some files were not shown because too many files have changed in this diff Show More