preset flipswitch works
This commit is contained in:
13
index.html
13
index.html
@ -12,6 +12,7 @@
|
||||
$.ajaxSetup({
|
||||
async: false
|
||||
});
|
||||
$("#flip-checkbox-1").flipswitch({"defaults": true});
|
||||
var switchMapping = $.getJSON('http://' + serverAddress + '/switchMapping').responseJSON;
|
||||
var firstListItem = $("li:first", "#switchlist");
|
||||
for (var key in switchMapping) {
|
||||
@ -37,9 +38,19 @@
|
||||
});
|
||||
$(".switchlink").click(function() {
|
||||
var v = $(this).attr("id");
|
||||
$("#target").text(v);
|
||||
var w = $("span:first", this).text();
|
||||
$("#dialogTitle").text(w);
|
||||
$("#target").text(v);
|
||||
var x = $("span:last", this).text();
|
||||
console.debug(x);
|
||||
if (x == 'on') {
|
||||
console.debug('x:on');
|
||||
$("#flip-checkbox-1").prop('checked', true);
|
||||
} else {
|
||||
console.debug('x:off');
|
||||
$("#flip-checkbox-1").prop('checked', false);
|
||||
}
|
||||
$("#flip-checkbox-1").flipswitch( "refresh" );
|
||||
});
|
||||
function updateState() {
|
||||
for (var key in switchMapping) {
|
||||
|
Reference in New Issue
Block a user