window.layout = window.layout || {}; function getServiceAddress(config, callback){ window.layout.config = config; if (config.configMapping && (config.configMapping[window.location.host] || config.configMapping[window.location.hostname])) { var mapping = config.configMapping[window.location.host] || config.configMapping[window.location.hostname]; if (mapping.servers){ window.layout.serviceAddressList = mapping.servers; if (mapping.center) center = (o2.typeOf(mapping.center)==="array") ? mapping.center[0] : mapping.center; window.layout.centerServer = center; if (callback) callback(); }else{ if (mapping.center) layout.config.center = (o2.typeOf(mapping.center)==="array") ? mapping.center : [mapping.center]; getServiceAddressConfigArray(layout.config, callback); } }else{ if (typeOf(config.center)=="object"){ getServiceAddressConfigObject(callback); }else if (typeOf(config.center)=="array"){ // var center = chooseCenter(config); // if (center){ // getServiceAddressConfigObject(callback, center); // }else{ getServiceAddressConfigArray(config, callback); // } } } } function chooseCenter(config){ var host = window.location.host; var center = null; for (var i=0; i