2018-01-12, 02:22 AM
How to set default state of collapse buttons (on homepage categories) to collapsed? (instead of expanded)
[attachment=39856]
i see general.jw contains expander.click function. One could trigger that on page load, for each category, but that seems inefficient.
i see the saveCollapsed function stores the collapsed state in browser. Can we create that cookie on first visit to force collapsed view? Where's best place for that? Does that function make a separate cookie for every category?
i see global.php contains the setup code, which checks the collapse cookie:
should be a way to mod or just remove this code.
But, if i'm making a plugin, i should not alter the global.php.
Update: i deleted this code from global.php-- the page did not load in collapsed mode.
More analysis: the comment says "to automatically show them us expanded", but i believe that comment might not be accurate. Rather, what happens here is the code loops through the array of category collapse-states, and applies the user's state from previous visit.
I don't see where a default state is applied, for categories not found, or if the cookie isn't found.
[attachment=39856]
i see general.jw contains expander.click function. One could trigger that on page load, for each category, but that seems inefficient.
i see the saveCollapsed function stores the collapsed state in browser. Can we create that cookie on first visit to force collapsed view? Where's best place for that? Does that function make a separate cookie for every category?
i see global.php contains the setup code, which checks the collapse cookie:
should be a way to mod or just remove this code.
But, if i'm making a plugin, i should not alter the global.php.
Update: i deleted this code from global.php-- the page did not load in collapsed mode.
More analysis: the comment says "to automatically show them us expanded", but i believe that comment might not be accurate. Rather, what happens here is the code loops through the array of category collapse-states, and applies the user's state from previous visit.
I don't see where a default state is applied, for categories not found, or if the cookie isn't found.
// set up collapsable items (to automatically show them us expanded)
$collapsed = array('boardstats' => '', 'boardstats_e' => '', 'quickreply' => '', 'quickreply_e' => '');
$collapsedimg = $collapsed;
if($colcookie)
{
$col = explode("|", $colcookie);
if(!is_array($col))
{
$col[0] = $colcookie; // only one item
}
unset($collapsed);
foreach($col as $key => $val)
{
$ex = $val."_e";
$co = $val."_c";
$collapsed[$co] = "display: show;";
$collapsed[$ex] = "display: none;";
$collapsedimg[$val] = "_collapsed";
$collapsedthead[$val] = " thead_collapsed";
}
}