mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-24 02:13:43 +03:00
fixed urls in context menus
This commit is contained in:
parent
004ca19087
commit
04d5dd2346
|
@ -22,7 +22,7 @@ window.antiCensorRu = {
|
||||||
|
|
||||||
pacProviders: {
|
pacProviders: {
|
||||||
Антизапрет: {
|
Антизапрет: {
|
||||||
pacUrl: 'http://antizapret.prostovpn.org/proxy.pac',
|
pacUrl: 'https://antizapret.prostovpn.org/proxy.pac',
|
||||||
proxyHosts: ['proxy.antizapret.prostovpn.org'],
|
proxyHosts: ['proxy.antizapret.prostovpn.org'],
|
||||||
proxyIps: {
|
proxyIps: {
|
||||||
'195.154.110.37': 'proxy.antizapret.prostovpn.org',
|
'195.154.110.37': 'proxy.antizapret.prostovpn.org',
|
||||||
|
@ -37,8 +37,8 @@ window.antiCensorRu = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Оба_и_на_свитчах: {
|
Оба_и_на_свитчах: {
|
||||||
//pacUrl: 'https://drive.google.com/uc?export=download&id=0B-ZCVSvuNWf0akpCOURNS2VCTmc',
|
pacUrl: 'https://drive.google.com/uc?export=download&id=0B-ZCVSvuNWf0akpCOURNS2VCTmc',
|
||||||
pacUrl: 'https://drive.google.com/uc?export=download&id=0B-ZCVSvuNWf0WGczNmJzY3gzMWc',
|
//pacUrl: 'https://drive.google.com/uc?export=download&id=0B-ZCVSvuNWf0WGczNmJzY3gzMWc', // Beta
|
||||||
proxyHosts: ['proxy.antizapret.prostovpn.org', 'gw2.anticenz.org'],
|
proxyHosts: ['proxy.antizapret.prostovpn.org', 'gw2.anticenz.org'],
|
||||||
proxyIps: {
|
proxyIps: {
|
||||||
'195.154.110.37': 'proxy.antizapret.prostovpn.org',
|
'195.154.110.37': 'proxy.antizapret.prostovpn.org',
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
|
|
||||||
window.tabWithError2ip = {}; // For errors only: Error? -> Check this IP!
|
window.tabWithError2ip = {}; // For errors only: Error? -> Check this IP!
|
||||||
|
|
||||||
function getHostname(url) {
|
function createLink(url) {
|
||||||
var a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
a.href = url;
|
a.href = url;
|
||||||
return a.hostname;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
+function() {
|
+function() {
|
||||||
|
@ -83,7 +83,7 @@ function getHostname(url) {
|
||||||
var ifTitleSetAlready = /\n/.test(title);
|
var ifTitleSetAlready = /\n/.test(title);
|
||||||
var proxyHost = window.antiCensorRu.pacProvider.proxyIps[ requestDetails.ip ];
|
var proxyHost = window.antiCensorRu.pacProvider.proxyIps[ requestDetails.ip ];
|
||||||
|
|
||||||
var hostname = getHostname( requestDetails.url );
|
var hostname = createLink( requestDetails.url ).hostname;
|
||||||
|
|
||||||
var ifShouldUpdateTitle = false;
|
var ifShouldUpdateTitle = false;
|
||||||
var indent = ' ';
|
var indent = ' ';
|
||||||
|
@ -99,7 +99,7 @@ function getHostname(url) {
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var hostsProxiesPair = title.split(proxyTitle);
|
const hostsProxiesPair = title.split(proxyTitle);
|
||||||
|
|
||||||
if (hostsProxiesPair[1].indexOf(proxyHost) === -1) {
|
if (hostsProxiesPair[1].indexOf(proxyHost) === -1) {
|
||||||
title = title.replace(hostsProxiesPair[1], hostsProxiesPair[1] +'\n'+ indent + proxyHost);
|
title = title.replace(hostsProxiesPair[1], hostsProxiesPair[1] +'\n'+ indent + proxyHost);
|
||||||
|
|
|
@ -2,19 +2,24 @@
|
||||||
|
|
||||||
+function() {
|
+function() {
|
||||||
|
|
||||||
var createMenuLinkEntry = (title, tab2url) => chrome.contextMenus.create({
|
const createMenuLinkEntry = (title, tab2url) => chrome.contextMenus.create({
|
||||||
title: title,
|
title: title,
|
||||||
contexts: ['browser_action'],
|
contexts: ['browser_action'],
|
||||||
onclick: (menuInfo, tab) => Promise.resolve( tab2url( tab ) ).then( url => chrome.tabs.create({url: url}) )
|
onclick: (menuInfo, tab) => Promise.resolve( tab2url( tab ) ).then( url => chrome.tabs.create({url: url}) )
|
||||||
});
|
});
|
||||||
|
|
||||||
createMenuLinkEntry( 'Сайт доступен из-за границы? Is up?', tab => 'http://isup.me/'+ getHostname(tab.url) );
|
const removeProtocol = (url) => {
|
||||||
|
const link = createLink(url);
|
||||||
|
return link.href.replace( link.protocol + '//', '' );
|
||||||
|
};
|
||||||
|
|
||||||
|
createMenuLinkEntry( 'Сайт доступен из-за границы? Is up?', tab => 'http://isup.me/'+ createLink(tab.url).hostname );
|
||||||
|
|
||||||
window.reestrUrl = 'http://reestr.rublacklist.net/search/?q=';
|
window.reestrUrl = 'http://reestr.rublacklist.net/search/?q=';
|
||||||
|
|
||||||
createMenuLinkEntry( 'Сайт в реестре блокировок?', tab => {
|
createMenuLinkEntry( 'Сайт в реестре блокировок?', tab => {
|
||||||
const ifIp = confirm('Да = искать по IP.\nНет = искать по домену.');
|
const ifIp = confirm('Да = искать по IP.\nНет = искать по домену.');
|
||||||
const hostname = getHostname( tab.url );
|
const hostname = createLink( tab.url ).hostname;
|
||||||
if (ifIp) {
|
if (ifIp) {
|
||||||
var ip = window.tabWithError2ip[tab.id];
|
var ip = window.tabWithError2ip[tab.id];
|
||||||
if ( /^[.\d]+$/.test(hostname) || /^[:\dA-Fa-f]+$/.test(hostname) )
|
if ( /^[.\d]+$/.test(hostname) || /^[:\dA-Fa-f]+$/.test(hostname) )
|
||||||
|
@ -26,20 +31,20 @@
|
||||||
return reestrUrl + hostname
|
return reestrUrl + hostname
|
||||||
});
|
});
|
||||||
|
|
||||||
createMenuLinkEntry( 'Из кэша Google', tab => 'https://webcache.googleusercontent.com/search?q=cache:'+ tab.url );
|
createMenuLinkEntry( 'Из кэша Google', tab => 'https://webcache.googleusercontent.com/search?q=cache:' + removeProtocol(tab.url) );
|
||||||
|
|
||||||
createMenuLinkEntry( 'Из архива archive.org', tab => 'https://web-beta.archive.org/web/submit?url='+ tab.url );
|
createMenuLinkEntry( 'Из архива archive.org', tab => 'https://web.archive.org/web/*/' + removeProtocol(tab.url) );
|
||||||
|
|
||||||
createMenuLinkEntry( 'Свежий снимок страницы', tab => `
|
createMenuLinkEntry( 'Свежий снимок страницы, Screenshot machine', tab => `
|
||||||
data:text/html;charset=utf8,<title>Чиииз...</title>
|
data:text/html;charset=utf8,<title>Screenshot machine</title>
|
||||||
<form method="POST" action="https://screenshotmachine.com/processor.php">
|
<form method="POST" action="https://screenshotmachine.com/processor.php">
|
||||||
<input name="urlparam" value="${tab.url}" type="hidden">
|
<input name="urlparam" value="${ removeProtocol(tab.url) }" type="hidden">
|
||||||
<input name="size" value="F" type="hidden">
|
<input name="size" value="F" type="hidden">
|
||||||
<input name="cacheLimit" value="0" type="hidden">
|
<input name="cacheLimit" value="0" type="hidden">
|
||||||
</form>
|
</form>
|
||||||
<script>document.forms[0].submit()</script>`
|
<script>document.forms[0].submit()</script>`
|
||||||
);
|
);
|
||||||
|
|
||||||
createMenuLinkEntry( 'Разблокировать страницу по-другому', tab => chrome.extension.getURL('./pages/other-unblocks/index.html') +'?'+ tab.url );
|
createMenuLinkEntry( 'Разблокировать страницу по-другому', tab => chrome.extension.getURL('./pages/other-unblocks/index.html') +'?'+ removeProtocol(tab.url) );
|
||||||
|
|
||||||
}();
|
}();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user