- // Load Dynamic Function List
- var self = {
- cur: $.Select($a,$c),
- $jquery: "$Rev$",
-
- // The only two getters
- size: function() {return this.get().length;},
- get: function(i) {
- return typeof i == 'undefined' ? this.cur : this.cur[i];
- },
-
- each: function(f) {
- for ( var i = 0; i < this.size(); i++ ) {
- $.apply( this.get(i), f, [i] );
- }
- return this;
- },
- set: function(a,b) {
- return this.each(function(){
- if ( typeof b == 'undefined' ) {
- for ( var j in a ) {
- $.attr(this,j,a[j]);
- }
- } else {
- $.attr(this,a,b);
- }
- });
- },
- html: function(h) {
- return typeof h == 'undefined' && this.size() ?
- this.get(0).innerHTML : this.set( "innerHTML", h );
- },
- val: function(h) {
- return typeof h == 'undefined' && this.size() ?
- this.get(0).value : this.set( "value", h );
- },
-
- css: function(a,b) {
- return a.constructor != String || b ?
- this.each(function(){
- if ( !b ) {
- for ( var j in a ) {
- $.attr(this.style,j,a[j]);
- }
- } else {
- $.attr(this.style,a,b);
- }
- }) : $.css( this.get(0), a );
- },
- toggle: function() {
- return this.each(function(){
- var d = $.getCSS(this,"display");
- if ( d == "none" || d === '' ) {
- $(this).show();
- } else {
- $(this).hide();
- }
- });
- },
- show: function(a) {
- return this.each(function(){
- this.style.display = this.$$oldblock ? this.$$oldblock : '';
- if ( $.getCSS(this,"display") == "none" ) {
- this.style.display = 'block';
- }
- });
- },
- hide: function(a) {
- return this.each(function(){
- this.$$oldblock = $.getCSS(this,"display");
- if ( this.$$oldblock == "none" ) {
- this.$$oldblock = 'block';
- }
- this.style.display = 'none';
- });
- },
- addClass: function(c) {
- return this.each(function(){
- if ($.hasWord(this,c)) {
- return null;
- }
- this.className += ( this.className.length > 0 ? " " : "" ) + c;
- });
- },
- removeClass: function(c) {
- return this.each(function(){
- this.className = !c ? '' :
- this.className.replace(
- new RegExp('(^|\\s*\\b[^-])'+c+'($|\\b(?=[^-]))', 'g'), '');
- });
- },
- // TODO: Optomize
- toggleClass: function(c) {
- return this.each(function(){
- if ($.hasWord(this,c)) {
- this.className =
- this.className.replace(
- new RegExp('(\\s*\\b[^-])'+c+'($|\\b(?=[^-]))', 'g'), '');
- } else {
- this.className += ( this.className.length > 0 ? " " : "" ) + c;
- }
- });
- },
- remove: function() {
- this.each(function(){this.parentNode.removeChild( this );});
- this.cur = [];
- return this;
- },
-
- wrap: function() {
- var a = $.clean(arguments);
- return this.each(function(){
- var b = a[0].cloneNode(true);
- this.parentNode.insertBefore( b, this );
- while ( b.firstChild ) {
- b = b.firstChild;
- }
- b.appendChild( this );
- });
- },
-
- append: function() {
- var clone = this.size() > 1;
- var a = $.clean(arguments);
- return this.each(function(){
- for ( var i = 0; i < a.length; i++ ) {
- this.appendChild( clone ? a[i].cloneNode(true) : a[i] );
- }
- });
- },
-
- appendTo: function() {
- var a = arguments;
- return this.each(function(){
- for ( var i = 0; i < a.length; i++ ) {
- $(a[i]).append( this );
- }
- });
- },
-
- prepend: function() {
- var clone = this.size() > 1;
- var a = $.clean(arguments);
- return this.each(function(){
- for ( var i = a.length - 1; i >= 0; i-- ) {
- this.insertBefore( clone ? a[i].cloneNode(true) : a[i], this.firstChild );
- }
- });
- },
-
- before: function() {
- var clone = this.size() > 1;
- var a = $.clean(arguments);
- return this.each(function(){
- for ( var i = 0; i < a.length; i++ ) {
- this.parentNode.insertBefore( clone ? a[i].cloneNode(true) : a[i], this );
- }
- });
- },
-
- after: function() {
- var clone = this.size() > 1;
- var a = $.clean(arguments);
- return this.each(function(){
- for ( var i = a.length - 1; i >= 0; i-- ) {
- this.parentNode.insertBefore( clone ? a[i].cloneNode(true) : a[i], this.nextSibling );
- }
- });
- },
+/**
+ * Create a new jQuery Object
+ * @constructor
+ */
+function jQuery(a,c) {
+
+ // Shortcut for document ready (because $(document).each() is silly)
+ if ( a && a.constructor == Function )
+ return $(document).ready(a);
+
+ // Make sure t hat a selection was provided
+ a = a || jQuery.context || document;
+
+ /*
+ * Handle support for overriding other $() functions. Way too many libraries
+ * provide this function to simply ignore it and overwrite it.
+ */
+
+ // Check to see if this is a possible collision case
+ if ( jQuery._$ && !c && a.constructor == String &&
+
+ // Make sure that the expression is a colliding one
+ !/[^a-zA-Z0-9_-]/.test(a) &&
+
+ // and that there are no elements that match it
+ // (this is the one truly ambiguous case)
+ !document.getElementsByTagName(a).length )
+
+ // Use the default method, in case it works some voodoo
+ return jQuery._$( a );
+
+ // Watch for when a jQuery object is passed as the selector
+ if ( a.jquery )
+ return a;
+
+ // Watch for when a jQuery object is passed at the context
+ if ( c && c.jquery )
+ return $(c.get()).find(a);
+
+ // If the context is global, return a new object
+ if ( window == this )
+ return new jQuery(a,c);