-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for click-to-load of embedded frames
Additionally, as a requirement to support click-to-load feature, redirected resources will from now on no longer be collapsed. Related issues: - #2688 - #3619 - #1899 This new feature should considered in its draft stage and it needs to be fine-tuned as per feedback. Important: Only embedded frames can be converted into click-to-load widgets, as only these can be properly shieded from access by page content. Examples of usage: ||youtube.com/embed/$3p,frame,redirect=clicktoload ||scribd.com/embeds/$3p,frame,redirect=clicktoload ||player.vimeo.com/video/$3p,frame,redirect=clicktoload
- Loading branch information
Showing
9 changed files
with
238 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
uBlock Origin - a browser extension to block requests. | ||
Copyright (C) 2014-present 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 | ||
*/ | ||
|
||
body { | ||
align-items: center; | ||
background-color: var(--default-surface); | ||
border: 1px solid var(--ubo-red); | ||
box-sizing: border-box; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-evenly; | ||
position: relative; | ||
} | ||
|
||
.logo { | ||
left: 0; | ||
padding: 2px; | ||
position: absolute; | ||
top: 0; | ||
} | ||
|
||
#frameURL { | ||
font-family: monospace; | ||
font-size: 90%; | ||
overflow: hidden; | ||
word-break: break-all; | ||
} | ||
|
||
#clickToLoad { | ||
cursor: default; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/******************************************************************************* | ||
uBlock Origin - a browser extension to block requests. | ||
Copyright (C) 2014-present 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 | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/******************************************************************************/ | ||
/******************************************************************************/ | ||
|
||
(( ) => { | ||
|
||
/******************************************************************************/ | ||
|
||
if ( typeof vAPI !== 'object' ) { return; } | ||
|
||
const url = new URL(self.location.href); | ||
const frameURL = url.searchParams.get('url'); | ||
const frameURLElem = document.getElementById('frameURL'); | ||
|
||
frameURLElem.textContent = frameURL; | ||
|
||
const onWindowResize = function() { | ||
document.body.style.width = `${self.innerWidth}px`; | ||
document.body.style.height = `${self.innerHeight}px`; | ||
}; | ||
|
||
onWindowResize(); | ||
|
||
self.addEventListener('resize', onWindowResize); | ||
|
||
document.body.addEventListener('click', ev => { | ||
if ( ev.isTrusted === false ) { return; } | ||
//if ( ev.target === frameURLElem ) { return; } | ||
vAPI.messaging.send('default', { | ||
what: 'clickToLoad', | ||
frameURL, | ||
}).then(ok => { | ||
if ( ok ) { | ||
self.location.replace(frameURL); | ||
} | ||
}); | ||
}); | ||
|
||
/******************************************************************************/ | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
5916920
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this work for Disqus Click to Load again?
5916920
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will have to be investigated. I found a site which uses a Disqus widget:
https://www.iphoneincanada.ca/news/apple-telegram-belarus/
So it seems we might have to use a cosmetic filter to force Disqus iframe to have non-zero dimension:
More examples of sites using Disqus will have to be tested.
5916920
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works better:
Examples (I will add as I find them):
https://www.iphoneincanada.ca/news/apple-telegram-belarus/
https://sparktoro.com/blog/product-market-fit-is-a-broken-concept-theres-a-better-way/
https://petapixel.com/2020/10/06/nvidia-uses-ai-to-slash-bandwidth-on-video-calls/
https://publicdomainreview.org/essay/fungi-folklore-and-fairyland
5916920
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not block Disqus completely, because script from
disqus.com
is executed even before frame is loaded. It seems it's actually the script which creates the frame. Example:https://florydziak.com/blogger/2020/10/nie-uwierzycie.html
BTW, you can still use custom scriptlet: https://gist.github.com/gwarser/2d4b5dcd32b0d219e0ae65b43eb1f53d
5916920
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to use the scriptlet, Do I host it on github and add to the advance settings as resource?
Never mind I figured it out, thanks
5916920
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, but for now that's best I can do, next step is possibly to understand what that script does and have a local neutered version.
5916920
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*$3p,frame,redirect-rule=click2load.html
is aggressively cached in Firefox. Causes placeholder to be displayed even when page is whitelisted.https://www.wykop.pl/link/5769513/za-narod-podzielony-pieklo-was-pochlonie-kibice-lech-poznan-za-kobietami/
Click2load placeholder still displayed. Forcing cache-free reload works fine.