aprilFools.css icon indicating copy to clipboard operation
aprilFools.css copied to clipboard

aprilFools.js - dynamically load aprilFools.css on or after April 1, 2013

Open christiangenco opened this issue 12 years ago • 2 comments

Now you can do your dirty work any time between now and April 1st and the shenanigans will automatically happen at the right time!

Requires dotjs - I couldn't think of an easy way around this. Is there a Custom.css analog for javascript?

christiangenco avatar Mar 29 '13 02:03 christiangenco

On second thought, this may be a better task for Tampermonkey

// ==UserScript==
// @name       AprilFools.js
// @namespace  https://github.com/wesbos/aprilFools.css
// @version    0.1
// @description  Inserts aprilFools.css code in websites on or after April Fools 2013
// @match      http://*/*
// @copyright  2013+, @cgenco
// ==/UserScript==

// only do this *on or after* April Fools 2013
if(new Date() > new Date(2012, 3, 1, 0, 0, 0, 0))
{
  var css = document.createElement("link");
  css.setAttribute("rel", "stylesheet");
  css.setAttribute("type", "text/css");
  css.setAttribute("href", "https://raw.github.com/christiangenco/aprilFools.css/master/aprilFools.css");
  document.getElementsByTagName("head")[0].appendChild(css);
}

christiangenco avatar Mar 29 '13 03:03 christiangenco

I like the Tampermonkey/Greasemonkey idea. Easy to install it unnoticed when *monkey is used ;-)

Cougar avatar Mar 29 '13 13:03 Cougar