diff options
author | Andrew Dolgov <[email protected]> | 2017-01-07 15:29:17 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-01-07 15:29:17 +0300 |
commit | 6293d3717c32ca338c8e9d69b9eb70ed423b6ee5 (patch) | |
tree | 3fe5c794c86a215a503a1bb46044bea1970adcfa | |
parent | 4822485a745b783563fa3572992c581f0b2d8631 (diff) |
add toggle_sidebar plugin, remove obsolete toggle button
add PluginHost::HOOK_MAIN_TOOLBAR_BUTTON
-rw-r--r-- | classes/pluginhost.php | 1 | ||||
-rw-r--r-- | index.php | 11 | ||||
-rw-r--r-- | js/tt-rss.js | 8 | ||||
-rw-r--r-- | plugins/toggle_sidebar/application_side_list.png | bin | 0 -> 510 bytes | |||
-rw-r--r-- | plugins/toggle_sidebar/init.php | 34 |
5 files changed, 42 insertions, 12 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php index 675e0af17..82565257a 100644 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -50,6 +50,7 @@ class PluginHost { const HOOK_RENDER_ENCLOSURE = 29; const HOOK_ARTICLE_FILTER_ACTION = 30; const HOOK_ARTICLE_EXPORT_FEED = 31; + const HOOK_MAIN_TOOLBAR_BUTTON = 32; const KIND_ALL = 1; const KIND_SYSTEM = 2; @@ -171,17 +171,18 @@ <div id="toolbar" dojoType="dijit.layout.ContentPane" region="top"> <div id="main-toolbar" dojoType="dijit.Toolbar"> + <?php + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_MAIN_TOOLBAR_BUTTON) as $p) { + echo $p->hook_main_toolbar_button(); + } + ?> + <form id="headlines-toolbar" action="" onsubmit='return false'> </form> <form id="main_toolbar_form" action="" onsubmit='return false'> - <button dojoType="dijit.form.Button" id="collapse_feeds_btn" - onclick="collapse_feedlist()" - title="<?php echo __('Collapse feedlist') ?>" style="display : none"> - <<</button> - <select name="view_mode" title="<?php echo __('Show articles') ?>" onchange="viewModeChanged()" dojoType="dijit.form.Select"> diff --git a/js/tt-rss.js b/js/tt-rss.js index 1b84025d1..068ad0849 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -822,13 +822,7 @@ function parse_runtime_info(data) { function collapse_feedlist() { try { - if (!Element.visible('feeds-holder')) { - Element.show('feeds-holder'); - $("collapse_feeds_btn").innerHTML = "<<"; - } else { - Element.hide('feeds-holder'); - $("collapse_feeds_btn").innerHTML = ">>"; - } + Element.toggle("feeds-holder"); dijit.byId("main").resize(); diff --git a/plugins/toggle_sidebar/application_side_list.png b/plugins/toggle_sidebar/application_side_list.png Binary files differnew file mode 100644 index 000000000..248eaf1ac --- /dev/null +++ b/plugins/toggle_sidebar/application_side_list.png diff --git a/plugins/toggle_sidebar/init.php b/plugins/toggle_sidebar/init.php new file mode 100644 index 000000000..b2b0821a5 --- /dev/null +++ b/plugins/toggle_sidebar/init.php @@ -0,0 +1,34 @@ +<?php +class Toggle_Sidebar extends Plugin { + + private $host; + + function about() { + return array(1.0, + "Adds a main toolbar button to toggle sidebar", + "fox"); + } + + function init($host) { + $this->host = $host; + + $host->add_hook($host::HOOK_MAIN_TOOLBAR_BUTTON, $this); + } + + function hook_main_toolbar_button() { + ?> + + <button dojoType="dijit.form.Button" onclick="collapse_feedlist()"> + <img src="plugins/toggle_sidebar/application_side_list.png" + title="<?php echo __('Collapse feedlist') ?>"> + </button> + + <?php + } + + function api_version() { + return 2; + } + +} +?> |