[Gambas-user] Gambas wiki update
T Lee Davidson
t.lee.davidson at gmail.com
Wed Apr 5 03:23:14 CEST 2023
On 4/4/23 18:43, Benoit Minisini wrote:
> There is something I don't like: you must store the state of the panel in the user session, not in the cookie store of the browser.
Okay, I've changed that.
> I even think we don't have to store the state at all. Just a button that toggles the index should be enough, shouldn't it?
I thought it was nice to preserve the user's preference between page loads. But, it also may make sense to show the index for a
newly fetched page so the hierarchical location is readily apparent.
If you don't like it and want to disable the feature, simply comment out line 48:
set_indexbar_from_session();
Let's see if the G-overlord allows this attachment.
--
Lee
-------------- next part --------------
window.onload = (event) => {
function get_first_class(_class) {
return document.getElementsByClassName(_class)[0];
}
var indexframe = get_first_class('index-frame');
var pageindex = get_first_class('page-index');
var indexbutton = document.getElementById('indexbutton');
function index_is_hidden() {
return (pageindex.offsetParent === null)
}
function toggle_index() {
if (index_is_hidden())
show_index();
else
hide_index();
}
function hide_index() {
pageindex.style.display = 'none';
indexframe.style.width = '12px';
indexbutton.querySelector(":scope > span").innerText = '»';
indexbutton.title = "Show index";
sessionStorage.setItem('index', 'hidden');
}
function show_index() {
pageindex.style.display = 'block';
indexframe.style.width = '25%';
indexbutton.querySelector(":scope > span").innerText = '«';
indexbutton.title = "Hide index";
sessionStorage.setItem('index', 'visible');
}
function set_indexbar_from_session() {
let index_panel = sessionStorage.getItem('index')
if (!index_panel)
return;
if ((index_panel == 'hidden') && (!index_is_hidden()))
hide_index();
else if ((index_panel == 'visible') && (index_is_hidden()))
show_index();
}
set_indexbar_from_session();
indexbutton.addEventListener("click", toggle_index);
};
More information about the User
mailing list