Subversion Repositories HomeAutomation

Rev

Rev 977 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1.  
  2. function OnlinePhonebook(callback)
  3. {
  4.     this.myHTTP = new HTTP();
  5.     this.myCallback = callback;
  6. }
  7.  
  8. OnlinePhonebook.prototype.myHTTP = null;
  9. OnlinePhonebook.prototype.myCallback = null;
  10.  
  11. OnlinePhonebook.prototype.lookup = function(phonenumber)
  12. {
  13.     var self = this;
  14.  
  15.     this.myHTTP.request(function(result, header, content) { self.httpCallback(result, header, content); }, "mobil.hitta.se/default.aspx?Who=" + phonenumber + "&Where=&PageAction=White");
  16. }
  17.  
  18. OnlinePhonebook.prototype.httpCallback = function(result, header, content)
  19. {
  20.     var persons = new Array();
  21.  
  22.     if (result.indexOf("200 OK") != -1)
  23.     {
  24.         ///FIXME: parse html
  25.     }
  26.    
  27.     this.myCallback(persons);
  28. }
  29.