plugin:drop_me
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:drop_me [2011-03-08 07:10] – 24.85.247.169 | plugin:drop_me [2016-01-25 17:34] (current) – old revision restored (2015-10-19 15:36) Aleksandr | ||
---|---|---|---|
Line 17: | Line 17: | ||
==== Syntax ==== | ==== Syntax ==== | ||
- | < | + | |
- | <drop arg1/ | + | |
- | ^ ^what to create ^name ^ | + | ^ |
- | |arg1 | link | name of menu space| | + | | arg1 | link | name of menu space | |
- | |arg2 | menu | name of menu space| | + | | arg2 | menu | name of menu space | |
**example** | **example** | ||
- | <drop link/ | + | |
- | <drop menu/ | + | <drop menu/ |
- | * Drucker | + | * Drucker |
- | | + | |
- | </ | + | </ |
Line 36: | Line 36: | ||
[[plugin: | [[plugin: | ||
- | save php to lib/ | + | save php to lib/ |
open you main template add JavaScript to header | open you main template add JavaScript to header | ||
Line 53: | Line 53: | ||
</ | </ | ||
+ | My Bootstrap3 theme causing running script twice. This little workaround makes dropdown workable. | ||
+ | <code java> | ||
+ | <script TYPE=" | ||
+ | var clicked_duplicated = false; | ||
+ | function showhide(name) { | ||
+ | clicked_duplicated = !clicked_duplicated; | ||
+ | var display = document.getElementById(name).style.display; | ||
+ | if (display == ' | ||
+ | document.getElementById(name).style.display = ' | ||
+ | ; | ||
+ | } else if (display == ' | ||
+ | document.getElementById(name).style.display = ' | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
==== TODO ==== | ==== TODO ==== | ||
learn English ;-) | learn English ;-) | ||
Line 67: | Line 83: | ||
<code php> | <code php> | ||
<?php | <?php | ||
- | |||
- | |||
- | |||
/** | /** | ||
* Plugin Drop Me (Great dropdown menus (by click)) | * Plugin Drop Me (Great dropdown menus (by click)) | ||
- | | + | * |
* @license | * @license | ||
* @author | * @author | ||
Line 79: | Line 92: | ||
// must be run within DokuWiki | // must be run within DokuWiki | ||
if (!defined(' | if (!defined(' | ||
- | die(); | + | |
if (!defined(' | if (!defined(' | ||
- | define(' | + | |
require_once (DOKU_PLUGIN . ' | require_once (DOKU_PLUGIN . ' | ||
Line 89: | Line 102: | ||
* need to inherit from this class | * need to inherit from this class | ||
*/ | */ | ||
- | class syntax_plugin_drop_me | + | class syntax_plugin_dropMe |
- | /** | + | |
- | * return some info | + | |
- | */ | + | |
- | function getInfo() { | + | function getInfo() { |
- | return array ( | + | return array ( |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | ' | + | ' |
- | |||
- | ); | ||
- | } | ||
- | function getType() { | + | |
- | return ' | + | } |
- | } | + | |
- | function getAllowedTypes() { | + | |
- | return array ( | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ); | + | |
- | } | + | |
- | function getSort() { | + | |
- | return 158; | + | |
- | } | + | |
- | function connectTo($mode) { | + | |
- | $this-> | + | |
- | } | + | |
- | function postConnect() { | + | |
- | $this-> | + | |
- | } | + | |
- | /** | + | |
- | * Handle the match | + | |
- | */ | + | } |
- | function | + | function getAllowedTypes() { |
- | global $ende; | + | |
- | switch | + | ' |
- | case DOKU_LEXER_ENTER : | + | ' |
- | list ($color, $background) = preg_split("/ | + | ' |
- | if ($color = $this-> | + | ' |
- | $color = $color; | + | |
- | $ende = $this->_ende($color); | + | } |
- | } | + | function getSort() { |
- | return array ( | + | |
- | $state, | + | } |
- | array | + | function connectTo($mode) { |
- | $color, | + | |
- | $background | + | } |
- | ) | + | |
- | ); | + | $this-> |
+ | } | ||
- | case DOKU_LEXER_UNMATCHED : | + | /** |
- | return array ( | + | * Handle the match |
- | $state, | + | */ |
- | $match | + | function handle($match, |
- | ); | + | |
- | case DOKU_LEXER_EXIT | + | |
- | return array ( | + | case DOKU_LEXER_ENTER |
- | $state, | + | |
- | $ende | + | if ($color = $this-> |
- | ); | + | $color = $color; |
- | } | + | $ende = $this-> |
- | return array (); | + | } |
- | } | + | return array ( |
+ | $state, | ||
+ | array ( | ||
+ | $color, | ||
+ | $background | ||
+ | | ||
+ | ); | ||
- | /** | + | case DOKU_LEXER_UNMATCHED : |
- | * Create output | + | |
- | */ | + | |
- | function render($mode, & $renderer, $data) { | + | |
+ | ); | ||
+ | case DOKU_LEXER_EXIT : | ||
+ | return array ( | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | return array (); | ||
+ | } | ||
- | if ($mode | + | /** |
- | list ($state, $match) = $data; | + | * Create output |
- | switch ($state) { | + | */ |
- | case DOKU_LEXER_ENTER : | + | function render($mode, & $renderer, $data) { |
- | list ($color, $background) = $match; | + | |
- | $renderer-> | + | |
- | break; | + | if ($mode == ' |
+ | list ($state, $match) = $data; | ||
+ | switch ($state) { | ||
+ | case DOKU_LEXER_ENTER : | ||
+ | list ($color, $background) = $match; | ||
+ | $renderer-> | ||
- | case DOKU_LEXER_UNMATCHED : | + | |
- | $renderer-> | + | |
- | break; | + | |
- | case DOKU_LEXER_EXIT : | + | |
- | list ($ende) = $match; | + | |
- | + | ||
- | if ($ende == " | + | |
- | $renderer-> | + | |
- | if ($ende == " | + | |
- | $renderer-> | + | |
- | break; | + | case DOKU_LEXER_UNMATCHED : |
- | } | + | $renderer-> |
- | return true; | + | break; |
- | } | + | case DOKU_LEXER_EXIT : |
- | return false; | + | list ($ende) = $match; |
- | } | + | |
+ | if ($ende == " | ||
+ | $renderer-> | ||
+ | if ($ende == " | ||
+ | $renderer-> | ||
+ | |||
+ | | ||
+ | } | ||
+ | return true; | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
//creat < | //creat < | ||
- | function _link($c, $o) { | + | |
- | $c = trim($c); | + | $c = trim($c); |
- | if ($c == " | + | if ($c == " |
- | return "<a href=javascript: | + | return "<a href=javascript: |
- | } | + | } |
- | elseif ($c == " | + | elseif ($c == " |
- | return "< | + | return "< |
- | } | + | } |
- | } | + | } |
- | //creat </ | + | //creat </ |
- | function _ende($ende) { | + | function _ende($ende) { |
- | $c = trim($ende); | + | $c = trim($ende); |
- | $c = substr($c, " | + | $c = substr($c, " |
- | if ($c == " | + | |
- | return " | + | |
- | } | + | } |
- | elseif ($c == " | + | elseif ($c == " |
- | return " | + | |
- | } | + | } |
- | } | + | } |
} | } | ||
?> | ?> | ||
</ | </ | ||
--- // | --- // |
plugin/drop_me.1299564616.txt.gz · Last modified: 2011-03-08 07:10 by 24.85.247.169