Hi all, I used to offer a CategoryTree in my MediaWiki sidebar with MW 1.20.4. Everything worked well, but since my update to MW 1.24.1 all appropriate releases of CategoryTree stopped working in the sidebar. This includes the REL1_24 version but also the development master version. The problem is, that the expandable symbols are not shown at all and no click handle is registered. Interestingly CategoryTree works perfect as part of a WikiPage in parallel to not work at all in the sidebar.
I figured out that the way how the ext.CategoryTree.js works is that it uses a mw.hook to access the WikiPage content and to make CategoryTree working there. But obviously the sidebar is not part of the content which is access by this approach. I tested it by just removing the whole content in the ext.CategoryTree.js and literally just the inner section of my page disappeared but the sidebar was still there together with some other navigation content. So I am looking for a fix to have ext.CategroyTree.js to access the whole content including the sidebar.
I am no MediaWiki nor js nor php specialist, but after looking into the vector skin, I figured out how the skin accesses the whole content. I decided to give this appraoch a try, so I modified the beginning of ext.CategoryTree.js (which is located in extensions/CategoryTree/modules by the way) to make it look like this:
//( function ( $, mw ) { // // mw.hook( 'wikipage.content' ).add( function ( $content ) { jQuery( function ( $ ) { /** * Sets display inline to tree toggle */ function showToggles() {
and the end of ext.CategoryTree.js to look like this;
// Register click events and show toggle buttons $( '.CategoryTreeToggle' ).click( handleNode ); showToggles(); } ); //}( jQuery, mediaWiki ) );
From my understanding this gives the ext.CategoryTree.js access to the whole page content. So good news is, that everything works well after this modification, CategoryTree in the sidebar works like expected.
So now I have a question to all MediaWiki specialists: is this a valid approach to solve the problem? Or does it cause tremendous load to the system or break system concepts?