FANDOM


I noticed that the "Expand All" button doesn't seem to work if I'm not logged into my account. I suspect that the reason for that is that the script gets executed before the content of the page has finished loading. I tried it with a shorter page (Monogatari Series Second Season Original Soundtracks) and there everything works as you would expect. I have no idea why it works if I'm logged in.

This should make sure the script only gets executed when the page is ready:

// Expand
var state =1;
$(function() {
   $('#collapse-global').html($('<a>', {
       'class': 'wikia-button',
       text: 'Expand/Collapse All'
   })).click(function() {
       if(state ===0){
       $('.mw-collapsible-toggle-expanded').click();
       state = 1;
       }
       else {
           $('.mw-collapsible-toggle-collapsed').click();
           state = 0;
       }
      }
)});

See also here.

Community content is available under CC-BY-SA unless otherwise noted.