Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#searchString').keyup(function(){
- console.log('instant: ',instant);
- //instant on content not replaced
- if(instant && !replaced){
- if($(this).val().length >= 3){
- log('length: >=3');
- replaced = true;
- oldc = $('#mainContent').html();
- $('#mainContent').fadeOut('fast', function(){
- $('#mainContent').html(loader);
- chrome.extension.sendRequest({
- 'action' : 'searchGeneral',
- 'search' : $('#searchString').val(),
- 'type' : $('#searchType').val()
- }, showResult);
- });
- }
- }
- //instant on and content replaced
- else if(instant && replaced){
- log('instant: true - replaced: true');
- if($(this).val().length >= 3){
- log('length; >= 3');
- $('#mainContent').fadeOut('fast', function(){
- $('#mainContent').html(loader)
- chrome.extension.sendRequest({
- 'action' : 'searchGeneral',
- 'search' : $('#searchString').val(),
- 'type' : $('#searchType').val()
- }, showResult);
- });
- }
- else if($(this).val() == ''){
- log('length: == 0')
- $('#mainContent').fadeOut('fast', function(){
- $('#mainContent').html(oldc)
- });
- replaced = false;
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement