DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:copy_section_link

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tips:copy_section_link [2016-10-20 21:46] – [An improved version of the script] sancayatips:copy_section_link [2016-10-21 04:05] (current) – [An improved version of the script] sancaya
Line 62: Line 62:
 In that case ''$this.attr('id')'' wouldn't find ''id'' in a header. For that I added ''if (!anchorId) anchorId = this.childNodes[0].id;''. In that case ''$this.attr('id')'' wouldn't find ''id'' in a header. For that I added ''if (!anchorId) anchorId = this.childNodes[0].id;''.
  
-The resulting script is here. It gives Javascript errors in some browsers, so could anyone help to debug it?+The resulting script is here:
  
 <code javascript ./conf/userscript.js> <code javascript ./conf/userscript.js>
Line 83: Line 83:
     if ( document.createRange ) {     if ( document.createRange ) {
         rng = document.createRange();         rng = document.createRange();
-        rng.selectNode( target )+        rng.selectNode( target );
         sel = window.getSelection();         sel = window.getSelection();
         sel.removeAllRanges();         sel.removeAllRanges();
tips/copy_section_link.txt · Last modified: 2016-10-21 04:05 by sancaya

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki