git-svn-id: https://msi/svn/firstRepo/WebClient/branches/Manut_2.2.3@24 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
+16
-3
@@ -156,6 +156,19 @@ var openGPlus = (function () {
|
||||
function logout() {
|
||||
tokenStore['gplustoken'] = undefined;
|
||||
}
|
||||
|
||||
function createHttpReq(callbackFn){
|
||||
var request;
|
||||
if (window.XDomainRequest) {
|
||||
request = new window.XDomainRequest();
|
||||
request.onload = callbackFn;
|
||||
}
|
||||
else {
|
||||
request = new XMLHttpRequest();
|
||||
request.onreadystatechange = callbackFn;
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets you make any Facebook Graph API request.
|
||||
@@ -171,14 +184,14 @@ var openGPlus = (function () {
|
||||
var method = obj.method || 'GET',
|
||||
baseUrl = obj.baseUrl || 'https://www.googleapis.com/plus/v1/',
|
||||
params = obj.params || {},
|
||||
xhr = new XMLHttpRequest(),
|
||||
url;
|
||||
|
||||
params['access_token'] = tokenStore['gplustoken'];
|
||||
|
||||
url = baseUrl + obj.path + '?' + toQueryString(params);
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
//xhr.onreadystatechange =
|
||||
var xhr = createHttpReq(function () {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status === 200) {
|
||||
if (obj.success) obj.success(JSON.parse(xhr.responseText));
|
||||
@@ -187,7 +200,7 @@ var openGPlus = (function () {
|
||||
if (obj.error) obj.error(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
xhr.open(method, url, true);
|
||||
xhr.send();
|
||||
|
||||
Reference in New Issue
Block a user