mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
raptorize
This commit is contained in:
parent
fe00760cd6
commit
1ccdc7a996
5 changed files with 113 additions and 1 deletions
BIN
public/images/raptor.png
Normal file
BIN
public/images/raptor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 207 KiB |
101
public/js/jquery.raptorize.1.0.js
Normal file
101
public/js/jquery.raptorize.1.0.js
Normal file
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* jQuery Raptorize Plugin
|
||||
* @acrogenesis
|
||||
* Free to use under the MIT license.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
$("body").raptorize();
|
||||
});
|
||||
(function($) {
|
||||
|
||||
//Stupid Browser Checking which should be in jQuery
|
||||
jQuery.browser = {};
|
||||
jQuery.browser.mozilla = /mozilla/.test(navigator.userAgent.toLowerCase()) && !/webkit/.test(navigator.userAgent.toLowerCase());
|
||||
jQuery.browser.webkit = /webkit/.test(navigator.userAgent.toLowerCase());
|
||||
|
||||
$.fn.raptorize = function(options) {
|
||||
//Yo' defaults
|
||||
var defaults = {
|
||||
enterOn: 'konami-code', //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;
|
||||
|
||||
if ($.browser.mozilla || $.browser.webkit) {
|
||||
audioSupported = true;
|
||||
}
|
||||
|
||||
//Raptor Vars (Modify the 'src' to your prefrence)
|
||||
var raptorImageMarkup = '<img id="elRaptor" style="display: none" src="images/raptor.png" />'
|
||||
var raptorAudioMarkup = '<audio id="elRaptorShriek" preload="auto"><source src="sounds/raptor-sound.mp3" /><source src="sounds/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": "-300px",
|
||||
"right" : "0",
|
||||
"display" : "none"
|
||||
});
|
||||
|
||||
// Animating Code
|
||||
function init() {
|
||||
locked = true;
|
||||
$(window).scrollTop(9999999);
|
||||
var raptor = $('#elRaptor').css({"display" : "block"});
|
||||
//Sound Hilarity
|
||||
if(audioSupported) {
|
||||
function playSound() {
|
||||
document.getElementById('elRaptorShriek').play();
|
||||
}
|
||||
playSound();
|
||||
}
|
||||
|
||||
// Movement Hilarity
|
||||
raptor.animate({
|
||||
"bottom" : "0px"
|
||||
}, function() {
|
||||
$(this).animate({
|
||||
"bottom" : "0px"
|
||||
}, 100, function() {
|
||||
var offset = (($(this).position().left)+400);
|
||||
$(this).delay(300).animate({
|
||||
"right" : offset
|
||||
}, 2200, function() {
|
||||
locked = false;
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
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');
|
||||
}
|
||||
});
|
||||
}
|
||||
});//each call
|
||||
}//orbit plugin call
|
||||
})(jQuery);
|
BIN
public/sounds/raptor-sound.mp3
Normal file
BIN
public/sounds/raptor-sound.mp3
Normal file
Binary file not shown.
BIN
public/sounds/raptor-sound.ogg
Normal file
BIN
public/sounds/raptor-sound.ogg
Normal file
Binary file not shown.
|
@ -38,9 +38,20 @@
|
|||
|
||||
<script src="/js/jquery-1.11.0.min.js"></script>
|
||||
<script src='https://www.google.com/recaptcha/api.js'></script>
|
||||
|
||||
<script src="/js/jquery.raptorize.1.0.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(window).load(function() {
|
||||
$('.pmarca').raptorize({
|
||||
'enterOn' : 'timer', //timer, konami-code, click
|
||||
'delayTime' : 1000 //time before raptor attacks on timer mode
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body class="hp">
|
||||
<div class="pmarca"></div>
|
||||
<a id="new"></a>
|
||||
|
||||
<div class="page">
|
||||
|
@ -251,7 +262,7 @@
|
|||
<p>Once you find some interesting sites in our website gallery, you can keep track of all new updates by following them. Any changes to the sites show up in your news feed. You'll also see what sites are followed by your favorite site builders.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row content right">
|
||||
<div class="col col-50"><div class="screenshot" style="background-image:url(/img/front-comment-screenshot.png);"></div></div>
|
||||
<div class="col col-50 text">
|
||||
|
|
Loading…
Add table
Reference in a new issue