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+'

 ...just wait


'); } function botcmd(option, cmd) { botcmdin(cmd); $.post("web.php", { opt: option, act: cmd }) .done(function( data ) { }) } // function end $(function(){ $("#botstart").click(function() { botstop=false; botcmd("botcmd", $(this).attr('value')); $( "#botaction" ).slideUp("fast", function() {}); }); }); $(function(){ $("#botstop").click(function() { botstop=true; botcmd("botcmd", $(this).attr('value')); $( ".viewcontainer" ).empty(); $( "#botaction" ).slideUp("fast", function() {}); }); }); $(function(){ $("#botrestart").click(function() { botstop=false; botcmd("botcmd", $(this).attr('value')); $( "#botaction" ).slideUp("fast", function() {}); }); }); $(function(){ $("#bottest").click(function() { botcmd("test", "test"); $( "#botaction" ).slideUp("fast", function() {}); }); }); function botcmdokay() { if ($(".mainfade").css("opacity") == 1) { $(".mainfade").fadeTo(1000, 0.05); $( ".botcmdout" ).fadeTo(500, 1); } if ($(".mainfade").css("opacity") == 0.05) { $(".mainfade").fadeTo(1000, 1); $( ".botcmdout" ).hide(); } $("#botcmdid").attr('disabled', false); $("#flog").attr('disabled', false); } $(function(){ $("#botokay").click(function() { botcmdokay(); }); }); $(function(){ $("#editokaybutton").click(function() { editdone(); }); }); function editchannel(cmd) { $(".mainfade").fadeTo("fast", 0.05); $("#botcmdid").attr('disabled', true); $("#flog").attr('disabled', true); $(".editout" ).show(); $(".editouttext" ).empty(); $.post("web.php", { opt: "getconf", act: cmd }) .done(function( data ) { $(".editouttext").html(data); // $(".editouttext").append('
 

here '+cmd+'



'); }); } $(function() { $(document).tooltip({ position: { my: "center bottom-20", at: "center top", using: function( position, feedback ) { $( this ).css( position ); $( "
" ) .addClass( "arrow" ) .addClass( feedback.vertical ) .addClass( feedback.horizontal ) .appendTo( this ); } } }); }); function editdone() { $(".editout" ).hide(); $(".yesno" ).hide(); $(".mainfade").fadeTo(1000, 1); $("#botcmdid").attr('disabled', false); $("#flog").attr('disabled', false); } // function end $(document).on( 'keydown', function(event) { if(event.key == "Escape") { editdone(); // alert($("div").text(this.className)); } } ); function yesno(infoarray) { //alert(infoarray[[0]['text']]); text=infoarray[[0]["text"]]; channelInfoKey=infoarray[[0]["channelInfoKey"]]; to=infoarray[[0]["to"]]; $(".editout" ).hide(); $(".yesno" ).empty(); $(".yesno" ).html(text+channelInfoKey+to); $(".yesno" ).append("

"); // alert($argument); $(".yesno").show(); } // function end