mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-24 02:13:43 +03:00
Added context menus
This commit is contained in:
parent
b8c1b325e4
commit
3d9ec1fd3d
|
@ -19,7 +19,7 @@
|
|||
Если пункт уже выбран, нажмите кнопку "[обновить]".
|
||||
2. Если появилось сообщение об ошибке, с которой вы не можете справиться, то [сообщите о проблеме](#Как-сообщить-о-проблеме).
|
||||
3. Если ошибок нет, пишет "PAC-скрипт установлен", но https://archive.org всё равно не открывается, то нужно разбираться:
|
||||
* Зайдите в настройки chrome://settings, убедитесь, что параметр прокси контролируется этим расширением, а не другим.
|
||||
* Зайдите в настройки chrome://settings/search#proxy и убедитесь, что параметр прокси контролируется этим расширением, а не другим.
|
||||
* Проверьте доступность прокси АнтиЗапрет и АнтиЦенз: `ping proxy.antizapret.prostovpn.org`, `ping gw2.anticenz.org`
|
||||
* Посмотрите логи фоновой страницы в chrome://extensions, если умеете.
|
||||
4. Если ничего не помогло, то [сообщите о проблеме](#Как-сообщить-о-проблеме).
|
||||
|
|
Binary file not shown.
|
@ -68,6 +68,7 @@ window.antiCensorRu = {
|
|||
_periodicUpdateAlarmReason: 'Периодичное обновление PAC-скрипта Антизапрет',
|
||||
|
||||
pushToStorage(cb) {
|
||||
console.log('Pushing...');
|
||||
|
||||
// Copy only settable properties.
|
||||
var onlySettable = {};
|
||||
|
@ -99,7 +100,7 @@ window.antiCensorRu = {
|
|||
syncWithPacProvider(cb) {
|
||||
var cb = asyncLogGroup('Syncing with PAC provider...', cb);
|
||||
if (!this.pacProvider)
|
||||
return cb({clarification: 'Сперва выберите PAC-провайдера.'});
|
||||
return cb({clarification:{message:'Сперва выберите PAC-провайдера.'}});
|
||||
|
||||
var pacSetPromise = new Promise(
|
||||
(resolve, reject) => setPacScriptFromProvider(
|
||||
|
@ -151,7 +152,7 @@ window.antiCensorRu = {
|
|||
}
|
||||
);
|
||||
|
||||
return nextUpdateMoment === now; // ifAlarmTriggered. Return value may be changed.
|
||||
return nextUpdateMoment === now; // ifAlarmTriggered. May be changed.
|
||||
},
|
||||
|
||||
installPac(key, cb) {
|
||||
|
@ -191,6 +192,7 @@ chrome.storage.local.get(null, oldStorage => {
|
|||
// LAUNCH, RELOAD, UPDATE
|
||||
antiCensorRu._currentPacProviderKey = oldStorage._currentPacProviderKey;
|
||||
antiCensorRu.lastPacUpdateStamp = oldStorage.lastPacUpdateStamp || antiCensorRu.lastPacUpdateStamp;
|
||||
console.log( 'Last PAC update was on', new Date(antiCensorRu.lastPacUpdateStamp).toLocaleString('ru-RU') );
|
||||
}
|
||||
|
||||
chrome.alarms.onAlarm.addListener(
|
||||
|
@ -222,7 +224,7 @@ chrome.storage.local.get(null, oldStorage => {
|
|||
var ifAlarmTriggered = antiCensorRu.setAlarms();
|
||||
|
||||
if (antiCensorRu.version === oldStorage.version) {
|
||||
// LAUNCH, RELOAD
|
||||
// LAUNCH, RELOAD, ENABLE
|
||||
antiCensorRu.pacProviders = oldStorage.pacProviders;
|
||||
return console.log('Extension launched, reloaded or enabled.');
|
||||
}
|
||||
|
@ -232,7 +234,7 @@ chrome.storage.local.get(null, oldStorage => {
|
|||
if (!ifAlarmTriggered)
|
||||
updatePacProxyIps(
|
||||
antiCensorRu.pacProvider,
|
||||
ipsError => ipsError ? console.log('Error updating IPs:', ipsError) : antiCensorRu.pushToStorage()
|
||||
ipsError => ipsError ? console.error('Error updating IPs:', ipsError) : antiCensorRu.pushToStorage()
|
||||
);
|
||||
|
||||
/*
|
||||
|
@ -253,8 +255,6 @@ chrome.storage.local.get(null, oldStorage => {
|
|||
**/
|
||||
});
|
||||
|
||||
// PRIVATE
|
||||
|
||||
function asyncLogGroup() {
|
||||
var args = [].slice.apply(arguments);
|
||||
var cb = args.pop();
|
||||
|
@ -267,25 +267,44 @@ function asyncLogGroup() {
|
|||
}
|
||||
}
|
||||
|
||||
function ifSuccessfulCode(status) {
|
||||
return status >= 200 && status < 300 || status === 304;
|
||||
}
|
||||
|
||||
function httpGet(url, cb) {
|
||||
var cb = cb || (() => {});
|
||||
var req = new XMLHttpRequest();
|
||||
var ifAsync = true;
|
||||
req.open('GET', url, ifAsync);
|
||||
req.onload = event => {
|
||||
if ( !ifSuccessfulCode(req.status) ) {
|
||||
req.clarification = {message: 'Получен ответ с неудачным HTTP-кодом '+req.status+ '.'};
|
||||
return cb(req);
|
||||
return fetch(url).then(
|
||||
res => {
|
||||
var textCb = err => cb && res.text().then( text => cb(err, text), cb );
|
||||
var status = res.status;
|
||||
if ( !( status >= 200 && status < 300 || status === 304 ) ) {
|
||||
res.clarification = {message: 'Получен ответ с неудачным HTTP-кодом '+status+'.'};
|
||||
return textCb(res);
|
||||
}
|
||||
console.log('GETed with success.');
|
||||
return cb(null, req.responseText)
|
||||
};
|
||||
req.onerror = event => { event.clarification = {message: 'Что-то не так с сетью, проверьте соединение.'}; return cb(event); };
|
||||
req.send();
|
||||
return textCb();
|
||||
},
|
||||
err => {
|
||||
err.clarification = {message: 'Что-то не так с сетью, проверьте соединение.'};
|
||||
return cb && cb(err);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getIpsAndCnames(host, cb) {
|
||||
httpGet(
|
||||
'http://www.dns-lg.com/google1/'+ host +'/a',
|
||||
(err, res) => {
|
||||
if (res)
|
||||
try {
|
||||
res = JSON.parse(res);
|
||||
if (err)
|
||||
err.clarification.message += ' Сервер: '+ res.message;
|
||||
else
|
||||
res = res.answer;
|
||||
} catch(e) {
|
||||
err = err || {clarification:{message:''}};
|
||||
err.clarification.message += ' Сервер: '+ res;
|
||||
err.clarification.message.trim();
|
||||
}
|
||||
return cb( err, res );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function updatePacProxyIps(provider, cb) {
|
||||
|
@ -296,14 +315,12 @@ function updatePacProxyIps(provider, cb) {
|
|||
};
|
||||
var i = 0;
|
||||
provider.proxyHosts.map(
|
||||
proxyHost => httpGet(
|
||||
'http://www.dns-lg.com/google1/'+ proxyHost +'/A',
|
||||
(err, res) => {
|
||||
proxyHost => getIpsAndCnames(
|
||||
proxyHost,
|
||||
(err, ans) => {
|
||||
if (!err) {
|
||||
provider.proxyIps = provider.proxyIps || {};
|
||||
JSON.parse(res).answer.map(
|
||||
ans => provider.proxyIps[ ans.rdata ] = proxyHost
|
||||
)
|
||||
ans.filter( ans => ans.type === 'A' ).map( ans => provider.proxyIps[ ans.rdata ] = proxyHost );
|
||||
} else
|
||||
failure.errors[proxyHost] = err;
|
||||
|
||||
|
@ -324,7 +341,7 @@ function setPacScriptFromProvider(provider, cb) {
|
|||
(err, res) => {
|
||||
if (err) {
|
||||
err.clarification = {
|
||||
message: 'Не удалось скачать PAC-скрипт с адреса: ' +provider.pacUrl+ '.',
|
||||
message: 'Не удалось скачать PAC-скрипт с адреса: '+ provider.pacUrl +'.',
|
||||
prev: err.clarification
|
||||
};
|
||||
return cb(err);
|
147
extensions/chromium/minimalistic-pac-setter/extension/2-block-informer.js
Executable file
147
extensions/chromium/minimalistic-pac-setter/extension/2-block-informer.js
Executable file
|
@ -0,0 +1,147 @@
|
|||
'use strict';
|
||||
|
||||
// Shows user browserAction icon if any part of the current site is being blocked and proxied.
|
||||
|
||||
/*
|
||||
In what moment the title of the previous icon is cleared?
|
||||
By my observations it usually takes place near tabs.onUpdate of tab status to "loading".
|
||||
So if you set a title earlier it may be cleared by browser.
|
||||
It pertains not only to page refesh but to newly opened pages too.
|
||||
Also on loosing title see:
|
||||
https://github.com/ilyaigpetrov/repository-for-chrome-bugs/blob/master/browserAction-title-lost-after-setting/background.js
|
||||
Crazy parallel Chrome.
|
||||
**/
|
||||
|
||||
window.tabWithError2ip = {}; // For errors only: Error? -> Check this IP!
|
||||
|
||||
function getHostname(url) {
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
return a.hostname;
|
||||
}
|
||||
|
||||
+function() {
|
||||
|
||||
var _tabCallbacks = {};
|
||||
|
||||
function afterTabUpdated(tabId, cb) {
|
||||
if (_tabCallbacks[tabId])
|
||||
_tabCallbacks[tabId].push(cb);
|
||||
else _tabCallbacks[tabId] = [cb];
|
||||
}
|
||||
|
||||
function onTabUpdate(tabId) {
|
||||
if (_tabCallbacks[tabId]) {
|
||||
_tabCallbacks[tabId].map( f => f() );
|
||||
delete _tabCallbacks[tabId];
|
||||
}
|
||||
}
|
||||
|
||||
chrome.tabs.onUpdated.addListener( onTabUpdate );
|
||||
|
||||
function isInsideTabWithIp(requestDetails) {
|
||||
return requestDetails.tabId !== -1 && requestDetails.ip
|
||||
}
|
||||
|
||||
chrome.webRequest.onErrorOccurred.addListener(
|
||||
requestDetails =>
|
||||
isInsideTabWithIp(requestDetails) &&
|
||||
(
|
||||
isProxiedAndInformed(requestDetails) || requestDetails.type === 'main_frame' && ( window.tabWithError2ip[requestDetails.tabId] = requestDetails.ip )
|
||||
),
|
||||
{ urls: ['<all_urls>'] }
|
||||
);
|
||||
|
||||
chrome.tabs.onRemoved.addListener( tabId => { onTabUpdate(tabId); delete window.tabWithError2ip[tabId] } );
|
||||
|
||||
var previousUpdateTitleFinished = Promise.resolve();
|
||||
|
||||
function isProxiedAndInformed(requestDetails) {
|
||||
|
||||
if (
|
||||
!( window.antiCensorRu.pacProvider && window.antiCensorRu.pacProvider.proxyIps && window.antiCensorRu.pacProvider.proxyIps[ requestDetails.ip ] )
|
||||
) return false;
|
||||
|
||||
var ifMainFrame = requestDetails.type === 'main_frame';
|
||||
|
||||
previousUpdateTitleFinished = previousUpdateTitleFinished.then(
|
||||
() => new Promise(
|
||||
resolve => {
|
||||
var cb = () => updateTitle( requestDetails, resolve );
|
||||
return ifMainFrame ? afterTabUpdated(requestDetails.tabId, cb) : cb();
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
return true;
|
||||
|
||||
function updateTitle(requestDetails, cb) {
|
||||
|
||||
chrome.browserAction.getTitle(
|
||||
{ tabId: requestDetails.tabId },
|
||||
title => {
|
||||
var ifTitleSetAlready = /\n/.test(title);
|
||||
var proxyHost = window.antiCensorRu.pacProvider.proxyIps[ requestDetails.ip ];
|
||||
|
||||
var hostname = getHostname( requestDetails.url );
|
||||
|
||||
var ifShouldUpdateTitle = false;
|
||||
var indent = ' ';
|
||||
var proxyTitle = 'Прокси:';
|
||||
|
||||
if (!ifTitleSetAlready) {
|
||||
title = 'Разблокированы:\n'+ indent + hostname +'\n'+ proxyTitle +'\n'+ indent + proxyHost;
|
||||
ifShouldUpdateTitle = true;
|
||||
|
||||
chrome.browserAction.setBadgeText({
|
||||
tabId: requestDetails.tabId,
|
||||
text: ifMainFrame ? '1' : '%1'
|
||||
});
|
||||
|
||||
} else {
|
||||
var hostsProxiesPair = title.split(proxyTitle);
|
||||
|
||||
if (hostsProxiesPair[1].indexOf(proxyHost) === -1) {
|
||||
title = title.replace(hostsProxiesPair[1], hostsProxiesPair[1] +'\n'+ indent + proxyHost);
|
||||
ifShouldUpdateTitle = true;
|
||||
}
|
||||
|
||||
if (hostsProxiesPair[0].indexOf(hostname) === -1) {
|
||||
title = title.replace(proxyTitle, indent + hostname +'\n'+ proxyTitle);
|
||||
ifShouldUpdateTitle = true;
|
||||
|
||||
var _cb = cb;
|
||||
cb = () => chrome.browserAction.getBadgeText(
|
||||
{tabId: requestDetails.tabId},
|
||||
result => {
|
||||
chrome.browserAction.setBadgeText(
|
||||
{
|
||||
tabId: requestDetails.tabId,
|
||||
text: ( isNaN( result.charAt(0) ) && result.charAt(0) || '' ) + (hostsProxiesPair[0].split('\n').length - 1)
|
||||
}
|
||||
);
|
||||
return _cb();
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (ifShouldUpdateTitle)
|
||||
chrome.browserAction.setTitle({
|
||||
title: title,
|
||||
tabId: requestDetails.tabId
|
||||
});
|
||||
|
||||
return cb();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
chrome.webRequest.onResponseStarted.addListener(
|
||||
requestDetails => isInsideTabWithIp(requestDetails) && isProxiedAndInformed(requestDetails),
|
||||
{ urls: ['<all_urls>'] }
|
||||
);
|
||||
|
||||
}();
|
37
extensions/chromium/minimalistic-pac-setter/extension/3-context-menus.js
Executable file
37
extensions/chromium/minimalistic-pac-setter/extension/3-context-menus.js
Executable file
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
+function() {
|
||||
|
||||
var createMenuLinkEntry = (title, tab2url) => chrome.contextMenus.create({
|
||||
title: title,
|
||||
contexts: ['browser_action'],
|
||||
onclick: (menuInfo, tab) => Promise.resolve( tab2url( tab ) ).then( url => chrome.tabs.create({url: url}) )
|
||||
});
|
||||
|
||||
createMenuLinkEntry( 'Сайт доступен из-за границы? ISUP.ME', tab => 'http://isup.me/'+ getHostname(tab.url) );
|
||||
|
||||
createMenuLinkEntry( 'Сайт доступен из-за границы?', tab =>
|
||||
`data:text/html;charset=utf8,<title>Запрашиваю...</title>
|
||||
<form method="POST" action="https://www.host-tracker.com/ru/InstantCheck/Create">
|
||||
<input name="InstantCheckUrl" value="${getHostname(tab.url)}" type="hidden">
|
||||
</form>
|
||||
<script>document.forms[0].submit()</script>`
|
||||
);
|
||||
|
||||
window.reestrUrl = 'http://reestr.rublacklist.net/search/?q=';
|
||||
|
||||
createMenuLinkEntry('IP этого сайта в реестре блокировок?', tab => {
|
||||
var hostname = getHostname( tab.url );
|
||||
var ip = window.tabWithError2ip[tab.id];
|
||||
if ( /^[.\d]+$/.test(hostname) || /^[:\dA-Fa-f]+$/.test(hostname) )
|
||||
ip = hostname;
|
||||
return ip
|
||||
? reestrUrl + ip
|
||||
: chrome.extension.getURL('./pages/is-ip-blocked/index.html') +'?'+ hostname
|
||||
});
|
||||
|
||||
createMenuLinkEntry( 'Домен этого сайта в реестре блокировок?', tab => reestrUrl + getHostname(tab.url) );
|
||||
createMenuLinkEntry( 'Поиск этой страницы в архиве archive.org', tab => 'http://web.archive.org/web/*/'+ tab.url );
|
||||
createMenuLinkEntry( 'Разблокировать страницу по-другому', tab => chrome.extension.getURL('./pages/other-unblocks/index.html') +'?'+ tab.url );
|
||||
|
||||
}();
|
|
@ -1,124 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
// Shows user browserAction icon if any part of the current site is being blocked and proxied.
|
||||
|
||||
/*
|
||||
In what moment the title of the previous icon is cleared?
|
||||
By my observations it usually takes place near tabs.onUpdate of tab status to "loading".
|
||||
So if you set a title earlier it may be cleared by browser.
|
||||
It pertains not only to page refesh but to newly opened pages too.
|
||||
Also on loosing title see:
|
||||
https://github.com/ilyaigpetrov/repository-for-chrome-bugs/blob/master/browserAction-title-lost-after-setting/background.js
|
||||
Crazy parallel Chrome.
|
||||
**/
|
||||
window._tabCallbacks = {};
|
||||
|
||||
function afterTabUpdated(tabId, cb) {
|
||||
if (window._tabCallbacks[tabId])
|
||||
window._tabCallbacks[tabId].push(cb);
|
||||
else window._tabCallbacks[tabId] = [cb];
|
||||
}
|
||||
|
||||
function onTabUpdate(tabId) {
|
||||
if (window._tabCallbacks[tabId]) {
|
||||
window._tabCallbacks[tabId].map( f => f() );
|
||||
delete window._tabCallbacks[tabId];
|
||||
}
|
||||
}
|
||||
|
||||
chrome.tabs.onUpdated.addListener( onTabUpdate );
|
||||
chrome.tabs.onRemoved.addListener( onTabUpdate );
|
||||
|
||||
var previousUpdateTitleFinished = Promise.resolve();
|
||||
|
||||
function blockInform(requestDetails) {
|
||||
|
||||
if (
|
||||
requestDetails.tabId === -1 || // Not inside tab.
|
||||
!window.antiCensorRu.pacProvider || !window.antiCensorRu.pacProvider.proxyIps || !window.antiCensorRu.pacProvider.proxyIps[ requestDetails.ip ]
|
||||
) return;
|
||||
|
||||
previousUpdateTitleFinished = previousUpdateTitleFinished.then(
|
||||
() => new Promise(
|
||||
resolve => {
|
||||
var cb = () => updateTitle( requestDetails, resolve );
|
||||
return requestDetails.type === 'main_frame' ? afterTabUpdated(requestDetails.tabId, cb) : cb();
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
function updateTitle(requestDetails, cb) {
|
||||
|
||||
chrome.browserAction.getTitle(
|
||||
{ tabId: requestDetails.tabId },
|
||||
title => {
|
||||
var ifTitleSetAlready = /\n/.test(title);
|
||||
var proxyHost = window.antiCensorRu.pacProvider.proxyIps[ requestDetails.ip ];
|
||||
|
||||
var a = document.createElement('a');
|
||||
a.href = requestDetails.url;
|
||||
var hostname = a.hostname;
|
||||
|
||||
var ifShouldUpdateTitle = false;
|
||||
var indent = ' ';
|
||||
var proxyTitle = 'Прокси:';
|
||||
|
||||
if (!ifTitleSetAlready) {
|
||||
title = 'Разблокированы:\n'+ indent + hostname +'\n'+ proxyTitle +'\n'+ indent + proxyHost;
|
||||
ifShouldUpdateTitle = true;
|
||||
|
||||
chrome.browserAction.setBadgeText({
|
||||
tabId: requestDetails.tabId,
|
||||
text: requestDetails.type === 'main_frame' ? '1' : '%1'
|
||||
});
|
||||
|
||||
} else {
|
||||
var hostsProxiesPair = title.split(proxyTitle);
|
||||
|
||||
if (hostsProxiesPair[1].indexOf(proxyHost) === -1) {
|
||||
title = title.replace(hostsProxiesPair[1], hostsProxiesPair[1] +'\n'+ indent + proxyHost);
|
||||
ifShouldUpdateTitle = true;
|
||||
}
|
||||
|
||||
if (hostsProxiesPair[0].indexOf(hostname) === -1) {
|
||||
title = title.replace(proxyTitle, indent + hostname +'\n'+ proxyTitle);
|
||||
ifShouldUpdateTitle = true;
|
||||
|
||||
var _cb = cb;
|
||||
cb = () => chrome.browserAction.getBadgeText(
|
||||
{tabId: requestDetails.tabId},
|
||||
result => {
|
||||
chrome.browserAction.setBadgeText(
|
||||
{
|
||||
tabId: requestDetails.tabId,
|
||||
text: ( isNaN( result.charAt(0) ) && result.charAt(0) || '' ) + (hostsProxiesPair[0].split('\n').length - 1)
|
||||
}
|
||||
);
|
||||
return _cb();
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (ifShouldUpdateTitle)
|
||||
chrome.browserAction.setTitle({
|
||||
title: title,
|
||||
tabId: requestDetails.tabId
|
||||
});
|
||||
|
||||
return cb();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
chrome.webRequest.onResponseStarted.addListener(
|
||||
blockInform,
|
||||
{ urls: ['<all_urls>'] }
|
||||
);
|
||||
|
||||
chrome.webRequest.onErrorOccurred.addListener(
|
||||
blockInform,
|
||||
{ urls: ['<all_urls>'] }
|
||||
);
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
|
||||
"name": "Обход блокировок Рунета",
|
||||
"name": "Обход блокировок Рунета NEW",
|
||||
"description": "Аргументы против цензуры: https://git.io/vEkI9",
|
||||
"version": "0.0.0.12",
|
||||
"version": "0.0.0.14",
|
||||
"icons": {
|
||||
"128": "/icons/ribbon128.png"
|
||||
},
|
||||
|
@ -16,12 +16,14 @@
|
|||
"alarms",
|
||||
"storage",
|
||||
"<all_urls>",
|
||||
"tabs"
|
||||
"tabs",
|
||||
"contextMenus"
|
||||
],
|
||||
"background": {
|
||||
"scripts": ["sync-pac-script-with-pac-provider.js", "block-informer.js"]
|
||||
"scripts": ["1-sync-pac-script-with-pac-provider.js", "2-block-informer.js", "3-context-menus.js"]
|
||||
},
|
||||
"browser_action": {
|
||||
"default_title": "Этот сайт благословлён РКН",
|
||||
"default_popup": "/pages/choose-pac-provider/index.html"
|
||||
},
|
||||
"options_ui": {
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
renderPage();
|
||||
|
||||
function renderPage() {
|
||||
console.log('Rendering started.');
|
||||
chrome.runtime.getBackgroundPage( backgroundPage => {
|
||||
|
||||
function getStatus() {
|
||||
return document.querySelector('#status');
|
||||
|
@ -18,8 +15,6 @@ function renderPage() {
|
|||
status.classList.add('off');
|
||||
}
|
||||
|
||||
chrome.runtime.getBackgroundPage( backgroundPage => {
|
||||
|
||||
var antiCensorRu = backgroundPage.antiCensorRu;
|
||||
|
||||
// SET DATE
|
||||
|
@ -54,7 +49,7 @@ function renderPage() {
|
|||
}
|
||||
|
||||
setDate();
|
||||
chrome.storage.onChanged.addListener( setDate );
|
||||
chrome.storage.onChanged.addListener( changes => changes.lastPacUpdateStamp.newValue && setDate() );
|
||||
|
||||
// CLOSE BUTTON
|
||||
|
||||
|
@ -94,7 +89,6 @@ function renderPage() {
|
|||
|
||||
function enableDisableInputs() {
|
||||
var inputs = document.querySelectorAll('input');
|
||||
console.log(inputs.length);
|
||||
for (var i = 0; i < inputs.length; i++)
|
||||
inputs[i].disabled = !inputs[i].disabled;
|
||||
}
|
||||
|
@ -110,17 +104,15 @@ function renderPage() {
|
|||
do {
|
||||
message = message +' '+ (clarification && clarification.message || err.message || '');
|
||||
clarification = clarification.prev;
|
||||
} while( clarification && clarification.prev );
|
||||
} while( clarification );
|
||||
message = message.trim();
|
||||
|
||||
message = '<span style="font-size: 0.9em; color: darkred">'+ message +'</span>';
|
||||
var label = ifNotCritical ? 'Некритичная ошибка.' : 'Ошибка!';
|
||||
label = '<span style="color:red">'+ label +'</span>';
|
||||
setStatusTo(
|
||||
label +'<br/>'+ message +' <a href class="link-button">[Ещё подробнее]</a>'
|
||||
`<span style="color:red">${ifNotCritical ? 'Некритичная ошибка.' : 'Ошибка!'}</span>
|
||||
<br/>
|
||||
<span style="font-size: 0.9em; color: darkred">${message}</span>
|
||||
<a href class="link-button">[Ещё подробнее]</a>`
|
||||
);
|
||||
var btn = getStatus().querySelector('.link-button');
|
||||
btn.onclick = function() {
|
||||
getStatus().querySelector('.link-button').onclick = function() {
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = '\
|
||||
Более подробную информацию можно узнать из логов фоновой страницы:<br/>\
|
||||
|
@ -144,6 +136,4 @@ function renderPage() {
|
|||
if (antiCensorRu.ifFirstInstall)
|
||||
triggerChosenProvider();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Ищу IP...</title>
|
||||
<script src="./index.js"></script>
|
||||
</head>
|
||||
</html>
|
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
chrome.runtime.getBackgroundPage( backgroundPage => {
|
||||
|
||||
var hostname = window.location.search.substring(1);
|
||||
|
||||
backgroundPage.getIpsAndCnames( hostname, (err, records) =>
|
||||
err
|
||||
? document.write(
|
||||
`<title>IP уже нет</title>
|
||||
Не могу получить IP для домена "${hostname}". Домена уже нет?<br/>
|
||||
Ошибка:<br/>
|
||||
${err.clarification && err.clarification.message || err.message}`
|
||||
)
|
||||
: records.length === 1 && records[0].type === 'A'
|
||||
? window.location.replace( backgroundPage.reestrUrl + records[0].rdata )
|
||||
: document.write(
|
||||
'<title>Выбор IP</title>'
|
||||
+ '<h4>У домена несколько IP / синонимов:</h4>'
|
||||
+ records
|
||||
.sort( (a,b) => a.rdata.localeCompare(b.rdata) )
|
||||
.map( ans => ans.rdata.link( ans.type === 'A' ? backgroundPage.reestrUrl + ans.rdata : window.location.pathname +'?'+ ans.rdata ) )
|
||||
.join('<br/>')
|
||||
)
|
||||
)
|
||||
|
||||
})
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>По-другому</title>
|
||||
<style></style>
|
||||
</head>
|
||||
<body>
|
||||
<script src="./index.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
|
||||
var url = decodeURIComponent(window.location.search.substring(1));
|
||||
document.body.innerHTML = `
|
||||
<input type="text" value="${url}" autofocus style="width: 100%; border: 0; outline: none; font-size: 2em"/>
|
||||
<button>Копировать</button>
|
||||
<h3>Веб-прокси</h3>
|
||||
<a href="https://www.vpnbook.com/webproxy">vpnbook [COPY]</a><br/>
|
||||
<a href="https://webproxy.com/browse.php?u=${url}">webproxy.com</a><br/>
|
||||
<a href="http://buka.link/browse.php?u=${url.replace(/\?.+/,'')}">buka.link [AVAST]</a><br/>
|
||||
<a href="https://hide.me/en/proxy">hide.me [COPY]</a><br/>
|
||||
<a href="https://www.hidemyass.com/proxy">Hide my ass [COPY]</a><br/>
|
||||
<a href="https://www.google.com/search?q=webproxy">Другие</a>
|
||||
<h3>Из кеша поисковиков</h3>
|
||||
<a href="https://webcache.googleusercontent.com/search?q=cache:${url}">Google</a></br>
|
||||
<a href="http://viewcached.com/${url}">viewcached.com</a></br>
|
||||
<a href="http://cachedview.com">cachedview.com [COPY]</a>
|
||||
<h3>Из архивов Интернета</h3>
|
||||
<a href="http://web.archive.org/web/*/${url}">web.archive.org</a><br/>
|
||||
<a href="http://archive.is/${url}">archive.is</a><br/>
|
||||
<a href="http://timetravel.mementoweb.org">Momento Time Travel [COPY]</a>
|
||||
`;
|
||||
var _ = document.querySelector('input');
|
||||
_.onfocus = function() { this.select() };
|
||||
document.querySelector('button').onclick = () => {_.focus(); document.execCommand('copy')};
|
0
pac-generator/dump.csv
Normal file → Executable file
0
pac-generator/dump.csv
Normal file → Executable file
Can't render this file because it is too large.
|
0
pac-performance-analyses/benchmark/Inputs/blocked-hosts.txt
Normal file → Executable file
0
pac-performance-analyses/benchmark/Inputs/blocked-hosts.txt
Normal file → Executable file
0
pac-performance-analyses/benchmark/Program.cs
Normal file → Executable file
0
pac-performance-analyses/benchmark/Program.cs
Normal file → Executable file
0
pac-performance-analyses/benchmark/project.json
Normal file → Executable file
0
pac-performance-analyses/benchmark/project.json
Normal file → Executable file
0
pac-performance-analyses/chart/README.md
Normal file → Executable file
0
pac-performance-analyses/chart/README.md
Normal file → Executable file
0
pac-performance-analyses/chart/src/data.tsv
Normal file → Executable file
0
pac-performance-analyses/chart/src/data.tsv
Normal file → Executable file
0
pac-performance-analyses/chart/src/index.html
Normal file → Executable file
0
pac-performance-analyses/chart/src/index.html
Normal file → Executable file
Loading…
Reference in New Issue
Block a user