It's better when it's simple

User Tools

Site Tools


JS replacements Plugin

Compatible with DokuWiki


plugin Extends JSINFO with 'replacements' for usage in JS scripts

Last updated on

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

Tagged with javascript, jquery


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 plugins exposes the replacements through the JavaScript JSINFO environment variable.


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.

(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);


Change Log

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
plugin/jsreplacements.txt · Last modified: 2023-05-02 13:59 by Aleksandr

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