$(document).ready(function(){ var config = { siteURL : 'pdfsearcher.com', searchSite : true, type : 'web', append : false, perPage : 8, page : 0 } // The small arrow that marks the active search icon: var arrow = $('',{className:'arrow'}).appendTo('ul.icons'); $('ul.icons li').click(function(){ var el = $(this); if(el.hasClass('active')){ // The icon is already active, exit return false; } el.siblings().removeClass('active'); el.addClass('active'); // Move the arrow below this icon arrow.stop().animate({ left : el.position().left, marginLeft : (el.width()/2)-4 }); // Set the search type config.type = el.attr('data-searchType'); $('#more').fadeOut(); }); // Adding the site domain as a label for the first radio button: $('#siteNameLabel').append(' '+config.siteURL); // Marking the Search tutorialzine.com radio as active: $('#searchSite').click(); // Marking the web search icon as active: $('li.web').click(); // Focusing the input text box: $('#s').focus(); $.post('/last.php', function(data) { $('#lastsearches').html(data).fadein('slow'); }); $('#main-form').submit(function(){ //window.location = "/test" var readbook = $('#readbook'); readbook.hide(); googleSearch(); return false; }); function googleSearchRun(){ var readbook = $('#readbook'); readbook.hide(); googleSearch(); return false; } $('#searchSite,#searchWeb').change(function(){ // Listening for a click on one of the radio buttons. // config.searchSite is either true or false. config.searchSite = this.id == 'searchSite'; }); function googleSearch(settings){ // If no parameters are supplied to the function, // it takes its defaults from the config object above: settings = $.extend({},config,settings); settings.term = settings.term || $('#searchBox').val(); keyword = $('#searchBox').val(); if(settings.searchSite){ // Using the Google site:example.com to limit the search to a // specific domain: settings.term = 'filetype:'+' '+settings.term; } // URL of Google's AJAX search API var apiURL = 'http://ajax.googleapis.com/ajax/services/search/'+settings.type+'?v=1.0&callback=?'; var resultsDiv = $('#resultsDiv'); $.getJSON(apiURL,{q:settings.term,rsz:settings.perPage,start:settings.page*settings.perPage},function(r){ var results = r.responseData.results; $('#more').remove(); if(results.length){ var searchterm = $('#searchBox').val(); $.post("search1.php", { searchstring: searchterm, start: 0 }, function(data) { $("#status p").html(''); //window.location = 'http://pdfsearcher.com/pdf/books-about-'+ keyword.replace(" ","-")+'-free-download.html' }); // If results were returned, add them to a pageContainer div, // after which append them to the #resultsDiv: var pageContainer = $('
',{className:'pageContainer'}); for(var i=0;i
') .hide().appendTo(resultsDiv) .fadeIn('slow'); var cursor = r.responseData.cursor; // Checking if there are more pages with results, // and deciding whether to show the More button: if( +cursor.estimatedResultCount > (settings.page+1)*settings.perPage){ $('
',{id:'more'}).appendTo(resultsDiv).click(function(){ googleSearch({append:true,page:settings.page+1}); $(this).fadeOut(); }); } } else { // No results were found for this search. resultsDiv.empty(); $('

',{className:'notFound',html:'No Books Were Found! Try another title...'}).hide().appendTo(resultsDiv).fadeIn(); } }); } function result(r){ // This is class definition. Object of this class are created for // each result. The markup is generated by the .toString() method. var arr = []; var e='0'; // GsearchResultClass is passed by the google API /* switch(r.GsearchResultClass){ case 'GwebSearch': arr = [ '

', '

',r.title,'', //'

',r.title,'Read File', 'Download File

', '

',r.content,'

', '',r.visibleUrl,'', '
' ]; break; } */ switch(r.GsearchResultClass){ e++; case 'GwebSearch': arr = [ '
  • ', '',r.title,'', //'

    ',r.title,'Read File', '
    moscow.auto.ru

    ', '

    ',r.content,'

    ', '',r.visibleUrl,'', '

  • ' ]; break; } //
  • AUTO.RU: Автомобили в Москве
    moscow.auto.ru

    Авто.ру Москва — один из самых посещаемых автомобильных сайтов в российском интернете. У нас самая обширная база объявлений о продаже разных видов транспортных средств в Москве.

  • // The toString method. this.toString = function(){ return arr.join(''); } return false; } });