plugin:drop_all
Table of Contents
Drop All Plugin
Compatible with DokuWiki
No compatibility info given!
The missing download url means that this extension cannot be installed via the Extension Manager. Please see Publishing a Plugin on dokuwiki.org. Recommended are public repository hosts like GitHub, GitLab or Bitbucket.
This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.
Extension name contains underscore, will not generate popularity points.
Syntax
[drop]
Quellcode
save in /lib/plugin/drop_all/syntax.php
PHP
<?php /** * Plugin Now: Inserts a timestamp. * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Christopher Smith <chris@jalakai.co.uk> */ // 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 .= "<a href=\"javascript:drop_all()\">Alles ein-/ausklappen</a>"; 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<k;i++){ var classname = d[i].className; if (classname == 'd'){ d[i].style.display='block'; d[i].className='drop'; }else if (classname == 'drop') { d[i].style.display='none'; d[i].className = 'd'; } } } //dropt die images und führt die Funktion zum Dropen der inhalte aus function drop_all() { var d = document.getElementsByName('drop_me_img'); var classname; var i; for(i=0;i<d.length;i++){ img = null; classname = d[i].className; if (classname != 'drop'){ d[i].src='minus.gif'; d[i].className = 'drop'; }else { d[i].src = 'plus.gif'; d[i].className = 'd'; } } //aufruf des Drops der inhalte drop_all_text() }
plugin/drop_all.txt · Last modified: by ach