Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. $(document).ready(function(e) {
  2.  
  3. var testo = $('.word').val();
  4. var k = 0;
  5. var n = 0;
  6. $('input').serialize();
  7. coll=[];
  8.  
  9. $('.search').click(function(e){
  10. e.preventDefault();
  11. testo = $('.word').val();
  12. if(testo != "")
  13. {
  14. testo = $('.word').val();
  15. $("p:contains(" +testo+ "),h1:contains(" +testo+ "),h2:contains(" +testo+ "),h3:contains(" +testo+ "),h4:contains(" +testo+ "),h5:contains(" +testo+ "),h6:contains(" +testo+ "),h7:contains(" +testo+ ")").addClass("found");
  16. $(function() {
  17. coll=[]
  18. n = 0;
  19. $('*.found').each(function(){
  20. n++;
  21. id = $(this).attr({'id': "id"+n})
  22. coll.push(n)
  23. })
  24. //console.log(coll)
  25. })
  26.  
  27. //console.log(testo);
  28. }
  29. else
  30. return false;
  31. });
  32.  
  33. $('.clear').click(function(e){
  34. e.preventDefault();
  35. n = 0;
  36. k = 0;
  37. $('.word').val("");
  38. $("p:contains(" +testo+ ")").removeClass("found");
  39. //console.log(testo);
  40. });
  41.  
  42. $('.next').each(function(index, element) {
  43. k = 0;
  44.  
  45. $(this).click(function(e){
  46. e.preventDefault();
  47. var testo = $('.word').val();
  48. if(testo != "" && k <= coll.length-1)
  49. {
  50. k+=1;
  51. //console.log(k);
  52. $('body').scrollTo("#id"+k,{duration:'slow', offsetTop: '30'});
  53. }
  54. else
  55. return false;
  56. });
  57.  
  58.  
  59.  
  60. });
  61.  
  62. $('.prev').each(function(index, element) {
  63. k = 0;
  64.  
  65. $(this).click(function(e){
  66. e.preventDefault();
  67. var testo = $('.word').val();
  68. if(testo != "" && k > 0)
  69. {
  70. k-=1;
  71. //console.log(k);
  72. $('body').scrollTo("#id"+k,{duration:'slow', offsetTop: '30'});
  73. }
  74. else
  75. return false;
  76. });
  77.  
  78.  
  79.  
  80. });
  81.  
  82.  
  83.  
  84. });