Commits

Anonymous committed 27498ba Merge

_

  • Participants
  • Parent commits 2f7f2aa, 676e732

Comments (0)

Files changed (3)

File crawler/http.js

 Class.prototype = {
    get: function(opt, callback)
    {
-      if(this.cpt < this.max)
+      if(this.max == 0 || this.cpt < this.max)
       {
          this.cpt++;
          this.doGet(opt, callback);
    },
    post: function(opt, data, callback)
    {
-      if(this.cpt < this.max)
+      if(this.max == 0 || this.cpt < this.max)
       {
          this.cpt++;
          this.doPost(opt, data, callback);

File website/routes/api.js

   , suggestPort =  8125;
 
  var jsHttp = require(__dirname + '/../../crawler/http.js');
- var jsHttpInstance = new jsHttp(10000);
+ var jsHttpInstance = new jsHttp(0);
 
 module.exports = function(app, engine, io){
 
     *
     */
    app.get('/api/filters/', function (req, res) {
-      res.json([{name:'pays', values:['US', 'France']}, {name:'other', values:['TEst', 'test']}]);
+      res.json([{name:'pays', values:['Canada', 'Etats-Unis', 'France', 'Italie', 'Portugal']}, {name:'Couleur', values:['rouge', 'blanc', 'rose']}]);
    });
 
 

File website/views/index.html

         return false; 
       });
 
-      $('.filter_item').click(function(e){
-        var v = $('#searchfield').val();
-        
-        $('#searchfield').val(v + 'toto');
-      });
+      
 
       var url = '/api/filters/';
       $.ajax({
                   var ul = $('<ul>').attr('class', 'simple');
                   ul.appendTo(div2);
                   for(var i=0; i < e.values.length;i++){
-                     console.log(e.values[i]);
                      var item = $('<li>');
                      item.appendTo(ul);
                      var item_a = $('<a>').attr('href', '#').attr('class', 'filter_item').append(e.values[i]);
+                     item_a.attr('onclick', "$('#searchfield').val($('#searchfield').val() + ' "+e.values[i]+"')");
                      item_a.appendTo(item);
                   }
              });