How can I add my own #replacingAnchor brush with customized "window.open(...)" code?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I add my own #replacingAnchor brush with customized "window.open(...)" code?

Sophie424
Dear incredibly helpful list ...

I would like a customzed anchor brush so the following:
    html replacingAnchor
        callback: [self foo];
        with: 'replaceMe'
generates the customized <a> below to replaces the current page in the
history (to disable back button). The only change is a 4th TRUE parameter in
the window.open(...):

<a onclick="window.open(this.href,'_self','',true);return false"
href="..._s=...&_k=...">replaceMe</a>

How do I do this? Can I get this effect using some options to the existing
#anchor, or do I need a new brush?

Thanks - Sophie

I am using window.open() as described at
http://www.w3schools.com/htmldom/met_win_open.asp.



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How can I add my own #replacingAnchor brush with customized "window.open(...)" code?

Lukas Renggli
> How do I do this? Can I get this effect using some options to the existing
> #anchor, or do I need a new brush?

As usual there are many way.

I suggest that you add a class extension to WAAnchorBrush:

    WAAnchorBrush>>superFancyOpen
        self onClick: 'window.open(this.href,'_self','',true);return false'

And then whenever you want to use it you just write:

    html anchor
        superFancyOpen;
        callback: [ self foo ];
        with: 'replace me'


--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside