Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
this fixes #1013
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Mar 25, 2015
1 parent 6f155d5 commit a4b4bc9
Show file tree
Hide file tree
Showing 10 changed files with 512 additions and 45 deletions.
5 changes: 4 additions & 1 deletion platform/chromium/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,8 @@
"http://*/*",
"https://*/*"
],
"short_name": "uBlock"
"short_name": "uBlock",
"web_accessible_resources": [
"document-blocked.html"
]
}
20 changes: 20 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,26 @@
"message": "off",
"description": "Firefox-specific: appears as 'uBlock (off)'"
},
"docblockedPrompt1": {
"message": "uBlock has prevented the following page from loading:",
"description": "English: uBlock has prevented the following page from loading:"
},
"docblockedPrompt2": {
"message": "Because of the following filter",
"description": "English: Because of the following filter"
},
"docblockedBack": {
"message": "Go back",
"description": "English: Go back"
},
"docblockedClose": {
"message": "Close this window",
"description": "English: Close this window"
},
"docblockedProceed": {
"message": "Proceed at your own risk",
"description": "English: Proceed at your own risk"
},
"dummy":{
"message":"This entry must be the last one",
"description":"so we dont need to deal with comma for last entry"
Expand Down
49 changes: 49 additions & 0 deletions src/document-blocked.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
body {
font-size: large;
text-align: center;
}
.label {
margin-bottom: 2px;
}
.code {
background-color: rgba(0, 0, 0, 0.1);
display: inline-block;
font-family: monospace;
margin: 0;
padding: 2px 4px;
word-break: break-all;
}
a {
margin: 0 1em;
}
img {
height: 60vh;
left: 10vw;
opacity: 0.05;
pointer-events: none;
position: fixed;
bottom: 5vh;
width: 80vw;
}
</style>
</head>
<body>
<!-- http://commons.wikimedia.org/wiki/File:Caution_sign_used_on_roads_pn.svg
Public domain. I removed the shadow.
--><img src="img/Caution_sign_used_on_roads_pn.svg" />
<p data-i18n="docblockedPrompt1" class="label"></p><p class="what code"></p>
<p data-i18n="docblockedPrompt2" class="label"></p><p class="code" id="why"></p>
<p><a id="back" data-i18n="docblockedBack" href></a><a id="bye" data-i18n="docblockedClose" href></a></p>
<p data-i18n="docblockedProceed" class="label"></p><p class="code"><a id="yolo" class="what" href></a></p>
<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/document-blocked.js"></script>
</body>
</html>
176 changes: 176 additions & 0 deletions src/img/Caution_sign_used_on_roads_pn.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ return {

// read-only
systemSettings: {
compiledMagic: 'intdliecolot',
compiledMagic: 'squafjaywuba',
selfieMagic: 'spqmeuaftfra'
},

Expand Down
73 changes: 73 additions & 0 deletions src/js/document-blocked.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*******************************************************************************
uBlock - 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 messager = vAPI.messaging.channel('document-blocked.js');

var matches = /details=([^&]+)/.exec(window.location.search);
if ( matches === null ) {
return;
}
var details = JSON.parse(atob(matches[1]));

/******************************************************************************/

var yolo = function(ev) {
var onReady = function() {
window.location.replace(details.url);
};

messager.send({
what: 'temporarilyWhitelistDocument',
url: details.url
}, onReady);

ev.preventDefault();
};

/******************************************************************************/

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(); });
} else {
uDom('#back').css('display', 'none');
}

uDom('#bye').on('click', function() { window.close(); });

uDom('#yolo').attr('href', details.url)
.on('click', yolo);

})();

/******************************************************************************/
39 changes: 38 additions & 1 deletion src/js/messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,43 @@ vAPI.messaging.listen('subscriber.js', onMessage);

})();

// https://www.youtube.com/watch?v=3_WcygKJP1k
/******************************************************************************/
/******************************************************************************/

// document-blocked.js

(function() {

'use strict';

/******************************************************************************/

var onMessage = function(request, sender, callback) {
// Async
switch ( request.what ) {
default:
break;
}

// Sync
var response;

switch ( request.what ) {
case 'temporarilyWhitelistDocument':
µBlock.webRequest.temporarilyWhitelistDocument(request.url);
break;

default:
return vAPI.messaging.UNHANDLED;
}

callback(response);
};

vAPI.messaging.listen('document-blocked.js', onMessage);

/******************************************************************************/

})();

/******************************************************************************/
Loading

0 comments on commit a4b4bc9

Please sign in to comment.