Advertisement
kevjonesin

jsbin.com 'Welcome' JavaScript

May 18th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (location.pathname === '/welcome' || location.pathname === '/welcome/') {
  2.   location = '/welcome/edit?html,live';
  3. }
  4.  
  5. if (window.location.pathname.indexOf('/edit') !== -1) $('a.open').click(function (event) {
  6.   event.preventDefault();
  7.   window.top.$('a[href$="' + this.hash + '"]').mousedown().click();
  8. });
  9.  
  10. var presses = 0;
  11.  
  12. var spin = [
  13.   "Woahohaohaohaahoahaohaohaohaohaoha...",
  14.   "Nononono...aiiiiiiiiiiiiieeeeeeee....",
  15.   "Aaaaaaaaaghhhhh...woahwoahwoahwoahwoah...",
  16.   "You're eeeeeeeeviiiiiiilllllllll....",
  17.   "Eee...eee...eee...eee...eee...",
  18.   "Woowoowoowoowoowoowoowoowoo..."
  19. ];
  20.  
  21. var stop = [
  22.   "Please... never again.",
  23.   "I'm so dizzy.",
  24.   "That's just... cruel.",
  25.   "Don't you have better things to do?",
  26.   "I can't feel my toes... oh wait, I don't have any toes!",
  27.   "This isn't fun anymore.",
  28.   "...",
  29.   "I'm going to be sick.",
  30.   "Uh-oh, I think I just dropped some tables...",
  31.   "Yep, I think I'm about to SQL-project everywhere...",
  32.   "SELECT * FROM `stomach`...",
  33.   "var_dump($result)...",
  34.   "+_+"
  35. ];
  36.  
  37. $('#dave').mousedown(function () {
  38.  
  39.   $('#message').fadeOut(function () {
  40.     $(this).text(spin[presses % spin.length]);
  41.     presses = presses + 1;
  42.   }).fadeIn();
  43.  
  44. }).mouseup(function () {
  45.  
  46.   $('#message').fadeOut(function () {
  47.     $(this).text(stop[presses % stop.length]);
  48.   }).fadeIn();
  49.  
  50.   if( presses >= stop.length - 1 ) {
  51.     $(this).animate({left: '-999px'}, 1000 * 10, function () {
  52.       $(this).animate({left: '0'}, 1000 * 4);
  53.       presses = 0;
  54.     });
  55.   }
  56.  
  57. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement