BassMan schrieb:
> Michael,
> 
> I put a post in earlier today about the Ajax.Dataset.  I found that the
> Ajax.Web.Dataset does not work when I'm using prototype.js in my pages.
>  I would love to be able to work with both Ajax.NET and prototype.js.
> on the same page.  Do you have any suggestions or have you had any
> experience with this prototype?

You can use the prototype.js and remove the redifinitions from the 
build-in AjaxPro.prototype.js. And then replace the AjaxPro built-in 
prototype in the web.config with the modified one.

I made this two days before, some quick tests shows that it works 
(prototype.js 1.4.0), but may need further antention.

// JavaScript prototype extensions for AjaxPro

Object.extend = function(dest, source) {
        for(prop in source) {
                dest[prop] = source[prop];
        }
        return dest;
}

Object.extend(Function.prototype, {
        getArguments: function() {
                var args = [];
                for(var i=0; i<this.arguments.length; i++)
                        args.push(this.arguments[i]);
                return args;
        },
        bindToEvent: function(ele, evt, obj, useCapture) {
                if(useCapture == "undefined") useCapture = false;
                if(ele.attachEvent) {
                        ele.attachEvent("on" + evt, 
this.bindAsEventListener(obj));
                }else if(ele.addEventListener) {
                        ele.addEventListener(evt, 
this.bindAsEventListener(obj), useCapture);
                }
        },
        removeFromEvent: function(ele, evt, obj, useCapture) {
                if(useCapture == "undefined") useCapture = false;
                if(ele.detachEvent) {
                        ele.detachEvent("on" + evt, 
this.bindAsEventListener(obj));
                }else if(ele.removeEventListener) {
                        ele.removeEventListener(evt, 
this.bindAsEventListener(obj), useCapture);
                }
        }
}, false);

Function.isFunction = function(f) {
        if(f != null && typeof f == "function")
                return true;
        return false;
}

Object.extend(String.prototype, {
        endsWith: function(s) {
                return (this.substr(this.length - s.length) == s);
        },
        startsWith: function(s) {
                return (this.substr(0, s.length) == s);
        },
        trimLeft: function() {
                return this.replace(/^\s*/,"");
        },
        trimRight: function() {
                return this.replace(/\s*$/,"");
        },
        trim: function() {
                return this.trimRight().trimLeft();
        }
}, false);

String.format = function(s) {
        for(var i=1; i<arguments.length; i++) {
                s = s.replace("{" + (i -1) + "}", arguments[i]);
        }
        return s;
}

String.isNullOrEmpty = function(s) {
        if(s == null || s.length == 0)
                return true;
        return false;
}

Object.extend(Array.prototype, {
        push: function(o) {
                this[this.length] = o;
        }
}, false);

// JavaScript namespaces

if(!window.addNamespace) {
        window.addNamespace = function(ns) {
                var nsParts = ns.split(".");
                var root = window;

                for(var i=0; i<nsParts.length; i++) {
                        if(typeof root[nsParts[i]] == "undefined")
                                root[nsParts[i]] = {};
                        root = root[nsParts[i]];
                }
        }
}

// Browser related properties

addNamespace("MS.Browser");
MS.Browser.isIE = 
(window.navigator.appName.toLowerCase().indexOf('explorer') != -1 || 
window.navigator.appName.toLowerCase().indexOf('msie') != -1 );
if(window.navigator.userAgent.toLowerCase().indexOf('opera') != -1) 
MS.Browser.isIE = false;

// Debugging

addNamespace("MS.Debug");
MS.Debug.enabled = false;
MS.Debug.trace = function(s){}

var Class = {
        create: function() {
                return function() {
                        if(typeof this.initialize == "function")
                                this.initialize.apply(this, arguments);
                }
        }
}

addNamespace("MS.Position");
MS.Position = {
        getLocation: function(ele) {
                var offsetX = 0;
                var offsetY = 0;
                var parent;

                for(parent=ele; parent; parent=parent.offsetParent) {
                        if(parent.offsetLeft)
                                offsetX += parent.offsetLeft;
                        if(parent.offsetTop)
                                offsetY += parent.offsetTop;
                }

                return {left:offsetX,top:offsetY};
        },
        getBounds: function(ele) {
                var offset = MS.Position.getLocation(ele);
                var width = ele.offsetWidth;
                var height = ele.offsetHeight;

                return {left:offset.left, top:offset.top, width:width, 
height:height};
        }
};

function addEvent(o, evType, f, capture) {
        if(o.addEventListener) {
                o.addEventListener(evType, f, capture);
                return true;
        } else if (o.attachEvent) {
                var r = o.attachEvent("on" + evType, f);
                return r;
        } else {
                // alert("Handler could not be attached");
        }
}

function removeEvent(o, evType, f, capture) {
        if(o.removeEventListener) {
                o.removeEventListener(evType, f, capture);
                return true;
        } else if (o.detachEvent) {
                o.detachEvent("on" + evType, f);
        } else {
                // alert("Handler could not be removed");
        }
}





-- 
Freundliche Grüße

Albert Weinert

http://der-albert.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at 
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---

Reply via email to