除非您通過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