mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
fine tuning warning page
This commit is contained in:
parent
53d96cc88f
commit
a1da6df4d6
@ -512,8 +512,16 @@
|
|||||||
"description": "English: Close this window"
|
"description": "English: Close this window"
|
||||||
},
|
},
|
||||||
"docblockedProceed": {
|
"docblockedProceed": {
|
||||||
"message": "Proceed at your own risk",
|
"message": "Disable strict blocking for {{hostname}}",
|
||||||
"description": "English: Proceed at your own risk"
|
"description": "English: Disable strict blocking for {{hostname}} ..."
|
||||||
|
},
|
||||||
|
"docblockedDisableTemporary": {
|
||||||
|
"message": "Temporarily",
|
||||||
|
"description": "English: Temporarily"
|
||||||
|
},
|
||||||
|
"docblockedDisablePermanent": {
|
||||||
|
"message": "Permanently",
|
||||||
|
"description": "English: Permanently"
|
||||||
},
|
},
|
||||||
"dummy":{
|
"dummy":{
|
||||||
"message":"This entry must be the last one",
|
"message":"This entry must be the last one",
|
||||||
|
@ -13,14 +13,11 @@ body > div {
|
|||||||
margin: 1.5em 0;
|
margin: 1.5em 0;
|
||||||
}
|
}
|
||||||
body > div > p {
|
body > div > p {
|
||||||
margin: 2px 0;
|
margin: 4px 0;
|
||||||
}
|
}
|
||||||
body > div > p:first-child {
|
body > div > p:first-child {
|
||||||
margin: 1.5em 0 0 0;
|
margin: 1.5em 0 0 0;
|
||||||
}
|
}
|
||||||
body > div > p:last-child {
|
|
||||||
margin: 0 0 1.5em 0;
|
|
||||||
}
|
|
||||||
.code {
|
.code {
|
||||||
background-color: rgba(0, 0, 0, 0.1);
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -30,7 +27,7 @@ body > div > p:last-child {
|
|||||||
}
|
}
|
||||||
button {
|
button {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin: 0 1em;
|
margin: 0 1em 0.25em 1em;
|
||||||
padding: 0.25em 0.5em;
|
padding: 0.25em 0.5em;
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
}
|
}
|
||||||
@ -66,8 +63,13 @@ button {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p data-i18n="docblockedProceed"></p>
|
<p id="proceed"></p>
|
||||||
<p><a id="yolo" class="what" href></a></p>
|
<p><button id="proceedTemporary" data-i18n="docblockedDisableTemporary" type="button"></button>
|
||||||
|
<button id="proceedPermanent" data-i18n="docblockedDisablePermanent" type="button"></button></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display: none;">
|
||||||
|
<span id="proceedTemplate"><span></span><span class="code"></span><span></span></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="js/vapi-common.js"></script>
|
<script src="js/vapi-common.js"></script>
|
||||||
|
@ -30,30 +30,58 @@
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var messager = vAPI.messaging.channel('document-blocked.js');
|
var messager = vAPI.messaging.channel('document-blocked.js');
|
||||||
|
var details = {};
|
||||||
|
|
||||||
var matches = /details=([^&]+)/.exec(window.location.search);
|
(function() {
|
||||||
if ( matches === null ) {
|
var matches = /details=([^&]+)/.exec(window.location.search);
|
||||||
return;
|
if ( matches === null ) {
|
||||||
}
|
return;
|
||||||
var details = JSON.parse(atob(matches[1]));
|
}
|
||||||
|
details = JSON.parse(atob(matches[1]));
|
||||||
|
})();
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var yolo = function(ev) {
|
var proceedToURL = function() {
|
||||||
var onReady = function() {
|
window.location.replace(details.url);
|
||||||
window.location.replace(details.url);
|
};
|
||||||
};
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
var proceedTemporary = function() {
|
||||||
messager.send({
|
messager.send({
|
||||||
what: 'temporarilyWhitelistDocument',
|
what: 'temporarilyWhitelistDocument',
|
||||||
url: details.url
|
url: details.url
|
||||||
}, onReady);
|
}, proceedToURL);
|
||||||
|
|
||||||
ev.preventDefault();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
var proceedPermanent = function() {
|
||||||
|
messager.send({
|
||||||
|
what: 'toggleHostnameSwitch',
|
||||||
|
name: 'dontBlockDoc',
|
||||||
|
hostname: details.hn,
|
||||||
|
state: true
|
||||||
|
}, proceedToURL);
|
||||||
|
};
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var matches = /^(.*)\{\{hostname\}\}(.*)$/.exec(vAPI.i18n('docblockedProceed'));
|
||||||
|
if ( matches === null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var proceed = uDom('#proceedTemplate').clone();
|
||||||
|
proceed.descendants('span:nth-of-type(1)').text(matches[1]);
|
||||||
|
proceed.descendants('span:nth-of-type(2)').text(details.hn);
|
||||||
|
proceed.descendants('span:nth-of-type(3)').text(matches[2]);
|
||||||
|
uDom('#proceed').append(proceed);
|
||||||
|
})();
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
uDom('.what').text(details.url);
|
uDom('.what').text(details.url);
|
||||||
uDom('#why').text(details.why.slice(3));
|
uDom('#why').text(details.why.slice(3));
|
||||||
|
|
||||||
@ -65,8 +93,8 @@ if ( window.history.length > 1 ) {
|
|||||||
uDom('#back').css('display', 'none');
|
uDom('#back').css('display', 'none');
|
||||||
}
|
}
|
||||||
|
|
||||||
uDom('#yolo').attr('href', details.url)
|
uDom('#proceedTemporary').attr('href', details.url).on('click', proceedTemporary);
|
||||||
.on('click', yolo);
|
uDom('#proceedPermanent').attr('href', details.url).on('click', proceedPermanent);
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -235,6 +235,7 @@ var onBeforeRootFrameRequest = function(details) {
|
|||||||
// Blocked
|
// Blocked
|
||||||
var query = btoa(JSON.stringify({
|
var query = btoa(JSON.stringify({
|
||||||
url: requestURL,
|
url: requestURL,
|
||||||
|
hn: requestHostname,
|
||||||
why: result
|
why: result
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user