UNPKG

865 BJavaScriptView Raw
1(function () {
2 var config = JSON.parse(document.getElementById('config').innerHTML);
3
4 if (config.setCredentialToken) {
5 var credentialToken = config.credentialToken;
6 var credentialSecret = config.credentialSecret;
7
8 if (window.opener && window.opener.WechatOAuth) {
9 window.opener.WechatOAuth._handleCredentialSecret(
10 credentialToken, credentialSecret);
11 } else {
12 try {
13 localStorage[config.storagePrefix + credentialToken] = credentialSecret;
14 } catch (err) {
15 // We can't do much else, but at least close the popup instead
16 // of having it hang around on a blank page.
17 }
18 }
19 }
20
21 document.getElementById('completedText').style.display = 'block';
22 document.getElementById('loginCompleted').onclick = function () {
23 window.close();
24 };
25 window.close();
26})();
\No newline at end of file