This commit is contained in:
carlospolop 2025-07-31 12:00:01 +02:00
parent af4e75a8c8
commit 48415b5f06

View File

@ -1,6 +1,6 @@
/** /**
* HackTricks Training Discounts * HackTricks Training Discounts
*/
(() => { (() => {
@ -9,13 +9,13 @@
const TXT = 'Click here for HT Summer Discounts, Last Days!'; const TXT = 'Click here for HT Summer Discounts, Last Days!';
const URL = 'https://training.hacktricks.xyz'; const URL = 'https://training.hacktricks.xyz';
/* Stop if user already dismissed */ // Stop if user already dismissed
if (localStorage.getItem(KEY) === 'true') return; if (localStorage.getItem(KEY) === 'true') return;
/* Quick helper */ // Quick helper
const $ = (tag, css = '') => Object.assign(document.createElement(tag), { style: css }); const $ = (tag, css = '') => Object.assign(document.createElement(tag), { style: css });
/* --- Overlay (blur + dim) --- */ // --- Overlay (blur + dim) ---
const overlay = $('div', ` const overlay = $('div', `
position: fixed; inset: 0; position: fixed; inset: 0;
background: rgba(0,0,0,.4); background: rgba(0,0,0,.4);
@ -24,7 +24,7 @@
z-index: 10000; z-index: 10000;
`); `);
/* --- Modal --- */ // --- Modal ---
const modal = $('div', ` const modal = $('div', `
max-width: 90vw; width: 480px; max-width: 90vw; width: 480px;
background: #fff; border-radius: 12px; overflow: hidden; background: #fff; border-radius: 12px; overflow: hidden;
@ -33,10 +33,10 @@
display: flex; flex-direction: column; align-items: stretch; display: flex; flex-direction: column; align-items: stretch;
`); `);
/* --- Title bar (link + close) --- */ // --- Title bar (link + close) ---
const titleBar = $('div', ` const titleBar = $('div', `
position: relative; position: relative;
padding: 1rem 2.5rem 1rem 1rem; /* room for the close button */ padding: 1rem 2.5rem 1rem 1rem; // room for the close button
text-align: center; text-align: center;
background: #222; color: #fff; background: #222; color: #fff;
font-size: 1.3rem; font-weight: 700; font-size: 1.3rem; font-weight: 700;
@ -53,7 +53,7 @@
link.textContent = TXT; link.textContent = TXT;
titleBar.appendChild(link); titleBar.appendChild(link);
/* Close "X" (no persistence) */ // Close "X" (no persistence)
const closeBtn = $('button', ` const closeBtn = $('button', `
position: absolute; top: .25rem; right: .5rem; position: absolute; top: .25rem; right: .5rem;
background: transparent; border: none; background: transparent; border: none;
@ -65,11 +65,11 @@
closeBtn.onclick = () => overlay.remove(); closeBtn.onclick = () => overlay.remove();
titleBar.appendChild(closeBtn); titleBar.appendChild(closeBtn);
/* --- Image --- */ // --- Image ---
const img = $('img'); const img = $('img');
img.src = IMG; img.alt = TXT; img.style.width = '100%'; img.src = IMG; img.alt = TXT; img.style.width = '100%';
/* --- Checkbox row --- */ // --- Checkbox row ---
const label = $('label', ` const label = $('label', `
display: flex; align-items: center; justify-content: center; gap: .6rem; display: flex; align-items: center; justify-content: center; gap: .6rem;
padding: 1rem; font-size: 1rem; color: #222; cursor: pointer; padding: 1rem; font-size: 1rem; color: #222; cursor: pointer;
@ -83,7 +83,7 @@
}; };
label.append(cb, document.createTextNode("Don't show again")); label.append(cb, document.createTextNode("Don't show again"));
/* --- Assemble & inject --- */ // --- Assemble & inject ---
modal.append(titleBar, img, label); modal.append(titleBar, img, label);
overlay.appendChild(modal); overlay.appendChild(modal);
@ -93,7 +93,7 @@
document.body.appendChild(overlay); document.body.appendChild(overlay);
} }
})(); })();
*/
/** /**