init
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,37 @@
|
||||
(function () {
|
||||
|
||||
var config = JSON.parse(document.getElementById("config").innerHTML);
|
||||
|
||||
if (config.setCredentialToken) {
|
||||
var credentialToken = config.credentialToken;
|
||||
var credentialSecret = config.credentialSecret;
|
||||
|
||||
if (config.isCordova) {
|
||||
var credentialString = JSON.stringify({
|
||||
credentialToken: credentialToken,
|
||||
credentialSecret: credentialSecret
|
||||
});
|
||||
|
||||
window.location.hash = credentialString;
|
||||
}
|
||||
|
||||
if (window.opener && window.opener.Package &&
|
||||
window.opener.Package.oauth) {
|
||||
window.opener.Package.oauth.OAuth._handleCredentialSecret(
|
||||
credentialToken, credentialSecret);
|
||||
} else {
|
||||
try {
|
||||
localStorage[config.storagePrefix + credentialToken] = credentialSecret;
|
||||
} catch (err) {
|
||||
// We can't do much else, but at least close the popup instead
|
||||
// of having it hang around on a blank page.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! config.isCordova) {
|
||||
document.getElementById("completedText").style.display = "block";
|
||||
document.getElementById("loginCompleted").onclick = function(){ window.close(); };
|
||||
window.close();
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,15 @@
|
||||
(function () {
|
||||
|
||||
var config = JSON.parse(document.getElementById("config").innerHTML);
|
||||
|
||||
if (config.setCredentialToken) {
|
||||
sessionStorage[config.storagePrefix + config.credentialToken] =
|
||||
config.credentialSecret;
|
||||
}
|
||||
|
||||
window.location =
|
||||
config.redirectUrl
|
||||
? config.redirectUrl.replace(/&/g, "&")
|
||||
: config.redirectUrl;
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user