2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00
fhem-mirror/fhem/www/pgm2/fhemweb_readingsGroup.js
justme-1968 7f11e47147 readingsGroup.pm: added collapsed/collapsible to visibility attribute
added visibility command


git-svn-id: https://svn.fhem.de/fhem/trunk@7214 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2014-12-14 18:34:35 +00:00

96 lines
2.2 KiB
JavaScript

function
FW_readingsGroupToggle(d) {
var rg = document.getElementById( 'readingsGroup-'+d );
if( rg ) {
s=rg.style;
s.display = s.display=='none' ? 'block' : 'none';
var group = rg.getAttribute('groupId');
if( group ) {
var elArr = document.querySelectorAll( '[groupId='+group+']' );
for( var k=0; k<elArr.length; k++ ){
el = elArr[k];
if( el != rg ) {
el.style.display = 'none';
}
}
}
}
}
function
FW_readingsGroupToggle2(d) {
var rg = document.getElementById( 'readingsGroup-'+d );
if( rg ) {
s=rg.style;
s.width = rg.scrollWidth+'px';
var rows = rg.childNodes[0].childNodes;
for(var r=0; r<rows.length; r++){
var row = rows[r];
var pm = row.querySelectorAll('[id=plusminus]');
if( pm.length ) {
for(var i=0; i<pm.length; i++){
pm[i].innerHTML = pm[i].innerHTML == '+'? '-' : '+';
}
} else {
row.style.display = row.style.display=='none' ? '' : 'none';
}
}
var group = rg.getAttribute('groupId');
if( group ) {
var elArr = document.querySelectorAll('[groupId='+group+']');
for(var k=0; k<elArr.length; k++){
el = elArr[k];
s=el.style;
s.width = rg.scrollWidth+'px';
if( el != rg ) {
var rows = el.childNodes[0].childNodes;
for(var r=0; r<rows.length; r++){
var row = rows[r];
var pm = row.querySelectorAll('[id=plusminus]');
if( pm.length ) {
for(var i=0; i<pm.length; i++){
pm[i].innerHTML = '+';
}
} else {
row.style.display = (r==1 ? '' : 'none');
}
}
}
}
}
}
}
function
FW_readingsGroupHide(d) {
}
function
FW_readingsGroupShow(d) {
}
function
FW_readingsGroupUpdateLine(d){
var dd = d[0].split("-", 3);
if(dd.length != 2)
return;
if( dd[1] != "visibility" )
return
if( d[1] == 'toggle' ) FW_readingsGroupToggle( dd[0] );
if( d[1] == 'toggle2' ) FW_readingsGroupToggle2( dd[0] );
console.log("xxx: "+d[1]);
}
FW_widgets['readingsGroup'] = {
updateLine:FW_readingsGroupUpdateLine
};