82 lines
2.8 KiB
JavaScript
82 lines
2.8 KiB
JavaScript
function isOnline() {
|
|
$.ajax({
|
|
url: '/get_status',
|
|
dataType: 'text',
|
|
success: function(result){
|
|
rc = result.indexOf("Internet ist verbunden") !== -1;
|
|
if (rc) {
|
|
$("#internet_on_label").addClass("active");
|
|
$("#internet_on").attr('checked', true);
|
|
$("#internet_off_label").removeClass("active");
|
|
$("#internet_off").attr('checked', false);
|
|
} else {
|
|
$("#internet_off_label").addClass("active");
|
|
$("#internet_off").attr('checked', true);
|
|
$("#internet_on_label").removeClass("active");
|
|
$("#internet_on").attr('checked', false);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
$("#status_info").hide();
|
|
$("#balance_info").hide();
|
|
$("#shutdown_info").hide();
|
|
isOnline();
|
|
|
|
$("#poweroff").click(function(){
|
|
$("#well").hide();
|
|
$("#power").hide();
|
|
$("#get_balance").hide();
|
|
$("#get_status").hide();
|
|
$("#shutdown_info").show().html("<h1>ProxyPi wird heruntergefahren, zum Neustart muss der Stromstecker aus- und wieder eingesteckt werden!</h1>");
|
|
$.ajax({url: "/shutdown", success: function(result){
|
|
$("#div1").html(result);
|
|
}});
|
|
});
|
|
|
|
$("#get_balance").click(function(){
|
|
$('html,body').addClass("wait");
|
|
$.ajax({
|
|
url: "/get_balance",
|
|
dataType: 'text',
|
|
success: function(result){
|
|
$("#balance_info").show().html(result).fadeOut(15000);
|
|
},
|
|
complete: function () {
|
|
$('html,body').removeClass("wait");
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#get_status").click(function(){
|
|
$('html,body').addClass("wait");
|
|
$.ajax({
|
|
url: "/get_status",
|
|
dataType: 'text',
|
|
success: function(result){
|
|
$("#status_info").show().html(result).fadeOut(30000);
|
|
},
|
|
complete: function () {
|
|
$('html,body').removeClass("wait");
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
$('input[type=radio]').change(function() {
|
|
$('html,body').addClass("wait");
|
|
$.ajax({
|
|
url: this.value,
|
|
dataType: 'text',
|
|
success: function(result){
|
|
},
|
|
complete: function () {
|
|
$('html,body').removeClass("wait");
|
|
}
|
|
});
|
|
});
|
|
|
|
});
|