Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
88  ajax/ajax.js
... ...
@@ -0,0 +1,88 @@
  1
+// AJAX Plugin
  2
+// Docs Here:
  3
+// http://jquery.com/docs/ajax/
  4
+
  5
+if ( typeof XMLHttpRequest == 'undefined' && typeof window.ActiveXObject == 'function') {
  6
+  var XMLHttpRequest = function() {
  7
+    return new ActiveXObject((navigator.userAgent.toLowerCase().indexOf('msie 5') >= 0) ? 
  8
+      "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP");
  9
+  };
  10
+}
  11
+
  12
+$.xml = function( type, url, data, ret ) {
  13
+  var xml = new XMLHttpRequest();
  14
+
  15
+  if ( xml ) {
  16
+    xml.open(type || "GET", url, true);
  17
+
  18
+    if ( data )
  19
+      xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  20
+
  21
+    if ( ret )
  22
+      xml.onreadystatechange = function() {
  23
+        if ( xml.readyState == 4 ) ret(xml);
  24
+      };
  25
+
  26
+    xml.send(data)
  27
+  }
  28
+};
  29
+
  30
+$.httpData = function(r,type) {
  31
+  return r.getResponseHeader("content-type").indexOf("xml") > 0 || type == "xml" ?
  32
+    r.responseXML : r.responseText;
  33
+};
  34
+
  35
+$.get = function( url, ret, type ) {
  36
+  $.xml( "GET", url, null, function(r) {
  37
+    if ( ret ) ret( $.httpData(r,type) );
  38
+  });
  39
+};
  40
+
  41
+$.getXML = function( url, ret ) {
  42
+  $.get( url, ret, "xml" );
  43
+};
  44
+
  45
+$.post = function( url, data, ret, type ) {
  46
+  $.xml( "POST", url, $.param(data), function(r) {
  47
+    if ( ret ) ret( $.httpData(r,type) );
  48
+  });
  49
+};
  50
+
  51
+$.postXML = function( url, data, ret ) {
  52
+  $.post( url, data, ret, "xml" );
  53
+};
  54
+
  55
+$.param = function(a) {
  56
+  var s = [];
  57
+  for ( var i in a )
  58
+    s[s.length] = i + "=" + encodeURIComponent( a[i] );
  59
+  return s.join("&");
  60
+};
  61
+
  62
+$.fn.load = function(a,o,f) {
  63
+  // Arrrrghhhhhhhh!!
  64
+  // I overwrote the event plugin's .load
  65
+  // this won't happen again, I hope -John
  66
+  if ( a && a.constructor == Function )
  67
+    return this.bind("load", a);
  68
+
  69
+  var t = "GET";
  70
+  if ( o && o.constructor == Function ) {
  71
+    f = o; o = null;
  72
+  }
  73
+  if (o != null) {
  74
+    o = $.param(o);
  75
+    t = "POST";
  76
+  }
  77
+  var self = this;
  78
+  $.xml(t,a,o,function(h){
  79
+  var h = h.responseText;
  80
+    self.html(h).find("script").each(function(){
  81
+      try {
  82
+        eval( this.text || this.textContent || this.innerHTML );
  83
+      } catch(e){}
  84
+    });
  85
+    if(f)f(h);
  86
+  });
  87
+  return this;
  88
+};
5  browse/.htaccess
... ...
@@ -0,0 +1,5 @@
  1
+RewriteEngine On
  2
+RewriteRule ^$ /docs/SourceCode/ [L,QSA]
  3
+RewriteRule ^([^/]+).js$ browse-new.cgi?v=$1 [L,QSA]
  4
+RewriteRule ^([^/]+)/$ browse-new.cgi?v=$1 [L,QSA]
  5
+RewriteRule ^([^/]+)/([a-z0-9-]+)/?$ browse-new.cgi?v=$1&custom=$2 [L,QSA]
467  browse/Pack.pm
... ...
@@ -0,0 +1,467 @@
  1
+#Pack (July 2005)
  2
+#  Based on "Pack.js" by Dean Edwards <http://dean.edwards.name/>
  3
+#  Ported to Perl by Rob Seiler, ELR Software Pty Ltd <http://www.elr.com.au>
  4
+#  Copyright 2005. License <http://creativecommons.org/licenses/LGPL/2.1/>
  5
+
  6
+package Pack;
  7
+use strict;
  8
+use Data::Dumper;
  9
+
  10
+use ParseMaster;
  11
+
  12
+# Package wide variable declarations
  13
+use vars qw/$VERSION $PM_VERSION
  14
+            $_X_encodePrivate $_JSunpack $_JSdecode %baseLookup
  15
+            $_X_encode10 $_X_encode36 $_X_encode62 $_X_encode95
  16
+            $_JSencode10 $_JSencode36 $_JSencode62 $_JSencode95
  17
+            @_X_parsers
  18
+            $_X_script $_X_encoding $_X_fastDecode $_X_specialChars
  19
+           /;
  20
+$VERSION    = '024';
  21
+$PM_VERSION = $ParseMaster::VERSION;
  22
+
  23
+# Package wide constants
  24
+my $X_IGNORE  = q{$1};
  25
+my $X_ENCODE  = q/\x24encode\(\x24count\)/;  # NB: requires g modifier
  26
+my $PERL      = 'perl';     # Flag to indicate whether we need to use one of our "internal" Perl encoding functions
  27
+my $JSCRIPT   = 'jscript';  # or embed a pre-build JScript encoding function
  28
+########################################
  29
+
  30
+##################
  31
+sub pack($$$$) { # require 4 arguments
  32
+##################
  33
+#print Dumper(@_);
  34
+  ($_X_script, $_X_encoding, $_X_fastDecode, $_X_specialChars) = @_;
  35
+  # validate parameters (sort of!)
  36
+  $_X_script  .= "\n";
  37
+  $_X_encoding = ($_X_encoding > 95) ? 95 : $_X_encoding;
  38
+
  39
+  @_X_parsers = (); # Reset parsers
  40
+
  41
+####################
  42
+  sub _X_pack($) { # require 1 argument
  43
+####################
  44
+  # apply all parsing routines
  45
+    my $X_script = shift;
  46
+    for (my $i = 0; $i<scalar(@_X_parsers); $i++) {
  47
+      my $X_parse = $_X_parsers[$i];
  48
+       $X_script = &$X_parse($X_script);
  49
+    }
  50
+    return $X_script;
  51
+  };
  52
+
  53
+######################
  54
+  sub _X_addParser { #
  55
+######################
  56
+  # keep a list of parsing functions, they'll be executed all at once
  57
+    my $X_parser = shift;
  58
+    push (@_X_parsers,$X_parser);
  59
+  }
  60
+
  61
+#############################
  62
+  sub _X_basicCompression { #
  63
+#############################
  64
+    # zero encoding - just removal of white space and comments
  65
+    my $X_script = shift;
  66
+    my $parser = ParseMaster->new();
  67
+    # make safe
  68
+    $parser->escapeChar("\\");
  69
+    # protect strings
  70
+    $parser->add(q/'[^'\n\r]*'/, $X_IGNORE);
  71
+    $parser->add(q/"[^"\n\r]*"/, $X_IGNORE);
  72
+    # remove comments
  73
+    $parser->add(q/\/\/[^\n\r]*[\n\r]/);
  74
+    $parser->add(q/\/\*[^*]*\*+([^\/][^*]*\*+)*\//);
  75
+    # protect regular expressions
  76
+    $parser->add(q/\s+(\/[^\/\n\r\*][^\/\n\r]*\/g?i?)/, q{$2}); # IGNORE
  77
+    $parser->add(q/[^\w\x24\/'"*)\?:]\/[^\/\n\r\*][^\/\n\r]*\/g?i?/, $X_IGNORE);
  78
+    # remove: ;;; doSomething();
  79
+    $parser->add(q/;;[^\n\r]+[\n\r]/) if ($_X_specialChars);
  80
+    # remove redundant semi-colons
  81
+    $parser->add(q/;+\s*([};])/, q{$2});
  82
+    # remove white-space
  83
+    $parser->add(q/(\b|\x24)\s+(\b|\x24)/, q{$2 $3});
  84
+    $parser->add(q/([+\-])\s+([+\-])/, q{$2 $3});
  85
+    $parser->add(q/\s+/, '');
  86
+    # done
  87
+    return $parser->exec($X_script);
  88
+  }
  89
+
  90
+###############################
  91
+  sub _X_encodeSpecialChars { #
  92
+###############################
  93
+    my $X_script = shift;
  94
+    my $parser = ParseMaster->new();
  95
+    # replace: $name -> n, $$name -> $$na
  96
+    $parser->add(q/((\x24+)([a-zA-Z\x24_]+))(\d*)/,
  97
+      sub {
  98
+        my $X_offset   = pop;
  99
+        my @X_match    = @_;
  100
+        my $X_length   = length($X_match[$X_offset+2]);
  101
+        my $lengthnext = length($X_match[$X_offset+3]);
  102
+        my $X_start = $X_length - ((($X_length - $lengthnext) > 0) ? ($X_length - $lengthnext) : 0);
  103
+        my $str = $X_match[$X_offset+1];
  104
+        $str = substr($str,$X_start,$X_length) . $X_match[$X_offset+4];
  105
+        return "$str";
  106
+      });
  107
+     # replace: _name -> _0, double-underscore (__name) is ignored
  108
+     my $X_regexp = q/\b_[A-Za-z\d]\w*/;
  109
+     # build the word list
  110
+     my %X_keywords = &_X_analyze($X_script, $X_regexp, $_X_encodePrivate);
  111
+#print Dumper(%X_keywords);
  112
+     # quick ref
  113
+     my $X_encoded = \$X_keywords{X_encoded}; # eg _private1 => '_0',_private2 => '_1';
  114
+#print Dumper($X_encoded);
  115
+     $parser->add($X_regexp, sub {my $X_offset = pop; my @X_match = @_; return ${$X_encoded}->{$X_match[$X_offset]};});
  116
+
  117
+     return $parser->exec($X_script);
  118
+  };
  119
+
  120
+###########################
  121
+  sub _X_encodeKeywords { #
  122
+###########################
  123
+    my $X_script = shift;
  124
+    # escape high-ascii values already in the script (i.e. in strings)
  125
+    if ($_X_encoding > 62) {$X_script = &_X_escape95($X_script)};
  126
+    # create the parser
  127
+    my $parser = ParseMaster->new();
  128
+    my $X_encode = &_X_getEncoder($_X_encoding,$PERL);
  129
+    # for high-ascii, don't encode single character low-ascii
  130
+    my $X_regexp = ($_X_encoding > 62) ? q/\w\w+/ : q/\w+/;
  131
+    # build the word list
  132
+    my %X_keywords = &_X_analyze($X_script, $X_regexp, $X_encode);
  133
+#print Dumper(%X_keywords);
  134
+    my $X_encoded = \$X_keywords{X_encoded}; # eg alert => 2, function => 10 etc
  135
+    # encode
  136
+    $parser->add($X_regexp, sub {my $X_offset = pop; my @X_match = @_; return ${$X_encoded}->{$X_match[$X_offset]};});
  137
+    # if encoded, wrap the script in a decoding function
  138
+
  139
+    return $X_script && _X_bootStrap(\$parser->exec($X_script), \%X_keywords);
  140
+  }
  141
+
  142
+####################
  143
+  sub _X_analyze { #
  144
+####################
  145
+#print Dumper(@_);
  146
+    my ($X_script, $X_regexp, $X_encode) = @_;
  147
+    # analyse
  148
+    # retreive all words in the script
  149
+    my @X_all = $X_script =~ m/$X_regexp/g; # Save all captures in a list context
  150
+    my %XX_sorted    = ();  # list of words sorted by frequency
  151
+    my %XX_encoded   = ();  # dictionary of word->encoding
  152
+    my %XX_protected = ();  # instances of "protected" words
  153
+    if (@X_all) {
  154
+      my @X_unsorted  = (); # same list, not sorted
  155
+      my %X_protected = (); # "protected" words (dictionary of word->"word")
  156
+      my %X_values    = (); # dictionary of charCode->encoding (eg. 256->ff)
  157
+      my %X_count     = (); # word->count
  158
+      my $i = scalar(@X_all); my $j = 0; my $X_word = '';
  159
+      # count the occurrences - used for sorting later
  160
+      do {
  161
+        $X_word = '$' . $X_all[--$i];
  162
+        if (!exists($X_count{$X_word})) {
  163
+          $X_count{$X_word}   = [0,$i]; # Store both the usage count and original array position (ie a secondary sort key)
  164
+          $X_unsorted[$j]   = $X_word;
  165
+          # make a dictionary of all of the protected words in this script
  166
+          #   these are words that might be mistaken for encoding
  167
+          $X_values{$j}     = &$X_encode($j);
  168
+          my $v           = '$'.$X_values{$j};
  169
+          $X_protected{$v}  = $j++;
  170
+        }
  171
+        # increment the word counter
  172
+        $X_count{$X_word}[0]++;
  173
+      } while ($i);
  174
+#print Dumper (%X_values);
  175
+#print Dumper (@X_unsorted);
  176
+#print Dumper (%X_protected);
  177
+      # prepare to sort the word list, first we must protect
  178
+      #  words that are also used as codes. we assign them a code
  179
+      #  equivalent to the word itself.
  180
+      # e.g. if "do" falls within our encoding range
  181
+      #       then we store keywords["do"] = "do";
  182
+      # this avoids problems when decoding
  183
+       $i = scalar(@X_unsorted);
  184
+      do {
  185
+        $X_word = $X_unsorted[--$i];
  186
+        if (exists($X_protected{$X_word})) {
  187
+          $XX_sorted{$X_protected{$X_word}} = substr($X_word,1);
  188
+          $XX_protected{$X_protected{$X_word}} = 1; # true
  189
+          $X_count{$X_word}[0] = 0;
  190
+        }
  191
+      } while ($i);
  192
+#print Dumper (%XX_protected);
  193
+#print Dumper (%XX_sorted);
  194
+#print Dumper (%X_count);
  195
+      # sort the words by frequency
  196
+      # Sort with count a primary key and original array order as secondary key - which is apparently the default in javascript!
  197
+      @X_unsorted = sort ({($X_count{$b}[0] - $X_count{$a}[0]) or ($X_count{$b}[1] <=> $X_count{$a}[1])} @X_unsorted);
  198
+#print Dumper (@X_unsorted) . "\n";
  199
+
  200
+      $j = 0;
  201
+      # because there are "protected" words in the list
  202
+      # we must add the sorted words around them
  203
+      do {
  204
+        if (!exists($XX_sorted{$i})) {$XX_sorted{$i} = substr($X_unsorted[$j++],1)}
  205
+        $XX_encoded{$XX_sorted{$i}} = $X_values{$i};
  206
+      } while (++$i < scalar(@X_unsorted));
  207
+    }
  208
+#print Dumper(X_sorted => \%XX_sorted, X_encoded => \%XX_encoded, X_protected => \%XX_protected);
  209
+    return (X_sorted => \%XX_sorted, X_encoded => \%XX_encoded, X_protected => \%XX_protected);
  210
+  }
  211
+
  212
+######################
  213
+  sub _X_bootStrap { #
  214
+######################
  215
+    # build the boot function used for loading and decoding
  216
+    my ($X_packed, $X_keywords) = @_; # Reference arguments!
  217
+#print Dumper ($X_keywords) . "\n";
  218
+
  219
+    # $packed: the packed script - dereference and escape
  220
+    $X_packed = "'" . &_X_escape($$X_packed) ."'";
  221
+
  222
+    my %sorted    = %{$$X_keywords{X_sorted}};    # Dereference to local variables
  223
+    my %protected = %{$$X_keywords{X_protected}}; # for simplicity
  224
+
  225
+    my @sorted    = ();
  226
+    foreach my $key (keys %sorted) {$sorted[$key] = $sorted{$key}}; # Convert hash to a standard list
  227
+
  228
+    # ascii: base for encoding
  229
+    my $X_ascii = ((scalar(@sorted) > $_X_encoding) ? $_X_encoding : scalar(@sorted)) || 1;
  230
+
  231
+    # count: number of (unique {RS}) words contained in the script
  232
+    my $X_count = scalar(@sorted); # Use $X_count for assigning $X_ascii
  233
+
  234
+    # keywords: list of words contained in the script
  235
+    foreach my $i (keys %protected) {$sorted[$i] = ''}; # Blank out protected words
  236
+#print Dumper(@sorted) . "\n";
  237
+
  238
+    # convert from a string to an array - prepare keywords as a JScript string->array {RS}
  239
+    $X_keywords = "'" . join('|',@sorted) . "'.split('|')";
  240
+
  241
+    # encode: encoding function (used for decoding the script)
  242
+    my $X_encode = $_X_encoding > 62 ? $_JSencode95 : &_X_getEncoder($X_ascii,$JSCRIPT); # This is a JScript function (as a string)
  243
+       $X_encode =~ s/_encoding/\x24ascii/g; $X_encode =~ s/arguments\.callee/\x24encode/g;
  244
+    my $X_inline = '$count' . ($X_ascii > 10 ? '.toString($ascii)' : '');
  245
+
  246
+    # decode: code snippet to speed up decoding
  247
+    my $X_decode = '';
  248
+    if ($_X_fastDecode) {
  249
+      # create the decoder
  250
+      $X_decode = &_X_getFunctionBody($_JSdecode); # ie from the Javascript literal function
  251
+      if ($_X_encoding > 62) {$X_decode =~ s/\\\\w/[\\xa1-\\xff]/g}
  252
+      # perform the encoding inline for lower ascii values
  253
+      elsif ($X_ascii < 36) {$X_decode =~ s/$X_ENCODE/$X_inline/g}
  254
+      # special case: when $X_count==0 there ar no keywords. i want to keep
  255
+      # the basic shape of the unpacking funcion so i'll frig the code...
  256
+      if (!$X_count) {$X_decode =~ s/(\x24count)\s*=\s*1/$1=0/}
  257
+    }
  258
+
  259
+    # boot function
  260
+    my $X_unpack = $_JSunpack;
  261
+    if ($_X_fastDecode) {
  262
+      # insert the decoder
  263
+      $X_unpack =~ s/\{/\{$X_decode;/;
  264
+    }
  265
+    $X_unpack =~ s/"/'/g;
  266
+    if ($_X_encoding > 62) { # high-ascii
  267
+      # get rid of the word-boundaries for regexp matches
  268
+      $X_unpack =~ s/'\\\\b'\s*\+|\+\s*'\\\\b'//g; # Not checked! {RS}
  269
+    }
  270
+    if ($X_ascii > 36 || $_X_encoding > 62 || $_X_fastDecode) {
  271
+    # insert the encode function
  272
+    $X_unpack =~ s/\{/\{\$encode=$X_encode;/;
  273
+    } else {
  274
+      # perform the encoding inline
  275
+      $X_unpack =~ s/$X_ENCODE/$X_inline/;
  276
+    }
  277
+
  278
+    # arguments   {RS} Do this before using &pack because &pack changes the pack parameters (eg $fastDecode) in Perl!!
  279
+    my $X_params = "$X_packed,$X_ascii,$X_count,$X_keywords"; # Interpolate to comma separated string
  280
+    if ($_X_fastDecode) {
  281
+      # insert placeholders for the decoder
  282
+      $X_params .= ',0,{}';
  283
+    }
  284
+
  285
+    # pack the boot function too
  286
+    $X_unpack = &pack($X_unpack,0,0,1);
  287
+
  288
+    # the whole thing
  289
+    return "eval(" . $X_unpack . "(" . $X_params . "))\n";
  290
+  };
  291
+
  292
+#######################
  293
+  sub _X_getEncoder { #
  294
+#######################
  295
+  # mmm.. ..which one do i need ?? ({RS} Perl or JScript ??)
  296
+    my ($X_ascii,$language) = @_;
  297
+    my $perl_encoder    = ($X_ascii > 10) ? ($X_ascii > 36) ? ($X_ascii > 62) ? $_X_encode95 : $_X_encode62 : $_X_encode36 : $_X_encode10;
  298
+    my $jscript_encoder = ($X_ascii > 10) ? ($X_ascii > 36) ? ($X_ascii > 62) ? $_JSencode95 : $_JSencode62 : $_JSencode36 : $_JSencode10;
  299
+    return ($language eq $JSCRIPT) ? $jscript_encoder : $perl_encoder;
  300
+  };
  301
+
  302
+#############################
  303
+# Perl versions of encoders #
  304
+#############################
  305
+  # base10 zero encoding - characters: 0123456789
  306
+  $_X_encode10 = sub {return &_encodeBase(shift,10)};
  307
+  # base36               - characters: 0123456789abcdefghijklmnopqrstuvwxyz
  308
+  $_X_encode36 = sub {return &_encodeBase(shift,36)};
  309
+  # base62               - characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  310
+  $_X_encode62 = sub {return &_encodeBase(shift,62)};
  311
+  # high-ascii values    - characters: 、�ウЖ����渦慨偽係杭纂従神疎団兎波品北洋椀冫嘖孛忤掣桀毳烙痰邃繙艾蜉謖邇關髓齡
  312
+  $_X_encode95 = sub {return &_encodeBase(shift,95)};
  313
+  # Lookup character sets for baseN encoding
  314
+     $baseLookup{10} = [(0..9)[0..9]];                    # base 10
  315
+     $baseLookup{36} = [(0..9,'a'..'z')[0..35]];          # base 36
  316
+     $baseLookup{62} = [(0..9,'a'..'z','A'..'Z')[0..61]]; # base 62
  317
+     $baseLookup{95} = (); for (my $i=0; $i<95; $i++) {$baseLookup{95}[$i] = chr($i+161)}; # base95 (high ascii)
  318
+#print Dumper(%baseLookup);
  319
+#####################
  320
+  sub _encodeBase { #
  321
+#####################
  322
+  # Generic base conversion function using defined lookup arrays (perl version only)
  323
+    my ($X_charCode, $base) = @_;
  324
+    my $X_encoded = '';
  325
+    # Do we know this encoding?
  326
+    if (exists ($baseLookup{$base})) {
  327
+      if ($X_charCode == 0) {$X_encoded = $baseLookup{$base}[0]}
  328
+      while($X_charCode > 0) {
  329
+        $X_encoded  = $baseLookup{$base}[$X_charCode % $base] . $X_encoded;
  330
+        $X_charCode = int($X_charCode / $base);
  331
+      }
  332
+    }
  333
+    else {$X_encoded = "$X_charCode"} # default is to return unchanged (ie as for base 10) if no baselookup is available
  334
+    return $X_encoded;
  335
+  };
  336
+
  337
+#############################
  338
+  $_X_encodePrivate = sub { #
  339
+#############################
  340
+  # special _chars
  341
+    my $X_charCode = shift;
  342
+    return '_' . $X_charCode;
  343
+  };
  344
+
  345
+############################
  346
+  sub _X_escape($script) { #
  347
+############################
  348
+  # protect characters used by the parser
  349
+    my $X_script = shift;
  350
+    $X_script =~ s/([\\'])/\\$1/g;
  351
+    return $X_script;
  352
+  };
  353
+
  354
+#####################
  355
+  sub _X_escape95 { #
  356
+#####################
  357
+  # protect high-ascii characters already in the script
  358
+    my $X_script = shift;
  359
+    $X_script =~ s/([\xa1-\xff])/sprintf("\\x%1x",ord($1))/eg;
  360
+    return $X_script;
  361
+  };
  362
+
  363
+############################
  364
+  sub _X_getFunctionBody { #
  365
+############################
  366
+  # extract the body of a function (ie between opening/closing {}) - consistent with Dean Edwards approach
  367
+    my $X_function = shift;
  368
+    $X_function =~ m/^.*\{(.*)\}*$/sg; # Multiline, global (greedy)
  369
+    my $start = index($X_function,'{');
  370
+    my $end   = rindex($X_function,'}');
  371
+    $X_function = substr($X_function,($start+1),($end-1-$start));
  372
+    return $X_function;
  373
+  };
  374
+
  375
+######################
  376
+  sub _X_globalize { #
  377
+######################
  378
+  # set the global flag on a RegExp (you have to create a new one) !!! Unused in perl version
  379
+    # my $X_regexp = shift;
  380
+  };
  381
+
  382
+  # build the parsing routine
  383
+  &_X_addParser(\&_X_basicCompression);
  384
+  &_X_addParser(\&_X_encodeSpecialChars) if ($_X_specialChars);
  385
+  &_X_addParser(\&_X_encodeKeywords)     if ($_X_encoding);
  386
+
  387
+  # go!
  388
+  return &_X_pack($_X_script);
  389
+}
  390
+
  391
+########################
  392
+# Javascript Literals  #
  393
+########################
  394
+
  395
+# JScript function "_unpack" - from DeanEdwards pack.js (NB: No ";" after final "}")
  396
+($_JSunpack) = <<'END_JSCRIPT_UNPACK';
  397
+/* unpacking function - this is the boot strap function   */
  398
+/* data extracted from this packing routine is passed to  */
  399
+/* this function when decoded in the target               */
  400
+function($packed, $ascii, $count, $keywords, $encode, $decode) {
  401
+  while ($count--)
  402
+    if ($keywords[$count])
  403
+     $packed = $packed.replace(new RegExp('\\b' + $encode($count) + '\\b', 'g'), $keywords[$count]);
  404
+  /* RS_Debug = $packed; */  /* {RS} !!!!!!!!! */
  405
+  return $packed;
  406
+}
  407
+END_JSCRIPT_UNPACK
  408
+
  409
+# JScript function "_decode" - from DeanEdwards pack.js
  410
+($_JSdecode) = <<'END_JSCRIPT_DECODE';
  411
+  /* code-snippet inserted into the unpacker to speed up decoding */
  412
+  function() {
  413
+    /* does the browser support String.replace where the */
  414
+    /*  replacement value is a function? */
  415
+    if (!''.replace(/^/, String)) {
  416
+      /* decode all the values we need */
  417
+          while ($count--) $decode[$encode($count)] = $keywords[$count] || $encode($count);
  418
+          /* global replacement function */
  419
+          $keywords = [function($encoded){return $decode[$encoded]}];
  420
+          /* generic match */
  421
+          $encode = function(){return'\\w+'};
  422
+          /* reset the loop counter -  we are now doing a global replace */
  423
+          $count = 1;
  424
+      }
  425
+  };
  426
+END_JSCRIPT_DECODE
  427
+
  428
+# JScript versions of encoders
  429
+($_JSencode10) = <<'END_JSCRIPT_ENCODE10';
  430
+  /* zero encoding */
  431
+  /* characters: 0123456789 */
  432
+  function($charCode) {
  433
+    return $charCode;
  434
+  };
  435
+END_JSCRIPT_ENCODE10
  436
+
  437
+($_JSencode36) = <<'END_JSCRIPT_ENCODE36';
  438
+  /* inherent base36 support */
  439
+  /* characters: 0123456789abcdefghijklmnopqrstuvwxyz */
  440
+  function($charCode) {
  441
+    return $charCode.toString(36);
  442
+  };
  443
+END_JSCRIPT_ENCODE36
  444
+
  445
+($_JSencode62) = <<'END_JSCRIPT_ENCODE62';
  446
+  /* hitch a ride on base36 and add the upper case alpha characters */
  447
+  /* characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ */
  448
+  function($charCode) {
  449
+    return ($charCode < _encoding ? '' : arguments.callee(parseInt($charCode / _encoding))) +
  450
+    (($charCode = $charCode % _encoding) > 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36));
  451
+   };
  452
+END_JSCRIPT_ENCODE62
  453
+
  454
+($_JSencode95) = <<'END_JSCRIPT_ENCODE95';
  455
+ /* use high-ascii values */
  456
+ /* characters: 、�ウЖ����渦慨偽係杭纂従神疎団兎波品北洋椀冫嘖孛忤掣桀毳烙痰邃繙艾蜉謖邇關髓齡 */
  457
+ function($charCode) {
  458
+   return ($charCode < _encoding ? '' : arguments.callee($charCode / _encoding)) +
  459
+     String.fromCharCode($charCode % _encoding + 161);
  460
+ };
  461
+END_JSCRIPT_ENCODE95
  462
+
  463
+###########
  464
+# END     #
  465
+###########
  466
+1; # Pack #
  467
+###########
207  browse/ParseMaster.pm
... ...
@@ -0,0 +1,207 @@
  1
+#ParseMaster (July 25 2005)
  2
+#  Based on "ParseMaster.js" by Dean Edwards <http://dean.edwards.name/>
  3
+#  Ported to Perl by Rob Seiler, ELR Software Pty Ltd <http://www.elr.com.au>
  4
+#  Copyright 2005. License <http://creativecommons.org/licenses/LGPL/2.1/>
  5
+
  6
+package ParseMaster;
  7
+use strict;
  8
+use Data::Dumper;
  9
+
  10
+# Package wide variable declarations
  11
+use vars qw/$VERSION
  12
+            @_X_escaped @_X_patterns
  13
+           /;
  14
+
  15
+$VERSION    = '017';
  16
+
  17
+# constants
  18
+my $X_EXPRESSION  = 0;
  19
+my $X_REPLACEMENT = 1;
  20
+my $X_LENGTH      = 2;
  21
+
  22
+# re's used to determine nesting levels
  23
+my $X_GROUPS      = qr/\(/o;                # NB: Requires g modifier!
  24
+my $X_SUB_REPLACE = qr/\$\d/o;
  25
+my $X_INDEXED     = qr/^\$\d+$/o;
  26
+my $XX_ESCAPE     = qr/\\./o;               # NB: Requires g modifier!
  27
+my $XX_DELETED    = qr/\001[^\001]*\001/o;  # NB: Requires g modifier!
  28
+my $DIGIT         = qr/[^\D]/o;             # Yep - this is a digit - contains no non-digits
  29
+
  30
+# Constructor
  31
+sub new {
  32
+  my $class = shift;
  33
+  my $self  = {};
  34
+  @_X_escaped  = ();  # Re-initialize global for each instance
  35
+  @_X_patterns = ();  # Re-initialize global for each instance
  36
+  # Instance variables - access by similarly named set/get functions
  37
+  $self->{_ignoreCase_} = 0;
  38
+  $self->{_escapeChar_} = '';
  39
+  bless ($self, $class);
  40
+  return $self;
  41
+}
  42
+
  43
+sub ignoreCase {
  44
+  my ($self, $value) = @_;
  45
+  if (defined($value)) {
  46
+    $self->{_ignoreCase_} = $value;
  47
+  }
  48
+  return $self->{_ignoreCase_};
  49
+}
  50
+
  51
+sub escapeChar{
  52
+  my ($self, $value) = @_;
  53
+  if (defined($value)) {
  54
+    $self->{_escapeChar_} = $value;
  55
+  }
  56
+  return $self->{_escapeChar_};
  57
+}
  58
+
  59
+#######################
  60
+# Public Parsemaster functions
  61
+
  62
+my $X_DELETE = sub(@$) {
  63
+  my $X_offset = pop;
  64
+  my @X_match = @_;
  65
+  return (chr(001) . $X_match[$X_offset] . chr(001));
  66
+}; # NB semicolon required for closure!
  67
+
  68
+# create and add a new pattern to the patterns collection
  69
+sub add {
  70
+  my ($self, $expression, $X_replacement) = @_;
  71
+  if (!$X_replacement) {$X_replacement = $X_DELETE};
  72
+
  73
+  # count the number of sub-expressions
  74
+  my $temp = &_X_internalEscape($expression);
  75
+  my $length  = 1; # Always at least one because each pattern is itself a sub-expression
  76
+     $length += $temp =~ s/$X_GROUPS//g; # One way to count the left capturing parentheses in the regexp string
  77
+
  78
+  # does the pattern deal with sub-expressions?
  79
+  if ((ref($X_replacement) ne "CODE") && ($X_replacement =~ m/$X_SUB_REPLACE/)) {
  80
+    if ($X_replacement =~ m/$X_INDEXED/) { # a simple lookup? (eg "$2")
  81
+      # store the index (used for fast retrieval of matched strings)
  82
+      $X_replacement = substr($X_replacement,1) - 1;
  83
+    }
  84
+    else { # a complicated lookup (eg "Hello $2 $1")
  85
+      my $i = $length;
  86
+      while ($i) { # Had difficulty getting Perl to do Dean's splitting and joining of strings containing $'s
  87
+        my $str = '$a[$o+' . ($i-1) . ']'; # eg $a[$o+1]
  88
+        $X_replacement =~ s/\$$i/$str/;      # eg $2 $3 -> $a[$o+1] $a[$o+2]
  89
+        $i--;
  90
+      }
  91
+      # build a function to do the lookup - returns interpolated string of array lookups
  92
+      $X_replacement = eval('sub {my $o=pop; my @a=@_; return "' . $X_replacement . '"};');
  93
+    }
  94
+  }
  95
+  else {}
  96
+  # pass the modified arguments
  97
+  &_X_add($expression || q/^$/, $X_replacement, $length);
  98
+}
  99
+
  100
+# execute the global replacement
  101
+sub exec {
  102
+#print Dumper(@_X_patterns);
  103
+  my ($self, $X_string) = @_;
  104
+  my $escChar    = $self->escapeChar();
  105
+  my $ignoreCase = $self->ignoreCase();
  106
+  my ($regexp,$captures) = &_getPatterns();  # Concatenated and parenthesized regexp eg '(regex1)|(regex2)|(regex3)' etc
  107
+  $X_string = &_X_escape($X_string, $escChar);
  108
+  if ($ignoreCase) {$X_string =~ s/$regexp/{&_X_replacement(&_matchVars($captures,\$X_string))}/gie} # Pass $X_String as a
  109
+    else           {$X_string =~ s/$regexp/{&_X_replacement(&_matchVars($captures,\$X_string))}/ge}  # reference for speed
  110
+
  111
+  $X_string = &_X_unescape($X_string, $escChar);
  112
+  $X_string =~ s/$XX_DELETED//g;
  113
+  return $X_string;
  114
+}
  115
+
  116
+sub _X_add {
  117
+  push (@_X_patterns, [@_]); # Save each argument set as is into an array of arrays
  118
+}
  119
+
  120
+# this is the global replace function (it's quite complicated)
  121
+sub _X_replacement {
  122
+  my (@arguments) = @_;
  123
+#print Dumper (@arguments);
  124
+  if ($arguments[0] le '') {return ''}
  125
+  # Dereference last index (source String) here - faster than in _matchVars (maybe not needed at all?)
  126
+  $arguments[$#arguments] = ${$arguments[$#arguments]};
  127
+  my $i = 1;
  128
+  # loop through the patterns
  129
+  for (my $j=0; $j<scalar(@_X_patterns); $j++) { # Loop through global all @_X_patterns
  130
+    my @X_pattern = @{$_X_patterns[$j]};
  131
+    # do we have a result? NB: "if ($arguments[$i])" as in Dean's Javascript is false for the value 0!!!
  132
+    if ((defined $arguments[$i]) && ($arguments[$i] gt '')) {
  133
+      my $X_replacement = $X_pattern[$X_REPLACEMENT];
  134
+      # switch on type of $replacement
  135
+      if (ref($X_replacement) eq "CODE") {     # function
  136
+        return &$X_replacement(@arguments,$i);
  137
+      }
  138
+      elsif ($X_replacement =~ m/$DIGIT/) {    # number (contains no non-digits)
  139
+        return $arguments[$X_replacement + $i];
  140
+      }
  141
+      else { # default
  142
+        return $X_replacement;                 # default
  143
+      }
  144
+    } # skip over references to sub-expressions
  145
+    else {$i += $X_pattern[$X_LENGTH]}
  146
+  }
  147
+}
  148
+
  149
+#######################
  150
+# Private functions
  151
+#######################
  152
+
  153
+# encode escaped characters
  154
+sub _X_escape {
  155
+  my ($X_string, $X_escapeChar) = @_;
  156
+  if ($X_escapeChar) {
  157
+    my $re = '\\'.$X_escapeChar.'(.)';
  158
+    $X_string =~ s/$re/{push(@_X_escaped,$1); $X_escapeChar}/ge;
  159
+  }
  160
+  return $X_string;
  161
+}
  162
+
  163
+# decode escaped characters
  164
+sub _X_unescape {
  165
+  my ($X_string, $X_escapeChar) = @_;
  166
+  if ($X_escapeChar) { # We'll only do this if there is an $X_escapeChar!
  167
+    my $re = '\\'.$X_escapeChar;
  168
+    $X_string =~ s/$re/{$X_escapeChar . (shift(@_X_escaped))}/ge; # Don't use Dean Edwards as below 'or' here - because zero will return ''!
  169
+  # $X_string =~ s/$re/{$X_escapeChar . (shift(@_X_escaped) || '')}/ge;
  170
+  }
  171
+  return $X_string;
  172
+}
  173
+
  174
+sub _X_internalEscape {
  175
+  my ($string) = shift;
  176
+  $string =~ s/$XX_ESCAPE//g;
  177
+  return $string;
  178
+}
  179
+
  180
+# Builds an array of match variables to (approximately) emulate that available in Javascript String.replace()
  181
+sub _matchVars {
  182
+  my ($m,$sref) = @_;
  183
+  my @args = (1..$m);                # establish the number potential memory variables
  184
+  my @mv = map {eval("\$$_")} @args; # matchvarv[1..m] = the memory variables $1 .. $m
  185
+  unshift (@mv, $&);                 # matchvar[0]     = the substring that matched
  186
+  push    (@mv, length($`));         # matchvar[m+1]   =  offset within the source string where the match occurred (= length of prematch string)
  187
+  push    (@mv, $sref);              # matchvar[m+2]   = reference to full source string (dereference in caller if/when needed)
  188
+#print Dumper (@mv);
  189
+  return @mv;
  190
+}
  191
+
  192
+sub _getPatterns {
  193
+  my @Patterns = ();
  194
+  my $lcp = 0;
  195
+  for (my $i=0; $i<scalar(@_X_patterns); $i++) {       # Loop through global all @_patterns
  196
+    push (@Patterns, $_X_patterns[$i][$X_EXPRESSION]); # accumulate the expressions
  197
+    $lcp += $_X_patterns[$i][$X_LENGTH];               # sum the left capturing parenthesis counts
  198
+  }
  199
+  my $str = "(" . join(')|(',@Patterns). ")";          # enclose each pattern in () separated by "|"
  200
+  return ($str, $lcp);
  201
+}
  202
+
  203
+##################
  204
+# END            #
  205
+##################
  206
+1; # ParseMaster #
  207
+##################
85  browse/browse-new.cgi
... ...
@@ -0,0 +1,85 @@
  1
+#!/usr/bin/perl
  2
+
  3
+use Pack;
  4
+use CGI;
  5
+use LWP::Simple;
  6
+use Digest::MD5 qw(md5_hex);
  7
+
  8
+chdir("/home/jquery/www/src/");
  9
+
  10
+my $cgi = new CGI();
  11
+print $cgi->header('text/javascript');
  12
+my $c = $cgi->param('c') || 'compressed';
  13
+my $v = $cgi->param('v') || 'latest';
  14
+my $live = 0;
  15
+#$v = "0.10" if ( $v eq 'latest' );
  16
+if ( $v eq 'dev' ) {
  17
+  $live = 1;
  18
+  $c = 'sane';
  19
+  $v = 'latest';
  20
+} elsif ( $v eq 'debug' ) {
  21
+  $c = 'sane';
  22
+  $v = 'latest';
  23
+}
  24
+
  25
+my @files = $cgi->param('files') ?
  26
+	split(',', join(',', $cgi->param('files')) ):
  27
+	("jquery","fx","event","ajax");
  28
+
  29
+if ($cgi->param('custom') && $cgi->param('custom') !~ /-/) {
  30
+  $c = $cgi->param('custom');
  31
+}
  32
+
  33
+my $md5 = $cgi->param('custom') || join('-',dupe(@files),$v,$c);
  34
+my $j = "build/$md5\.js";
  35
+my $stamp = "/* Built " . localtime() . " */\n";
  36
+
  37
+if ( !-e $j && !$live ) {
  38
+	my $f = getf();
  39
+	open( F, ">$j" );
  40
+	print F $stamp;
  41
+	print F $c eq 'compressed' ? &Pack::pack($f, 62, 1, 0) : $f;
  42
+	close( F );
  43
+
  44
+	if ( $c eq 'compressed' ) {
  45
+	  my $tj = $j;
  46
+	  $tj =~ s/$c\.js$/sane\.js/;
  47
+	  open( F, ">$tj" );
  48
+	  print F $stamp;
  49
+	  print F $f;
  50
+	  close( F );
  51
+	}
  52
+}
  53
+
  54
+if ( $cgi->param('files') ) {
  55
+	print $cgi->redirect("/src/$v/$md5/");
  56
+} else {
  57
+	#print $cgi->header('text/javascript');
  58
+	if ( $live ) {
  59
+		print getf();
  60
+	} else {
  61
+		my $t = `cat copyright.txt $j`;
  62
+		$v = $v eq 'latest' ? 'Current' : "Version $v";
  63
+		$t =~ s/\$VERSION/$v/ig;
  64
+		$t =~ s/\$MD5/$md5/ig;
  65
+		my $url = $cgi->param('v') . "/";
  66
+		$url .= $cgi->param('custom') . "/" if ( $cgi->param('custom') );
  67
+		$t =~ s/\$URL/$url/ig;
  68
+		print $t;
  69
+	}
  70
+}
  71
+
  72
+sub getf {
  73
+	my $f = '';
  74
+	foreach ( @files ) {
  75
+		$f .= `cat $_/$_\-$v\.js`;
  76
+	}
  77
+	$f =~ s/\r//g;
  78
+	$f;
  79
+}
  80
+
  81
+sub dupe {
  82
+  my %check;
  83
+  $check{$_} = 1 foreach (@_);
  84
+  return sort keys %check;
  85
+}
51  browse/browse.cgi
... ...
@@ -0,0 +1,51 @@
  1
+#!/usr/bin/perl
  2
+
  3
+use Pack;
  4
+use CGI;
  5
+use LWP::Simple;
  6
+use Digest::MD5 qw(md5_hex);
  7
+
  8
+chdir("/home/jquery/www/src/");
  9
+
  10
+my $cgi = new CGI();
  11
+my $c = $cgi->param('c') || 'compressed';
  12
+my $v = $cgi->param('v');
  13
+#$v = "0.10" if ( $v eq 'latest' );
  14
+my @files = $cgi->param('files') ?
  15
+	split(',', join(',', $cgi->param('files')) ):
  16
+	("jquery","minifx","fx","event");
  17
+
  18
+my $md5 = $cgi->param('custom') || join('-',dupe(@files),$v,$c);
  19
+my $j = "build/$md5\.js";
  20
+
  21
+if ( !-e $j ) {
  22
+	my $f = '';
  23
+	foreach ( @files ) {
  24
+		$f .= `cat $_/$_\-$v\.js`;
  25
+	}
  26
+	$f =~ s/\r//g;
  27
+	my $o = $c eq 'compressed' ? &Pack::pack($f, 62, 1, 0) : $f;
  28
+	open( F, ">$j" );
  29
+	print F $o;
  30
+	close( F );
  31
+}
  32
+
  33
+if ( $cgi->param('files') ) {
  34
+	print $cgi->redirect("/src/$v/$md5/");
  35
+} else {
  36
+	print $cgi->header('text/javascript');
  37
+	my $t = `cat copyright.txt $j`;
  38
+	$v = $v eq 'latest' ? 'Current' : "Version $v";
  39
+	$t =~ s/\$VERSION/$v/ig;
  40
+	$t =~ s/\$MD5/$md5/ig;
  41
+	my $url = $cgi->param('v') . "/";
  42
+	$url .= $cgi->param('custom') . "/" if ( $cgi->param('custom') );
  43
+	$t =~ s/\$URL/$url/ig;
  44
+	print $t;
  45
+}
  46
+
  47
+sub dupe {
  48
+  my %check;
  49
+  $check{$_} = 1 foreach (@_);
  50
+  return sort keys %check;
  51
+}
17  browse/copyright.txt
... ...
@@ -0,0 +1,17 @@
748  core/core.js
... ...
@@ -0,0 +1,748 @@
  1
+/*
  2
+ * JQuery (http://jquery.com/)
  3
+ * By John Resig (http://ejohn.org/)
  4
+ * Under an Attribution, Share Alike License
  5
+ */
  6
+
  7
+function $(a,c) {
  8
+	var $a = a || $.context || document;
  9
+	var $c = c && c.$jquery && c.get(0) || c;
  10
+	
  11
+	// Since we're using Prototype's $ function,
  12
+	// be nice and have backwards compatability
  13
+	if ( typeof Prototype != "undefined" ) {
  14
+		if ( $a.constructor == String ) {
  15
+			var re = new RegExp( "[^a-zA-Z0-9_-]" );
  16
+			if ( !re.test($a) ) {
  17
+				$c = $c && $c.documentElement || document;
  18
+				if ( $c.getElementsByTagName($a).length == 0 ) {
  19
+					var obj = $c.getElementById($a);
  20
+					if ( obj != null ) return obj;
  21
+				}
  22
+			}
  23
+		} else if ( $a.constructor == Array ) {
  24
+			return $.map( $a, function(b){
  25
+				if ( b.constructor == String )
  26
+					return document.getElementById(b);
  27
+				return b;
  28
+			});
  29
+		}
  30
+	}
  31
+
  32
+	// Load Dynamic Function List
  33
+	var self = {
  34
+		cur: $.Select($a,$c),
  35
+		$jquery: "0.30",
  36
+		
  37
+		// The only two getters
  38
+		size: function() {return this.get().length},
  39
+		get: function(i) {
  40
+			return i == null ? this.cur : this.cur[i];
  41
+		},
  42
+		
  43
+		each: function(f) {
  44
+			for ( var i = 0; i < this.size(); i++ )
  45
+				$.apply( this.get(i), f, [i] );
  46
+			return this;
  47
+		},
  48
+		set: function(a,b) {
  49
+			return this.each(function(){
  50
+				if ( b == null )
  51
+					for ( var j in a )
  52
+						$.attr(this,j,a[j]);
  53
+				else
  54
+					$.attr(this,a,b);
  55
+			});
  56
+		},
  57
+		html: function(h) {
  58
+			return h == null && this.size() ?
  59
+        this.get(0).innerHTML : this.set( "innerHTML", h );
  60
+		},
  61
+		val: function(h) {
  62
+			return h == null && this.size() ?
  63
+        this.get(0).value : this.set( "value", h );
  64
+		},
  65
+		
  66
+		css: function(a,b) {
  67
+			return this.each(function(){
  68
+				if ( !b )
  69
+					for ( var j in a )
  70
+						$.attr(this.style,j,a[j]);
  71
+				else
  72
+					$.attr(this.style,a,b);
  73
+			});
  74
+		},
  75
+		toggle: function() {
  76
+			return this.each(function(){
  77
+				var d = $.getCSS(this,"display");
  78
+				if ( d == "none" || d == '' )
  79
+					$(this).show();
  80
+				else
  81
+					$(this).hide();
  82
+			});
  83
+		},
  84
+		show: function(a) {
  85
+			return this.each(function(){
  86
+				this.style.display = this.$$oldblock ? this.$$oldblock : '';
  87
+				if ( $.getCSS(this,"display") == "none" ) this.style.display = 'block';
  88
+			});
  89
+		},
  90
+		hide: function(a) {
  91
+			return this.each(function(){
  92
+				this.$$oldblock = $.getCSS(this,"display");
  93
+				if ( this.$$oldblock == "none" ) this.$$oldblock = 'block';
  94
+				this.style.display = 'none';
  95
+			});
  96
+		},
  97
+		addClass: function(c) {
  98
+			return this.each(function(){
  99
+				if ($.hasWord(this,c)) return;
  100
+				this.className += ( this.className.length > 0 ? " " : "" ) + c;
  101
+			});
  102
+		},
  103
+		removeClass: function(c) {
  104
+			return this.each(function(){
  105
+				this.className = c == null ? '' :
  106
+					this.className.replace(
  107
+						new RegExp('(^|\\s*\\b[^-])'+c+'($|\\b(?=[^-]))', 'g'), '');
  108
+			});
  109
+		},
  110
+		// TODO: Optomize
  111
+		toggleClass: function(c) {
  112
+			return this.each(function(){
  113
+				if ($.hasWord(this,c))
  114
+					this.className = 
  115
+						this.className.replace(
  116
+							new RegExp('(\\s*\\b[^-])'+c+'($|\\b(?=[^-]))', 'g'), '');
  117
+				else
  118
+					this.className += ( this.className.length > 0 ? " " : "" ) + c;
  119
+			});
  120
+		},
  121
+		remove: function() {
  122
+			this.each(function(){this.parentNode.removeChild( this );});
  123
+			this.cur = [];
  124
+			return this;
  125
+		},
  126
+		
  127
+		wrap: function() {
  128
+			var a = $.clean(arguments);
  129
+			return this.each(function(){
  130
+				var b = a[0].cloneNode(true);
  131
+				this.parentNode.insertBefore( b, this );
  132
+				while ( b.firstChild ) b = b.firstChild;
  133
+				b.appendChild( this );
  134
+			});
  135
+		},
  136
+		
  137
+		append: function() {
  138
+      var clone = this.size() > 1;
  139
+			var a = $.clean(arguments);
  140
+			return this.each(function(){
  141
+				for ( var i in a )
  142
+				  this.appendChild( clone ? a[i].cloneNode(true) : a[i] );
  143
+			});
  144
+		},
  145
+
  146
+		appendTo: function() {
  147
+			var a = arguments;
  148
+			return this.each(function(){
  149
+				for ( var i = 0; i < a.length; i++ )
  150
+					$(a[i]).append( this );
  151
+			});
  152
+		},
  153
+		
  154
+		prepend: function() {
  155
+      var clone = this.size() > 1;
  156
+			var a = $.clean(arguments);
  157
+			return this.each(function(){
  158
+				for ( var i = a.length - 1; i >= 0; i-- )
  159
+					this.insertBefore( clone ? a[i].cloneNode(true) : a[i], this.firstChild );
  160
+			});
  161
+		},
  162
+		
  163
+		before: function() {
  164
+      var clone = this.size() > 1;
  165
+			var a = $.clean(arguments);
  166
+			return this.each(function(){
  167
+				for ( var i in a )
  168
+					this.parentNode.insertBefore( clone ? a[i].cloneNode(true) : a[i], this );
  169
+			});
  170
+		},
  171
+		
  172
+		after: function() {
  173
+      var clone = this.size() > 1;
  174
+			var a = $.clean(arguments);
  175
+			return this.each(function(){
  176
+				for ( var i = a.length - 1; i >= 0; i-- )
  177
+					this.parentNode.insertBefore( clone ? a[i].cloneNode(true) : a[i], this.nextSibling );
  178
+			});
  179
+		},
  180
+
  181
+		empty: function() {
  182
+			return this.each(function(){
  183
+				while ( this.firstChild )
  184
+					this.removeChild( this.firstChild );
  185
+			});
  186
+		},
  187
+		
  188
+		bind: function(t,f) {
  189
+			return this.each(function(){addEvent(this,t,f);});
  190
+		},
  191
+		unbind: function(t,f) {
  192
+			return this.each(function(){removeEvent(this,t,f);});
  193
+		},
  194
+		trigger: function(t) {
  195
+			return this.each(function(){triggerEvent(this,t);});
  196
+		},
  197
+		
  198
+		find: function(t) {
  199
+			var old = [], ret = [];
  200
+			this.each(function(){
  201
+				old[old.length] = this;
  202
+				ret = $.merge( ret, $.Select(t,this) );
  203
+			});
  204
+			this.old = old;
  205
+			this.cur = ret;
  206
+			return this;
  207
+		},
  208
+		end: function() {
  209
+			this.cur = this.old;
  210
+			return this;
  211
+		},
  212
+		
  213
+		parent: function(a) {
  214
+			if ( a == null ) a = 1;
  215
+			this.cur = $.map(this.cur,function(d){
  216
+				var b = $.parents(d);
  217
+				if ( a == 0 )
  218
+					return b;
  219
+				else if ( a.constructor == String ) {
  220
+					var c = $.filter(a,b);
  221
+					return c.length > 0 ? c[0] : null;
  222
+				} else
  223
+					return b.length >= a ? b[a-1] : null;
  224
+			});
  225
+			return this;
  226
+		},
  227
+		
  228
+		parents: function(a) {
  229
+			return this;
  230
+		},
  231
+		
  232
+		filter: function(t) {
  233
+			this.cur = $.filter(t,this.cur).r;
  234
+			return this;
  235
+		},
  236
+		not: function(t) {
  237
+			this.cur = t.constructor == String ?
  238
+				$.filter(t,this.cur,false).r :
  239
+				$.grep(this.cur,function(a){return a != t;});
  240
+			return this;
  241
+		},
  242
+		add: function(t) {
  243
+			this.cur = $.merge( this.cur, t.constructor == String ?
  244
+				$.Select(t) : t.constructor == Array ? t : [t] );
  245
+			return this;
  246
+		},
  247
+		is: function(t) {
  248
+			return $.filter(t,this.cur).r.length > 0;
  249
+		},
  250
+		isNot: function(t) {
  251
+			return !this.s(t);
  252
+		}
  253
+	};
  254
+	
  255
+	// TODO: Remove need to return this
  256
+	for ( var i in $.fn ) {
  257
+		if ( self[i] != null )
  258
+			self["_"+i] = self[i];
  259
+		self[i] = $.fn[i];
  260
+	}
  261
+	
  262
+	if ( typeof Prototype != "undefined" && $a.constructor != String ) {
  263
+		if ( $c ) $a = self.get();
  264
+		for ( var i in self ) {(function(j){
  265
+			try {
  266
+				if ( $a[j] == null ) {
  267
+					$a[j] = function() {
  268
+						return $.apply(self,self[j],arguments);
  269
+					};
  270
+				}
  271
+			} catch(e) {}
  272
+		})(i);}