mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-04-08 04:51:23 -06:00
Disable copy code button in insecure contexts (#1226)
Implements point (2a) of https://github.com/just-the-docs/just-the-docs/issues/1202 ## Secure context - behaviour unchanged  ## Unsecure context - copy icon not shown and console message logged 
This commit is contained in:
parent
d107faaff4
commit
7daf042a03
@ -488,6 +488,11 @@ jtd.onReady(function(){
|
||||
|
||||
jtd.onReady(function(){
|
||||
|
||||
if (!window.isSecureContext) {
|
||||
console.log('Window does not have a secure context, therefore code clipboard copy functionality will not be available. For more details see https://web.dev/async-clipboard/#security-and-permissions');
|
||||
return;
|
||||
}
|
||||
|
||||
var codeBlocks = document.querySelectorAll('div.highlighter-rouge, div.listingblock > div.content, figure.highlight');
|
||||
|
||||
// note: the SVG svg-copied and svg-copy is only loaded as a Jekyll include if site.enable_copy_code_button is true; see _includes/icons/icons.html
|
||||
|
Loading…
x
Reference in New Issue
Block a user