File tree Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 34
34
</ style >
35
35
< script type ="application/javascript ">
36
36
function sendValue ( input ) {
37
- $ . ajax ( {
38
- url : input . dataset . url , method : "POST" , data : $ ( input ) . closest ( "form" ) . find ( "input" ) . val ( )
39
- } ) . complete ( function ( data , textStatus , jqXHR ) {
40
- alert ( textStatus ) ;
41
- } ) ;
37
+ $ . ajax ( input . dataset . url , {
38
+ 'data' : $ ( input ) . closest ( "form" ) . find ( "input" ) . val ( ) ,
39
+ 'type' : 'POST' ,
40
+ 'processData' : false ,
41
+ 'contentType' : 'application/json'
42
+ } ) ;
42
43
}
43
44
setInterval ( function ( ) {
44
45
$ ( "[data-ajaxurl]" ) . each ( function ( index ) {
45
46
var ele = $ ( this ) ;
46
47
$ . getJSON ( ele . data ( "ajaxurl" ) , function ( data ) {
47
- var eleValue = $ ( ele . find ( ".panel-body " ) [ 0 ] ) ;
48
+ var eleValue = $ ( ele . find ( "#value " ) [ 0 ] ) ;
48
49
if ( data . value . toUpperCase ( ) == "OPEN" ) {
49
50
eleValue . html ( "<span class=\"label label-success\">" + data . value + "</span>" ) ;
50
51
} else if ( data . value . toUpperCase ( ) == "CLOSE" ) {
129
130
<!-- split:sensnor_input -->
130
131
<!-- split:sensor_output -->
131
132
< li class ="list-group-item " style ="font-size: 24px; ">
132
- < span > {value}</ span >
133
+ < span id =" value " > {value}</ span >
133
134
</ li >
134
135
<!-- split:sensor_output -->
135
136
</ ul >
Original file line number Diff line number Diff line change @@ -79,14 +79,16 @@ void WebPortal::sendSensor(Entry* entry) {
79
79
String page = FPSTR (HTML_SENSOR);
80
80
page.replace (" {color}" , entry->isInternal () ? " warning" : " primary" );
81
81
page.replace (" {name}" , getName (entry));
82
+ bool include = false ;
82
83
if (entry->isOut ()) {
84
+ include = true ;
83
85
page.replace (" {input}" , FPSTR (HTML_SENSOR_INPUT));
84
- page.replace (" {path}" , getRestPath (entry));
85
86
} else {
86
87
page.replace (" {input}" , " " );
87
88
}
88
89
String value = entry->getValue ();
89
90
if (value != NULL ) {
91
+ include = true ;
90
92
page.replace (" {output}" , FPSTR (HTML_SENSOR_OUTPUT));
91
93
if (getName (entry).endsWith (" password" )) {
92
94
page.replace (" {value}" , " ***" );
@@ -96,8 +98,11 @@ void WebPortal::sendSensor(Entry* entry) {
96
98
} else {
97
99
page.replace (" {output}" , " " );
98
100
}
99
- page.replace (" {last_updated}" , time (entry->getLastUpdate ()));
100
- webServer->sendContent (page);
101
+ if (include) {
102
+ page.replace (" {path}" , getRestPath (entry));
103
+ page.replace (" {last_updated}" , time (entry->getLastUpdate ()));
104
+ webServer->sendContent (page);
105
+ }
101
106
}
102
107
103
108
void WebPortal::sendConfigs () {
You can’t perform that action at this time.
0 commit comments