dokuwiki-template-sprintdoc.../js/anchor.js

13 lines
2.4 KiB
JavaScript

jQuery(function () {
jQuery('#dokuwiki__content.main-content').find('h1,h2,h3,h4,h5').append(function () {
if (this.id) {
return '<a href="#' + this.id + '" class="anchor">' +
'<svg viewBox="0 0 20 20">' +
'<path d="m 15.416601,0 c -1.58446,-4.6014118e-8 -2.991809,0.81019022 -3.813281,2.0403646 l -1.89e-4,2.645e-4 -1.6649087,2.4970052 a 0.83333545,0.83333545 0 0 0 0.2313147,1.1557943 0.83333545,0.83333545 0 0 0 1.155534,-0.2310548 l 1.664323,-2.4965493 2.52e-4,-5.166e-4 c 0.523149,-0.7831205 1.408706,-1.298698 2.426953,-1.2986979 1.6207,0 2.916798,1.2960971 2.916798,2.9167968 0,0.6021756 -0.179631,1.154007 -0.489128,1.6171224 l -2.52e-4,2.645e-4 -3.333658,5.0005203 c -0.523149,0.783122 -1.408706,1.298698 -2.426953,1.298698 -1.6207,0 -2.916797,-1.295901 -2.916797,-2.9166011 0,-0.11021 0.0062,-0.2187797 0.017969,-0.3252604 A 0.83333545,0.83333545 0 0 0 8.447859,8.3383588 0.83333545,0.83333545 0 0 0 7.5280673,9.0750775 c -0.018477,0.1671322 -0.02806,0.3368675 -0.02806,0.5083334 0,2.5214361 2.0619628,4.5832031 4.5833987,4.5832031 1.584459,0 2.991809,-0.809929 3.813282,-2.040104 l 2.52e-4,-5.17e-4 3.333203,-4.9994788 C 19.716167,6.3991244 20,5.5202455 20,4.5833984 20,2.0619631 17.938037,9.202824e-8 15.416601,0 Z M 7.9166015,5.8333983 C 6.3321419,5.8333982 4.9247921,6.643328 4.1033203,7.8735025 l -1.89e-4,5.165e-4 -3.33366517,5.000265 C 0.28367569,13.601502 0,14.480069 0,15.416601 0,17.938037 2.0619629,20 4.5833984,20 c 1.58446,0 2.9918085,-0.810191 3.8132812,-2.040364 l 1.889e-4,-2.52e-4 1.6649085,-2.497006 A 0.83333545,0.83333545 0 0 0 9.8304623,14.306584 0.83333545,0.83333545 0 0 0 8.6749285,14.537639 L 7.0103452,17.03471 c -0.5231502,0.783122 -1.4087056,1.298697 -2.4269531,1.298697 -1.6206999,0 -2.9167969,-1.296097 -2.9167969,-2.916797 0,-0.602177 0.1796968,-1.154007 0.4891927,-1.617122 l 2.016e-4,-2.52e-4 3.3334635,-4.9999997 2.646e-4,-5.166e-4 c 0.5231491,-0.7831206 1.4086408,-1.298698 2.426888,-1.2986979 1.6206997,0 2.9168624,1.2959017 2.9168624,2.9166012 0,0.110213 -0.0062,0.21879 -0.01797,0.325261 a 0.83333545,0.83333545 0 0 0 0.736719,0.919791 0.83333545,0.83333545 0 0 0 0.919726,-0.736718 C 12.490419,10.757796 12.5,10.588061 12.5,10.416601 12.5,7.895166 10.438037,5.8333983 7.9166015,5.8333983 Z" />' +
'</svg>' +
'</a>';
} else {
return '';
}
})
});