2013-05-16 00:19:58 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<script type="text/javascript">
|
|
|
|
function getParameter(name) {
|
|
|
|
var regex = new RegExp(name + "=(.+?)(&|$)");
|
|
|
|
try {
|
|
|
|
return decodeURI(regex.exec(location.search)[1]);
|
|
|
|
} catch (e) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var client_id = getParameter("client_id");
|
|
|
|
var code = getParameter("code");
|
|
|
|
if (client_id) {
|
|
|
|
var redirectURI = location.href.substring(0, location.href.indexOf("?"));
|
|
|
|
window.location.href = "https://public-api.wordpress.com/oauth2/authorize?response_type=code&client_id="
|
|
|
|
+ client_id + "&redirect_uri=" + redirectURI;
|
|
|
|
} else {
|
|
|
|
if (code) {
|
|
|
|
localStorage["wordpressCode"] = code;
|
|
|
|
}
|
2013-05-16 00:38:24 +00:00
|
|
|
window.close();
|
2013-05-16 00:19:58 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
</html>
|