Help (Run when page loads)Javascript

Discussion in 'Web Programming' started by GPTman, Aug 10, 2009.

Help (Run when page loads)Javascript
  1. Unread #1 - Aug 10, 2009 at 11:08 AM
  2. GPTman
    Joined:
    Aug 10, 2009
    Posts:
    2
    Referrals:
    0
    Sythe Gold:
    0

    GPTman Newcomer

    Help (Run when page loads)Javascript

    Hi someone told me this is a good place to get answers on stuff like this.


    I was wondering if there is a way to make nothing run until a page loads.
    Im using an addon called "greasemonkey" on firefox to run javascripts on firefox.


    this is the script.
    Could someone gladly rewrite it so it would only run functions when the page loads entirely?


    Btw i DID NOT make this script.

    // ==UserScript==
    // @name Just say NO!
    // @namespace http://schoolsux.tz/
    // @description Checks no on surveys, just enable whenever you need it; you should edit the @include.
    // @include http://www.eltpath.com/*
    // @include http://*.smileymedia.com/*
    // @include http://lgn*.coolsavings.com/*
    // @include http://lnktrckr.com/*
    // @include http://*quizjungle.com/?act_id=*
    // @include http://www.quizjumper.com/*
    // @include http://www.modpath.com/*
    // @include http://www.tnmtechnology.com/*
    // @include http://www.brandarama.com/*
    // @include http://www.topconsumergifts.com/*
    // @include http://offers.slwpath.com/*
    // @include http://us.quizrocket.com/*
    // @include http://www*.recipe4living.com/default*
    // @include http://www.premiumproductsonline.com/*
    // @include https://mysmokingrewards.com/*
    // @include http://www.eversave.com/*
    // @include http://www.thelaptopsaver.com/*
    // ==/UserScript==

    inputs = document.getElementsByTagName("input");
    var checkedyes = 0;
    var radios=0;
    var firstradio=0;
    var foundradio=false;
    var i=0;
    for(i=0;i<inputs.length;i++)
    {
    if(inputs.type=="radio")
    {
    if(!foundradio)
    {
    firstradio = i;
    foundradio = true;
    }
    radios++;
    if(inputs.value.toLowerCase()=="no")
    {
    inputs.checked = true;
    inputs.click();
    document.body.focus();
    }
    else
    {
    inputs.checked=true;
    }
    }

    }
    if (radios>2)
    {
    inputs[firstradio+2].checked=true;
    }

    next = document.getElementById("nextOffer");
    if (next == null)
    {
    next = document.getElementById("pass");
    }
    if (next == null)
    {
    next = document.getElementById("bt_cancel");
    }
    if(next == null)
    {
    for(i=0;i<inputs.length;i++)
    {
    if((inputs.type=="submit") && (inputs.value.toLowerCase()=="skip"))
    {
    next = inputs;
    break;
    }
    }
    }
    if(next==null)
    {
    for(i=0;i<inputs.length;i++)
    {
    if((inputs.value.toLowerCase()=="submit") || (inputs.name.toLowerCase()=="submit"))
    {
    next = inputs;
    break;
    }
    }
    }
    if(next == null)
    {
    next = document.getElementById("submitbutton");
    }
    next.focus();
    next.click();
     
  3. Unread #2 - Aug 14, 2009 at 1:06 AM
  4. Deacon Frost
    Joined:
    Jan 30, 2007
    Posts:
    2,905
    Referrals:
    3
    Sythe Gold:
    57

    Deacon Frost Grand Master
    Banned

    Help (Run when page loads)Javascript

    Copy it all into a url, then bookmark it. When the page loads, click the bookmark.
     
  5. Unread #3 - Aug 15, 2009 at 3:58 AM
  6. GPTman
    Joined:
    Aug 10, 2009
    Posts:
    2
    Referrals:
    0
    Sythe Gold:
    0

    GPTman Newcomer

    Help (Run when page loads)Javascript

    Would this rewrite it or something? what do i do after i bookmark it the second time?

    And how would this help in anyway? It doesnt seem to change any lines at all.

    Sorry im just a real newbie at this

    I also heard that i can use a function called "Window.Onload"

    But i dont know where and how to put it in the lines to make this run properly
     
  7. Unread #4 - Aug 15, 2009 at 6:10 PM
  8. Deacon Frost
    Joined:
    Jan 30, 2007
    Posts:
    2,905
    Referrals:
    3
    Sythe Gold:
    57

    Deacon Frost Grand Master
    Banned

    Help (Run when page loads)Javascript

    The only way I've heard of javascript working on other websites is by running it while on that website, generally by putting it in the address bar and pressing enter, or bookmarking it and using it (like in a lot of facebook apps).

    So I wouldn't know what functions you could use, I figured grease monkey had configuration options to set when it runs?
     
< Looking for website Partners | need help (coder needed) >

Users viewing this thread
1 guest


 
 
Adblock breaks this site