tungnt128888 / sendSMS

// ==UserScript==
// @name       sendSMS
// @namespace  http://use.i.E.your.homepage/
// @match      https://partner.sms.fpt.net/*

// @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 ($('input[name="username"]').length) {
    //alert("The paragraph was clicked.");

    $('input[name="username"]').val('apax_campha_sms');
    $('input[name="password"]').val('192168');

    $("button:contains(Đăng nhập)").attr("id", "continue");
    document.getElementById('continue').click();

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

var checkExist1 = setInterval(function () {
  if (!$('#frmFilter').length) {
    if ($('#fade').length) {
      var win = window.open("https://partner.sms.fpt.net/brandname/search", '_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 ($('#frmFilter').length) {
    //SearchSMS.exportExcel();
    //      alert('Please allow popups for this website');

    //$('input[type="button"][class="btn btn-blue"]').click();
    //$('input[name="DateFrom"]').val('15/12/2017');
    //$('input[name="DateTo"]').val('15/12/2017');

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

    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');
//   }
//});