mirror of
https://github.com/moodle/moodle.git
synced 2025-02-08 17:11:49 +01:00
c24a1ccd08
How it works: _ within the "sideblockheading" a DIV with class="hide-show" holds a link calling the JS containerDisplaySwitching(). To the user it's represented by the icon "switch.gif" (a plus in a square) at the right end side of the header. _ all content of the sideblock is surounded by a new <div class="blockcontent" id="'.$attributes['id']."_cont\">" _ a call of the JS containerDisplaySwitching() changes the state of the appropriate DIV with the content to "display:none/inline" and writes this state into a cookie. _ at the end of every block I added a call to the JS "containerDisplaySet()". This reads the block's state and hides the content or leaves it visible with every page load. _ in the stylesheet I added the positioning of the icon: .sideblockheading .hide-show { float:right; } .sideblockheading a img.hide-show-image { padding-top:0.25em; }
38 lines
833 B
JavaScript
38 lines
833 B
JavaScript
function containerDisplaySwitching(id)
|
|
{
|
|
var id_cont = id + "_cont";
|
|
var x = new getObj(id_cont);
|
|
var what = (x.style.display == 'inline' || x.style.display == '') ? 'none' : 'inline';
|
|
x.style.display = what;
|
|
new cookie(id, what, 356, '/').set();
|
|
}
|
|
|
|
function containerDisplaySet(id)
|
|
{
|
|
var id_cont = id + "_cont";
|
|
var x = new getObj(id_cont);
|
|
var what = new cookie(id).read();
|
|
if (what != null) {
|
|
x.style.display = what;
|
|
}
|
|
}
|
|
|
|
function getObj(id)
|
|
{
|
|
if (document.getElementById)
|
|
{
|
|
this.obj = document.getElementById(id);
|
|
this.style = document.getElementById(id).style;
|
|
}
|
|
else if (document.all)
|
|
{
|
|
this.obj = document.all[id];
|
|
this.style = document.all[id].style;
|
|
}
|
|
else if (document.layers)
|
|
{
|
|
this.obj = document.layers[id];
|
|
this.style = document.layers[id];
|
|
}
|
|
}
|