mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Use window.opener in popup rather than polling. Fixes #789
This commit is contained in:
@@ -73,17 +73,13 @@ iD.OAuth = function(context) {
|
||||
['top', screen.height / 2 - h / 2]].map(function(x) {
|
||||
return x.join('=');
|
||||
}).join(','),
|
||||
popup = window.open("about:blank", 'oauth_window', settings),
|
||||
locationCheck = window.setInterval(function() {
|
||||
if (popup.closed) return window.clearInterval(locationCheck);
|
||||
if (popup.location.search) {
|
||||
var search = popup.location.search,
|
||||
oauth_token = ohauth.stringQs(search.slice(1));
|
||||
popup.close();
|
||||
get_access_token(oauth_token);
|
||||
window.clearInterval(locationCheck);
|
||||
}
|
||||
}, 100);
|
||||
popup = window.open("about:blank", 'oauth_window', settings);
|
||||
|
||||
window.authComplete = function(token) {
|
||||
var oauth_token = ohauth.stringQs(token);
|
||||
get_access_token(oauth_token);
|
||||
delete window.authComplete;
|
||||
};
|
||||
|
||||
function reqTokenDone(err, xhr) {
|
||||
if (err) callback(err);
|
||||
|
||||
20
land.html
20
land.html
@@ -1,23 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>iD</title>
|
||||
<style>
|
||||
body {
|
||||
font:normal 20px/30px 'Helvetica Neue';
|
||||
text-align:center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<html><head></head>
|
||||
<body>
|
||||
<h1 id='land'></h1>
|
||||
<script>
|
||||
var i = 2;
|
||||
window.setInterval(function() {
|
||||
document.getElementById('land').innerHTML = (new Array(i++)).join('.');
|
||||
i = (i > 8) ? 2 : i;
|
||||
}, 200);
|
||||
opener.authComplete(window.location.search.slice(1));
|
||||
window.close();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user