Skip to content

Commit 23feddf

Browse files
committed
Merge branch 'master' of github.com:HackTricks-wiki/hacktricks-cloud
2 parents 9eb6d65 + ca03ade commit 23feddf

File tree

2 files changed

+37
-10
lines changed

2 files changed

+37
-10
lines changed

searchindex.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

theme/ai.js

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55

66
(() => {
7-
const KEY = 'htSummerDiscountDismissed';
8-
const IMG = '/images/discount.jpeg';
9-
const TXT = 'HT Summer Discount, Last Days!';
7+
const KEY = 'htSummerDiscountsDismissed';
8+
const IMG = '/images/discount.jpeg';
9+
const TXT = 'Click here for HT Summer Discounts, Last Days!';
10+
const URL = 'https://training.hacktricks.xyz';
1011

1112
/* Stop if user already dismissed */
1213
if (localStorage.getItem(KEY) === 'true') return;
@@ -32,13 +33,37 @@
3233
display: flex; flex-direction: column; align-items: stretch;
3334
`);
3435

35-
/* --- Title bar (separate, over image) --- */
36+
/* --- Title bar (link + close) --- */
3637
const titleBar = $('div', `
37-
padding: 1rem; text-align: center;
38+
position: relative;
39+
padding: 1rem 2.5rem 1rem 1rem; /* room for the close button */
40+
text-align: center;
3841
background: #222; color: #fff;
3942
font-size: 1.3rem; font-weight: 700;
4043
`);
41-
titleBar.textContent = TXT;
44+
45+
const link = $('a', `
46+
color: inherit;
47+
text-decoration: none;
48+
display: block;
49+
`);
50+
link.href = URL;
51+
link.target = '_blank';
52+
link.rel = 'noopener noreferrer';
53+
link.textContent = TXT;
54+
titleBar.appendChild(link);
55+
56+
/* Close "X" (no persistence) */
57+
const closeBtn = $('button', `
58+
position: absolute; top: .25rem; right: .5rem;
59+
background: transparent; border: none;
60+
color: #fff; font-size: 1.4rem; line-height: 1;
61+
cursor: pointer; padding: 0; margin: 0;
62+
`);
63+
closeBtn.setAttribute('aria-label', 'Close');
64+
closeBtn.textContent = '✕';
65+
closeBtn.onclick = () => overlay.remove();
66+
titleBar.appendChild(closeBtn);
4267

4368
/* --- Image --- */
4469
const img = $('img');
@@ -62,9 +87,11 @@
6287
modal.append(titleBar, img, label);
6388
overlay.appendChild(modal);
6489

65-
(document.readyState === 'loading'
66-
? () => document.addEventListener('DOMContentLoaded', () => document.body.appendChild(overlay), { once: true })
67-
: () => document.body.appendChild(overlay))();
90+
if (document.readyState === 'loading') {
91+
document.addEventListener('DOMContentLoaded', () => document.body.appendChild(overlay), { once: true });
92+
} else {
93+
document.body.appendChild(overlay);
94+
}
6895
})();
6996

7097

0 commit comments

Comments
 (0)