From bbac148918bb6e6d2251a64bd20ef5d67f834cf8 Mon Sep 17 00:00:00 2001 From: Phy Date: Mon, 9 Mar 2020 17:02:12 -0400 Subject: generate curid class by jQuery internallink's output 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. --- lib/scripts/page.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/scripts/page.js') 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 + */ + currentIDHighlight: function(){ + jQuery('a.wikilink1, a.wikilink2').filter('[data-wiki-id="'+JSINFO.id+'"]').wrap(''); + }, + /** * Create/get a insitu popup used by the footnotes * -- cgit v1.2.3