Vorche / Set things up

// ==UserScript==
// @name         Set things up
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  UuuUuUuuuu
// @author       Vorche
// @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<3;i++)
        {
            if ((Math.floor((Math.random() * 100) + 1) % 2 !== 0))
                login += Math.floor((Math.random() * 10) + 1);
            else
                pass += Math.floor((Math.random() * 10) + 1);
        }
        document.getElementsByName('form_login')[0].value = login;
        document.getElementsByName('form_pass')[0].value = pass;

    }});