setInterval(readLogFile, 4000);
setInterval(stats, 15000);
setInterval(queuestats, 2000);
window.onload = start;
var pathname = window.location.pathname;
botstop = false;
infoarray=[];
function gettitle() {
$.post("web.php", {
opt: "title",
act: ""
})
.done(function( data ) {
document.title = data+" - bot";
});
}
function start() {
gettitle();
$(".fulllogbuttonhide" ).hide();
$(".fulllog" ).hide();
$(".editout" ).hide();
$(".botcmdout" ).hide();
$("#botaction" ).hide();
$(".yesno").hide();
// $(".fulllog").scrollTop($(".fulllog")[0].scrollHeight);
readLogFile();
stats();
}
function readLogFile() {
if (botstop == false) {
$.post("web.php", {
opt: "taillog",
act: ""
})
.done(function( data ) {
data = data.replace(new RegExp(" ", "g"), " ");
data = data.replace(new RegExp("\n", "g"), "
");
$(".viewcontainer").html(data);
}); // $.post("web.php", {
$(".viewcontainer").scrollTop($(".viewcontainer")[0].scrollHeight);
} else {
$(".viewcontainer" ).last().html( "bot not running...");
}// if (botstop == false)
} // function end
function sortchannels(option, cmd) { // hmmm
alert(cmd+option);
$.post("web.php?call="+option, {
opt: option,
act: cmd
})
.done(function( data ) {
})
} // function end
function stats() {
$.post("web.php", {
opt: "getlogsize",
act: ""
})
.done(function( data ) {
$(".logsize").html(data);
});
$.post("web.php", {
opt: "cpuload",
act: ""
})
.done(function( data ) {
$(".cpuload").html(data);
});
$.post("web.php", {
opt: "loadconf",
act: ""
})
.done(function( data ) {
$(".confmain").html(data);
});
}
function queuestats() {
$.post("web.php", {
opt: "queue",
act: ""
})
.done(function( data ) {
$(".queue").html(data);
});
$.post("web.php", {
opt: "fwdstatus",
act: ""
})
.done(function( data ) {
$(".fwdstatus").html(data);
});
}
function loadfulllog() {
$.post("web.php", {
opt: "fulllog",
act: ""
})
.done(function( data ) {
data = data.replace(new RegExp(" ", "g"), " ");
data = data.replace(new RegExp("\n", "g"), "
");
$(".fulllog").html(data);
$(".fulllog").scrollTop($(".fulllog")[0].scrollHeight);
$(".fulllogbuttonhide").show();
});
}
$(function(){
$("#flog").click(function() {
$(".fulllogbutton" ).hide();
$("#botcmdid" ).hide();
$("#botaction" ).hide();
$(".fulllog" ).last().html( "logfile loading...");
$(".viewcontainer" ).hide();
$(".viewborder" ).hide()
$(".confmain").hide();
loadfulllog();
$( ".fulllog" ).show();
});
});
$(function(){
$("#floghide").click(function() {
$( ".fulllogbutton" ).show();
$( "#botcmdid" ).show();
$( ".fulllogbuttonhide" ).hide();
$( ".fulllog" ).empty();
$( ".viewcontainer" ).show();
$( ".viewborder" ).show();
$( ".fulllog" ).hide();
$(".confmain").show();
});
});
$(function(){
$( "#botcmdid" ).on( "click", function() {
if ( $( "#botaction" ).first().is( ":hidden" ) ) {
$( "#botaction" ).slideDown( "slow", function() {});
} else {
$( "#botaction" ).slideUp( "fast", function() {});
}
});
});
function botcmdin(cmd) {
if ($(".mainfade").css("opacity") == 1) {
$(".mainfade").fadeTo("fast", 0.05);
$(".botcmdout").fadeTo(500, 1);
$("#botcmdid").attr('disabled', true);
$("#flog").attr('disabled', true);
}
if ($(".mainfade").css("opacity") == 0.05) {
$(".mainfade").fadeTo(1000, 1);
$(".botcmdout").hide();
$(".botcmdouttext").hide();
}
$(".botcmdouttext" ).empty();
$(".botcmdouttext").append('
bot action:
'+cmd+'
here '+cmd+'