Subversion Repositories SmartDukaan

Rev

Rev 18073 | Rev 18076 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18073 Rev 18075
Line 1... Line 1...
1
<script>
1
<script>
2
    $(document).ready(function(){
2
    $(document).ready(function(){
-
 
3
    var statepushed = false;
-
 
4
    if($("#searchforbrand").length != 0 ) {
-
 
5
      if (window.history && window.history.pushState) {
-
 
6
 
-
 
7
        $(window).on('popstate', function() {
-
 
8
            $('#searchforbrand').val("");
-
 
9
            $("#regularcontent").removeClass('hidden');
-
 
10
            $("#searchedcontent").addClass('hidden');
-
 
11
 
-
 
12
            statepushed = false;
-
 
13
        });
-
 
14
 
3
    
15
      }
-
 
16
    }       
-
 
17
 
4
        var new_msg="";
18
        var new_msg="";
5
        var typingTimer;                
19
        var typingTimer;                
6
        var doneTypingInterval = 1000; 
20
        var doneTypingInterval = 1000; 
7
        $('#searchforbrand').keyup(function(){
21
        $('#searchforbrand').keyup(function(){
8
            clearTimeout(typingTimer);
22
            clearTimeout(typingTimer);
9
        // $('input:text').keypress(function(e){
23
        // $('input:text').keypress(function(e){
10
           // var s = encodeURIComponent($(this).val().trim());
24
           // var s = encodeURIComponent($(this).val().trim());
11
            var s ="";  
25
            var s ="";  
12
            s = encodeURIComponent($(this).val().trim());            
26
            s = encodeURIComponent($(this).val().trim());            
13
            if(s.length > 0 && $('#searchforbrand').val()!= ""){
27
            if(s.length > 0 && $('#searchforbrand').val()!= ""){
-
 
28
                
-
 
29
                if(!statepushed)
-
 
30
                {
-
 
31
                    if (window.history && window.history.pushState) {
-
 
32
 
-
 
33
                        window.history.pushState('forward', null, './6');
-
 
34
                        statepushed = true;
-
 
35
                    }
-
 
36
                }
14
                //on keyup, start the countdown
37
                //on keyup, start the countdown
15
                    //debugger;
38
                
16
                    if ($('#searchforbrand').val) {
39
                    if ($('#searchforbrand').val) {
17
                        typingTimer = setTimeout(function doneTyping(){
40
                        typingTimer = setTimeout(function doneTyping(){
18
                            $("#searchloader").removeClass('hidden');
41
                            $("#searchloader").removeClass('hidden');
19
                            // $("#regularcontent").addClass('hidden');
42
                            // $("#regularcontent").addClass('hidden');
20
                            // $("#searchedcontent").addClass('hidden');
43
                            // $("#searchedcontent").addClass('hidden');
Line 81... Line 104...
81
            }
104
            }
82
            else
105
            else
83
            {
106
            {
84
                $("#regularcontent").removeClass('hidden');
107
                $("#regularcontent").removeClass('hidden');
85
                $("#searchedcontent").addClass('hidden');
108
                $("#searchedcontent").addClass('hidden');
-
 
109
                if(statepushed){
-
 
110
                    window.history.back();
-
 
111
                }
-
 
112
                statepushed = false;
-
 
113
 
86
            } 
114
            } 
87
        });
115
        });
88
 
116
 
89
        
117
        
90
 
118