tungnt128888 / getCSVFile.CM

// ==UserScript==
// @name       getCSVFile.CM
// @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==

var checkExist = setInterval(function() {
    if ($('#login_admin').length) {
        // alert('Please allow popups for this website');

        //$('#login_admin').click();
        document.getElementById('login_admin').click();

        $('input[name="username"]').val('it');
        $('input[name="password"]').val('itonly2017');

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

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

var checkExist1 = setInterval(function() {
    if ($('#welcomepage').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) {
        var today = new Date();
        var dd = today.getDate();

        $('#startday').val(dd);
        //$('#startday').val('17');
        $('#cnum').val("_420[4-9],_421[0-9],_4220");

        //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');
        //$("#disposition").val("ANSWERED");
        //$("#group").val("cnum");
        $("form:first").submit();
        //document.forms[0].submit();

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