I have proposed to implement an adapter for Pixastic (http://
www.pixastic.com),
and tried in two ways. I was seeking you to know the best way and if I
made an error:

1) Prototype

Element.addMethods({
        pixastic: function(element, action, options) {
        element = $(element);

                if (this.tagName == "IMG" && !this.complete) {
                        return;
                }
            Pixastic.process(element, action, options);

    return element;

  }
});

// $(elem).pixastic("desaturate");
// Element.pixastic(elem, "desaturate");

2) Prototype + Scriptaculous effects

Effect.pixastic = Class.create(Effect.Base, {

        initialize: function(element, action, options) {
        this.element = $(element);

                if (this.element.tagName == "IMG") {
                        return;
                }
            Pixastic.process(this.element, action, options);
        return this.element;

        }

});

// new Effect.pixastic(elem, "desaturate");




In fact the author of Pixastic has wrote an adapter for jQuery (you
can compare?):

if (typeof jQuery != "undefined" && jQuery && jQuery.fn) {
        jQuery.fn.pixastic = function(action, options) {
                var newElements = [];
                this.each(
                        function () {
                                if (this.tagName == "IMG" && !this.complete) {
                                        return;
                                }
                                var res = Pixastic.process(this, action, 
options);
                                if (res) {
                                        newElements.push(res);
                                }
                        }
                );
                if (newElements.length > 0)
                        return jQuery(newElements);
                else
                        return this;
        };

};
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to