dwp-forge / refnotes

4 stars 6 forks source link

Configuration page for refnotes fails to work #27

Closed dwp-forge closed 9 years ago

dwp-forge commented 9 years ago
The configuration page for refnotes is entirely unresponsive; the save button has no
effect and no predefined namespaces are listed, running refnotes in the latest version
of DokuWiki. The syntax for refnotes all appears to work fine, but the configuration
page does not.

The installed plugins are:
addnewpage
authplain
badbehaviour
captcha
nspages
popularity
refnotes
safefnrecode
tablewidth
wrap
yalist

Original issue reported on code.google.com by celticmadman on 2013-10-17 21:39:19

dwp-forge commented 9 years ago
There's been a number of similar reports and few of them have fixes, but some of them
I just couldn't reproduce and track down. If you know your way around Javascript and
have some spare time you could try to debug it yourself. Or if you really want to get
this fixed but lack the skills, we could do some remote debugging (for example, see
issue 20).

Original issue reported on code.google.com by dwp-forge on 2013-10-18 08:44:34

dwp-forge commented 9 years ago
I've tracked down the issue to an incompatibility with the following custom JavaScript
in userscript.js, but I lack the chops to figure out why. I'm willing to do some debugging
to try and figure it out.

jQuery(function(){
    var scrollerTopMargin = jQuery(".desktop #dokuwiki__aside").offset().top;
    jQuery(window).scroll(function(){
        var c = jQuery(window).scrollTop();
        var d = jQuery(".desktop #dokuwiki__aside");
        if (c > scrollerTopMargin) {
            d.css({ position: "fixed", top: "1em" });
        } else if (c <= scrollerTopMargin) {
            d.css({ position: "relative", top: "" });
        }
    });
});

Original issue reported on code.google.com by celticmadman on 2013-10-18 16:23:14

dwp-forge commented 9 years ago
Reproduced.

Original issue reported on code.google.com by dwp-forge on 2013-10-19 11:26:55

dwp-forge commented 9 years ago
Apparently sidebar is not shown in admin interface, so you have to take that into account
in your user script. Replace the first line in the function by the following:

    var aside = jQuery(".desktop #dokuwiki__aside");
    if (aside.length == 0) return;
    var scrollerTopMargin = aside.offset().top;

Otherwise .offset() doesn't return anything and you call .top on an undefined object.
The resulting exception breaks execution of the remaining callbacks, so RefNotes never
gets a chance to initialize.

Original issue reported on code.google.com by dwp-forge on 2013-10-19 12:08:52

dwp-forge commented 9 years ago
Thank you for that! I've made the change to my script. Everything works as expected
now.

Original issue reported on code.google.com by celticmadman on 2013-10-19 15:29:33