-
-
Save thejefflarson/880645 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var $$ = function(query){ | |
!!(query && query.nodeType == 1) ? | |
this.dom = query | |
: | |
this.dom = document.getElementById(query); | |
}; | |
$$.prototype.remove = function(){ | |
this.dom.parentNode.removeChild(this.dom); | |
return this; | |
}; | |
$$.prototype.css = function(rules){ | |
for(i in rules) | |
this.dom.style[i] = rules[i]; | |
return this; | |
}; | |
$$.prototype.append = function(html){ | |
var el = document.createElement("div"); | |
el.innerHTML = html; | |
for(var i = 0; i < el.children.length; i++) | |
this.dom.appendChild(el.children[i]); | |
return this; | |
}; | |
$$.prototype.replaceWith = function(html){ | |
var parent = this.dom.parentNode; | |
this.remove(); | |
$(parent).append(html); | |
return $($(parent).lastChild); | |
}; | |
var $ = function(query){ | |
return new $$(query); | |
}; | |
var hide = {}; | |
hide.the = function(el){ | |
$(el).replaceWith("<img src=" + enHatMan() + "/>"); | |
return this; | |
}; | |
var enHatMan = function() { | |
var hatMen = [ | |
'http://26.media.tumblr.com/tumblr_li7y79w7Ps1qzp87ao1_250.gif', | |
'http://davidcole.me/drop/nytwhat.gif', | |
'http://petervidani.com/images/nyt.gif' | |
]; | |
var getRandomHatMan = function() { | |
return Math.floor(hatMen.length * Math.random()); | |
}; | |
return hatMen[getRandomHatMan()]; | |
}; | |
hide.and = hide; | |
hide.the("overlay").and.the("gatewayCreative"); | |
$(document.body).css({overflow:'scroll'}); | |
// old school | |
$(document.body).append('<audio controls="no" preload="auto" autoplay style="display:none"><source src="themessage.mp3" /></audio>'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment