summaryrefslogtreecommitdiff
path: root/plugins/toggle_sidebar
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2019-03-06 12:52:09 +0300
committerAndrew Dolgov <[email protected]>2019-03-06 12:52:09 +0300
commit684a1368e9794abfb5c70877304dcf06110ca1d7 (patch)
tree2fea92660002128a0f60ce766b1a04631ef649dc /plugins/toggle_sidebar
parent83650fffa44a8f3eeeb81153835c013348a8c584 (diff)
toggle_sidebar: switch icon on click
Diffstat (limited to 'plugins/toggle_sidebar')
-rw-r--r--plugins/toggle_sidebar/init.js9
-rw-r--r--plugins/toggle_sidebar/init.php10
2 files changed, 16 insertions, 3 deletions
diff --git a/plugins/toggle_sidebar/init.js b/plugins/toggle_sidebar/init.js
new file mode 100644
index 000000000..9efb06193
--- /dev/null
+++ b/plugins/toggle_sidebar/init.js
@@ -0,0 +1,9 @@
+Plugins.Toggle_Sidebar = {
+ toggle: function() {
+ Feeds.toggle();
+
+ const label = document.querySelector("i.toggle-sidebar-label");
+
+ label.innerHTML = Element.visible("feeds-holder") ? 'chevron_left' : 'chevron_right';
+ }
+};
diff --git a/plugins/toggle_sidebar/init.php b/plugins/toggle_sidebar/init.php
index 2992f2ac7..f8ec35a91 100644
--- a/plugins/toggle_sidebar/init.php
+++ b/plugins/toggle_sidebar/init.php
@@ -15,12 +15,16 @@ class Toggle_Sidebar extends Plugin {
$host->add_hook($host::HOOK_MAIN_TOOLBAR_BUTTON, $this);
}
+ function get_js() {
+ return file_get_contents(__DIR__ . "/init.js");
+ }
+
function hook_main_toolbar_button() {
?>
- <button dojoType="dijit.form.Button" onclick="Feeds.toggle()">
- <i class="material-icons"
- title="<?php echo __('Toggle feedlist') ?>">menu</i>
+ <button dojoType="dijit.form.Button" onclick="Plugins.Toggle_Sidebar.toggle(this)">
+ <i class="material-icons toggle-sidebar-label"
+ title="<?php echo __('Toggle sidebar') ?>">chevron_left</i>
</button>
<?php