mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
anchor: fix link in FF when served from filesystem #482
This commit is contained in:
parent
1e670e8f3d
commit
68e89ca171
1 changed files with 1 additions and 1 deletions
|
@ -305,7 +305,7 @@ function initSwagger( update, attrs ){
|
||||||
|
|
||||||
function initAnchorClipboard(){
|
function initAnchorClipboard(){
|
||||||
document.querySelectorAll( 'h1~h2,h1~h3,h1~h4,h1~h5,h1~h6').forEach( function( element ){
|
document.querySelectorAll( 'h1~h2,h1~h3,h1~h4,h1~h5,h1~h6').forEach( function( element ){
|
||||||
var url = encodeURI(document.location.origin + document.location.pathname);
|
var url = encodeURI( (document.location.origin == "null" ? (document.location.protocol + "//" + document.location.host) : document.location.origin )+ document.location.pathname);
|
||||||
var link = url + "#" + element.id;
|
var link = url + "#" + element.id;
|
||||||
var new_element = document.createElement( 'span' );
|
var new_element = document.createElement( 'span' );
|
||||||
new_element.classList.add( 'anchor' );
|
new_element.classList.add( 'anchor' );
|
||||||
|
|
Loading…
Reference in a new issue