Select service tester
See tester for Store, or Update service.
Below is the code used in the demo.
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);
};