Warning, /frameworks/ktexttemplate/examples/contacts/themes/gettext/dopey/grantlee/5.0/ratio_calculator.qs is written in an unsupported language. File is not indexed.

0001 
0002 function GetRatioNode(dob, salary, contextName)
0003 {
0004   this.dob = dob;
0005   this.salary = salary;
0006   this.contextName = contextName;
0007 
0008   this.render = function( context )
0009   {
0010     var dob = this.dob.resolve(context);
0011     var salary = this.salary.resolve(context);
0012     var today = new Date();
0013     var ageMS = today - dob;
0014     var ageYears = ageMS / (1000 * 60 * 60 * 24 * 365);
0015     var ratio = salary / ageYears;
0016     context.insert(this.contextName, ratio);
0017   }
0018 }
0019 
0020 function GetRatioNodeFactory( tagContent, parser )
0021 {
0022   var tagArgs = AbstractNodeFactory.smartSplit(tagContent);
0023   var node = new Node("GetRatioNode", FilterExpression(tagArgs[1]), FilterExpression(tagArgs[2]), tagArgs[4]);
0024   return node;
0025 }
0026 Library.addFactory("GetRatioNodeFactory", "get_ratio");