2 var test_numSet_ = [1, 34, 500, 432, 098, 124, 234, 3464, 12];
5 var test_numSetIndex = 0;
8 var pvNames_ =
new Array(2);
12 console.log(
"init called");
17 window.parent.setupWidget(window.frameElement.id);
27 function newWidget(widget)
30 for(var pvi=0;pvi< Object.keys(widget.PVList).length && pvi< 2;++pvi)
34 pvNames_[pvi] = Object.keys(widget.PVList)[pvi];
40 function setupPVs(settings)
42 console.log(
"setupPVs() : " + settings);
45 function newValue(pvName, pvValue, pvTime, pvStatus, pvSeverity)
48 for(;pvi<pvNames_.length;++pvi)
50 if(pvNames_[pvi] == pvName)
54 if(pvi == pvNames_.length)
56 console.log(
"Invalid new value for PV name:" + pvName);
64 switchValue_ = ((pvValue>>1)|0)%2;
69 barValue_ = (pvValue|0)%100;
77 function updateSwitch()
79 switchValue_ = !switchValue_;
86 var elem = document.getElementById(
"switch_rounded");
101 console.log(
"updateBar called " + barValue_);
103 if (barValue_ == 100)
105 window.clearInterval(updateTimeout_);
111 function updateBar2() {
113 barValue_ = test_numSet_[test_numSetIndex];
116 if (test_numSetIndex == test_numSet_.length) {
118 test_numSetIndex = 0;
127 var elem = document.getElementById(
"weather_bar");
128 var elem2 = document.getElementById(
"weatherBar_bg");
129 var width = 100 - barValue_;
132 if(barValue_ < 0 || barValue_ > 100)
135 elem.innerHTML =
'Illegal';
136 elem.style.width = 100 +
"%";
137 elem.style.left = 0 +
"%";
138 elem.style.backgroundColor =
"red";
142 elem.style.width = width +
'%';
143 elem.style.left = barValue_ +
'%';
144 elem2.innerHTML = barValue_ +
'%';
146 elem.style.backgroundColor =
"white";