Skip to content

Instantly share code, notes, and snippets.

@hugeuser
Last active August 29, 2015 13:58
Show Gist options
  • Save hugeuser/10191114 to your computer and use it in GitHub Desktop.
Save hugeuser/10191114 to your computer and use it in GitHub Desktop.
Easter Eggs
HUGE.cheat = {
init: function(code) {
HUGE.cheat[code].call();
},
monochrome: function() {
$('head').append('<style> body { -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); -ms-filter: grayscale(100%); -o-filter: grayscale(100%); filter: grayscale(100%); filter: gray; }</style>');
},
sepia: function() {
$('head').append('<style> body { -webkit-filter: sepia(100%); -moz-filter: sepia(100%); -ms-filter: sepia(100%); -o-filter: sepia(100%); filter: sepia(100%); filter: sepia; }</style>');
},
acid: function() {
// NOTE: -webkit-… used for simplicity, although all browser
// prefixes would be present
var animation = document.createElement('style');
animation.type = 'text/css';
var keyframes = document.createTextNode('@-webkit-keyframes acid {'+
'0% { -webkit-filter: hue-rotate(30deg); }' +
'50% { -webkit-filter: hue-rotate(60deg); }' +
'100% { -webkit-filter: hue-rotate(90deg); }' +
'}');
animation.appendChild(keyframes);
document.getElementsByTagName('head')[0].appendChild(animation);
$('body').css('-webkit-filter', 'hue-rotate(90deg)');
$('body > nav, section, #mosaic a').each(function(i, element){
$(element).css('-webkit-animation', 'acid 1s alternate infinite');
});
$('footer').css({'background':'orange', '-webkit-animation':'acid 1s alternate infinite'});
},
seasick: function() {
var animation = document.createElement('style');
animation.type = 'text/css';
var keyframes = document.createTextNode('@-webkit-keyframes acid {'+
‘0% { -webkit-transform: translateY(0) }’ +
‘50% { -webkit-transform: translateY(-10px) }’ +
‘100% { -webkit-transform: translateY(0) }’ +
'}');
animation.appendChild(keyframes);
document.getElementsByTagName('head')[0].appendChild(animation);
$(p).css({'-webkit-animation': ‘seasick 5s infinite'});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment