mirror of https://github.com/gorhill/uBlock.git
Fine tune click-to-load widget
Notably, add clickable link to open the widget in its own tab. Also, allows the URL to be text- selected so that it becomes possible to use the selection in a browser contextual menu's "Open in a new tab" option.
This commit is contained in:
parent
54c8a0a6f2
commit
46d7f8a70c
|
@ -42,6 +42,9 @@ body {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
#frameURL > a {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
#clickToLoad {
|
#clickToLoad {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
|
|
@ -34,7 +34,8 @@ const url = new URL(self.location.href);
|
||||||
const frameURL = url.searchParams.get('url');
|
const frameURL = url.searchParams.get('url');
|
||||||
const frameURLElem = document.getElementById('frameURL');
|
const frameURLElem = document.getElementById('frameURL');
|
||||||
|
|
||||||
frameURLElem.textContent = frameURL;
|
frameURLElem.children[0].textContent = frameURL;
|
||||||
|
frameURLElem.children[1].href = frameURL;
|
||||||
|
|
||||||
const onWindowResize = function() {
|
const onWindowResize = function() {
|
||||||
document.body.style.width = `${self.innerWidth}px`;
|
document.body.style.width = `${self.innerWidth}px`;
|
||||||
|
@ -47,7 +48,7 @@ self.addEventListener('resize', onWindowResize);
|
||||||
|
|
||||||
document.body.addEventListener('click', ev => {
|
document.body.addEventListener('click', ev => {
|
||||||
if ( ev.isTrusted === false ) { return; }
|
if ( ev.isTrusted === false ) { return; }
|
||||||
//if ( ev.target === frameURLElem ) { return; }
|
if ( ev.target.closest('#frameURL') !== null ) { return; }
|
||||||
vAPI.messaging.send('default', {
|
vAPI.messaging.send('default', {
|
||||||
what: 'clickToLoad',
|
what: 'clickToLoad',
|
||||||
frameURL,
|
frameURL,
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>uBlock Origin Click-to-Load</title>
|
<title>uBlock Origin Click-to-Load</title>
|
||||||
<link rel="stylesheet" href="../css/themes/default.css">
|
<link rel="stylesheet" href="../css/themes/default.css">
|
||||||
<link rel="stylesheet" href="../css/common.css">
|
<link rel="stylesheet" href="../css/common.css">
|
||||||
|
<link rel="stylesheet" href="../css/fa-icons.css">
|
||||||
<link rel="stylesheet" href="../css/click2load.css">
|
<link rel="stylesheet" href="../css/click2load.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -13,8 +14,9 @@
|
||||||
|
|
||||||
<span class="logo"><img src="../img/ublock.svg"></span>
|
<span class="logo"><img src="../img/ublock.svg"></span>
|
||||||
<span id="clickToLoad" data-i18n="clickToLoad"></span>
|
<span id="clickToLoad" data-i18n="clickToLoad"></span>
|
||||||
<div id="frameURL"></div>
|
<div id="frameURL"><span></span> <a class="fa-icon" href="" rel="noreferrer noopener" target="_blank">external-link</a></div>
|
||||||
|
|
||||||
|
<script src="../js/fa-icons.js"></script>
|
||||||
<script src="../js/vapi.js"></script>
|
<script src="../js/vapi.js"></script>
|
||||||
<script src="../js/vapi-common.js"></script>
|
<script src="../js/vapi-common.js"></script>
|
||||||
<script src="../js/vapi-client.js"></script>
|
<script src="../js/vapi-client.js"></script>
|
||||||
|
|
Loading…
Reference in New Issue