mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
browser: fix broken inline clipboard buttons after IE11 refactor #452
This commit is contained in:
parent
6b96c2d662
commit
6d90be3015
1 changed files with 3 additions and 4 deletions
|
@ -335,8 +335,7 @@ function initCodeClipboard(){
|
||||||
for( var i = 0; i < codeElements.length; i++ ){
|
for( var i = 0; i < codeElements.length; i++ ){
|
||||||
var code = codeElements[i];
|
var code = codeElements[i];
|
||||||
var text = code.textContent;
|
var text = code.textContent;
|
||||||
var parent = code.parentNode;
|
var inPre = code.parentNode.tagName.toLowerCase() == 'pre';
|
||||||
var inPre = parent.tagName.toLowerCase() == 'pre';
|
|
||||||
|
|
||||||
if( inPre || text.length > 5 ){
|
if( inPre || text.length > 5 ){
|
||||||
var clip = new ClipboardJS( '.copy-to-clipboard-button', {
|
var clip = new ClipboardJS( '.copy-to-clipboard-button', {
|
||||||
|
@ -382,7 +381,7 @@ function initCodeClipboard(){
|
||||||
var span = document.createElement( 'span' );
|
var span = document.createElement( 'span' );
|
||||||
span.classList.add( 'copy-to-clipboard' );
|
span.classList.add( 'copy-to-clipboard' );
|
||||||
span.appendChild( clone );
|
span.appendChild( clone );
|
||||||
parent.replaceChild( span, code );
|
code.parentNode.replaceChild( span, code );
|
||||||
code = clone;
|
code = clone;
|
||||||
}
|
}
|
||||||
var button = document.createElement( 'span' );
|
var button = document.createElement( 'span' );
|
||||||
|
@ -394,7 +393,7 @@ function initCodeClipboard(){
|
||||||
this.removeAttribute( 'aria-label' );
|
this.removeAttribute( 'aria-label' );
|
||||||
this.classList.remove( 'tooltipped', 'tooltipped-w', 'tooltipped-se', 'tooltipped-sw' );
|
this.classList.remove( 'tooltipped', 'tooltipped-w', 'tooltipped-se', 'tooltipped-sw' );
|
||||||
});
|
});
|
||||||
parent.insertBefore( button, code.nextSibling );
|
code.parentNode.insertBefore( button, code.nextSibling );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue