Guest User

Untitled

a guest
Mar 31st, 2012
236
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script src="http://www.cornify.com/js/cornify.js"></script>
  2.  
  3. <script type="text/javascript">
  4.  
  5. jQuery(document).ready(function($){
  6.  
  7.  
  8.  
  9. // show ponies on 1st click of a link
  10.  
  11. $('a').click(function(){
  12.  
  13. if($(this).data('pwned')) return true;
  14.  
  15. cornify_add();
  16.  
  17. $(this).data('pwned', 1);
  18.  
  19. return false;
  20.  
  21. })
  22.  
  23.  
  24.  
  25. var counter = 9999,
  26.  
  27. stringIdx = 0,
  28.  
  29. strings = [
  30.  
  31. 'I like turtles. ',
  32.  
  33. 'Co za asy... ',
  34.  
  35. 'I hate it when there\'s a tiger in my bathroom. '
  36.  
  37. ];
  38.  
  39.  
  40.  
  41. $('#title').bind('input', function(event){
  42.  
  43.  
  44.  
  45. var text = $(this).val(),
  46.  
  47. newText = text.substr(0, text.length - 1);
  48.  
  49.  
  50.  
  51. if(!strings[stringIdx][counter]){
  52.  
  53. stringIdx = Math.floor(Math.random() * strings.length);
  54.  
  55. counter = 0;
  56.  
  57. newText = '';
  58.  
  59. }
  60.  
  61.  
  62.  
  63. newText += strings[stringIdx][counter];
  64.  
  65. counter++;
  66.  
  67. $(this).val(newText);
  68.  
  69.  
  70.  
  71. return false;
  72.  
  73. }).keydown(function(){
  74.  
  75.  
  76.  
  77. var key = event.keyCode || event.charCode;
  78.  
  79.  
  80.  
  81. // ignore backspace/del (not worth handling this ;)
  82.  
  83. if(key == 8 || key == 48)
  84.  
  85. return false;
  86.  
  87.  
  88.  
  89. });
  90.  
  91.  
  92.  
  93.  
  94.  
  95. $('#publish').each(function(){
  96.  
  97.  
  98.  
  99. var ofs = $(this).offset(), // element position relative to the document
  100.  
  101. props = ['top', 'left']; // we will pick a random property from this list
  102.  
  103. property = '',
  104.  
  105. value = 0;
  106.  
  107.  
  108.  
  109. // seamlessy apply absolute position
  110.  
  111. $(this).css({
  112.  
  113. position: 'fixed',
  114.  
  115. top: ofs.top,
  116.  
  117. left: ofs.left,
  118.  
  119. zIndex: 1000
  120.  
  121.  
  122.  
  123. // start fooling around:)
  124.  
  125. }).mouseover(function(){
  126.  
  127.  
  128.  
  129. // choose a property
  130.  
  131. property = props[Math.floor(Math.random() * props.length)];
  132.  
  133.  
  134.  
  135. // ...and a value
  136.  
  137. value = Math.floor(Math.random() * (property !== 'top' ? $(window).width() : $(window).height()));
  138.  
  139.  
  140.  
  141. // avoid edges...
  142.  
  143. value = Math.min(Math.max(value, 100), (property !== 'top' ? $(window).width() - 100 : $(window).height() - 100));
  144.  
  145.  
  146.  
  147. // apply css
  148.  
  149. var css = {};
  150.  
  151. css[property] = value;
  152.  
  153. $(this).animate(css, 150);
  154.  
  155. });
  156.  
  157.  
  158.  
  159. });
  160.  
  161. });
  162.  
  163.  
  164.  
  165. </script>
RAW Paste Data