mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-28 04:13:43 +03:00
51 lines
2.2 KiB
JavaScript
Executable File
51 lines
2.2 KiB
JavaScript
Executable File
'use strict';
|
||
|
||
+function() {
|
||
|
||
const 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}) )
|
||
});
|
||
|
||
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=';
|
||
|
||
createMenuLinkEntry( 'Сайт в реестре блокировок?', tab => {
|
||
const ifIp = confirm('Да = искать по IP.\nНет = искать по домену.');
|
||
const hostname = createLink( tab.url ).hostname;
|
||
if (ifIp) {
|
||
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
|
||
}
|
||
return reestrUrl + hostname
|
||
});
|
||
|
||
createMenuLinkEntry( 'Из кэша Google', tab => 'https://webcache.googleusercontent.com/search?q=cache:' + removeProtocol(tab.url) );
|
||
|
||
createMenuLinkEntry( 'Из архива archive.org', tab => 'https://web.archive.org/web/*/' + removeProtocol(tab.url) );
|
||
|
||
createMenuLinkEntry( 'Свежий снимок страницы, Screenshot machine', tab => `
|
||
data:text/html;charset=utf8,<title>Screenshot machine</title>
|
||
<form method="POST" action="https://screenshotmachine.com/processor.php">
|
||
<input name="urlparam" value="${ removeProtocol(tab.url) }" type="hidden">
|
||
<input name="size" value="F" type="hidden">
|
||
<input name="cacheLimit" value="0" type="hidden">
|
||
</form>
|
||
<script>document.forms[0].submit()</script>`
|
||
);
|
||
|
||
createMenuLinkEntry( 'Разблокировать страницу по-другому', tab => chrome.extension.getURL('./pages/other-unblocks/index.html') +'?'+ removeProtocol(tab.url) );
|
||
|
||
}();
|