Methods

  • BrainJS: u.method()
  • BrainXML: <u>method()</u>
function User( ) {
this.isHolidayToday = function( ) {
  
     if (this.getHolidayToday()){
       return true;
     }
     return false;
  
};
this.isName = function(name) {
  
     if(name) {
       var lowerName = name.toLowerCase();
       for (var i in this.people) {
         if (this.people[i].name) {          
           if(this.people[i].name.toLowerCase() === lowerName){
             return true;
           }
         }
       }
     }
     return false;
  
};
this.isNewYearToday = function( ) {
  
     if (this.getHolidayToday() == "New Year's Day"){
       return true;
     }
     return false;
  
};
this.isNumber = function(n) {
    
    return !isNaN(parseFloat(n)) && isFinite(n);
};
this.isUserPlace = function(place) {
  
     if (place === undefined) {
       return false;
     }
     var geo;
     for ( geo in this.location){
       if (this.location[geo] == place) {
         return true;
       }
     }
     for ( geo in this.birthplace) {
       if (this.birthplace[geo] == place) {
         return true;
       }
     }
     return false;
  
};
this.lastMonth = function( ) {
     return this.monthOffset(-1);
  
};
this.listeningAnswer = function(qid, answer) {
    
     if (qid === undefined || answer === undefined){
       return this.listeningQuiz();
     }
     var lang = this.getPageLang(); 
     answer = encodeURIComponent (answer);
     var url = 'http://acobot.com/api/listening/answer/' + this.uid_key + '/' + lang + '/' + qid + '/' + answer;
     return sraix(url);
  
};
this.listeningQuiz = function(cont) {
  
     var to = this.getPageLang();
     if (!to){
       to = 'en';
     }
     var url = 'http://acobot.com/api/listening/quiz/' + this.uid_key + '/' + to;
     if (cont !== undefined){
       url += '/cont'; 
     }
     return sraix(url);
  
};
this.listeningReport = function( ) {
   
     var to = this.getPageLang();
     if (!to){
       to = 'en';
     }
     var url = 'http://acobot.com/api/listening/report/' + this.uid_key + '/' + to;
     return this.loadWebPage(url);
  
};
this.listeningScore = function(qid, answer) {
  
     if (qid === undefined || answer === undefined){
       return this.listeningQuiz();
     }
     var lang = this.getPageLang(); 
     answer = encodeURIComponent (answer);
     var url = 'http://acobot.com/api/listening/score/' + this.uid_key + '/' + lang + '/' + qid + '/' + answer + '/' + this.adCredits;
     return sraix(url);
  
};

Pages