Robot is coming into your home Watch

HucktheForde
Badges: 17
Rep:
?
#1
Report Thread starter 6 months ago
#1
// ==UserScript== // @name testing for policy validation 2 // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @include http://aiahk-fe.aia.biz/ews/ews/main.xhtml* // @grant none // ==/UserScript== function pol(polno,iss, ptd, curr) { this.polno = ""; this.iss = ""; this.ptd = ""; this.curr =""; this.riders =[]; } function rider(iss, name, sum, inforce, state, reason, balance) { this.iss = ""; this.name = ""; this.sum = ""; this.inforce = ""; this.state = ""; this.reason ="" this.balance = ""; } function prevpaid() { this.name = ""; this.sum = ""; this.curr = ""; this.pol = ""; } var past = []; var policies = []; //-----------------------------------------------------------------UDF---------------------------------------------------- function DateDiff(date1, date2) { var diff = Math.floor(( Date.parse(date2) - Date.parse(date1) ) / 86400000) +1; return diff; } function PolVal (zEvent) { //-----------------POLICY VALIDATION BEGINS HERE----------------------- policies = []; $('#ta1').val(""); $('a').each(function(index) { //click on eligbility if (index == 5 ) { $(this).click(); } }); //LOOP THROUGH ALL INPUTS var list = document.getElementsByTagName('i nput'); for(var i = 0; i < list.length; i++) { //for1 //FIND IF INPUT IS A POLICY if(list[i].type == 'text' && list[i].id.substring(0,55) == "mainTabViewrintForm:clmTabView:detailEligib iltyPanel:" && list[i].id.substring(list[i].id.length-11) == "olicynoel" ) { //if1 var n = list[i].id.replace(/[^0-9]/g,''); var iss = document.getElementById('mainTab ViewrintForm:clmTabView:detailEligib iltyPanel:' + n + ":appDate").value; var ptd = document.getElementById('mainTab ViewrintForm:clmTabView:detailEligib iltyPanel:' + n + ":currPtd").value; var cur = document.getElementById('mainTab ViewrintForm:clmTabView:detailEligib iltyPanel:' + n + ":currency").value; var p1 = new pol(iss, ptd, cur); p1.polno = list[i].value; p1.iss = iss; p1.ptd = ptd; p1.curr = cur; var tb = document.getElementById("mainTab ViewrintForm:clmTabView:detailEligib iltyPanel:" + n + ":j_idt149_data"); if (tb == null ) { tb = document.getElementById("mainTab ViewrintForm:clmTabView:detailEligib iltyPanel:" + n + ":j_idt147_data"); } var tr = tb.getElementsByTagName("tr"); for(var j = 0; j < tr.length; j++) { //LOOP THROUGH ALL RIDERS //for2 var td = tr[j].getElementsByTagName("td"); var plan = td[0].innerHTML; var sum = td[1].innerHTML; var eff = td[2].innerHTML; var inforce = td[3].innerHTML; var status = td[4].innerHTML; var reason = td[5].innerHTML; if (plan == "CPA2JN5") { if (cur == "USD") { sum = 500; }else { sum = 4000; } } if (plan == "CPA6PNI") { if (cur == "USD") { sum = 3000; }else { sum = 20000; } } if (plan == "CPA3HN6") { if (cur == "USD") { sum = 10000; }else { sum = 80000; } } if (plan == "CPAN3NN5") { if (cur == "USD") { sum = 2000; }else { sum = 15000; } } if (plan == "CPA3HN5") { if (cur == "USD") { sum = 1500; }else { sum = 12000; } } if (plan == "CPAMN6") { if (cur == "USD") { sum = 2000; }else { sum = 15000; } } if (plan == "CPA3NN5") { if (cur == "USD") { sum = 1500; }else { sum = 12000; } } if (plan == "CPAPNN5") { if (cur == "USD") { sum = 2000; }else { sum = 16000; } } if (plan == "CPA4JN5") { if (cur == "USD") { sum = 1000; }else { sum = 8000; } } if (plan == "CPAN3HN5") { if (cur == "USD") { sum = 2000; }else { sum = 16000; } } if (plan == "CPA9NNI") { if (cur == "USD") { sum = 4500; }else { sum = 36000; } } if (plan == "CPABN5") { if (cur == "USD") { sum = 1500; }else { sum = 12000; } } if (plan == "CPABN5") { if (cur == "USD") { sum = 1500; }else { sum = 12000; } } if (plan == "CPANJ2N5") { if (cur == "USD") { sum = 750; }else { sum = 6000; } } if (plan == "CPA4JNI") { if (cur == "USD") { sum = 1000; }else { sum = 7000; } } if (inforce == "INFORCE") { var r1 = new rider(eff,plan,sum,inforce,statu s,reason); r1.iss = eff; r1.sum = sum; r1.name = plan; r1.inforce = inforce; r1.state = status; r1.reason = reason; r1.balance = sum; p1.riders.push(r1); } // end of if status check } // end for for 2 if (p1.riders.length > 0 ) { policies.push(p1) } } //end for if 1 } // end of policy loop end of for 1 past = []; $('a').each(function(index) { if (index == 4 ) { $(this).click(); } }); var thead = document.getElementById("mainTab ViewrintForm:clmTabView:j_idt124_dat a"); if (thead == null) { thead = document.getElementById("mainTab ViewrintForm:clmTabView:j_idt122_dat a"); } if (thead != null) { var tbody = thead.getElementsByTagName("tr") ; for(var j = 0; j < tbody.length; j++) { //loop through all prev paid var td = tbody[j].getElementsByTagName("td"); var p = td[2].innerText; var plan = td[3].innerText; var curr = td[4].innerText; var amount = td[5].innerText; var h1 = new prevpaid() ; h1.name = plan; h1.sum = amount; h1.curr = curr h1.pol = p past.push(h1) } //BEGINNING OF DEDUCTING BALANCE for(var i = 0; i < past.length; i++) { for(var o = 0; o < policies.length; o++) { for(var u = 0; u < policies[o].riders.length; u++) { //alert("1 " + policies[o].riders[u].name + " " + past[i].name + " " + policies[o].polno + " " + past[i].pol) //alert("2 " + past[i].name) //alert("3 " + policies[o].polno + " " + past[i].pol) //alert("4 " + past[i].pol) if (policies[o].riders[u].name == past[i].name && policies[o].polno == past[i].pol) { policies[o].riders[u].balance = policies[o].riders[u].balance - past[i].sum; } } } } } // INSERT TEXT FOR POLICY VALIDATION INTO TEXTAREA for(var a = 0; a < policies.length; a++) { document.getElementById("ta1").v alue = document.getElementById("ta1").v alue + policies[a].polno + " iss:" + policies[a].iss + " ptd:" + policies[a].ptd + "\n"; for(var e = 0; e < policies[a].riders.length; e++) { var checkeffdate = ""; var checkbalance = ""; if (policies[a].riders[e].iss != policies[a].iss ) { checkeffdate = "eff:" + policies[a].riders[e].iss; } if (policies[a].riders[e].balance != policies[a].riders[e].sum) { checkbalance = "balance:" + Math.round(policies[a].riders[e].balance); } document.getElementById("ta1").v alue = document.getElementById("ta1").v alue + policies[a].riders[e].name + " " + policies[a].curr + policies[a].riders[e].sum + " " + checkeffdate + " " + checkbalance + "\n"; } document.getElementById("ta1").v alue = document.getElementById("ta1").v alue + "\n" } } //--------------------end of POLVAL ---------------- $('body').append("<table style = position:absolute>"); $('body').append("<tr><td><p>"); $('body').append("<input type = 'button' id='button1' value ='pol validation'> "); $('body').append("<input type = 'button' id='button2' value ='past amount'> "); $('body').append("<input type = 'button' id='button3' value ='Deduct'> "); $('body').append("</tr><td>"); $('body').append("<textarea rows='15' cols='40' id='ta1'></textarea>"); $('body').append("<textarea rows='15' cols='40' id='ta2'></textarea>"); $('body').append("</table>"); $("#button1").click (PolVal); $( document ).ready(function() { document.getElementById('topPane l').style.display = 'none'; });//end
Last edited by HucktheForde; 4 months ago
0
reply
Infinite Series
  • Answer Heroes
Badges: 20
Rep:
?
#2
Report 6 months ago
#2
I've seen this at the start of the year, and though it's quite cute, it's very expensive for what it does. It's not worth £200:noway:
0
reply
HucktheForde
Badges: 17
Rep:
?
#3
Report Thread starter 6 months ago
#3
(Original post by Grade A)
I've seen this at the start of the year, and though it's quite cute, it's very expensive for what it does. It's not worth £200:noway:
Vector is an upgrade to Cosmo, which has functions including connecting to the internet and find stuff to answer your question.

I imagine the coming version will be more and more powerful. Maybe one day we dont need human personal assistant anymore. These robots will sort out our schedule for us.
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Do you have a food intolerance or allergy?

Yes - a food intolerance (44)
12.32%
Yes - a food allergy (39)
10.92%
Yes - an autoimmune disorder (i.e coeliac, colitis) (11)
3.08%
Yes - I have an intolerance and allergy (9)
2.52%
No (254)
71.15%

Watched Threads

View All