chutchison / CLA Test Lead Toggle Userscript

// ==UserScript==
// @name       CLA Test Lead Toggle Userscript
// @namespace  http://use.i.E.your.homepage/
// @version    0.1
// @description  Will submit leads as a test lead on the CLA form platform.
// @match      http://*/*
// @copyright  2012+, You
// ==/UserScript==



function create(htmlStr) {
    var frag = document.createDocumentFragment(),
        temp = document.createElement('div');
    temp.innerHTML = htmlStr;
    while (temp.firstChild) {
        frag.appendChild(temp.firstChild);
    }
    return frag;
}

someParentObject = document.getElementsByClassName('appInfoForm')[0];

if(someParentObject.length) {

    var fragment = create('<div id="toggle_testLead" style="padding:2px; position:fixed; z-index:10000; font-family:sans-serif; font-size:11px; top:0; right:0; background-color:black; color:white;">Test Lead Activated</div>');
        
    // You can use native DOM methods to insert the fragment:
    document.body.insertBefore(fragment, document.body.childNodes[0]);
    
    someChildObject = document.createElement("input");
    someChildObject.type = 'hidden';
    someChildObject.name = 'status';
    someChildObject.value = 'Test_Lead';
    
    someParentObject.insertBefore(someChildObject,someParentObject.firstChild);

}