Advertisement
Guest User

scripts

a guest
Aug 27th, 2014
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 4.01 KB | None | 0 0
  1. //login check
  2. $(document).ready(function(){
  3.  $("#login").click(function(){
  4.   username=$("#username").val();
  5.   password=$("#password").val();
  6.   $.ajax({
  7.    type: "POST",
  8.    url: "logincheck.php",
  9.    data: "cell="+username+"&passw="+password,
  10.    success: function(html){
  11.     if(html=='true')
  12.     {
  13. var time_left = 5;
  14. var cinterval;
  15.  
  16. function time_dec(){
  17.   time_left--;
  18.   document.getElementById('countdown').innerHTML = time_left;
  19.   if(time_left == 0){
  20.     clearInterval(cinterval);
  21.   }
  22. }
  23. cinterval = setInterval('time_dec()', 1000);
  24.  
  25. var a = "<?PHP $sitelink/home.php?>";
  26. function redirect(){
  27.    window.location = "home.php";
  28. }
  29. setTimeout(redirect, 3000);
  30.      $("#add_err").html("Welcome "+username+"! Redirecting in 3 Second!");
  31.     }
  32.     else
  33.     {
  34.      $("#add_err").html("Wrong Password!");
  35.     }
  36.    },
  37.    beforeSend:function()
  38.    {
  39.     $("#add_err").html("Loading...")
  40.    }
  41.   });
  42.   return false;
  43.  });
  44. });
  45. //Search Auto Complete
  46. $(function(){
  47. $(".search").keyup(function()
  48. {
  49. var inputSearch = $(this).val();
  50. var dataString = 'q='+ inputSearch;
  51. if(inputSearch!='')
  52. {
  53.     $.ajax({
  54.     type: "GET",
  55.     url: "http://local.con/critic/assets/files/ajaxsearch.php",
  56.     data: dataString,
  57.     cache: false,
  58.     success: function(html)
  59.     {
  60.     $("#divResult").html(html).show();
  61.     }
  62.     });
  63. }return false;    
  64. });
  65.  
  66. jQuery("#divResult").live("click",function(e){
  67.     var $clicked = $(e.target);
  68.     var $name = $clicked.find('.name').html();
  69.     var decoded = $("<div/>").html($name).text();
  70.     $('#inputSearch').val(decoded);
  71. });
  72. jQuery(document).live("click", function(e) {
  73.     var $clicked = $(e.target);
  74.     if (! $clicked.hasClass("search")){
  75.     jQuery("#divResult").fadeOut();
  76.     }
  77. });
  78. $('#inputSearch').click(function(){
  79.     jQuery("#divResult").fadeIn();
  80. });
  81. });
  82. //Search Auto Complete
  83. //style search
  84. $(function(){
  85.  
  86.     var input = $('input#inputSearch');
  87.     var divInput = $('div.input');
  88.     var width = divInput.width();
  89.     var outerWidth = divInput.parent().width() - (divInput.outerWidth() - width);
  90.     var submit = $('#searchSubmit');
  91.     var txt = input.val();
  92.    
  93.     input.bind('focus', function() {
  94.         if(input.val() === txt) {
  95.             input.val('');
  96.         }
  97.         $(this).animate({color: '#000'}, 300); // text color
  98.         $(this).parent().animate({
  99.             width: outerWidth + 'px',
  100.             backgroundColor: '#fff', // background color
  101.             paddingRight: '43px'
  102.         }, 300, function() {
  103.             if(!(input.val() === '' || input.val() === txt)) {
  104.                 if(!($.browser.msie && $.browser.version < 9)) {
  105.                     submit.fadeIn(300);
  106.                 } else {
  107.                     submit.css({display: 'block'});
  108.                 }
  109.             }
  110.         }).addClass('focus');
  111.     }).bind('blur', function() {
  112.         $(this).animate({color: '#b4bdc4'}, 300); // text color
  113.         $(this).parent().animate({
  114.             width: width + 'px',
  115.             backgroundColor: '#e8edf1', // background color
  116.             paddingRight: '15px'
  117.         }, 300, function() {
  118.             if(input.val() === '') {
  119.                 input.val(txt)
  120.             }
  121.         }).removeClass('focus');
  122.         if(!($.browser.msie && $.browser.version < 9)) {
  123.             submit.fadeOut(100);
  124.         } else {
  125.             submit.css({display: 'none'});
  126.         }
  127.     }).keyup(function() {
  128.         if(input.val() === '') {
  129.             if(!($.browser.msie && $.browser.version < 9)) {
  130.                 submit.fadeOut(300);
  131.             } else {
  132.                 submit.css({display: 'none'});
  133.             }
  134.         } else {
  135.             if(!($.browser.msie && $.browser.version < 9)) {
  136.                 submit.fadeIn(300);
  137.             } else {
  138.                 submit.css({display: 'block'});
  139.             }
  140.         }
  141.     });
  142. });
  143. //SCROLLING SIDEBAR
  144. $(document).ready(function() {
  145.  
  146. $.lockfixed("#sidebar .css3transition",{offset: {top: 30, bottom: 100}});
  147. $});
  148. //LAZYLOAD
  149. $(function() {
  150.      $("img.lazy").lazyload({
  151.          effect : "fadeIn"
  152.      });
  153. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement