maybe you should pass the link argument into the original method.

this.previous(link);


On Thu, Jun 30, 2011 at 11:03 PM, 3dolab <[email protected]> wrote:

> Hello, I've just discovered the powerful refactor method and I'm
> already stuck!
>
> I'm trying to implement the "Multibox plugin" in order to make it
> handle AJAX requests in WordPress through the recommended admin-
> ajax.php gateway.
>
> Basically, I first need to add another property (namely 'wpajax') to
> the 'setContentType' options retrieved from the link rel attribute.
> https://github.com/samuelbirch/MultiBox/blob/master/Source/MultiBox.js#L133
> but my attempt with:
>
> MultiBox = Class.refactor(MultiBox, {
>    setContentType: function(link){
>        this.previous(); //energy++!
>        if(contentOptions.wpajax){
>                this.type = 'wpajax';
>        }
>    }
> });
>
> throws out a "link is undefined" error.
> Any suggestion?
>
> Later I should do the same with 'showContent'
> https://github.com/samuelbirch/MultiBox/blob/master/Source/MultiBox.js#L492
> but there I guess that implement is the only option, since I have to
> inject into the middle and no previous reference seems affordable.
>
> I could definitely rewrite everything with implement, or even edit the
> core file (It's been over a year since the last update), but I'd like
> to learn about this matter...

Reply via email to