Permalink
Browse files

initial commit

  • Loading branch information...
mhayes committed Jul 31, 2012
0 parents commit 276f1864c9f044343cfa58584923a6e260859c0a
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8" />
+ <title>Title This Page :)</title>
+
+ <!-- jQuery: Grab Google CDN jQuery. fall back to local if necessary -->
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
+ <script>!window.jQuery && document.write('<script src="jquery-1.4.1.min.js"><\/script>')</script>
+
+ <!-- The raptorize file -->
+ <script src="jquery.raptorize.1.0.js"></script>
+
+ <!-- For the button version -->
+ <script type="text/javascript">
+ $(window).load(function() {
+ $('.button').raptorize();
+ });
+ </script>
+
+ <!-- For the Konami Code version -->
+ <script type="text/javascript">
+ $(window).load(function() {
+ $('.button').raptorize({
+ 'enterOn' : 'konami-code'
+ });
+ });
+ </script>
+
+ <!-- For the Timer version -->
+ <!-- <script type="text/javascript">
+ $(window).load(function() {
+ $('.button').raptorize({
+ 'enterOn' : 'timer',
+ 'delayTime' : 2000
+ });
+ });
+ </script>
+ -->
+
+</head>
+<body>
+ <h1>Hey There!</h1>
+
+ <p><a href="#" class="button">Click me</a> to activate the Raptorize plugin.</p>
+ <p>You can also use the Konami-Code (on your keyboard type &uarr; &uarr; &darr; &darr; &larr; &rarr; &larr; &rarr; B A)</p>
+
+</body>
+</html>

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,106 @@
+/*
+ * jQuery Raptorize Plugin 1.0
+ * www.ZURB.com/playground
+ * Copyright 2010, ZURB
+ * Free to use under the MIT license.
+ * http://www.opensource.org/licenses/mit-license.php
+*/
+
+
+(function($) {
+
+ $.fn.raptorize = function(options) {
+
+ //Yo' defaults
+ var defaults = {
+ enterOn: 'click', //timer, konami-code, click
+ delayTime: 5000 //time before raptor attacks on timer mode
+ };
+
+ //Extend those options
+ var options = $.extend(defaults, options);
+
+ return this.each(function() {
+
+ var _this = $(this);
+ var audioSupported = false;
+ //Stupid Browser Checking which should be in jQuery Support
+ if ($.browser.mozilla && $.browser.version.substr(0, 5) >= "1.9.2" || $.browser.webkit) {
+ audioSupported = true;
+ }
+
+ //Raptor Vars
+ var raptorImageMarkup = '<img id="elRaptor" style="display: none" src="raptor.png" />'
+ var raptorAudioMarkup = '<audio id="elRaptorShriek" preload="auto"><source src="raptor-sound.mp3" /><source src="raptor-sound.ogg" /></audio>';
+ var locked = false;
+
+ //Append Raptor and Style
+ $('body').append(raptorImageMarkup);
+ if(audioSupported) { $('body').append(raptorAudioMarkup); }
+ var raptor = $('#elRaptor').css({
+ "position":"fixed",
+ "bottom": "-700px",
+ "right" : "0",
+ "display" : "block"
+ })
+
+ // Animating Code
+ function init() {
+ locked = true;
+
+ //Sound Hilarity
+ if(audioSupported) {
+ function playSound() {
+ document.getElementById('elRaptorShriek').play();
+ }
+ playSound();
+ }
+
+ // Movement Hilarity
+ raptor.animate({
+ "bottom" : "0"
+ }, function() {
+ $(this).animate({
+ "bottom" : "-130px"
+ }, 100, function() {
+ var offset = (($(this).position().left)+400);
+ $(this).delay(300).animate({
+ "right" : offset
+ }, 2200, function() {
+ raptor = $('#elRaptor').css({
+ "bottom": "-700px",
+ "right" : "0"
+ })
+ locked = false;
+ })
+ });
+ });
+ }
+
+
+ //Determine Entrance
+ if(options.enterOn == 'timer') {
+ setTimeout(init, options.delayTime);
+ } else if(options.enterOn == 'click') {
+ _this.bind('click', function(e) {
+ e.preventDefault();
+ if(!locked) {
+ init();
+ }
+ })
+ } else if(options.enterOn == 'konami-code'){
+ var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
+ $(window).bind("keydown.raptorz", function(e){
+ kkeys.push( e.keyCode );
+ if ( kkeys.toString().indexOf( konami ) >= 0 ) {
+ init();
+ $(window).unbind('keydown.raptorz');
+ }
+ }, true);
+
+ }
+
+ });//each call
+ }//orbit plugin call
+})(jQuery);
+
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 276f186

Please sign in to comment.