Skip to content

Commit 7b6d59f

Browse files
committed
fix popup loading and obfuscate title
1 parent f0df03f commit 7b6d59f

1 file changed

Lines changed: 25 additions & 28 deletions

File tree

static/assets/js/home.js

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,41 @@ try {
88
if (!store.get("ab")) store.set("ab", true);
99
if (!inFrame && !navigator.userAgent.includes("Firefox") && store.get("ab") === "true") {
1010
const popup = open("about:blank", "_blank");
11-
setTimeout(() => {
12-
if (!popup || popup.closed) {
13-
} else {
14-
const doc = popup.document;
15-
const iframe = doc.createElement("iframe");
16-
const style = iframe.style;
17-
const link = doc.createElement("link");
11+
if (popup && !popup.closed) {
12+
const doc = popup.document;
13+
const iframe = doc.createElement("iframe");
14+
const style = iframe.style;
15+
const link = doc.createElement("link");
16+
const script = doc.createElement("script");
1817

19-
const name = store.get("name") || "My Drive - Google Drive";
20-
const icon = store.get("icon") || "https://ssl.gstatic.com/docs/doclist/images/drive_2022q3_32dp.png";
18+
const name = store.get("name") || "My Drive - Google Drive";
19+
const icon = store.get("icon") || "https://ssl.gstatic.com/docs/doclist/images/drive_2022q3_32dp.png";
2120

22-
doc.title = name;
23-
link.rel = "icon";
24-
link.href = icon;
21+
doc.title = (window.laceTitle || (s => s))(name);
22+
link.rel = "icon";
23+
link.href = icon;
2524

26-
iframe.src = location.href;
27-
style.position = "fixed";
28-
style.top = style.bottom = style.left = style.right = 0;
29-
style.border = style.outline = "none";
30-
style.width = style.height = "100%";
25+
iframe.src = location.href;
26+
style.position = "fixed";
27+
style.top = style.bottom = style.left = style.right = 0;
28+
style.border = style.outline = "none";
29+
style.width = style.height = "100%";
3130

32-
doc.head.appendChild(link);
33-
doc.body.appendChild(iframe);
34-
35-
const pLink = store.get("pLink") || getRandomUrl();
36-
location.replace(pLink);
37-
38-
const script = doc.createElement("script");
39-
script.textContent = `
31+
script.textContent = `
4032
window.onbeforeunload = function (event) {
4133
const confirmationMessage = 'Leave Site?';
4234
(event || window.event).returnValue = confirmationMessage;
4335
return confirmationMessage;
4436
};
4537
`;
46-
doc.head.appendChild(script);
47-
}
48-
}, 2000);
38+
39+
doc.head.appendChild(link);
40+
doc.head.appendChild(script);
41+
doc.body.appendChild(iframe);
42+
43+
const pLink = store.get("pLink") || getRandomUrl();
44+
location.replace(pLink);
45+
}
4946
}
5047

5148
const SplashT = [

0 commit comments

Comments
 (0)