I use a file that extends and overwrites some prototype methods.
URL: http://aka-fotos.de/research/prototype/js/extendedPrototype0.2.js

Some examples - the following ones extend Element.methods

*
visible: function(element) {
  return Element.getStyle(element, 'display') != 'none';
}
For me it's better because, if an element is visible, is not
exclusively defined by style attributes.


*
setOpacity: function(element, opacity) {
        var el = $(element);

        try {el.style.opacity = opacity;} catch(e) {}
        try {el.style.MozOpacity = opacity;} catch(e) {}
        try {el.style.filter = 'alpha(opacity='+Math.round(opacity *
100)+')';} catch(e) {}
        try {el.style.KhtmlOpacity = opacity;} catch(e) {}
}
Useful to set cross-browser opacity, but how I see it seems to be
implemented in prototype 1.5 stable.


* And some extensions for show and hide, for me it's a more complex
thing:
hide: function(element) {
        if (Element.visible(element)) {
                element = $(element);
                element._display = element.style.display;
                element.style.display = 'none';
        }
},
show: function(element) {
        if (!Element.visible(element)) {
                element = $(element);
                element.style.display =
                        typeof element._display == 'undefined' ?
                                (element.style.display ?
                                        '' :
                                        Element.getDisplayType(element)) :
                                element._display;
        }
},
getDisplayType: function(element) {
        return ['BLOCKQUOTE', 'DIV', 'FORM', 'P', 'TABLE']
                .include(element.nodeName) ? 'block' : 'inline';
},
I think it's important because the display defines whether I have a
block or an inline element. And I want to save the original display, if
it was defined by style and not by stylesheet.

Prototype is very inspiring and useful for my daily work. Thank for
this library, it's the best I can find.

Andi


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to