new way of handling blocked documents
parent
e751a5403b
commit
ddaa948cf4
@ -0,0 +1,76 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
µMatrix - a browser extension to block requests.
|
||||||
|
Copyright (C) 2015 Raymond Hill
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||||
|
|
||||||
|
Home: https://github.com/gorhill/uBlock
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* global uDom */
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
var details = {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var matches = /details=([^&]+)/.exec(window.location.search);
|
||||||
|
if ( matches === null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
details = JSON.parse(atob(matches[1]));
|
||||||
|
})();
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
uDom('.what').text(details.url);
|
||||||
|
uDom('#why').text(details.why.slice(3));
|
||||||
|
|
||||||
|
if ( window.history.length > 1 ) {
|
||||||
|
uDom('#back').on('click', function() { window.history.back(); });
|
||||||
|
uDom('#bye').css('display', 'none');
|
||||||
|
} else {
|
||||||
|
uDom('#bye').on('click', function() { window.close(); });
|
||||||
|
uDom('#back').css('display', 'none');
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
// See if the target hostname is still blacklisted, and if not, navigate to it.
|
||||||
|
|
||||||
|
var messager = vAPI.messaging.channel('main-blocked.js');
|
||||||
|
|
||||||
|
messager.send({
|
||||||
|
what: 'mustBlock',
|
||||||
|
scope: details.hn,
|
||||||
|
hostname: details.hn,
|
||||||
|
type: 'doc'
|
||||||
|
}, function(response) {
|
||||||
|
if ( response === false ) {
|
||||||
|
window.location.replace(details.url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title></title>
|
||||||
|
<link rel="stylesheet" href="css/common.css" type="text/css">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: large;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
body > div {
|
||||||
|
margin: 1.5em 0;
|
||||||
|
}
|
||||||
|
body > div > p {
|
||||||
|
margin: 4px 0;
|
||||||
|
}
|
||||||
|
body > div > p:first-child {
|
||||||
|
margin: 1.5em 0 0 0;
|
||||||
|
}
|
||||||
|
.code {
|
||||||
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
|
display: inline-block;
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: large;
|
||||||
|
line-height: 1;
|
||||||
|
padding: 2px 4px;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
cursor: pointer;
|
||||||
|
margin: 0 1em 0.25em 1em;
|
||||||
|
padding: 0.25em 0.5em;
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
#warningSign {
|
||||||
|
margin: 1e, 0;
|
||||||
|
opacity: 1;
|
||||||
|
pointer-events: none;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#warningSign > span {
|
||||||
|
color: #f2a500;
|
||||||
|
font-size: 180px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="warningSign"><span class="fa"></span></div>
|
||||||
|
<div>
|
||||||
|
<p data-i18n="mainBlockedPrompt1"></p>
|
||||||
|
<p class="what code"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div>
|
||||||
|
<p data-i18n="mainBlockedPrompt2"></p>
|
||||||
|
<p id="why" class="code"></p>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p><button id="back" data-i18n="mainBlockedBack" type="button"></button>
|
||||||
|
<button id="bye" data-i18n="mainBlockedClose" type="button"></button></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="js/vapi-common.js"></script>
|
||||||
|
<script src="js/vapi-client.js"></script>
|
||||||
|
<script src="js/udom.js"></script>
|
||||||
|
<script src="js/i18n.js"></script>
|
||||||
|
<script src="js/main-blocked.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue