dokufreaks/plugin-folded — Issue #2: folded won't work with DW Angua
Author: schplurtz
Created: 2011-12-05 22:32:33+00:00
State: open

Hi,
The title says it all. This is due to javascript changes in Angua. With the following folded/script.js, it works again. It's one if my first JS attempt, sorry if it's ugly...

/schplurtz

```javascript
/*
* For Folded Text Plugin
*
* @author Fabian van-de-l_Isle
* @author Christopher Smith
* @author Schplurtz le Déboulonné
*/

// containers for localised reveal/hide strings,
// populated from html comments in hidden elements on the page
var folded_reveal = 'reveal';
var folded_hide = 'hide';

/*
* toggle the folded element via className change
* also adjust the classname and title tooltip on the folding link
*/
function folded_toggle(evt) {
id = this.href.match(/(#.*)$/)[1];
var n=jQuery(id);
if(n.hasClass('hidden')) {
n.addClass('open').removeClass('hidden');
}
else {
n.addClass('hidden').removeClass('open');
}
evt.preventDefault();
return false;
}

/*
* run on document load, setup everything we need
*/
jQuery(function() {
var n=jQuery('#folded_reveal');
if(!n) return;
n.each( function(){ folded_reveal=this.innerHTML.match(/^$/)[1]; });
n=jQuery('#folded_hide');
n.each( function(){ folded_hide=this.innerHTML.match(/^$/)[1]; });
jQuery('.dokuwiki .folder').click(folded_toggle);
});

//jQuery(folded_setup);

// support graceful js degradation, this hides the folded blocks from view before they are shown,
// whilst still allowing non-js user to see any folded content.
document.write('');
```