toggle_sidebar: switch icon on click

master
Andrew Dolgov 6 years ago
parent 83650fffa4
commit 684a1368e9

@ -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';
}
};

@ -15,12 +15,16 @@ class Toggle_Sidebar extends Plugin {
$host->add_hook($host::HOOK_MAIN_TOOLBAR_BUTTON, $this); $host->add_hook($host::HOOK_MAIN_TOOLBAR_BUTTON, $this);
} }
function get_js() {
return file_get_contents(__DIR__ . "/init.js");
}
function hook_main_toolbar_button() { function hook_main_toolbar_button() {
?> ?>
<button dojoType="dijit.form.Button" onclick="Feeds.toggle()"> <button dojoType="dijit.form.Button" onclick="Plugins.Toggle_Sidebar.toggle(this)">
<i class="material-icons" <i class="material-icons toggle-sidebar-label"
title="<?php echo __('Toggle feedlist') ?>">menu</i> title="<?php echo __('Toggle sidebar') ?>">chevron_left</i>
</button> </button>
<?php <?php

Loading…
Cancel
Save