23 August 2011
Earthquake Bookmarklet
Earthquakes can be scary. Other times you might not even notice it apart from everyone tweeting about it.
Well, if you fit into the latter group, you can experience your own safe browser-based earthquake with the
» earthquakelet «
Click on it right now to see it’s devastation! …and refresh the page to undo it’s effects. If you wish to wreak havoc on other sites on the web just drag that link into your bookmarks toolbar and click on it while viewing any site.
Also, here’s the code in case you’re interested (it’s a bit hacked together):
(function(w,url,hasjq) {
if (!(hasjq = w.jQuery)) {
var s = document.createElement('script');
s.src = url;
(document.getElementsByTagName('head')[0] ||
document.getElementsByTagName('body')[0]).appendChild(s);
}
(function go() {
if (!w.jQuery) {
return w.setTimeout(go, 200);
}
var $ = w.jQuery;
if (!hasjq) $ = $.noConflict();
var $s = $('p,div,img,span,strong,em');
(function shake() {
$s.each(function() {
if (this.shift) this.shift = 0;
else this.shift = (2*(Math.floor(Math.random() * 2)) - 1) * (Math.floor(Math.random() * 4));
$(this).css('margin-left', this.shift);
});
w.setTimeout(shake, 80);
})();
})();
})(window, '//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
Comments (2)
1. Harold wrote:
¡earthquakelet!
Posted on 23 August 2011 at 11:08 PM | permalink
2. peter wrote:
o/\o consider that name changed!
Posted on 24 August 2011 at 12:08 AM | permalink