So what I'm trying to do is 2 fold but I think I have one of the folds
figured out.

Fold 1: Scrape the screen in real time and when the words "Click Now"
appear...
Fold 2: Click the Play! button on the screen after a random amount of
time between 0 and 15 minutes.
-----------------------
Fold 1 Code only works on refresh.  So if I refresh my browser and the
screen already says "Click now" it will highlight the text and pop the
message.  If I let the count down timer reach 0:00 and it changes to
"Click now" then it just sits there.
-----------------------
function click()
{
        if (window.find("Click now"))
                {
                        var random = Math.floor(Math.random()*15)
                        var timer = random * 60000
                        alert('Found text.  Waiting ' + timer/60000 + ' 
minutes')
                }

}

click();

-----------------------
Fold 2 Code is taken from the source of the webpage. This script has
the button that I'm trying to get my script to "press".
-----------------------
<script>
    (function() {
        var button = {
            init: function() {
                $('#button').empty();

                //Timer display
                button.timer = $('<span style="font-size: 1.2em;"></
span>');
                button.timer.appendTo($('#button'));

                //Form
                form = $('<form method="post" action="/guild"></
form>');
                form.appendTo($('#button'));

                //csrf token
                $('<input id="csrf_token" name="csrf_token"
type="hidden" value="2c1967a8-2074-4039-bb77-12e775965603" /
>').appendTo(form);

                //Click button
                button.click = $('<input type="submit" name="play"
value="Play!" class="play" />');
                button.click.appendTo(form);

                button.seconds = 257.0;
                button.timer.html('<b>' + Math.floor(button.seconds /
60) + '</b> minutes, <b>' + button.seconds % 60 + '</b> seconds
left.');

                button.countdown();

                button.interval = setInterval(button.countdown, 1000);
            },
            countdown: function() {
                button.seconds -= 1;

                if (button.seconds <= -1) {
                    button.seconds += 1;
                    button.timer.html('You can click <u>now</u>!');
                    clearInterval(button.interval);
                }
                if (button.seconds <= 0) {
                    button.timer.html('You can click <u>now</u>!');
                    clearInterval(button.interval);
                } else {
                    button.timer.html('<b>' +
Math.floor(button.seconds / 60) + '</b> minutes, <b>' + button.seconds
% 60 + '</b> seconds left.');
                }
            }
        }

        button.init();
    })();
</script>



Is this possible to even accomplish?  I can't quite figure it out.

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
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.

Reply via email to