It started with a seemingly mundane invoice attachment. Clean filename, nothing unusual in the headers. Yet when it hit the inbox of a colleague at a…
We've all been there. You film a solid take for your vlog, reaction video, or spontaneous ‘get ready with me'—and then you rewatch it. Cue th…
What is Blooket and Its Educational Purpose? After spending considerable time exploring various educational gaming platforms, I discovered Blooket—an…
A massive security breach at Tea, the women's dating safety app that recently topped Apple's App Store charts, has exposed approximately 72,0…
The subscription economy, estimated to reach £1.5 trillion globally by 2025, is more than a trend. It's become a default model in many sectors. A…
Microsoft issues emergency patches as three Chinese threat groups exploit zero-day flaws to deploy ransomware and steal sensitive data from thousands…
In today’s threat landscape, cybersecurity is no longer a tick-box exercise. It should be as integral to your business strategy as reliable internet …
These days, your visibility in search engines is a must-have for business growth and prosperity. Not without a reason, companies are spending plenty …
In the fast-paced world of digital finance, building a robust crypto trading portfolio is more than just buying Bitcoin and hoping for the best. It’s…
Over the past decade, the "Internet of Things" has leapt from tech-conference slides to daily life. Network-connected cameras monitor wareh…
const config = {
safeID = 'safelink',
safeURL: ['/p/safelink.html'],
timer: 15,
redirect: true,
text: {
wait: 'The link will appear in 0 second',
direct: 'You’ll be redirected to the download link in 0 second',
shifted: 'Redirecting... [link] if you’re not redirected automatically.',
click: 'Click here',
btn: 'Direct to link.'
}
};
(() => {
const randomURL = url => url[Math.floor(Math.random() * url.length)];
const safeLink = () => config.safeURL.some(path => location.pathname.endsWith(path));
const safeMessage = (text, time) => {
const [start, end] = text.split('0');
return `${start} ${time} ${end}.
`;
};
const outboundLinks = () => {
const links = document.querySelectorAll('a.safeurl[href]');
if (!links.length) return;
links.forEach(anchor => {
const encoded = encodeURIComponent(btoa(anchor.href));
Object.assign(anchor, {
href: `${location.origin}${randomURL(config.safeURL)}?go=${encoded}`,
target: '_self',
rel: 'noopener'
})
})
};
const handleLink = () => {
const params = new URLSearchParams(location.search);
const encoded = params.get('go');
if (!encoded) return;
const link = atob(decodeURIComponent(encoded))
params.delete('go');
history.replaceState({}, '', location.pathname + (params.toString() ? '?' + params : ''));
let counter = config.timer;
const label = config.redirect ? config.text.direct : config.text.wait;
const box = document.getElementById(config.safeID);
if (!box) return;
box.removeAttribute('hidden');
box.innerHTML = safeMessage(label, counter);
const countdown = setInterval(() => {
counter--;
box.innerHTML = safeMessage(label, counter);
if (counter > 0) return;
clearInterval(countdown);
if (config.redirect) {
box.innerHTML = `${config.text.shifted.replace('[link]', `${config.text.click}`)}
`;
location.href = link;
} else {
box.innerHTML = '';
const btn = document.createElement('a');
//btn.className = 'btn';
btn.href = link;
btn.target = '_blank';
btn.rel = 'nofollow noopener noreferrer';
btn.innerHTML = `${config.text.btn}`;
box.appendChild(btn);
}
}, 1000)
};
safeLink() ? handleLink() : outboundLinks();
})();