[tpm] [OT] Javascript to watch for certain KW from a web page

Antonio Sun antoniosun at lavabit.com
Fri Oct 12 06:45:56 PDT 2012


Thanks Shaun.

Yes I did use jQuery eventually. As I have zero knowledge of Javascript, I
started easy with Mark's code on a static page, once successful, I moved on
to jQuery.

Thanks for your recommendation. jQuery is really powerful and well
commented.
I was able to get my job done with only the knowledge from the following
two tutorials:

The load() method
http://www.jquery-tutorial.net/ajax/the-load-method/

Showing progress
http://www.jquery-tutorial.net/ajax/showing-progress/

Thanks

On Fri, Oct 12, 2012 at 4:38 AM, Shaun Fryer <sfryer at sourcery.ca> wrote:

> The reason jquery is a good idea, is you probably want to add it as an
> onclick to a button or something. It's worth it to take the 10 minutes
> to rtfm, and avoid yourself alot of headache with cross-browser
> events.
> --
> Shaun Fryer
> 647-709-6509
> ----------------------------------------------------------
> perl -e 'print chr for map{$_+=22}($ARGV[0])=~/(\d\d)/g' \
>         52959394107588899482799210587992861082757785799222
> ----------------------------------------------------------
>
>
> On Fri, Oct 12, 2012 at 4:31 AM, Shaun Fryer <sfryer at sourcery.ca> wrote:
> > Or for yet another way, also sans jquery...
> >
> > var iframe = document.createElement("iframe");
> > var o = {display:"none", height:0, width:0};
> > for (var attr in o) iframe.style[attr] = o[attr]; // append a
> > timestamp below to bypass cache
> > var getServerStatus = function () { iframe.src =
> > "/url/to/your/log/output?" + (new Date ()).getTime() };
> > iframe.onload = function() {
> >
> >   var win = iframe.contentWindow || iframe.contentDocument;
> >   if (/your regexp/.test(win.document.body.innerHTML))
> >     alert("your process completed");
> >   else setTimeout( getServerStatus, 60*1000 ); // ~1 minute
> >
> > };
> > getServerStatus();
> > document.body.appendChild(iframe);
> > --
> > Shaun Fryer
> > 647-709-6509
> > ----------------------------------------------------------
> > perl -e 'print chr for map{$_+=22}($ARGV[0])=~/(\d\d)/g' \
> >         52959394107588899482799210587992861082757785799222
> > ----------------------------------------------------------
> >
> >
> > On Thu, Oct 11, 2012 at 11:05 AM, Antonio Sun <antoniosun at lavabit.com>
> wrote:
> >> Thanks a lot Mark,
> >> That works like a charm. I really appreciate your simplified solution
> sample
> >> code.
> >>
> >> Thanks again everyone for your helps.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20121012/13cc8885/attachment-0001.html>


More information about the toronto-pm mailing list