|
|
@ -14,9 +14,14 @@ jx.cloudview.init = function(url,redir_url){//host,protocol){
|
|
|
|
// jx.cloudview.host = host
|
|
|
|
// jx.cloudview.host = host
|
|
|
|
// jx.cloudview.protocol = protocol
|
|
|
|
// jx.cloudview.protocol = protocol
|
|
|
|
jx.cloudview.url = url.trim().replace(/\/$/,'')
|
|
|
|
jx.cloudview.url = url.trim().replace(/\/$/,'')
|
|
|
|
|
|
|
|
jx.cloudview.host = url.match(/^.+\/\/([a-z,0-9,.,-]+)\/.+$/)[1]
|
|
|
|
|
|
|
|
jx.cloudview.protocol = url.match(/^(https|http).+/)[1]
|
|
|
|
if(redir_url != null){
|
|
|
|
if(redir_url != null){
|
|
|
|
jx.cloudview.redirect_url = redir_url
|
|
|
|
jx.cloudview.redirect_url = redir_url
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(jx.cloudview.handler != null){
|
|
|
|
|
|
|
|
clearInterval(jx.cloudview.handler)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
jx.cloudview.oauth.init = function (id, key,callback,err) {
|
|
|
|
jx.cloudview.oauth.init = function (id, key,callback,err) {
|
|
|
|
// var url = ":protocol://:host/cloud-view/" +id+"/get"
|
|
|
|
// var url = ":protocol://:host/cloud-view/" +id+"/get"
|
|
|
@ -81,9 +86,16 @@ jx.cloudview.oauth.listen = function (key,callback,err) {
|
|
|
|
http.setHeader('platform', navigator.appName)
|
|
|
|
http.setHeader('platform', navigator.appName)
|
|
|
|
http.setHeader('redirect_uri', key)
|
|
|
|
http.setHeader('redirect_uri', key)
|
|
|
|
http.post(url, function (x) {
|
|
|
|
http.post(url, function (x) {
|
|
|
|
|
|
|
|
try{
|
|
|
|
var info = JSON.parse(x.responseText)
|
|
|
|
var info = JSON.parse(x.responseText)
|
|
|
|
callback(info)
|
|
|
|
callback(info)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch(e){
|
|
|
|
|
|
|
|
if (err != null){
|
|
|
|
|
|
|
|
err(e)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// jx.dom.set.value('name', info.user.uii)
|
|
|
|
// jx.dom.set.value('name', info.user.uii)
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -99,8 +111,9 @@ jx.cloudview.oauth.listen = function (key,callback,err) {
|
|
|
|
if(jx.cloudview.popup != null){
|
|
|
|
if(jx.cloudview.popup != null){
|
|
|
|
if(jx.cloudview.popup.closed){
|
|
|
|
if(jx.cloudview.popup.closed){
|
|
|
|
clearInterval(jx.cloudview.handler)
|
|
|
|
clearInterval(jx.cloudview.handler)
|
|
|
|
|
|
|
|
callback(null)
|
|
|
|
if (err != null){
|
|
|
|
if (err != null){
|
|
|
|
err()
|
|
|
|
err(error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|