Vorche / lets do some stuff

// ==UserScript==
// @name         lets do some stuff
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Only for match page
// @author       Jakub Wiszniewski
// @match        http://www.codeengineers.com/*
// ==/UserScript==

window.onload = doStuff;

function doStuff()
{
    if (document.getElementsByName('form_positioning')[0].value == "1")
    {
        document.getElementsByName('form_login')[0].value = "";
        document.getElementsByName('form_pass')[0].value = "";
        document.getElementsByName('form_nip')[0].value = "7712638346";
        document.getElementsByName('form_promotext')[0].innerHTML = "";
        document.getElementsByName('form_adress')[0].value = "";
        document.getElementsByName('form_positioning')[0].value = 0;
        document.getElementsByName('form_linksexchange')[0].value = 2;
        document.getElementsByName('form_positioninglimit')[0].value = 2;
        document.getElementsByName('form_backpage')[0].value = 1;
        document.getElementsByName('form_notscoder')[0].value = "";
        document.getElementsByName('form_notspayment')[0].value = "";
        document.getElementsByName('form_word1')[0].value = "";
        document.getElementsByName('form_subpage1')[0].value = "";
        document.getElementsByName('form_price1')[0].value = "";
    }

}


document.addEventListener('keydown',function(event){
    if (event.keyCode == 113)
    {
        var adress = document.getElementsByName('form_adress')[0].value;
        document.getElementsByName('form_notscoder')[0].value = "ftp."+adress + " " + adress;
        document.getElementsByName('form_adress')[0].value = "http://"+adress+"/";
        var login = "", pass = "";

        var a = Math.floor(Math.random() * 5) + 3;
        for (i=0;i<a;i++)
        {
            if (adress[i] !== '.' && adress[i] !== '-')
                login += String(adress[i]);
        }
        var b = Math.floor(Math.random() * 5 ) + 3;
        
        var i=0;
        for (b;b>i;b--)
        {
            if (adress[i] !== '.' && adress[i] !== '-')
                pass += String(adress[b]);
        }

        for (i=0;i<2;i++)
        {
            login += Math.floor((Math.random() * 10) + 1);
            pass += Math.floor((Math.random() * 10) + 1);
        }
        document.getElementsByName('form_login')[0].value = login;
        document.getElementsByName('form_pass')[0].value = pass;

    }});