tormec / AcMenu

DokuWiki plugin which provides an accordion menu for namespaces and relative pages.
https://www.dokuwiki.org/plugin:acmenu
1 stars 3 forks source link

Incompatibility with recent versions of the bootstrap3 template #7

Open abargerbos opened 3 years ago

abargerbos commented 3 years ago

I'd like to mention an incompatibility that people have been experiencing when using the AcMenu plugin with the Boostrap 3 template. There is an issue for this on the github page of the template: https://github.com/giterlizzi/dokuwiki-template-bootstrap3/issues/497

As written there, the menu is loading correctly in the sidebar, but it doesn't react to clicking, The folders do not expand and pagelinks are not being opened, but there are no errors on screen or in log files. And when accessing the sidebar page directly (with http://wikiurl/namespace/sidebar) everything is working fine, it is just in the sidebar that there is an issue.

Given that the problem started occuring after an update to the template, I suppose the incompatibility is in a recent change over there. However, given your expertise on how AcMenu works, I thought perhaps you would have an idea of where the issue originates.

jvantuyl commented 3 years ago

Same problem.

julien235 commented 3 years ago

acMenu works great with bootstrap4 theme like Mikio 😃

max0013 commented 3 years ago

Hi, Do you find a solution to make AcMenu work with bootstrap3 theme like flaty ?

julien235 commented 3 years ago

Hi, No, I use bootstrap 4.

max0013 commented 3 years ago

Do you know if it exist something like bootswatch with themes like flaty or darky with boostrap 4 ?

julien235 commented 3 years ago

nop, sorry

JBr34k commented 1 year ago

I managed to make it work.

Update the file script.js as follows.

Before:

[...]

    jQuery(selector).click(function(event) {
        var item = trim_url(jQuery(this).find("a").attr("href"));
        event.preventDefault();
        if (jQuery(this).next().is(":hidden")) {
            jQuery(this)
            .next().slideDown("fast")
            .parent().removeClass("closed").addClass("open");
            _OPEN_ITEMS.push(item);
        }
        else {
            jQuery(this)
            .next().slideUp("fast")
            .parent().removeClass("open").addClass("closed");
            _OPEN_ITEMS.splice(jQuery.inArray(item, _OPEN_ITEMS), 1);
        }
        var cookie_value = JSON.stringify(_OPEN_ITEMS);
        document.cookie = _COOKIE_NAME + "=" + cookie_value + ";expires='';path=/";
    });

[...]

After:

[...]

    jQuery(selector).click(function(event) {

        if(jQuery(event.target,"a").attr("class").indexOf("wikilink1") < 0) {
                var item = trim_url(jQuery(this).find("a").attr("href"));
                event.preventDefault();

                if (jQuery(event.target).next().is(":hidden")) {
                    jQuery(event.target)
                    .next().slideDown("fast")
                    .parent().parent().parent().removeClass("closed").addClass("open");
                    _OPEN_ITEMS.push(item);
                } else {
                    jQuery(event.target)
                    .next().slideUp("fast")
                    .parent().parent().parent().removeClass("open").addClass("closed");
                    _OPEN_ITEMS.splice(jQuery.inArray(item, _OPEN_ITEMS), 1);
                }

                var cookie_value = JSON.stringify(_OPEN_ITEMS);
                document.cookie = _COOKIE_NAME + "=" + cookie_value + ";expires='';path=/";

                return false;
        }
    });

[...]