public/js/chrome/share.js
function formData(form) {
    var length = form.length;
    var data = {};
    var value;
    var el;
    var type;
    var name;

    var append = function (data, name, value) {
      if (data[name] === undefined) {
        data[name] = value;
      } else {
        if (typeof data[name] === 'string') {
          data[name] = [data[name]];
        }
        data[name].push(value);
      }
    };

    for (var i = 0; i < length; i++) {
      el = form[i];
      value = el.value;
      type = el.type;
      name = el.name;

      if (type === 'radio') {
        if (el.checked) {
          append(data, name, value);
        }
      } else if (type === 'checkbox') {
        if (data[name] === undefined) {
          data[name] = [];
        }
        if (el.checked) {
          append(data, name, value);
        }
      } else {
        append(data, name, value);
      }
    }

    return data;
  }
function formData(form) {
    var length = form.length;
    var data = {};
    var value;
    var el;
    var type;
    var name;

    var append = function (data, name, value) {
      if (data[name] === undefined) {
        data[name] = value;
      } else {
        if (typeof data[name] === 'string') {
          data[name] = [data[name]];
        }
        data[name].push(value);
      }
    };

    for (var i = 0; i < length; i++) {
      el = form[i];
      value = el.value;
      type = el.type;
      name = el.name;

      if (type === 'radio') {
        if (el.checked) {
          append(data, name, value);
        }
      } else if (type === 'checkbox') {
        if (data[name] === undefined) {
          data[name] = [];
        }
        if (el.checked) {
          append(data, name, value);
        }
      } else {
        append(data, name, value);
      }
    }

    return data;
  }
function formData ( form ) { var length = form . length ; var data = { } ; var value ; var el ; var type ; var name ; var append = function ( data , name , value ) { if ( data [ name ] === undefined ) { data [ name ] = value ; } else { if ( typeof data [ name ] === 'string' ) { data [ name ] = [ data [ name ] ] ; } data [ name ] . push ( value ) ; } } ; for ( var i = 0 ; i < length ; i ++ ) { el = form [ i ] ; value = el . value ; type = el . type ; name = el . name ; if ( type === 'radio' ) { if ( el . checked ) { append ( data , name , value ) ; } } else if ( type === 'checkbox' ) { if ( data [ name ] === undefined ) { data [ name ] = [ ] ; } if ( el . checked ) { append ( data , name , value ) ; } } else { append ( data , name , value ) ; } } return data ; }
get an object representation of a form's state
get an object representation of a form s state