Table of Contents
JS replacements Plugin
Compatible with DokuWiki
Greebo
This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.
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.
Usage
This plugins exposes the replacements through the JavaScript JSINFO environment variable.
Examples/Usage
Adaptive Site width when sidebar is present
Some templates with support for sidebar shrink the content width
when the sidebar is present. With given the html structure they have, the only way to provide a pure css
solution would be to have the relational pseudo class :has (level 4 css), provided that you can select the dokuwiki site when the sidebar is present.
However, :has
is still not supported by any major browser, and only jQuery
provides the required support. In other words, to solve this you need to use javascript by for example using the conf/userscript.js
file.
This example ensures that your content will keep the width
when you include sidebar
to templates in the family of the starter template, specially the dokuwiki template, which provides the __site_width__
and the __sidebar_width__
placeholder variables.
- conf/userscript.js
(function (window, document, undefined) { jQuery(document).ready(function() { $sidebar = jQuery("#dokuwiki__aside"); $site = jQuery("#dokuwiki__site"); replacements = JSINFO.replacements; var site_width, sidebar_width; if ($sidebar.length && $site.length && replacements) { site_width = replacements.__site_width__ || ($site.css('max-width') + "px"); sidebar_width = replacements.__sidebar_width__ || ($sidebar.css('max-width') + "px"); if (site_width && sidebar_width) { //console.log("adapting site max-width to", site_width + ' + ' + sidebar_width, "from", $site.css('max-width')); $site.css({'max-width': 'calc(' + site_width + ' + ' + sidebar_width + ')'}); //console.log("new site max-width", $site.css('max-width'), $site); } } }); })(window, document);
Development
Change Log
- remove update message (2020-05-14 08:20)
- Update README.md (2020-05-10 03:35)
- Update plugin.info.txt (2020-05-10 02:42)
- remove test (2020-05-10 00:41)
- test (2020-05-10 00:39)
- fix missing param (2020-05-10 00:29)
- Update README.md (2020-05-10 00:02)
- Update README.md (2020-05-10 00:00)
Known Bugs and Issues
Please report bugs or feature requests at the Bug tracker.
ToDo/Wish List
- add admin configuration to expose other configuration settings