diff options
author | Phy <git@phy25.com> | 2020-03-09 17:02:12 -0400 |
---|---|---|
committer | Phy <git@phy25.com> | 2020-03-09 17:02:12 -0400 |
commit | bbac148918bb6e6d2251a64bd20ef5d67f834cf8 (patch) | |
tree | 8f0e31045bf6b74b79e5e217152b8c2119de3e85 /lib/scripts/page.js | |
parent | 69a18e87a66b26f1e683359c6773a53aa713e46c (diff) | |
download | dokuwiki-bbac148918bb6e6d2251a64bd20ef5d67f834cf8.tar.gz dokuwiki-bbac148918bb6e6d2251a64bd20ef5d67f834cf8.zip |
generate curid class by jQuery
internallink's output <a> tag gets a new attribute, data-wiki-id, so that
jQuery doesn't need to parse the various link format to get the ID.
Any plugin javascript that loads after DokuWiki's script should be able to
discover curid class as usual, as long as they use the default js.php
facility.
fixes #1511, fixes #2968.
Diffstat (limited to 'lib/scripts/page.js')
-rw-r--r-- | lib/scripts/page.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/scripts/page.js b/lib/scripts/page.js index 284c2038b..77d644a38 100644 --- a/lib/scripts/page.js +++ b/lib/scripts/page.js @@ -9,6 +9,7 @@ dw_page = { */ init: function(){ dw_page.sectionHighlight(); + dw_page.currentIDHighlight(); jQuery('a.fn_top').on('mouseover', dw_page.footnoteDisplay); dw_page.makeToggle('#dw__toc h3','#dw__toc > div'); }, @@ -46,6 +47,16 @@ dw_page = { }); }, + + /** + * Highlight internal link pointing to current page + * + * @author Henry Pan <dokuwiki@phy25.com> + */ + currentIDHighlight: function(){ + jQuery('a.wikilink1, a.wikilink2').filter('[data-wiki-id="'+JSINFO.id+'"]').wrap('<span class="curid"></div>'); + }, + /** * Create/get a insitu popup used by the footnotes * |