]> git.wh0rd.org Git - tt-rss.git/commitdiff
add toggle_sidebar plugin, remove obsolete toggle button
authorAndrew Dolgov <noreply@fakecake.org>
Sat, 7 Jan 2017 12:29:17 +0000 (15:29 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Sat, 7 Jan 2017 12:29:17 +0000 (15:29 +0300)
add PluginHost::HOOK_MAIN_TOOLBAR_BUTTON

classes/pluginhost.php
index.php
js/tt-rss.js
plugins/toggle_sidebar/application_side_list.png [new file with mode: 0644]
plugins/toggle_sidebar/init.php [new file with mode: 0644]

index 675e0af17152ad8fe7f00ca29e4924de8dca7078..82565257a94ef3bedbbd731b9d4131d5cc95e7b8 100644 (file)
@@ -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;
index 6b27d90425e72fb9c4c9ebd1f0dc950140d5a812..220fe27c1693536d5147b7d69b3207dc151f44f2 100644 (file)
--- a/index.php
+++ b/index.php
 <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">
-                       &lt;&lt;</button>
-
                <select name="view_mode" title="<?php echo __('Show articles') ?>"
                        onchange="viewModeChanged()"
                        dojoType="dijit.form.Select">
index 1b84025d112b879906c05c169038b4adb3e0d6a7..068ad0849634a44d297be06c0913002f02ba1616 100644 (file)
@@ -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 = "&lt;&lt;";
-               } else {
-                       Element.hide('feeds-holder');
-                       $("collapse_feeds_btn").innerHTML = "&gt;&gt;";
-               }
+               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
new file mode 100644 (file)
index 0000000..248eaf1
Binary files /dev/null and b/plugins/toggle_sidebar/application_side_list.png differ
diff --git a/plugins/toggle_sidebar/init.php b/plugins/toggle_sidebar/init.php
new file mode 100644 (file)
index 0000000..b2b0821
--- /dev/null
@@ -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;
+       }
+
+}
+?>