Skip to content

Instantly share code, notes, and snippets.

@collegeman
Created May 7, 2010 19:33
Show Gist options
  • Save collegeman/393912 to your computer and use it in GitHub Desktop.
Save collegeman/393912 to your computer and use it in GitHub Desktop.
smoke-alarm-expiration.en.js
(function(){var protocol=(location.protocol=='https:'?'https':'http');document.write('<div style="background-color: #069; background-image: url('+protocol+'://www.usfa.dhs.gov/_images/campaigns/smokealarms/widget.jpg); background-repeat: no-repeat; -moz-border-radius: 8px; -webkit-border-radius: 8px; box-shadow: 0px 0px 8px #666; -webkit-box-shadow: 0px 0px 8px #666; -moz-box-shadow: 0px 0px 8px #666; color: #fff; font-family: \'Trebuchet MS\', Arial, Helvetica, sans-serif; margin: 10px 0; text-align: center; width: 310px">'+'<h2 style="color: #b7d3e1; font-size: 20px; margin: 0; padding: 170px 0 0 0;">IT’S A FACT:</h2>'+'<p style="color: #fff; font-size: 14px; margin: 0 auto; padding-bottom: 95px; width: 280px;">If your smoke alarm was installed <span id="usfa-smokealarms-notifier-date-to-replace-en"><strong>more than 10 years ago</strong></span>, it needs to be <em>replaced</em>.</p>'+'</div>'+'<a href="'+protocol+'://www.usfa.dhs.gov/notices/ads.shtm" style="font-family: Tahoma, Geneva, sans-serif; font-size: 11px; padding: 1em">Share this widget</a>');var now=new Date();var jan=new Date(now.getFullYear(),0,1,0,0,0,0);var date=now.getTime()-jan.getTime();var d=new Date(now.getFullYear()-10,0,1,0,0,0,date);var mon=['January','February','March','April','May','June','July','August','September','October','November','December'][d.getMonth()];var day=d.getDate();var year=d.getFullYear();var formatted=mon+' '+day+', '+year;var url='http://www.google.com/products?q=smoke+detector&hl=en&aq=f';var e=document.getElementById('usfa-smokealarms-notifier-date-to-replace-en');e.innerHTML='before <span class="the_date"><strong>'+formatted+'</strong></span>';})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment