POE-XUL
view release on metacpan or search on metacpan
javascript/src/util.js view on Meta::CPAN
if( !down || !widget ) {
return false;
}
if( Element.visible( down ) ) {
rollup_set( widget, textOFF, up, down );
}
else {
rollup_set( widget, textON, down, up );
}
if( rollup.accordion ) {
rollup_accordion( id, textOFF, textON ) ;
}
return false;
}
rollup.accordion = 1;
// ------------------------------------------------------------------
function rollup_set( widget, text, shown, hidden ) {
if( shown )
Element.show( shown );
if( hidden )
Element.hide( hidden );
if( widget.textContent ) {
widget.textContent = text;
}
else {
widget.value = text;
}
}
// ------------------------------------------------------------------
function rollup_accordion( down_id, textOFF, textON ) {
var droppers = document.getElementsByTagName( 'groupbox' );
fb_log( "Accordion on " + droppers.length + " elements" );
for( var q = 0 ; q < droppers.length ; q++ ) {
var gb = droppers[q];
if( gb && gb.id && gb.id != down_id &&
gb.className && gb.className.match(/drop-down/) ) {
var down = $( "DOWN_" + gb.id );
if( down && Element.visible( down ) ) {
var widget = $( "WIDGET_" + gb.id );
fb_log( "Drop down " + gb.id + " is down" );
if( widget ) {
rollup_set( widget, textOFF, null, down );
fb_log( widget.id + ".onclick=" +
widget.attributes['onclick'] );
}
}
}
}
}
// ------------------------------------------------------------------
function popup ( id, e ) {
var el = $( id );
if( el ) {
if( Element.visible( el ) )
Element.hide( el );
else
Element.show( el );
}
if( e ) {
e.stopPropagation();
e.preventDefault();
}
return false;
}
// ------------------------------------------------------------------
function to_page( name ) {
if( window.location.toString().match( /\.xul$/ ) ) {
window.location = name + ".xul";
}
else {
window.location = name + ".html";
}
return false;
}
// ------------------------------------------------------------------
function corner_div( side, width, background ) {
var line = document.createElement( "div" );
Element.setStyle( line, {
height: "1px",
overflow: "hidden",
background: background,
} );
var m = "margin-"+side;
line.style[ m.camelize() ] = width+"px";
return line;
}
function corners ( id ) {
var el = $( id );
var dim = Element.getDimensions( el );
var pos = Position.positionedOffset( el );
// Left-side corner
var left = document.createElement( "div" );
var size = dim.height + "px";
Element.setStyle( left, {
width: size,
height: size,
overflow: "hidden",
"background-color": "transparent",
position: "fixed",
top: pos[1] + "px",
left: (pos[0] - dim.height) + "px"
} );
// Right-side corner
var right = document.createElement( "div" );
( run in 0.697 second using v1.01-cache-2.11-cpan-364913b4093 )