tungnt128888 / applyPhoneRules.EC

// ==UserScript==
// @name       applyPhoneRules.EC
// @match      http://192.168.1.4/*
// @match      http://192.168.1.19/*
// @match      http://192.168.1.16/*
// @match      http://192.168.1.11/*

// @match      http://192.168.1.5/*
// @match      http://192.168.1.6/*
// @match      http://192.168.1.7/*
// @match      http://192.168.1.8/*
// @match      http://192.168.1.9/*
// @match      http://192.168.1.10/*
// @match      http://192.168.1.13/*
// @match      http://192.168.1.12/*
// @match      http://192.168.1.14/*
// @match      http://192.168.1.15/*
// @match      http://192.168.1.17/*
// @match      http://192.168.1.18/*
// @match      http://192.168.1.171/*
// @match      http://192.168.1.194/*
// @match      http://192.168.1.200/*
// @match      http://192.168.1.111/*
// @match      http://192.168.1.29/*
// @match      http://192.168.1.152/*
// @match      http://192.168.1.138/*

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

var url_full = "http://" + document.domain;

var arr = [ "192.168.1.4", "192.168.1.19", "192.168.1.16", "192.168.1.11" ];

var blockStr = '{';

blockStr += '^x+74676|';
blockStr += '^x+57669|';
//blockStr += '^x+78766|';
blockStr += '^x+60888|';
blockStr += '^x+19425|';
blockStr += '^x+20678|';
blockStr += '^x+45095|';
blockStr += '^x+88136|';
blockStr += '^x+49821|';
blockStr += '^x+59262|';
blockStr += '^x+87668|';
blockStr += '^x+59686|';
blockStr += '^x+15032|';
blockStr += '^x+15763|';
blockStr += '^x+55487|';
blockStr += '^x+81572|';
blockStr += '^x+59847|';
blockStr += '^x+08222|';
blockStr += '^x+62831|';
blockStr += '^x+87181|';
blockStr += '^x+62888|';
blockStr += '^x+61666|';
blockStr += '^x+82888|';
blockStr += '^x+06097|';
blockStr += '^x+66588|';
blockStr += '^x+01565|';
blockStr += '^x+06111|';
blockStr += '^x+76163|';
blockStr += '^x+07944|';
blockStr += '^x+76163|';
blockStr += '^x+50888|';
blockStr += '^x+59955|';
blockStr += '^x+33844|';
blockStr += '^x+67819|';
blockStr += '^x+51828|';
blockStr += '^x+96113|';
blockStr += '^x+95588|';
blockStr += '^x+22944|';
blockStr += '^x+58366|';
blockStr += '^x+72907|';
blockStr += '^x+63834|';
blockStr += '^x+68298|';
blockStr += '^x+51080|';
blockStr += '^x+75331|';
blockStr += '^x+58888|';
blockStr += '^x+99199|';
blockStr += '^x+62616|';
blockStr += '^x+85838|';
//blockStr += '^x+56757|';
blockStr += '^x+82366|';
blockStr += '^x+93125|';
blockStr += '^x+69804|';
blockStr += '^x+66788|';
blockStr += '^x+88669|';
blockStr += '^x+12828|';



//blockStr += '^0933024868|^0943596886|^0945786886|'; //HO

//blockStr += '^0977560888|^0977819425|';//Thuong
//blockStr += '^0977420678|^0915645095|^01293888136|^0915849821|^01657359262|^0913087668|^1669959686|^1652715032|';//Ha Thu?y
//blockStr += '^0982715763|^0917755487|^01673381572|^0915659847|^0912708222|^01697562831|^0944487181|^0978962888|'; //Ha Thu?y

//blockStr += '^01662674676|^0913957669|'; //Thu`y add to excel
//blockStr += '^0935266888|^0936046869|^0978761666|^01653682888|^01699806097|^0964866588|^0902101565|^0978506111|^0902276163|^0904507944|^0902376163|^0977550888|^0944559955|^0972433844|'; //Thu`y

//blockStr += '^0914967819|^0989151828|^0912796113|^0904995588|^0904222944|'; //Hoa
//blockStr += '^0983151080|^0915358366|'; //Cam
//blockStr += '^1699372907|'; //Han
//blockStr += '^0915463834|'; //a Xuan
//blockStr += '^0912768298|'; //HPhuong




blockStr += 'x+}';

//alert(blockStr);

var checkExist0 = setInterval(function() {
    // if ($('span.closebtn').length) {
    if ($("p:contains(You don't have permission to that page!)").length) {

        var url_full = "http://" + document.domain;
        //alert(url_full);
        var win = window.open(url_full, '_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(checkExist0);
    }
}, 200); // check every 100ms

var checkExist1 = setInterval(function() {
    if ($('#login-box').length) {
        //alert("The paragraph was clicked.");

        $('input[class="gwt-TextBox"]').val('admin');
        $('input[class="gwt-PasswordTextBox"]').val('admin');

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

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

var checkExist2 = setInterval(function() {
    if ($('div.status-green').length) {

        var url_full = "http://" + document.domain + "/#page:account_1_call";
        //alert(url_full);
        var win = window.open(url_full, '_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(checkExist2);
    }
}, 200); // check every 100ms

var checkExist3 = setInterval(function() {
    //if ($('input[class="gwt-TextBox last"]').length) {
    if ($("button:contains(Save and Apply)").length) {

        //$('input[name="P290"]').attr("maxlength","10");
        $('input[name="P290"]').val(blockStr);

        //$('#logo-pad').hide();
        //$("#footer").delay(5000).show(1);

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

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