Select service tester

See tester for Store, or Update service.

User #1 email:  
User #1 display name:  
User #1 photo URL:  
User #1 Provider ID:  
 
User #2 email:  
User #2 display name:  
User #2 photo URL:  
User #2 Provider ID:  
 
IDP List (one per line):  
 
Favicon URL:  
Window Title:  
Branding URL:  
 

Below is the code used in the demo.

See client API library doc for API details. Or learn more from Account Chooser Working Group.
function done(result, error) {
  client.closePopupWindow();
  if (result) {
    alert('receive result: ' + JSON.stringify(result));
  } else {
    alert('receive error: ' + JSON.stringify(error));
  }
}

var client = window.accountchooser.CdsClient.init({
  popupMode: false,
  popupWidth: 640,
  popupHeight: 480,
  clientCallbackUrl: window.location.protocol + '//gitkit-tool.appspot.com/select.htm',
  callbacks: {
    select: done
  }});

var doSelect = function() {
  client.changePopupModeTo(jQuery('#popupMode').prop('checked'));
  if (jQuery('#includeLocal').prop('checked')) {
    var accounts = [
      {
        email: jQuery('#email1').val(),
        displayName: jQuery('#displayName1').val(),
        photoUrl: jQuery('#photoUrl1').val(),
        providerId: jQuery('#providerId1').val()
      },
      {
        email: jQuery('#email2').val(),
        displayName: jQuery('#displayName2').val(),
        photoUrl: jQuery('#photoUrl2').val(),
        providerId: jQuery('#providerId2').val()
      }
    ];
  }
  var cdsOptions = {
    showAll: jQuery('#showAll').prop('checked'),
    language: jQuery('#language').val()
  };
  var providers = jQuery.trim(jQuery('#providers').val();
  if (providers) {
    cdsOptions.providers = providers.split(/\s+/);
  }
  if (jQuery('#useCustomizedUI').prop('checked')) {
    cdsOptions.ui = {
      favicon: jQuery('#favicon').val(),
      title: jQuery('#title').val(),
      branding: jQuery('#main').val()
    }
  }
  client.select(accounts, cdsOptions);
};