Methods

  • BrainJS: u.method()
  • BrainXML: <u>method()</u>
function User( ) {
this.movieSynopsisByTitle = function(title) {
  
   
     if (title === undefined) {
       return 'acox movieSynopsis titleMissed';
     }
     title = encodeURIComponent(title);
     var url = 'http://acobot.com/api/movie/synopsis/title/'+title;
     return sraix(url);
  
};
this.msgMT = function(text, to) {
     if (text === undefined || text === null) {
       return 'acox msgMTError missText';
     }
     text = encodeURIComponent (text);
     text = text.replace(' ','%20');
     if(!to) {
        to = this.getTargetLangCode();
      }
     
     var url = 'http://acobot.com/api/mt_msg/' + text + '/' + to;   
     return sraix(url);
  
};
this.mt2 = function(text) {
  
     if (this.isTranslation === 'yes'){
       return 'acox mt2Response err';
     }
     this.isTranslation = 'yes';  
     if (text === undefined || text === null) {
       return 'acox mt2Response err';
     }
     text = encodeURIComponent (text);
     text = text.replace(' ','%20');    
     var url = 'http://acobot.com/api/';
     
     if (this.tip === 1){
       url = url + 'mt2learn/' + text;
     }
     else {
       url = url + 'mt2/' + text;
     }
     return sraix(url);
  
};
this.news = function(Query, NewsCategory, Market, NewsLocationOverride, Latitude, Longtitude) {
  
     var queries = "";
     if (Query){
       Query = encodeURIComponent (Query);
       queries += "Query=%27"+Query+"%27";
     }
     if (NewsCategory){
       queries += "&NewsCategory=%27"+NewsCategory+"%27";
     }
     if (NewsLocationOverride){
       queries += "&NewsLocationOverride=%27"+NewsLocationOverride+"%27";
     }
     if (Market){
       queries += "&Market=%27"+Market+"%27";
     }
     if (Latitude){
       queries += "&Latitude=%27"+Latitude+"%27";
     }
     if (Longtitude){
       queries += "&Latitude=%27"+Longtitude+"%27";
     }
     var url = "http://acobot.com/api/news?"+queries;
     return sraix(url);  
   
  
};
this.next = function( ) {
  
     this.pointer ++;
     return this.pointer;
  
};
this.nextDialog = function(lost) {
  
     if (this.reviewing) {
       if (this.reviews.length > 0) {
         return this.reviews.shift();
       }
       else if (this.reviewsNew.length > 0) {
         this.reviews = this.reviewsNew;
         this.reviewsNew = [];
         return this.reviews.shift();        
       }
       else {
         this.reviewing = 0;
       }
     }
     
     if (lost == 'lost') {
       this.dialogLost ++;
       if (this.dialogLost > 10) {
         this.dialog -= this.dialogLost;
         this.dialogLost = 0;
         return 'not found';
       }
     }
     else {
       this.dialogLost = 0;
     }
         
     if (isNaN(this.dialog)) {
       this.dialog = 0; 
     }
     this.dialog ++;    
     return this.dialog;
  
};
this.nextMonth = function( ) {
     return this.monthOffset(1);
  
};
this.occurrences = function(string, subString, allowOverlapping) {
  
       string+=""; subString+="";
       if (subString.length <= 0) return string.length+1;
   
       var n=0, pos=0;
       var step=(allowOverlapping)?(1):(subString.length);
   
       while (true){
           pos=string.indexOf(subString,pos);
           if(pos>=0){ n++; pos+=step; } else break;
       }
       return(n);
  
};
this.openingMovie = function(country) {
  
     var url = 'http://acobot.com/api/movie/opening/';
     if (country){
       country = encodeURIComponent(country);
       url = url + country;
     }
     return sraix(url);
  
};
this.p2ap = function(p) {
  
     switch(p){
       case 'i':
         return 'me';
       case 'you':
         return 'you';
       case 'he':
         return 'him';
       case 'she':
         return 'her';
       case 'it':
         return 'it';
       case 'we':
         return 'us';
       case 'they':
         return 'them';
       default:
         return p;
     }
  
};

Pages