DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:autotooltip

This is an old revision of the document!


Auto-Tooltip Plugin

Compatible with DokuWiki

Greebo

plugin Manually create tooltips, or generate them off of the title and abstract of a wikilink

Last updated on
2020-05-16
Provides
Syntax, Helper, Action, Render
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to tooltip

Tagged with abstract, 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!

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.

This plugin allows you to manually insert tooltips one-by-one, or to generate them automatically for every wikilink on your site (or a subset thereof, limited by namespace).

There are three ways to enable this feature:

  1. If you're already using ActionRenderer as your renderer, you don't have to do anything.
  2. Go to AdminConfigurationAdvancedrenderer_xhtml, and select “Auto-Tooltip.”
  3. If neither of those options suits your needs, consider Auto-link 4, which can add tooltips to links that it generates, when installed alongside AutoTooltip.

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

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 a tooltip

<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>

Generating a tooltip

<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.”

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.

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

Discussion

plugin/autotooltip.1589685697.txt.gz · Last modified: 2020-05-17 05:21 by zioth

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki