@@ -583,14 +583,16 @@ function initAnchorClipboard() {
583583 var origin = document . location . origin == 'null' ? `${ document . location . protocol } //${ document . location . host } ` : document . location . origin ;
584584 var id = encodeURIComponent ( element . id ) ;
585585 var link = `${ origin } ${ document . location . pathname } #${ id } ` ;
586- var new_element = document . createElement ( 'button' ) ;
587- new_element . classList . add ( 'anchor' ) ;
586+ var span = document . createElement ( 'span' ) ;
587+ span . classList . add ( 'anchor' , 'btn' , 'cstyle' , 'link' , 'noborder' , 'notitle' , 'interactive' ) ;
588+ span . setAttribute ( 'data-clipboard-text' , link ) ;
589+ var button = document . createElement ( 'button' ) ;
588590 if ( ! window . relearn . disableAnchorCopy ) {
589- new_element . setAttribute ( 'title' , window . T_Copy_link_to_clipboard ) ;
591+ button . setAttribute ( 'title' , window . T_Copy_link_to_clipboard ) ;
590592 }
591- new_element . setAttribute ( 'data-clipboard-text' , link ) ;
592- new_element . innerHTML = '<i class="fas fa-link fa-lg"></i>' ;
593- element . appendChild ( new_element ) ;
593+ button . innerHTML = '<i class="fas fa-link fa-lg"></i>' ;
594+ span . appendChild ( button ) ;
595+ element . appendChild ( span ) ;
594596 } ) ;
595597
596598 var anchors = document . querySelectorAll ( '.anchor' ) ;
@@ -617,7 +619,7 @@ function initAnchorClipboard() {
617619 } else if ( ! window . relearn . disableAnchorScrolling ) {
618620 for ( var i = 0 ; i < anchors . length ; i ++ ) {
619621 anchors [ i ] . addEventListener ( 'click' , function ( e ) {
620- e . target . parentElement . parentElement . scrollIntoView ( { behavior : 'smooth' } ) ;
622+ e . currentTarget . parentElement . scrollIntoView ( { behavior : 'smooth' } ) ;
621623 var state = window . history . state || { } ;
622624 state = Object . assign ( { } , typeof state === 'object' ? state : { } ) ;
623625 history . replaceState ( { } , '' , e . text ) ;
0 commit comments