tungnt128888 / getCSVFile

// ==UserScript==
// @name       getCSVFile
// @namespace  http://use.i.E.your.homepage/
// @match      http://voip.apaxenglish.com/*

// @license MIT
// @icon http://pics.smotri.com/cskins/blue/smiles/bt.gif
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==



//$( document ).ready(function() {
  // Handler for .ready() called.
//  if ($('#login_admin').length) {
//    $('#login_admin').click();
//    $('input[name="username"]').val('it');
//    $('input[name="password"]').val('itonly2017');

//    $("button:contains(Continue)").attr("id","continue");
 //   document.getElementById('continue').click();
//}
//});

//$('#login_admin').click(function(){
  //  alert("The paragraph was clicked.");
//});



var checkExist = setInterval(function() {

   if ($('#login_admin').length) {
      $('#login_admin').click();
    $('input[name="username"]').val('it');
    $('input[name="password"]').val('itonly2017');

    //$(':button[value="Continue"]').attr("id","continue");
    $("button:contains(Continue)").attr("id","continue");
    //$( "button[class='ui-button ui-corner-all ui-widget']" ).attr("id","username");
    //alert("Hello! I am an alert box!!");
    document.getElementById('continue').click();

     clearInterval(checkExist);
   }
}, 200); // check every 100ms

var checkExist1 = setInterval(function() {

   //if ($('#page_Main').length) {
   if ($('#welcomepage').length) {
   //if ($('#statuspage').length) {
      var win = window.open("http://voip.apaxenglish.com/admin/config.php?display=cdr", '_self');
    if (win) {
        //Browser has allowed it to be opened
        win.focus();
    } else {
        //Browser has blocked it
        alert('Please allow popups for this website');
    }

     clearInterval(checkExist1);
   }
}, 200); // check every 100ms

var checkExist2 = setInterval(function() {

   if ($('#startday').length) {
   //if ($('#maincdr').length) {
   //if ($('#statuspage').length) {
       var today = new Date();
       var dd = today.getDate();

       $('#startday').val(dd);
       $('#cnum').val("45,42,37,31");

       //document.getElementById("startday").value = dd;
       //document.getElementById("cnum").value = "_420[24689],_421[0-9],_4220";
       //document.getElementById("cnum").value = "45,42,48,31";

       $("input[name='need_html']:checkbox").prop('checked',false);
       $("input[name='need_csv']:checkbox").prop('checked',true);
       $('input[name="limit"]').val('100000');
       $("form:first").submit();
       //document.forms[0].submit();

       clearInterval(checkExist2);
   }
}, 200); // check every 100ms

//$( document ).ready(function() {
  // Handler for .ready() called.
 //   var win = window.open("http://voip.apaxenglish.com/admin/config.php?display=cdr", '_self');
 //   if (win) {
        //Browser has allowed it to be opened
//        win.focus();
 //   } else {
        //Browser has blocked it
 //       alert('Please allow popups for this website');
 //   }
//});