return (this.match(/^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$/) != null);
},
- 'host': function()
+ 'host': function(ipv4only)
{
return cbi_validators.hostname.apply(this) ||
- cbi_validators.ipaddr.apply(this);
+ ((ipv4only != 1) && cbi_validators.ipaddr.apply(this)) ||
+ ((ipv4only == 1) && cb_validators.ip4addr.apply(this));
},
'hostname': function()
cbi_validators.host.apply(this);
},
- 'hostport': function()
+ 'hostport': function(ipv4only)
{
var hp = this.split(/:/);
if (hp.length == 2)
- return (cbi_validators.host.apply(hp[0]) &&
+ return (cbi_validators.host.apply(hp[0], ipv4only) &&
cbi_validators.port.apply(hp[1]));
return false;
},
- 'ipaddrport': function()
+ 'ip4addrport': function()
{
var hp = this.split(/:/);
if (hp.length == 2)
return (cbi_validators.ipaddr.apply(hp[0]) &&
cbi_validators.port.apply(hp[1]));
-
return false;
},
+ 'ipaddrport': function(bracket)
+ {
+ if (this.match(/^([^\[\]:]+):([^:]+)$/)) {
+ var addr = RegExp.$1
+ var port = RegExp.$2
+ return (cbi_validators.ip4addr.apply(addr) &&
+ cbi_validators.port.apply(port));
+ } else if ((bracket == 1) && (this.match(/^\[(.+)\]:([^:]+)$/))) {
+ var addr = RegExp.$1
+ var port = RegExp.$2
+ return (cbi_validators.ip6addr.apply(addr) &&
+ cbi_validators.port.apply(port));
+ } else if ((bracket != 1) && (this.match(/^([^\[\]]+):([^:]+)$/))) {
+ var addr = RegExp.$1
+ var port = RegExp.$2
+ return (cbi_validators.ip6addr.apply(addr) &&
+ cbi_validators.port.apply(port));
+ } else {
+ return false;
+ }
+ },
+
'wpakey': function()
{
var v = this;
if (node && node.parentNode && !cbi_d_check(entry.deps)) {
node.parentNode.removeChild(node);
state = true;
- if( entry.parent )
+ if( entry.parent && typeof(cbi_c[entry.parent]) == 'number')
cbi_c[entry.parent]--;
} else if ((!node || !node.parentNode) && cbi_d_check(entry.deps)) {
if (!next) {
next.parentNode.insertBefore(entry.node, next);
}
state = true;
- if( entry.parent )
+ if( entry.parent && typeof(cbi_c[entry.parent]) == 'number' )
cbi_c[entry.parent]++;
}
}
for( var sid in cbi_t )
for( var tid in cbi_t[sid] )
{
- if( cbi_c[cbi_t[sid][tid].cid] == 0 ) {
+ if (typeof(cbi_c[cbi_t[sid][tid].cid]) !== 'number') {
+ continue;
+ }
+ else if( cbi_c[cbi_t[sid][tid].cid] == 0 ) {
cbi_t[sid][tid].tab.style.display = 'none';
}
else if( cbi_t[sid][tid].tab && cbi_t[sid][tid].tab.style.display == 'none' ) {