Skip to content

Commit

Permalink
Merge pull request #38 from turnermm/toolbar_rev
Browse files Browse the repository at this point in the history
Toolbar rev
  • Loading branch information
turnermm committed Nov 27, 2019
2 parents ddcb3a2 + 1d3a4b4 commit 00b404a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
21 changes: 0 additions & 21 deletions action.php
Expand Up @@ -19,7 +19,6 @@ class action_plugin_snippets extends DokuWiki_Action_Plugin {
* Register callbacks
*/
function register(Doku_Event_Handler $controller) {
$controller->register_hook('TOOLBAR_DEFINE','AFTER', $this, 'handle_toolbar_define');
$controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handle_ajax_call');
$controller->register_hook('IO_WIKIPAGE_READ', 'AFTER', $this, 'handle_wiki_read');
$controller->register_hook('TPL_ACT_RENDER', 'AFTER', $this, 'handle_content_display');
Expand Down Expand Up @@ -78,26 +77,6 @@ function handle_revoutput(Doku_Event $event, $param){

}


/**
* Adds the new toolbar item
*
* @author Michael Klier <chi@chimeric.de>
*/
function handle_toolbar_define(Doku_Event $event, $param) {
if(!page_exists($this->getConf('snippets_page'))) return;

$item = array(
'type' => 'mediapopup',
'title' => $this->getLang('gb_snippets'),
'icon' => '../../plugins/snippets/images/icon.png',
'url' => 'lib/plugins/snippets/exe/snippets.php?ns=',
'name' => 'snippets',
'options' => 'width=800,height=500,left=20,top=20,scrollbars=no,resizable=yes'
);
$event->data[] = $item;
}

function handle_dw_started(Doku_Event $event, $param) {
global $JSINFO;
if($this->getConf('snips_updatable')) {
Expand Down
10 changes: 9 additions & 1 deletion script.js
Expand Up @@ -303,4 +303,12 @@ if(opener) {
DokuCookie.setValue('snippets_old_rev',which) ;

}

if(toolbar){
var url = encodeURI('lib/plugins/snippets/exe/snippets.php?ns=');
toolbar[toolbar.length] = {"type":"mediapopup", "title": LANG['plugins']['snippets']['title'], "key":"",
"icon": "../../plugins/snippets/images/icon.png",
"url": url,
'name': 'snippets',
'options' : 'width=800,height=500,left=20,top=20,scrollbars=no,resizable=yes'
};
}

0 comments on commit 00b404a

Please sign in to comment.