Add site blocked alert page

Inform the user about the full url blocking
This commit is contained in:
Kevin Röbert 2017-09-13 23:35:40 +02:00
parent b23089ac9a
commit e528ade2f0
4 changed files with 109 additions and 45 deletions

View File

@ -12,6 +12,7 @@ var badgedStatus;
var tabid = 0; var tabid = 0;
var globalCounter; var globalCounter;
var globalURLCounter; var globalURLCounter;
var siteBlockedAlert = browser.extension.getURL ('./siteBlockedAlert.html');
/** /**
* Initialize the JSON provider object keys. * Initialize the JSON provider object keys.
@ -205,6 +206,9 @@ function Provider(_name,_completeProvider = false){
this.matchException = function(url) { this.matchException = function(url) {
var result = false; var result = false;
//Add the site blocked alert to every exception
if(url == siteBlockedAlert) return true;
for (var i = 0; i < exceptions.length; i++) { for (var i = 0; i < exceptions.length; i++) {
if(result) { break; } if(result) { break; }
@ -335,12 +339,13 @@ function clearUrl(request)
result = removeFieldsFormURL(providers[i], request); result = removeFieldsFormURL(providers[i], request);
/* /*
* Cancel the Request * Cancel the Request and redirect to the site blocked alert page,
* to inform the user about the full url blocking.
*/ */
if(result["cancel"]){ if(result["cancel"]){
return { return {
cancel: true redirectUrl: siteBlockedAlert
} };
} }
/* /*

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "ClearURLs", "name": "ClearURLs",
"version": "1.1.2.1", "version": "1.1.2.2",
"author": "Kevin R.", "author": "Kevin R.",
"description": "Remove tracking elements form URLs. ", "description": "Remove tracking elements form URLs. ",
"homepage_url": "https://github.com/KevinRoebert/ClearUrls", "homepage_url": "https://github.com/KevinRoebert/ClearUrls",
@ -36,5 +36,8 @@
{ {
"matches": ["<all_urls>"] "matches": ["<all_urls>"]
} }
],
"web_accessible_resources": [
"siteBlockedAlert.html"
] ]
} }

View File

@ -67,7 +67,7 @@
<footer> <footer>
<div class="row"> <div class="row">
<div class="col-sm-1 navbar-inverse text-center"> <div class="col-sm-1 navbar-inverse text-center">
<small class="text-muted">Version 1.1.2.1</small> <small class="text-muted">Version 1.1.2.2</small>
</div> </div>
</div> </div>
</footer> </footer>

56
siteBlockedAlert.html Normal file
View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="bootstrap.min.css">
<style>
body {
background-color: #333;
color: white;
text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
h1 {
color: #f72d04;
}
.content {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%,-50%);
}
</style>
</head>
<body>
<div class="container content">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h1 class="text-center">This site or element was blocked by <b>ClearURLs</b> Add-on</h1>
<p class="text-center">
This site or element was blocked by <b>ClearURLs</b> Add-on, because we identify this site as an
advertising and/or tracking service.
<br>
To visit this site, you must temporarily deactivate the Add-on.
</p>
</div>
</div>
</div>
<footer class="navbar-fixed-bottom">
<div class="navbar-inverse text-center">
<small class="text-muted">Version 1.1.2.2</small>
</div>
</footer>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="jquery-3.2.1.min.js"></script>
<script src="bootstrap.min.js"></script>
</body>
</html>