除非您通过OAuth授权每个帐户(这是不可接受的方法),否则无法检查用户是否登录到多个帐户。这是我的可怕的变通办法这个错误。
免责声明:
1.这是一个setTimeout
观察家:(
2.这依赖于一个事实的用户使用的是英语语言环境:(:(
3.这依赖于一个事实,即文本正是:。Sorry, sharing is unavailable at this time. Please try again later.
:(:(:(
var TIME_LIMIT_SECONDS = 35;
var errorTimer = null;
var startTime = null;
// Call this function after you call showSettingsDialog()
function watchForErrors() {
startTime = new Date().getTime();
startErrorTimer();
};
// Starts the error check
function startErrorTimer() {
errorTimer = setTimeout(function() {
var $test = $(".dcs-cd-dcs-c-dcs-eb").filter(function() { return $(this).text().trim() === "Sorry, sharing is unavailable at this time. Please try again later."; });
if ($test.length) {
// Message detected...do something
console.log("Error Found!");
// Close the share dialog
$("span.dcs-cd-dcs-c-dcs-k-dcs-bc[role='button']").trigger("click");
return;
}
if ((new Date().getTime() - startTime)/1000 < TIME_LIMIT_SECONDS) {
// No errors detected. Could be a success at this point
startErrorTimer();
} else {
// No errors found after 35 seconds - probably a success?
console.log("Timeout - Success?");
}
}, 200);
};
我要做的就是,只要我打电话showSettingsDialog()
显示共享对话框后面一个成功的消息。如果方法失败,我关闭对话框的份额。如果方法成功,用户将克隆在对话&看到我的成功消息。
哎哟,确实......太可怕了。很可能我需要去的深度。我需要考虑这一点 - 非常感谢你发布。 – bleeper 2014-10-09 10:55:58