sfc-utils 1.4.170 → 1.4.171
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accountswap.js +22 -15
- package/package.json +1 -1
package/accountswap.js
CHANGED
|
@@ -2,27 +2,34 @@
|
|
|
2
2
|
// Any domain + /realm/ should work for an account link
|
|
3
3
|
const accountURL = "/realm/";
|
|
4
4
|
|
|
5
|
-
const pollForAccount = async function (i, isNav) {
|
|
5
|
+
const pollForAccount = async function (i, isNav, attachedRealm) {
|
|
6
6
|
// Assume it's nav
|
|
7
7
|
if (isNav === undefined) {
|
|
8
8
|
isNav = true;
|
|
9
9
|
}
|
|
10
|
+
if (attachedRealm === undefined) {
|
|
11
|
+
attachedRealm = false;
|
|
12
|
+
}
|
|
10
13
|
// Start the iterator
|
|
11
14
|
if (!i) {
|
|
12
15
|
i = 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
}
|
|
17
|
+
// Add a click event to signin
|
|
18
|
+
if (isNav && !attachedRealm) {
|
|
19
|
+
const signinButton = document.querySelector(".hnp-signin");
|
|
20
|
+
console.log("Signin button, looking for .hnp-signin");
|
|
21
|
+
if (signinButton) {
|
|
22
|
+
console.log("Found signin button");
|
|
23
|
+
// Add event listener to signin button
|
|
24
|
+
attachedRealm = true;
|
|
25
|
+
signinButton.onclick = function (e) {
|
|
26
|
+
console.log("Clicked signin button");
|
|
27
|
+
window.treg.realm.core.login();
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
e.stopPropagation();
|
|
30
|
+
};
|
|
31
|
+
} else {
|
|
32
|
+
console.log("Didn't find signin button this time");
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
35
|
// Safecheck for treg since it might not be global yet
|
|
@@ -63,7 +70,7 @@ const pollForAccount = async function (i, isNav) {
|
|
|
63
70
|
}
|
|
64
71
|
// Check again after 0.5 sec using a Promise with async/await
|
|
65
72
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
66
|
-
return await pollForAccount(i + 1, isNav);
|
|
73
|
+
return await pollForAccount(i + 1, isNav, attachedRealm);
|
|
67
74
|
}
|
|
68
75
|
};
|
|
69
76
|
|