Table of Contents
Auto-Tooltip Plugin
Compatible with DokuWiki
- 2024-02-06 "Kaos" yes
- 2023-04-04 "Jack Jackrum" yes
- 2022-07-31 "Igor" yes
- 2020-07-29 "Hogfather" yes
Similar to tooltip
This plugin allows you to construct tooltips for text and links on the page, or to automatically generate tooltips based on a wikilink's title and abstract. If you enable the renderer plugin or install ActionRenderer, it can even add a tooltip to every internal wikilink on your site!
Known Bugs and Conflicts (as plugin)
- Sometimes doubles/triples inner text in abstract (including RSS and its own contents).
- Sometimes shows an error about incorrect installation (while working in every place).
- Is shown as raw tag in search.
- Is shown as raw tag in RSS syndication (Full HTML mode).
Known Bugs and Conflicts (as renderer)
- catlist Plugin: adds additional `span` wrapper to `a` link, breaking the bootstrap pillow structure in a sidebar mode.
- IfAuthEx Plugin: show hidden info available for editor to everyone, including anonymous.
- If timeout is set and you hover from one link to another, shows a new tooltip, then hides and then shows again.
- Bootstrap Wrapper Plugin/Bootstrap3 Template: Doesn't work properly with the bootstrap3 theme and its breadcrumbs. Breaks some elements which require a strict element parent/child relations by adding `span` wrapper.
Installation
Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.
Automatically turning plain text into links with tooltips
Install both this plugin and Autolink 4. The configuration options for Autolink 4 allow you to specify text or regular expressions, and automatically turn those into links with tooltips.
Adding tooltips to every link on your site, or specific namespaces
If you're already using ActionRenderer as your renderer, this will happen automatically. Otherwise, Go to Admin → Configuration → Advanced → renderer_xhtml, and select “Auto-Tooltip.” Note that you can only have one custom renderer, so this is not compatible with other renderer plugins.
You can limit this to specific namespaces or pages using the configuration options.
You won't see tooltips on self-referential links. In other words, a link to wiki:whatever on wiki:whatever will not have a tooltip.
Examples/Usage
Generating tooltip content automatically
<autott>wiki:syntax</autott>
This will generate a link to wiki:syntax, using the page's title as the link text. The tooltip will include the page's title and abstract.
<autott>wiki:syntax|Custom Title</autott>
Same as above, but the link text will be “Custom Title.”
Manual tooltips
<autott> <content>This is the linked text on the page.</content> <tip>The body of the tooltip.</tip> <title>An optional title for the tooltip</title> </autott>
This creates a simple tooltip for text on the page.
Customizing appearance
<autott style1 style2>...</autott>
There is an admin setting to change the default styling of all tooltips. If you want to override that for a single tooltip, you can specify styles in the tooltip definition. Available classes are:
- default: A semi-transparent black tooltip with rounded border.
- blue: Same as default, but blue.
- plain: A white tooltip with black text and a black border.
- small: Smaller font size. This can be combined with any of the above styles.
You can add additional styles in your CSS. Class names are of the form plugin-autotooltip__MYNAME. For instance, to create a tooltip with an image for a background and white text, add this CSS:
.plugin-autotooltip__picture { background: url(/path/to/image.jpg); color: #fff; }
and then create your tooltip like this:
<autott picture>...</autott>
Configuration
- style: A space-delimited set of default classes. This can include the built-in styles, or any CSS class you create that starts with "plugin-autotooltip__."
- delay: The time in miliseconds to wait before showing a tooltip.
- linkall_inclusions: When using the renderer plugin to add tooltips to all links, this is a regular expression for pages or namespaces to include. For example, “^wiki:|^stuff:” inludes only links from the wiki and stuff namespaces. Leave blank to include all pages.
- linkall_exclusions: A regular expression for pages or namespaces to exclude. When combined with linkall_inclusions, this means “Include these pages, except those pages.” This works well with Include and similar plugins, allowing you to, for example, exclude tooltips on all sidebars, but keep them on the page.
Helper Plugin
The helper exposes these methods:
forText
Create a manual tooltip on arbitrary text.
$tooltip->forText($content, $tooltip, $title='', $preTitle='', $classes='', $textStyle='');
- $content: The on-page text.
- $tooltip: The tooltip content. Newlines will be rendered as line breaks.
- $title: The title inside the tooltip.
- $preTitle: Text to display before the title. Newlines will be rendered as line breaks.
- $classes: CSS classes to add to this tooltip. "dokuwiki-plugin__" will be prepended to each class.
- $textStyle - CSS styles for the linked content.
forWikilink
Create a wikilink with a tooltip.
$tooltip->forWikilink($id, $content=null, $classes='', $linkStyle='');
- $id - A page id.
- $content - The on-page content. Newlines will be rendered as line breaks. Omit to use the page's title.
- $preTitle - Text to display before the title in the tooltip. Newlines will be rendered as line breaks.
- $classes - CSS classes to add to this tooltip. "dokuwiki-plugin__" will be prepended to each class.
- $linkStyle - Style attribute for the link.
Compatibility
- description: If you add a description to a page using this plugin, tooltips will show the description, rather than DokuWiki's generated abstract.
Development
Change Log
- Relative links were not working with the renderer plugin. Fixed #24 (2024-11-28 16:51)
- Work-around for DokuWiki Kaos bug in plugin.info.txt processing (2024-02-11 03:36)
- Work-around for DokuWiki Kaos bug in plugin.info.txt processing (2024-02-11 03:32)
- Fix harmless warnings from error log (2024-02-04 20:26)
- Fixed broken css classes (2024-01-15 19:04)
- Fixed #20 - Tooltip won't hide on fast mouse moves (2024-01-15 14:47)
- Code clean-up (2024-01-15 14:46)
- fix php 8 warnings (2024-01-07 20:24)
Discussion
- It isn't correctly working with RSS feed (full articles) if not enabled as renderer.
- When enabled as a renderer:
- Creates giant tooltips for breadcrumbs.
- Shows private information for any user when using IfAuth plugin.
Any solution?
— Antiokh 2025-01-05 18:25