====== Drop All Plugin ====
---- plugin ----
description: Extends the Drop me plugin with a button for Drop all
author : Jan-Philipp Warmers
email : proGamler@freakz-at-work.de
type : syntax
lastupdate : 2007-07-11
compatible :
depends :
conflicts : drop_me
similar :
tags : menu, navigation, collapsible
----
===== Syntax ===
[drop]
===== Quellcode ===
save in /lib/plugin/drop_all/syntax.php
==== PHP ==
*/
// must be run within DokuWiki
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
/**
* All DokuWiki plugins to extend the parser/rendering mechanism
* need to inherit from this class
*/
class syntax_plugin_drop_all extends DokuWiki_Syntax_Plugin {
function getInfo(){
return array(
'author' => 'Jan-Philipp Warmers',
'email' => 'proGamler@freakz-at-work.de',
'date' => '2007-07-11',
'name' => 'Drop all button',
'desc' => 'use [drop]',
'url' => 'http://www.dokuwiki.org/plugin:drop_all',
);
}
function getType() { return 'substition'; }
function getSort() { return 158; }
function connectTo($mode) { $this->Lexer->addSpecialPattern('\[drop\]',$mode,'plugin_drop_all'); }
function handle($match, $state, $pos, &$handler){ return array($match, $state, $pos); }
function render($mode, &$renderer, $data) {
if($mode == 'xhtml'){
$renderer->doc .= "Alles ein-/ausklappen";
return true;
}
return false;
}
}
?>
==== JAVAScript ==
add to /lib/scripts/script.js
//dropt die inhalte
function drop_all_text(){
// getElementsByName funktioniert nicht im IE da div kein name="" kennt.
//sommit musste ich erst alle auslesen und dann geziehlt nach der classe gucken
var d = document.getElementsByTagName('div');
var k = d.length;
for(i=0;i