hello critic :p
remember that it must run fast - he expects to be redirected nearly asap.
how about this code then?
// @run-at document-start
(function f(){
var e=document.getElementById('
quantity_1');
if(e!==null)
{
e.value="25.0";return;
}
if(document.readyState=='
complete'){return;}
setTimeout(f,200);
})();
On Friday, 20 July 2012 22:40:57 UTC+2, blm wrote:
>
> So if the page changes in the future to not have a quantity_1 element,
> greasemonkey will run f every 5 milliseconds... forever. Yeah, f is small
> and quick, but even small and quick at 200 times per second, doing
> something that will never succeed, seems bad.
>
> Brian
>
> On 7/20/12 11:54 AM, Hans Henrik Bergan wrote:
>
> // @run-at document-start
>
> function f(){
> try{
> document.getElementById('quantity_1').value="25.00";
> }catch(e){setTimeout(f,5);}
> }
> f();
>
>
> will use some cpu (until it has done it's task), and its quite hackish,
> but i guess i think it should work
> On Friday, 13 July 2012 00:15:15 UTC+2, Console wrote:
>>
>> I want to immediately change this javascript value on the fly before it
>> redirects me to the page with grease monkey. I am a novice on grease monkey
>> and spent quiet of a few hours reading and experimenting with no luck, if
>> anyone can give me a helping hand on this I would appreciate it. This is
>> the code I want to replace:
>>
>> " <input id="quantity_1" name="quantity_1" type="hidden" value="20.00"
>> /> "
>>
>> to
>>
>> " " <input id="quantity_1" name="quantity_1" type="hidden" value="25.00"
>> /> "
>> If any more info is needed let me know, thank you in advance.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "greasemonkey-users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/greasemonkey-users/-/6tZm8EInLGcJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/greasemonkey-users?hl=en.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/greasemonkey-users/-/5zOH0RsW5_oJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/greasemonkey-users?hl=en.