| [ Index ] |
PHP Cross Reference of Jalakai Designs - DokuWiki Plugins & Templates |
[Summary view] [Print] [Text view]
1 /* 2 * For Folded Text Plugin 3 * 4 * @author Fabian van-de-l_Isle <webmaster [at] lajzar [dot] co [dot] uk> 5 * @author Christopher Smith <chris [at] jalakai [dot] co [dot] uk> 6 */ 7 8 // containers for localised reveal/hide strings, 9 // populated from html comments in hidden elements on the page 10 var folded_reveal = 'reveal'; 11 var folded_hide = 'hide'; 12 13 /* 14 * toggle the folded element via className change 15 * also adjust the classname and title tooltip on the folding link 16 */ 17 function folded_toggle(evt) { 18 id = this.href.match(/#(.*)$/)[1]; 19 e = $(id); 20 if (!e) return; 21 22 if (e.className.match(/\bhidden\b/)) { 23 e.className = e.className.replace(/\bhidden\b/g,''); 24 e.className = e.className.replace(/ /g,' '); 25 26 this.title = folded_hide; 27 28 this.className += ' open'; 29 } else { 30 e.className += ' hidden'; 31 32 this.title = folded_reveal; 33 34 this.className = this.className.replace(/\bopen\b/g,''); 35 this.className = this.className.replace(/ /g,' '); 36 } 37 38 evt.preventDefault(); 39 return false; 40 } 41 42 /* 43 * run on document load, setup everything we need 44 */ 45 function folded_setup() { 46 47 // extract and save localised title tooltip strings 48 var eStrings = $('folded_reveal','folded_hide'); 49 if (!eStrings[0]) return; 50 51 folded_reveal = eStrings[0].innerHTML.match(/^<!-- (.*) -->$/)[1]; 52 folded_hide = eStrings[1].innerHTML.match(/^<!-- (.*) -->$/)[1]; 53 54 // find all folder links, assign onclick handler and title tooltip for initial state 55 var folds = getElementsByClass('folder'); 56 for (var i=0; i<folds.length; i++) { 57 addEvent(folds[i], 'click', folded_toggle); 58 folds[i].title = folded_reveal; 59 } 60 } 61 62 addInitEvent(folded_setup); 63 64 // support graceful js degradation, this hides the folded blocks from view before they are shown, 65 // whilst still allowing non-js user to see any folded content. 66 document.write('<style type="text/css" media="screen"><!--/*--><![CDATA[/*><!--*/ .folded.hidden { display: none; } .folder .indicator { visibility: visible; } /*]]>*/--></style>');
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Dec 16 05:46:24 2006 | Cross-referenced by PHPXref 0.6 |