Skip to content

Instantly share code, notes, and snippets.

@devarda
Created January 26, 2025 03:35
Show Gist options
  • Save devarda/52211761f99905ac92403d4e75c4feb7 to your computer and use it in GitHub Desktop.
Save devarda/52211761f99905ac92403d4e75c4feb7 to your computer and use it in GitHub Desktop.
countingdownto.com clean up code
// Hide everything except the countdown widget
document.querySelectorAll('body > *').forEach(el => {
if (!el.contains(document.querySelector('#cdt'))) {
el.style.display = 'none';
}
});
// Hide specific elements we don't want
const selector = document.querySelector('#countdown_widget_selector');
if (selector) selector.style.display = 'none';
const title = document.querySelector('.centered h1');
if (title) title.style.display = 'none';
const desc = document.querySelector('.centered p');
if (desc) desc.style.display = 'none';
const btn = document.querySelector('.centered .btn');
if (btn) btn.style.display = 'none';
// Hide ALL links to countingdownto.com
document.querySelectorAll('a[href*="countingdownto.com"]').forEach(link => {
link.style.display = 'none';
});
// Clean up the specific content around the widget
document.querySelector('.corner-logo')?.remove();
document.querySelector('.pull-right')?.remove();
document.querySelector('br')?.remove();
document.querySelector('hr')?.remove();
// Style the widget container
const body = document.body;
Object.assign(body.style, {
margin: 0,
padding: 0,
background: '#000',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
minHeight: '100vh'
});
// Make widget wrapper fullscreen
const widget = document.querySelector('.widget-wrapper');
Object.assign(widget.style, {
position: 'relative',
margin: 'auto'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment