From 1dbdf43658874e1326da41817b1e36a5248ca642 Mon Sep 17 00:00:00 2001 From: John Resig Date: Sun, 13 Aug 2006 14:52:14 +0000 Subject: [PATCH] Moved plugins to the new plugin directory. --- plugins/compat/compat.js | 41 ++++++++++++++++++++++++++++++++++++++++ {form => plugins/form}/form.js | 0 2 files changed, 41 insertions(+) create mode 100644 plugins/compat/compat.js rename {form => plugins/form}/form.js (100%) diff --git a/plugins/compat/compat.js b/plugins/compat/compat.js new file mode 100644 index 0000000..390c0e6 --- /dev/null +++ b/plugins/compat/compat.js @@ -0,0 +1,41 @@ + // Since we're using Prototype's $ function, + // be nice and have backwards compatability + if ( typeof Prototype != "undefined" ) { + if ( $a.constructor == String ) { + var re = new RegExp( "[^a-zA-Z0-9_-]" ); + if ( !re.test($a) ) { + $c = $c && $c.documentElement || document; + if ( $c.getElementsByTagName($a).length === 0 ) { + var obj = $c.getElementById($a); + if ( obj ) { return obj; } + } + } + } else if ( $a.constructor == Array ) { + return $.map( $a, function(b){ + if ( b.constructor == String ) { + return document.getElementById(b); + } + return b; + }); + } + } + +// TODO: Remove need to return this + for ( var i in $.fn ) { + if ( self[i] !== null ) + self["_"+i] = self[i]; + self[i] = $.fn[i]; + } + + if ( typeof Prototype != "undefined" && $a.constructor != String ) { + if ( $c ) $a = self.get(); + for ( var k in self ) {(function(j){ + try { + if ( !$a[j] ) + $a[j] = function() { + return $.apply(self,self[j],arguments); + }; + } catch(e) {} + })(k);} + return $a; + } diff --git a/form/form.js b/plugins/form/form.js similarity index 100% rename from form/form.js rename to plugins/form/form.js -- 1.7.10.4