Commit 77a99609 authored by campaign's avatar campaign

Merge remote-tracking branch 'origin/dev' into dev

parents 22ea87c5 21f15934
......@@ -1463,13 +1463,13 @@ baidu.frontia = {}, function(e) {
return e.every(function(e) {
return "file" !== e.type || e.value && e.value instanceof File ? "string" !== e.type || e.value && "string" == typeof e.value ? "array" !== e.type || e.value && "Array" === Object.prototype.toString.call(e.value).slice(8, -1) ? !0 : (r.options.error(new o(i.INVALID_PARAMS, "[" + t + "]: targets is invalid")), !1) : (r.options.error(new o(i.INVALID_PARAMS, "[" + t + "]: target is invalid")), !1) : (r.options.error(new o(i.INVALID_PARAMS, "[" + t + "]: file is null or not typeof File of DOM")), !1)
})
},_createAjaxOpt: function(t, r) {
},_createAjaxOpt: function(t, r, cb) {
var i = this, s = {callback: function(e) {
if (e.error_code) {
var r = new o(e);
i.options.error(r), t.err_code = r.code, t.err_msg = r.message
} else
i.options.success(e), t.err_code = 0;
(cb && cb.success || i.options.success)(e), t.err_code = 0;
t.restimestamp = a(), n(t)
},onerror: function(r, s) {
try {
......@@ -1518,13 +1518,13 @@ baidu.frontia = {}, function(e) {
var t = new o(e);
u.options.error(t), c.err_code = t.code, c.err_msg = t.message
} else
u.options.success(p), c.err_code = 0;
(s.success || u.options.success)(p), c.err_code = 0;
c.restimestamp = a(), n(c)
},onerror: function(t, r) {
try {
var i = e.util.parseJSON(t.responseText)
} catch (s) {
return u.options.error(s, t), void 0
} catch (ss) {
return (s.error || u.options.error)(ss, t), void 0
}
var r = new o(i);
u.options.error(r, t), c.err_code = r.code, c.err_msg = r.message, c.restimestamp = a(), n(c)
......@@ -1550,7 +1550,7 @@ baidu.frontia = {}, function(e) {
o.method = "list";
var c = e.getCurrentAccount();
c && (accessToken = c.getAccessToken()), o.access_token = accessToken;
var u = t(n, o, ["success", "error"]), f = r("file?", u.query), l = s._createAjaxOpt(i, {dataType: "json"}), p = e.ajax;
var u = t(n, o, ["success", "error"]), f = r("file?", u.query), l = s._createAjaxOpt(i, {dataType: "json"}, o), p = e.ajax;
p.get(f, {}, l)
}
},listStreamFile: function(n) {
......
......@@ -63,6 +63,8 @@ $( function () {
// 当前连接是否指示要加载一个分享的脑图
isShareLink,
isPathLink,
uuid = function () {
return ( ( +new Date() * 10000 ) + ( Math.random() * 9999 ) ).toString( 36 );
},
......@@ -90,12 +92,11 @@ $( function () {
initUI();
initFrontia();
loadShare();
loadPath();
checkLogin();
bindShortCuts();
watchChanges();
bindDraft();
loadDraft( 0 );
watchChanges();
if ( !loadPath() && !isShareLink ) loadDraft( 0 );
}
// 创建 UI
......@@ -220,8 +221,17 @@ $( function () {
// documemt.referrer 是为了支持被嵌在 iframe 里的情况
var match = pattern.exec( window.location ) || pattern.exec( document.referrer );
if ( !match ) return;
if ( !currentAccount ) {
setTimeout( function () {
if ( !currentAccount ) return login();
setRemotePath( decodeURIComponent( match[ 1 ], true ) );
loadRemote();
}, 1000 );
return false;
}
setRemotePath( decodeURIComponent( match[ 1 ], true ) );
loadRemote();
return true;
}
function setRemotePath( path, saved ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment