xref: /plugin/diagrams/script/mediafile-linkfix.js (revision ae61245c7cadffbd577e8133c64e7f47b91cd49d)
1/**
2 * Open links in diagrams in the browser window instead of SVG frame
3 *
4 * FIXME wrapping the function in dokuwiki__content click handler
5 * is necessary for releases up to Jack, because hovering over
6 * section edit buttons used to remove handlers attached inside the section
7 */
8window.addEventListener('load', () => {
9    // FIXME workaround wrapper
10    document.querySelector('#dokuwiki__content').addEventListener('click', (event) => {
11        jQuery('object.diagrams-svg').each(function () {
12            jQuery(this.contentDocument).find('svg a').not('[target]').attr('target', '_top');
13        });
14    });
15
16});
17