52. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 5/25/2018 9:21:43 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

52.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\ZIP\DSM-cif\Direct Implementation\java\dsm-config\dsm-config-ui\src\main\webapp\resources\jqueryform\2.47 jquery.form.js Tue May 22 13:42:10 2018 UTC
2 C:\AraxisMergeCompare\Pri_re\ZIP\DSM-cif\Direct Implementation\java\dsm-config\dsm-config-ui\src\main\webapp\resources\jqueryform\2.47 jquery.form.js Thu May 24 19:30:36 2018 UTC

52.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1560
Changed 1 2
Inserted 0 0
Removed 0 0

52.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

52.4 Active regular expressions

No regular expressions were active.

52.5 Comparison detail

  1   /*!
  2    * jQuery  Form Plugi n
  3    * version : 2.47 (04 -SEP-2010)
  4    * @requir es jQuery  v1.3.2 or  later
  5    *
  6    * Example s and docu mentation  at: http:/ /malsup.co m/jquery/f orm/
  7    * Dual li censed und er the MIT  and GPL l icenses:
  8    *   http: //www.open source.org /licenses/ mit-licens e.php
  9    *   http: //www.gnu. org/licens es/gpl.htm l
  10    */
  11   ;(function ($) {
  12  
  13   /*
  14           Us age Note:
  15           -- ---------
  16           Do  not use b oth ajaxSu bmit and a jaxForm on  the same  form.  The se
  17           fu nctions ar e intended  to be exc lusive.  U se ajaxSub mit if you  want
  18           to  bind your  own submi t handler  to the for m.  For ex ample,
  19  
  20           $( document). ready(func tion() {
  21                    $('# myForm').b ind('submi t', functi on() {
  22                             $(this ).ajaxSubm it({
  23                                      target:  '#output'
  24                             });
  25                             return  false; //  <-- impor tant!
  26                    });
  27           }) ;
  28  
  29           Us e ajaxForm  when you  want the p lugin to m anage all  the event  binding
  30           fo r you.  Fo r example,
  31  
  32           $( document). ready(func tion() {
  33                    $('# myForm').a jaxForm({
  34                             target : '#output '
  35                    });
  36           }) ;
  37  
  38           Wh en using a jaxForm, t he ajaxSub mit functi on will be  invoked f or you
  39           at  the appro priate tim e.
  40   */
  41  
  42   /**
  43    * ajaxSub mit() prov ides a mec hanism for  immediate ly submitt ing
  44    * an HTML  form usin g AJAX.
  45    */
  46   $.fn.ajaxS ubmit = fu nction(opt ions) {
  47           //  fast fail  if nothin g selected  (http://d ev.jquery. com/ticket /2752)
  48           if  (!this.le ngth) {
  49                    log( 'ajaxSubmi t: skippin g submit p rocess - n o element  selected') ;
  50                    retu rn this;
  51           }
  52  
  53           if  (typeof o ptions ==  'function' ) {
  54                    opti ons = { su ccess: opt ions };
  55           }
  56  
  57           va r url = $. trim(this. attr('acti on'));
  58           if  (url) {
  59                    // c lean url ( don't incl ude hash v aue)
  60                    url  = (url.mat ch(/^([^#] +)/)||[])[ 1];
  61           }
  62           ur l = url ||  window.lo cation.hre f || '';
  63  
  64           op tions = $. extend(tru e, {
  65                    url:   url,
  66                    type : this.att r('method' ) || 'GET' ,
  67                    ifra meSrc: /^h ttps/i.tes t(window.l ocation.hr ef || '')  ? 'javascr ipt:false'  : 'about: blank'
  68           },  options);
  69  
  70           //  hook for  manipulati ng the for m data bef ore it is  extracted;
  71           //  convenien t for use  with rich  editors li ke tinyMCE  or FCKEdi tor
  72           va r veto = { };
  73           th is.trigger ('form-pre -serialize ', [this,  options, v eto]);
  74           if  (veto.vet o) {
  75                    log( 'ajaxSubmi t: submit  vetoed via  form-pre- serialize  trigger');
  76                    retu rn this;
  77           }
  78  
  79           //  provide o pportunity  to alter  form data  before it  is seriali zed
  80           if  (options. beforeSeri alize && o ptions.bef oreSeriali ze(this, o ptions) == = false) {
  81                    log( 'ajaxSubmi t: submit  aborted vi a beforeSe rialize ca llback');
  82                    retu rn this;
  83           }
  84  
  85           va r n,v,a =  this.formT oArray(opt ions.seman tic);
  86           if  (options. data) {
  87                    opti ons.extraD ata = opti ons.data;
  88                    for  (n in opti ons.data)  {
  89                             if(opt ions.data[ n] instanc eof Array)  {
  90                                      for (var  k in opti ons.data[n ]) {
  91                                               a.push( {  name: n, v alue: opti ons.data[n ][k] } );
  92                                      }
  93                             }
  94                             else {
  95                                      v = opti ons.data[n ];
  96                                      v = $.is Function(v ) ? v() :  v; // if v alue is fn , invoke i t
  97                                      a.push(  { name: n,  value: v  } );
  98                             }
  99                    }
  100           }
  101  
  102           //  give pre- submit cal lback an o pportunity  to abort  the submit
  103           if  (options. beforeSubm it && opti ons.before Submit(a,  this, opti ons) === f alse) {
  104                    log( 'ajaxSubmi t: submit  aborted vi a beforeSu bmit callb ack');
  105                    retu rn this;
  106           }
  107  
  108           //  fire veto able 'vali date' even t
  109           th is.trigger ('form-sub mit-valida te', [a, t his, optio ns, veto]) ;
  110           if  (veto.vet o) {
  111                    log( 'ajaxSubmi t: submit  vetoed via  form-subm it-validat e trigger' );
  112                    retu rn this;
  113           }
  114  
  115           va r q = $.pa ram(a);
  116  
  117           if  (options. type.toUpp erCase() = = 'GET') {
  118                    opti ons.url +=  (options. url.indexO f('?') >=  0 ? '&' :  '?') + q;
  119                    opti ons.data =  null;  //  data is n ull for 'g et'
  120           }
  121           el se {
  122                    opti ons.data =  q; // dat a is the q uery strin g for 'pos t'
  123           }
  124  
  125           va r $form =  this, call backs = [] ;
  126           if  (options. resetForm)  {
  127                    call backs.push (function( ) { $form. resetForm( ); });
  128           }
  129           if  (options. clearForm)  {
  130                    call backs.push (function( ) { $form. clearForm( ); });
  131           }
  132  
  133           //  perform a  load on t he target  only if da taType is  not provid ed
  134           if  (!options .dataType  && options .target) {
  135                    var  oldSuccess  = options .success | | function (){};
  136                    call backs.push (function( data) {
  137                             var fn  = options .replaceTa rget ? 're placeWith'  : 'html';
  138                             $(opti ons.target )[fn](data ).each(old Success, a rguments);
  139                    });
  140           }
  141           el se if (opt ions.succe ss) {
  142                    call backs.push (options.s uccess);
  143           }
  144  
  145           op tions.succ ess = func tion(data,  status, x hr) { // j Query 1.4+  passes xh r as 3rd a rg
  146                    var  context =  options.co ntext || o ptions;    // jQuery  1.4+ suppo rts scope  context 
  147                    for  (var i=0,  max=callba cks.length ; i < max;  i++) {
  148                             callba cks[i].app ly(context , [data, s tatus, xhr  || $form,  $form]);
  149                    }
  150           };
  151  
  152           //  are there  files to  upload?
  153           va r fileInpu ts = $('in put:file',  this).len gth > 0;
  154           va r mp = 'mu ltipart/fo rm-data';
  155           va r multipar t = ($form .attr('enc type') ==  mp || $for m.attr('en coding') = = mp);
  156  
  157           //  options.i frame allo ws user to  force ifr ame mode
  158           //  06-NOV-09 : now defa ulting to  iframe mod e if file  input is d etected
  159      if (opt ions.ifram e !== fals e && (file Inputs ||  options.if rame || mu ltipart))  {
  160               // hack t o fix Safa ri hang (t hanks to T im Molendi jk for thi s)
  161               // see:   http://gro ups.google .com/group /jquery-de v/browse_t hread/thre ad/36395b7 ab510dd5d
  162               if (optio ns.closeKe epAlive) {
  163                       $ .get(optio ns.closeKe epAlive, f ileUpload) ;
  164                    }
  165               else {
  166                       f ileUpload( );
  167                    }
  168      }
  169      else {
  170               $.ajax(op tions);
  171      }
  172  
  173           //  fire 'not ify' event
  174           th is.trigger ('form-sub mit-notify ', [this,  options]);
  175           re turn this;
  176  
  177  
  178           //  private f unction fo r handling  file uplo ads (hat t ip to YAHO O!)
  179           fu nction fil eUpload()  {
  180                    var  form = $fo rm[0];
  181  
  182                    if ( $(':input[ name=submi t],:input[ id=submit] ', form).l ength) {
  183                             // if  there is a n input wi th a name  or id of ' submit' th en we won' t be
  184                             // abl e to invok e the subm it fn on t he form (a t least no t x-browse r)
  185                             alert( 'Error: Fo rm element s must not  have name  or id of  "submit".' );
  186                             return ;
  187                    }
  188                    
  189                    var  s = $.exte nd(true, { }, $.ajaxS ettings, o ptions);
  190                    s.co ntext = s. context ||  s;
  191                    var  id = 'jqFo rmIO' + (n ew Date(). getTime()) , fn = '_' +id;
  192                    wind ow[fn] = f unction()  {
  193                             var f  = $io.data ('form-plu gin-onload ');
  194                             if (f)  {
  195                                      f();
  196                                      window[f n] = undef ined;
  197                                      try { de lete windo w[fn]; } c atch(e){}
  198                             }
  199                    }
  200                    var  $io = $('< iframe id= "' + id +  '" name="'  + id + '"  src="'+ s .iframeSrc  +'" onloa d="window[ \'_\'+this .id]()" /> ');
  201                    var  io = $io[0 ];
  202  
  203                    $io. css({ posi tion: 'abs olute', to p: '-1000p x', left:  '-1000px'  });
  204  
  205                    var  xhr = { //  mock obje ct
  206                             aborte d: 0,
  207                             respon seText: nu ll,
  208                             respon seXML: nul l,
  209                             status : 0,
  210                             status Text: 'n/a ',
  211                             getAll ResponseHe aders: fun ction() {} ,
  212                             getRes ponseHeade r: functio n() {},
  213                             setReq uestHeader : function () {},
  214                             abort:  function( ) {
  215                                      this.abo rted = 1;
  216                                      $io.attr ('src', s. iframeSrc) ; // abort  op in pro gress
  217                             }
  218                    };
  219  
  220                    var  g = s.glob al;
  221                    // t rigger aja x global e vents so t hat activi ty/block i ndicators  work like  normal
  222                    if ( g && ! $.a ctive++) {
  223                             $.even t.trigger( "ajaxStart ");
  224                    }
  225                    if ( g) {
  226                             $.even t.trigger( "ajaxSend" , [xhr, s] );
  227                    }
  228  
  229                    if ( s.beforeSe nd && s.be foreSend.c all(s.cont ext, xhr,  s) === fal se) {
  230                             if (s. global) { 
  231                                      $.active --;
  232                             }
  233                             return ;
  234                    }
  235                    if ( xhr.aborte d) {
  236                             return ;
  237                    }
  238  
  239                    var  cbInvoked  = false;
  240                    var  timedOut =  0;
  241  
  242                    // a dd submitt ing elemen t to data  if we know  it
  243                    var  sub = form .clk;
  244                    if ( sub) {
  245                             var n  = sub.name ;
  246                             if (n  && !sub.di sabled) {
  247                                      s.extraD ata = s.ex traData ||  {};
  248                                      s.extraD ata[n] = s ub.value;
  249                                      if (sub. type == "i mage") {
  250                                               s.extraDat a[n+'.x']  = form.clk _x;
  251                                               s.extraDat a[n+'.y']  = form.clk _y;
  252                                      }
  253                             }
  254                    }
  255  
  256                    // t ake a brea th so that  pending r epaints ge t some cpu  time befo re the upl oad starts
  257                    func tion doSub mit() {
  258                             // mak e sure for m attrs ar e set
  259                             var t  = $form.at tr('target '), a = $f orm.attr(' action');
  260  
  261                             // upd ate form a ttrs in IE  friendly  way
  262                             form.s etAttribut e('target' ,id);
  263                             if (fo rm.getAttr ibute('met hod') != ' POST') {
  264                                      form.set Attribute( 'method',  'POST');
  265                             }
  266                             if (fo rm.getAttr ibute('act ion') != s .url) {
  267                                      form.set Attribute( 'action',  s.url);
  268                             }
  269  
  270                             // ie  borks in s ome cases  when setti ng encodin g
  271                             if (!  s.skipEnco dingOverri de) {
  272                                      $form.at tr({
  273                                               encoding:  'multipart /form-data ',
  274                                               enctype:   'multipart /form-data '
  275                                      });
  276                             }
  277  
  278                             // sup port timou t
  279                             if (s. timeout) {
  280                                      setTimeo ut(functio n() { time dOut = tru e; cb(); } , s.timeou t);
  281                             }
  282  
  283                             // add  "extra" d ata to for m if provi ded in opt ions
  284                             var ex traInputs  = [];
  285                             try {
  286                                      if (s.ex traData) {
  287                                               for (var n  in s.extr aData) {
  288                                                       ex traInputs. push(
  289                                                                $('< input type ="hidden"  name="'+n+ '" value=" '+s.extraD ata[n]+'"  />')
  290                                                                         .appen dTo(form)[ 0]);
  291                                               }
  292                                      }
  293  
  294                                      // add i frame to d oc and sub mit the fo rm
  295                                      $io.appe ndTo('body ');
  296                                      $io.data ('form-plu gin-onload ', cb);
  297                                      form.sub mit();
  298                             }
  299                             finall y {
  300                                      // reset  attrs and  remove "e xtra" inpu t elements
  301                                      form.set Attribute( 'action',a );
  302                                      if(t) {
  303                                               form.setAt tribute('t arget', t) ;
  304                                      } else {
  305                                               $form.remo veAttr('ta rget');
  306                                      }
  307                                      $(extraI nputs).rem ove();
  308                             }
  309                    }
  310  
  311                    if ( s.forceSyn c) {
  312                             doSubm it();
  313                    }
  314                    else  {
  315                             setTim eout(doSub mit, 10);  // this le ts dom upd ates rende r
  316                    }
  317           
  318                    var  data, doc,  domCheckC ount = 50;
  319  
  320                    func tion cb()  {
  321                             if (cb Invoked) {
  322                                      return;
  323                             }
  324  
  325                             $io.re moveData(' form-plugi n-onload') ;
  326                             
  327                             var ok  = true;
  328                             try {
  329                                      if (time dOut) {
  330                                               throw 'tim eout';
  331                                      }
  332                                      // extra ct the ser ver respon se from th e iframe
  333                                      doc = io .contentWi ndow ? io. contentWin dow.docume nt : io.co ntentDocum ent ? io.c ontentDocu ment : io. document;
  334                                      
  335                                      var isXm l = s.data Type == 'x ml' || doc .XMLDocume nt || $.is XMLDoc(doc );
  336                                      log('isX ml='+isXml );
  337                                      if (!isX ml && wind ow.opera & & (doc.bod y == null  || doc.bod y.innerHTM L == ''))  {
  338                                               if (--domC heckCount)  {
  339                                                       //  in some b rowsers (O pera) the  iframe DOM  is not al ways trave rsable whe n
  340                                                       //  the onloa d callback  fires, so  we loop a  bit to ac commodate
  341                                                       lo g('requein g onLoad c allback, D OM not ava ilable');
  342                                                       se tTimeout(c b, 250);
  343                                                       re turn;
  344                                               }
  345                                               // let thi s fall thr ough becau se server  response c ould be an  empty doc ument
  346                                               //log('Cou ld not acc ess iframe  DOM after  mutiple t ries.');
  347                                               //throw 'D OMExceptio n: not ava ilable';
  348                                      }
  349  
  350                                      //log('r esponse de tected');
  351                                      cbInvoke d = true;
  352                                      xhr.resp onseText =  doc.docum entElement  ? doc.doc umentEleme nt.innerHT ML : null;  
  353                                      xhr.resp onseXML =  doc.XMLDoc ument ? do c.XMLDocum ent : doc;
  354                                      xhr.getR esponseHea der = func tion(heade r){
  355                                               var header s = {'cont ent-type':  s.dataTyp e};
  356                                               return hea ders[heade r];
  357                                      };
  358  
  359                                      var scr  = /(json|s cript)/.te st(s.dataT ype);
  360                                      if (scr  || s.texta rea) {
  361                                               // see if  user embed ded respon se in text area
  362                                               var ta = d oc.getElem entsByTagN ame('texta rea')[0];
  363                                               if (ta) {
  364                                                       xh r.response Text = ta. value;
  365                                               }
  366                                               else if (s cr) {
  367                                                       //  account f or browser s injectin g pre arou nd json re sponse
  368                                                       va r pre = do c.getEleme ntsByTagNa me('pre')[ 0];
  369                                                       if  (pre) {
  370                                                                xhr. responseTe xt = pre.i nnerHTML;
  371                                                       }
  372                                               }                           
  373                                      }
  374                                      else if  (s.dataTyp e == 'xml'  && !xhr.r esponseXML  && xhr.re sponseText  != null)  {
  375                                               xhr.respon seXML = to Xml(xhr.re sponseText );
  376                                      }
  377                                      data = $ .httpData( xhr, s.dat aType);
  378                             }
  379                             catch( e){
  380                                      log('err or caught: ',e);
  381                                      ok = fal se;
  382                                      xhr.erro r = e;
  383                                      $.handle Error(s, x hr, 'error ', e);
  384                             }
  385  
  386                             // ord ering of t hese callb acks/trigg ers is odd , but that 's how $.a jax does i t
  387                             if (ok ) {
  388                                      s.succes s.call(s.c ontext, da ta, 'succe ss', xhr);
  389                                      if (g) {
  390                                               $.event.tr igger("aja xSuccess",  [xhr, s]) ;
  391                                      }
  392                             }
  393                             if (g)  {
  394                                      $.event. trigger("a jaxComplet e", [xhr,  s]);
  395                             }
  396                             if (g  && ! --$.a ctive) {
  397                                      $.event. trigger("a jaxStop");
  398                             }
  399                             if (s. complete)  {
  400                                      s.comple te.call(s. context, x hr, ok ? ' success' :  'error');
  401                             }
  402  
  403                             // cle an up
  404                             setTim eout(funct ion() {
  405                                      $io.remo veData('fo rm-plugin- onload');
  406                                      $io.remo ve();
  407                                      xhr.resp onseXML =  null;
  408                             }, 100 );
  409                    }
  410  
  411                    func tion toXml (s, doc) {
  412                             if (wi ndow.Activ eXObject)  {
  413                                      doc = ne w ActiveXO bject('Mic rosoft.XML DOM');
  414                                      doc.asyn c = 'false ';
  415                                      doc.load XML(s);
  416                             }
  417                             else {
  418                                      doc = (n ew DOMPars er()).pars eFromStrin g(s, 'text /xml');
  419                             }
  420                             return  (doc && d oc.documen tElement & & doc.docu mentElemen t.tagName  != 'parser error') ?  doc : null ;
  421                    }
  422           }
  423   };
  424  
  425   /**
  426    * ajaxFor m() provid es a mecha nism for f ully autom ating form  submissio n.
  427    *
  428    * The adv antages of  using thi s method i nstead of  ajaxSubmit () are:
  429    *
  430    * 1: This  method wi ll include  coordinat es for <in put type=" image" />  elements ( if the ele ment
  431    *      is  used to s ubmit the  form).
  432    * 2. This  method wi ll include  the submi t element' s name/val ue data (f or the ele ment that  was
  433    *      us ed to subm it the for m).
  434    * 3. This  method bi nds the su bmit() met hod to the  form for  you.
  435    *
  436    * The opt ions argum ent for aj axForm wor ks exactly  as it doe s for ajax Submit.  a jaxForm me rely
  437    * passes  the option s argument  along aft er properl y binding  events for  submit el ements and
  438    * the for m itself.
  439    */
  440   $.fn.ajaxF orm = func tion(optio ns) {
  441           //  in jQuery  1.3+ we c an fix mis takes with  the ready  state
  442           if  (this.len gth === 0)  {
  443                    var  o = { s: t his.select or, c: thi s.context  };
  444                    if ( !$.isReady  && o.s) {
  445                             log('D OM not rea dy, queuin g ajaxForm ');
  446                             $(func tion() {
  447                                      $(o.s,o. c).ajaxFor m(options) ;
  448                             });
  449                             return  this;
  450                    }
  451                    // i s your DOM  ready?  h ttp://docs .jquery.co m/Tutorial s:Introduc ing_$(docu ment).read y()
  452                    log( 'terminati ng; zero e lements fo und by sel ector' + ( $.isReady  ? '' : ' ( DOM not re ady)'));
  453                    retu rn this;
  454           }
  455           
  456           re turn this. ajaxFormUn bind().bin d('submit. form-plugi n', functi on(e) {
  457                    if ( !e.isDefau ltPrevente d()) { //  if event h as been ca nceled, do n't procee d
  458                             e.prev entDefault ();
  459                             $(this ).ajaxSubm it(options );
  460                    }
  461           }) .bind('cli ck.form-pl ugin', fun ction(e) {
  462                    var  target = e .target;
  463                    var  $el = $(ta rget);
  464                    if ( !($el.is(" :submit,in put:image" ))) {
  465                             // is  this a chi ld element  of the su bmit el?   (ex: a spa n within a  button)
  466                             var t  = $el.clos est(':subm it');
  467                             if (t. length ==  0) {
  468                                      return;
  469                             }
  470                             target  = t[0];
  471                    }
  472                    var  form = thi s;
  473                    form .clk = tar get;
  474                    if ( target.typ e == 'imag e') {
  475                             if (e. offsetX !=  undefined ) {
  476                                      form.clk _x = e.off setX;
  477                                      form.clk _y = e.off setY;
  478                             } else  if (typeo f $.fn.off set == 'fu nction') {  // try to  use dimen sions plug in
  479                                      var offs et = $el.o ffset();
  480                                      form.clk _x = e.pag eX - offse t.left;
  481                                      form.clk _y = e.pag eY - offse t.top;
  482                             } else  {
  483                                      form.clk _x = e.pag eX - targe t.offsetLe ft;
  484                                      form.clk _y = e.pag eY - targe t.offsetTo p;
  485                             }
  486                    }
  487                    // c lear form  vars
  488                    setT imeout(fun ction() {  form.clk =  form.clk_ x = form.c lk_y = nul l; }, 100) ;
  489           }) ;
  490   };
  491  
  492   // ajaxFor mUnbind un binds the  event hand lers that  were bound  by ajaxFo rm
  493   $.fn.ajaxF ormUnbind  = function () {
  494           re turn this. unbind('su bmit.form- plugin cli ck.form-pl ugin');
  495   };
  496  
  497   /**
  498    * formToA rray() gat hers form  element da ta into an  array of  objects th at can
  499    * be pass ed to any  of the fol lowing aja x function s: $.get,  $.post, or  load.
  500    * Each ob ject in th e array ha s both a ' name' and  'value' pr operty.  A n example  of
  501    * an arra y for a si mple login  form migh t be:
  502    *
  503    * [ { nam e: 'userna me', value : ' PW ' }, { nam e: 'passwo rd', value : ' PW      ' } ]
  504    *
  505    * It is t his array  that is pa ssed to pr e-submit c allback fu nctions pr ovided to  the
  506    * ajaxSub mit() and  ajaxForm()  methods.
  507    */
  508   $.fn.formT oArray = f unction(se mantic) {
  509           va r a = [];
  510           if  (this.len gth === 0)  {
  511                    retu rn a;
  512           }
  513  
  514           va r form = t his[0];
  515           va r els = se mantic ? f orm.getEle mentsByTag Name('*')  : form.ele ments;
  516           if  (!els) {
  517                    retu rn a;
  518           }
  519           
  520           va r i,j,n,v, el;
  521           fo r(i=0, max =els.lengt h; i < max ; i++) {
  522                    el =  els[i];
  523                    n =  el.name;
  524                    if ( !n) {
  525                             contin ue;
  526                    }
  527  
  528                    if ( semantic & & form.clk  && el.typ e == "imag e") {
  529                             // han dle image  inputs on  the fly wh en semanti c == true
  530                             if(!el .disabled  && form.cl k == el) {
  531                                      a.push({ name: n, v alue: $(el ).val()});
  532                                      a.push({ name: n+'. x', value:  form.clk_ x}, {name:  n+'.y', v alue: form .clk_y});
  533                             }
  534                             contin ue;
  535                    }
  536  
  537                    v =  $.fieldVal ue(el, tru e);
  538                    if ( v && v.con structor = = Array) {
  539                             for(j= 0, jmax=v. length; j  < jmax; j+ +) {
  540                                      a.push({ name: n, v alue: v[j] });
  541                             }
  542                    }
  543                    else  if (v !==  null && t ypeof v !=  'undefine d') {
  544                             a.push ({name: n,  value: v} );
  545                    }
  546           }
  547  
  548           if  (!semanti c && form. clk) {
  549                    // i nput type= ='image' a re not fou nd in elem ents array ! handle i t here
  550                    var  $input = $ (form.clk) , input =  $input[0];
  551                    n =  input.name ;
  552                    if ( n && !inpu t.disabled  && input. type == 'i mage') {
  553                             a.push ({name: n,  value: $i nput.val() });
  554                             a.push ({name: n+ '.x', valu e: form.cl k_x}, {nam e: n+'.y',  value: fo rm.clk_y}) ;
  555                    }
  556           }
  557           re turn a;
  558   };
  559  
  560   /**
  561    * Seriali zes form d ata into a  'submitta ble' strin g. This me thod will  return a s tring
  562    * in the  format: na me1=value1 &amp;name2 =value2
  563    */
  564   $.fn.formS erialize =  function( semantic)  {
  565           // hand off t o jQuery.p aram for p roper enco ding
  566           re turn $.par am(this.fo rmToArray( semantic)) ;
  567   };
  568  
  569   /**
  570    * Seriali zes all fi eld elemen ts in the  jQuery obj ect into a  query str ing.
  571    * This me thod will  return a s tring in t he format:  name1=val ue1&amp;na me2=value2
  572    */
  573   $.fn.field Serialize  = function (successfu l) {
  574           va r a = [];
  575           th is.each(fu nction() {
  576                    var  n = this.n ame;
  577                    if ( !n) {
  578                             return ;
  579                    }
  580                    var  v = $.fiel dValue(thi s, success ful);
  581                    if ( v && v.con structor = = Array) {
  582                             for (v ar i=0,max =v.length;  i < max;  i++) {
  583                                      a.push({ name: n, v alue: v[i] });
  584                             }
  585                    }
  586                    else  if (v !==  null && t ypeof v !=  'undefine d') {
  587                             a.push ({name: th is.name, v alue: v});
  588                    }
  589           }) ;
  590           // hand off t o jQuery.p aram for p roper enco ding
  591           re turn $.par am(a);
  592   };
  593  
  594   /**
  595    * Returns  the value (s) of the  element i n the matc hed set.   For exampl e, conside r the foll owing form :
  596    *
  597    *  <form> <fieldset>
  598    *         <input nam e="A" type ="text" />
  599    *         <input nam e="A" type ="text" />
  600    *         <input nam e="B" type ="checkbox " value="B 1" />
  601    *         <input nam e="B" type ="checkbox " value="B 2"/>
  602    *         <input nam e="C" type ="radio" v alue="C1"  />
  603    *         <input nam e="C" type ="radio" v alue="C2"  />
  604    *  </fiel dset></for m>
  605    *
  606    *  var v  = $(':text ').fieldVa lue();
  607    *  // if  no values  are entere d into the  text inpu ts
  608    *  v == [ '','']
  609    *  // if  values ent ered into  the text i nputs are  'foo' and  'bar'
  610    *  v == [ 'foo','bar ']
  611    *
  612    *  var v  = $(':chec kbox').fie ldValue();
  613    *  // if  neither ch eckbox is  checked
  614    *  v ===  undefined
  615    *  // if  both check boxes are  checked
  616    *  v == [ 'B1', 'B2' ]
  617    *
  618    *  var v  = $(':radi o').fieldV alue();
  619    *  // if  neither ra dio is che cked
  620    *  v ===  undefined
  621    *  // if  first radi o is check ed
  622    *  v == [ 'C1']
  623    *
  624    * The suc cessful ar gument con trols whet her or not  the field  element m ust be 'su ccessful'
  625    * (per ht tp://www.w 3.org/TR/h tml4/inter act/forms. html#succe ssful-cont rols).
  626    * The def ault value  of the su ccessful a rgument is  true.  If  this valu e is false  the value (s)
  627    * for eac h element  is returne d.
  628    *
  629    * Note: T his method  *always*  returns an  array.  I f no valid  value can  be determ ined the
  630    *          array wil l be empty , otherwis e it will  contain on e or more  values.
  631    */
  632   $.fn.field Value = fu nction(suc cessful) {
  633           fo r (var val =[], i=0,  max=this.l ength; i <  max; i++)  {
  634                    var  el = this[ i];
  635                    var  v = $.fiel dValue(el,  successfu l);
  636                    if ( v === null  || typeof  v == 'und efined' ||  (v.constr uctor == A rray && !v .length))  {
  637                             contin ue;
  638                    }
  639                    v.co nstructor  == Array ?  $.merge(v al, v) : v al.push(v) ;
  640           }
  641           re turn val;
  642   };
  643  
  644   /**
  645    * Returns  the value  of the fi eld elemen t.
  646    */
  647   $.fieldVal ue = funct ion(el, su ccessful)  {
  648           va r n = el.n ame, t = e l.type, ta g = el.tag Name.toLow erCase();
  649           if  (successf ul === und efined) {
  650                    succ essful = t rue;
  651           }
  652  
  653           if  (successf ul && (!n  || el.disa bled || t  == 'reset'  || t == ' button' ||
  654                    (t = = 'checkbo x' || t ==  'radio')  && !el.che cked ||
  655                    (t = = 'submit'  || t == ' image') &&  el.form & & el.form. clk != el  ||
  656                    tag  == 'select ' && el.se lectedInde x == -1))  {
  657                             return  null;
  658           }
  659  
  660           if  (tag == ' select') {
  661                    var  index = el .selectedI ndex;
  662                    if ( index < 0)  {
  663                             return  null;
  664                    }
  665                    var  a = [], op s = el.opt ions;
  666                    var  one = (t = = 'select- one');
  667                    var  max = (one  ? index+1  : ops.len gth);
  668                    for( var i=(one  ? index :  0); i < m ax; i++) {
  669                             var op  = ops[i];
  670                             if (op .selected)  {
  671                                      var v =  op.value;
  672                                      if (!v)  { // extra  pain for  IE...
  673                                               v = (op.at tributes & & op.attri butes['val ue'] && !( op.attribu tes['value '].specifi ed)) ? op. text : op. value;
  674                                      }
  675                                      if (one)  {
  676                                               return v;
  677                                      }
  678                                      a.push(v );
  679                             }
  680                    }
  681                    retu rn a;
  682           }
  683           re turn $(el) .val();
  684   };
  685  
  686   /**
  687    * Clears  the form d ata.  Take s the foll owing acti ons on the  form's in put fields :
  688    *  - inpu t text fie lds will h ave their  'value' pr operty set  to the em pty string
  689    *  - sele ct element s will hav e their 's electedInd ex' proper ty set to  -1
  690    *  - chec kbox and r adio input s will hav e their 'c hecked' pr operty set  to false
  691    *  - inpu ts of type  submit, b utton, res et, and hi dden will  *not* be e ffected
  692    *  - butt on element s will *no t* be effe cted
  693    */
  694   $.fn.clear Form = fun ction() {
  695           re turn this. each(funct ion() {
  696                    $('i nput,selec t,textarea ', this).c learFields ();
  697           }) ;
  698   };
  699  
  700   /**
  701    * Clears  the select ed form el ements.
  702    */
  703   $.fn.clear Fields = $ .fn.clearI nputs = fu nction() {
  704           re turn this. each(funct ion() {
  705                    var  t = this.t ype, tag =  this.tagN ame.toLowe rCase();
  706                    if ( t == 'text ' || t ==  'password'  || tag ==  'textarea ') {
  707                             this.v alue = '';
  708                    }
  709                    else  if (t ==  'checkbox'  || t == ' radio') {
  710                             this.c hecked = f alse;
  711                    }
  712                    else  if (tag = = 'select' ) {
  713                             this.s electedInd ex = -1;
  714                    }
  715           }) ;
  716   };
  717  
  718   /**
  719    * Resets  the form d ata.  Caus es all for m elements  to be res et to thei r original  value.
  720    */
  721   $.fn.reset Form = fun ction() {
  722           re turn this. each(funct ion() {
  723                    // g uard again st an inpu t with the  name of ' reset'
  724                    // n ote that I E reports  the reset  function a s an 'obje ct'
  725                    if ( typeof thi s.reset ==  'function ' || (type of this.re set == 'ob ject' && ! this.reset .nodeType) ) {
  726                             this.r eset();
  727                    }
  728           }) ;
  729   };
  730  
  731   /**
  732    * Enables  or disabl es any mat ching elem ents.
  733    */
  734   $.fn.enabl e = functi on(b) {
  735           if  (b === un defined) {
  736                    b =  true;
  737           }
  738           re turn this. each(funct ion() {
  739                    this .disabled  = !b;
  740           }) ;
  741   };
  742  
  743   /**
  744    * Checks/ unchecks a ny matchin g checkbox es or radi o buttons  and
  745    * selects /deselects  and match ing option  elements.
  746    */
  747   $.fn.selec ted = func tion(selec t) {
  748           if  (select = == undefin ed) {
  749                    sele ct = true;
  750           }
  751           re turn this. each(funct ion() {
  752                    var  t = this.t ype;
  753                    if ( t == 'chec kbox' || t  == 'radio ') {
  754                             this.c hecked = s elect;
  755                    }
  756                    else  if (this. tagName.to LowerCase( ) == 'opti on') {
  757                             var $s el = $(thi s).parent( 'select');
  758                             if (se lect && $s el[0] && $ sel[0].typ e == 'sele ct-one') {
  759                                      // desel ect all ot her option s
  760                                      $sel.fin d('option' ).selected (false);
  761                             }
  762                             this.s elected =  select;
  763                    }
  764           }) ;
  765   };
  766  
  767   // helper  fn for con sole loggi ng
  768   // set $.f n.ajaxSubm it.debug t o true to  enable deb ug logging
  769   function l og() {
  770           if  ($.fn.aja xSubmit.de bug) {
  771                    var  msg = '[jq uery.form]  ' + Array .prototype .join.call (arguments ,'');
  772                    if ( window.con sole && wi ndow.conso le.log) {
  773                             window .console.l og(msg);
  774                    }
  775                    else  if (windo w.opera &&  window.op era.postEr ror) {
  776                             window .opera.pos tError(msg );
  777                    }
  778           }
  779   };
  780  
  781   })(jQuery) ;