|
12 | 12 | localStorage.getItem("ab") === "true"
|
13 | 13 | ) {
|
14 | 14 | const popup = open("about:blank", "_blank");
|
15 |
| - if (!popup || popup.closed) { |
16 |
| - alert( |
17 |
| - "Please allow popups for this site. Doing so will allow us to open the site in a about:blank tab and preventing this site from showing up in your history. You can turn this off in the site settings.", |
18 |
| - ); |
19 |
| - } else { |
20 |
| - const doc = popup.document; |
21 |
| - const iframe = doc.createElement("iframe"); |
22 |
| - const style = iframe.style; |
23 |
| - const link = doc.createElement("link"); |
| 15 | + setTimeout(() => { |
| 16 | + if (!popup || popup.closed) { |
| 17 | + alert( |
| 18 | + "Please allow popups for this site. Doing so will allow us to open the site in a about:blank tab and preventing this site from showing up in your history. You can turn this off in the site settings.", |
| 19 | + ); |
| 20 | + } else { |
| 21 | + const doc = popup.document; |
| 22 | + const iframe = doc.createElement("iframe"); |
| 23 | + const style = iframe.style; |
| 24 | + const link = doc.createElement("link"); |
24 | 25 |
|
25 |
| - const name = localStorage.getItem("name") || "My Drive - Google Drive"; |
26 |
| - const icon = |
27 |
| - localStorage.getItem("icon") || |
28 |
| - "https://ssl.gstatic.com/docs/doclist/images/drive_2022q3_32dp.png"; |
| 26 | + const name = localStorage.getItem("name") || "My Drive - Google Drive"; |
| 27 | + const icon = |
| 28 | + localStorage.getItem("icon") || |
| 29 | + "https://ssl.gstatic.com/docs/doclist/images/drive_2022q3_32dp.png"; |
29 | 30 |
|
30 |
| - doc.title = name; |
31 |
| - link.rel = "icon"; |
32 |
| - link.href = icon; |
| 31 | + doc.title = name; |
| 32 | + link.rel = "icon"; |
| 33 | + link.href = icon; |
33 | 34 |
|
34 |
| - iframe.src = location.href; |
35 |
| - style.position = "fixed"; |
36 |
| - style.top = style.bottom = style.left = style.right = 0; |
37 |
| - style.border = style.outline = "none"; |
38 |
| - style.width = style.height = "100%"; |
| 35 | + iframe.src = location.href; |
| 36 | + style.position = "fixed"; |
| 37 | + style.top = style.bottom = style.left = style.right = 0; |
| 38 | + style.border = style.outline = "none"; |
| 39 | + style.width = style.height = "100%"; |
39 | 40 |
|
40 |
| - doc.head.appendChild(link); |
41 |
| - doc.body.appendChild(iframe); |
| 41 | + doc.head.appendChild(link); |
| 42 | + doc.body.appendChild(iframe); |
42 | 43 |
|
43 |
| - const pLink = localStorage.getItem(encodeURI("pLink")) || getRandomUrl(); |
44 |
| - location.replace(pLink); |
| 44 | + const pLink = localStorage.getItem(encodeURI("pLink")) || getRandomUrl(); |
| 45 | + location.replace(pLink); |
45 | 46 |
|
46 |
| - const script = doc.createElement("script"); |
47 |
| - script.textContent = ` |
| 47 | + const script = doc.createElement("script"); |
| 48 | + script.textContent = ` |
48 | 49 | window.onbeforeunload = function (event) {
|
49 | 50 | const confirmationMessage = 'Leave Site?';
|
50 | 51 | (event || window.event).returnValue = confirmationMessage;
|
51 | 52 | return confirmationMessage;
|
52 | 53 | };
|
53 | 54 | `;
|
54 |
| - doc.head.appendChild(script); |
55 |
| - } |
| 55 | + doc.head.appendChild(script); |
| 56 | + } |
| 57 | + }, 5000); |
56 | 58 | }
|
57 | 59 | // Particles
|
58 | 60 | document.addEventListener("DOMContentLoaded", event => {
|
|
0 commit comments